Ver código fonte

[Add][Modularization][Modudle_OcppBackend / Module_OcppBackend20]

2021.08.26 / Folus Wen

Actions:
1. Add Current.Offered & Power.Offered(Only DC) data to MeterValues message.

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 anos atrás
pai
commit
b5cd928d3f

+ 703 - 455
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -1439,13 +1439,13 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].component.name, "AlignedDataCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variable.name, "Measurands");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_MemberList]);
-		ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.maxLimit = 10;
+		ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableCharacteristics.maxLimit = 20;
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadOnly]);
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered");
 		else
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Interval].component.name, "AlignedDataCtrlr");
@@ -2190,13 +2190,13 @@ int DB_cbVariableIsCreate(void *para, int columnCount, char **columnValue, char
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].component.name, "SampledDataCtrlr");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variable.name, "TxUpdatedMeasurands");
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.dataType, "%s", DataEnumTypeStr[DataEnumType_MemberList]);
-		ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.maxLimit = 10;
+		ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableCharacteristics.maxLimit = 0;
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].type, "%s", AttributeEnumTypeStr[AttributeEnumType_Target]);
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].mutability, "%s", MutabilityEnumTypeStr[MutabilityEnumType_ReadWrite]);
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered");
 		else
-			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage");
+			sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered");
 		DB_variableSaveToDb(&ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands]);
 
 		sprintf((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedInterval].component.name, "SampledDataCtrlr");
@@ -7323,6 +7323,7 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 	DEBUG_INFO("sendMeterValuesRequest...\n");
 
 	memset(queuedata, 0, ARRAY_SIZE(queuedata));
+	memset(&ShmOCPP20Data->MeterValues[gun_index], 0, sizeof(struct MeterValues_20));
 	//set value
 	ShmOCPP20Data->MeterValues[gun_index].evseId = gun_index + 1; // gun start from 1~
 
@@ -7343,118 +7344,240 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 
 	//idx_sample=0;
 	//********************************(1)Current.Import L1************************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingCurrent;
+				}
+			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingCurrent;
+				}
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GB_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingCurrent;
+				}
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingCurrent;
+				}
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
-
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingCurrent;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrent;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.multiplier = 0;
 	}
-	else
+
+	//idx_sample=1;
+	//********************************(2)Energy.Active.Import.Register ************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = 2;
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+				{
+					tempIndex = ((gun_index==2) ? 1: 0);
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
+
+				for (int index = 0; index < CCS_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
+		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 < AC_QUANTITY; index++)
+				for (int index = 0; index < GB_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
-			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrent;
-			}
+
+				tempIndex = gun_index;
+
+				for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
+					}
+				}
+
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
+		else
+		{
+				if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+				{
+					tempIndex = 2;
+				}
+				else
+				{
+					tempIndex = gun_index;
+				}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+				for (int index = 0; index < AC_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
+					}
+				}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[0].unitOfMeasure.multiplier = 0;
+				strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		}
 
-	//idx_sample=1;
-	//********************************(2)Energy.Active.Import.Register ************************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].unitOfMeasure.uint , "kWh");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+	}
 
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	//idx_sample=2;
+	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7468,14 +7591,14 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy;
 				}
-			}
+			} // END OF FOR CHAdeMO_QUANTITY
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7489,14 +7612,14 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy;
 				}
-			}
+			} // END OF CCS_QUANTITY
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
 				tempIndex = ((gun_index==2) ? 1: 0);
@@ -7510,29 +7633,28 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy;
 				}
-			}
-
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
+			} // END OF GB_QUANTITY
 
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
 			tempIndex = gun_index;
 
 			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy;
 				}
 			}
 
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else
-	{
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else
+		{
 			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
 			{
 				tempIndex = 2;
@@ -7546,533 +7668,659 @@ int sendMeterValuesRequest(int gun_index, ReadingContextEnumType dataType)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PowerConsumption;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy;
 				}
-			}
-
-			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+			 }
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Register]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[1].unitOfMeasure.uint , "kWh");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		}
 
-	//idx_sample=2;
-	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.uint , "kWh");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+	}
 
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	//idx_sample=3;
+	//********************************(4)Power.Active.Import************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargedEnergy;
+				tempIndex = gun_index;
 			}
