|
@@ -763,6 +763,18 @@ static void getChillerTemperature(struct ChargingInfoData* chargingData)
|
|
|
|
|
|
void GetOtpPwrOrCurMethod(struct ChargingInfoData* chargingData, float* pow, float* cur)
|
|
|
{
|
|
|
+ for(int i = 0 ; i < 4 ; i++) {
|
|
|
+ if (ShmDcCommonData->SystemTemp[i] >= STAGE1_GUN_DERATING_TEMP &&
|
|
|
+ ShmDcCommonData->SystemTemp[i] < STAGE2_GUN_DERATING_TEMP &&
|
|
|
+ chargingData->deratingByConnOtp.deratingIndex < 1) {
|
|
|
+ chargingData->deratingByConnOtp.deratingIndex = 1;
|
|
|
+ } else if (ShmDcCommonData->SystemTemp[i] >= STAGE2_GUN_DERATING_TEMP &&
|
|
|
+ ShmDcCommonData->SystemTemp[i] != UNDEFINED_TEMP &&
|
|
|
+ chargingData->deratingByConnOtp.deratingIndex < 2) {
|
|
|
+ chargingData->deratingByConnOtp.deratingIndex = 2;
|
|
|
+ }
|
|
|
+ }
|
|
|
+ /*
|
|
|
if (((chargingData->ConnectorTemp >= STAGE1_GUN_DERATING_TEMP &&
|
|
|
chargingData->ConnectorTemp < STAGE2_GUN_DERATING_TEMP) ||
|
|
|
(chargingData->ChillerTemp >= STAGE1_GUN_DERATING_TEMP &&
|
|
@@ -778,7 +790,7 @@ void GetOtpPwrOrCurMethod(struct ChargingInfoData* chargingData, float* pow, flo
|
|
|
{
|
|
|
chargingData->deratingByConnOtp.deratingIndex = 2;
|
|
|
}
|
|
|
-
|
|
|
+ */
|
|
|
if (chargingData->deratingByConnOtp.deratingTargetRate[chargingData->deratingByConnOtp.deratingIndex] != 0)
|
|
|
{
|
|
|
*pow *= chargingData->deratingByConnOtp.deratingTargetRate[chargingData->deratingByConnOtp.deratingIndex];
|
|
@@ -804,6 +816,7 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
|
|
|
float deratingCurrent;
|
|
|
int derating_index = 0;
|
|
|
uint8_t PreviousSystemStatus[2] = {0xff};
|
|
|
+ int idx;
|
|
|
char *usageMsg = "Usage:\n"
|
|
|
" strchg <index> <voltage> <current> ex: strchg 0 150 2\n"
|
|
|
" chg <voltage> <current> ex: chg 500 100\n"
|
|
@@ -858,6 +871,7 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
|
|
|
pDcChargingInfo->ConnectorPlugIn = 1;
|
|
|
printf ("[UnconditionalCharge - S_IDLE]\n");
|
|
|
pDcChargingInfo->Type = 9;
|
|
|
+ sleep(1);
|
|
|
|
|
|
}
|
|
|
if (ShmOCPP16Data->SpMsg.bits.AuthorizeConf == 1) {
|
|
@@ -1010,23 +1024,26 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
|
|
|
// pDcChargingInfo->EvBatterytargetVoltage,
|
|
|
// pDcChargingInfo->EvBatterytargetCurrent);
|
|
|
//ev task do this
|
|
|
- if (pDcChargingInfo->deratingByConnOtp.isNeedDerating) {
|
|
|
- deratingCurrent = pDcChargingInfo->EvBatterytargetCurrent;
|
|
|
- deratingPower = pDcChargingInfo->AvailableChargingPower;
|
|
|
-
|
|
|
- getChillerTemperature(pDcChargingInfo);
|
|
|
- GetOtpPwrOrCurMethod(pDcChargingInfo, &deratingPower, &deratingCurrent);
|
|
|
- if (derating_index != pDcChargingInfo->deratingByConnOtp.deratingIndex) {
|
|
|
- printf("Change Derating Index:%d\n", pDcChargingInfo->deratingByConnOtp.deratingIndex);
|
|
|
- derating_index = pDcChargingInfo->deratingByConnOtp.deratingIndex;
|
|
|
- }
|
|
|
- if (pDcChargingInfo->EvBatterytargetCurrent != deratingCurrent ||
|
|
|
- pDcChargingInfo->AvailableChargingPower != deratingPower) {
|
|
|
- pDcChargingInfo->EvBatterytargetCurrent = deratingCurrent;
|
|
|
- pDcChargingInfo->AvailableChargingPower = deratingPower;
|
|
|
- printf("Derating Current:%.3f Power:%.3f\n", pDcChargingInfo->EvBatterytargetCurrent, pDcChargingInfo->AvailableChargingPower);
|
|
|
+ for (idx = 0; idx < pSysConfig->TotalConnectorCount; idx++) {
|
|
|
+ struct ChargingInfoData* pInfo = (struct ChargingInfoData*)GetDcChargingInfoData(idx);
|
|
|
+ if (pInfo->deratingByConnOtp.isNeedDerating) {
|
|
|
+ deratingCurrent = pInfo->EvBatterytargetCurrent;
|
|
|
+ deratingPower = pInfo->AvailableChargingPower;
|
|
|
+
|
|
|
+ getChillerTemperature(pInfo);
|
|
|
+ GetOtpPwrOrCurMethod(pInfo, &deratingPower, &deratingCurrent);
|
|
|
+ if (derating_index != pDcChargingInfo->deratingByConnOtp.deratingIndex) {
|
|
|
+ printf("Change Derating Index:%d\n", pInfo->deratingByConnOtp.deratingIndex);
|
|
|
+ derating_index = pInfo->deratingByConnOtp.deratingIndex;
|
|
|
+ }
|
|
|
+ if (pInfo->EvBatterytargetCurrent != deratingCurrent ||
|
|
|
+ pInfo->AvailableChargingPower != deratingPower) {
|
|
|
+ pInfo->EvBatterytargetCurrent = deratingCurrent;
|
|
|
+ pInfo->AvailableChargingPower = deratingPower;
|
|
|
+ printf("Derating Current:%.3f Power:%.3f\n", pInfo->EvBatterytargetCurrent, pInfo->AvailableChargingPower);
|
|
|
+ }
|
|
|
}
|
|
|
- }
|
|
|
+ } // for
|
|
|
|
|
|
pDcChargingInfo->PresentChargingPower =
|
|
|
((float)((pDcChargingInfo->PresentChargingVoltage) *
|
|
@@ -1078,9 +1095,9 @@ void RunUnconditionalChargeIndex1(char *v1, char *v2, char *v3)
|
|
|
pDcChargingInfo->PresentChargingPower = 0;
|
|
|
|
|
|
if (stopChg == pSysConfig->TotalConnectorCount) {
|
|
|
- ShmDcCommonData->debugflag = NO;
|
|
|
- ShmFanModuleData->TestFanSpeed = 0;
|
|
|
system("/root/Module_EvComm &");
|
|
|
+ ShmFanModuleData->TestFanSpeed = 0;
|
|
|
+ ShmDcCommonData->debugflag = NO;
|
|
|
sleep(3);
|
|
|
|
|
|
for (_GunIndex = 0; _GunIndex < pSysConfig->TotalConnectorCount; _GunIndex++) {
|
|
@@ -1470,7 +1487,7 @@ int main(void)
|
|
|
" lock <index> : get gun locked state\n"
|
|
|
" sysid : test system ID\n"
|
|
|
" self : self test state (x)\n"
|
|
|
- " version | v | -v : version of board (407 or relay or other)\n"
|
|
|
+ " ver| v | -v : version of board (407 or relay or other)\n"
|
|
|
" update : update firmware\n"
|
|
|
" ac : get ac relay state (x) \n"
|
|
|
" cable <index> <state> : set ground fault state\n"
|
|
@@ -1558,7 +1575,7 @@ int main(void)
|
|
|
} else if (strcmp(newString[0], "self") == 0) {
|
|
|
// CSU 自我檢測狀態
|
|
|
RunSelfProc(newString[1]);
|
|
|
- } else if (strcmp(newString[0], "version") == 0 ||
|
|
|
+ } else if (strcmp(newString[0], "ver") == 0 ||
|
|
|
strcmp(newString[0], "v") == 0 ||
|
|
|
strcmp(newString[0], "-v") == 0) {
|
|
|
//if (strcmp(newString[1], "-1") == 0 || strcmp(newString[1], "") == 0) {
|