| worker | | {<br />"processType": "workerSet",<br />"startDelay": 500,<br />"elementAddDelay": 0,<br />"elementsPerWorker": 'auto',<br />"poolMinSize": 4,<br />"poolMaxSize": 16<br />} | {<br />processType?: WorkerProcessType;<br />startDelay?: number;<br />elementAddDelay?: number;<br />elementsPerWorker?: number \| 'auto' \| 'all';<br />poolMinSize?: number;<br />poolMaxSize?: number;<br />resourceLimits?: ResourceLimits;<br />} | Worker configuration section:<br />- _processType_: worker threads process type (`workerSet`/`fixedPool`/`dynamicPool`)<br />- _startDelay_: milliseconds to wait at worker threads startup (only for `workerSet` worker threads process type)<br />- _elementAddDelay_: milliseconds to wait between charging station add<br />- _elementsPerWorker_: number of charging stations per worker threads for the `workerSet` process type (`auto` means (number of stations) / (number of CPUs) \* 1.5 if (number of stations) > (number of CPUs), otherwise 1; `all` means a unique worker will run all charging stations)<br />- _poolMinSize_: worker threads pool minimum number of threads</br >- _poolMaxSize_: worker threads pool maximum number of threads<br />- _resourceLimits_: worker threads [resource limits](https://nodejs.org/api/worker_threads.html#new-workerfilename-options) object option |
| uiServer | | {<br />"enabled": false,<br />"type": "ws",<br />"version": "1.1",<br />"options": {<br />"host": "localhost",<br />"port": 8080<br />}<br />} | {<br />enabled?: boolean;<br />type?: ApplicationProtocol;<br />version?: ApplicationProtocolVersion;<br />options?: ServerOptions;<br />authentication?: {<br />enabled: boolean;<br />type: AuthenticationType;<br />username?: string;<br />password?: string;<br />}<br />} | UI server configuration section:<br />- _enabled_: enable UI server<br />- _type_: 'http' or 'ws'<br />- _version_: HTTP version '1.1' or '2.0'<br />- _options_: node.js net module [listen options](https://nodejs.org/api/net.html#serverlistenoptions-callback)<br />- _authentication_: authentication type configuration section |
| performanceStorage | | {<br />"enabled": true,<br />"type": "none",<br />} | {<br />enabled?: boolean;<br />type?: string;<br />uri?: string;<br />} | Performance storage configuration section:<br />- _enabled_: enable performance storage<br />- _type_: 'jsonfile', 'mongodb' or 'none'<br />- _uri_: storage URI |
-| stationTemplateUrls | | {}[] | {<br />file: string;<br />numberOfStations: number;<br />}[] | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations) |
+| stationTemplateUrls | | {}[] | {<br />file: string;<br />numberOfStations: number;<br />provisionedNumberOfStations?: number;<br />}[] | array of charging station templates URIs configuration section:<br />- _file_: charging station configuration template file relative path<br />- _numberOfStations_: template number of stations at startup<br />- _provisionedNumberOfStations_: template provisioned number of stations after startup |
#### Worker process model
)
}
+ 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:
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>()