|
@@ -3450,28 +3450,180 @@ int DiffTimebWithNowSec(struct timeb ST)
|
|
|
|
|
|
int getStartStop(uint8_t *start, uint8_t *stop)
|
|
|
{
|
|
|
+ struct ParsingResult
|
|
|
+ {
|
|
|
+ int result;
|
|
|
+ int scanedElement;
|
|
|
+ int year;
|
|
|
+ int month;
|
|
|
+ int mday;
|
|
|
+ int hour;
|
|
|
+ int min;
|
|
|
+ int sec;
|
|
|
+ int tz_hour;
|
|
|
+ int tz_min;
|
|
|
+ float minSec;
|
|
|
+ };
|
|
|
+
|
|
|
+ struct ParsingResult parseStart;
|
|
|
+ struct ParsingResult parseStop;
|
|
|
+
|
|
|
int result = -1;
|
|
|
struct tm tmStart;
|
|
|
struct timeb tbStart;
|
|
|
struct tm tmStop;
|
|
|
struct timeb tbStop;
|
|
|
|
|
|
+ memset(&parseStart, 0x00, sizeof(struct ParsingResult));
|
|
|
+ memset(&parseStop, 0x00, sizeof(struct ParsingResult));
|
|
|
|
|
|
- if((sscanf((char*)start, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6) &&
|
|
|
- (sscanf((char*)stop, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStop.tm_year, &tmStop.tm_mon, &tmStop.tm_mday, &tmStop.tm_hour, &tmStop.tm_min, &tmStop.tm_sec) == 6))
|
|
|
+ // Scan start & stop date time
|
|
|
+ if(strstr((char*)start, ".") != NULL)
|
|
|
{
|
|
|
- //DEBUG_INFO("Start: %d-%d-%d %d:%d:%d\n", tmStart.tm_year, tmStart.tm_mon, tmStart.tm_mday, tmStart.tm_hour, tmStart.tm_min, tmStart.tm_sec);
|
|
|
- //DEBUG_INFO("Stop: %d-%d-%d %d:%d:%d\n", tmStop.tm_year, tmStop.tm_mon, tmStop.tm_mday, tmStop.tm_hour, tmStop.tm_min, tmStop.tm_sec);
|
|
|
+ // Original data with mini second
|
|
|
+ if(strstr((char*)start, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.minSec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.minSec,
|
|
|
+ &parseStart.tz_hour,
|
|
|
+ &parseStart.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without mini second
|
|
|
+ if(strstr((char*)start, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.tz_hour,
|
|
|
+ &parseStart.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- tmStart.tm_year -= 1900;
|
|
|
- tmStart.tm_mon -= 1;
|
|
|
+ if(strstr((char*)stop, ".") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with mini second
|
|
|
+ if(strstr((char*)stop, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d.%fZ",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.minSec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d.%f%d:%d",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.minSec,
|
|
|
+ &parseStop.tz_hour,
|
|
|
+ &parseStop.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without mini second
|
|
|
+ if(strstr((char*)stop, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%dZ",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d%d:%d",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.tz_hour,
|
|
|
+ &parseStop.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Calculate date time difference
|
|
|
+ if((parseStart.scanedElement >=6) &&
|
|
|
+ (parseStop.scanedElement >=6))
|
|
|
+ {
|
|
|
+ //DEBUG_INFO("Start: %04d-%02d-%02d %02d:%02d:%02d(%02d:%02d)\n", parseStart.year, parseStart.month, parseStart.mday, parseStart.hour, parseStart.min, parseStart.sec, parseStart.tz_hour, parseStart.tz_min);
|
|
|
+ //DEBUG_INFO("Stop: %04d-%02d-%02d %02d:%02d:%02d(%02d:%02d)\n", parseStop.year, parseStop.month, parseStop.mday, parseStop.hour, parseStop.min, parseStop.sec, parseStop.tz_hour, parseStop.tz_min);
|
|
|
+
|
|
|
+ tmStart.tm_year = parseStart.year - 1900;
|
|
|
+ tmStart.tm_mon = parseStart.month - 1;
|
|
|
+ tmStart.tm_mday = parseStart.mday;
|
|
|
+ tmStart.tm_hour = parseStart.hour;
|
|
|
+ tmStart.tm_min = parseStart.min;
|
|
|
+ tmStart.tm_sec = parseStart.sec;
|
|
|
+ tmStart.tm_gmtoff = 0;
|
|
|
tbStart.time = mktime(&tmStart);
|
|
|
- tbStart.millitm = 0;
|
|
|
-
|
|
|
- tmStop.tm_year -= 1900;
|
|
|
- tmStop.tm_mon -= 1;
|
|
|
+ tbStart.timezone = 0;
|
|
|
+ tbStart.time -= (parseStart.tz_hour*3600) + (parseStart.tz_min*60*(parseStart.tz_hour>=0?1:-1));
|
|
|
+
|
|
|
+ tmStop.tm_year = parseStop.year - 1900;
|
|
|
+ tmStop.tm_mon = parseStop.month - 1;
|
|
|
+ tmStop.tm_mday = parseStop.mday;
|
|
|
+ tmStop.tm_hour = parseStop.hour;
|
|
|
+ tmStop.tm_min = parseStop.min;
|
|
|
+ tmStop.tm_sec = parseStop.sec;
|
|
|
+ tmStop.tm_gmtoff = 0;
|
|
|
tbStop.time = mktime(&tmStop);
|
|
|
- tbStop.millitm = 0;
|
|
|
+ tbStop.timezone = 0;
|
|
|
+ tbStop.time -= (parseStop.tz_hour*3600) + (parseStop.tz_min*60*(parseStop.tz_hour>=0?1:-1));
|
|
|
|
|
|
result = DiffTimebSec(tbStart, tbStop);
|
|
|
|
|
@@ -3598,26 +3750,189 @@ int isOvertNow(uint8_t *start)
|
|
|
|
|
|
int getStartSinceRecurring(uint8_t *start, uint8_t *stop, uint8_t isDaily)
|
|
|
{
|
|
|
+ struct ParsingResult
|
|
|
+ {
|
|
|
+ int result;
|
|
|
+ int scanedElement;
|
|
|
+ int year;
|
|
|
+ int month;
|
|
|
+ int mday;
|
|
|
+ int hour;
|
|
|
+ int min;
|
|
|
+ int sec;
|
|
|
+ int tz_hour;
|
|
|
+ int tz_min;
|
|
|
+ float minSec;
|
|
|
+ };
|
|
|
+
|
|
|
+ struct ParsingResult parseStart;
|
|
|
+ struct ParsingResult parseStop;
|
|
|
+
|
|
|
int result = -1;
|
|
|
struct tm tmStart;
|
|
|
struct timeb tbStart;
|
|
|
struct tm tmStop;
|
|
|
struct timeb tbStop;
|
|
|
|
|
|
- if((sscanf((char*)start, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStart.tm_year, &tmStart.tm_mon, &tmStart.tm_mday, &tmStart.tm_hour, &tmStart.tm_min, &tmStart.tm_sec) == 6) &&
|
|
|
- (sscanf((char*)stop, "%4d-%2d-%2dT%2d:%2d:%2d", &tmStop.tm_year, &tmStop.tm_mon, &tmStop.tm_mday, &tmStop.tm_hour, &tmStop.tm_min, &tmStop.tm_sec) == 6))
|
|
|
+ memset(&parseStart, 0x00, sizeof(struct ParsingResult));
|
|
|
+ memset(&parseStop, 0x00, sizeof(struct ParsingResult));
|
|
|
+
|
|
|
+ // Scan start & stop date time
|
|
|
+ if(strstr((char*)start, ".") != NULL)
|
|
|
{
|
|
|
- tmStart.tm_year -= 1900;
|
|
|
- tmStart.tm_mon -= 1;
|
|
|
- tbStart.time = mktime(&tmStart);
|
|
|
- tbStart.millitm = 0;
|
|
|
+ // Original data with mini second
|
|
|
+ if(strstr((char*)start, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%fZ",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.minSec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d.%f%d:%d",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.minSec,
|
|
|
+ &parseStart.tz_hour,
|
|
|
+ &parseStart.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without mini second
|
|
|
+ if(strstr((char*)start, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%dZ",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStart.scanedElement = sscanf((char*)start, "%d-%d-%dT%d:%d:%d%d:%d",
|
|
|
+ &parseStart.year,
|
|
|
+ &parseStart.month,
|
|
|
+ &parseStart.mday,
|
|
|
+ &parseStart.hour,
|
|
|
+ &parseStart.min,
|
|
|
+ &parseStart.sec,
|
|
|
+ &parseStart.tz_hour,
|
|
|
+ &parseStart.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
|
|
|
- tmStop.tm_year -= 1900;
|
|
|
- tmStop.tm_mon -= 1;
|
|
|
+ if(strstr((char*)stop, ".") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with mini second
|
|
|
+ if(strstr((char*)stop, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d.%fZ",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.minSec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d.%f%d:%d",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.minSec,
|
|
|
+ &parseStop.tz_hour,
|
|
|
+ &parseStop.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without mini second
|
|
|
+ if(strstr((char*)stop, "Z") != NULL)
|
|
|
+ {
|
|
|
+ // Original data with Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%dZ",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec);
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ // Original data without Z
|
|
|
+ parseStop.scanedElement = sscanf((char*)stop, "%d-%d-%dT%d:%d:%d%d:%d",
|
|
|
+ &parseStop.year,
|
|
|
+ &parseStop.month,
|
|
|
+ &parseStop.mday,
|
|
|
+ &parseStop.hour,
|
|
|
+ &parseStop.min,
|
|
|
+ &parseStop.sec,
|
|
|
+ &parseStop.tz_hour,
|
|
|
+ &parseStop.tz_min);
|
|
|
+ }
|
|
|
+ }
|
|
|
+
|
|
|
+ // Calculate date time difference
|
|
|
+ if((parseStart.scanedElement >=6) &&
|
|
|
+ (parseStop.scanedElement >=6))
|
|
|
+ {
|
|
|
+ //DEBUG_INFO("Start: %04d-%02d-%02d %02d:%02d:%02d(%02d:%02d)\n", parseStart.year, parseStart.month, parseStart.mday, parseStart.hour, parseStart.min, parseStart.sec, parseStart.tz_hour, parseStart.tz_min);
|
|
|
+ //DEBUG_INFO("Stop: %04d-%02d-%02d %02d:%02d:%02d(%02d:%02d)\n", parseStop.year, parseStop.month, parseStop.mday, parseStop.hour, parseStop.min, parseStop.sec, parseStop.tz_hour, parseStop.tz_min);
|
|
|
+
|
|
|
+ tmStart.tm_year = parseStart.year - 1900;
|
|
|
+ tmStart.tm_mon = parseStart.month - 1;
|
|
|
+ tmStart.tm_mday = parseStart.mday;
|
|
|
+ tmStart.tm_hour = parseStart.hour;
|
|
|
+ tmStart.tm_min = parseStart.min;
|
|
|
+ tmStart.tm_sec = parseStart.sec;
|
|
|
+ tmStart.tm_gmtoff = 0;
|
|
|
+ tbStart.time = mktime(&tmStart);
|
|
|
+ tbStart.timezone = 0;
|
|
|
+ tbStart.time -= (parseStart.tz_hour*3600) + (parseStart.tz_min*60*(parseStart.tz_hour>=0?1:-1));
|
|
|
+
|
|
|
+ tmStop.tm_year = parseStop.year - 1900;
|
|
|
+ tmStop.tm_mon = parseStop.month - 1;
|
|
|
+ tmStop.tm_mday = parseStop.mday;
|
|
|
+ tmStop.tm_hour = parseStop.hour;
|
|
|
+ tmStop.tm_min = parseStop.min;
|
|
|
+ tmStop.tm_sec = parseStop.sec;
|
|
|
+ tmStop.tm_gmtoff = 0;
|
|
|
tbStop.time = mktime(&tmStop);
|
|
|
- tbStop.millitm = 0;
|
|
|
+ tbStop.timezone = 0;
|
|
|
+ tbStop.time -= (parseStop.tz_hour*3600) + (parseStop.tz_min*60*(parseStop.tz_hour>=0?1:-1));
|
|
|
|
|
|
result = DiffTimebSec(tbStart, tbStop)%(isDaily?86400:604800);
|
|
|
+
|
|
|
+ //DEBUG_INFO("getStartStop(): %d\n", result);
|
|
|
+
|
|
|
+ }
|
|
|
+ else
|
|
|
+ {
|
|
|
+ DEBUG_WARN("Start or stop date parsing error.\r\n");
|
|
|
}
|
|
|
|
|
|
return result;
|
|
@@ -3710,8 +4025,6 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
}
|
|
|
- maxProfile.id = -1;
|
|
|
- maxProfile.stackLevel = -1;
|
|
|
|
|
|
if(maxProfile.id == -1)
|
|
|
DEBUG_INFO("MaxProfile found.\n");
|
|
@@ -3824,8 +4137,6 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
}
|
|
|
- maxProfile.id = -1;
|
|
|
- maxProfile.stackLevel = -1;
|
|
|
|
|
|
if(maxProfile.id == -1)
|
|
|
DEBUG_INFO("MaxProfile found.\n");
|
|
@@ -4082,7 +4393,7 @@ void checkChargePointMaxProfile(uint32_t durationReq, struct ChargingProfileType
|
|
|
DEBUG_INFO("Profile ChargingProfileKind: %s\n", maxProfile.ChargingProfileKind);
|
|
|
DEBUG_INFO("Profile recurrencyKind: %s\n", maxProfile.recurrencyKind);
|
|
|
|
|
|
- DEBUG_INFO("Profile start schedule: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
|
|
|
+ DEBUG_INFO("Profile start schedule: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
|
|
|
DEBUG_INFO("Profile schedule duration: %d\n", maxProfile.chargingSchedule[idxSchedule].Duration);
|
|
|
DEBUG_INFO("Profile charging rate unit: %s\n", maxProfile.chargingSchedule[idxSchedule].ChargingRateUnit);
|
|
|
DEBUG_INFO("Profile charging min rate: %f\n", maxProfile.chargingSchedule[idxSchedule].MinChargingRate);
|
|
@@ -4256,8 +4567,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].phaseToUse = 0;
|
|
|
}
|
|
|
- txProfile.id = -1;
|
|
|
- txProfile.stackLevel = -1;
|
|
|
|
|
|
if(txProfile.id == -1)
|
|
|
DEBUG_INFO("TxProfile found.\n");
|
|
@@ -4370,8 +4679,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
txProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].phaseToUse = 0;
|
|
|
}
|
|
|
- txProfile.id = -1;
|
|
|
- txProfile.stackLevel = -1;
|
|
|
|
|
|
if(txProfile.id == -1)
|
|
|
DEBUG_INFO("TxProfile found.\n");
|
|
@@ -4560,8 +4867,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].phaseToUse = 0;
|
|
|
}
|
|
|
- defaultTxProfile.id = -1;
|
|
|
- defaultTxProfile.stackLevel = -1;
|
|
|
|
|
|
if(defaultTxProfile.id == -1)
|
|
|
DEBUG_INFO("TxDefaultProfile found.\n");
|
|
@@ -4674,8 +4979,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].phaseToUse = 0;
|
|
|
}
|
|
|
- defaultTxProfile.id = -1;
|
|
|
- defaultTxProfile.stackLevel = -1;
|
|
|
|
|
|
if(defaultTxProfile.id == -1)
|
|
|
DEBUG_INFO("TxDefaultProfile found.\n");
|
|
@@ -4861,8 +5164,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
}
|
|
|
- maxProfile.id = -1;
|
|
|
- maxProfile.stackLevel = -1;
|
|
|
|
|
|
if(maxProfile.id == -1)
|
|
|
DEBUG_INFO("MaxProfile found.\n");
|
|
@@ -4975,8 +5276,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].limit = -1;
|
|
|
maxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].numberPhases = 3;
|
|
|
}
|
|
|
- maxProfile.id = -1;
|
|
|
- maxProfile.stackLevel = -1;
|
|
|
|
|
|
if(maxProfile.id == -1)
|
|
|
DEBUG_INFO("MaxProfile found.\n");
|
|
@@ -5248,7 +5547,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
DEBUG_INFO("Profile ChargingProfileKind: %s\n", txProfile.ChargingProfileKind);
|
|
|
DEBUG_INFO("Profile recurrencyKind: %s\n", txProfile.recurrencyKind);
|
|
|
|
|
|
- DEBUG_INFO("Profile start schedule: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
|
|
|
+ DEBUG_INFO("Profile start schedule: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
|
|
|
DEBUG_INFO("Profile schedule duration: %d\n", txProfile.chargingSchedule[idxSchedule].Duration);
|
|
|
DEBUG_INFO("Profile charging rate unit: %s\n", txProfile.chargingSchedule[idxSchedule].ChargingRateUnit);
|
|
|
DEBUG_INFO("Profile charging min rate: %f\n", txProfile.chargingSchedule[idxSchedule].MinChargingRate);
|
|
@@ -5283,11 +5582,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
0:
|
|
|
(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)
|
|
|
- {
|
|
|
- defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod += (txProfile.chargingSchedule[idxSchedule].duration-defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
|
|
|
- }
|
|
|
-
|
|
|
if(idxPeriod > 0)
|
|
|
{
|
|
|
if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod-1].startPeriod == defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod)
|
|
@@ -5315,11 +5609,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
0:
|
|
|
(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)
|
|
|
- {
|
|
|
- defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod += (txProfile.chargingSchedule[idxSchedule].duration-defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
|
|
|
- }
|
|
|
-
|
|
|
if(idxPeriod > 0)
|
|
|
{
|
|
|
if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod-1].startPeriod == defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod)
|
|
@@ -5349,11 +5638,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
0:
|
|
|
(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)
|
|
|
- {
|
|
|
- defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod += (txProfile.chargingSchedule[idxSchedule].duration-defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
|
|
|
- }
|
|
|
-
|
|
|
if(idxPeriod > 0)
|
|
|
{
|
|
|
if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod-1].startPeriod == defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod)
|
|
@@ -5381,11 +5665,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
0:
|
|
|
(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)
|
|
|
- {
|
|
|
- defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod += (txProfile.chargingSchedule[idxSchedule].duration-defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod);
|
|
|
- }
|
|
|
-
|
|
|
if(idxPeriod > 0)
|
|
|
{
|
|
|
if(defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod-1].startPeriod == defaultTxProfile.chargingSchedule[idxSchedule].chargingSchedulePeriod[idxPeriod].startPeriod)
|
|
@@ -5407,7 +5686,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
DEBUG_INFO("Profile ChargingProfileKind: %s\n", defaultTxProfile.ChargingProfileKind);
|
|
|
DEBUG_INFO("Profile recurrencyKind: %s\n", defaultTxProfile.recurrencyKind);
|
|
|
|
|
|
- DEBUG_INFO("Profile start schedule: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
|
|
|
+ DEBUG_INFO("Profile start schedule: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
|
|
|
DEBUG_INFO("Profile schedule duration: %d\n", defaultTxProfile.chargingSchedule[idxSchedule].Duration);
|
|
|
DEBUG_INFO("Profile charging rate unit: %s\n", defaultTxProfile.chargingSchedule[idxSchedule].ChargingRateUnit);
|
|
|
DEBUG_INFO("Profile charging min rate: %f\n", defaultTxProfile.chargingSchedule[idxSchedule].MinChargingRate);
|
|
@@ -5547,7 +5826,7 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
DEBUG_INFO("Profile ChargingProfileKind: %s\n", maxProfile.ChargingProfileKind);
|
|
|
DEBUG_INFO("Profile recurrencyKind: %s\n", maxProfile.recurrencyKind);
|
|
|
|
|
|
- DEBUG_INFO("Profile start schedule: %s\n", compositeProfile->ChargingSchedule.StartSchedule);
|
|
|
+ DEBUG_INFO("Profile start schedule: %s\n", compositeProfile.ChargingSchedule.StartSchedule);
|
|
|
DEBUG_INFO("Profile schedule duration: %d\n", maxProfile.chargingSchedule[idxSchedule].Duration);
|
|
|
DEBUG_INFO("Profile charging rate unit: %s\n", maxProfile.chargingSchedule[idxSchedule].ChargingRateUnit);
|
|
|
DEBUG_INFO("Profile charging min rate: %f\n", maxProfile.chargingSchedule[idxSchedule].MinChargingRate);
|
|
@@ -5925,8 +6204,6 @@ void checkCompositeSchedule(uint8_t connectorId, uint32_t durationReq, struct Ch
|
|
|
if(line)
|
|
|
free(line);
|
|
|
|
|
|
- checkChargePointMaxProfile(durationReq, &ShmOCPP20Data->MaxChargingProfile, idxSchedule, isUnitA);
|
|
|
-
|
|
|
ShmOCPP20Data->CSUMsg.bits[(connectorId==0?0:connectorId-1)].ChargingProfileConf = ON;
|
|
|
}
|
|
|
|
|
@@ -7100,6 +7377,7 @@ void CheckSystemValue(void)
|
|
|
//==============================================
|
|
|
if(ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq == ON)
|
|
|
{
|
|
|
+ checkChargePointMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
|
|
|
checkCompositeSchedule(gun_index+1, 86400, &ShmOCPP20Data->SmartChargingProfile[gun_index], 0, TRUE);
|
|
|
ShmOCPP20Data->CSUMsg.bits[gun_index].ChargingProfileReq = OFF;
|
|
|
}
|
|
@@ -13156,11 +13434,15 @@ end:
|
|
|
{
|
|
|
for(uint8_t idx=0;idx<gunTotalNumber;idx++)
|
|
|
{
|
|
|
+ checkChargePointMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
|
|
|
checkCompositeSchedule((idx+1), 86400, &ShmOCPP20Data->SmartChargingProfile[idx], 0, TRUE);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
+ checkChargePointMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
|
|
|
checkCompositeSchedule(connectorIdInt, 86400, &ShmOCPP20Data->SmartChargingProfile[connectorIdInt-1], 0, TRUE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
|
|
@@ -16544,11 +16826,15 @@ int handleSetChargingProfileRequest(char *uuid, char *payload)
|
|
|
{
|
|
|
for(uint8_t idx=0;idx<gunTotalNumber;idx++)
|
|
|
{
|
|
|
+ checkChargePointMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
|
|
|
checkCompositeSchedule((idx+1), 86400, &ShmOCPP20Data->SmartChargingProfile[idx], 0, TRUE);
|
|
|
}
|
|
|
}
|
|
|
else
|
|
|
+ {
|
|
|
+ checkChargePointMaxProfile(86400, &ShmOCPP20Data->MaxChargingProfile, 0, TRUE);
|
|
|
checkCompositeSchedule(SetProfileReq.evseId, 86400, &ShmOCPP20Data->SmartChargingProfile[SetProfileReq.evseId-1], 0, TRUE);
|
|
|
+ }
|
|
|
}
|
|
|
|
|
|
sendSetChargingProfileConfirmation(uuid, (SetProfileReq.evseId==0?SetProfileReq.evseId:SetProfileReq.evseId-1));
|