export class ChargingStation extends EventEmitter {
public readonly index: number;
public readonly templateFile: string;
- public stationInfo!: ChargingStationInfo;
public started: boolean;
public starting: boolean;
public idTagsCache: IdTagsCache;
public bootNotificationRequest!: BootNotificationRequest;
public bootNotificationResponse!: BootNotificationResponse | undefined;
public powerDivider!: number;
+ private internalStationInfo!: ChargingStationInfo;
private stopping: boolean;
private configurationFile!: string;
private configurationFileHash!: string;
return this.connectors.size === 0 && this.evses.size > 0;
}
+ public get stationInfo(): ChargingStationInfo {
+ return {
+ ...this.internalStationInfo,
+ ...{
+ enableStatistics: false,
+ remoteAuthorization: true,
+ currentOutType: CurrentType.AC,
+ ocppStrictCompliance: true,
+ outOfOrderEndMeterValues: false,
+ beginEndMeterValues: false,
+ meteringPerTransaction: true,
+ transactionDataMeterValues: false,
+ mainVoltageMeterValues: true,
+ phaseLineToLineVoltageMeterValues: false,
+ customValueLimitationMeterValues: true,
+ supervisionUrlOcppConfiguration: false,
+ supervisionUrlOcppKey: VendorParametersKey.ConnectionUrl,
+ ocppVersion: OCPPVersion.VERSION_16,
+ ocppPersistentConfiguration: true,
+ stationInfoPersistentConfiguration: true,
+ automaticTransactionGeneratorPersistentConfiguration: true,
+ autoReconnectMaxRetries: -1,
+ registrationMaxRetries: -1,
+ reconnectExponentialDelay: false,
+ stopTransactionsOnStopped: true,
+ },
+ };
+ }
+
private get wsConnectionUrl(): URL {
return new URL(
`${
- this.getSupervisionUrlOcppConfiguration() &&
- isNotEmptyString(this.getSupervisionUrlOcppKey()) &&
- isNotEmptyString(getConfigurationKey(this, this.getSupervisionUrlOcppKey())?.value)
- ? getConfigurationKey(this, this.getSupervisionUrlOcppKey())!.value
+ this.stationInfo?.supervisionUrlOcppConfiguration &&
+ isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey) &&
+ isNotEmptyString(getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!)?.value)
+ ? getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!)!.value
: this.configuredSupervisionUrl.href
}/${this.stationInfo.chargingStationId}`,
);
return isNotEmptyArray(this.idTagsCache.getIdTags(getIdTagsFile(this.stationInfo)!));
}
- public getEnableStatistics(): boolean {
- return this.stationInfo.enableStatistics ?? false;
- }
-
- public getRemoteAuthorization(): boolean {
- return this.stationInfo.remoteAuthorization ?? true;
- }
-
public getNumberOfPhases(stationInfo?: ChargingStationInfo): number {
const localStationInfo: ChargingStationInfo = stationInfo ?? this.stationInfo;
switch (this.getCurrentOutType(stationInfo)) {
return this.connectors.get(connectorId);
}
- public getCurrentOutType(stationInfo?: ChargingStationInfo): CurrentType {
- return (stationInfo ?? this.stationInfo)?.currentOutType ?? CurrentType.AC;
- }
-
- public getOcppStrictCompliance(): boolean {
- return this.stationInfo?.ocppStrictCompliance ?? true;
- }
-
- public getVoltageOut(stationInfo?: ChargingStationInfo): number {
- const defaultVoltageOut = getDefaultVoltageOut(
- this.getCurrentOutType(stationInfo),
- this.logPrefix(),
- this.templateFile,
- );
- return (stationInfo ?? this.stationInfo).voltageOut ?? defaultVoltageOut;
- }
-
- public getMaximumPower(stationInfo?: ChargingStationInfo): number {
- return (stationInfo ?? this.stationInfo).maximumPower!;
- }
-
public getConnectorMaximumAvailablePower(connectorId: number): number {
let connectorAmperageLimitationPowerLimit: number | undefined;
if (
this.getAmperageLimitation()! < this.stationInfo.maximumAmperage!
) {
connectorAmperageLimitationPowerLimit =
- (this.getCurrentOutType() === CurrentType.AC
+ (this.stationInfo?.currentOutType === CurrentType.AC
? ACElectricUtils.powerTotal(
this.getNumberOfPhases(),
- this.getVoltageOut(),
+ this.stationInfo.voltageOut!,
this.getAmperageLimitation()! *
(this.hasEvses ? this.getNumberOfEvses() : this.getNumberOfConnectors()),
)
- : DCElectricUtils.power(this.getVoltageOut(), this.getAmperageLimitation()!)) /
+ : DCElectricUtils.power(this.stationInfo.voltageOut!, this.getAmperageLimitation()!)) /
this.powerDivider;
}
- const connectorMaximumPower = this.getMaximumPower() / this.powerDivider;
+ const connectorMaximumPower = this.stationInfo.maximumPower! / this.powerDivider;
const connectorChargingProfilesPowerLimit =
getChargingStationConnectorChargingProfilesPowerLimit(this, connectorId);
return min(
return numberOfRunningTransactions;
}
- public getOutOfOrderEndMeterValues(): boolean {
- return this.stationInfo?.outOfOrderEndMeterValues ?? false;
- }
-
- public getBeginEndMeterValues(): boolean {
- return this.stationInfo?.beginEndMeterValues ?? false;
- }
-
- public getMeteringPerTransaction(): boolean {
- return this.stationInfo?.meteringPerTransaction ?? true;
- }
-
- public getTransactionDataMeterValues(): boolean {
- return this.stationInfo?.transactionDataMeterValues ?? false;
- }
-
- public getMainVoltageMeterValues(): boolean {
- return this.stationInfo?.mainVoltageMeterValues ?? true;
- }
-
- public getPhaseLineToLineVoltageMeterValues(): boolean {
- return this.stationInfo?.phaseLineToLineVoltageMeterValues ?? false;
- }
-
- public getCustomValueLimitationMeterValues(): boolean {
- return this.stationInfo?.customValueLimitationMeterValues ?? true;
- }
-
public getConnectorIdByTransactionId(transactionId: number): number | undefined {
if (this.hasEvses) {
for (const evseStatus of this.evses.values()) {
public setSupervisionUrl(url: string): void {
if (
- this.getSupervisionUrlOcppConfiguration() &&
- isNotEmptyString(this.getSupervisionUrlOcppKey())
+ this.stationInfo?.supervisionUrlOcppConfiguration &&
+ isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey)
) {
- setConfigurationKeyValue(this, this.getSupervisionUrlOcppKey(), url);
+ setConfigurationKeyValue(this, this.stationInfo.supervisionUrlOcppKey!, url);
} else {
this.stationInfo.supervisionUrls = url;
this.saveStationInfo();
if (this.started === false) {
if (this.starting === false) {
this.starting = true;
- if (this.getEnableStatistics() === true) {
+ if (this.stationInfo?.enableStatistics === true) {
this.performanceStatistics?.start();
}
if (hasFeatureProfile(this, SupportedFeatureProfiles.Reservation)) {
if (this.getAutomaticTransactionGeneratorConfiguration().enable === true) {
this.startAutomaticTransactionGenerator();
}
- if (this.getEnableStatistics() === true) {
+ if (this.stationInfo?.enableStatistics === true) {
this.performanceStatistics?.restart();
} else {
this.performanceStatistics?.stop();
this.stopping = true;
await this.stopMessageSequence(reason, stopTransactions);
this.closeWSConnection();
- if (this.getEnableStatistics() === true) {
+ if (this.stationInfo?.enableStatistics === true) {
this.performanceStatistics?.stop();
}
if (hasFeatureProfile(this, SupportedFeatureProfiles.Reservation)) {
}
public saveOcppConfiguration(): void {
- if (this.getOcppPersistentConfiguration()) {
+ if (this.stationInfo?.ocppPersistentConfiguration === true) {
this.saveConfiguration();
}
}
this.wsConnection = new WebSocket(
this.wsConnectionUrl,
- `ocpp${this.stationInfo.ocppVersion ?? OCPPVersion.VERSION_16}`,
+ `ocpp${this.stationInfo.ocppVersion}`,
options,
);
const stationTemplate = this.getTemplateFromFile();
const stationConfiguration = this.getConfigurationFromFile();
if (
- this.getAutomaticTransactionGeneratorPersistentConfiguration() &&
+ this.stationInfo?.automaticTransactionGeneratorPersistentConfiguration === true &&
stationConfiguration?.stationInfo?.templateHash === stationTemplate?.templateHash &&
stationConfiguration?.automaticTransactionGenerator
) {
): Promise<StopTransactionResponse> {
const transactionId = this.getConnectorStatus(connectorId)?.transactionId;
if (
- this.getBeginEndMeterValues() === true &&
- this.getOcppStrictCompliance() === true &&
- this.getOutOfOrderEndMeterValues() === false
+ this.stationInfo?.beginEndMeterValues === true &&
+ this.stationInfo?.ocppStrictCompliance === true &&
+ this.stationInfo?.outOfOrderEndMeterValues === false
) {
// FIXME: Implement OCPP version agnostic helpers
const transactionEndMeterValue = OCPP16ServiceUtils.buildTransactionEndMeterValue(
}
}
- private getSupervisionUrlOcppConfiguration(): boolean {
- return this.stationInfo.supervisionUrlOcppConfiguration ?? false;
- }
-
- private getSupervisionUrlOcppKey(): string {
- return this.stationInfo.supervisionUrlOcppKey ?? VendorParametersKey.ConnectionUrl;
- }
-
private getTemplateFromFile(): ChargingStationTemplate | undefined {
let template: ChargingStationTemplate | undefined;
try {
private getStationInfoFromFile(): ChargingStationInfo | undefined {
let stationInfo: ChargingStationInfo | undefined;
- if (this.getStationInfoPersistentConfiguration()) {
+ if (this.stationInfo?.stationInfoPersistentConfiguration === true) {
stationInfo = this.getConfigurationFromFile()?.stationInfo;
if (stationInfo) {
delete stationInfo?.infoHash;
}
private saveStationInfo(): void {
- if (this.getStationInfoPersistentConfiguration()) {
+ if (this.stationInfo?.stationInfoPersistentConfiguration === true) {
this.saveConfiguration();
}
}
- private getOcppPersistentConfiguration(): boolean {
- return this.stationInfo?.ocppPersistentConfiguration ?? true;
- }
-
- private getStationInfoPersistentConfiguration(): boolean {
- return this.stationInfo?.stationInfoPersistentConfiguration ?? true;
- }
-
- private getAutomaticTransactionGeneratorPersistentConfiguration(): boolean {
- return this.stationInfo?.automaticTransactionGeneratorPersistentConfiguration ?? true;
- }
-
private handleUnsupportedVersion(version: OCPPVersion) {
const errorMsg = `Unsupported protocol version '${version}' configured in template file ${this.templateFile}`;
logger.error(`${this.logPrefix()} ${errorMsg}`);
} else {
this.initializeConnectorsOrEvsesFromTemplate(stationTemplate);
}
- this.stationInfo = this.getStationInfo();
+ this.internalStationInfo = this.getStationInfo();
if (
this.stationInfo.firmwareStatus === FirmwareStatus.Installing &&
isNotEmptyString(this.stationInfo.firmwareVersion) &&
}
this.saveStationInfo();
this.configuredSupervisionUrl = this.getConfiguredSupervisionUrl();
- if (this.getEnableStatistics() === true) {
+ if (this.stationInfo?.enableStatistics === true) {
this.performanceStatistics = PerformanceStatistics.getInstance(
this.stationInfo.hashId,
this.stationInfo.chargingStationId!,
}
private initializeOcppServices(): void {
- const ocppVersion = this.stationInfo.ocppVersion ?? OCPPVersion.VERSION_16;
+ const ocppVersion = this.stationInfo.ocppVersion;
switch (ocppVersion) {
case OCPPVersion.VERSION_16:
this.ocppIncomingRequestService =
addConfigurationKey(this, StandardParametersKey.HeartBeatInterval, '0', { visible: false });
}
if (
- this.getSupervisionUrlOcppConfiguration() &&
- isNotEmptyString(this.getSupervisionUrlOcppKey()) &&
- !getConfigurationKey(this, this.getSupervisionUrlOcppKey())
+ this.stationInfo?.supervisionUrlOcppConfiguration &&
+ isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey) &&
+ !getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!)
) {
addConfigurationKey(
this,
- this.getSupervisionUrlOcppKey(),
+ this.stationInfo.supervisionUrlOcppKey!,
this.configuredSupervisionUrl.href,
{ reboot: true },
);
} else if (
- !this.getSupervisionUrlOcppConfiguration() &&
- isNotEmptyString(this.getSupervisionUrlOcppKey()) &&
- getConfigurationKey(this, this.getSupervisionUrlOcppKey())
+ !this.stationInfo?.supervisionUrlOcppConfiguration &&
+ isNotEmptyString(this.stationInfo?.supervisionUrlOcppKey) &&
+ getConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!)
) {
- deleteConfigurationKey(this, this.getSupervisionUrlOcppKey(), { save: false });
+ deleteConfigurationKey(this, this.stationInfo.supervisionUrlOcppKey!, { save: false });
}
if (
isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
}
private saveAutomaticTransactionGeneratorConfiguration(): void {
- if (this.getAutomaticTransactionGeneratorPersistentConfiguration()) {
+ if (this.stationInfo?.automaticTransactionGeneratorPersistentConfiguration === true) {
this.saveConfiguration();
}
}
let configurationData: ChargingStationConfiguration = this.getConfigurationFromFile()
? cloneObject<ChargingStationConfiguration>(this.getConfigurationFromFile()!)
: {};
- if (this.getStationInfoPersistentConfiguration() && this.stationInfo) {
+ if (this.stationInfo?.stationInfoPersistentConfiguration === true && this.stationInfo) {
configurationData.stationInfo = this.stationInfo;
} else {
delete configurationData.stationInfo;
}
- if (this.getOcppPersistentConfiguration() && this.ocppConfiguration?.configurationKey) {
+ if (
+ this.stationInfo?.ocppPersistentConfiguration === true &&
+ this.ocppConfiguration?.configurationKey
+ ) {
configurationData.configurationKey = this.ocppConfiguration.configurationKey;
} else {
delete configurationData.configurationKey;
buildChargingStationAutomaticTransactionGeneratorConfiguration(this),
);
if (
- !this.getAutomaticTransactionGeneratorPersistentConfiguration() ||
+ !this.stationInfo?.automaticTransactionGeneratorPersistentConfiguration ||
!this.getAutomaticTransactionGeneratorConfiguration()
) {
delete configurationData.automaticTransactionGenerator;
private getOcppConfigurationFromFile(): ChargingStationOcppConfiguration | undefined {
const configurationKey = this.getConfigurationFromFile()?.configurationKey;
- if (this.getOcppPersistentConfiguration() === true && configurationKey) {
+ if (this.stationInfo?.ocppPersistentConfiguration === true && configurationKey) {
return { configurationKey };
}
return undefined;
skipBufferingOnError: true,
});
if (this.isRegistered() === false) {
- this.getRegistrationMaxRetries() !== -1 && ++registrationRetryCount;
+ this.stationInfo?.registrationMaxRetries !== -1 && ++registrationRetryCount;
await sleep(
this?.bootNotificationResponse?.interval
? secondsToMilliseconds(this.bootNotificationResponse.interval)
}
} while (
this.isRegistered() === false &&
- (registrationRetryCount <= this.getRegistrationMaxRetries()! ||
- this.getRegistrationMaxRetries() === -1)
+ (registrationRetryCount <= this.stationInfo.registrationMaxRetries! ||
+ this.stationInfo?.registrationMaxRetries) === -1
);
}
if (this.isRegistered() === true) {
}
} else {
logger.error(
- `${this.logPrefix()} Registration failure: max retries reached (${this.getRegistrationMaxRetries()}) or retry disabled (${this.getRegistrationMaxRetries()})`,
+ `${this.logPrefix()} Registration failure: max retries reached or retry disabled (${this
+ .stationInfo?.registrationMaxRetries})`,
);
}
this.wsConnectionRestarted = false;
private async handleIncomingMessage(request: IncomingRequest): Promise<void> {
const [messageType, messageId, commandName, commandPayload] = request;
- if (this.getEnableStatistics() === true) {
+ if (this.stationInfo.enableStatistics === true) {
this.performanceStatistics?.addRequestStatistic(commandName, messageType);
}
logger.debug(
}
private getEnergyActiveImportRegister(connectorStatus: ConnectorStatus, rounded = false): number {
- if (this.getMeteringPerTransaction() === true) {
+ if (this.stationInfo?.meteringPerTransaction === true) {
return (
(rounded === true
? Math.round(connectorStatus.transactionEnergyActiveImportRegisterValue!)
return Constants.DEFAULT_CONNECTION_TIMEOUT;
}
- // -1 for unlimited, 0 for disabling
- private getAutoReconnectMaxRetries(): number | undefined {
- return this.stationInfo.autoReconnectMaxRetries ?? -1;
- }
-
- // -1 for unlimited, 0 for disabling
- private getRegistrationMaxRetries(): number | undefined {
- return this.stationInfo.registrationMaxRetries ?? -1;
- }
-
private getPowerDivider(): number {
let powerDivider = this.hasEvses ? this.getNumberOfEvses() : this.getNumberOfConnectors();
if (this.stationInfo?.powerSharedByConnectors) {
}
}
+ private getMaximumPower(stationInfo?: ChargingStationInfo): number {
+ return (stationInfo ?? this.stationInfo).maximumPower!;
+ }
+
+ private getCurrentOutType(stationInfo?: ChargingStationInfo): CurrentType {
+ return (stationInfo ?? this.stationInfo).currentOutType!;
+ }
+
+ private getVoltageOut(stationInfo?: ChargingStationInfo): number {
+ const defaultVoltageOut = getDefaultVoltageOut(
+ this.getCurrentOutType(stationInfo),
+ this.logPrefix(),
+ this.templateFile,
+ );
+ return (stationInfo ?? this.stationInfo).voltageOut ?? defaultVoltageOut;
+ }
+
private getAmperageLimitation(): number | undefined {
if (
isNotEmptyString(this.stationInfo?.amperageLimitationOcppKey) &&
private async stopMessageSequence(
reason?: StopTransactionReason,
- stopTransactions = this.stationInfo?.stopTransactionsOnStopped ?? true,
+ stopTransactions = this.stationInfo?.stopTransactionsOnStopped,
): Promise<void> {
// Stop WebSocket ping
this.stopWebSocketPing();
}
}
- private getReconnectExponentialDelay(): boolean {
- return this.stationInfo?.reconnectExponentialDelay ?? false;
- }
-
private async reconnect(): Promise<void> {
// Stop WebSocket ping
this.stopWebSocketPing();
this.stopAutomaticTransactionGenerator();
}
if (
- this.autoReconnectRetryCount < this.getAutoReconnectMaxRetries()! ||
- this.getAutoReconnectMaxRetries() === -1
+ this.autoReconnectRetryCount < this.stationInfo.autoReconnectMaxRetries! ||
+ this.stationInfo?.autoReconnectMaxRetries === -1
) {
++this.autoReconnectRetryCount;
- const reconnectDelay = this.getReconnectExponentialDelay()
- ? exponentialDelay(this.autoReconnectRetryCount)
- : secondsToMilliseconds(this.getConnectionTimeout());
+ const reconnectDelay =
+ this.stationInfo?.reconnectExponentialDelay === true
+ ? exponentialDelay(this.autoReconnectRetryCount)
+ : secondsToMilliseconds(this.getConnectionTimeout());
const reconnectDelayWithdraw = 1000;
const reconnectTimeout =
reconnectDelay && reconnectDelay - reconnectDelayWithdraw > 0
{ closeOpened: true },
);
this.wsConnectionRestarted = true;
- } else if (this.getAutoReconnectMaxRetries() !== -1) {
+ } else if (this.stationInfo?.autoReconnectMaxRetries !== -1) {
logger.error(
`${this.logPrefix()} WebSocket connection retries failure: maximum retries reached (${
this.autoReconnectRetryCount
- }) or retries disabled (${this.getAutoReconnectMaxRetries()})`,
+ }) or retries disabled (${this.stationInfo?.autoReconnectMaxRetries})`,
);
}
}
if (voltageSampledValueTemplate) {
const voltageSampledValueTemplateValue = voltageSampledValueTemplate.value
? parseInt(voltageSampledValueTemplate.value)
- : chargingStation.getVoltageOut();
+ : chargingStation.stationInfo.voltageOut!;
const fluctuationPercent =
voltageSampledValueTemplate.fluctuationPercent ?? Constants.DEFAULT_FLUCTUATION_PERCENT;
const voltageMeasurandValue = getRandomFloatFluctuatedRounded(
);
if (
chargingStation.getNumberOfPhases() !== 3 ||
- (chargingStation.getNumberOfPhases() === 3 && chargingStation.getMainVoltageMeterValues())
+ (chargingStation.getNumberOfPhases() === 3 &&
+ chargingStation.stationInfo?.mainVoltageMeterValues)
) {
meterValue.sampledValue.push(
OCPP16ServiceUtils.buildSampledValue(voltageSampledValueTemplate, voltageMeasurandValue),
const voltagePhaseLineToNeutralSampledValueTemplateValue =
voltagePhaseLineToNeutralSampledValueTemplate.value
? parseInt(voltagePhaseLineToNeutralSampledValueTemplate.value)
- : chargingStation.getVoltageOut();
+ : chargingStation.stationInfo.voltageOut!;
const fluctuationPhaseToNeutralPercent =
voltagePhaseLineToNeutralSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT;
phaseLineToNeutralValue as OCPP16MeterValuePhase,
),
);
- if (chargingStation.getPhaseLineToLineVoltageMeterValues()) {
+ if (chargingStation.stationInfo?.phaseLineToLineVoltageMeterValues) {
const phaseLineToLineValue = `L${phase}-L${
(phase + 1) % chargingStation.getNumberOfPhases() !== 0
? (phase + 1) % chargingStation.getNumberOfPhases()
const errMsg = `MeterValues measurand ${
powerSampledValueTemplate.measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: Unknown ${chargingStation.getCurrentOutType()} currentOutType in template file ${
+ }: Unknown ${chargingStation.stationInfo?.currentOutType} currentOutType in template file ${
chargingStation.templateFile
}, cannot calculate ${
powerSampledValueTemplate.measurand ??
const connectorMinimumPowerPerPhase = Math.round(
connectorMinimumPower / chargingStation.getNumberOfPhases(),
);
- switch (chargingStation.getCurrentOutType()) {
+ switch (chargingStation.stationInfo?.currentOutType) {
case CurrentType.AC:
if (chargingStation.getNumberOfPhases() === 3) {
const defaultFluctuatedPowerPerPhase =
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerSampledValueTemplate.value,
connectorMaximumPower / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
) / chargingStation.getNumberOfPhases(),
powerSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerPerPhaseSampledValueTemplates.L1.value,
connectorMaximumPowerPerPhase / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
powerPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerPerPhaseSampledValueTemplates.L2.value,
connectorMaximumPowerPerPhase / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
powerPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerPerPhaseSampledValueTemplates.L3.value,
connectorMaximumPowerPerPhase / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
powerPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerSampledValueTemplate.value,
connectorMaximumPower / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
powerSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
powerSampledValueTemplate.value,
connectorMaximumPower / unitDivider,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
powerSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
const errMsg = `MeterValues measurand ${
currentSampledValueTemplate.measurand ??
OCPP16MeterValueMeasurand.ENERGY_ACTIVE_IMPORT_REGISTER
- }: Unknown ${chargingStation.getCurrentOutType()} currentOutType in template file ${
+ }: Unknown ${chargingStation.stationInfo?.currentOutType} currentOutType in template file ${
chargingStation.templateFile
}, cannot calculate ${
currentSampledValueTemplate.measurand ??
chargingStation.getConnectorMaximumAvailablePower(connectorId);
const connectorMinimumAmperage = currentSampledValueTemplate.minimumValue ?? 0;
let connectorMaximumAmperage: number;
- switch (chargingStation.getCurrentOutType()) {
+ switch (chargingStation.stationInfo?.currentOutType) {
case CurrentType.AC:
connectorMaximumAmperage = ACElectricUtils.amperagePerPhaseFromPower(
chargingStation.getNumberOfPhases(),
connectorMaximumAvailablePower,
- chargingStation.getVoltageOut(),
+ chargingStation.stationInfo.voltageOut!,
);
if (chargingStation.getNumberOfPhases() === 3) {
const defaultFluctuatedAmperagePerPhase =
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentSampledValueTemplate.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentPerPhaseSampledValueTemplates.L1.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentPerPhaseSampledValueTemplates.L1.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentPerPhaseSampledValueTemplates.L2.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentPerPhaseSampledValueTemplates.L2.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentPerPhaseSampledValueTemplates.L3.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentPerPhaseSampledValueTemplates.L3.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentSampledValueTemplate.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
case CurrentType.DC:
connectorMaximumAmperage = DCElectricUtils.amperage(
connectorMaximumAvailablePower,
- chargingStation.getVoltageOut(),
+ chargingStation.stationInfo.voltageOut!,
);
currentMeasurandValues.allPhases = currentSampledValueTemplate.value
? getRandomFloatFluctuatedRounded(
OCPP16ServiceUtils.getLimitFromSampledValueTemplateCustomValue(
currentSampledValueTemplate.value,
connectorMaximumAmperage,
- { limitationEnabled: chargingStation.getCustomValueLimitationMeterValues() },
+ {
+ limitationEnabled:
+ chargingStation.stationInfo?.customValueLimitationMeterValues,
+ },
),
currentSampledValueTemplate.fluctuationPercent ??
Constants.DEFAULT_FLUCTUATION_PERCENT,
energySampledValueTemplate.value,
connectorMaximumEnergyRounded,
{
- limitationEnabled: chargingStation.getCustomValueLimitationMeterValues(),
+ limitationEnabled: chargingStation.stationInfo?.customValueLimitationMeterValues,
unitMultiplier: unitDivider,
},
),