X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=e217991ac8aad3c7c4256010687929df0f0162a3;hb=b3e297931b16fbd02794e62bdea7077419e07097;hp=7dbb0d3ebd7f7ae2900885f8e7706daa56e30b36;hpb=f223daa52d37f83d11ef1b4b6864eb8b549652a4;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 7dbb0d3e..e217991a 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -120,8 +120,9 @@ import { createSerialNumber, getAmperageLimitationUnitDivider, getBootConnectorStatus, - getChargingStationConnectorChargingProfilesPowerLimit, + getChargingStationChargingProfilesLimit, getChargingStationId, + getConnectorChargingProfilesLimit, getDefaultVoltageOut, getHashId, getIdTagsFile, @@ -391,14 +392,14 @@ export class ChargingStation extends EventEmitter { } public getConnectorMaximumAvailablePower (connectorId: number): number { - let connectorAmperageLimitationPowerLimit: number | undefined + let connectorAmperageLimitationLimit: number | undefined const amperageLimitation = this.getAmperageLimitation() if ( amperageLimitation != null && // eslint-disable-next-line @typescript-eslint/no-non-null-assertion amperageLimitation < this.stationInfo!.maximumAmperage! ) { - connectorAmperageLimitationPowerLimit = + connectorAmperageLimitationLimit = (this.stationInfo?.currentOutType === CurrentType.AC ? ACElectricUtils.powerTotal( this.getNumberOfPhases(), @@ -414,20 +415,25 @@ export class ChargingStation extends EventEmitter { } // eslint-disable-next-line @typescript-eslint/no-non-null-assertion const connectorMaximumPower = this.stationInfo!.maximumPower! / this.powerDivider! - const connectorChargingProfilesPowerLimit = - getChargingStationConnectorChargingProfilesPowerLimit(this, connectorId) + const chargingStationChargingProfilesLimit = + // eslint-disable-next-line @typescript-eslint/no-non-null-assertion + getChargingStationChargingProfilesLimit(this)! / this.powerDivider! + const connectorChargingProfilesLimit = getConnectorChargingProfilesLimit(this, connectorId) return min( isNaN(connectorMaximumPower) ? Number.POSITIVE_INFINITY : connectorMaximumPower, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - isNaN(connectorAmperageLimitationPowerLimit!) + isNaN(connectorAmperageLimitationLimit!) ? Number.POSITIVE_INFINITY : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorAmperageLimitationPowerLimit!, + connectorAmperageLimitationLimit!, + isNaN(chargingStationChargingProfilesLimit) + ? Number.POSITIVE_INFINITY + : chargingStationChargingProfilesLimit, // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - isNaN(connectorChargingProfilesPowerLimit!) + isNaN(connectorChargingProfilesLimit!) ? Number.POSITIVE_INFINITY : // eslint-disable-next-line @typescript-eslint/no-non-null-assertion - connectorChargingProfilesPowerLimit! + connectorChargingProfilesLimit! ) }