+ };
+
+ private workerEventStopped = (data: ChargingStationData) => {
+ this.uiServer?.chargingStations.set(data.stationInfo.hashId, data);
+ --this.numberOfStartedChargingStations;
+ logger.info(
+ `${this.logPrefix()} ${moduleName}.workerEventStopped: Charging station ${
+ data.stationInfo.chargingStationId
+ } (hashId: ${data.stationInfo.hashId}) stopped (${
+ this.numberOfStartedChargingStations
+ } started from ${this.numberOfChargingStations})`,
+ );
+ };
+
+ private workerEventUpdated = (data: ChargingStationData) => {
+ this.uiServer?.chargingStations.set(data.stationInfo.hashId, data);
+ };
+
+ private workerEventPerformanceStatistics = (data: Statistics) => {
+ this.storage.storePerformanceStatistics(data) as void;
+ };
+
+ private initializeCounters() {
+ if (this.initializedCounters === false) {
+ this.resetCounters();
+ const stationTemplateUrls = Configuration.getStationTemplateUrls()!;
+ if (isNotEmptyArray(stationTemplateUrls)) {
+ this.numberOfChargingStationTemplates = stationTemplateUrls.length;
+ for (const stationTemplateUrl of stationTemplateUrls) {
+ this.numberOfChargingStations += stationTemplateUrl.numberOfStations ?? 0;
+ }
+ } else {
+ console.warn(
+ chalk.yellow("'stationTemplateUrls' not defined or empty in configuration, exiting"),
+ );
+ process.exit(exitCodes.missingChargingStationsConfiguration);
+ }
+ if (this.numberOfChargingStations === 0) {
+ console.warn(
+ chalk.yellow('No charging station template enabled in configuration, exiting'),
+ );
+ process.exit(exitCodes.noChargingStationTemplates);
+ }
+ this.initializedCounters = true;
+ }
+ }
+
+ private resetCounters(): void {
+ this.numberOfChargingStationTemplates = 0;
+ this.numberOfChargingStations = 0;
+ this.numberOfStartedChargingStations = 0;