-		} // END OF FOR CHAdeMO_QUANTITY
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingPower;
+				}
+			} // END OF FOR
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingPower;
+				}
 			}
-		} // END OF CCS_QUANTITY
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
-		for (int index = 0; index < GB_QUANTITY; index++)
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargedEnergy;
+				tempIndex = gun_index;
 			}
-		} // END OF GB_QUANTITY
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower;
+				}
+			}
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingPower;
+				}
 			}
-		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
 		else
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargedEnergy;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingPower;
+				}
 			}
-		 }
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Energy_Active_Import_Interval]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.uint , "kWh");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[2].unitOfMeasure.multiplier = 0;
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.uint , "kW");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.multiplier = 0;
+	}
 
-	//idx_sample=3;
-	//********************************(4)Power.Active.Import************************************************/
-	//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
-	if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+	//idx_sample=4;
+	//***********************************************(5)VOLTAGE L1******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingVoltage;
+				}
+			}
+
+			 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingVoltage;
+				}
 			}
-		} // END OF FOR
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		}
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingVoltage;
+				}
+			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingVoltage;
+				}
 			}
-		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
 		else
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltage;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+	//***********************************************(6)SOC******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_SoC]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
+	{
+		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if((ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0') && (gunType[gun_index] != GUN_TYPE_DO))
 			{
-			     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingPower;
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
 			}
-		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	else
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
+			if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].EvBatterySoc;
+					}
+				}
+			}
+			else if(gunType[gun_index] == GUN_TYPE_CCS)
 			{
-			    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingPower;
+				//tempIndex = ((gun_index==2) ? 1: 0);
+
+				for (int index = 0; index < CCS_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+					{
+						ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].EvBatterySoc;
+					}
+				}
+
 			}
-		}
+			else if(gunType[gun_index] == GUN_TYPE_GBT)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
-	}
+				for (int index = 0; index < GB_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+					{
+						 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].EvBatterySoc;
+					}
+				}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Active_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.uint , "kW");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[3].unitOfMeasure.multiplier = 0;
+			}
+			else if(gunType[gun_index] == GUN_TYPE_DO)
+			{
+				//tempIndex = ((gun_index==2) ? 1: 0);
 
-	//idx_sample=4;
-	//***********************************************(5)VOLTAGE L1******************************************************/
-	//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
-	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 < GENERAL_GUN_QUANTITY; index++)
+				{
+					if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+					{
+						 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.EvBatterySoc;
+					}
+				}
 
-		for (int index = 0; index < CHAdeMO_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
-			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].PresentChargingVoltage;
 			}
-		}
 
-		 strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].context, ReadingContextEnumTypeStr[dataType]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].location, LocationEnumTypeStr[LocationEnumType_EV]);
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.uint , "Percent");
+			ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.multiplier = 0;
+		}
 	}
-	else if(gunType[gun_index] == GUN_TYPE_CCS)
+
+
+	//********************************(7)Current.Import L2************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
+		// Only for AC 3 phase
+		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < CCS_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL2;
+				}
 			}
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_GBT)
+
+	//********************************(8)Current.Import L3************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
+		// Only for AC 3 phase
+		if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < GB_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL3;
+				}
 			}
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.multiplier = 0;
 	}
-	else if(gunType[gun_index] == GUN_TYPE_DO)
-	{
-		tempIndex = gun_index;
 
-		for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+
+	//***********************************************(9)VOLTAGE L2******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
+	{
+		if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-			 	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL2;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.multiplier = 0;
 	}
-	else
+
+	//***********************************************(10)VOLTAGE L3******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
+		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltage;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL3;
+				}
 			}
+
+			strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].phase, PhaseEnumTypeStr[PhaseEnumType_L1_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.uint , "V");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.multiplier = 0;
 	}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[4].unitOfMeasure.multiplier = 0;
-
-
-	//***********************************************(6)SOC******************************************************/
-	if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if((ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0') && (gunType[gun_index] != GUN_TYPE_DO))
-		{
-			tempIndex = ((gun_index==2) ? 1: 0);
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
 		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].EvBatterySoc;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10);
 				}
-			}
+			} // END OF FOR
 		}
 		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
 				{
-					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].EvBatterySoc;
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10);
 				}
 			}
