X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FChargingStation.ts;h=f94efde394bf2bd18e710e07a431a4ae141fceb1;hb=36a16ec2649a0652c443f4ef519e0d0f31b67fa4;hp=8341fe30a71612a1b52ff5da90ca5245dde53d09;hpb=902250529d3aab51cfdb21ba467fc082caf0c765;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index 8341fe30..f94efde3 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -70,7 +70,7 @@ export default class ChargingStation { this._authorizedTags = this._loadAndGetAuthorizedTags(); } - _getStationName(stationTemplate: ChargingStationTemplate): string { + _getChargingStationId(stationTemplate: ChargingStationTemplate): string { // 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 : ''; @@ -98,7 +98,7 @@ export default class ChargingStation { } else { stationInfo.maxPower = stationTemplateFromFile.power as number; } - stationInfo.name = this._getStationName(stationTemplateFromFile); + stationInfo.chargingStationId = this._getChargingStationId(stationTemplateFromFile); stationInfo.resetTime = stationTemplateFromFile.resetTime ? stationTemplateFromFile.resetTime * 1000 : Constants.CHARGING_STATION_DEFAULT_RESET_TIME; return stationInfo; } @@ -117,7 +117,7 @@ export default class ChargingStation { }; this._configuration = this._getTemplateChargingStationConfiguration(); this._supervisionUrl = this._getSupervisionURL(); - this._wsConnectionUrl = this._supervisionUrl + '/' + this._stationInfo.name; + this._wsConnectionUrl = this._supervisionUrl + '/' + this._stationInfo.chargingStationId; // Build connectors if needed const maxConnectors = this._getMaxNumberOfConnectors(); if (maxConnectors <= 0) { @@ -172,7 +172,7 @@ export default class ChargingStation { this._stationInfo.powerDivider = this._getPowerDivider(); if (this.getEnableStatistics()) { this._statistics = Statistics.getInstance(); - this._statistics.objName = this._stationInfo.name; + this._statistics.objName = this._stationInfo.chargingStationId; this._performanceObserver = new PerformanceObserver((list) => { const entry = list.getEntries()[0]; this._statistics.logPerformance(entry, Constants.ENTITY_CHARGING_STATION); @@ -190,7 +190,7 @@ export default class ChargingStation { } _logPrefix(): string { - return Utils.logPrefix(` ${this._stationInfo.name}:`); + return Utils.logPrefix(` ${this._stationInfo.chargingStationId}:`); } _isWebSocketOpen(): boolean { @@ -1015,7 +1015,7 @@ export default class ChargingStation { this.getConnector(connectorId).idTag = requestPayload.idTag; this.getConnector(connectorId).lastEnergyActiveImportRegisterValue = 0; await this.sendStatusNotification(connectorId, ChargePointStatus.CHARGING); - logger.info(this._logPrefix() + ' Transaction ' + payload.transactionId.toString() + ' STARTED on ' + this._stationInfo.name + '#' + connectorId.toString() + ' for idTag ' + requestPayload.idTag); + logger.info(this._logPrefix() + ' Transaction ' + payload.transactionId.toString() + ' STARTED on ' + this._stationInfo.chargingStationId + '#' + connectorId.toString() + ' for idTag ' + requestPayload.idTag); if (this._stationInfo.powerSharedByConnectors) { this._stationInfo.powerDivider++; } @@ -1050,7 +1050,7 @@ export default class ChargingStation { if (this._stationInfo.powerSharedByConnectors) { this._stationInfo.powerDivider--; } - logger.info(this._logPrefix() + ' Transaction ' + requestPayload.transactionId.toString() + ' STOPPED on ' + this._stationInfo.name + '#' + transactionConnectorId.toString()); + logger.info(this._logPrefix() + ' Transaction ' + requestPayload.transactionId.toString() + ' STOPPED on ' + this._stationInfo.chargingStationId + '#' + transactionConnectorId.toString()); this._resetTransactionOnConnector(transactionConnectorId); } else { logger.error(this._logPrefix() + ' Stopping transaction id ' + requestPayload.transactionId.toString() + ' REJECTED with status ' + payload.idTagInfo?.status); @@ -1301,7 +1301,7 @@ export default class ChargingStation { await this.sendStatusNotification(transactionConnectorID, ChargePointStatus.PREPARING); // Authorization successful start transaction await this.sendStartTransaction(transactionConnectorID, commandPayload.idTag); - logger.debug(this._logPrefix() + ' Transaction remotely STARTED on ' + this._stationInfo.name + '#' + transactionConnectorID.toString() + ' for idTag ' + commandPayload.idTag); + logger.debug(this._logPrefix() + ' Transaction remotely STARTED on ' + this._stationInfo.chargingStationId + '#' + transactionConnectorID.toString() + ' for idTag ' + commandPayload.idTag); return Constants.OCPP_RESPONSE_ACCEPTED; } logger.error(this._logPrefix() + ' Remote starting transaction REJECTED on connector Id ' + transactionConnectorID.toString() + ', idTag ' + commandPayload.idTag); @@ -1310,7 +1310,7 @@ export default class ChargingStation { await this.sendStatusNotification(transactionConnectorID, ChargePointStatus.PREPARING); // No local authorization check required => start transaction await this.sendStartTransaction(transactionConnectorID, commandPayload.idTag); - logger.debug(this._logPrefix() + ' Transaction remotely STARTED on ' + this._stationInfo.name + '#' + transactionConnectorID.toString() + ' for idTag ' + commandPayload.idTag); + logger.debug(this._logPrefix() + ' Transaction remotely STARTED on ' + this._stationInfo.chargingStationId + '#' + transactionConnectorID.toString() + ' for idTag ' + commandPayload.idTag); return Constants.OCPP_RESPONSE_ACCEPTED; } logger.error(this._logPrefix() + ' Remote starting transaction REJECTED on unavailable connector Id ' + transactionConnectorID.toString() + ', idTag ' + commandPayload.idTag);