|
@@ -2904,7 +2904,7 @@ void CANReceiver()
|
|
|
}
|
|
|
|
|
|
_chargingData[targetGun]->ConnectorPlugIn = frame.data[0];
|
|
|
- _chargingData[targetGun]->PilotVoltage = frame.data[1];
|
|
|
+ _chargingData[targetGun]->PilotState = frame.data[1];
|
|
|
|
|
|
//PRINTF_FUNC("index = %d, ConnectorPlugIn = %x, data[0] = %x \n", targetGun, _chargingData[targetGun]->ConnectorPlugIn, frame.data[0]);
|
|
|
//PRINTF_FUNC("ConnectorPlugIn = %x \n", (-120 + frame.data[1]) / 10);
|
|
@@ -2962,13 +2962,13 @@ void CANReceiver()
|
|
|
break;
|
|
|
case EV_Command_GetOutputReq:
|
|
|
{
|
|
|
- if ((_chargingData[targetGun]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE &&
|
|
|
- _chargingData[targetGun]->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
+ if ((_chargingData[targetGun]->SystemStatus >= SYS_MODE_PREPARE_FOR_EV &&
|
|
|
+ _chargingData[targetGun]->SystemStatus <= SYS_MODE_TERMINATING) ||
|
|
|
(_chargingData[targetGun]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 &&
|
|
|
_chargingData[targetGun]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
{
|
|
|
if (frame.data[1] > _chargingData[targetGun]->EvBatterySoc ||
|
|
|
- _chargingData[targetGun]->SystemStatus == SYS_MODE_CHARGING)
|
|
|
+ (_chargingData[targetGun]->SystemStatus >= SYS_MODE_CHARGING && _chargingData[targetGun]->SystemStatus <= SYS_MODE_COMPLETE))
|
|
|
_chargingData[targetGun]->EvBatterySoc = frame.data[1];
|
|
|
}
|
|
|
|
|
@@ -3045,7 +3045,7 @@ void CANReceiver()
|
|
|
case EV_Command_GetMiscellaneous:
|
|
|
{
|
|
|
_chargingData[targetGun]->GunLocked = frame.data[0];
|
|
|
- _chargingData[targetGun]->PilotVoltage = (float)(-120 + frame.data[3]) / 10;
|
|
|
+ _chargingData[targetGun]->PilotVoltage = (float)(-12 + frame.data[3]) / 10;
|
|
|
|
|
|
ShmDcCommonData->ConnectorTemp1[targetGun] = frame.data[1];
|
|
|
ShmDcCommonData->ConnectorTemp2[targetGun] = frame.data[2];
|
|
@@ -3093,8 +3093,10 @@ void CANReceiver()
|
|
|
{
|
|
|
if (ShmCcsData->CommProtocol == _CCS_COMM_V2GMessage_DIN70121)
|
|
|
{
|
|
|
- memset(ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID, 0, sizeof(ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID));
|
|
|
- memcpy(ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID, frame.data, frame.can_dlc);
|
|
|
+ memset(ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID,
|
|
|
+ 0, sizeof(ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID));
|
|
|
+ memcpy( ShmCcsData->V2GMessage_DIN70121[_chargingData[targetGun]->type_index].SessionSetupRequest.EVCCID,
|
|
|
+ frame.data, frame.can_dlc);
|
|
|
}
|
|
|
}
|
|
|
|
|
@@ -3102,7 +3104,7 @@ void CANReceiver()
|
|
|
frame.data[0], frame.data[1], frame.data[2], frame.data[3],
|
|
|
frame.data[4], frame.data[5]);
|
|
|
|
|
|
- PRINTF_FUNC("*******Gun %d->EVCCID = %s \n", targetGun, _chargingData[targetGun]->EVCCID);
|
|
|
+ PRINTF_FUNC("CCS - Gun %d->EVCCID = %s \n", targetGun, _chargingData[targetGun]->EVCCID);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
@@ -3122,8 +3124,11 @@ void CANReceiver()
|
|
|
// frame.data[0] : 0x01 => normal stop, 0x02 => ev emergency stop
|
|
|
if (frame.data[0] == 0x02)
|
|
|
{
|
|
|
- PRINTF_FUNC("Gun_%d, ** Emc Level **, Stop charging by EV. \n", targetGun);
|
|
|
- if (AbnormalStopAnalysis(targetGun, frame.data + 1))
|
|
|
+ PRINTF_FUNC("Gun_%d, ** Emc Level **, Stop charging by EV. SOC = %d \n",
|
|
|
+ targetGun,
|
|
|
+ _chargingData[targetGun]->EvBatterySoc);
|
|
|
+ if (AbnormalStopAnalysis(targetGun, frame.data + 1) &&
|
|
|
+ _chargingData[targetGun]->EvBatterySoc < 100)
|
|
|
{
|
|
|
_chargingData[targetGun]->StopChargeFlag = YES;
|
|
|
}
|
|
@@ -3141,6 +3146,66 @@ void CANReceiver()
|
|
|
_chargingData[targetGun]->NormalStopChargeFlag = YES;
|
|
|
}
|
|
|
}
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case EV_Command_VincodeData:
|
|
|
+ {
|
|
|
+ byte _tarPackage = frame.data[0];
|
|
|
+ byte _tarCount = 7;
|
|
|
+
|
|
|
+ if (_tarPackage <= ShmDcCommonData->gbtVincodeInfo[targetGun].packageCount)
|
|
|
+ {
|
|
|
+ if (_tarPackage == ShmDcCommonData->gbtVincodeInfo[targetGun].packageCount &&
|
|
|
+ _tarPackage != 0)
|
|
|
+ {
|
|
|
+ _tarCount = ShmDcCommonData->gbtVincodeInfo[targetGun].dataLen - ((_tarPackage - 1) * _tarCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ memcpy((char *)ShmDcCommonData->gbtVincodeInfo[targetGun].data + ((_tarPackage - 1) * 7),
|
|
|
+ (char *)frame.data + 1, _tarCount);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_tarPackage == ShmDcCommonData->gbtVincodeInfo[targetGun].packageCount)
|
|
|
+ {
|
|
|
+ byte chksum = 0;
|
|
|
+
|
|
|
+ for (int idx = 0; idx < ShmDcCommonData->gbtVincodeInfo[targetGun].dataLen; idx++)
|
|
|
+ chksum ^= ShmDcCommonData->gbtVincodeInfo[targetGun].data[idx];
|
|
|
+
|
|
|
+ if (chksum == ShmDcCommonData->gbtVincodeInfo[targetGun].checksum)
|
|
|
+ {
|
|
|
+ // 放到 GBT Vincode
|
|
|
+ PRINTF_FUNC("data = %s \n",
|
|
|
+ ShmDcCommonData->gbtVincodeInfo[targetGun].data);
|
|
|
+ PRINTF_FUNC("EV state = %d \n",
|
|
|
+ ShmGBTData->evse[_chargingData[targetGun]->type_index].EvboardStatus);
|
|
|
+
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ PRINTF_FUNC("GBT - Gun %d->Vincode = %s \n", targetGun, _chargingData[targetGun]->EVCCID);
|
|
|
+
|
|
|
+ if (strcmp((char *) _chargingData[targetGun]->EVCCID, "") == EQUAL
|
|
|
+ && _chargingData[targetGun]->Type == _Type_GB)
|
|
|
+ {
|
|
|
+ if (strlen((char*) ShmDcCommonData->gbtVincodeInfo[targetGun].data) > 0)
|
|
|
+ {
|
|
|
+ memcpy((char *) _chargingData[targetGun]->EVCCID, (char*) ShmDcCommonData->gbtVincodeInfo[targetGun].data,
|
|
|
+ sizeof(_chargingData[targetGun]->EVCCID));
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ }
|
|
|
+ break;
|
|
|
+ case EV_Command_VincodeInfo:
|
|
|
+ {
|
|
|
+ ShmDcCommonData->gbtVincodeInfo[targetGun].dataLen = (frame.data[1] << 8) + frame.data[0];
|
|
|
+ ShmDcCommonData->gbtVincodeInfo[targetGun].packageCount = frame.data[2];
|
|
|
+ ShmDcCommonData->gbtVincodeInfo[targetGun].checksum = frame.data[4];
|
|
|
+
|
|
|
+// PRINTF_FUNC("dataLen = %d, packageCount = %d, checksum = %x \n",
|
|
|
+// ShmDcCommonData->gbtVincodeInfo[targetGun].dataLen,
|
|
|
+// ShmDcCommonData->gbtVincodeInfo[targetGun].packageCount,
|
|
|
+// ShmDcCommonData->gbtVincodeInfo[targetGun].checksum);
|
|
|
}
|
|
|
break;
|
|
|
case EV_Command_SyncRtcInfo:
|
|
@@ -3215,7 +3280,7 @@ void SetPresentChargingOutputPower(struct ChargingInfoData *chargingData_1, stru
|
|
|
|
|
|
cur2 = (chargingData_2->PresentChargingCurrent * 10);
|
|
|
|
|
|
- if ((chargingData_1->SystemStatus >= SYS_MODE_PREPARING && chargingData_1->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
+ if ((chargingData_1->SystemStatus >= SYS_MODE_PREPARING && chargingData_1->SystemStatus <= SYS_MODE_ALARM) ||
|
|
|
(chargingData_1->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingData_1->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
{
|
|
|
if ((LogInfo[GUN_LEFT][EV_LOG_NOW_OUTPUT_VOL] >= vol1 + CHK_VOL_RANGE) || (LogInfo[GUN_LEFT][EV_LOG_NOW_OUTPUT_VOL] <= vol1 - CHK_VOL_RANGE) ||
|
|
@@ -3246,8 +3311,9 @@ void SetPresentChargingOutputPower(struct ChargingInfoData *chargingData_1, stru
|
|
|
curAllowCount[GUN_RIGHT] = 0;
|
|
|
}
|
|
|
|
|
|
- if ((chargingData_2->SystemStatus >= SYS_MODE_PREPARING && chargingData_2->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
- (chargingData_2->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingData_2->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
+ if (ShmSysConfigAndInfo->SysConfig.TotalConnectorCount > 1 &&
|
|
|
+ ((chargingData_2->SystemStatus >= SYS_MODE_PREPARING && chargingData_2->SystemStatus <= SYS_MODE_ALARM) ||
|
|
|
+ (chargingData_2->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && chargingData_2->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1)))
|
|
|
{
|
|
|
if ((LogInfo[GUN_RIGHT][EV_LOG_NOW_OUTPUT_VOL] >= vol2 + CHK_VOL_RANGE) || (LogInfo[GUN_RIGHT][EV_LOG_NOW_OUTPUT_VOL] <= vol2 - CHK_VOL_RANGE) ||
|
|
|
(LogInfo[GUN_RIGHT][EV_LOG_NOW_OUTPUT_CUR] >= cur2 + CHK_CUR_RANGE) || (LogInfo[GUN_RIGHT][EV_LOG_NOW_OUTPUT_CUR] <= cur2 - CHK_CUR_RANGE))
|
|
@@ -3258,7 +3324,6 @@ void SetPresentChargingOutputPower(struct ChargingInfoData *chargingData_1, stru
|
|
|
}
|
|
|
}
|
|
|
|
|
|
-
|
|
|
if (!_useOfflineNoCharging)
|
|
|
{
|
|
|
if (ShmSysConfigAndInfo->SysInfo.OcppConnStatus == NO &&
|
|
@@ -3463,6 +3528,7 @@ void Initialization()
|
|
|
void GetMaxVolAndCurMethod(byte index, float *vol, float *cur)
|
|
|
{
|
|
|
unsigned short configCurrent = ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent * 10;
|
|
|
+ unsigned short configVoltage = ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage * 10;
|
|
|
|
|
|
if (ShmSysConfigAndInfo->SysInfo.MainChargingMode == _MAIN_CHARGING_MODE_BOTH)
|
|
|
configCurrent /= 2;
|
|
@@ -3470,6 +3536,9 @@ void GetMaxVolAndCurMethod(byte index, float *vol, float *cur)
|
|
|
if (configCurrent != 0 && configCurrent < *cur)
|
|
|
*cur = configCurrent;
|
|
|
|
|
|
+ if (configVoltage != 0 && configVoltage < *vol)
|
|
|
+ *vol = configVoltage;
|
|
|
+
|
|
|
if (_chargingData[index]->ConnectorMaxVoltage != 0 &&
|
|
|
_chargingData[index]->ConnectorMaxVoltage <= *vol)
|
|
|
*vol = _chargingData[index]->ConnectorMaxVoltage;
|
|
@@ -3480,10 +3549,12 @@ void GetMaxVolAndCurMethod(byte index, float *vol, float *cur)
|
|
|
|
|
|
_chargingData [index]->CurrentOffered = *cur ;
|
|
|
|
|
|
- if (((_chargingData[index]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE && _chargingData[index]->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
- (_chargingData[index]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0 && _chargingData[index]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1)) &&
|
|
|
- _chargingData[index]->ChargingProfileCurrent >= 0 &&
|
|
|
- _chargingData[index]->ChargingProfileCurrent <= *cur)
|
|
|
+ if (((_chargingData[index]->SystemStatus >= SYS_MODE_PREPARE_FOR_EVSE
|
|
|
+ && _chargingData[index]->SystemStatus <= SYS_MODE_CHARGING) ||
|
|
|
+ (_chargingData[index]->SystemStatus >= SYS_MODE_CCS_PRECHARGE_STEP0
|
|
|
+ && _chargingData[index]->SystemStatus <= SYS_MODE_CCS_PRECHARGE_STEP1))
|
|
|
+ && _chargingData[index]->ChargingProfileCurrent >= 0
|
|
|
+ && _chargingData[index]->ChargingProfileCurrent <= *cur)
|
|
|
{
|
|
|
*cur = _chargingData[index]->ChargingProfileCurrent;
|
|
|
}
|
|
@@ -3710,7 +3781,7 @@ byte GetStopChargingReasonByEvse(byte gunIndex, byte *reason)
|
|
|
return result;
|
|
|
}
|
|
|
|
|
|
-void SendCommunicationOnly(byte index)
|
|
|
+void SetPermissionProc(byte index, byte param)
|
|
|
{
|
|
|
byte targetID = _chargingData[index]->Evboard_id;
|
|
|
|
|
@@ -3721,38 +3792,20 @@ void SendCommunicationOnly(byte index)
|
|
|
targetID += 1;
|
|
|
}
|
|
|
|
|
|
- SetChargingPermission(index, COMMUNICATION,
|
|
|
- _chargingData[index]->AvailableChargingPower,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- targetID);
|
|
|
-}
|
|
|
-
|
|
|
-void SendStopOnly(byte index)
|
|
|
-{
|
|
|
- byte targetID = _chargingData[index]->Evboard_id;
|
|
|
-
|
|
|
- if (gun_count == 1 &&
|
|
|
- _chargingData[index]->Type == _Type_CCS &&
|
|
|
- ShmDcCommonData->CcsVersion == _CCS_VERSION_CHECK_TAG_V015S0)
|
|
|
+ float _maxVol = _chargingData[index]->ConnectorMaxVoltage;
|
|
|
+ if (ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage != 0 &&
|
|
|
+ _maxVol > ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage)
|
|
|
{
|
|
|
- targetID += 1;
|
|
|
+ _maxVol = ShmSysConfigAndInfo->SysConfig.MaxChargingVoltage;
|
|
|
}
|
|
|
|
|
|
- SetChargingPermission(index, STOP,
|
|
|
- _chargingData[index]->AvailableChargingPower,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- targetID);
|
|
|
-}
|
|
|
|
|
|
-void InitialConnectorStatus(byte index)
|
|
|
-{
|
|
|
- SetChargingPermission(index, INITIALIZATION,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- 0,
|
|
|
- _chargingData[index]->Evboard_id);
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ SetChargingPermission (index, param,
|
|
|
+ ShmPsuData->SystemAvailablePower,
|
|
|
+ _chargingData[index]->ConnectorMaxCurrent,
|
|
|
+ _maxVol,
|
|
|
+ targetID);
|
|
|
}
|
|
|
|
|
|
void SetDertingInfo(byte _index)
|
|
@@ -3761,6 +3814,7 @@ void SetDertingInfo(byte _index)
|
|
|
{
|
|
|
case 'S':
|
|
|
{
|
|
|
+ // Chademo
|
|
|
_chargingData [_index]->deratingByConnOtp.isNeedDerating = YES;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [0] = 0;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [1] = 0;
|
|
@@ -3775,8 +3829,26 @@ void SetDertingInfo(byte _index)
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingIndex = 0;
|
|
|
}
|
|
|
break;
|
|
|
+ case 'W':
|
|
|
+ {
|
|
|
+ // Chademo
|
|
|
+ _chargingData [_index]->deratingByConnOtp.isNeedDerating = YES;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetRate [0] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetRate [1] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetRate [2] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetRate [3] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetRate [4] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetCurrent [0] = 3500;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetCurrent [1] = 2000;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetCurrent [2] = 2000;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetCurrent [3] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingTargetCurrent [4] = 0;
|
|
|
+ _chargingData [_index]->deratingByConnOtp.deratingIndex = 0;
|
|
|
+ }
|
|
|
+ break;
|
|
|
case 'K':
|
|
|
{
|
|
|
+ // Chademo
|
|
|
_chargingData [_index]->deratingByConnOtp.isNeedDerating = YES;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [0] = 1;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [1] = 0.8;
|
|
@@ -3786,9 +3858,10 @@ void SetDertingInfo(byte _index)
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingIndex = 0;
|
|
|
}
|
|
|
break;
|
|
|
- case 'T' :
|
|
|
- case 'D' :
|
|
|
+ case 'I' :
|
|
|
+ case 'Q' :
|
|
|
{
|
|
|
+ // CCS
|
|
|
_chargingData [_index]->deratingByConnOtp.isNeedDerating = YES;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [0] = 0;
|
|
|
_chargingData [_index]->deratingByConnOtp.deratingTargetRate [1] = 0;
|
|
@@ -3949,7 +4022,9 @@ void FormatVoltageAndCurrent()
|
|
|
{
|
|
|
if (_chargingData[_index]->Type == _Type_Chademo)
|
|
|
{
|
|
|
- if (_chargingData[_index]->ModelType == 'K' ||
|
|
|
+ if (_chargingData[_index]->ModelType == 'W')
|
|
|
+ _chargingData[_index]->ConnectorMaxCurrent = 3500;
|
|
|
+ else if (_chargingData[_index]->ModelType == 'K' ||
|
|
|
_chargingData[_index]->ModelType == 'S')
|
|
|
_chargingData[_index]->ConnectorMaxCurrent = 2000;
|
|
|
else if (_chargingData[_index]->ModelType == 'J' &&
|
|
@@ -3963,9 +4038,12 @@ void FormatVoltageAndCurrent()
|
|
|
if (_chargingData [_index]->ModelType == 'V' ||
|
|
|
_chargingData [_index]->ModelType == 'F')
|
|
|
_chargingData[_index]->ConnectorMaxCurrent = 5000;
|
|
|
- if (_chargingData[_index]->ModelType == 'T' ||
|
|
|
- _chargingData[_index]->ModelType == 'D')
|
|
|
+ else if (_chargingData[_index]->ModelType == 'I' ||
|
|
|
+ _chargingData[_index]->ModelType == 'Q')
|
|
|
_chargingData[_index]->ConnectorMaxCurrent = 5000;
|
|
|
+ else if (_chargingData[_index]->ModelType == 'T' ||
|
|
|
+ _chargingData[_index]->ModelType == 'D')
|
|
|
+ _chargingData[_index]->ConnectorMaxCurrent = 3000;
|
|
|
else if (_chargingData[_index]->ModelType == 'R')
|
|
|
_chargingData[_index]->ConnectorMaxCurrent = 2500;
|
|
|
else
|
|
@@ -4018,10 +4096,10 @@ void CalOutputPowerAndEnergy(int _index)
|
|
|
{
|
|
|
// DC Meter
|
|
|
if (ShmCsuMeterData->_meter[_index].curMeterValue == 0)
|
|
|
- ShmCsuMeterData->_meter[_index].curMeterValue = ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy;
|
|
|
+ ShmCsuMeterData->_meter[_index].curMeterValue = (float)ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy;
|
|
|
else
|
|
|
{
|
|
|
- if (ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy > ShmCsuMeterData->_meter[_index].curMeterValue)
|
|
|
+ if ((float)ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy > ShmCsuMeterData->_meter[_index].curMeterValue)
|
|
|
{
|
|
|
ShmCsuMeterData->_meter[_index]._curTotalCharging += ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy - ShmCsuMeterData->_meter[_index].curMeterValue;
|
|
|
float totalChargingValue = ShmCsuMeterData->_meter[_index]._curTotalCharging;
|
|
@@ -4041,7 +4119,7 @@ void CalOutputPowerAndEnergy(int _index)
|
|
|
_chargingData[_index]->ChargingFee = totalChargingValue * ShmSysConfigAndInfo->SysConfig.BillingData.Cur_fee;
|
|
|
}
|
|
|
|
|
|
- ShmCsuMeterData->_meter[_index].curMeterValue = ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy;
|
|
|
+ ShmCsuMeterData->_meter[_index].curMeterValue = (float)ShmSysConfigAndInfo->SysInfo.DcMeterInfo[_index].totlizeImportEnergy;
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4109,9 +4187,9 @@ void InitTimeToPrintLog()
|
|
|
|
|
|
void AuthorizeByCcid(byte _index)
|
|
|
{
|
|
|
- if (_chargingData[_index]->Type == _Type_CCS &&
|
|
|
- _chargingData [_index]->IsAvailable &&
|
|
|
- ShmDcCommonData->enObtainAuthorizbyCCID &&
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ //if ((_chargingData[_index]->Type == _Type_CCS || _chargingData[_index]->Type == _Type_GB)&&
|
|
|
+ if( _chargingData [_index]->IsAvailable && ShmDcCommonData->enObtainAuthorizbyCCID &&
|
|
|
strcmp ( (char *) _chargingData[_index]->StartUserId, "") == EQUAL)
|
|
|
{
|
|
|
if (_chargingData [_index]->ConnectorPlugIn)
|
|
@@ -4132,7 +4210,7 @@ void AuthorizeByCcid(byte _index)
|
|
|
|
|
|
if (strcmp ( (char *) _chargingData [_index]->EVCCID, "" ) == EQUAL)
|
|
|
{
|
|
|
- SendCommunicationOnly ( _index );
|
|
|
+ SetPermissionProc(_index, COMMUNICATION);
|
|
|
GetEvccIdReq ( _index, targetID);
|
|
|
}
|
|
|
else
|
|
@@ -4140,17 +4218,32 @@ void AuthorizeByCcid(byte _index)
|
|
|
}
|
|
|
else if (ShmDcCommonData->_authWithCcidFlag [_index] == _CCID_AUTHFAIL)
|
|
|
{
|
|
|
- SendStopOnly ( _index );
|
|
|
+ SetPermissionProc(_index, STOP);
|
|
|
strcpy ( (char *) _chargingData [_index]->EVCCID, "" );
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
{
|
|
|
- SendStopOnly ( _index );
|
|
|
+ SetPermissionProc(_index, STOP);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
|
|
|
|
+//LW_GBT_EVCCID
|
|
|
+bool WaitStartTransactionResult(byte _index)
|
|
|
+{
|
|
|
+ bool result = NO;
|
|
|
+
|
|
|
+ //Condition: (1)Enable auth by RFID or Remote start. (2)Enable auth by CCID and gun type was ccs
|
|
|
+ //Note: GBT type's CCID was authorized at SYS_MODE_PREPARE_FOR_EV state.
|
|
|
+
|
|
|
+ if (ShmDcCommonData->startTransactionFlag[_index] == START_TRANSATION_STATUS_WAIT
|
|
|
+ && (!ShmDcCommonData->enObtainAuthorizbyCCID || _chargingData[_index]->Type == _Type_CCS))
|
|
|
+ result = YES;
|
|
|
+
|
|
|
+ return result;
|
|
|
+}
|
|
|
+
|
|
|
void SampleOutputVoltage()
|
|
|
{
|
|
|
for (byte group = 0; group < ShmPsuData->GroupCount; group++)
|
|
@@ -4246,7 +4339,7 @@ int main(int argc, char *argv[])
|
|
|
}
|
|
|
|
|
|
if (ShmDcCommonData->evBoardResetFlag)
|
|
|
- InitialConnectorStatus(_index);
|
|
|
+ SetPermissionProc(_index, INITIALIZATION);
|
|
|
}
|
|
|
else if (_chargingData[_index]->Type == _Type_GB)
|
|
|
{
|
|
@@ -4258,7 +4351,7 @@ int main(int argc, char *argv[])
|
|
|
}
|
|
|
|
|
|
if (ShmDcCommonData->evBoardResetFlag)
|
|
|
- InitialConnectorStatus(_index);
|
|
|
+ SetPermissionProc(_index, INITIALIZATION);
|
|
|
}
|
|
|
else if (_chargingData[_index]->Type == _Type_CCS)
|
|
|
{
|
|
@@ -4306,7 +4399,7 @@ int main(int argc, char *argv[])
|
|
|
{
|
|
|
chkChademoPermission[_index] = true;
|
|
|
GetTimespecFunc(&_chk_chademo_permission_timeout[_index]);
|
|
|
- SendStopOnly(_index);
|
|
|
+ SetPermissionProc(_index, STOP);
|
|
|
chkChademoPermissionSend[_index] = NO;
|
|
|
}
|
|
|
else
|
|
@@ -4322,7 +4415,7 @@ int main(int argc, char *argv[])
|
|
|
if (chkChademoPermissionSend[_index] == NO)
|
|
|
{
|
|
|
chkChademoPermissionSend[_index] = YES;
|
|
|
- SendCommunicationOnly(_index);
|
|
|
+ SetPermissionProc(_index, COMMUNICATION);
|
|
|
}
|
|
|
if (_timeBuf > 10)
|
|
|
{
|
|
@@ -4336,12 +4429,10 @@ int main(int argc, char *argv[])
|
|
|
else if (chkChademoPermission[_index])
|
|
|
{
|
|
|
chkChademoPermission[_index] = false;
|
|
|
- //SendStopOnly(_index);
|
|
|
}
|
|
|
|
|
|
if (ShmDcCommonData->ConnectErrList[_index].GunBits.ChaConnectOTP == NO)
|
|
|
_chargingData[_index]->StopChargeFlag = NO;
|
|
|
-
|
|
|
}
|
|
|
else if (_chargingData[_index]->Type == _Type_GB)
|
|
|
{
|
|
@@ -4385,7 +4476,8 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
// 使用 Meter 狀況
|
|
|
if(ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'M' ||
|
|
|
- ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L')
|
|
|
+ ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'L' ||
|
|
|
+ ShmSysConfigAndInfo->SysConfig.ModelName[3] == 'P')
|
|
|
{
|
|
|
if (ShmCsuMeterData->_meter[_index].isCalculation == NO)
|
|
|
{
|
|
@@ -4426,17 +4518,17 @@ int main(int argc, char *argv[])
|
|
|
break;
|
|
|
case SYS_MODE_PREPARE_FOR_EV:
|
|
|
{
|
|
|
- AuthorizeByCcid(_index);
|
|
|
+ if(_chargingData[_index]->Type == _Type_CCS)
|
|
|
+ AuthorizeByCcid(_index);
|
|
|
|
|
|
- if (ShmDcCommonData->startTransactionFlag[_index] == START_TRANSATION_STATUS_WAIT)
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ if (WaitStartTransactionResult(_index) == YES)
|
|
|
continue;
|
|
|
|
|
|
+ //LW_GBT_EVCCID ..
|
|
|
if (_chargingData[_index]->Type == _Type_CCS)
|
|
|
GetEvccIdReq(_index, targetID);
|
|
|
|
|
|
- // 開始確認車端是否同意開始充電 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
|
|
|
- GetOutputReq(_index, targetID);
|
|
|
-
|
|
|
// 設定當前輸出
|
|
|
if (gun_count == 1)
|
|
|
SetPresentChargingOutputPower(_chargingData[GUN_LEFT], _chargingData[GUN_LEFT]);
|
|
@@ -4458,18 +4550,20 @@ int main(int argc, char *argv[])
|
|
|
LogInfo[_index][EV_LOG_EVSE_MAX_VOL] = maxVol;
|
|
|
LogInfo[_index][EV_LOG_EVSE_MAX_CUR] = ShmPsuData->SystemAvailableCurrent;
|
|
|
|
|
|
- PRINTF_FUNC("To EV_%d Max_Vol = %.1f, Cap_Cur = %d (A), Cap_Pow = %d (KW) \n",
|
|
|
- _index, maxVol / 10, ShmPsuData->SystemAvailableCurrent / 10, ShmPsuData->SystemAvailablePower / 10);
|
|
|
+ PRINTF_FUNC("To EV_%d Max_Vol = %.1f, Sys_Cur = %d (A), Sys_Pow = %d (KW), Cap_Cur = %.1f (A) \n",
|
|
|
+ _index, maxVol / 10, ShmPsuData->SystemAvailableCurrent / 10, ShmPsuData->SystemAvailablePower / 10,
|
|
|
+ maxCur / 10);
|
|
|
}
|
|
|
|
|
|
_chargingData[_index]->RealMaxVoltage = maxVol;
|
|
|
- SetChargingPermission ( _index, START,
|
|
|
- ShmPsuData->SystemAvailablePower,
|
|
|
- ShmPsuData->SystemAvailableCurrent,
|
|
|
- maxVol, targetID);
|
|
|
+
|
|
|
+ SetPermissionProc(_index, START);
|
|
|
|
|
|
// 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
|
|
|
GetEvBatteryInfo(_index, targetID);
|
|
|
+
|
|
|
+ // 開始確認車端是否同意開始充電 : 1.SOC, 2.Target Vol, 3.Target Cur, 4.Charging remaining time
|
|
|
+ GetOutputReq(_index, targetID);
|
|
|
}
|
|
|
GetTimespecFunc(&_chk_ratingPower_timeout[_index]);
|
|
|
}
|
|
@@ -4477,7 +4571,11 @@ int main(int argc, char *argv[])
|
|
|
case SYS_MODE_PREPARE_FOR_EVSE:
|
|
|
case SYS_MODE_CCS_PRECHARGE_STEP0:
|
|
|
case SYS_MODE_CCS_PRECHARGE_STEP1:
|
|
|
- {
|
|
|
+ {
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ if (_chargingData[_index]->Type == _Type_GB)
|
|
|
+ GetEvccIdReq(_index, targetID);
|
|
|
+
|
|
|
// 開始確認車端是否同意開始充電
|
|
|
GetOutputReq(_index, targetID);
|
|
|
|
|
@@ -4489,9 +4587,6 @@ int main(int argc, char *argv[])
|
|
|
|
|
|
if (priorityLow % 5 == 1)
|
|
|
{
|
|
|
- if (_chargingData[_index]->Type == _Type_CCS)
|
|
|
- GetEvccIdReq(_index, targetID);
|
|
|
-
|
|
|
// 取得車端電池資訊 : 1.AC or DC ? 2.Total battery cap, 3.Max battery vol, 4.Max battery cur
|
|
|
GetEvBatteryInfo(_index, targetID);
|
|
|
|
|
@@ -4505,7 +4600,8 @@ int main(int argc, char *argv[])
|
|
|
if (LogInfo[_index][EV_LOG_MAX_BATT_VOL] != _chargingData[_index]->EvBatteryMaxVoltage)
|
|
|
{
|
|
|
LogInfo[_index][EV_LOG_MAX_BATT_VOL] = _chargingData[_index]->EvBatteryMaxVoltage;
|
|
|
- PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index, _chargingData[_index]->EvBatteryMaxVoltage);
|
|
|
+ PRINTF_FUNC("index = %d, Ev Maximum Battery Voltage = %f \n", _index,
|
|
|
+ _chargingData[_index]->EvBatteryMaxVoltage);
|
|
|
}
|
|
|
|
|
|
if (LogInfo[_index][EV_LOG_SOC] != _chargingData[_index]->EvBatterySoc)
|
|
@@ -4517,63 +4613,66 @@ int main(int argc, char *argv[])
|
|
|
// 持續通知 Isolation 測試狀態
|
|
|
if (priorityLow == 1)
|
|
|
{
|
|
|
- // 拉 500 V 如果在一秒鐘內 GFD 都符合則 PASS
|
|
|
-// if (_chargingData[_index]->FireChargingVoltage >= 3500)
|
|
|
-// _chargingData[_index]->GroundFaultStatus = GFD_PASS;
|
|
|
+ unsigned char _result = _chargingData[_index]->GroundFaultStatus;
|
|
|
|
|
|
- //PRINTF_FUNC("To EV_%d GFD = %d \n", _index, _chargingData[_index]->GroundFaultStatus);
|
|
|
- //if(_chargingData[_index]->GroundFaultStatus != GFD_WAIT)
|
|
|
+ // GB & Chademo ~ Warning 也先算 Pass,因為 CCS 認證會驗 Warning 故不可更動
|
|
|
+ if (_chargingData[_index]->Type == _Type_Chademo ||
|
|
|
+ _chargingData[_index]->Type == _Type_GB)
|
|
|
{
|
|
|
- //if ((GetTimeoutValue(_derating_time) / 1000) > 1000)
|
|
|
- unsigned char _result = _chargingData[_index]->GroundFaultStatus;
|
|
|
-
|
|
|
- // GB & Chademo ~ Warning 也先算 Pass,因為 CCS 認證會驗 Warning 故不可更動
|
|
|
- if(_chargingData[_index]->Type == _Type_Chademo ||
|
|
|
- _chargingData[_index]->Type == _Type_GB)
|
|
|
+ if (_result == GFD_WARNING)
|
|
|
{
|
|
|
- if (_result == GFD_WARNING)
|
|
|
- {
|
|
|
- _result = GFD_PASS;
|
|
|
- }
|
|
|
+ _result = GFD_PASS;
|
|
|
}
|
|
|
+ }
|
|
|
|
|
|
- if (_result == GFD_WARNING || _result == GFD_PASS)
|
|
|
+ if (_result == GFD_WARNING || _result == GFD_PASS)
|
|
|
+ {
|
|
|
+ _timeBuf = GetTimeoutValue(&_chk_ratingPower_timeout[_index]);
|
|
|
+ if (_timeBuf < 0)
|
|
|
{
|
|
|
- _timeBuf = GetTimeoutValue(&_chk_ratingPower_timeout[_index]);
|
|
|
- if (_timeBuf < 0)
|
|
|
+ GetTimespecFunc(&_chk_ratingPower_timeout[_index]);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ if ((_timeBuf > 6 &&
|
|
|
+ _chargingData[_index]->RealRatingPower > 0) ||
|
|
|
+ _timeBuf > 14)
|
|
|
{
|
|
|
- GetTimespecFunc(&_chk_ratingPower_timeout[_index]);
|
|
|
+ PRINTF_FUNC("Conn %d, RealRatingPower = %d (KW) \n",
|
|
|
+ _index, _chargingData[_index]->RealRatingPower / 10);
|
|
|
}
|
|
|
else
|
|
|
- {
|
|
|
- if ((_timeBuf > 6 &&
|
|
|
- _chargingData[_index]->RealRatingPower > 0) ||
|
|
|
- _timeBuf > 14)
|
|
|
- {
|
|
|
- PRINTF_FUNC("Conn %d, RealRatingPower = %d (KW) \n",
|
|
|
- _index, _chargingData[_index]->RealRatingPower / 10);
|
|
|
- }
|
|
|
- else
|
|
|
- _result = GFD_WAIT;
|
|
|
- }
|
|
|
+ _result = GFD_WAIT;
|
|
|
}
|
|
|
-
|
|
|
- if (_result != GFD_WAIT)
|
|
|
- SetIsolationStatus(_index, _result, targetID);
|
|
|
}
|
|
|
|
|
|
- if(_chargingData[_index]->SystemStatus == SYS_MODE_CCS_PRECHARGE_STEP0 &&
|
|
|
- _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
|
|
|
- {
|
|
|
- SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, targetID);
|
|
|
- }
|
|
|
+ if (_result != GFD_WAIT)
|
|
|
+ SetIsolationStatus(_index, _result, targetID);
|
|
|
+ }
|
|
|
+
|
|
|
+ if (_chargingData[_index]->SystemStatus == SYS_MODE_CCS_PRECHARGE_STEP0 &&
|
|
|
+ _chargingData[_index]->PrechargeStatus == PRECHARGE_READY)
|
|
|
+ {
|
|
|
+ SetEvsePrechargeInfo(_index, PRECHARGE_PRERELAY_PASS, targetID);
|
|
|
+ }
|
|
|
+
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ if (_chargingData[_index]->Type == _Type_GB)
|
|
|
+ AuthorizeByCcid(_index);
|
|
|
+
|
|
|
+ //LW_GBT_EVCCID
|
|
|
+ if (ShmDcCommonData->startTransactionFlag[_index] == START_TRANSATION_STATUS_PASS
|
|
|
+ && _chargingData[_index]->Type == _Type_GB)
|
|
|
+ {
|
|
|
+ SetPermissionProc(_index, START);
|
|
|
}
|
|
|
}
|
|
|
break;
|
|
|
case SYS_MODE_CHARGING:
|
|
|
{
|
|
|
// 當前 Power
|
|
|
- _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage) * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
|
|
|
+ _chargingData[_index]->PresentChargingPower = ((float)((_chargingData[_index]->PresentChargingVoltage)
|
|
|
+ * (_chargingData[_index]->PresentChargingCurrent)) / 1000);
|
|
|
|
|
|
CalOutputPowerAndEnergy(_index);
|
|
|
|
|
@@ -4662,7 +4761,8 @@ int main(int argc, char *argv[])
|
|
|
byte normalStop = 0x01;
|
|
|
byte stopReason[7] = { 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 };
|
|
|
|
|
|
- if (GetStopChargingReasonByEvse(_index, stopReason))
|
|
|
+ if (GetStopChargingReasonByEvse(_index, stopReason) ||
|
|
|
+ _chargingData[_index]->StopChargeFlag)
|
|
|
{
|
|
|
normalStop = 0x02;
|
|
|
}
|
|
@@ -4697,11 +4797,7 @@ int main(int argc, char *argv[])
|
|
|
maxCur = _chargingData[_index]->AvailableChargingCurrent;
|
|
|
|
|
|
GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
|
|
|
- SetChargingPermission(_index, STOP,
|
|
|
- _chargingData[_index]->AvailableChargingPower,
|
|
|
- maxCur,
|
|
|
- maxVol,
|
|
|
- targetID);
|
|
|
+ SetPermissionProc(_index, STOP);
|
|
|
}
|
|
|
}
|
|
|
}
|
|
@@ -4723,11 +4819,7 @@ int main(int argc, char *argv[])
|
|
|
maxCur = _chargingData[_index]->AvailableChargingCurrent;
|
|
|
|
|
|
GetMaxVolAndCurMethod(_index, &maxVol, &maxCur);
|
|
|
- SetChargingPermission(_index, STOP,
|
|
|
- _chargingData[_index]->AvailableChargingPower,
|
|
|
- maxCur,
|
|
|
- maxVol,
|
|
|
- targetID);
|
|
|
+ SetPermissionProc(_index, STOP);
|
|
|
}
|
|
|
}
|
|
|
break;
|