1 import Configuration
from './utils/Configuration.js';
2 import Utils
from './utils/Utils.js';
3 import Wrk
from './charging-station/Worker.js';
4 import logger
from './utils/Logger.js';
9 logger
.debug('%s Configuration: %j', Utils
.logPrefix(), Configuration
.getConfig());
10 let numStationsTotal
= 0;
11 // Start each ChargingStation object in a worker thread
12 if (Configuration
.getStationTemplateURLs()) {
13 Configuration
.getStationTemplateURLs().forEach((stationURL
) => {
15 const nbStation
= stationURL
.numberOfStation
? stationURL
.numberOfStation
: 0;
16 numStationsTotal
+= nbStation
;
17 for (let index
= 1; index
<= nbStation
; index
++) {
18 const worker
= new Wrk('./src/charging-station/StationWorker.js', {
20 templateFile
: stationURL
.file
,
25 // eslint-disable-next-line no-console
26 console
.log('Charging station start with template file ' + stationURL
.file
+ ' error ' + JSON
.stringify(error
, null, ' '));
30 console
.log('No stationTemplateURLs defined in configuration, exiting');
32 if (numStationsTotal
=== 0) {
33 console
.log('No charging station template enabled in configuration, exiting');
35 console
.log('Charging station simulator started with ' + numStationsTotal
+ ' charging station(s)');
38 // eslint-disable-next-line no-console
39 console
.log('Bootstrap start error ' + JSON
.stringify(error
, null, ' '));