فهرست منبع

2021-05-26 / Wendell

Actions
1. fix parallel relay control logic (for DK model)
2. modify default config logic (do not re-initial the value when model name and serial number are available)
3. use shell command to erase and write flash
4. add wiring information to record dispenser and connector message
5. fork led indication process to display power cabinet's status (for DK model)
6. status code that power cabinet send to ocpp in sync with status code display on screen
7. extend ac contactor recovery time when psu module is error
8. modify psu module recovery logic when psu error occur
9. add misc command: billing information, stop charging button
10.add led indication (for DK model)
11.add message log when dispenser request cabinet status code
12.add check factory setting (run default config when flash is unavailable)
13.modify firmware update logic for DX model
14.fix one dispenser can not charging after one of two dispenser system is disconnected (for DK model)
15.fix average charging can not change to max charging when using r-load
16.add test command

Files
1. As follow commit history

Image version : D0.13.XX.XXXX.XX
Wendell 3 سال پیش
والد
کامیت
0d5cac4829

+ 169 - 16
EVSE/Projects/DO360/Apps/Config.h

@@ -11,8 +11,7 @@
 
 typedef unsigned char			    byte;
 
-#define TOTAL_QUANTITY_GUN			4				//Max Count
-
+
 #define MODE_BOOT					0
 #define MODE_IDLE					1
 #define MODE_AUTHORIZING			2
@@ -56,12 +55,19 @@ typedef unsigned char			    byte;
 
 // **********  Audi ********** //
 // Model Name: DOYC182000D2AD
+// Model Name: DDYC182V0UE2AD
 
 // ********** e4you ********** //
 // Model Name: DKYE182000D1E4
+// Model Name: DXYE182E00E1E4
 
 // ********** xpeng ********** //
 // Model Name: DOYE362000D2XP
