From: Jérôme Benoit Date: Thu, 24 Mar 2022 10:03:52 +0000 (+0100) Subject: Charging profiles: Fix timestamp value unit handling X-Git-Tag: v1.1.57~31 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=7b872eaa46d0131c6487d52a8ce9886663e99eae;p=e-mobility-charging-stations-simulator.git Charging profiles: Fix timestamp value unit handling Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 79fc4f43..02c7a0e0 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -247,12 +247,12 @@ export default class ChargingStation { ) : DCElectricUtils.power(this.getVoltageOut(), this.getAmperageLimitation()); } - const connectorChargingProfilePowerLimit = this.getChargingProfilePowerLimit(connectorId); const connectorMaximumPower = ((this.stationInfo['maxPower'] as number) ?? this.stationInfo.maximumPower) / this.stationInfo.powerDivider; const connectorAmperageLimitationPowerLimit = amperageLimitationPowerLimit / this.stationInfo.powerDivider; + const connectorChargingProfilePowerLimit = this.getChargingProfilePowerLimit(connectorId); return Math.min( isNaN(connectorMaximumPower) ? Infinity : connectorMaximumPower, isNaN(connectorAmperageLimitationPowerLimit) @@ -731,7 +731,7 @@ export default class ChargingStation { timestamp >= chargingProfile.chargingSchedule?.startSchedule.getTime() && timestamp < chargingProfile.chargingSchedule?.startSchedule.getTime() + - chargingProfile.chargingSchedule.duration && + chargingProfile.chargingSchedule.duration * 1000 && chargingProfile?.stackLevel === Math.max(...chargingProfiles.map((cp) => cp?.stackLevel)) ); if (!Utils.isEmptyArray(chargingProfiles)) { @@ -742,12 +742,13 @@ export default class ChargingStation { (chargingSchedulePeriod, index) => { timestamp >= chargingProfile.chargingSchedule.startSchedule.getTime() + - chargingSchedulePeriod.startPeriod && + chargingSchedulePeriod.startPeriod * 1000 && chargingProfile.chargingSchedule.chargingSchedulePeriod[index + 1] && timestamp < chargingProfile.chargingSchedule.startSchedule.getTime() + chargingProfile.chargingSchedule.chargingSchedulePeriod[index + 1] - ?.startPeriod; + ?.startPeriod * + 1000; } ); if (!Utils.isEmptyArray(chargingSchedulePeriods)) {