)
}
+ public get numberOfProvisionedChargingStations (): number {
+ return [...this.templateStatistics.values()].reduce(
+ (accumulator, value) => accumulator + value.provisioned,
+ 0
+ )
+ }
+
public getState (): SimulatorState {
return {
version: this.version,
+ configuration: Configuration.getConfigurationData(),
started: this.started,
templateStatistics: this.templateStatistics
}
chalk.green(
`Charging stations simulator ${
this.version
- } started with ${this.numberOfConfiguredChargingStations} configured charging station(s) from ${this.numberOfChargingStationTemplates} charging station template(s) and ${
+ } started with ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s) from ${this.numberOfChargingStationTemplates} charging station template(s) and ${
Configuration.workerDynamicPoolInUse() ? `${workerConfiguration.poolMinSize}/` : ''
}${this.workerImplementation?.size}${
Configuration.workerPoolInUse() ? `/${workerConfiguration.poolMaxSize}` : ''
let elementsPerWorker: number
switch (workerConfiguration.elementsPerWorker) {
case 'all':
- elementsPerWorker = this.numberOfConfiguredChargingStations
+ elementsPerWorker =
+ this.numberOfConfiguredChargingStations + this.numberOfProvisionedChargingStations
break
case 'auto':
elementsPerWorker =
- this.numberOfConfiguredChargingStations > availableParallelism()
- ? Math.round(this.numberOfConfiguredChargingStations / (availableParallelism() * 1.5))
+ this.numberOfConfiguredChargingStations + this.numberOfProvisionedChargingStations >
+ availableParallelism()
+ ? Math.round(
+ (this.numberOfConfiguredChargingStations +
+ this.numberOfProvisionedChargingStations) /
+ (availableParallelism() * 1.5)
+ )
: 1
break
default:
msg: ChargingStationWorkerMessage<ChargingStationWorkerMessageData>
): void {
// logger.debug(
- // `${this.logPrefix()} ${moduleName}.messageHandler: Worker channel message received: ${JSON.stringify(
+ // `${this.logPrefix()} ${moduleName}.messageHandler: Charging station worker message received: ${JSON.stringify(
// msg,
// undefined,
// 2
break
default:
throw new BaseError(
- `Unknown charging station worker event: '${event}' received with data: ${JSON.stringify(data, undefined, 2)}`
+ `Unknown charging station worker message event: '${event}' received with data: ${JSON.stringify(data, undefined, 2)}`
)
}
} catch (error) {
logger.error(
- `${this.logPrefix()} ${moduleName}.messageHandler: Error occurred while handling '${event}' event:`,
+ `${this.logPrefix()} ${moduleName}.messageHandler: Error occurred while handling charging station worker message event '${event}':`,
error
)
}
data.stationInfo.chargingStationId
} (hashId: ${data.stationInfo.hashId}) added (${
this.numberOfAddedChargingStations
- } added from ${this.numberOfConfiguredChargingStations} configured charging station(s))`
+ } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
)
}
data.stationInfo.chargingStationId
} (hashId: ${data.stationInfo.hashId}) deleted (${
this.numberOfAddedChargingStations
- } added from ${this.numberOfConfiguredChargingStations} configured charging station(s))`
+ } added from ${this.numberOfConfiguredChargingStations} configured and ${this.numberOfProvisionedChargingStations} provisioned charging station(s))`
)
}
const templateName = buildTemplateName(stationTemplateUrl.file)
this.templateStatistics.set(templateName, {
configured: stationTemplateUrl.numberOfStations,
+ provisioned: stationTemplateUrl.provisionedNumberOfStations ?? 0,
added: 0,
started: 0,
indexes: new Set<number>()