Browse Source

2022-02-14/Jerry Wang
Action:
1. Modify composite charging profile logic to solve the profile missing problem caused by receiving setChargingProfile frequently.

File:
1. EVSE/Modularization/ocppfiles/MessageHandler.c
--> Action 1
2. EVSE/Modularization/ocppph/MessageHandler.c
--> Action 1
3. EVSE/Modularization/ocpp20/MessageHandler.c
--> Action 1

Jerry Wang 3 years ago
parent
commit
c6fb268bd4

+ 180 - 174
EVSE/Modularization/ocpp20/MessageHandler.c

@@ -3623,7 +3623,7 @@ int getStartSinceRecurring(uint8_t *start, uint8_t *stop, uint8_t isDaily)
 	return result;
 }
 
-void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType *compositeProfile, uint8_t idxSchedule, uint8_t isUnitA)
+void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType *targetCompositeProfile, uint8_t idxSchedule, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -3633,27 +3633,28 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 	struct tm *tmComposite;
 
 	struct ChargingProfileType maxProfile;
+	struct ChargingProfileType compositeProfile;
 
 	uint8_t limitMax=0;
 	int compositePeriodIdx = 0;
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].startSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].startSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit, "A");
+		sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit, "W");
-	compositeProfile->chargingSchedule[idxSchedule].duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit, "W");
+	compositeProfile.chargingSchedule[idxSchedule].duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = -1;
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = -1;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
 	}
-	compositeProfile->id = 0;
-	compositeProfile->stackLevel = 99 ;
-	sprintf((char*)compositeProfile->chargingProfileKind ,"Absolute");
+	compositeProfile.id = 0;
+	compositeProfile.stackLevel = 99 ;
+	sprintf((char*)compositeProfile.chargingProfileKind ,"Absolute");
 
 	maxProfile.id = -1;
 
@@ -3801,7 +3802,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 								}
 								else
 								{
-									sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", compositeProfile->chargingSchedule[idxSchedule].startSchedule);
+									sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", compositeProfile.chargingSchedule[idxSchedule].startSchedule);
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -3914,7 +3915,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 						}
 						else
 						{
-							sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", compositeProfile->chargingSchedule[idxSchedule].startSchedule);
+							sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", compositeProfile.chargingSchedule[idxSchedule].startSchedule);
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -3968,18 +3969,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 		{
 			if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 														0:
-														(maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+														(maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																								 0:
-																								 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																								 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -4020,18 +4021,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 															0:
-															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -4047,18 +4048,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 															0:
-															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -4113,45 +4114,47 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
 			   (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod < durationReq) &&
 			   (maxProfile.chargingSchedule[idxSchedule].duration > 0))
 			{
-				if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+				if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 				{
-					memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct ChargingSchedulePeriodType));
+					memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct ChargingSchedulePeriodType));
 					compositePeriodIdx++;
 				}
 				else
 				{
-					memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct ChargingSchedulePeriodType));
+					memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct ChargingSchedulePeriodType));
 				}
 			}
 		}
 	}
 
 	DEBUG_INFO("ChargePointMaxProfile ready.\n");
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->chargingSchedule[idxSchedule].startSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->chargingSchedule[idxSchedule].duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.chargingSchedule[idxSchedule].startSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.chargingSchedule[idxSchedule].duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod >= 0)
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod >= 0)
 		{
-			compositeProfile->id = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases);
+			compositeProfile.id = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases);
 		}
 
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit == -1)
-			compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit =0;
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit == -1)
+			compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit =0;
 
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod == -1)
-			compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod =0;
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod == -1)
+			compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);
 }
 
-void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct ChargingProfileType *compositeProfile, uint8_t idxSchedule, uint8_t isUnitA)
+void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct ChargingProfileType *targetCompositeProfile, uint8_t idxSchedule, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -4163,6 +4166,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 	struct ChargingProfileType maxProfile;
 	struct ChargingProfileType defaultTxProfile;
 	struct ChargingProfileType txProfile;
+	struct ChargingProfileType compositeProfile;
 
 	struct ChargingSchedulePeriodType tmpPeriod;
 	uint8_t limitMax=0;
@@ -4173,22 +4177,22 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].startSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].startSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit, "A");
+		sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit, "W");
-	compositeProfile->chargingSchedule[idxSchedule].duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit, "W");
+	compositeProfile.chargingSchedule[idxSchedule].duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = -1;
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
-		compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 0;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = -1;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
+		compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 0;
 	}
-	compositeProfile->id = 0;
-	compositeProfile->stackLevel = 99 ;
-	sprintf((char*)compositeProfile->chargingProfileKind ,ChargingProfileKindEnumTypeStr[ChargingProfileKindEnumType_Absolute]);
+	compositeProfile.id = 0;
+	compositeProfile.stackLevel = 99 ;
+	sprintf((char*)compositeProfile.chargingProfileKind ,ChargingProfileKindEnumTypeStr[ChargingProfileKindEnumType_Absolute]);
 
 	maxProfile.id = -1;
 	defaultTxProfile.id = -1;
