X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=f646a32c092240f3b3d84df64b6bce709819795b;hb=c045d9a97ebdf3747b82746b733b0c60a7db3f32;hp=b3a2e62239303fb6e5af5868570d6de74c8e8795;hpb=ad2f27c30a5a29e0ce3a6e2be5a3385061ada313;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index b3a2e622..f646a32c 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -74,9 +74,7 @@ export default class ChargingStation { // In case of multiple instances: add instance index to charging station id let instanceIndex = process.env.CF_INSTANCE_INDEX ? process.env.CF_INSTANCE_INDEX : 0; instanceIndex = instanceIndex > 0 ? instanceIndex : ''; - const idSuffix = stationTemplate.nameSuffix ? stationTemplate.nameSuffix : ''; - return stationTemplate.fixedName ? stationTemplate.baseName : stationTemplate.baseName + '-' + instanceIndex.toString() + ('000000000' + this.index.toString()).substr(('000000000' + this.index.toString()).length - 4) + idSuffix; } @@ -141,6 +139,9 @@ export default class ChargingStation { if (Utils.convertToInt(lastConnector) === 0 && this._getUseConnectorId0() && this.stationInfo.Connectors[lastConnector]) { this.connectors[lastConnector] = Utils.cloneObject(this.stationInfo.Connectors[lastConnector]); this.connectors[lastConnector].availability = AvailabilityType.OPERATIVE; + if (Utils.isUndefined(this.connectors[lastConnector]?.chargingProfiles)) { + this.connectors[lastConnector].chargingProfiles = []; + } } } // Generate all connectors @@ -149,6 +150,9 @@ export default class ChargingStation { const randConnectorID = this.stationInfo.randomConnectors ? Utils.getRandomInt(Utils.convertToInt(lastConnector), 1) : index; this.connectors[index] = Utils.cloneObject(this.stationInfo.Connectors[randConnectorID]); this.connectors[index].availability = AvailabilityType.OPERATIVE; + if (Utils.isUndefined(this.connectors[lastConnector]?.chargingProfiles)) { + this.connectors[index].chargingProfiles = []; + } } } } @@ -167,8 +171,7 @@ export default class ChargingStation { } this.stationInfo.powerDivider = this._getPowerDivider(); if (this.getEnableStatistics()) { - this.statistics = Statistics.getInstance(); - this.statistics.objName = this.stationInfo.chargingStationId; + this.statistics = new Statistics(this.stationInfo.chargingStationId); this.performanceObserver = new PerformanceObserver((list) => { const entry = list.getEntries()[0]; this.statistics.logPerformance(entry, Constants.ENTITY_CHARGING_STATION); @@ -1057,6 +1060,10 @@ export default class ChargingStation { logger.debug(this._logPrefix() + ' Heartbeat response received: %j to Heartbeat request: %j', payload, requestPayload); } + handleResponseAuthorize(payload: AuthorizeResponse, requestPayload: AuthorizeRequest): void { + logger.debug(this._logPrefix() + ' Authorize response received: %j to Authorize request: %j', payload, requestPayload); + } + async handleRequest(messageId: string, commandName: IncomingRequestCommand, commandPayload: Record): Promise { let response; // Call