Browse Source

[Workaround][DM30][DW30][CHAdeMO] Workaround for CHAdeMO adapter of Tesla, add CHAdeMO communication permission retry function.

2020.08.20 / TC Hsu

Actions: Add CHAdeMO communication permission retry function to Module_EvComm.c for CHAdeMO adapter of Tesla. When user swipe the RFID or charger get remote start command, charger will enter wait for plug state, DCM will call the SendCommunicationOnly() function, it will setup communication permission to CHAdeMO EV board, CHAdeMO EV board should try to communication with EV periodly, if communication is successful, start charging procedure.

Image version    : N/A
Image checksum   : N/A

Hardware PWB P/N : N/A
Hardware Version : N/A

Files:

	modified:   EVSE/Projects/DM30/Apps/Module_EvComm.c
	modified:   EVSE/Projects/DW30/Apps/Module_EvComm.c
TC_Hsu 4 years ago
parent
commit
2bdc77f853
2 changed files with 90 additions and 2 deletions
  1. 45 1
      EVSE/Projects/DM30/Apps/Module_EvComm.c
  2. 45 1
      EVSE/Projects/DW30/Apps/Module_EvComm.c

+ 45 - 1
EVSE/Projects/DM30/Apps/Module_EvComm.c

@@ -36,6 +36,7 @@
 #define FAIL                -1
 #define START               1
 #define STOP                0
+#define COMMUNICATION       2
 #define YES                 1
 #define NO                  0
 #define EQUAL               0
@@ -49,7 +50,6 @@ struct CcsData                  *ShmCcsData;
 
 byte gun_count;
 int chargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
-struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
 float _pow_1 = 0;
 float _cur_1 = 0;
@@ -72,6 +72,9 @@ float maxChargingPow = 0;                           // 限制最大充電能量
 
 // 槍資訊
 struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+struct timeval _chk_chademo_permission_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+bool chkChademoPermission[2] = { false, false };
 
 struct Ev_Board_Cmd Ev_Cmd={
         0,
@@ -3205,6 +3208,24 @@ byte GetStopChargingReasonByEvse(byte gunIndex, byte *reason)
     return result;
 }
 
+void SendCommunicationOnly(byte index)
+{
+    SetChargingPermission(index, COMMUNICATION,
+        _chargingData[index]->AvailableChargingPower,
+        0,
+        0,
+        _chargingData[index]->Evboard_id);
+}
+
+void SendStopOnly(byte index)
+{
+    SetChargingPermission(index, STOP,
+        _chargingData[index]->AvailableChargingPower,
+        0,
+        0,
+        _chargingData[index]->Evboard_id);
+}
+
 int main(int argc, char *argv[])
 {
     if(InitShareMemory() == FAIL)
@@ -3272,6 +3293,28 @@ int main(int argc, char *argv[])
                     if (_chargingData[_index]->Type == _Type_Chademo)
                     {
                         ClearAbnormalStatus_Chademo(_index);
+                        if (ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
+                        {
+                            if (!chkChademoPermission[_index])
+                            {
+                                chkChademoPermission[_index] = true;
+                                gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
+                                SendCommunicationOnly(_index);
+                            }
+                            else
+                            {
+                                if (GetTimeoutValue(_chk_chademo_permission_timeout[_index]) / 1000 > 10000)
+                                {
+                                    SendCommunicationOnly(_index);
+                                    gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
+                                }
+                            }
+                        }
+                        else if (chkChademoPermission[_index])
+                        {
+                            chkChademoPermission[_index] = false;
+                            SendStopOnly(_index);
+                        }
                     }
                     else if (_chargingData[_index]->Type == _Type_GB)
                     {
@@ -3302,6 +3345,7 @@ int main(int argc, char *argv[])
                     break;
                 case S_PREPARNING:
                 {
+                    chkChademoPermission[_index] = false;
                     // 設定當前輸出
                     if (gun_count == 1)
                         SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);

+ 45 - 1
EVSE/Projects/DW30/Apps/Module_EvComm.c

@@ -36,6 +36,7 @@
 #define FAIL                -1
 #define START               1
 #define STOP                0
+#define COMMUNICATION       2
 #define YES                 1
 #define NO                  0
 #define EQUAL               0
@@ -49,7 +50,6 @@ struct CcsData                  *ShmCcsData;
 
 byte gun_count;
 int chargingTime[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
-struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
 
 float _pow_1 = 0;
 float _cur_1 = 0;
@@ -72,6 +72,9 @@ float maxChargingPow = 0;                           // 限制最大充電能量
 
 // 槍資訊
 struct ChargingInfoData *_chargingData[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+struct timeval _chk_ratingPower_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+struct timeval _chk_chademo_permission_timeout[CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY];
+bool chkChademoPermission[2] = { false, false };
 
 struct Ev_Board_Cmd Ev_Cmd={
         0,
@@ -3205,6 +3208,24 @@ byte GetStopChargingReasonByEvse(byte gunIndex, byte *reason)
     return result;
 }
 
+void SendCommunicationOnly(byte index)
+{
+    SetChargingPermission(index, COMMUNICATION,
+        _chargingData[index]->AvailableChargingPower,
+        0,
+        0,
+        _chargingData[index]->Evboard_id);
+}
+
+void SendStopOnly(byte index)
+{
+    SetChargingPermission(index, STOP,
+        _chargingData[index]->AvailableChargingPower,
+        0,
+        0,
+        _chargingData[index]->Evboard_id);
+}
+
 int main(int argc, char *argv[])
 {
     if(InitShareMemory() == FAIL)
@@ -3272,6 +3293,28 @@ int main(int argc, char *argv[])
                     if (_chargingData[_index]->Type == _Type_Chademo)
                     {
                         ClearAbnormalStatus_Chademo(_index);
+                        if (ShmSysConfigAndInfo->SysInfo.PageIndex == _LCM_WAIT_FOR_PLUG)
+                        {
+                            if (!chkChademoPermission[_index])
+                            {
+                                chkChademoPermission[_index] = true;
+                                gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
+                                SendCommunicationOnly(_index);
+                            }
+                            else
+                            {
+                                if (GetTimeoutValue(_chk_chademo_permission_timeout[_index]) / 1000 > 10000)
+                                {
+                                    SendCommunicationOnly(_index);
+                                    gettimeofday(&_chk_chademo_permission_timeout[_index], NULL);
+                                }
+                            }
+                        }
+                        else if (chkChademoPermission[_index])
+                        {
+                            chkChademoPermission[_index] = false;
+                            SendStopOnly(_index);
+                        }
                     }
                     else if (_chargingData[_index]->Type == _Type_GB)
                     {
@@ -3302,6 +3345,7 @@ int main(int argc, char *argv[])
                     break;
                 case S_PREPARNING:
                 {
+                    chkChademoPermission[_index] = false;
                     // 設定當前輸出
                     if (gun_count == 1)
                         SetPresentChargingOutputPower(_chargingData[0], _chargingData[0]);