-
 		}
 		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
 			for (int index = 0; index < GB_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
 				{
-					 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.GbChargingData[index].EvBatterySoc;
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10);;
 				}
 			}
-
 		}
 		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
-			//tempIndex = ((gun_index==2) ? 1: 0);
+			tempIndex = gun_index;
 
 			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
 				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
 				{
-					 ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].value = ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.EvBatterySoc;
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10);;
 				}
 			}
-
-		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].context, ReadingContextEnumTypeStr[dataType]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].measurand, MeasurandEnumTypeStr[MeasurandEnumType_SoC]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].location, LocationEnumTypeStr[LocationEnumType_EV]);
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.uint , "Percent");
-		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[5].unitOfMeasure.multiplier = 0;
-	}
-
-	//********************************(7)Current.Import L2************************************************/
-	// Only for AC 3 phase
-	if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
 		}
 		else
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < AC_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL2;
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+				    uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].value = currentOffer;
+				}
 			}
 		}
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
+
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Offered]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].unitOfMeasure.uint , "A");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[10].unitOfMeasure.multiplier = 0;
 	}
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[6].unitOfMeasure.multiplier = 0;
 
-	//********************************(8)Current.Import L3************************************************/
-	// Only for AC 3 phase
-	if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContextEnumType_Sample_Clock) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[AlignedDataCtrlr_Measurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) != NULL)) ||
+	   ((dataType == ReadingContextEnumType_Sample_Periodic) && (strstr((char*)ShmOCPP20Data->ControllerComponentVariable[SampledDataCtrlr_TxUpdatedMeasurands].variableAttribute[0].value, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]) != NULL)) ||
+	   (dataType == ReadingContextEnumType_Trigger))
 	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
-		}
-		else
-		{
-			tempIndex = gun_index;
-		}
-
-		for (int index = 0; index < AC_QUANTITY; index++)
+		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
+		if(gunType[gun_index] == GUN_TYPE_CHAdeMO)
 		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingCurrentL3;
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
 			}
-		}
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
-	}
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Current_Import]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.uint , "A");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[7].unitOfMeasure.multiplier = 0;
 
-	//***********************************************(9)VOLTAGE L2******************************************************/
-	if( (gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-		{
-			tempIndex = 2;
+			for (int index = 0; index < CHAdeMO_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10);
+				}
+			} // END OF FOR
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_CCS)
 		{
-			tempIndex = gun_index;
-		}
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < CCS_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL2;
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10);
+				}
 			}
 		}
-
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].phase, PhaseEnumTypeStr[PhaseEnumType_L2_N]);
-	}
-
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[8].unitOfMeasure.multiplier = 0;
-
-	//***********************************************(10)VOLTAGE L3******************************************************/
-	if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'D')))
-	{
-		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+		else if(gunType[gun_index] == GUN_TYPE_GBT)
 		{
-			tempIndex = 2;
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[8] != '0')
+			{
+				tempIndex = ((gun_index==2) ? 1: 0);
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < GB_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10);
+				}
+			}
 		}
-		else
+		else if(gunType[gun_index] == GUN_TYPE_DO)
 		{
 			tempIndex = gun_index;
-		}
 
-		for (int index = 0; index < AC_QUANTITY; index++)
-		{
-			if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
 			{
-				ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].value = ShmSysConfigAndInfo->SysInfo.AcChargingData[index].PresentChargingVoltageL3;
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+				     //ShmSysConfigAndInfo->SysInfo.GbChargingData[index].PresentChargingPower = 100.0;
+				    ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].value = (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10);
+				}
 			}
 		}
 
-		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].phase, PhaseEnumTypeStr[PhaseEnumType_L3_N]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].context, ReadingContextEnumTypeStr[dataType]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Power_Offered]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
+		strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].unitOfMeasure.uint , "W");
+		ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[11].unitOfMeasure.multiplier = 0;
 	}
 
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].context, ReadingContextEnumTypeStr[dataType]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].measurand, MeasurandEnumTypeStr[MeasurandEnumType_Voltage]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].location, LocationEnumTypeStr[LocationEnumType_Outlet]);
-	strcpy((char *)ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.uint , "V");
-	ShmOCPP20Data->MeterValues[gun_index].meterValue[0].sampledValue[9].unitOfMeasure.multiplier = 0;
-
 	// Message create ====================================================================================================
 	random_uuid(guid);
 

