)
: DCElectricUtils.power(voltageOut, amperageLimitation)) / (this.powerDivider ?? 1)
}
- const connectorMaximumPower = (this.stationInfo?.maximumPower ?? 0) / (this.powerDivider ?? 1)
+ const maximumPower = this.stationInfo?.maximumPower
+ if (maximumPower == null || maximumPower <= 0) {
+ logger.error(
+ `${this.logPrefix()} getConnectorMaximumAvailablePower: maximumPower is ${
+ maximumPower?.toString() ?? 'undefined'
+ }, cannot compute connector maximum power`
+ )
+ return Number.POSITIVE_INFINITY
+ }
+ const connectorMaximumPower = maximumPower / (this.powerDivider ?? 1)
const chargingStationChargingProfilesLimit =
(getChargingStationChargingProfilesLimit(this) ?? Number.POSITIVE_INFINITY) /
(this.powerDivider ?? 1)
private getMaximumAmperage (stationInfo?: ChargingStationInfo): number | undefined {
const localStationInfo = stationInfo ?? this.stationInfo
- const maximumPower = localStationInfo?.maximumPower ?? 0
+ const maximumPower = localStationInfo?.maximumPower
+ if (maximumPower == null || maximumPower <= 0) {
+ logger.error(
+ `${this.logPrefix()} getMaximumAmperage: maximumPower is ${
+ maximumPower?.toString() ?? 'undefined'
+ }, cannot compute maximum amperage`
+ )
+ return undefined
+ }
switch (this.getCurrentOutType(stationInfo)) {
case CurrentType.AC:
return ACElectricUtils.amperagePerPhaseFromPower(
isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
getConfigurationKey(this, this.stationInfo.amperageLimitationOcppKey) == null
) {
- addConfigurationKey(
- this,
- this.stationInfo.amperageLimitationOcppKey,
- // prettier-ignore
- ((this.stationInfo.maximumAmperage ?? 0) * getAmperageLimitationUnitDivider(this.stationInfo)).toString()
- )
+ const maximumAmperage = this.stationInfo.maximumAmperage
+ if (maximumAmperage != null && maximumAmperage > 0) {
+ addConfigurationKey(
+ this,
+ this.stationInfo.amperageLimitationOcppKey,
+ // prettier-ignore
+ (maximumAmperage * getAmperageLimitationUnitDivider(this.stationInfo)).toString()
+ )
+ } else {
+ logger.error(
+ `${this.logPrefix()} initializeOcppConfiguration: maximumAmperage is ${
+ maximumAmperage?.toString() ?? 'undefined'
+ }, cannot set amperage limitation configuration key`
+ )
+ }
}
if (getConfigurationKey(this, StandardParametersKey.SupportedFeatureProfiles) == null) {
addConfigurationKey(
const chargingProfilesLimit = getChargingProfilesLimit(chargingStation, 0, chargingProfiles)
if (chargingProfilesLimit != null) {
const limit = buildChargingProfilesLimit(chargingStation, chargingProfilesLimit)
- const chargingStationMaximumPower = chargingStation.stationInfo?.maximumPower ?? 0
+ const chargingStationMaximumPower = chargingStation.stationInfo?.maximumPower
+ if (chargingStationMaximumPower == null) {
+ return limit
+ }
if (limit > chargingStationMaximumPower) {
logger.error(
`${chargingStation.logPrefix()} ${moduleName}.getChargingStationChargingProfilesLimit: Charging profile id ${getChargingProfileId(chargingProfilesLimit.chargingProfile)} limit ${limit.toString()} is greater than charging station maximum ${chargingStationMaximumPower.toString()}: %j`,
)
if (chargingProfilesLimit != null) {
const limit = buildChargingProfilesLimit(chargingStation, chargingProfilesLimit)
- const connectorMaximumPower =
- (chargingStation.stationInfo?.maximumPower ?? 0) / (chargingStation.powerDivider ?? 1)
+ const maximumPower = chargingStation.stationInfo?.maximumPower
+ if (maximumPower == null) {
+ return limit
+ }
+ const connectorMaximumPower = maximumPower / (chargingStation.powerDivider ?? 1)
if (limit > connectorMaximumPower) {
logger.error(
`${chargingStation.logPrefix()} ${moduleName}.getConnectorChargingProfilesLimit: Charging profile id ${getChargingProfileId(chargingProfilesLimit.chargingProfile)} limit ${limit.toString()} is greater than connector ${connectorId.toString()} maximum ${connectorMaximumPower.toString()}: %j`,