+// Model Name: DDYE362F0KE2XP
+
+// *********** BYD *********** //
+// Model Name: DOYE242000D2BD
+// Model Name: DDYE242V0UE2BD
 
 enum _SYSTEM_STATUS
 {
@@ -294,6 +300,8 @@ typedef union
     unsigned int CtrlValue;
     struct
     {
+        unsigned int NeedSoftReset:1;               // 0: no effect,                1: system need soft reset
+        unsigned int NeedHardReset:1;               // 0: no effect,                1: system need hard reset
         unsigned int SelfTestOK:1;                  // 0: self test not completed,  1: self test ok
         unsigned int PrimaryDisable:1;              // 0: primary enable,           1: primary disable
         unsigned int RelayBoardDisable:1;           // 0: relay board enable,       1: relay board disable
@@ -302,10 +310,30 @@ typedef union
         unsigned int SecondRelayBoardEnable:1;      // 0: second relay disable,     1: second relay enable
         unsigned int StandardLedIndication:1;       // 0: no led indication,        1: enable standard led indication
         unsigned int E4YOULedIndication:1;          // 0: no led indication,        1: enable e4you led indication
-        unsigned int res:24;
+        unsigned int res:22;
     }bits;
 }SystemControl;
 
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        unsigned int DisableBalance:1;              // 0: no effect,                1: disable announce balance
+        unsigned int FastStandbyTime:1;             // 0: no effect,                1: enable fast standby time
+        unsigned int res:30;
+    }bits;
+}TestControl;
+
+typedef union
+{
+    unsigned int CtrlValue;
+    struct
+    {
+        unsigned int res:32;
+    }bits;
+}DebugControl;
+
 typedef union
 {
     unsigned int AuthFlag;
@@ -387,7 +415,11 @@ typedef union
 
 typedef struct
 {
+    unsigned char   MaxDispenser;
+    unsigned char   MaxConnector;
     SystemControl   SysCtrl;
+    TestControl     TestCtrl;
+    DebugControl    DebugCtrl;
     PrimaryControl  PrimaryCtrl;
     RelayControl    RelayCtrl;
     FanControl      FanCtrl;
@@ -400,7 +432,7 @@ typedef struct
     bool          CheckIn;
     unsigned char Address;
     unsigned char GroupNo;
-    unsigned char Index;
+    unsigned char GIndex;
 }PsuAddressInfoData;
 
 typedef struct
@@ -420,32 +452,153 @@ typedef struct
 // ************************************************************************************************* //
 typedef enum
 {
-    _GROLE_IDLE             = 0,
-    _GROLE_MASTER           = 1,
-    _GROLE_SLAVE            = 2,
-    _GROLE_SWITCH_TO_IDLE   = 10,
-    _GROLE_SWITCH_IDLE_OK   = 11,
-    _GROLE_SWITCH_TO_MASTER = 20,
-    _GROLE_SWITCH_MASTER_OK = 21,
-    _GROLE_SWITCH_TO_SLAVE  = 30,
-    _GROLE_SWITCH_SLAVE_OK  = 31,
+    _GROLE_IDLE                 = 0,
+    _GROLE_MASTER               = 1,
+    _GROLE_SLAVE                = 2,
+    _GROLE_PREPARE_SWITCH_OFF   = 10,           // reduce output current capability
+    _GROLE_SLAVE_POWER_OFF      = 11,           // power off
+    _GROLE_SWITCH_OFF_OK        = 12,           // power off completed
+    _GROLE_WAIT_IDLE            = 13,           // wait a while to change to idle, open parallel relay at this state
+    _GROLE_WAIT_SLAVE           = 14,           // wait a while to change to slave
+    _GROLE_PREPARE_ATTACH_ON    = 20,           // raise voltage to master output voltage
+    _GROLE_SWITCH_TO_MASTER     = 21,           // close parallel relay
+    _GROLE_WAIT_MASTER          = 22,           // wait a while to master
+    _GROLE_REQUEST_TO_CHARGING  = 30,
+    _GROLE_TERMINATE            = 40,
+    _GROLE_WAIT_TERMINATED      = 41,
+    _GROLE_NONE                 = 99,
 }_GROUP_ROLE;
 
+typedef union
+{
+    unsigned int CtrlValue[6];
+    struct
+    {
+        unsigned int IdleCtrlValue;
+        unsigned int MasterCtrlValue;
+        unsigned int StopChargingCtrlValue;
+        unsigned int DeratingCtrlValue;
+        unsigned int ExtendCapabilityCtrlValue;
+        unsigned int SlaveCtrlValue;
+    }RoleCtrl;
+    struct
+    {
+        // IdleCtrlValue
+        unsigned int ChargingRequest:1;                         // 0: no effect,                1: charging request from main.c
+        unsigned int ChargingRequestConfirmed:1;                // 0: no effect,                1: request confirmed by psu task
+        unsigned int GroupShareCheck:1;                         // 0: no effect,                1: check is there any psu can share
+        unsigned int ShareConfirmed:1;                          // 0: no effect,                1: psu share confirmed
+        unsigned int GrabGroupWait:1;                           // 0: no effect,                1: need to wait grab psu
+        unsigned int ShareCheckDone:1;                          // 0: no effect,                1: psu share completed
+        unsigned int FindGroupPartner:1;                        // 0: no effect,                1: find available group partner
+        unsigned int ParallelRelayOn:1;                         // 0: no effect,                1: set parallel relay on
+        unsigned int ParallelRelayConfirmed:1;                  // 0: no effect,                1: parallel relay confirmed
+        unsigned int GroupingDone:1;                            // 0: no effect,                1: grouping completed
+        unsigned int IdleCtrlRes:22;
+
+        // MasterCtrlValue
+        unsigned int AlreadyInChargingMode:1;                   // 0: no effect,                1: system status ever enter charging mode
+        unsigned int MasterCtrlRes:31;
+
+        // StopChargingCtrlValue
+        unsigned int StopChargingRequest:1;                     // 0: no effect,                1: master need to stop
+        unsigned int StopChargingConfirmed:1;                   // 0: no effect,                1: stop charging confirmed
+        unsigned int AllPowerOffDone:1;                         // 0: no effect,                1: all member power off done
+        unsigned int AllParallelRelayOff:1;                     // 0: no effect,                1: all member's parallel relay off
+        unsigned int AllParallelRelayConfirmed:1;               // 0: no effect,                1: all member's parallel relay off confirmed
+        unsigned int AllMemberStopCompleted:1;                  // 0: no effect,                1: all member stop completed
+        unsigned int StopChargingCompleted:1;                   // 0: no effect,                1: stop charging completed
+        unsigned int StopChargingCtrlRes:25;
+
+        // DeratingCtrlValue
+        unsigned int NeedDerating:1;                            // 0: no effect,                1: need derating
+        unsigned int DeratingConfirmed:1;                       // 0: no effect,                1: derating confirmed
+        unsigned int DeratingStart:1;                           // 0: no effect,                1: derating start
+        unsigned int DeratingPowerOffDone:1;                    // 0: no effect,                1: derating member power off done
+        unsigned int DeratingRelayOff:1;                        // 0: no effect,                1: set derating member parallel relay off
+        unsigned int DeratingRelayConfirmed:1;                  // 0: no effect,                1: derating member parallel relay confirmed
+        unsigned int DeratingCompleted:1;                       // 0: no effect,                1: derating completed
+        unsigned int DeratingCtrlRes:25;
+
+        // ExtendCapabilityCtrlValue
+        unsigned int MorePowerRequest:1;                        // 0: no effect,                1: need to request more psu
+        unsigned int MorePowerConfirmed:1;                      // 0: no effect,                1: request more psu confirmed
+        unsigned int ExtendPrecharge:1;                         // 0: no effect,                1: extend group need to pre-charge
+        unsigned int ExtendPrechargeDone:1;                     // 0: no effect,                1: extend group pre-charge completed
+        unsigned int ExtendRelayOn:1;                           // 0: no effect,                1: extend group parallel relay on
+        unsigned int ExtendRelayConfirmed:1;                    // 0: no effect,                1: extend group parallel relay confirmed
+        unsigned int ExtendCompleted:1;                         // 0: no effect,                1: extend capability completed
+        unsigned int ExtendCapabilityCtrlRes:25;
+
+        // SlaveCtrlValue
+        unsigned int SlaveChargingRequest:1;                    // 0: no effect,                1: request slave to charging after power off
+        unsigned int SlavePowerOffRequest:1;                    // 0: no effect,                1: request slave to power off
+        unsigned int SlavePowerOffConfirmed:1;                  // 0: no effect,                1: slave power off confirmed
+        unsigned int SlaveCtrlRes:29;
+    }bits;
+}PsuGroupControl;
+
+typedef struct
+{
+    unsigned short          Quantity;
+    unsigned char           Member[MAX_GROUP_QUANTITY];         // record slave group index
+}PsuGroupPartner;
+
 typedef struct
 {
     unsigned char           Index;
     unsigned char           Role;
+    unsigned char           PreRole;
     unsigned char           Location;
-    unsigned char           GroupMemberQuantity;
-    unsigned char           GroupMember[MAX_GROUP_QUANTITY];
-    unsigned char           TargetGroup;                        // group index + 1
+    PsuGroupPartner         Partner;                            // record slave group information
+    PsuGroupPartner         PossibleMember;                     // record possible slave group information
+    unsigned char           TargetGroup;                        // target group index + 1
+    unsigned char           ReservedTarget;                     // reserved target group index + 1
+    PsuGroupControl         GroupCtrl;
+    unsigned short          ReAssignAvailableCurrent;           // group available current when reassign, unit: 0.1A
+    unsigned short          ParallelCheck;
+    unsigned char           ParallelConfig[MAX_GROUP_QUANTITY]; // group parallel relay setting
 }PsuGroupCollectionData;
 
+typedef struct
+{
+    unsigned short          GTargetVoltage;                     // group target voltage config, unit: 0.1V
+    unsigned short          GTargetCurrent;                     // group target current config, unit: 0.1A
+}GroupOutputConfigInfo;
+
+typedef union
+{
+    unsigned short CtrlValue;
+    struct
+    {
+        unsigned short Output_N:1;                              // 0: set Output_N off,         1: set Output_N on
+        unsigned short Output_P:1;                              // 0: set Output_P off,         1: set Output_P on
+        unsigned short res:14;
+    }bits;
+}PsuGroupOutputRelay;
+
+typedef union
+{
+    unsigned short CtrlValue;
+    struct
+    {
+        unsigned short Location_1_2:1;                          // 0: set parallel off,         1: set parallel on
+        unsigned short Location_2_3:1;                          // 0: set parallel off,         1: set parallel on
+        unsigned short Location_3_4:1;                          // 0: set parallel off,         1: set parallel on
+        unsigned short res:13;
+    }bits;
+}PsuGroupParallelRelay;
+
 typedef struct
 {
     byte                    Location[MAX_GROUP_QUANTITY];
     byte                    Layout[MAX_GROUP_QUANTITY];
     PsuGroupCollectionData  GroupCollection[MAX_GROUP_QUANTITY];
+    GroupOutputConfigInfo   GroupOutput[MAX_GROUP_QUANTITY];
+    PsuGroupOutputRelay     OutputRelayConfig[MAX_GROUP_QUANTITY];
+    PsuGroupOutputRelay     OutputRelayConfirmed[MAX_GROUP_QUANTITY];
+    PsuGroupParallelRelay   ParallelRelayConfig;
+    PsuGroupParallelRelay   ParallelRelayConfirmed;
 }PsuGroupingInfoData;
 // ************************************************************************************************* //
 

+ 15 - 6
EVSE/Projects/DO360/Apps/FactoryConfig.c

@@ -105,8 +105,16 @@ int main(int argc,char *argv[])
 	*/
 	//********** System **********// udhcpc -i eth1 -s ./dhcp_script/eth1.script
 	//
-	strcpy((char *)SysConfig.ModelName, "DOYC182000D2AD");
-	strcpy((char *)SysConfig.SerialNumber, "NeedSetupSN");
+    if (argc == 4)
+    {
+        strcpy((char *)SysConfig.ModelName, argv[2]);
+        strcpy((char *)SysConfig.SerialNumber, argv[3]);
+    }
+    else
+    {
+        strcpy((char *)SysConfig.ModelName, "DOYC182000D2AD");
+        strcpy((char *)SysConfig.SerialNumber, "NeedSetupSN");
+    }
 
 	memset(SysConfig.SystemId, 0x00, sizeof(SysConfig.SystemId));
 
@@ -147,10 +155,8 @@ int main(int argc,char *argv[])
 	strcpy((char *) SysConfig.Eth1Interface.EthIpAddress, "192.168.100.1");
 	strcpy((char *) SysConfig.Eth1Interface.EthSubmaskAddress, "255.255.255.0");
 	strcpy((char *) SysConfig.Eth1Interface.EthGatewayAddress, "192.168.0.254");
-	if(SysConfig.ModelName[10] == 'W')
-		SysConfig.AthInterface.WifiMode = 2;
-	else
-		SysConfig.AthInterface.WifiMode = 0;
+	SysConfig.AthInterface.WifiMode = 0;
+	SysConfig.TelecomInterface.TelcomEnabled = 0;
 	strcpy((char *) SysConfig.AthInterface.WifiSsid, "");
 	strcpy((char *) SysConfig.AthInterface.WifiPassword, "");
 	SysConfig.AthInterface.WifiRssi = 0;
@@ -185,6 +191,9 @@ int main(int argc,char *argv[])
 	strcpy((char *) SysConfig.ChargeBoxId, "");
 	SysConfig.LedInfo.Intensity = 2;
 
+	// clean power cabinet wiring info
+	memset((char *)&SysConfig.WiringInfo, 0x00, sizeof(WiringInfoData));
+
 	//copy default configuration to pointer
 	memcpy(ptr,&SysConfig,sizeof(struct SysConfigData));
 

+ 135 - 27
EVSE/Projects/DO360/Apps/Module_EvComm.c

@@ -951,6 +951,9 @@ void ConnectorIDResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
 	send(socket, &sendBuffer, sendBuffer.Header.len + 4, 0);
 }
 
