From 5fdab605ce885d9a9fb21ac47c6d0766bd3673bb Mon Sep 17 00:00:00 2001 From: =?utf8?q?J=C3=A9r=C3=B4me=20Benoit?= Date: Thu, 21 Jan 2021 11:35:03 +0100 Subject: [PATCH] Cleanups. MIME-Version: 1.0 Content-Type: text/plain; charset=utf8 Content-Transfer-Encoding: 8bit Signed-off-by: Jérôme Benoit --- .gitignore | 2 +- package-lock.json | 6 +++--- package.json | 2 +- src/assets/config-template.json | 1 - .../abb-atg.station-template.json | 4 +++- .../abb.station-template.json | 3 ++- .../evlink.station-template.json | 3 ++- .../keba.station-template.json | 3 ++- .../schneider-imredd.station-template.json | 3 ++- .../schneider.station-template.json | 3 ++- .../siemens.station-template.json | 3 ++- .../virtual-simple-atg.station-template.json | 3 ++- .../virtual-simple.station-template.json | 3 ++- .../virtual.station-template.json | 3 ++- .../AutomaticTransactionGenerator.ts | 18 ++++++++++------- src/charging-station/ChargingStation.ts | 16 +++++++-------- src/charging-station/StationWorker.ts | 10 +++++----- src/charging-station/Worker.ts | 14 ++++++------- src/scripts/deleteChargingStations.ts | 12 +++++------ src/scripts/scriptConfig-template.json | 4 +++- src/scripts/setCSPublicFlag.ts | 14 ++++++------- src/start.ts | 20 +++++++++---------- src/types/ChargingStationTemplate.ts | 4 +++- src/types/ConfigurationData.ts | 3 +-- src/utils/Configuration.ts | 4 ---- src/utils/Constants.ts | 7 +++++-- 26 files changed, 91 insertions(+), 77 deletions(-) diff --git a/.gitignore b/.gitignore index 3a622e5d..ca88d032 100644 --- a/.gitignore +++ b/.gitignore @@ -1,5 +1,6 @@ # config src/assets/config.json +src/scripts/scriptConfig.json manifest.yml # Logs @@ -86,4 +87,3 @@ Thumbs.db # MTA *.mta mta_archives/ -src/scripts/scriptConfig.json diff --git a/package-lock.json b/package-lock.json index c5dd1f86..6d0fc1e5 100644 --- a/package-lock.json +++ b/package-lock.json @@ -665,9 +665,9 @@ "dev": true }, "@types/node": { - "version": "14.14.21", - "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.21.tgz", - "integrity": "sha512-cHYfKsnwllYhjOzuC5q1VpguABBeecUp24yFluHpn/BQaVxB1CuQ1FSRZCzrPxrkIfWISXV2LbeoBthLWg0+0A==", + "version": "14.14.22", + "resolved": "https://registry.npmjs.org/@types/node/-/node-14.14.22.tgz", + "integrity": "sha512-g+f/qj/cNcqKkc3tFqlXOYjrmZA+jNBiDzbP3kH+B+otKFqAdPgVTGP1IeKRdMml/aE69as5S4FqtxAbl+LaMw==", "dev": true }, "@types/offscreencanvas": { diff --git a/package.json b/package.json index 11c18cff..8a4d7a29 100644 --- a/package.json +++ b/package.json @@ -60,7 +60,7 @@ "utf-8-validate": "^5.0.4" }, "devDependencies": { - "@types/node": "^14.14.21", + "@types/node": "^14.14.22", "@types/uuid": "^8.3.0", "@types/worker-threads-pool": "^2.0.0", "@types/ws": "^7.4.0", diff --git a/src/assets/config-template.json b/src/assets/config-template.json index 61067bcf..bfa96ecc 100644 --- a/src/assets/config-template.json +++ b/src/assets/config-template.json @@ -7,7 +7,6 @@ "useWorkerPool": false, "workerPoolSize": 16, "chargingStationsPerWorker": 1, - "chargingStationIdSuffix": "", "stationTemplateURLs": [ { "file": "./src/assets/station-templates/siemens.station-template.json", diff --git a/src/assets/station-templates/abb-atg.station-template.json b/src/assets/station-templates/abb-atg.station-template.json index acb62382..935509af 100644 --- a/src/assets/station-templates/abb-atg.station-template.json +++ b/src/assets/station-templates/abb-atg.station-template.json @@ -1,6 +1,7 @@ { "authorizationFile": "./src/assets/authorization-tags.json", "baseName": "CS-ABB", + "nameSuffix": "Roaming", "chargePointModel": "MD_TERRA_53", "chargePointVendor": "ABB", "firmwareVersion": "4.0.4.22", @@ -62,7 +63,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/abb.station-template.json b/src/assets/station-templates/abb.station-template.json index 510045e7..ce2025c9 100644 --- a/src/assets/station-templates/abb.station-template.json +++ b/src/assets/station-templates/abb.station-template.json @@ -62,7 +62,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": true + "stopOnConnectionFailure": true, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/evlink.station-template.json b/src/assets/station-templates/evlink.station-template.json index 4ced1375..aebc3d05 100644 --- a/src/assets/station-templates/evlink.station-template.json +++ b/src/assets/station-templates/evlink.station-template.json @@ -48,7 +48,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/keba.station-template.json b/src/assets/station-templates/keba.station-template.json index 4c8ef7eb..b1337fc7 100644 --- a/src/assets/station-templates/keba.station-template.json +++ b/src/assets/station-templates/keba.station-template.json @@ -45,7 +45,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/schneider-imredd.station-template.json b/src/assets/station-templates/schneider-imredd.station-template.json index 0e333065..e82998e1 100644 --- a/src/assets/station-templates/schneider-imredd.station-template.json +++ b/src/assets/station-templates/schneider-imredd.station-template.json @@ -47,7 +47,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/schneider.station-template.json b/src/assets/station-templates/schneider.station-template.json index 26f36319..1502c595 100644 --- a/src/assets/station-templates/schneider.station-template.json +++ b/src/assets/station-templates/schneider.station-template.json @@ -52,7 +52,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/siemens.station-template.json b/src/assets/station-templates/siemens.station-template.json index 0c6cdc34..0f48b404 100644 --- a/src/assets/station-templates/siemens.station-template.json +++ b/src/assets/station-templates/siemens.station-template.json @@ -46,7 +46,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual-simple-atg.station-template.json b/src/assets/station-templates/virtual-simple-atg.station-template.json index ae81e876..6b9df513 100644 --- a/src/assets/station-templates/virtual-simple-atg.station-template.json +++ b/src/assets/station-templates/virtual-simple-atg.station-template.json @@ -46,7 +46,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual-simple.station-template.json b/src/assets/station-templates/virtual-simple.station-template.json index d2ff814a..63e4c143 100644 --- a/src/assets/station-templates/virtual-simple.station-template.json +++ b/src/assets/station-templates/virtual-simple.station-template.json @@ -46,7 +46,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/assets/station-templates/virtual.station-template.json b/src/assets/station-templates/virtual.station-template.json index b4c01921..a28fccf5 100644 --- a/src/assets/station-templates/virtual.station-template.json +++ b/src/assets/station-templates/virtual.station-template.json @@ -46,7 +46,8 @@ "maxDelayBetweenTwoTransactions": 30, "probabilityOfStart": 1, "stopAfterHours": 0.3, - "stopOnConnectionFailure": false + "stopOnConnectionFailure": false, + "requireAuthorize": false }, "Connectors": { "0": {}, diff --git a/src/charging-station/AutomaticTransactionGenerator.ts b/src/charging-station/AutomaticTransactionGenerator.ts index 363605be..d6a825ed 100644 --- a/src/charging-station/AutomaticTransactionGenerator.ts +++ b/src/charging-station/AutomaticTransactionGenerator.ts @@ -130,15 +130,19 @@ export default class AutomaticTransactionGenerator { private async startTransaction(connectorId: number, self: AutomaticTransactionGenerator): Promise { if (self._chargingStation.hasAuthorizedTags()) { const tagId = self._chargingStation.getRandomTagId(); - logger.info(self._logPrefix(connectorId) + ' start transaction for tagID ' + tagId); - // Authorize tagId - const authorizeResponse = await self._chargingStation.sendAuthorize(tagId); - if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { - // Start transaction - return await self._chargingStation.sendStartTransaction(connectorId, tagId); - } else { + if (self._chargingStation.stationInfo.AutomaticTransactionGenerator.requireAuthorize) { + // Authorize tagId + const authorizeResponse = await self._chargingStation.sendAuthorize(tagId); + if (authorizeResponse?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { + logger.info(self._logPrefix(connectorId) + ' start transaction for tagID ' + tagId); + // Start transaction + return await self._chargingStation.sendStartTransaction(connectorId, tagId); + } return authorizeResponse as StartTransactionResponse; } + logger.info(self._logPrefix(connectorId) + ' start transaction for tagID ' + tagId); + // Start transaction + return await self._chargingStation.sendStartTransaction(connectorId, tagId); } logger.info(self._logPrefix(connectorId) + ' start transaction without a tagID'); return await self._chargingStation.sendStartTransaction(connectorId); diff --git a/src/charging-station/ChargingStation.ts b/src/charging-station/ChargingStation.ts index b8ac0233..8341fe30 100644 --- a/src/charging-station/ChargingStation.ts +++ b/src/charging-station/ChargingStation.ts @@ -75,9 +75,9 @@ export default class ChargingStation { let instanceIndex = process.env.CF_INSTANCE_INDEX ? process.env.CF_INSTANCE_INDEX : 0; instanceIndex = instanceIndex > 0 ? instanceIndex : ''; - const idSuffix = Configuration.getChargingStationIdSuffix(); + const idSuffix = stationTemplate.nameSuffix ? stationTemplate.nameSuffix : ''; - return stationTemplate.fixedName ? stationTemplate.baseName : stationTemplate.baseName + '-' + instanceIndex + ('000000000' + this._index.toString()).substr(('000000000' + this._index.toString()).length - 4) + idSuffix; + return stationTemplate.fixedName ? stationTemplate.baseName : stationTemplate.baseName + '-' + instanceIndex.toString() + ('000000000' + this._index.toString()).substr(('000000000' + this._index.toString()).length - 4) + idSuffix; } _buildStationInfo(): ChargingStationInfo { @@ -527,7 +527,7 @@ export default class ChargingStation { } _startAuthorizationFileMonitoring(): void { - fs.watch(this._getAuthorizationFile()).on("change", e => { + fs.watch(this._getAuthorizationFile()).on('change', (e) => { try { logger.debug(this._logPrefix() + ' Authorization file ' + this._getAuthorizationFile() + ' have changed, reload'); // Initialize _authorizedTags @@ -539,7 +539,7 @@ export default class ChargingStation { } _startStationTemplateFileMonitoring(): void { - fs.watch(this._stationTemplateFile).on("change", e => { + fs.watch(this._stationTemplateFile).on('change', (e) => { try { logger.debug(this._logPrefix() + ' Template file ' + this._stationTemplateFile + ' have changed, reload'); // Initialize @@ -828,7 +828,7 @@ export default class ChargingStation { async sendAuthorize(idTag?: string): Promise { try { const payload: AuthorizeRequest = { - ...!Utils.isUndefined(idTag) ? { idTag } : { idTag: Constants.TRANSACTION_DEFAULT_IDTAG }, + ...!Utils.isUndefined(idTag) ? { idTag } : { idTag: Constants.TRANSACTION_DEFAULT_TAGID }, }; return await this.sendMessage(Utils.generateUUID(), payload, MessageType.CALL_MESSAGE, RequestCommand.AUTHORIZE) as AuthorizeResponse; } catch (error) { @@ -840,7 +840,7 @@ export default class ChargingStation { try { const payload: StartTransactionRequest = { connectorId, - ...!Utils.isUndefined(idTag) ? { idTag } : { idTag: Constants.TRANSACTION_DEFAULT_IDTAG }, + ...!Utils.isUndefined(idTag) ? { idTag } : { idTag: Constants.TRANSACTION_DEFAULT_TAGID }, meterStart: 0, timestamp: new Date().toISOString(), }; @@ -1009,7 +1009,7 @@ export default class ChargingStation { return; } - if (payload.idTagInfo.status === AuthorizationStatus.ACCEPTED) { + if (payload?.idTagInfo?.status === AuthorizationStatus.ACCEPTED) { this.getConnector(connectorId).transactionStarted = true; this.getConnector(connectorId).transactionId = payload.transactionId; this.getConnector(connectorId).idTag = requestPayload.idTag; @@ -1023,7 +1023,7 @@ export default class ChargingStation { this._startMeterValues(connectorId, configuredMeterValueSampleInterval ? Utils.convertToInt(configuredMeterValueSampleInterval.value) * 1000 : 60000); } else { - logger.error(this._logPrefix() + ' Starting transaction id ' + payload.transactionId.toString() + ' REJECTED with status ' + payload.idTagInfo.status + ', idTag ' + requestPayload.idTag); + logger.error(this._logPrefix() + ' Starting transaction id ' + payload.transactionId.toString() + ' REJECTED with status ' + payload?.idTagInfo?.status + ', idTag ' + requestPayload.idTag); this._resetTransactionOnConnector(connectorId); await this.sendStatusNotification(connectorId, ChargePointStatus.AVAILABLE); } diff --git a/src/charging-station/StationWorker.ts b/src/charging-station/StationWorker.ts index c7bc2337..8eac9e46 100644 --- a/src/charging-station/StationWorker.ts +++ b/src/charging-station/StationWorker.ts @@ -1,7 +1,7 @@ import { isMainThread, parentPort, workerData } from 'worker_threads'; -import Constants from '../utils/Constants'; import ChargingStation from './ChargingStation'; +import Constants from '../utils/Constants'; if (!isMainThread) { const station = new ChargingStation(workerData.index as number, workerData.templateFile as string); @@ -12,10 +12,10 @@ if (!isMainThread) { } function addListener() { - parentPort.setMaxListeners(1000); - parentPort.on("message", e => { - if (e.id === Constants.START_NEW_CHARGING_STATION) { - startChargingStation(e.workerData); + parentPort.setMaxListeners(Constants.MAX_LISTENERS); + parentPort.on('message', (e) => { + if (e.id === Constants.START_CHARGING_STATION) { + startChargingStation(e.workerData); } }); } diff --git a/src/charging-station/Worker.ts b/src/charging-station/Worker.ts index fbfdf3d1..84ec9edf 100644 --- a/src/charging-station/Worker.ts +++ b/src/charging-station/Worker.ts @@ -1,9 +1,9 @@ import { Worker, WorkerOptions } from 'worker_threads'; import Configuration from '../utils/Configuration'; +import Constants from '../utils/Constants'; import Pool from 'worker-threads-pool'; import WorkerData from '../types/WorkerData'; -import Constants from '../utils/Constants'; export default class Wrk { private _workerScript: string; @@ -46,23 +46,23 @@ export default class Wrk { */ async start(): Promise { if (Configuration.useWorkerPool()) { - this._startWorkerWithPool(); + await this._startWorkerWithPool(); } else { - this._startWorker(); + await this._startWorker(); } return this._worker; } - /** + /** * - * @return {Promise} + * @return {void} * @public */ - async startNewChargingStation(workerData: WorkerData, numConcurrentWorkers: number): Promise { + addChargingStation(workerData: WorkerData, numConcurrentWorkers: number): void { this._workerData = workerData; this._index = workerData.index; this._concurrentWorkers = numConcurrentWorkers; - this._worker.postMessage({ id : Constants.START_NEW_CHARGING_STATION, workerData: workerData }); + this._worker.postMessage({ id : Constants.START_CHARGING_STATION, workerData: workerData }); } /** diff --git a/src/scripts/deleteChargingStations.ts b/src/scripts/deleteChargingStations.ts index db07c6c1..9ac7a085 100644 --- a/src/scripts/deleteChargingStations.ts +++ b/src/scripts/deleteChargingStations.ts @@ -1,5 +1,5 @@ -var MongoClient = require('mongodb'); -var fs = require('fs'); +import MongoClient from 'mongodb'; +import fs from 'fs'; // This script deletes charging stations // Filter charging stations by id pattern @@ -8,19 +8,19 @@ var fs = require('fs'); // Delete these charging stations all at once // Config -var config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); +const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); // Mongo Connection and Query if (config && config.mongoConnectionString) { MongoClient.connect(config.mongoConnectionString, { useUnifiedTopology: true, useNewUrlParser: true - }, async function(err, client) { + }, async function(err, client) { const db = client.db('evse'); for await (const tenantID of config.tenantIDs) { - let response = await db.collection(tenantID + '.chargingstations').deleteMany( - { _id: {'$regex': config.idPattern} } + const response = await db.collection(tenantID + '.chargingstations').deleteMany( + { _id: { '$regex': config.idPattern } } ); console.log(response.deletedCount, `Charging Stations with id = %${config.idPattern}% deleted. TenantID =`, tenantID); } diff --git a/src/scripts/scriptConfig-template.json b/src/scripts/scriptConfig-template.json index fb911ff3..f30b37ad 100644 --- a/src/scripts/scriptConfig-template.json +++ b/src/scripts/scriptConfig-template.json @@ -1,6 +1,8 @@ { "publicFlag": true, - "tenantIDs": [""], + "tenantIDs": [ + "" + ], "idPattern": "", "mongoConnectionString": "mongodb://..." } diff --git a/src/scripts/setCSPublicFlag.ts b/src/scripts/setCSPublicFlag.ts index 2bc6b7e8..5c1978e8 100644 --- a/src/scripts/setCSPublicFlag.ts +++ b/src/scripts/setCSPublicFlag.ts @@ -1,5 +1,5 @@ -var MongoClient = require('mongodb'); -var fs = require('fs'); +import MongoClient from 'mongodb'; +import fs from 'fs'; // This script sets charging stations public or private // Filter charging stations by id pattern @@ -9,20 +9,20 @@ var fs = require('fs'); // set public = true // Config -var config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); +const config = JSON.parse(fs.readFileSync('scriptConfig.json', 'utf8')); // Mongo Connection and Query if (config && config.mongoConnectionString) { MongoClient.connect(config.mongoConnectionString, { useUnifiedTopology: true, useNewUrlParser: true - }, async function(err, client) { + }, async function(err, client) { const db = client.db('evse'); for await (const tenantID of config.tenantIDs) { - let response = await db.collection(tenantID + '.chargingstations').updateMany( - { _id: {'$regex': config.idPattern} }, - { $set: { public : config.publicFlag } } + const response = await db.collection(tenantID + '.chargingstations').updateMany( + { _id: { '$regex': config.idPattern } }, + { $set: { public: config.publicFlag } } ); console.log(response.modifiedCount, `Charging Stations with id = %${config.idPattern}% updated. TenantID =`, tenantID); } diff --git a/src/start.ts b/src/start.ts index fb58c2d2..67df5a3f 100644 --- a/src/start.ts +++ b/src/start.ts @@ -1,9 +1,8 @@ import Configuration from './utils/Configuration'; -import { StationTemplateURL } from './types/ConfigurationData'; +import Constants from './utils/Constants'; import Utils from './utils/Utils'; -import Wrk from './charging-station/Worker'; import WorkerData from './types/WorkerData'; -import fs from 'fs'; +import Wrk from './charging-station/Worker'; class Bootstrap { static async start() { @@ -11,7 +10,7 @@ class Bootstrap { let numStationsTotal = 0; let numConcurrentWorkers = 0; let worker: Wrk; - let chargingStationsPerWorker = Configuration.getChargingStationsPerWorker(); + const chargingStationsPerWorker = Configuration.getChargingStationsPerWorker(); let counter = 0; // Start each ChargingStation object in a worker thread if (Configuration.getStationTemplateURLs()) { @@ -24,19 +23,18 @@ class Bootstrap { index, templateFile: stationURL.file } as WorkerData; - if(counter === 0 || counter === chargingStationsPerWorker) { + if (counter === 0 || counter === chargingStationsPerWorker) { // Start new worker with one charging station - worker = await new Wrk('./dist/charging-station/StationWorker.js', workerData, numStationsTotal); - worker.start().catch(() => {}); + worker = new Wrk('./dist/charging-station/StationWorker.js', workerData, numStationsTotal); + worker.start().catch(() => { }); counter = 0; // Start workers sequentially to optimize memory at start time - await Utils.sleep(500); + await Utils.sleep(Constants.START_WORKER_DELAY); } else { - // Add new charging station to existing Worker - worker.startNewChargingStation(workerData, numStationsTotal) + // Add charging station to existing Worker + worker.addChargingStation(workerData, numStationsTotal); } counter++; - // Start charging station sequentially to optimize memory at start time numConcurrentWorkers = worker.concurrentWorkers; } } catch (error) { diff --git a/src/types/ChargingStationTemplate.ts b/src/types/ChargingStationTemplate.ts index 65e22ea3..c97079d5 100644 --- a/src/types/ChargingStationTemplate.ts +++ b/src/types/ChargingStationTemplate.ts @@ -25,13 +25,15 @@ export interface AutomaticTransactionGenerator { maxDelayBetweenTwoTransactions: number; probabilityOfStart: number; stopAfterHours: number; - stopOnConnectionFailure: boolean + stopOnConnectionFailure: boolean; + requireAuthorize: boolean } export default interface ChargingStationTemplate { supervisionURL?: string; authorizationFile?: string; baseName: string; + nameSuffix?: string; fixedName?: string; chargePointModel: string; chargePointVendor: string; diff --git a/src/types/ConfigurationData.ts b/src/types/ConfigurationData.ts index e056471c..bc4e0f88 100644 --- a/src/types/ConfigurationData.ts +++ b/src/types/ConfigurationData.ts @@ -12,8 +12,7 @@ export default interface ConfigurationData { distributeStationsToTenantsEqually?: boolean; useWorkerPool?: boolean; workerPoolSize?: number; - chargingStationsPerWorker: number; - chargingStationIdSuffix: string; + chargingStationsPerWorker?: number; logFormat?: string; logLevel?: string; logRotate?: boolean; diff --git a/src/utils/Configuration.ts b/src/utils/Configuration.ts index 090e2e2c..3e2a66bc 100644 --- a/src/utils/Configuration.ts +++ b/src/utils/Configuration.ts @@ -49,10 +49,6 @@ export default class Configuration { return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'chargingStationsPerWorker') ? Configuration.getConfig().chargingStationsPerWorker : 1; } - static getChargingStationIdSuffix(): string { - return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'chargingStationIdSuffix') ? Configuration.getConfig().chargingStationIdSuffix : ''; - } - static getLogConsole(): boolean { Configuration.deprecateConfigurationKey('consoleLog', 'Use \'logConsole\' instead'); return Configuration.objectHasOwnProperty(Configuration.getConfig(), 'logConsole') ? Configuration.getConfig().logConsole : false; diff --git a/src/utils/Constants.ts b/src/utils/Constants.ts index 6e5eb697..bad0858d 100644 --- a/src/utils/Constants.ts +++ b/src/utils/Constants.ts @@ -33,7 +33,10 @@ export default class Constants { static readonly CHARGING_STATION_DEFAULT_RESET_TIME = 60000; // Ms static readonly CHARGING_STATION_ATG_WAIT_TIME = 2000; // Ms - static readonly TRANSACTION_DEFAULT_IDTAG = '00000000'; + static readonly TRANSACTION_DEFAULT_TAGID = '00000000'; - static readonly START_NEW_CHARGING_STATION = 'startNewChargingStation'; + static readonly MAX_LISTENERS = 1000; + + static readonly START_WORKER_DELAY = 500; + static readonly START_CHARGING_STATION = 'startChargingStation'; } -- 2.34.1