Преглед изворни кода

[Improve][Modularization][Module_OcppBackend / Module_OcppBackend20]

2021.08.04 / Folus Wen

Actions:
1. Enable align clock meter values sent out in charging mode.
2. Configuration key change to reversion 3 for modify default value.

Files:
1. As follow commit history

Image version: D0.00.XX.XXXX.XX
Image checksum: XXXXXXXX

Hardware PWB P/N : XXXXXXX
Hardware Version : XXXXXXX
FolusWen пре 3 година
родитељ
комит
2a73023df2
2 измењених фајлова са 25 додато и 50 уклоњено
  1. 10 22
      EVSE/Modularization/ocpp20/MessageHandler.c
  2. 15 28
      EVSE/Modularization/ocppfiles/MessageHandler.c

+ 10 - 22
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -5899,10 +5899,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-						}
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
 					}
 				}// End for CHAdeMO
 			}
@@ -5922,10 +5919,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-						}
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
 					}
 				} // End for CCS
 			}
@@ -5945,10 +5939,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							cpinitateMsg.bits[gun_index].SampleMeterReq = ON;
-						}
+						cpinitateMsg.bits[gun_index].SampleMeterReq = ON;
 					}
 				}// End for GB
 			}
@@ -5961,10 +5952,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != SYS_MODE_CHARGING)
-						{
-							cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-						}
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
 					}
 				}
 			}
@@ -5985,10 +5973,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
-						}
+						cpinitateMsg.bits[gun_index].ClockAlignMeterReq = ON;
 					}
 				}//End for AC
 			}
@@ -6001,7 +5986,7 @@ void CheckSystemValue(void)
 		}
 
 		// Sample period MeterValue
-		if(((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > (atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value)- 1)))
+		if((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > ((atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value)>10)?(atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value)- 1):10))
 		{
 			//check Transaction active
 			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
@@ -6115,7 +6100,9 @@ void CheckSystemValue(void)
 
 			if(cpinitateMsg.bits[gun_index].SampleMeterReq == ON)
 			{
-				sendMeterValuesRequest(gun_index, ReadingContextEnumType_Sample_Periodic);
+				if(atoi((const char *)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].variableAttribute[0].value) > 0)
+					sendMeterValuesRequest(gun_index, ReadingContextEnumType_Sample_Periodic);
+
 				storeTempStopTransaction(gun_index);
 				cpinitateMsg.bits[gun_index].SampleMeterReq = OFF;
 			}
@@ -17502,6 +17489,7 @@ void InitialSystemValue(void)
 		cpinitateMsg.bits[gun_index].StatusNotificationConf = OFF;
 		//clientTime.MeterValues[gun_index] = time((time_t*)NULL);
 		clientTime.StatusNotification[gun_index] = time((time_t*)NULL);
+		memset(&ShmOCPP20Data->StatusNotification[gun_index], 0x00, sizeof(struct StatusNotification_20));
 	}
 	clientTime.Heartbeat=time((time_t*)NULL);
 

+ 15 - 28
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -24,9 +24,9 @@ char queuedata[QUEUE_MESSAGE_LENGTH]				= {0};
 static int server_cycle_Status 		= 120;
 
 //===============================
-// Configuration: unknownkey
+// Configuration: unknown key
 //===============================
-static char unknownkey[10][20]		= {0};
+static char unknownkey[10][36]		= {0};
 static int UnknownKeynum 			= 0;
 
 //===============================
@@ -3298,10 +3298,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							reqClockAlignMeter[gun_index] = 1;
-						}
+						reqClockAlignMeter[gun_index] = 1;
 					}
 				}// End for CHAdeMO
 			}
@@ -3321,10 +3318,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							reqClockAlignMeter[gun_index] = 1;
-						}
+						reqClockAlignMeter[gun_index] = 1;
 					}
 				} // End for CCS
 			}
@@ -3344,10 +3338,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.GbChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							reqClockAlignMeter[gun_index] = 1;
-						}
+						reqClockAlignMeter[gun_index] = 1;
 					}
 				}// End for GB
 			}
@@ -3360,10 +3351,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.SystemStatus != SYS_MODE_CHARGING)
-						{
-							reqClockAlignMeter[gun_index] = 1;
-						}
+						reqClockAlignMeter[gun_index] = 1;
 					}
 				}
 			}
@@ -3383,10 +3371,7 @@ void CheckSystemValue(void)
 					// 0: Booting, 1: idle, 2: authorizing, 3: preparing, 4: charging, 5: terminating, 6: alarm, 7: fault
 					if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 					{
-						if(ShmSysConfigAndInfo->SysInfo.AcChargingData[index].SystemStatus != SYS_MODE_CHARGING)
-						{
-							reqClockAlignMeter[gun_index] = 1;
-						}
+						reqClockAlignMeter[gun_index] = 1;
 					}
 				}//End for AC
 			}
@@ -3396,7 +3381,7 @@ void CheckSystemValue(void)
 		}
 
 		// Sample period MeterValue
-		if((((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > (atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1))))
+		if((((time((time_t*)NULL) - clientTime.MeterValues[gun_index]) > ((atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData))>10?(atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)- 1):10))))
 		{
 			//check Transaction active
 			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
@@ -3510,7 +3495,9 @@ void CheckSystemValue(void)
 
 			if(reqSampleMeter[gun_index] == 1)
 			{
-				sendMeterValuesRequest(gun_index, ReadingContext_Sample_Periodic);
+				if(atoi((const char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValueSampleInterval].ItemData)>0)
+					sendMeterValuesRequest(gun_index, ReadingContext_Sample_Periodic);
+
 				storeTempStopTransaction(gun_index);
 			}
 
@@ -12847,7 +12834,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 2;
+	int	confVersion = 3;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -13071,7 +13058,7 @@ int initialConfigurationTable(void)
 		// StopTxnAlignedData
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemName, "StopTxnAlignedData");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemData, "Energy.Active.Import.Register" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemData, "" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","StopTxnAlignedData", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[StopTxnAlignedData].ItemData);
 
@@ -13249,7 +13236,7 @@ int initialConfigurationTable(void)
 		// ChargingScheduleAllowedChargingRateUnit
 		ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemName, "ChargingScheduleAllowedChargingRateUnit");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemData, "Current" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemData, "Current,Power" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ChargingScheduleAllowedChargingRateUnit", "true", ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ChargingScheduleAllowedChargingRateUnit].ItemData);
 
@@ -13264,7 +13251,7 @@ int initialConfigurationTable(void)
 		// ConnectorSwitch3to1PhaseSupported
 		ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ConnectorSwitch3to1PhaseSupported].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ConnectorSwitch3to1PhaseSupported].ItemName, "ConnectorSwitch3to1PhaseSupported");
-		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ConnectorSwitch3to1PhaseSupported].ItemData, "TRUE" );
+		strcpy((char *)ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ConnectorSwitch3to1PhaseSupported].ItemData, "FALSE" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","ConnectorSwitch3to1PhaseSupported", "true", ShmOCPP16Data->ConfigurationTable.SmartChargingProfile[ConnectorSwitch3to1PhaseSupported].ItemData);