+ 223 - 29
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -6370,8 +6370,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
 
 	//********************************(1)Current.Import L1************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6482,8 +6482,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(2)Energy.Active.Import.Register ************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6595,8 +6595,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6707,8 +6707,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(4)Power.Active.Import************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Power.Active.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Power.Active.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6821,8 +6821,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(5)VOLTAGE L1******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6933,8 +6933,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(6)SOC******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "SOC") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "SOC") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[SoC]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[SoC]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
@@ -7013,8 +7013,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(7)Current.Import L2************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -7046,8 +7046,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(8)Current.Import L3************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -7079,8 +7079,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(9)VOLTAGE L2******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -7113,8 +7113,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(10)VOLTAGE L3******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -7146,6 +7146,200 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[9].Unit,UnitOfMeasureStr[UnitOfMeasure_V]);
 	}
 
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContext_Trigger))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10));
+				}
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", currentOffer);
+				}
+			 }
+		}
+
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Current_Offered]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_A]);
+	}
+
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Trigger) && (gunType[gun_index] != GUN_TYPE_AC)))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10));
+				}
+			}
+		}
+
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Power_Offered]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16Data->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_W]);
+	}
+
 	// Message create ====================================================================================================
 	if(TRUE)
 	{
@@ -13835,7 +14029,7 @@ int initialConfigurationTable(void)
 	char sstr[256]={0};
 	int c = 0;
 	char *loc;
-	int	confVersion = 6;
+	int	confVersion = 7;
 
 	DEBUG_INFO("initialConfigurationTable...version: %d\n", confVersion);
 	//start_t = clock();
@@ -13955,9 +14149,9 @@ int initialConfigurationTable(void)
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemName, "MeterValuesAlignedData");
 
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedData", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData);
 
@@ -13965,9 +14159,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemName, "MeterValuesAlignedDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedDataMaxLength", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData);
 
@@ -13976,9 +14170,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemName, "MeterValuesSampledData");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledData", "false", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData);
 
@@ -13987,9 +14181,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemName, "MeterValuesSampledDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledDataMaxLength", "true", ShmOCPP16Data->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData);
 

+ 222 - 28
EVSE/Modularization/ocppph/MessageHandler.c

@@ -6118,8 +6118,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	//DEBUG_INFO("ShmSysConfigAndInfo->SysConfig.ModelName[0]=%c\n", ShmSysConfigAndInfo->SysConfig.ModelName[0]);
 
 	//********************************(1)Current.Import L1************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6230,8 +6230,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(2)Energy.Active.Import.Register ************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Register") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Register]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6343,8 +6343,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//****************************************************(3)Energy.Active.Import.Interval*********************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Energy.Active.Import.Interval") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Energy_Active_Import_Interval]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
@@ -6455,8 +6455,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(4)Power.Active.Import************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Power.Active.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Power.Active.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Active_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6569,8 +6569,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(5)VOLTAGE L1******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		//J : CHAdeMO   U: CCS1 combo   E: CCS2 combo   G: GBT DC
@@ -6681,8 +6681,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(6)SOC******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "SOC") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "SOC") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[SoC]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[SoC]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_CHAdeMO)||(gunType[gun_index] == GUN_TYPE_CCS)||(gunType[gun_index] == GUN_TYPE_GBT)||(gunType[gun_index] == GUN_TYPE_DO))
@@ -6761,8 +6761,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(7)Current.Import L2************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6794,8 +6794,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//********************************(8)Current.Import L3************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Import]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		// Only for AC 3 phase
@@ -6827,8 +6827,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(9)VOLTAGE L2******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -6861,8 +6861,8 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 	}
 
 	//***********************************************(10)VOLTAGE L3******************************************************/
-	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Voltage") != NULL)) ||
-	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Voltage") != NULL)) ||
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Voltage]) != NULL)) ||
 	   (dataType == ReadingContext_Trigger))
 	{
 		if((gunType[gun_index] == GUN_TYPE_AC) && ((ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'Y') || (ShmSysConfigAndInfo->SysConfig.ModelName[2] == 'W') || (ShmSysConfigAndInfo->SysConfig.ModelName[2]=='D')))
@@ -6894,6 +6894,200 @@ int sendMeterValuesRequest(int gun_index, ReadingContext dataType)
 		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[9].Unit,UnitOfMeasureStr[UnitOfMeasure_V]);
 	}
 
