X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=src%2Fcharging-station%2FAutomaticTransactionGenerator.ts;h=32d9d2e3ec9224dfc0bc2520e8a48c989313dca3;hb=593cf3f9c5d1b68ec8b5a034343a7cd6f0be7f38;hp=ac7b2008e1370dda7e566d973591e8e53fc8f107;hpb=9ac86a7ea04eb1155c2a720b36f6bf33ba336767;p=e-mobility-charging-stations-simulator.git diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index ac7b2008..32d9d2e3 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -1,4 +1,4 @@ -import { AuthorizationStatus, StartTransactionResponse, StopTransactionReason, StopTransactionResponse } from '../types/Transaction'; +import { AuthorizationStatus, StartTransactionResponse, StopTransactionReason, StopTransactionResponse } from '../types/ocpp/1.6/Transaction'; import { PerformanceObserver, performance } from 'perf_hooks'; import ChargingStation from './ChargingStation'; @@ -29,7 +29,7 @@ export default class AutomaticTransactionGenerator { _logPrefix(connectorId: number = null): string { if (connectorId) { - return Utils.logPrefix(' ' + this._chargingStation.stationInfo.name + ' ATG on connector #' + connectorId + ':'); + return Utils.logPrefix(' ' + this._chargingStation.stationInfo.name + ' ATG on connector #' + connectorId.toString() + ':'); } return Utils.logPrefix(' ' + this._chargingStation.stationInfo.name + ' ATG:'); } @@ -54,7 +54,7 @@ export default class AutomaticTransactionGenerator { logger.info(this._logPrefix() + ' ATG OVER => STOPPING ALL TRANSACTIONS'); for (const connector in this._chargingStation.connectors) { if (this._chargingStation.getConnector(Utils.convertToInt(connector)).transactionStarted) { - logger.info(this._logPrefix(Utils.convertToInt(connector)) + ' ATG OVER. Stop transaction ' + this._chargingStation.getConnector(Utils.convertToInt(connector)).transactionId); + logger.info(this._logPrefix(Utils.convertToInt(connector)) + ' ATG OVER. Stop transaction ' + this._chargingStation.getConnector(Utils.convertToInt(connector)).transactionId.toString()); await this._chargingStation.sendStopTransaction(this._chargingStation.getConnector(Utils.convertToInt(connector)).transactionId, reason); } } @@ -91,11 +91,11 @@ export default class AutomaticTransactionGenerator { // Wait until end of transaction const waitTrxEnd = Utils.getRandomInt(this._chargingStation.stationInfo.AutomaticTransactionGenerator.maxDuration, this._chargingStation.stationInfo.AutomaticTransactionGenerator.minDuration) * 1000; - logger.info(this._logPrefix(connectorId) + ' transaction ' + this._chargingStation.getConnector(connectorId).transactionId + ' will stop in ' + Utils.milliSecondsToHHMMSS(waitTrxEnd)); + logger.info(this._logPrefix(connectorId) + ' transaction ' + this._chargingStation.getConnector(connectorId).transactionId.toString() + ' will stop in ' + Utils.milliSecondsToHHMMSS(waitTrxEnd)); await Utils.sleep(waitTrxEnd); // Stop transaction if (this._chargingStation.getConnector(connectorId).transactionStarted) { - logger.info(this._logPrefix(connectorId) + ' stop transaction ' + this._chargingStation.getConnector(connectorId).transactionId); + logger.info(this._logPrefix(connectorId) + ' stop transaction ' + this._chargingStation.getConnector(connectorId).transactionId.toString()); if (this._chargingStation.getEnableStatistics()) { const stopTransaction = performance.timerify(this.stopTransaction); this._performanceObserver.observe({ entryTypes: ['function'] });