@@ -4343,7 +4347,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 								}
 								else
 								{
-									sprintf((char*)txProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+									sprintf((char*)txProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -4458,7 +4462,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 						}
 						else
 						{
-							sprintf((char*)txProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+							sprintf((char*)txProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -4647,7 +4651,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 								}
 								else
 								{
-									sprintf((char*)defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+									sprintf((char*)defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -4761,7 +4765,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 						}
 						else
 						{
-							sprintf((char*)defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+							sprintf((char*)defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -4949,7 +4953,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 								}
 								else
 								{
-									sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+									sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -5062,7 +5066,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 						}
 						else
 						{
-							sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
+							sprintf((char*)maxProfile.chargingSchedule[idxSchedule].startSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.chargingSchedule[idxSchedule].startSchedule : ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "chargingProfile"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -5127,18 +5131,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(txProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 														0:
-														(txProfile.chargingSchedule[idxSchedule].duration-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+														(txProfile.chargingSchedule[idxSchedule].duration-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																								 0:
-																								 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																								 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -5154,18 +5158,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(txProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				txProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.chargingSchedule[idxSchedule].duration:((txProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				txProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.chargingSchedule[idxSchedule].duration:((txProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																								  0:
-																																								 (txProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																																								 (txProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																																												0:
-																																																											   (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																																																											   (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -5183,18 +5187,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(txProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+					txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 															0:
-															(txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+															(txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+						txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 																									 0:
-																									 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+																									 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -5210,18 +5214,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(txProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+					txProfile.chargingSchedule[idxSchedule].duration = ((txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 															0:
-															(txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+															(txProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+						txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 																									 0:
-																									 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+																									 (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(txProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -5266,18 +5270,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(defaultTxProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 														0:
-														(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+														(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																								 0:
-																								 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																								 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod < txProfile.chargingSchedule[idxSchedule].duration)
 					{
@@ -5298,18 +5302,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(defaultTxProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				defaultTxProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.chargingSchedule[idxSchedule].duration:((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				defaultTxProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.chargingSchedule[idxSchedule].duration:((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																								  0:
-																																								 (defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																																								 (defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																																												0:
-																																																											   (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																																																											   (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod < txProfile.chargingSchedule[idxSchedule].duration)
 					{
@@ -5332,18 +5336,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(defaultTxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+					defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 															0:
-															(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+															(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+						defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 																									 0:
-																									 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+																									 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 
 						if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod < txProfile.chargingSchedule[idxSchedule].duration)
 						{
@@ -5364,18 +5368,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(defaultTxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+					defaultTxProfile.chargingSchedule[idxSchedule].duration = ((defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 															0:
-															(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+															(defaultTxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+						defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 																									 0:
-																									 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+																									 (defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(defaultTxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 
 						if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod < txProfile.chargingSchedule[idxSchedule].duration)
 						{
@@ -5426,18 +5430,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 														0:
-														(maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+														(maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																								 0:
-																								 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																								 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -5453,18 +5457,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		{
 			if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 			{
-				maxProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.chargingSchedule[idxSchedule].duration:((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+				maxProfile.chargingSchedule[idxSchedule].duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.chargingSchedule[idxSchedule].duration:((maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																								  0:
-																																								 (maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[9].startSchedule)));
+																																								 (maxProfile.chargingSchedule[idxSchedule].duration-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[9].startSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule))<0?
+					maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod:((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule))<0?
 																																																											    0:
-																																																											   (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile->chargingSchedule[idxSchedule].startSchedule)));
+																																																											   (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartStop(ShmOCPP20Data->TransactionEvent[(connectorId==0?0:connectorId-1)].timestamp, compositeProfile.chargingSchedule[idxSchedule].startSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -5482,18 +5486,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 															0:
-															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
+						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, FALSE)));
+																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -5509,18 +5513,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(maxProfile.chargingSchedule[idxSchedule].duration != -1)
 				{
-					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+					maxProfile.chargingSchedule[idxSchedule].duration = ((maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 															0:
-															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+															(maxProfile.chargingSchedule[idxSchedule].duration-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod != -1)
 					{
-						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
+						maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod = ((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile->chargingSchedule[idxSchedule].startSchedule, TRUE)));
+																									 (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod-getStartSinceRecurring(maxProfile.chargingSchedule[idxSchedule].startSchedule, compositeProfile.chargingSchedule[idxSchedule].startSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -5586,7 +5590,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 	// TxProfile found, composite schedule based on it
 	if(txProfile.id != -1)
 	{
-		compositeProfile->chargingSchedule[idxSchedule].duration = txProfile.chargingSchedule[idxSchedule].duration;
+		compositeProfile.chargingSchedule[idxSchedule].duration = txProfile.chargingSchedule[idxSchedule].duration;
 		for(int idxTxPeriod=0;idxTxPeriod<limitTx;idxTxPeriod++)
 		{
 			if((txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod].limit != -1) &&
@@ -5615,16 +5619,16 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 
 						if(idxMaxPeriod == (limitMax-1))
 						{
-							if(tmpPeriod.limit != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
+							if(tmpPeriod.limit != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
 							{
-								if(tmpPeriod.startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+								if(tmpPeriod.startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 								}
 							}
 						}
@@ -5632,14 +5636,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 				}
 				else
 				{
-					if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+					if(txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod],sizeof(struct ChargingSchedulePeriodType));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod],sizeof(struct ChargingSchedulePeriodType));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod],sizeof(struct ChargingSchedulePeriodType));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod],sizeof(struct ChargingSchedulePeriodType));
 					}
 				}
 			}
@@ -5648,7 +5652,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 			{
 				if(defaultTxProfile.id != -1)
 				{
-					compositeProfile->chargingSchedule[idxSchedule].duration = (defaultTxProfile.chargingSchedule[idxSchedule].duration>compositeProfile->chargingSchedule[idxSchedule].duration)?defaultTxProfile.chargingSchedule[idxSchedule].duration:compositeProfile->chargingSchedule[idxSchedule].duration;
+					compositeProfile.chargingSchedule[idxSchedule].duration = (defaultTxProfile.chargingSchedule[idxSchedule].duration>compositeProfile.chargingSchedule[idxSchedule].duration)?defaultTxProfile.chargingSchedule[idxSchedule].duration:compositeProfile.chargingSchedule[idxSchedule].duration;
 					for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 					{
 						if((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod >= (txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxTxPeriod].startPeriod + (txProfile.chargingSchedule[idxSchedule].duration-defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod))) &&
@@ -5674,40 +5678,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 											tmpPeriod.limit = defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].limit;
 										}
 
-										if(tmpPeriod.limit != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
+										if(tmpPeriod.limit != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
 										{
-											if(tmpPeriod.startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+											if(tmpPeriod.startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 											{
-												memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+												memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 												compositePeriodIdx++;
 											}
 											else
 											{
-												memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+												memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 											}
 										}
 
 										// Delete duplicate period
 										if(compositePeriodIdx > 1)
 										{
-											if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+											if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
 											{
-												compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
-												compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+												compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+												compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
 												compositePeriodIdx -= 1;
 											}
 										}
 									}
 									else
 									{
-										if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+										if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 										{
-											memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+											memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 											compositePeriodIdx++;
 										}
 										else
 										{
-											memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+											memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 										}
 										break;
 									}
@@ -5715,14 +5719,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 							}
 							else
 							{
-								if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+								if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 								}
 							}
 						}
@@ -5734,7 +5738,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 	// TxProfile not found but defaultTxProfile found, composite schedule based on it
 	else if(defaultTxProfile.id != -1)
 	{
-		compositeProfile->chargingSchedule[idxSchedule].duration = defaultTxProfile.chargingSchedule[idxSchedule].duration;
+		compositeProfile.chargingSchedule[idxSchedule].duration = defaultTxProfile.chargingSchedule[idxSchedule].duration;
 		for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 		{
 			if((defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].limit != -1) &&
@@ -5759,40 +5763,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 								tmpPeriod.limit = defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].limit;
 							}
 
-							if(tmpPeriod.limit != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
+							if(tmpPeriod.limit != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].limit)
 							{
-								if(tmpPeriod.startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+								if(tmpPeriod.startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+									memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 								}
 							}
 
 							// Delete duplicate period
 							if(compositePeriodIdx > 1)
 							{
-								if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+								if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
 								{
-									compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
-									compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+									compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+									compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
 									compositePeriodIdx -= 1;
 								}
 							}
 						}
 						else
 						{
-							if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+							if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 							{
-								memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+								memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+								memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 							}
 							break;
 						}
@@ -5800,14 +5804,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 				}
 				else
 				{
-					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+					if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxDefPeriod],sizeof(struct ChargingSchedulePeriodType));
 					}
 				}
 			}
@@ -5819,21 +5823,21 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 	{
 		if(compositePeriodIdx==0)
 		{
-			compositeProfile->chargingSchedule[idxSchedule].duration = maxProfile.chargingSchedule[idxSchedule].duration;
+			compositeProfile.chargingSchedule[idxSchedule].duration = maxProfile.chargingSchedule[idxSchedule].duration;
 			for(int idxMaxPeriod=0;idxMaxPeriod<limitDef;idxMaxPeriod++)
 			{
 				if((maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].limit != -1) &&
 				   (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod < durationReq) &&
 				   (maxProfile.chargingSchedule[idxSchedule].duration > 0))
 				{
-					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
+					if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].startPeriod)
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -5847,13 +5851,13 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 				   (maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod < durationReq) &&
 				   (maxProfile.chargingSchedule[idxSchedule].duration > 0))
 				{
-					if((maxProfile.chargingSchedule[idxSchedule].duration >= compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod))
+					if((maxProfile.chargingSchedule[idxSchedule].duration >= compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod))
 					{
-						if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].limit > compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[lastCompositePeriodIdx-1].limit)
+						if(maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].limit > compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[lastCompositePeriodIdx-1].limit)
 						{
 							tmpPeriod.startPeriod = maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].startPeriod;
 							tmpPeriod.numberPhases = maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxMaxPeriod].numberPhases;
-							tmpPeriod.limit = compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[lastCompositePeriodIdx-1].limit;
+							tmpPeriod.limit = compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[lastCompositePeriodIdx-1].limit;
 						}
 						else
 						{
@@ -5865,26 +5869,26 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 
 					if(tmpPeriod.limit != -1)
 					{
-						if(tmpPeriod.limit != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)].limit)
+						if(tmpPeriod.limit != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)].limit)
 						{
-							if(tmpPeriod.startPeriod != compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)].startPeriod)
+							if(tmpPeriod.startPeriod != compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)].startPeriod)
 							{
-								memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+								memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
+								memcpy(&compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[(compositePeriodIdx-1)], &tmpPeriod , sizeof(struct ChargingSchedulePeriodType));
 							}
 						}
 
 						// Delete duplicate period
 						if(compositePeriodIdx > 1)
 						{
-							if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
+							if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit == compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-2].limit)
 							{
-								compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
-								compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
+								compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].startPeriod = -1;
+								compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[compositePeriodIdx-1].limit = -1;
 								compositePeriodIdx -= 1;
 							}
 						}
@@ -5894,28 +5898,30 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
 		}
 	}
 
-	compositeProfile->chargingSchedule[idxSchedule].duration = durationReq;
+	compositeProfile.chargingSchedule[idxSchedule].duration = durationReq;
 	DEBUG_INFO("Connector-%d composite schedule ready.\n", connectorId);
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->chargingSchedule[idxSchedule].startSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->chargingSchedule[idxSchedule].duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->chargingSchedule[idxSchedule].chargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.chargingSchedule[idxSchedule].startSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.chargingSchedule[idxSchedule].duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.chargingSchedule[idxSchedule].chargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod >= 0)
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod >= 0)
 		{
-			compositeProfile->id = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases);
+			compositeProfile.id = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases);
 		}
 
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit == -1)
-			compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit =0;
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit == -1)
+			compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit =0;
 
-		if(compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod == -1)
-			compositeProfile->chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod =0;
+		if(compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod == -1)
+			compositeProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);
 
@@ -17100,7 +17106,7 @@ int handleSetVariablesRequest(char *uuid, char *payload)
 
 							if((strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].component.name, "OCPPCommCtrlr") != NULL) && (strstr((char*)ShmOCPP20Data->SetVariables.setVariableData[idx].variable.name, "HeartbeatInterval") != NULL))
 							{
-								if(((atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value)) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
+								if((atoi((char*)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableAttribute[0].value) < (int)ShmOCPP20Data->ControllerComponentVariable[idx_var].variableCharacteristics.minLimit) )
 								{
 									strcpy((char*)ShmOCPP20Data->SetVariables.Response_setVariableResult[idx].attributeStatus, SetVariableStatusEnumTypeStr[SetVariableStatusEnumType_OutOfRange]);
 								}

+ 178 - 172
EVSE/Modularization/ocppfiles/MessageHandler.c

@@ -1736,7 +1736,7 @@ int getStartSinceRecurring(uint8_t *start, uint8_t *stop, uint8_t isDaily)
 	return result;
 }
 
-void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfile *compositeProfile, uint8_t isUnitA)
+void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfile *targetCompositeProfile, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -1746,27 +1746,28 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 	struct tm *tmComposite;
 
 	struct StructChargingProfile maxProfile;
+	struct StructChargingProfile compositeProfile;
 
 	uint8_t limitMax=0;
 	int compositePeriodIdx = 0;
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "A");
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "W");
-	compositeProfile->ChargingSchedule.Duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "W");
+	compositeProfile.ChargingSchedule.Duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
 	}
-	compositeProfile->ChargingProfileId = 0;
-	compositeProfile->StackLevel = 99 ;
-	sprintf((char*)compositeProfile->ChargingProfileKind ,"Absolute");
+	compositeProfile.ChargingProfileId = 0;
+	compositeProfile.StackLevel = 99 ;
+	sprintf((char*)compositeProfile.ChargingProfileKind ,"Absolute");
 
 	maxProfile.ChargingProfileId = -1;
 
@@ -1915,7 +1916,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 								}
 								else
 								{
-									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile->ChargingSchedule.StartSchedule);
+									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile.ChargingSchedule.StartSchedule);
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2029,7 +2030,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 						}
 						else
 						{
-							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile->ChargingSchedule.StartSchedule);
+							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile.ChargingSchedule.StartSchedule);
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2083,18 +2084,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -2135,18 +2136,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -2162,18 +2163,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -2228,45 +2229,47 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod < durationReq) &&
 			   (maxProfile.ChargingSchedule.Duration > 0))
 			{
-				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 				{
-					memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+					memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					compositePeriodIdx++;
 				}
 				else
 				{
-					memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+					memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 				}
 			}
 		}
 	}
 
 	DEBUG_INFO("ChargePointMaxProfile ready.\n");
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->ChargingSchedule.Duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->ChargingSchedule.ChargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.ChargingSchedule.Duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.ChargingSchedule.ChargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
 		{
-			compositeProfile->ChargingProfileId = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
+			compositeProfile.ChargingProfileId = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
 		}
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);
 }
 
-void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct StructChargingProfile *compositeProfile, uint8_t isUnitA)
+void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct StructChargingProfile *targetCompositeProfile, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -2278,6 +2281,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	struct StructChargingProfile maxProfile;
 	struct StructChargingProfile defaultTxProfile;
 	struct StructChargingProfile txProfile;
+	struct StructChargingProfile compositeProfile;
 
 	struct StructChargingSchedulePeriod tmpPeriod;
 	uint8_t limitMax=0;
@@ -2288,21 +2292,21 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "A");
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "W");
-	compositeProfile->ChargingSchedule.Duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "W");
+	compositeProfile.ChargingSchedule.Duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
 	}
-	compositeProfile->ChargingProfileId = 0;
-	compositeProfile->StackLevel = 99 ;
-	sprintf((char*)compositeProfile->ChargingProfileKind ,"Absolute");
+	compositeProfile.ChargingProfileId = 0;
+	compositeProfile.StackLevel = 99 ;
+	sprintf((char*)compositeProfile.ChargingProfileKind ,"Absolute");
 
 	maxProfile.ChargingProfileId = -1;
 	defaultTxProfile.ChargingProfileId = -1;
@@ -2457,7 +2461,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2571,7 +2575,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2761,7 +2765,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2875,7 +2879,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -3064,7 +3068,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -3178,7 +3182,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -3243,18 +3247,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(txProfile.ChargingSchedule.Duration != -1)
 			{
-				txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3270,18 +3274,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(txProfile.ChargingSchedule.Duration != -1)
 			{
-				txProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.Duration:((txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				txProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.Duration:((txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																												0:
-																																																											   (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3299,18 +3303,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(txProfile.ChargingSchedule.Duration != -1)
 				{
-					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3326,18 +3330,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(txProfile.ChargingSchedule.Duration != -1)
 				{
-					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3382,18 +3386,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(defaultTxProfile.ChargingSchedule.Duration != -1)
 			{
-				defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 					{
@@ -3414,18 +3418,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(defaultTxProfile.ChargingSchedule.Duration != -1)
 			{
-				defaultTxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.Duration:((defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				defaultTxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.Duration:((defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																												0:
-																																																											   (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 					{
@@ -3448,18 +3452,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingSchedule.Duration != -1)
 				{
-					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 						{
@@ -3480,18 +3484,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingSchedule.Duration != -1)
 				{
-					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 						{
@@ -3542,18 +3546,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3569,18 +3573,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.Duration:((maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.Duration:((maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																											    0:
-																																																											   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16Data->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3598,18 +3602,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3625,18 +3629,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3702,7 +3706,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	// TxProfile found, composite schedule based on it
 	if(txProfile.ChargingProfileId != -1)
 	{
-		compositeProfile->ChargingSchedule.Duration = txProfile.ChargingSchedule.Duration;
+		compositeProfile.ChargingSchedule.Duration = txProfile.ChargingSchedule.Duration;
 		for(int idxTxPeriod=0;idxTxPeriod<limitTx;idxTxPeriod++)
 		{
 			if((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].Limit != -1) &&
@@ -3731,16 +3735,16 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 						if(idxMaxPeriod == (limitMax-1))
 						{
-							if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+							if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 							{
-								if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 						}
@@ -3748,14 +3752,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				}
 				else
 				{
-					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3764,7 +3768,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingProfileId != -1)
 				{
-					compositeProfile->ChargingSchedule.Duration = (defaultTxProfile.ChargingSchedule.Duration>compositeProfile->ChargingSchedule.Duration)?defaultTxProfile.ChargingSchedule.Duration:compositeProfile->ChargingSchedule.Duration;
+					compositeProfile.ChargingSchedule.Duration = (defaultTxProfile.ChargingSchedule.Duration>compositeProfile.ChargingSchedule.Duration)?defaultTxProfile.ChargingSchedule.Duration:compositeProfile.ChargingSchedule.Duration;
 					for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 					{
 						if((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod >= (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod + (txProfile.ChargingSchedule.Duration-defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod))) &&
@@ -3790,40 +3794,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 											tmpPeriod.Limit = defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit;
 										}
 
-										if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+										if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 										{
-											if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+											if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 											{
-												memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+												memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 												compositePeriodIdx++;
 											}
 											else
 											{
-												memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+												memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 											}
 										}
 
 										// Delete duplicate period
 										if(compositePeriodIdx > 1)
 										{
-											if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+											if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 											{
-												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+												compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+												compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 												compositePeriodIdx -= 1;
 											}
 										}
 									}
 									else
 									{
-										if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+										if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 										{
-											memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+											memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 											compositePeriodIdx++;
 										}
 										else
 										{
-											memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+											memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 										}
 										break;
 									}
@@ -3831,14 +3835,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 							}
 							else
 							{
-								if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 						}
@@ -3850,7 +3854,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	// TxProfile not found but defaultTxProfile found, composite schedule based on it
 	else if(defaultTxProfile.ChargingProfileId != -1)
 	{
-		compositeProfile->ChargingSchedule.Duration = defaultTxProfile.ChargingSchedule.Duration;
+		compositeProfile.ChargingSchedule.Duration = defaultTxProfile.ChargingSchedule.Duration;
 		for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 		{
 			if((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit != -1) &&
@@ -3874,40 +3878,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								tmpPeriod.Limit = defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit;
 							}
 
-							if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+							if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 							{
-								if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 
 							// Delete duplicate period
 							if(compositePeriodIdx > 1)
 							{
-								if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+								if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 								{
-									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+									compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+									compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 									compositePeriodIdx -= 1;
 								}
 							}
 						}
 						else
 						{
-							if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+							if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 							}
 							break;
 						}
@@ -3915,14 +3919,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				}
 				else
 				{
-					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3934,21 +3938,21 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	{
 		if(compositePeriodIdx==0)
 		{
-			compositeProfile->ChargingSchedule.Duration = maxProfile.ChargingSchedule.Duration;
+			compositeProfile.ChargingSchedule.Duration = maxProfile.ChargingSchedule.Duration;
 			for(int idxMaxPeriod=0;idxMaxPeriod<limitDef;idxMaxPeriod++)
 			{
 				if((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit != -1) &&
 				   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod < durationReq) &&
 				   (maxProfile.ChargingSchedule.Duration > 0))
 				{
-					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3963,13 +3967,13 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				   (maxProfile.ChargingSchedule.Duration > 0))
 				{
 
-					if((maxProfile.ChargingSchedule.Duration >= compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod))
+					if((maxProfile.ChargingSchedule.Duration >= compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod))
 					{
-						if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit > compositeProfile->ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit)
+						if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit > compositeProfile.ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit)
 						{
 							tmpPeriod.StartPeriod = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod;
 							tmpPeriod.NumberPhases = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].NumberPhases;
-							tmpPeriod.Limit = compositeProfile->ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit;
+							tmpPeriod.Limit = compositeProfile.ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit;
 						}
 						else
 						{
@@ -3981,26 +3985,26 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 					if(tmpPeriod.Limit != -1)
 					{
-						if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit)
+						if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit)
 						{
-							if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod)
+							if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod)
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 							}
 						}
 
 						// Delete duplicate period
 						if(compositePeriodIdx > 1)
 						{
-							if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+							if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 							{
-								compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-								compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+								compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+								compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 								compositePeriodIdx -= 1;
 							}
 						}
@@ -4010,28 +4014,30 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		}
 	}
 
-	compositeProfile->ChargingSchedule.Duration = durationReq;
+	compositeProfile.ChargingSchedule.Duration = durationReq;
 	DEBUG_INFO("Connector-%d composite schedule ready.\n", connectorId);
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->ChargingSchedule.Duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->ChargingSchedule.ChargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.ChargingSchedule.Duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.ChargingSchedule.ChargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
 		{
-			compositeProfile->ChargingProfileId = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
+			compositeProfile.ChargingProfileId = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
 		}
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);
 

+ 178 - 172
EVSE/Modularization/ocppph/MessageHandler.c

@@ -1241,7 +1241,7 @@ int getStartSinceRecurring(uint8_t *start, uint8_t *stop, uint8_t isDaily)
 	return result;
 }
 
-void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfile *compositeProfile, uint8_t isUnitA)
+void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfile *targetCompositeProfile, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -1251,27 +1251,28 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 	struct tm *tmComposite;
 
 	struct StructChargingProfile maxProfile;
+	struct StructChargingProfile compositeProfile;
 
 	uint8_t limitMax=0;
 	int compositePeriodIdx = 0;
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "A");
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "W");
-	compositeProfile->ChargingSchedule.Duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "W");
+	compositeProfile.ChargingSchedule.Duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
 	}
-	compositeProfile->ChargingProfileId = 0;
-	compositeProfile->StackLevel = 99 ;
-	sprintf((char*)compositeProfile->ChargingProfileKind ,"Absolute");
+	compositeProfile.ChargingProfileId = 0;
+	compositeProfile.StackLevel = 99 ;
+	sprintf((char*)compositeProfile.ChargingProfileKind ,"Absolute");
 
 	maxProfile.ChargingProfileId = -1;
 
@@ -1420,7 +1421,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 								}
 								else
 								{
-									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile->ChargingSchedule.StartSchedule);
+									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile.ChargingSchedule.StartSchedule);
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -1534,7 +1535,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 						}
 						else
 						{
-							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile->ChargingSchedule.StartSchedule);
+							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", compositeProfile.ChargingSchedule.StartSchedule);
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -1588,18 +1589,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -1640,18 +1641,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -1667,18 +1668,18 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -1733,45 +1734,47 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct StructChargingProfi
 			   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod < durationReq) &&
 			   (maxProfile.ChargingSchedule.Duration > 0))
 			{
-				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 				{
-					memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+					memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					compositePeriodIdx++;
 				}
 				else
 				{
-					memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+					memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 				}
 			}
 		}
 	}
 
 	DEBUG_INFO("ChargePointMaxProfile ready.\n");
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->ChargingSchedule.Duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->ChargingSchedule.ChargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.ChargingSchedule.Duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.ChargingSchedule.ChargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
 		{
-			compositeProfile->ChargingProfileId = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
+			compositeProfile.ChargingProfileId = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
 		}
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);
 }
 
-void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct StructChargingProfile *compositeProfile, uint8_t isUnitA)
+void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct StructChargingProfile *targetCompositeProfile, uint8_t isUnitA)
 {
 	FILE *fp;
 	char profileFileName[128];
@@ -1783,6 +1786,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	struct StructChargingProfile maxProfile;
 	struct StructChargingProfile defaultTxProfile;
 	struct StructChargingProfile txProfile;
+	struct StructChargingProfile compositeProfile;
 
 	struct StructChargingSchedulePeriod tmpPeriod;
 	uint8_t limitMax=0;
@@ -1793,21 +1797,21 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 	CurrentTime = time(NULL);
 	tmComposite=localtime(&CurrentTime);
-	sprintf((char*)compositeProfile->ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
+	sprintf((char*)compositeProfile.ChargingSchedule.StartSchedule, "%04d-%02d-%02dT%02d:%02d:%02dZ", tmComposite->tm_year+1900, tmComposite->tm_mon+1, tmComposite->tm_mday, tmComposite->tm_hour, tmComposite->tm_min, tmComposite->tm_sec);
 	if(isUnitA)
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "A");
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "A");
 	else
-		sprintf((char*)compositeProfile->ChargingSchedule.ChargingRateUnit, "W");
-	compositeProfile->ChargingSchedule.Duration = durationReq;
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+		sprintf((char*)compositeProfile.ChargingSchedule.ChargingRateUnit, "W");
+	compositeProfile.ChargingSchedule.Duration = durationReq;
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
-		compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit = -1;
+		compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases = 3;
 	}
-	compositeProfile->ChargingProfileId = 0;
-	compositeProfile->StackLevel = 99 ;
-	sprintf((char*)compositeProfile->ChargingProfileKind ,"Absolute");
+	compositeProfile.ChargingProfileId = 0;
+	compositeProfile.StackLevel = 99 ;
+	sprintf((char*)compositeProfile.ChargingProfileKind ,"Absolute");
 
 	maxProfile.ChargingProfileId = -1;
 	defaultTxProfile.ChargingProfileId = -1;
@@ -1962,7 +1966,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2076,7 +2080,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)txProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2266,7 +2270,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2380,7 +2384,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)defaultTxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2569,7 +2573,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								}
 								else
 								{
-									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+									sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 								}
 
 								if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2683,7 +2687,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 						}
 						else
 						{
-							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile->ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
+							sprintf((char*)maxProfile.ChargingSchedule.StartSchedule, "%s", (!cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging ? compositeProfile.ChargingSchedule.StartSchedule : ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp));
 						}
 
 						if(json_object_object_get(json_object_object_get(json_object_object_get(obj, "csChargingProfiles"), "chargingSchedule"), "minChargingRate") != NULL)
@@ -2748,18 +2752,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(txProfile.ChargingSchedule.Duration != -1)
 			{
-				txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(txProfile.ChargingSchedule.Duration-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -2775,18 +2779,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(txProfile.ChargingSchedule.Duration != -1)
 			{
-				txProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.Duration:((txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				txProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.Duration:((txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (txProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																												0:
-																																																											   (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -2804,18 +2808,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(txProfile.ChargingSchedule.Duration != -1)
 				{
-					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -2831,18 +2835,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(txProfile.ChargingSchedule.Duration != -1)
 				{
-					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					txProfile.ChargingSchedule.Duration = ((txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(txProfile.ChargingSchedule.Duration-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(txProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(txProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -2887,18 +2891,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(defaultTxProfile.ChargingSchedule.Duration != -1)
 			{
-				defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(defaultTxProfile.ChargingSchedule.Duration-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 					{
@@ -2919,18 +2923,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(defaultTxProfile.ChargingSchedule.Duration != -1)
 			{
-				defaultTxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.Duration:((defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				defaultTxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.Duration:((defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (defaultTxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																												0:
-																																																											   (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 					{
@@ -2953,18 +2957,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingSchedule.Duration != -1)
 				{
-					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 						{
@@ -2985,18 +2989,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingSchedule.Duration != -1)
 				{
-					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					defaultTxProfile.ChargingSchedule.Duration = ((defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(defaultTxProfile.ChargingSchedule.Duration-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(defaultTxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod < txProfile.ChargingSchedule.Duration)
 						{
@@ -3047,18 +3051,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 														0:
-														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+														(maxProfile.ChargingSchedule.Duration-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																								 0:
-																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule)));
+																								 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3074,18 +3078,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		{
 			if(maxProfile.ChargingSchedule.Duration != -1)
 			{
-				maxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.Duration:((maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+				maxProfile.ChargingSchedule.Duration = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.Duration:((maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																								  0:
-																																								 (maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																								 (maxProfile.ChargingSchedule.Duration-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 			}
 
 			for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 			{
 				if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 				{
-					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule))<0?
+					maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = !cpinitateMsg.bits[(connectorId==0?0:connectorId-1)].isOnCharging?maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod:((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule))<0?
 																																																											    0:
-																																																											   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile->ChargingSchedule.StartSchedule)));
+																																																											   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartStop(ShmOCPP16DataPH->StartTransaction[(connectorId==0?0:connectorId-1)].Timestamp, compositeProfile.ChargingSchedule.StartSchedule)));
 
 					if(idxPeriod > 0)
 					{
@@ -3103,18 +3107,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, FALSE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, FALSE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3130,18 +3134,18 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(maxProfile.ChargingSchedule.Duration != -1)
 				{
-					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+					maxProfile.ChargingSchedule.Duration = ((maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 															0:
-															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+															(maxProfile.ChargingSchedule.Duration-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 				}
 
 				for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(maxProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 				{
 					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod != -1)
 					{
-						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE))<0?
+						maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod = ((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE))<0?
 																									 0:
-																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile->ChargingSchedule.StartSchedule, TRUE)));
+																									 (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod-getStartSinceRecurring(maxProfile.ChargingSchedule.StartSchedule, compositeProfile.ChargingSchedule.StartSchedule, TRUE)));
 
 						if(idxPeriod > 0)
 						{
@@ -3207,7 +3211,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	// TxProfile found, composite schedule based on it
 	if(txProfile.ChargingProfileId != -1)
 	{
-		compositeProfile->ChargingSchedule.Duration = txProfile.ChargingSchedule.Duration;
+		compositeProfile.ChargingSchedule.Duration = txProfile.ChargingSchedule.Duration;
 		for(int idxTxPeriod=0;idxTxPeriod<limitTx;idxTxPeriod++)
 		{
 			if((txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].Limit != -1) &&
@@ -3236,16 +3240,16 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 						if(idxMaxPeriod == (limitMax-1))
 						{
-							if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+							if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 							{
-								if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 						}
@@ -3253,14 +3257,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				}
 				else
 				{
-					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3269,7 +3273,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 			{
 				if(defaultTxProfile.ChargingProfileId != -1)
 				{
-					compositeProfile->ChargingSchedule.Duration = (defaultTxProfile.ChargingSchedule.Duration>compositeProfile->ChargingSchedule.Duration)?defaultTxProfile.ChargingSchedule.Duration:compositeProfile->ChargingSchedule.Duration;
+					compositeProfile.ChargingSchedule.Duration = (defaultTxProfile.ChargingSchedule.Duration>compositeProfile.ChargingSchedule.Duration)?defaultTxProfile.ChargingSchedule.Duration:compositeProfile.ChargingSchedule.Duration;
 					for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 					{
 						if((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod >= (txProfile.ChargingSchedule.ChargingSchedulePeriod[idxTxPeriod].StartPeriod + (txProfile.ChargingSchedule.Duration-defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod))) &&
@@ -3295,40 +3299,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 											tmpPeriod.Limit = defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit;
 										}
 
-										if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+										if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 										{
-											if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+											if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 											{
-												memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+												memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 												compositePeriodIdx++;
 											}
 											else
 											{
-												memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+												memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 											}
 										}
 
 										// Delete duplicate period
 										if(compositePeriodIdx > 1)
 										{
-											if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+											if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 											{
-												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-												compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+												compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+												compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 												compositePeriodIdx -= 1;
 											}
 										}
 									}
 									else
 									{
-										if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+										if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 										{
-											memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+											memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 											compositePeriodIdx++;
 										}
 										else
 										{
-											memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+											memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 										}
 										break;
 									}
@@ -3336,14 +3340,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 							}
 							else
 							{
-								if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 						}
@@ -3355,7 +3359,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	// TxProfile not found but defaultTxProfile found, composite schedule based on it
 	else if(defaultTxProfile.ChargingProfileId != -1)
 	{
-		compositeProfile->ChargingSchedule.Duration = defaultTxProfile.ChargingSchedule.Duration;
+		compositeProfile.ChargingSchedule.Duration = defaultTxProfile.ChargingSchedule.Duration;
 		for(int idxDefPeriod=0;idxDefPeriod<limitDef;idxDefPeriod++)
 		{
 			if((defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit != -1) &&
@@ -3379,40 +3383,40 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 								tmpPeriod.Limit = defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].Limit;
 							}
 
-							if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
+							if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].Limit)
 							{
-								if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+								if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 									compositePeriodIdx++;
 								}
 								else
 								{
-									memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+									memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								}
 							}
 
 							// Delete duplicate period
 							if(compositePeriodIdx > 1)
 							{
-								if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+								if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 								{
-									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-									compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+									compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+									compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 									compositePeriodIdx -= 1;
 								}
 							}
 						}
 						else
 						{
-							if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+							if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 							}
 							break;
 						}
@@ -3420,14 +3424,14 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				}
 				else
 				{
-					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &defaultTxProfile.ChargingSchedule.ChargingSchedulePeriod[idxDefPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3439,21 +3443,21 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 	{
 		if(compositePeriodIdx==0)
 		{
-			compositeProfile->ChargingSchedule.Duration = maxProfile.ChargingSchedule.Duration;
+			compositeProfile.ChargingSchedule.Duration = maxProfile.ChargingSchedule.Duration;
 			for(int idxMaxPeriod=0;idxMaxPeriod<limitDef;idxMaxPeriod++)
 			{
 				if((maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit != -1) &&
 				   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod < durationReq) &&
 				   (maxProfile.ChargingSchedule.Duration > 0))
 				{
-					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
+					if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)].StartPeriod)
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 						compositePeriodIdx++;
 					}
 					else
 					{
-						memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
+						memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[(compositePeriodIdx==0?compositePeriodIdx:compositePeriodIdx-1)], &maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod],sizeof(struct StructChargingSchedulePeriod));
 					}
 				}
 			}
@@ -3467,13 +3471,13 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 				   (maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod < durationReq) &&
 				   (maxProfile.ChargingSchedule.Duration > 0))
 				{
-					if((maxProfile.ChargingSchedule.Duration >= compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod))
+					if((maxProfile.ChargingSchedule.Duration >= compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod))
 					{
-						if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit > compositeProfile->ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit)
+						if(maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].Limit > compositeProfile.ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit)
 						{
 							tmpPeriod.StartPeriod = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].StartPeriod;
 							tmpPeriod.NumberPhases = maxProfile.ChargingSchedule.ChargingSchedulePeriod[idxMaxPeriod].NumberPhases;
-							tmpPeriod.Limit = compositeProfile->ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit;
+							tmpPeriod.Limit = compositeProfile.ChargingSchedule.ChargingSchedulePeriod[lastCompositePeriodIdx-1].Limit;
 						}
 						else
 						{
@@ -3485,26 +3489,26 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 
 					if(tmpPeriod.Limit != -1)
 					{
-						if(tmpPeriod.Limit != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit)
+						if(tmpPeriod.Limit != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit)
 						{
-							if(tmpPeriod.StartPeriod != compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod)
+							if(tmpPeriod.StartPeriod != compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod)
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 								compositePeriodIdx++;
 							}
 							else
 							{
-								memcpy(&compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
+								memcpy(&compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1], &tmpPeriod , sizeof(struct StructChargingSchedulePeriod));
 							}
 						}
 
 						// Delete duplicate period
 						if(compositePeriodIdx > 1)
 						{
-							if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
+							if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit == compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-2].Limit)
 							{
-								compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
-								compositeProfile->ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
+								compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].StartPeriod = -1;
+								compositeProfile.ChargingSchedule.ChargingSchedulePeriod[compositePeriodIdx-1].Limit = -1;
 								compositePeriodIdx -= 1;
 							}
 						}
@@ -3514,28 +3518,30 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct St
 		}
 	}
 
-	compositeProfile->ChargingSchedule.Duration = durationReq;
+	compositeProfile.ChargingSchedule.Duration = durationReq;
 	DEBUG_INFO("Connector-%d composite schedule ready.\n", connectorId);
-	DEBUG_INFO("Schedule start: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
-	DEBUG_INFO("Schedule duration: %d\n", compositeProfile->ChargingSchedule.Duration);
-	DEBUG_INFO("Rate unit: %s\n", compositeProfile->ChargingSchedule.ChargingRateUnit);
-	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile->ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
+	DEBUG_INFO("Schedule start: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
+	DEBUG_INFO("Schedule duration: %d\n", compositeProfile.ChargingSchedule.Duration);
+	DEBUG_INFO("Rate unit: %s\n", compositeProfile.ChargingSchedule.ChargingRateUnit);
+	for(int idxPeriod=0;idxPeriod<ARRAY_SIZE(compositeProfile.ChargingSchedule.ChargingSchedulePeriod);idxPeriod++)
 	{
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod >= 0)
 		{
-			compositeProfile->ChargingProfileId = 1;
-			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
-			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
-			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
+			compositeProfile.ChargingProfileId = 1;
+			DEBUG_INFO("Period-%02d startPeriod: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod);
+			DEBUG_INFO("Period-%02d limit: %f\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit);
+			DEBUG_INFO("Period-%02d NumberPhases: %d\n", idxPeriod, compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].NumberPhases);
 		}
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].Limit =0;
 
-		if(compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
-			compositeProfile->ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
+		if(compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod == -1)
+			compositeProfile.ChargingSchedule.ChargingSchedulePeriod[idxPeriod].StartPeriod =0;
 	}
 
+	memcpy(targetCompositeProfile, &compositeProfile, sizeof(struct StructChargingProfile));
+
 	if(line)
 		free(line);