- private static workerImplementation: WorkerAbstract | null = null;
- private static storage: Storage;
- private static numberOfChargingStations: number;
+ private workerImplementation: WorkerAbstract | null = null;
+ private readonly storage: Storage;
+ private numberOfChargingStations: number;
private readonly version: string = version;
private started: boolean;
private readonly workerScript: string;
private readonly version: string = version;
private started: boolean;
private readonly workerScript: string;
this.started = false;
this.workerScript = path.join(path.resolve(__dirname, '../'), 'charging-station', 'ChargingStationWorker.js');
this.initWorkerImplementation();
this.started = false;
this.workerScript = path.join(path.resolve(__dirname, '../'), 'charging-station', 'ChargingStationWorker.js');
this.initWorkerImplementation();
- Bootstrap.storage = StorageFactory.getStorage(Configuration.getPerformanceStorage().type, Configuration.getPerformanceStorage().URI, this.logPrefix());
+ this.storage = StorageFactory.getStorage(Configuration.getPerformanceStorage().type, Configuration.getPerformanceStorage().URI, this.logPrefix());
- Bootstrap.numberOfChargingStations = 0;
- await Bootstrap.storage.open();
- await Bootstrap.workerImplementation.start();
+ this.numberOfChargingStations = 0;
+ await this.storage.open();
+ await this.workerImplementation.start();
// Start ChargingStation object in worker thread
if (Configuration.getStationTemplateURLs()) {
for (const stationURL of Configuration.getStationTemplateURLs()) {
// Start ChargingStation object in worker thread
if (Configuration.getStationTemplateURLs()) {
for (const stationURL of Configuration.getStationTemplateURLs()) {
index,
templateFile: path.join(path.resolve(__dirname, '../'), 'assets', 'station-templates', path.basename(stationURL.file))
};
index,
templateFile: path.join(path.resolve(__dirname, '../'), 'assets', 'station-templates', path.basename(stationURL.file))
};
- console.log(chalk.green(`Charging stations simulator ${this.version} started with ${Bootstrap.numberOfChargingStations.toString()} charging station(s) and ${Utils.workerDynamicPoolInUse() ? `${Configuration.getWorkerPoolMinSize().toString()}/` : ''}${Bootstrap.workerImplementation.size}${Utils.workerPoolInUse() ? `/${Configuration.getWorkerPoolMaxSize().toString()}` : ''} worker(s) concurrently running in '${Configuration.getWorkerProcess()}' mode${Bootstrap.workerImplementation.maxElementsPerWorker ? ` (${Bootstrap.workerImplementation.maxElementsPerWorker} charging station(s) per worker)` : ''}`));
+ console.log(chalk.green(`Charging stations simulator ${this.version} started with ${this.numberOfChargingStations.toString()} charging station(s) and ${Utils.workerDynamicPoolInUse() ? `${Configuration.getWorkerPoolMinSize().toString()}/` : ''}${this.workerImplementation.size}${Utils.workerPoolInUse() ? `/${Configuration.getWorkerPoolMaxSize().toString()}` : ''} worker(s) concurrently running in '${Configuration.getWorkerProcess()}' mode${this.workerImplementation.maxElementsPerWorker ? ` (${this.workerImplementation.maxElementsPerWorker} charging station(s) per worker)` : ''}`));
- Bootstrap.workerImplementation = WorkerFactory.getWorkerImplementation<ChargingStationWorkerData>(this.workerScript, Configuration.getWorkerProcess(),
+ this.workerImplementation = WorkerFactory.getWorkerImplementation<ChargingStationWorkerData>(this.workerScript, Configuration.getWorkerProcess(),
{
startDelay: Configuration.getWorkerStartDelay(),
poolMaxSize: Configuration.getWorkerPoolMaxSize(),
{
startDelay: Configuration.getWorkerStartDelay(),
poolMaxSize: Configuration.getWorkerPoolMaxSize(),
},
messageHandler: async (msg: ChargingStationWorkerMessage) => {
if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {
},
messageHandler: async (msg: ChargingStationWorkerMessage) => {
if (msg.id === ChargingStationWorkerMessageEvents.PERFORMANCE_STATISTICS) {