Эх сурвалжийг харах

2022-04-27/Jerry Wang
[OCPP 2.0]
Action:
1. Modify the logic that ignore checking limit in handleSetChargingProfile() when the key 'isEnableLocalPowerSharing' value is 1.
2. Correct the searching Max Profile name to 'ChargingStationMaxProfile_OCPP20.json' in checkCompositeSchedule() and checkChargingStationMaxProfile() function.
3. Fix the problem that sometimes EVSE do not send StatusNotification after reconnecting backend.
4. Delete 'SystemInitial' and related function.
5. Add PUT method for uploading logs.

File:
1. EVSE/Modularization/ocpp20/MessageHandler.c
--> Action 1,2,3,4

Jerry Wang 2 жил өмнө
parent
commit
e7b1fa154b

+ 67 - 51
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -797,7 +797,6 @@ static int variableVersion=6;
 static int server_sign					= FALSE;
 int server_pending 						= FALSE;
 static int BootNotificationInterval 	= 10;
-static int SystemInitial 				= 0;//= CHAdeMO_QUANTITY + CCS_QUANTITY + GB_QUANTITY;	// System Boot UP
 
 //===============================
 // OCPP auth variable
@@ -3979,7 +3978,7 @@ void checkChargingStationMaxProfile(uint32_t durationReq, struct ChargingProfile
 	system("cp /Storage/OCPP/*.json /tmp 2>/dev/null");
 
 	// Search max profile
-	sprintf(profileFileName, "/tmp/ChargePointMaxProfile.json");
+	sprintf(profileFileName, "/tmp/ChargingStationMaxProfile_OCPP20.json");
 	if((access(profileFileName, F_OK))!=-1)
 	{
 		fp = fopen(profileFileName, "r");
@@ -4150,7 +4149,6 @@ void checkChargingStationMaxProfile(uint32_t durationReq, struct ChargingProfile
 						if(isUnitA)
 						{
 							sprintf((char*)maxProfile.chargingSchedule[idxSchedule].chargingRateUnit, "A");
-
 							for(int idxPeriod=0;idxPeriod<json_object_array_length(json_object_object_get(json_object_array_get_idx(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), 0), "chargingSchedulePeriod"));idxPeriod++)
 							{
 								maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = json_object_get_int(json_object_object_get(json_object_array_get_idx(json_object_object_get(json_object_array_get_idx(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), 0), "chargingSchedulePeriod"), idxPeriod), "startPeriod"));
@@ -5118,7 +5116,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 	}
 
 	// Search max profile
-	sprintf(profileFileName, "/tmp/ChargePointMaxProfile.json");
+	sprintf(profileFileName, "/tmp/ChargingStationMaxProfile_OCPP20.json");
 	if((access(profileFileName, F_OK))!=-1)
 	{
 		fp = fopen(profileFileName, "r");
@@ -6366,7 +6364,6 @@ int ProcessShareMemory()
 			// DO series
 			for(int gun_index=0; gun_index<GENERAL_GUN_QUANTITY ; gun_index++)
 			{
-				SystemInitial += 1;
 				gunTotalNumber += 1;
 				gunType[gun_index] = GUN_TYPE_DO;
 
@@ -6394,7 +6391,6 @@ int ProcessShareMemory()
 		{
  			for(int gun_index=0;gun_index<modelnameInfo.GetGunCount;gun_index++)
  			{
-				SystemInitial += 1;
 				gunTotalNumber += 1;
 
  				switch(modelnameInfo.ParsingInfo[gun_index].GunType)
@@ -7115,14 +7111,13 @@ void CheckSystemValue(void)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[index]) )
+					if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != ChademoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn != ChademoPreviousConnectorPlugIn[index]) )
 					{
 						ChademoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus;
 						ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
-						if((SystemInitial == 0) &&
-						   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
+						if((ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
 						   (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
@@ -7169,14 +7164,13 @@ void CheckSystemValue(void)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
+					if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn != CcsPreviousConnectorPlugIn[index]) )//if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != CcsPreviousSystemStatus[index]/*PRE_SYS_MODE[gun_index]*/ )
 					{
 						CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus;
 						CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
-						if((SystemInitial == 0) &&
-						   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
+						if((ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
 						   (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
@@ -7222,14 +7216,13 @@ void CheckSystemValue(void)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[index]) )
+					if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != GbPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn != GbPreviousConnectorPlugIn[index]) )
 					{
 						GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus;
 						GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
-						if((SystemInitial == 0) &&
-						   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
+						if((ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
 						   (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
@@ -7268,14 +7261,13 @@ void CheckSystemValue(void)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != DoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn != DoPreviousConnectorPlugIn[index]) )
+					if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != DoPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn != DoPreviousConnectorPlugIn[index]) )
 					{
 						DoPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus;
 						DoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.ConnectorPlugIn;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
-						if((SystemInitial == 0) &&
-						   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_CHARGING) &&
+						if((ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus >= SYS_MODE_CHARGING) &&
 						   (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus <= SYS_MODE_COMPLETE))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
@@ -7320,14 +7312,13 @@ void CheckSystemValue(void)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 				{
-					if((SystemInitial > 0) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[index]) )
+					if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != AcPreviousSystemStatus[index]) || (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState != AcPreviousConnectorPlugIn[index]) )
 					{
 						AcPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus;
 						AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
 						cpinitateMsg.bits[gun_index].StatusNotificationReq = ON;
 
-						if((SystemInitial == 0) &&
-						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
+						if((ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus >= SYS_MODE_CHARGING) &&
 						   (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus <= SYS_MODE_COMPLETE))
 						{
 							ShmOCPP20Data->CpMsg.bits[gun_index].TransactionEventReq = ON;
@@ -7365,9 +7356,6 @@ void CheckSystemValue(void)
 		   ((strcmp((const char *)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationPeriodically].variableAttribute[0].value, "TRUE") == 0) &&
 			(getDiffSecNow(clientTime.StatusNotification[gun_index]) >= atoi((char*)ShmOCPP20Data->ControllerComponentVariable[OCPPCommCtrlr_StatusNotificationInterval].variableAttribute[0].value)))))
 		{
-			if(SystemInitial > 0)
-				SystemInitial -= 1;
-
 			sendStatusNotificationRequest(gun_index);
 			refreshStartTimer(&clientTime.StatusNotification[gun_index]);
 		}
@@ -16684,30 +16672,34 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
 									}
 
 									// Check invalid limit
-									if(ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A')
+									if((strstr((char*)SetProfileReq.chargingProfile.chargingProfilePurpose, ChargingProfilePurposeEnumTypeStr[ChargingProfilePurposeEnumType_ChargingStationMaxProfile]) == NULL) ||
+									   ((strstr((char*)SetProfileReq.chargingProfile.chargingProfilePurpose, ChargingProfilePurposeEnumTypeStr[ChargingProfilePurposeEnumType_ChargingStationMaxProfile]) != NULL) && (ShmSysConfigAndInfo->SysConfig.isEnableLocalPowerSharing != 1)))
 									{
-										if(((0 < SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit) && (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit < (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='A'?6:6*220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)))) ||
-											(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit > (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?modelnameInfo.ratedPower:ShmSysConfigAndInfo->SysConfig.RatingCurrent)))
+										if(ShmSysConfigAndInfo->SysConfig.ModelName[0] == 'A')
 										{
-											DEBUG_WARN("Profile chargingSchedule-%d period-%02d is invalid limit: %.2f %s with phase %d.\n", idxSchedule, idxPeriod,
-																														 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit,
-																														 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit,
-																														 (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases));
-											DEBUG_WARN("Rated Power: %d, Rating Current: %d\n", modelnameInfo.ratedPower, ShmSysConfigAndInfo->SysConfig.RatingCurrent);
-											isInvalidLimit = TRUE;
+											if(((0 < SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit) && (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit < (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='A'?6:6*220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)))) ||
+												(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit > (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?modelnameInfo.ratedPower:ShmSysConfigAndInfo->SysConfig.RatingCurrent)))
+											{
+												DEBUG_WARN("Profile chargingSchedule-%d period-%02d is invalid limit: %.2f %s with phase %d.\n", idxSchedule, idxPeriod,
+																															 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit,
+																															 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit,
+																															 (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases));
+												DEBUG_WARN("Rated Power: %d, Rating Current: %d\n", modelnameInfo.ratedPower, ShmSysConfigAndInfo->SysConfig.RatingCurrent);
+												isInvalidLimit = TRUE;
+											}
 										}
-									}
-									else
-									{
-										if((SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?1:220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)) > modelnameInfo.ratedPower) ||
-										   (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?1:220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)) < (modelnameInfo.ratedPower*0.01)))
+										else
 										{
-											DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
-																														 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit,
-																														 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit,
-																														 (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases));
-											DEBUG_WARN("Rated Power: %d \n", modelnameInfo.ratedPower);
-											isInvalidLimit = TRUE;
+											if((SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?1:220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)) > modelnameInfo.ratedPower) ||
+											   (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit[0]=='W'?1:220*(SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases)) < (modelnameInfo.ratedPower*0.01)))
+											{
+												DEBUG_WARN("Profile period-%02d is invalid limit: %.2f %s with phase %d.\n", idxPeriod,
+																															 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit,
+																															 SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingRateUnit,
+																															 (SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases==0?3:SetProfileReq.chargingProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases));
+												DEBUG_WARN("Rated Power: %d \n", modelnameInfo.ratedPower);
+												isInvalidLimit = TRUE;
+											}
 										}
 									}
 								}
