From: Jérôme Benoit Date: Fri, 25 Mar 2022 11:27:47 +0000 (+0100) Subject: Only compute amperage limitation when needed X-Git-Tag: v1.1.57~28 X-Git-Url: https://git.piment-noir.org/?a=commitdiff_plain;h=d20f43b5644d96a9a166cd2ec5ddf87945ea45d7;p=e-mobility-charging-stations-simulator.git Only compute amperage limitation when needed Signed-off-by: Jérôme Benoit --- diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 3051abb7..40e2c1b1 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -236,9 +236,9 @@ export default class ChargingStation { } public getConnectorMaximumAvailablePower(connectorId: number): number { - let amperageLimitationPowerLimit: number; + let connectorAmperageLimitationPowerLimit: number; if (this.getAmperageLimitation() < this.stationInfo.maximumAmperage) { - amperageLimitationPowerLimit = + const amperageLimitationPowerLimit = this.getCurrentOutType() === CurrentType.AC ? ACElectricUtils.powerTotal( this.getNumberOfPhases(), @@ -246,12 +246,12 @@ export default class ChargingStation { this.getAmperageLimitation() * this.getNumberOfConnectors() ) : DCElectricUtils.power(this.getVoltageOut(), this.getAmperageLimitation()); + connectorAmperageLimitationPowerLimit = + amperageLimitationPowerLimit / this.stationInfo.powerDivider; } 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,