+	//***********************************************(11)Current.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Current_Offered]) != NULL)) ||
+	   (dataType == ReadingContext_Trigger))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingCurrent/10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingCurrent/10));
+				}
+			}
+		}
+		else
+		{
+			if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
+			{
+				tempIndex = 2;
+			}
+			else
+			{
+				tempIndex = gun_index;
+			}
+
+			for (int index = 0; index < AC_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.AcChargingData[index].Index == tempIndex)
+				{
+					uint16_t currentOffer;
+					if(ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent == 0)
+					{
+						currentOffer = ShmSysConfigAndInfo->SysConfig.RatingCurrent;
+					}
+					else
+					{
+						currentOffer = ((ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent>ShmSysConfigAndInfo->SysConfig.RatingCurrent)?ShmSysConfigAndInfo->SysConfig.RatingCurrent:ShmSysConfigAndInfo->SysConfig.MaxChargingCurrent);
+					}
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Value, "%d", currentOffer);
+				}
+			 }
+		}
+
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Current_Offered]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_A]);
+	}
+
+	//***********************************************(12)Power.Offered******************************************************/
+	if(((dataType == ReadingContext_Sample_Clock) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Sample_Periodic) && (strstr((char*)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, MeasurandStr[Power_Offered]) != NULL) && (gunType[gun_index] != GUN_TYPE_AC)) ||
+	   ((dataType == ReadingContext_Trigger) && (gunType[gun_index] != GUN_TYPE_AC)))
+	{
+		//J: CHAdeMO  U: CCS1 combo  E: CCS2 combo  G: GBT DC
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ChademoChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF FOR CHAdeMO_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.CcsChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF CCS_QUANTITY
+		}
+		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++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.GbChargingData[index].AvailableChargingPower*10));
+				}
+			} // END OF GB_QUANTITY
+		}
+		else if(gunType[gun_index] == GUN_TYPE_DO)
+		{
+			tempIndex = gun_index;
+
+			for (int index = 0; index < GENERAL_GUN_QUANTITY; index++)
+			{
+				if (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.Index == tempIndex)
+				{
+					sprintf((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[11].Value, "%d", (uint16_t) (ShmSysConfigAndInfo->SysInfo.ConnectorInfo[index].GeneralChargingData.AvailableChargingPower*10));
+				}
+			}
+		}
+
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Context, ReadingContextStr[dataType]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Format, ValueFormatStr[Raw]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Measurand, MeasurandStr[Power_Offered]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Location, LocationStr[Location_Outlet]);
+		strcpy((char *)ShmOCPP16DataPH->MeterValues[gun_index].MeterValue[0].SampledValue[10].Unit,UnitOfMeasureStr[UnitOfMeasure_W]);
+	}
+
 	// Message create ====================================================================================================
 	if(TRUE)
 	{
@@ -13704,9 +13898,9 @@ int initialConfigurationTable(void)
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemName, "MeterValuesAlignedData");
 
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedData", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedData].ItemData);
 
@@ -13714,9 +13908,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemName, "MeterValuesAlignedDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesAlignedDataMaxLength", "true", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesAlignedDataMaxLength].ItemData);
 
@@ -13725,9 +13919,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemAccessibility = 1;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemName, "MeterValuesSampledData");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,SOC,Current.Offered,Power.Offered" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData, "Current.Import,Energy.Active.Import.Register,Energy.Active.Import.Interval,Power.Active.Import,Voltage,Current.Offered" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledData", "false", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledData].ItemData);
 
@@ -13736,9 +13930,9 @@ int initialConfigurationTable(void)
 		ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemAccessibility = 0;
 		strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemName, "MeterValuesSampledDataMaxLength");
 		if(ShmSysConfigAndInfo->SysConfig.ModelName[0]=='D')
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "6" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "8" );
 		else
-			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "9" );
+			strcpy((char *)ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData, "10" );
 
 		fprintf(outfile,"{\"key\":\"%s\",\"readonly\":%s,\"value\":\"%s\"}\n","MeterValuesSampledDataMaxLength", "true", ShmOCPP16DataPH->ConfigurationTable.CoreProfile[MeterValuesSampledDataMaxLength].ItemData);