From: Jérôme Benoit Date: Wed, 2 Aug 2023 16:59:34 +0000 (+0200) Subject: fix: fix wrong charging profiles resorting at power limitation X-Git-Tag: v1.2.20~37 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=0a96409ab6db51ef7b2e6e292216d12c926f7e9c;p=e-mobility-charging-stations-simulator.git fix: fix wrong charging profiles resorting at power limitation computation Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/Helpers.ts b/src/charging-station/Helpers.ts index 9de54777..63cc0f63 100644 --- a/src/charging-station/Helpers.ts +++ b/src/charging-station/Helpers.ts @@ -734,7 +734,7 @@ interface ChargingProfilesLimit { } /** - * Charging profiles should already be sorted by connector id ascending then stack level descending + * Charging profiles shall already be sorted by connector id ascending then stack level descending * * @param chargingStation - * @param connectorId - @@ -751,12 +751,6 @@ const getLimitFromChargingProfiles = ( const debugLogMsg = `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Matching charging profile found for power limitation: %j`; const currentDate = new Date(); const connectorStatus = chargingStation.getConnectorStatus(connectorId)!; - if (!isArraySorted(chargingProfiles, (a, b) => b.stackLevel - a.stackLevel)) { - logger.warn( - `${logPrefix} ${moduleName}.getLimitFromChargingProfiles: Charging profiles are not sorted by stack level. Trying to sort them`, - ); - chargingProfiles.sort((a, b) => b.stackLevel - a.stackLevel); - } for (const chargingProfile of chargingProfiles) { const chargingSchedule = chargingProfile.chargingSchedule; if (connectorStatus?.transactionStarted && isNullOrUndefined(chargingSchedule?.startSchedule)) {