@@ -19238,7 +19230,30 @@ int httpUploadFile(char *location, char *path, char *filename,char *url)
 
 	if(systemresult != 1)
 	{
-		DEBUG_INFO("HTTP upload error!\n");
+		DEBUG_WARN("HTTP POST upload error, change to PUT method\n");
+		FILE *phpFP = popen("/bin/php-cgi /var/www/ocpp_upload_put.php", "r");
+		if(phpFP == NULL)
+		{
+			DEBUG_WARN("PHP PUT upload fail.\n");
+			return FALSE;
+		}
+		else
+		{
+			while(fgets(buf, sizeof(buf), phpFP) != NULL)
+			{
+				if(strstr(buf, "result") != NULL)
+				{
+					sscanf(buf, "result: %d", &systemresult);
+					DEBUG_INFO("PHP HTTP PUT upload result: %d\n", systemresult);
+				}
+			}
+			pclose(phpFP);
+		}
+	}
+
+	if(systemresult != 1)
+	{
+		DEBUG_WARN("PHP PUT upload fail.\n");
 		return FALSE;
 	}
 
@@ -19751,31 +19766,31 @@ void InitialSystemValue(void)
 	//Status &&  ConnectorPlugIn Setting
 	for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 	{
-		ChademoPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PreviousSystemStatus;
+		ChademoPreviousSystemStatus[index] = 99; //ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PreviousSystemStatus;
 		ChademoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].ConnectorPlugIn;
 	}
 
 	for (int index = 0; index < CCS_QUANTITY; index++)
 	{
-		CcsPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PreviousSystemStatus;
+		CcsPreviousSystemStatus[index] = 99; //ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PreviousSystemStatus;
 		CcsPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].ConnectorPlugIn;
 	}
 
 	for (int index = 0; index < GB_QUANTITY; index++)
 	{
-		GbPreviousSystemStatus[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PreviousSystemStatus;
+		GbPreviousSystemStatus[index] = 99; //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PreviousSystemStatus;
 		GbPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].ConnectorPlugIn;
 	}
 
 	for (int index = 0; index < AC_QUANTITY; index++)
 	{
-		AcPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PreviousSystemStatus;
+		AcPreviousSystemStatus[index] = 99; //ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PreviousSystemStatus;
 		AcPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PilotState;
 	}
 
 	for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 	{
-		DoPreviousSystemStatus[index]= ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PreviousSystemStatus;
+		DoPreviousSystemStatus[index] = 99; //ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PreviousSystemStatus;
 		DoPreviousConnectorPlugIn[index] = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PilotState;
 	}
 
@@ -19786,7 +19801,8 @@ void InitialSystemValue(void)
 		cpinitateMsg.bits[gun_index].StatusNotificationConf = OFF;
 		//clientTime.MeterValues[gun_index] = time((time_t*)NULL);
 		refreshStartTimer(&clientTime.StatusNotification[gun_index]);
-		memset(&ShmOCPP20Data->StatusNotification[gun_index], 0x00, sizeof(struct StatusNotification_20));
+		//memset(&ShmOCPP20Data->StatusNotification[gun_index], 0x00, sizeof(struct StatusNotification_20));
+		memset(&ShmOCPP20Data->StatusNotification[gun_index].connectorStatus, 0x00, sizeof(ShmOCPP20Data->StatusNotification[gun_index].connectorStatus));
 	}
 
 	refreshStartTimer(&clientTime.Heartbeat);