+// more message for debug
+struct PACKET_STRUCTURE CabinetStatusToDispenser[4];
+
 void PowerCabinetStatusResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned char dispenserIndex)
 {
 	struct PACKET_STRUCTURE sendBuffer;
@@ -985,6 +988,40 @@ void PowerCabinetStatusResponse(int socket, struct PACKET_STRUCTURE *packet, uns
         memcpy(&sendBuffer.Payload.data[1 + (ShmSysConfigAndInfo->SysWarningInfo.WarningCount * 6)], &MiscEventCode[0], 6);
     }
 
+    bool need_copy = false;
+    if(sendBuffer.Header.len != CabinetStatusToDispenser[sendBuffer.Header.id].Header.len ||
+        sendBuffer.Header.op != CabinetStatusToDispenser[sendBuffer.Header.id].Header.op ||
+        sendBuffer.Payload.reg != CabinetStatusToDispenser[sendBuffer.Header.id].Payload.reg ||
+        sendBuffer.Payload.data[0] != CabinetStatusToDispenser[sendBuffer.Header.id].Payload.data[0])
+    {
+        need_copy = true;
+    }
+    else
+    {
+        for(int i = 0; i < sendBuffer.Header.len - 2; i++)
+        {
+            if(sendBuffer.Payload.data[1 + i] != CabinetStatusToDispenser[sendBuffer.Header.id].Payload.data[1 + i])
+            {
+                need_copy = true;
+            }
+        }
+    }
+    if(need_copy)
+    {
+        char str[256];
+        memcpy(&CabinetStatusToDispenser[sendBuffer.Header.id], &sendBuffer, sizeof(struct PACKET_STRUCTURE));
+
+        sprintf(str, "Status Code Update To %d:", sendBuffer.Header.id);
+
+        for(int i = 0; i < CabinetStatusToDispenser[sendBuffer.Header.id].Header.len - 2; i++)
+        {
+            char temp[8];
+            sprintf(temp, " %02X", CabinetStatusToDispenser[sendBuffer.Header.id].Payload.data[1 + i]);
+            strcat(str, temp);
+        }
+        PRINTF_FUNC("%s", str);
+    }
+
 	send(socket, &sendBuffer, sendBuffer.Header.len + 4, 0);
 }
 
@@ -1284,6 +1321,7 @@ void MiscControlResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
             AddMiscCommand(&sendBuffer, &misc);
         }
 
+        // announce misc command to first connector of the dispenser
         if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].ConnectorID[0] == packet->Header.id)
         {
             if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.ConnectorTimeoutConfigRequest)
@@ -1322,7 +1360,7 @@ void MiscControlResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
                 misc.Command = _MiscCmd_BackendStatus;
                 misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.BackendStatus;
 
-                PRINTF_FUNC("Announce Connector %d BackendStatus: %d", packet->Header.id, (misc.Value));
+                PRINTF_FUNC("Announce Dispenser %d BackendStatus: %d", dispenserIndex + 1, (misc.Value));
                 AddMiscCommand(&sendBuffer, &misc);
             }
 
@@ -1332,7 +1370,7 @@ void MiscControlResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
                 misc.Command = _MiscCmd_EthernetStatus;
                 misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.EthernetStatus;
 
-                PRINTF_FUNC("Announce Connector %d EthernetStatus: %d", packet->Header.id, (misc.Value));
+                PRINTF_FUNC("Announce Dispenser %d EthernetStatus: %d", dispenserIndex + 1, (misc.Value));
                 AddMiscCommand(&sendBuffer, &misc);
             }
 
@@ -1342,7 +1380,7 @@ void MiscControlResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
                 misc.Command = _MiscCmd_WiFiStatus;
                 misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.WiFiStatus;
 
-                PRINTF_FUNC("Announce Connector %d WiFiStatus: %d", packet->Header.id, (misc.Value));
+                PRINTF_FUNC("Announce Dispenser %d WiFiStatus: %d", dispenserIndex + 1, (misc.Value));
                 AddMiscCommand(&sendBuffer, &misc);
             }
 
@@ -1352,7 +1390,27 @@ void MiscControlResponse(int socket, struct PACKET_STRUCTURE *packet, unsigned c
                 misc.Command = _MiscCmd_4GStatus;
                 misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.TelcomModemStatus;
 
-                PRINTF_FUNC("Announce Connector %d TelcomModemStatus: %d", packet->Header.id, (misc.Value));
+                PRINTF_FUNC("Announce Dispenser %d TelcomModemStatus: %d", dispenserIndex + 1, (misc.Value));
+                AddMiscCommand(&sendBuffer, &misc);
+            }
+
+            if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.BillingStatusRequest)
+            {
+                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.BillingStatusRequest = false;
+                misc.Command = _MiscCmd_Billing;
+                misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.BillingStatus;
+
+                PRINTF_FUNC("Announce Dispenser %d %s Billing Information", dispenserIndex + 1, misc.Value ? "Enable" : "Disable");
+                AddMiscCommand(&sendBuffer, &misc);
+            }
+
+            if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.StopButtonStatusRequest)
+            {
+                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.StopButtonStatusRequest = false;
+                misc.Command = _MiscCmd_StopButton;
+                misc.Value = ShmSysConfigAndInfo->SysInfo.CabinetMicsStatus.StopChargingButton;
+
+                PRINTF_FUNC("Announce Dispenser %d %s Stop Charging Button", dispenserIndex + 1, misc.Value ? "Enable" : "Disable");
                 AddMiscCommand(&sendBuffer, &misc);
             }
 
@@ -1618,25 +1676,23 @@ void DispenserCheckInInfoUpdate(void)
 			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LocalStatus != _DS_Timeout)
 		{
 			dispenser++;
-			ShmSysConfigAndInfo->SysInfo.DispenserInfo.CheckInLog.Status |= (1 << i);
-			ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[i] = ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ConnectorQuantity;
 			connector += ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].ConnectorQuantity;
 		}
 	}
 
-	if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity != dispenser ||
-		ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity != connector)
+	if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentDispenserQuantity != dispenser ||
+		ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentConnectorQuantity != connector)
 	{
 		change = true;
 	}
-	ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity = dispenser;
-	ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity = connector;
+	ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentDispenserQuantity = dispenser;
+	ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentConnectorQuantity = connector;
 
 	if(change)
 	{
 		PRINTF_FUNC("Total Dispenser: %d, Total Connector: %d\n",
-			ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity,
-			ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentDispenserQuantity,
+			ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentConnectorQuantity);
 	}
 }
 
@@ -1660,6 +1716,29 @@ void SetConnectorID(unsigned char dispenserIndex, unsigned char quantity)
 	}
 }
 
+BOOL CheckNewDispenserSequence(unsigned char index, unsigned char quantity)
+{
+    if(index == ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence)
+    {
+        PRINTF_FUNC("Get New Dispenser %d, Connector Quantity: %d\n", index + 1, quantity);
+
+        ShmSysConfigAndInfo->SysInfo.DispenserInfo.CheckInLog.Status |= (1 << index);
+        ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[index] = quantity;
+
+        ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence = index + 1;
+        ShmSysConfigAndInfo->SysConfig.WiringInfo.MaxConnectorQuantity += quantity;
+        ShmSysConfigAndInfo->SysConfig.WiringInfo.WiringSetting[index] = quantity;
+        ShmSysConfigAndInfo->SysInfo.CabinetSetting.bits.WiringInfoChanged = true;
+
+        ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity = ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence;
+        ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity = ShmSysConfigAndInfo->SysConfig.WiringInfo.MaxConnectorQuantity;
+
+        return true;
+    }
+
+    return false;
+}
+
 BOOL DispenserIdentificationHandler(struct PACKET_STRUCTURE *packet, unsigned char dispenserIndex, unsigned char *modelName)
 {
 	unsigned char quantity = 0;
@@ -1671,18 +1750,27 @@ BOOL DispenserIdentificationHandler(struct PACKET_STRUCTURE *packet, unsigned ch
 
 	if(quantity > 0)
 	{
-		if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].LocalStatus == _DS_Timeout &&
+		if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[dispenserIndex] != 0 &&
 			quantity != ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[dispenserIndex])
 		{
 			PRINTF_FUNC("The same dispenser id (%d) but connector quantity not match", dispenserIndex + 1);
 			return false;
 		}
+        if(dispenserIndex == ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence &&
+            (quantity + ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity) > ShmChargerInfo->Control.MaxConnector)
+        {
+            PRINTF_FUNC("Dispenser %d connector quantity %d over range, total quantity: %d",
+                dispenserIndex + 1, quantity, ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity);
+            return false;
+        }
 		if(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].LocalStatus == _DS_None ||
 			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].LocalStatus == _DS_Timeout)
 		{
+            CheckNewDispenserSequence(dispenserIndex, quantity);
+
 			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].LocalStatus = _DS_Identification;
 			ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].ConnectorQuantity = quantity;
-			ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[dispenserIndex] = quantity;
+
 			SetConnectorID(dispenserIndex, quantity);
 			memcpy(ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].ModelName, packet->Payload.data, (packet->Header.len - 2));
 
