Ver Fonte

2022-01-12/Jerry Wang
Action:
1. Fix the problem that EVSE cannot send out all of the Clock-Aligned MeterValues for each connector.
2. Fix the problem that EVSE cannot record the Transaction related messages queue when EVSE can connect to server but no OCPP message feedback from backend.

File:
/EVSE/Modularization/ocpp20/MessageHandler.c
-->Action 1
/EVSE/Modularization/ocpp20/Module_OcppBackend20.c
-->Action 2

Jerry Wang há 3 anos atrás
pai
commit
87392d444b

+ 102 - 100
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -6633,6 +6633,108 @@ void CheckSystemValue(void)
 		ShmOCPP20Data->SpMsg.bits.Get15118EVCertificateReq = OFF;
 	}
 
+	for(int gun_index=0;gun_index < gunTotalNumber;gun_index++)
+	{
+		// ClockAlign MeterValue
+		if(isWebsocketSendable && (server_sign == TRUE) && ((atoi((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].value) > 0)?((getTimePassSinceToday(gun_index)%(atoi((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].value)))==0):FALSE))
+		{
+			//check Transaction active
+			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+			{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+				{
+					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+					{
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
+					}
+				}// End for CHAdeMO
+			}
+			else if(gunType[gun_index] == GUN_TYPE_CCS)
+			{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CCS_QUANTITY; index++)
+				{
+					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+					{
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
+					}
+				} // End for CCS
+			}
+			else if(gunType[gun_index] == GUN_TYPE_GBT)
+			{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < GB_QUANTITY; index++)
+				{
+					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+					{
+						cpinitateMsg.bits[gun_index].SampleMeterReq = ON;
+					}
+				}// End for GB
+			}
+			else if(gunType[gun_index] == GUN_TYPE_DO)
+			{
+				tempIndex = gun_index;
+
+				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+				{
+					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+					if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+					{
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
+					}
+				}
+			}
+			else
+			{
+
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+				{
+					tempIndex = 2;
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < AC_QUANTITY; index++)
+				{
+					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
+					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+					{
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
+					}
+				}//End for AC
+			}
+		}
+	}
 
 	//===============================
 	// Each connector operation check
@@ -6979,106 +7081,6 @@ void CheckSystemValue(void)
 			cpinitateMsg.bits[gun_index].TriggerMeterValueReq = OFF;
 		}
 
-		// ClockAlign MeterValue
-		if(isWebsocketSendable && (server_sign == TRUE) && ((atoi((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].value) > 0)?((getTimePassSinceToday(gun_index)%(atoi((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].variableAttribute[0].value)))==0):FALSE))
-		{
-			//check Transaction active
-			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
-			{
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((gun_index==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = gun_index;
-				}
-
-				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-				{
-					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
-					{
-						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-					}
-				}// End for CHAdeMO
-			}
-			else if(gunType[gun_index] == GUN_TYPE_CCS)
-			{
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((gun_index==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = gun_index;
-				}
-
-				for (int index = 0; index < CCS_QUANTITY; index++)
-				{
-					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
-					{
-						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-					}
-				} // End for CCS
-			}
-			else if(gunType[gun_index] == GUN_TYPE_GBT)
-			{
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-				{
-					tempIndex = ((gun_index==2) ? 1: 0);
-				}
-				else
-				{
-					tempIndex = gun_index;
-				}
-
-				for (int index = 0; index < GB_QUANTITY; index++)
-				{
-					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
-					{
-						cpinitateMsg.bits[gun_index].SampleMeterReq = ON;
-					}
-				}// End for GB
-			}
-			else if(gunType[gun_index] == GUN_TYPE_DO)
-			{
-				tempIndex = gun_index;
-
-				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
-				{
-					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-					if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
-					{
-						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-					}
-				}
-			}
-			else
-			{
-
-				if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-				{
-					tempIndex = 2;
-				}
-				else
-				{
-					tempIndex = gun_index;
-				}
-
-				for (int index = 0; index < AC_QUANTITY; index++)
-				{
-					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
-					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
-					{
-						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-					}
-				}//End for AC
-			}
-		}
-
 		if(isWebsocketSendable && (cpinitateMsg.bits[gun_index].ClockAlignMeterReq == ON))
 		{
 			sendMeterValuesRequest(gun_index, ReadingContextEnumType_Sample_Clock);

+ 3 - 2
EVSE/Modularization/ocpp20/Module_OcppBackend20.c

@@ -1164,6 +1164,9 @@ int main(void)
 				refreshStartTimer(&startTime.bootNotification);
 			}
 
+			// Check System Value
+			CheckSystemValue();
+
 			// On line operation
 			if(GetServerSign() == TRUE)
 			{
@@ -1175,8 +1178,6 @@ int main(void)
 					queueOpInfo.PreTransactionMessageResend = queueOpInfo.TransactionMessageResend;
 				}
 
-				// Check System Value
-				CheckSystemValue();
 
 				// PING packet
 				if(isWebsocketSendable && (0 < GetWebSocketPingInterval()) && ((GetWebSocketPingInterval()+counterPingSend) <= getDiffSecNow(startTime.pingOn)))