X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2Focpp%2F1.6%2FOCPP16ServiceUtils.ts;h=2a154e7b78e9dd26a6ebb2b300f968c7dba3f712;hb=1c3cfd4f4074733491c8e9ceee59c044a0d0800b;hp=1c8e1369b25fe997e9aac7ac509b3a91eb9c4920;hpb=492cf6ab7b4e5231974ca1a9c219afbf0d53f4b9;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts index 1c8e1369..2a154e7b 100644 --- a/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts +++ b/src/charging-station/ocpp/1.6/OCPP16ServiceUtils.ts @@ -1,10 +1,15 @@ // Partial Copyright Jerome Benoit. 2021. All Rights Reserved. -import { ACElectricUtils, DCElectricUtils } from '../../../utils/ElectricUtils'; +import OCPPError from '../../../exception/OCPPError'; import { CurrentType, Voltage } from '../../../types/ChargingStationTemplate'; import MeasurandPerPhaseSampledValueTemplates, { SampledValueTemplate, } from '../../../types/MeasurandPerPhaseSampledValueTemplates'; +import MeasurandValues from '../../../types/MeasurandValues'; +import { + OCPP16StandardParametersKey, + OCPP16SupportedFeatureProfiles, +} from '../../../types/ocpp/1.6/Configuration'; import { MeterValueContext, MeterValueLocation, @@ -18,20 +23,14 @@ import { OCPP16IncomingRequestCommand, OCPP16RequestCommand, } from '../../../types/ocpp/1.6/Requests'; -import { - OCPP16StandardParametersKey, - OCPP16SupportedFeatureProfiles, -} from '../../../types/ocpp/1.6/Configuration'; - +import { ErrorType } from '../../../types/ocpp/ErrorType'; +import Constants from '../../../utils/Constants'; +import { ACElectricUtils, DCElectricUtils } from '../../../utils/ElectricUtils'; +import logger from '../../../utils/Logger'; +import Utils from '../../../utils/Utils'; import type ChargingStation from '../../ChargingStation'; import { ChargingStationUtils } from '../../ChargingStationUtils'; -import Constants from '../../../utils/Constants'; -import { ErrorType } from '../../../types/ocpp/ErrorType'; -import MeasurandValues from '../../../types/MeasurandValues'; -import OCPPError from '../../../exception/OCPPError'; import { OCPPServiceUtils } from '../OCPPServiceUtils'; -import Utils from '../../../utils/Utils'; -import logger from '../../../utils/Logger'; export class OCPP16ServiceUtils extends OCPPServiceUtils { public static checkFeatureProfile( @@ -770,16 +769,16 @@ export class OCPP16ServiceUtils extends OCPPServiceUtils { chargingStation: ChargingStation, measurandType: OCPP16MeterValueMeasurand ): void { - if (Utils.isUndefined(chargingStation.stationInfo.powerDivider)) { + if (Utils.isUndefined(chargingStation.powerDivider)) { const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${ measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER }: powerDivider is undefined`; logger.error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES); - } else if (chargingStation.stationInfo?.powerDivider <= 0) { + } else if (chargingStation?.powerDivider <= 0) { const errMsg = `${chargingStation.logPrefix()} MeterValues measurand ${ measurandType ?? OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER - }: powerDivider have zero or below value ${chargingStation.stationInfo.powerDivider}`; + }: powerDivider have zero or below value ${chargingStation.powerDivider}`; logger.error(errMsg); throw new OCPPError(ErrorType.INTERNAL_ERROR, errMsg, OCPP16RequestCommand.METER_VALUES); }