@@ -1701,7 +1789,7 @@ BOOL DispenserIdentificationHandler(struct PACKET_STRUCTURE *packet, unsigned ch
 	}
 	else
 	{
-		PRINTF_FUNC("Connector quantity fail, model name: %s", modelName);
+        PRINTF_FUNC("Connector quantity fail, model name: %s", modelName);
 	}
 	return false;
 }
@@ -2399,7 +2487,8 @@ void DispenserSocketProcess(int socketFd, struct sockaddr_in clientInfo, unsigne
 						memset(modelName, 0x00, 64);
 						dispenserID = receiveBuffer.Payload.data[receiveBuffer.Header.len - 2];
 
-						if(dispenserID > 0 && dispenserID <= GENERAL_GUN_QUANTITY)
+						if(dispenserID > 0 && dispenserID <= GENERAL_GUN_QUANTITY &&
+                            dispenserID <= ShmChargerInfo->Control.MaxDispenser)
 						{
 						    dispenserIndex = dispenserID - 1;
 						    memcpy(modelName, receiveBuffer.Payload.data, receiveBuffer.Header.len - 2);
@@ -2466,13 +2555,15 @@ void DispenserSocketProcess(int socketFd, struct sockaddr_in clientInfo, unsigne
                                 ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.DispenserConfigSync = true;
 
                                 PRINTF_FUNC("Dispenser ID %d Configuration Need To Synchronize", dispenserID);
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.ConnectorTimeoutConfigRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.DefaultPriceConfigRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.CurrencyConfigRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.BackendStatusRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.EthernetStatusRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.WiFiStatusRequest = 1;
-                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.TelcomModemStatusRequest = 1;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.ConnectorTimeoutConfigRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.DefaultPriceConfigRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.CurrencyConfigRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.BackendStatusRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.EthernetStatusRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.WiFiStatusRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.TelcomModemStatusRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.BillingStatusRequest = true;
+                                ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[dispenserIndex].Setting.bits.StopButtonStatusRequest = true;
                             }
 						}
 					}
@@ -2737,8 +2828,10 @@ void InitDispenserInfo(void)
 	}
 
     //memset(&ShmSysConfigAndInfo->SysInfo.DispenserInfo, 0x00, sizeof(struct DispenserInfoData));
-    ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity = 0;
-    ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity = 0;
+    ShmSysConfigAndInfo->SysInfo.DispenserInfo.DispenserQuantity = ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence;
+    ShmSysConfigAndInfo->SysInfo.DispenserInfo.TotalConnectorQuantity = ShmSysConfigAndInfo->SysConfig.WiringInfo.MaxConnectorQuantity;
+    ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentDispenserQuantity = 0;
+    ShmSysConfigAndInfo->SysInfo.DispenserInfo.PresentConnectorQuantity = 0;
     for(int i = 0; i < GENERAL_GUN_QUANTITY; i++)
     {
         unsigned char localStatus = 0;
@@ -2746,8 +2839,23 @@ void InitDispenserInfo(void)
         memset(&ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i], 0x00, sizeof(struct DispenserModule));
         ShmSysConfigAndInfo->SysInfo.DispenserInfo.Dispenser[i].LocalStatus = localStatus;
     }
-    //ShmSysConfigAndInfo->SysInfo.DispenserInfo.CheckInLog.Status = 0;
-    //memset(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog, 0x00, sizeof(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog));
+
+    // initial CheckInLog from WiringInfo.DispenserSequence
+    ShmSysConfigAndInfo->SysInfo.DispenserInfo.CheckInLog.Status = 0;
+    for(int i = 0; i < ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence; i++)
+    {
+        ShmSysConfigAndInfo->SysInfo.DispenserInfo.CheckInLog.Status |= (1 << i);
+    }
+
+    // initial ConnectorLog from WiringInfo.WiringSetting
+    memset(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog, 0x00, sizeof(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog));
+    for(int i = 0; i < ShmSysConfigAndInfo->SysConfig.WiringInfo.DispenserSequence; i++)
+    {
+        if(i < GENERAL_GUN_QUANTITY)
+        {
+            ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorLog[i] = ShmSysConfigAndInfo->SysConfig.WiringInfo.WiringSetting[i];
+        }
+    }
     memset(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo, 0x00, sizeof(ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectionInfo));
     ShmSysConfigAndInfo->SysInfo.DispenserInfo.ConnectorTimeout = 0;
     ShmSysConfigAndInfo->SysInfo.DispenserInfo.DefaultPrice = 0;

+ 2 - 0
EVSE/Projects/DO360/Apps/Module_EvComm.h

@@ -175,6 +175,8 @@ enum MiscCommand
     _MiscCmd_EthernetStatus     = 0x0007,
     _MiscCmd_WiFiStatus         = 0x0008,
     _MiscCmd_4GStatus           = 0x0009,
+    _MiscCmd_Billing            = 0x000A,
+    _MiscCmd_StopButton         = 0x000B,
     _MiscCmd_HardwareReboot     = 0x0101,
     _MiscCmd_SoftwareRestart    = 0x0102,
     _MiscCmd_RemoteStart        = 0x0103,

+ 24 - 3
EVSE/Projects/DO360/Apps/Module_EventLogging.c

@@ -267,7 +267,7 @@ int main(void)
 	for(;;)
 	{
 		//check Fault Status
-		for(ByteCount=0;ByteCount<4;ByteCount++)
+		for(ByteCount=0;ByteCount<FaultCodeLength;ByteCount++)
 		{
 			if(ShmStatusCodeData->FaultCode.FaultEvents.FaultVal[ByteCount] != ShmStatusCodeData->FaultCode.PreviousFaultVal[ByteCount])
 			{
@@ -278,6 +278,13 @@ int main(void)
 					{
 						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
 						memcpy(EventCodeTmp,FaultStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+
+                        // modify power cabinet status code X1XXXX to X4XXXX
+                        if(EventCodeTmp[1] == '1')
+                        {
+                            EventCodeTmp[1] = '4';
+                        }
+
 						if(((tmp>>BitCount)&0x01)==0)//Recovered
 						{
 							//EventCodeTmp[0]=1;
@@ -297,7 +304,7 @@ int main(void)
 		}
 
 		//check Alarm Status
-		for(ByteCount=0;ByteCount<16;ByteCount++)
+		for(ByteCount=0;ByteCount<AlarmCodeLength;ByteCount++)
 		{
 			if(ShmStatusCodeData->AlarmCode.AlarmEvents.AlarmVal[ByteCount] != ShmStatusCodeData->AlarmCode.PreviousAlarmVal[ByteCount])
 			{
@@ -308,6 +315,13 @@ int main(void)
 					{
 						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
 						memcpy(EventCodeTmp,AlarmStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+
+                        // modify power cabinet status code X1XXXX to X4XXXX
+                        if(EventCodeTmp[1] == '1')
+                        {
+                            EventCodeTmp[1] = '4';
+                        }
+
 						if(((tmp>>BitCount)&0x01)==0)//Recovered
 						{
 							//EventCodeTmp[0]=1;
@@ -333,7 +347,7 @@ int main(void)
 		}
 
 		//check Info Status
-		for(ByteCount=0;ByteCount<40;ByteCount++)
+		for(ByteCount=0;ByteCount<InfoCodeLength;ByteCount++)
 		{
 			if(ShmStatusCodeData->InfoCode.InfoEvents.InfoVal[ByteCount] != ShmStatusCodeData->InfoCode.PreviousInfoVal[ByteCount])
 			{
@@ -344,6 +358,13 @@ int main(void)
 					{
 						memset(EventCodeTmp,0,sizeof(EventCodeTmp));
 						memcpy(EventCodeTmp,InfoStatusCode[ByteCount*8+BitCount],sizeof(EventCodeTmp)-1);
+
+                        // modify power cabinet status code X1XXXX to X4XXXX
+                        if(EventCodeTmp[1] == '1')
+                        {
+                            EventCodeTmp[1] = '4';
+                        }
+
 						if(((tmp>>BitCount)&0x01)==0)//Recovered
 						{
 							//EventCodeTmp[0]=1;

+ 2 - 2
EVSE/Projects/DO360/Apps/Module_InternalComm.c

@@ -851,7 +851,7 @@ void CheckK1K2RelayOutput(byte index)
                 _chargingData[index]->RelayK1K2Status = NO;
         }
 
-        if (regRelay[0].relay_event.bits.Gun1_Parallel_N == YES && regRelay[0].relay_event.bits.Gun1_Parallel_P == YES)
+        if (regRelay[0].relay_event.bits.Gun1_Parallel_N == YES && regRelay[0].relay_event.bits.Gun2_Parallel_N == YES)
             ShmSysConfigAndInfo->SysInfo.BridgeRelayStatus = YES;
         else
             ShmSysConfigAndInfo->SysInfo.BridgeRelayStatus = NO;
@@ -1189,7 +1189,7 @@ void SetParalleRelayStatus()
 	{
 		if (_chargingData[0]->SystemStatus == S_BOOTING || _chargingData[1]->SystemStatus == S_BOOTING ||
 				((_chargingData[0]->SystemStatus == S_IDLE || _chargingData[0]->SystemStatus == S_MAINTAIN || _chargingData[0]->SystemStatus == S_FAULT) &&
-				(_chargingData[1]->SystemStatus == S_IDLE || _chargingData[1]->SystemStatus == S_MAINTAIN || _chargingData[0]->SystemStatus == S_FAULT)))
+				(_chargingData[1]->SystemStatus == S_IDLE || _chargingData[1]->SystemStatus == S_MAINTAIN || _chargingData[1]->SystemStatus == S_FAULT)))
 		{
             if(ShmChargerInfo->Control.SysCtrl.bits.SecondRelayBoardEnable)
             {

+ 24 - 0
EVSE/Projects/DO360/Apps/Module_PsuComm.c

@@ -40,6 +40,9 @@ bool psuReceiveRecovery = false;
 float evseOutVol[CONNECTOR_QUANTITY] = {0, 0, 0, 0};
 float evseOutCur[CONNECTOR_QUANTITY] = {0, 0, 0, 0};
 struct timeval _PsuReceiveRecoveryCheck_time;
+int _initialCurrentDiff = 0;
+int _balanceCurrentDiff = 0;
+int _balanceDelay = 0;
 
 void PRINTF_FUNC(char *string, ...);
 
@@ -2094,6 +2097,9 @@ int main(void)
 							if (ShmSysConfigAndInfo->SysInfo.ReAssignedFlag == _REASSIGNED_ADJUST_A_TO_M)
 							{
 								bool balanceVol = true;
+								_initialCurrentDiff = 0;
+								_balanceCurrentDiff = 0;
+								_balanceDelay = 0;
 
 								for (byte subIndex = 0; subIndex < ShmPsuData->GroupCount; subIndex++)
 								{
@@ -2145,6 +2151,12 @@ int main(void)
 										chargingCurrent = ShmPsuData->PsuGroup[subIndex].GroupPresentOutputCurrent;
 								}
 
+								_balanceCurrentDiff = (chargingCurrent >= idleCurrent) ? (chargingCurrent - idleCurrent) : (idleCurrent - chargingCurrent);
+								if(_initialCurrentDiff == 0)
+								{
+								    _initialCurrentDiff = _balanceCurrentDiff;
+								}
+
 								if (idleCurrent >= chargingCurrent - PRE_CHARG_RANGE)
 								{
 									PRINTF_FUNC("=============Smart Charging_0 : _REASSIGNED_COMP============= Step 15 \n");
@@ -2155,6 +2167,18 @@ int main(void)
 									if ((GetTimeoutValue(_max_time) / 1000) > 500)
 									{
 										gettimeofday(&_max_time, NULL);
+										_balanceDelay++;
+										// 3s
+										if(_balanceDelay > 6)
+										{
+										    _balanceDelay = 0;
+										    int _changeDiff = (_initialCurrentDiff >= _balanceCurrentDiff) ? _initialCurrentDiff - _balanceCurrentDiff : _balanceCurrentDiff - _initialCurrentDiff;
+										    if(_changeDiff <= PRE_CHARG_RANGE)
+										    {
+										        PRINTF_FUNC("=============Smart Charging_0 : Current Change Difference %d Step 15\n", _changeDiff);
+			                                    ShmSysConfigAndInfo->SysInfo.ReAssignedFlag = _REASSIGNED_COMP;
+										    }
+										}
 									}
 								}
 							}

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 697 - 98
EVSE/Projects/DO360/Apps/ReadCmdline.c


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 390 - 303
EVSE/Projects/DO360/Apps/main.c


BIN
EVSE/Projects/DO360/Images/ramdisk.gz


+ 186 - 157
EVSE/Projects/define.h

@@ -178,6 +178,10 @@ Storage							0x0A200000-0x7FFFFFFF		1886 MB
 #define ShmOcpp20ModuleKey		1012
 #define ShmRelay2BdKey			1013
 
+#define FaultCodeLength         5
+#define AlarmCodeLength         16
+#define InfoCodeLength          41
+
 /**************************************************************************************/
 /****************** Share memory configuration value constant define ******************/
 /**************************************************************************************/
@@ -298,7 +302,7 @@ enum CoreProfile {
      DefaultPrice,
      CustomDisplayCostAndPrice,
      CustomIdleFeeAfterStop,
-	 ConfigurationVersion,
+     ConfigurationVersion,
 	 _CoreProfile_CNT
 };
 
@@ -414,6 +418,14 @@ typedef union
     }bits;
 }ChargingStop;
 
+typedef struct
+{
+    unsigned char DispenserSequence;                    // dispenser sequence
+    unsigned char MaxConnectorQuantity;                 // max connector quantity
+    unsigned char WiringSetting[8];                     // record connector quantity of dispenser
+    unsigned char PowerCabinetReserved[32];
+}WiringInfoData;
+
 struct SysConfigData
 {
 	/**************System***************/
@@ -474,7 +486,10 @@ struct SysConfigData
 	unsigned char			ShowInformation;
 	unsigned char           isReqFirstUpgrade;          //EVSE is request first upgrade from PH server
 	unsigned char           isEnableLocalPowerSharging; //0: Disable power sharing  1: Enable power sharing
-	unsigned char			StopChargingByButton;		//0: Disable  1: Enable
+	unsigned char           StopChargingByButton;       //0: Disable  1: Enable
+
+    /************PowerCabinet************/
+    WiringInfoData          WiringInfo;
 };
 
 struct ChargingInfoData
@@ -589,7 +604,9 @@ typedef union
         unsigned int EthernetStatusRequest:1;           // 0: no request,   1: ethernet connection status has changed           ( cabinet -> dispenser)
         unsigned int WiFiStatusRequest:1;               // 0: no request,   1: wifi connection status has changed               ( cabinet -> dispenser)
         unsigned int TelcomModemStatusRequest:1;        // 0: no request,   1: 4g connection status has changed                 ( cabinet -> dispenser)
-        unsigned int res:11;
+        unsigned int BillingStatusRequest:1;            // 0: no request,   1: billing status has changed                       ( cabinet -> dispenser)
+        unsigned int StopButtonStatusRequest:1;         // 0: no request,   1: stop charging button status has changed          ( cabinet -> dispenser)
+        unsigned int res:9;
     }bits;
 }DispenserSettingFlag;
 
@@ -645,10 +662,13 @@ struct ConnectionInfoData
 
 struct DispenserInfoData
 {
-    unsigned char               DispenserQuantity;
-    unsigned char               TotalConnectorQuantity;
+    unsigned char               DispenserQuantity;                  // record max dispenser quantity
+    unsigned char               TotalConnectorQuantity;             // record max connector quantity
     struct DispenserModule      Dispenser[GENERAL_GUN_QUANTITY];
 
+    unsigned char               PresentDispenserQuantity;
+    unsigned char               PresentConnectorQuantity;
+
     union
     {
         unsigned char Status;
@@ -756,7 +776,10 @@ typedef union
         unsigned int AuthorizingCompleted:1;    // 0: not yet, 1: authorizing completed
         unsigned int DispenserDisconnection:1;  // 0: no connection,  1: dispenser connected
         unsigned int BackendAuthorized:1;       // 0: local authorized, 1: backend authorized
-        unsigned int res:28;
+        unsigned int WiringInfoChanged:1;       // 0: no effect, 1: wiring info has changed
+        unsigned int EnableWriteWiringInfo:1;   // 0: no effect, 1: enable write wiring info after timeout
+        unsigned int CleanWiringInfo:1;         // 0: no effect, 1: clean wiring info
+        unsigned int res:25;
     }bits;
 }CabinetSettingFlag;
 
@@ -769,6 +792,8 @@ typedef struct
     unsigned int EthernetStatus;                // 0: disable, 1: connected, 2: disconnected
     unsigned int WiFiStatus;                    // 0: disable, 1: connected, 2: disconnected
     unsigned int TelcomModemStatus;             // 0: disable, 1: connected, 2: disconnected
+    unsigned int BillingStatus;                 // 0: disable, 1: enable
+    unsigned int StopChargingButton;            // 0: disable, 1: enable
     unsigned int HardwareReboot;                // 1: HardwareReboot, Other value: no effect
     unsigned int SoftwareRestart;               // 1: SoftwareRestart, Other value: no effect
 }CabinetMiscCommand;
@@ -991,10 +1016,10 @@ char FaultStatusCode[40][6]=
 
 struct FaultCodeData
 {
-	unsigned char PreviousFaultVal[5];
+	unsigned char PreviousFaultVal[FaultCodeLength];
 	union
 	{
-		unsigned char FaultVal[5];
+		unsigned char FaultVal[FaultCodeLength];
 		struct
 		{
 			//FaultVal[0]
@@ -1177,10 +1202,10 @@ char AlarmStatusCode[128][6]=
 };
 struct AlarmCodeData
 {
-	unsigned char PreviousAlarmVal[16];
+	unsigned char PreviousAlarmVal[AlarmCodeLength];
 	union
 	{
-		unsigned char AlarmVal[16];
+		unsigned char AlarmVal[AlarmCodeLength];
 		struct
 		{
 			//AlarmVal[0]
@@ -1659,10 +1684,10 @@ char InfoStatusCode[384][6]=
 };
 struct InfoCodeData
 {
-	unsigned char PreviousInfoVal[41];
+	unsigned char PreviousInfoVal[InfoCodeLength];
 	union
 	{
-		unsigned char InfoVal[41];
+		unsigned char InfoVal[InfoCodeLength];
 		struct
 		{
 			//InfoVal[0]
@@ -2084,6 +2109,10 @@ struct PsuGroupData
 	unsigned int            GroupPresentOutputPower;        //Watt
 	struct PsuModuleData 	PsuModule[MAX_PSU_QUANTITY];
 	PsuGroupError           GroupErrorFlag;
+    unsigned short          TotalIAvailableCurrent;         // unit: 0.1A
+    unsigned short          TempIAvailableCurrent;          // unit: 0.1A
+    unsigned short          StableIAvailableCurrent;        // unit: 0.1A
+    unsigned short          StableCurrentCounter;           // stable current counter
 };
 
 /*Following is the information for system all PSU*/
@@ -4231,104 +4260,104 @@ struct StructCost
 
 struct CertificateHashDataType
 {
-	unsigned char hashAlgorithm[8];								// Required. Used algorithms for the hashes provided.
-	unsigned char issuerNameHash[129];							// Required. hashed value of the IssuerName.
-	unsigned char issuerKeyHash[129];							// Required. Hashed value of the issuers public key
-	unsigned char serialNumber[41];								// Required. The serial number of the certificate.
+    unsigned char hashAlgorithm[8];                             // Required. Used algorithms for the hashes provided.
+    unsigned char issuerNameHash[129];                          // Required. hashed value of the IssuerName.
+    unsigned char issuerKeyHash[129];                           // Required. Hashed value of the issuers public key
+    unsigned char serialNumber[41];                             // Required. The serial number of the certificate.
 };
 
 struct LogParametersType
 {
-	unsigned char remoteLocation[513];								// Required. The URL of the location at the remote system where the log should be stored.
-	unsigned char oldestTimestamp[36];								// Optional. This contains the date and time of the oldest logging information to include in the diagnostics.
-	unsigned char latestTimestamp[36];								// Optional. This contains the date and time of the latest logging information to include in the diagnostics.
+    unsigned char remoteLocation[513];                              // Required. The URL of the location at the remote system where the log should be stored.
+    unsigned char oldestTimestamp[36];                              // Optional. This contains the date and time of the oldest logging information to include in the diagnostics.
+    unsigned char latestTimestamp[36];                              // Optional. This contains the date and time of the latest logging information to include in the diagnostics.
 };
 
 struct FirmwareType
 {
-	unsigned char location[513];									// Required. URI defining the origin of the firmware.
-	unsigned char retrieveDateTime[36];								// Required. Date and time at which the firmware shall be retrieved.
-	unsigned char installDateTime[36];								// Optional. Date and time at which the firmware shall be installed.
-	unsigned char signingCertificate[5501];							// Optional. Certificate with which the firmware was signed. X.509 certificate, first DER encoded into binary, and then Base64 encoded.
-	unsigned char signature[801];									// Optional. Base64 encoded firmware signature.
+    unsigned char location[513];                                    // Required. URI defining the origin of the firmware.
+    unsigned char retrieveDateTime[36];                             // Required. Date and time at which the firmware shall be retrieved.
+    unsigned char installDateTime[36];                              // Optional. Date and time at which the firmware shall be installed.
+    unsigned char signingCertificate[5501];                         // Optional. Certificate with which the firmware was signed. X.509 certificate, first DER encoded into binary, and then Base64 encoded.
+    unsigned char signature[801];                                   // Optional. Base64 encoded firmware signature.
 };
 
 struct StructCertificateSigned
 {
-	unsigned char certificateChain[10001];
-	unsigned char Response_status[16];
+    unsigned char certificateChain[10001];
+    unsigned char Response_status[16];
 };
 
 struct StructDeleteCertificate
 {
-	struct CertificateHashDataType certificateHashData;
-	unsigned char Response_status[16];
+    struct CertificateHashDataType certificateHashData;
+    unsigned char Response_status[16];
 };
 
 struct StructExtendedTrigger
 {
-	unsigned char requestedMessage[32];
-	int connectorId;
-	unsigned char Response_status[16];
+    unsigned char requestedMessage[32];
+    int connectorId;
+    unsigned char Response_status[16];
 };
 
 struct StructGetInstalledCertificateIds
 {
-	unsigned char certificateType[32];
-	unsigned char Response_status[16];
-	struct CertificateHashDataType Response_certificateHashData[3];
+    unsigned char certificateType[32];
+    unsigned char Response_status[16];
+    struct CertificateHashDataType Response_certificateHashData[3];
 };
 
 struct StructGetLog
 {
-	unsigned char logType[16];
-	int requestId;
-	int retries;
-	int retryInterval;
-	struct LogParametersType log;
-	unsigned char Response_status[16];
-	unsigned char Response_filename[256];
+    unsigned char logType[16];
+    int requestId;
+    int retries;
+    int retryInterval;
+    struct LogParametersType log;
+    unsigned char Response_status[16];
+    unsigned char Response_filename[256];
 };
 
 struct StructInstallCertificate
 {
-	unsigned char certificateType[32];
-	unsigned char certificate[5501];
-	unsigned char Response_status[16];
+    unsigned char certificateType[32];
+    unsigned char certificate[5501];
+    unsigned char Response_status[16];
 };
 
 struct StructSignedUpdateFirmware
 {
-	int retries;
-	int retryInterval;
-	int requestId;
-	struct FirmwareType firmware;
-	unsigned char Response_status[16];
+    int retries;
+    int retryInterval;
+    int requestId;
+    struct FirmwareType firmware;
+    unsigned char Response_status[16];
 };
 
 struct StructLogStatusNotification
 {
-	unsigned char status[32];
-	int requestId;
+    unsigned char status[32];
+    int requestId;
 };
 
 struct StructSecurityEventNotification
 {
-	unsigned char type[51];
-	unsigned char timestamp[28];
-	unsigned char techInfo[256];
+    unsigned char type[51];
+    unsigned char timestamp[28];
+    unsigned char techInfo[256];
 };
 
 struct StructSignCertificate
 {
-	unsigned char csr[5501];
-	unsigned char Response_status[16];
+    unsigned char csr[5501];
+    unsigned char Response_status[16];
 };
 
 struct StructSignedFirmwareStatusNotification
 {
-	unsigned char status[32];
-	int requestId;
+    unsigned char status[32];
+    int requestId;
 };
 
 struct OCPP16Data
@@ -4363,23 +4392,23 @@ struct OCPP16Data
         struct
         {
             //SpMsgValue[0]
-            unsigned char BootNotificationReq :1;               	//bit 0,
-            unsigned char BootNotificationConf :1;              	//bit 1,
-            unsigned char AuthorizeReq :1;                      	//bit 2,
-            unsigned char AuthorizeConf :1;                     	//bit 3,
-            unsigned char DiagnosticsStatusNotificationReq :1;  	//bit 4,
-            unsigned char DiagnosticsStatusNotificationConf :1; 	//bit 5,
-            unsigned char FirmwareStatusNotificationReq :1;     	//bit 6,
-            unsigned char FirmwareStatusNotificationConf :1;   	 	//bit 7,
+            unsigned char BootNotificationReq :1;                   //bit 0,
+            unsigned char BootNotificationConf :1;                  //bit 1,
+            unsigned char AuthorizeReq :1;                          //bit 2,
+            unsigned char AuthorizeConf :1;                         //bit 3,
+            unsigned char DiagnosticsStatusNotificationReq :1;      //bit 4,
+            unsigned char DiagnosticsStatusNotificationConf :1;     //bit 5,
+            unsigned char FirmwareStatusNotificationReq :1;         //bit 6,
+            unsigned char FirmwareStatusNotificationConf :1;        //bit 7,
             //SpMsgValue[1]
             unsigned char LogStatusNotificationReq :1;              //bit 0,
-			unsigned char LogStatusNotificationConf :1;             //bit 1,
-			unsigned char SecurityEventNotificationReq :1;          //bit 2,
-			unsigned char SecurityEventNotificationConf :1;         //bit 3,
-			unsigned char SignCertificateReq :1;  					//bit 4,
-			unsigned char SignCertificateConf :1; 					//bit 5,
-			unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
-			unsigned char SignedFirmwareStatusNotificationConf :1;	//bit 7,
+            unsigned char LogStatusNotificationConf :1;             //bit 1,
+            unsigned char SecurityEventNotificationReq :1;          //bit 2,
+            unsigned char SecurityEventNotificationConf :1;         //bit 3,
+            unsigned char SignCertificateReq :1;                    //bit 4,
+            unsigned char SignCertificateConf :1;                   //bit 5,
+            unsigned char SignedFirmwareStatusNotificationReq :1;   //bit 6,
+            unsigned char SignedFirmwareStatusNotificationConf :1;  //bit 7,
         } bits;
     } SpMsg;
 
@@ -4425,40 +4454,40 @@ struct OCPP16Data
         struct
         {
             //CsMsgValue[0]
-            unsigned char ChangeConfigurationReq :1;    			//bit 0,
-            unsigned char ChangeConfigurationConf :1;   			//bit 1,
-            unsigned char ClearCacheReq :1;             			//bit 2,
-            unsigned char ClearCacheConf :1;            			//bit 3,
-            unsigned char GetConfigurationReq :1;       			//bit 4,
-            unsigned char GetConfigurationConf :1;      			//bit 5,
-            unsigned char UpdateFirmwareReq :1;         			//bit 6,
-            unsigned char UpdateFirmwareConf :1;        			//bit 7,
+            unsigned char ChangeConfigurationReq :1;                //bit 0,
+            unsigned char ChangeConfigurationConf :1;               //bit 1,
+            unsigned char ClearCacheReq :1;                         //bit 2,
+            unsigned char ClearCacheConf :1;                        //bit 3,
+            unsigned char GetConfigurationReq :1;                   //bit 4,
+            unsigned char GetConfigurationConf :1;                  //bit 5,
+            unsigned char UpdateFirmwareReq :1;                     //bit 6,
+            unsigned char UpdateFirmwareConf :1;                    //bit 7,
             //CsMsgValue[1]
-            unsigned char GetDiagnosticsReq :1;         			//bit 0,
-            unsigned char GetDiagnosticsConf :1;        			//bit 1,
-            unsigned char GetLocalListVersionReq :1;   				//bit 2,
-            unsigned char GetLocalListVersionConf :1;   			//bit 3,
-            unsigned char ResetReq :1;                  			//bit 4,
-            unsigned char ResetConf :1;                 			//bit 5,
-            unsigned char SendLocalListReq :1;         				//bit 6,
-            unsigned char SendLocalListConf :1;         			//bit 7,
+            unsigned char GetDiagnosticsReq :1;                     //bit 0,
+            unsigned char GetDiagnosticsConf :1;                    //bit 1,
+            unsigned char GetLocalListVersionReq :1;                //bit 2,
+            unsigned char GetLocalListVersionConf :1;               //bit 3,
+            unsigned char ResetReq :1;                              //bit 4,
+            unsigned char ResetConf :1;                             //bit 5,
+            unsigned char SendLocalListReq :1;                      //bit 6,
+            unsigned char SendLocalListConf :1;                     //bit 7,
             //CsMsgValue[2]
-            unsigned char CertificateSignedReq :1;					//bit 0
-            unsigned char CertificateSignedConf :1;					//bit 1
-            unsigned char DeleteCertificateReq :1;					//bit 2
-            unsigned char DeleteCertificateConf :1;					//bit 3
-            unsigned char ExtendedTriggerMessageReq :1;				//bit 4
-            unsigned char ExtendedTriggerMessageConf :1;			//bit 5
-            unsigned char GetInstalledCertificateIdsReq :1;			//bit 6
-            unsigned char GetInstalledCertificateIdsConf :1;		//bit 7
+            unsigned char CertificateSignedReq :1;                  //bit 0
+            unsigned char CertificateSignedConf :1;                 //bit 1
+            unsigned char DeleteCertificateReq :1;                  //bit 2
+            unsigned char DeleteCertificateConf :1;                 //bit 3
+            unsigned char ExtendedTriggerMessageReq :1;             //bit 4
+            unsigned char ExtendedTriggerMessageConf :1;            //bit 5
+            unsigned char GetInstalledCertificateIdsReq :1;         //bit 6
+            unsigned char GetInstalledCertificateIdsConf :1;        //bit 7
             //CsMsgValue[3]
-            unsigned char GetLogReq :1;								//bit 0
-            unsigned char GetLogConf :1;							//bit 1
-            unsigned char InstallCertificateReq :1;					//bit 2
-            unsigned char InstallCertificateConf :1;				//bit 3
-            unsigned char SignedUpdateFirmwareReq :1;				//bit 4
-            unsigned char SignedUpdateFirmwareConf :1;				//bit 5
-            unsigned char :2;										//bit 6 & 7
+            unsigned char GetLogReq :1;                             //bit 0
+            unsigned char GetLogConf :1;                            //bit 1
+            unsigned char InstallCertificateReq :1;                 //bit 2
+            unsigned char InstallCertificateConf :1;                //bit 3
+            unsigned char SignedUpdateFirmwareReq :1;               //bit 4
+            unsigned char SignedUpdateFirmwareConf :1;              //bit 5
+            unsigned char :2;                                       //bit 6 & 7
         } bits;
     } MsMsg;
 
@@ -4475,48 +4504,48 @@ struct OCPP16Data
         } bits[CONNECTOR_QUANTITY];
     }CSUMsg;
 
-    struct StructBootNotification               	BootNotification;
-    struct StructHeartbeat                     	 	Heartbeat;
-    struct StructAuthorize                      	Authorize;
-    struct StructStartTransaction               	StartTransaction[CONNECTOR_QUANTITY];
-    struct StructStopTransaction                	StopTransaction[CONNECTOR_QUANTITY];
-    struct StructStatusNotification             	StatusNotification[CONNECTOR_QUANTITY];
-    struct StructCancelReservation              	CancelReservation[CONNECTOR_QUANTITY];
-    struct StructChangeAvailability             	ChangeAvailability[CONNECTOR_QUANTITY];
-    struct StructChangeConfiguration            	ChangeConfiguration;
-    struct StructClearCache                     	ClearCache;
-    struct StructClearChargingProfile           	ClearChargingProfile[CONNECTOR_QUANTITY];
-    struct StructDataTransfer                   	DataTransfer[CONNECTOR_QUANTITY];
-    struct StructDiagnosticsStatusNotification  	DiagnosticsStatusNotification;
-    struct StructFirmwareStatusNotification     	FirmwareStatusNotification;
-    struct StructGetCompositeSchedule           	GetCompositeSchedule[CONNECTOR_QUANTITY];
-    struct StructGetConfiguration               	GetConfiguration;
-    struct StructGetDiagnostics                 	GetDiagnostics;
-    struct StructGetLocalListVersion            	GetLocalListVersion;
-    struct StructMeterValues                    	MeterValues[CONNECTOR_QUANTITY];
-    struct StructRemoteStartTransaction         	RemoteStartTransaction[CONNECTOR_QUANTITY];
-    struct StructRemoteStopTransaction          	RemoteStopTransaction[CONNECTOR_QUANTITY];
-    struct StructReserveNow                     	ReserveNow[CONNECTOR_QUANTITY];
-    struct StructReset                          	Reset;
-    struct StructSendLocalList                  	SendLocalList;
-    struct StructSetChargingProfile            		SetChargingProfile[CONNECTOR_QUANTITY];
-    struct StructTriggerMessage                 	TriggerMessage[CONNECTOR_QUANTITY];
-    struct StructUnlockConnector                	UnlockConnector[CONNECTOR_QUANTITY];
-    struct StructUpdateFirmware                 	UpdateFirmware;
-    struct OCPP16ConfigurationTable             	ConfigurationTable;
-    struct StructChargingProfile                	SmartChargingProfile[CONNECTOR_QUANTITY];
-    struct StructCost                           	Cost;
-    struct StructCertificateSigned					CertificateSigned;
-    struct StructDeleteCertificate					DeleteCertificate;
-    struct StructExtendedTrigger					ExtendedTriggerMessage;
-    struct StructGetInstalledCertificateIds			GetInstalledCertificateIds;
-    struct StructGetLog								GetLog;
-    struct StructInstallCertificate					InstallCertificate;
-    struct StructSignedUpdateFirmware				SignedUpdateFirmware;
-    struct StructLogStatusNotification				LogStatusNotification;
-    struct StructSecurityEventNotification			SecurityEventNotification;
-    struct StructSignCertificate					SignCertificate;
-    struct StructSignedFirmwareStatusNotification 	SignedFirmwareStatusNotification;
+    struct StructBootNotification                   BootNotification;
+    struct StructHeartbeat                          Heartbeat;
+    struct StructAuthorize                          Authorize;
+    struct StructStartTransaction                   StartTransaction[CONNECTOR_QUANTITY];
+    struct StructStopTransaction                    StopTransaction[CONNECTOR_QUANTITY];
+    struct StructStatusNotification                 StatusNotification[CONNECTOR_QUANTITY];
+    struct StructCancelReservation                  CancelReservation[CONNECTOR_QUANTITY];
+    struct StructChangeAvailability                 ChangeAvailability[CONNECTOR_QUANTITY];
+    struct StructChangeConfiguration                ChangeConfiguration;
+    struct StructClearCache                         ClearCache;
+    struct StructClearChargingProfile               ClearChargingProfile[CONNECTOR_QUANTITY];
+    struct StructDataTransfer                       DataTransfer[CONNECTOR_QUANTITY];
+    struct StructDiagnosticsStatusNotification      DiagnosticsStatusNotification;
+    struct StructFirmwareStatusNotification         FirmwareStatusNotification;
+    struct StructGetCompositeSchedule               GetCompositeSchedule[CONNECTOR_QUANTITY];
+    struct StructGetConfiguration                   GetConfiguration;
+    struct StructGetDiagnostics                     GetDiagnostics;
+    struct StructGetLocalListVersion                GetLocalListVersion;
+    struct StructMeterValues                        MeterValues[CONNECTOR_QUANTITY];
+    struct StructRemoteStartTransaction             RemoteStartTransaction[CONNECTOR_QUANTITY];
+    struct StructRemoteStopTransaction              RemoteStopTransaction[CONNECTOR_QUANTITY];
+    struct StructReserveNow                         ReserveNow[CONNECTOR_QUANTITY];
+    struct StructReset                              Reset;
+    struct StructSendLocalList                      SendLocalList;
+    struct StructSetChargingProfile                 SetChargingProfile[CONNECTOR_QUANTITY];
+    struct StructTriggerMessage                     TriggerMessage[CONNECTOR_QUANTITY];
+    struct StructUnlockConnector                    UnlockConnector[CONNECTOR_QUANTITY];
+    struct StructUpdateFirmware                     UpdateFirmware;
+    struct OCPP16ConfigurationTable                 ConfigurationTable;
+    struct StructChargingProfile                    SmartChargingProfile[CONNECTOR_QUANTITY];
+    struct StructCost                               Cost;
+    struct StructCertificateSigned                  CertificateSigned;
+    struct StructDeleteCertificate                  DeleteCertificate;
+    struct StructExtendedTrigger                    ExtendedTriggerMessage;
+    struct StructGetInstalledCertificateIds         GetInstalledCertificateIds;
+    struct StructGetLog                             GetLog;
+    struct StructInstallCertificate                 InstallCertificate;
+    struct StructSignedUpdateFirmware               SignedUpdateFirmware;
+    struct StructLogStatusNotification              LogStatusNotification;
+    struct StructSecurityEventNotification          SecurityEventNotification;
+    struct StructSignCertificate                    SignCertificate;
+    struct StructSignedFirmwareStatusNotification   SignedFirmwareStatusNotification;
 };
 
 
@@ -5083,8 +5112,8 @@ struct TransactionType
 
 struct StatusInfoType
 {
-	unsigned char reasonCode[21];									// Required. A predefined code for the reason why thestatus is returned in this response. The string is case-insensitive.
-	unsigned char additionalInfo[513];								// Optional. Additional text to provide detailed information.
+    unsigned char reasonCode[21];                                   // Required. A predefined code for the reason why thestatus is returned in this response. The string is case-insensitive.
+    unsigned char additionalInfo[513];                              // Optional. Additional text to provide detailed information.
 };
 /*
  * =============== Message ===============
@@ -5115,11 +5144,11 @@ struct CancelReservation_20
 
 struct CertificateSigned_20
 {
-	unsigned char certificateChain[10001];							// Required. Required. The signed PEM encoded X.509 certificate.This can also contain the necessary sub CA certificates.In that case, the order of the bundle should follow thecertificate chain, starting from the leaf certificate.The Configuration Variable MaxCertificateChainSize canbe used to limit the maximum size of this field.
-	unsigned char certificateType[32];								// Optional. Indicates the type of the signed certificate that is returned.
-	unsigned char Response_status[16];								// Required. Returns whether certificate signing has been accepted, otherwise rejected.
-	struct StatusInfoType Response_statusInfo;						// Optional. Detailed status information.
-	unsigned char guid[37];											// Save guid from server request
+    unsigned char certificateChain[10001];                          // Required. Required. The signed PEM encoded X.509 certificate.This can also contain the necessary sub CA certificates.In that case, the order of the bundle should follow thecertificate chain, starting from the leaf certificate.The Configuration Variable MaxCertificateChainSize canbe used to limit the maximum size of this field.
+    unsigned char certificateType[32];                              // Optional. Indicates the type of the signed certificate that is returned.
+    unsigned char Response_status[16];                              // Required. Returns whether certificate signing has been accepted, otherwise rejected.
+    struct StatusInfoType Response_statusInfo;                      // Optional. Detailed status information.
+    unsigned char guid[37];                                         // Save guid from server request
 };
 
 struct ChangeAvailability_20
@@ -5549,10 +5578,10 @@ struct SetVariables_20
 
 struct SignCertificate_20
 {
-	unsigned char csr[5501];										// Required. The Charging Station SHALL send the public key in form of a Certificate Signing Request (CSR) as described in RFC 2986 [22] using the SignCertificateRequest message.
-	unsigned char certificateType[32];								// Optional. Indicates the type of certificate that is to be signed. When omitted the certificate is to be used for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
-	unsigned char Response_status[16];								// Required. Specifies whether the CSMS can process the request.
-	struct StatusInfoType Response_statusInfo;						// Optional. Detailed status information.
+    unsigned char csr[5501];                                        // Required. The Charging Station SHALL send the public key in form of a Certificate Signing Request (CSR) as described in RFC 2986 [22] using the SignCertificateRequest message.
+    unsigned char certificateType[32];                              // Optional. Indicates the type of certificate that is to be signed. When omitted the certificate is to be used for both the 15118 connection (if implemented) and the Charging Station to CSMS connection.
+    unsigned char Response_status[16];                              // Required. Specifies whether the CSMS can process the request.
+    struct StatusInfoType Response_statusInfo;                      // Optional. Detailed status information.
 };
 
 struct StatusNotification_20

BIN
EVSE/rootfs/root/Module_Payment


BIN
EVSE/rootfs/root/OcppBackend20


برخی فایل ها در این مقایسه diff نمایش داده نمی شوند زیرا تعداد فایل ها بسیار زیاد است