Add configuration tunable for pool worker choice strategy
[e-mobility-charging-stations-simulator.git] / README.md
CommitLineData
7dde0b73
JB
1# ev-simulator
2
3## Summary
4
1eabf6a9 5Simple [node.js](https://nodejs.org/) program to simulate a set of charging stations based on the OCPP-J 1.6 protocol.
7dde0b73 6
2c28fc83
JB
7## Start
8
a07b4408 9To start the program, run: `npm start`.
7dde0b73 10
2c28fc83
JB
11## Configuration syntax
12
13All configuration files are in the JSON standard format.
14
15The program's global configuration parameters must be within the src/assets/config.json file. A configuration template file is available at [src/assets/config-template.json](src/assets/config-template.json).
16
17All charging station templates are in the directory [src/assets/station-templates](src/assets/station-templates).
18
19A list of RFID tags must be defined for the automatic transaction generator with the default location and name src/assets/authorization-tags.json. A template file is available at [src/assets/authorization-tags-template.json](src/assets/authorization-tags-template.json).
20
21### Global configuration
22
b1d6e944 23**src/assets/config.json**:
2c28fc83
JB
24
25Key | Value(s) | Default Value | Value type | Description
26--- | -------| --------------| ---------- | ------------
27supervisionURLs | | [] | string[] | array of connection URIs to OCPP-J servers
28distributeStationsToTenantsEqually | true/false | true | boolean | distribute charging stations uniformly to the OCPP-J servers
29statisticsDisplayInterval | | 60 | integer | seconds between charging stations statistics output in the logs
326ab6fd
JB
30workerProcess | workerSet/staticPool/dynamicPool | workerSet | string | worker threads process type
31workerStartDelay | | 500 | integer | milliseconds to wait at charging station worker threads startup
2c28fc83
JB
32workerPoolMinSize | | 4 | integer | worker threads pool minimum number of threads
33workerPoolMaxSize | | 16 | integer | worker threads pool maximum number of threads
9efbac5b 34workerPoolStrategy | ROUND_ROBIN/LESS_RECENTLY_USED/... | [poolifier](https://github.com/pioardi/poolifier) default: ROUND_ROBBIN | string | worker threads pool [poolifier](https://github.com/pioardi/poolifier) worker choice strategy
2c28fc83
JB
35chargingStationsPerWorker | | 1 | integer | number of charging stations per worker threads for the `workerSet` process type
36logConsole | true/false | false | boolean | output logs on the console
37logFormat | | simple | string | winston log format
38logRotate | true/false | true | boolean | enable daily log files rotation
0302da79 39logMaxFiles | | 7 | integer | maximum number of log files to keep
2c28fc83
JB
40logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level
41logFile | | combined.log | string | log file relative path
42logErrorFile | | error.log | string | error log file relative path
a02da55f 43stationTemplateURLs | | {}[] | { file: string; numberOfStations: number; }[] | array of charging template file URIs
2c28fc83
JB
44
45### Charging station template
2e6e52f3 46
2c28fc83
JB
47Key | Value(s) | Default Value | Value type | Description
48--- | -------| --------------| ---------- | ------------
a02da55f
JB
49supervisionURL | | '' | string | connection URI to OCPP-J server
50ocppVersion | 1.6 | 1.6 | string | OCPP version
51ocppProtocol | json | json | string | OCPP protocol
2c28fc83 52authorizationFile | | '' | string | RFID tags list file relative to src/assets path
a02da55f
JB
53baseName | | '' | string | base name to build charging stations name
54nameSuffix | | '' | string | name suffix to build charging stations name
55fixedName | true/false | false | boolean | use the baseName as the charging stations unique name
56chargePointModel | | '' | string | charging stations model
57chargePointVendor | | '' | string | charging stations vendor
58chargeBoxSerialNumberPrefix | | '' | string | charging stations serial number prefix
59firmwareVersion | | '' | string | charging stations firmware version
aa8cbc5c 60power | | | integer\|integer[] | charging stations maximum power value(s)
c6f76013 61powerSharedByConnectors | true/false | false | boolean | charging stations power shared by its connectors
ef16e252 62powerUnit | W/kW | W | string | charging stations power unit
7decf1b6 63currentOutType | AC/DC | AC | string | charging stations current out type
c706280d 64numberOfPhases | 0/1/3 | AC:3/DC:0 | integer | charging stations number of phase(s)
7decf1b6
JB
65numberOfConnectors | | | integer\|integer[] | charging stations number of connector(s)
66useConnectorId0 | true/false | true | boolean | use connector id 0 definition from the template
11b056bb 67randomConnectors | true/false | false | boolean | randomize runtime connector id affectation from the connector id definition in template
7decf1b6
JB
68resetTime | | 60 | integer | seconds to wait before the charging stations come back at reset
69connectionTimeout | | 30 | integer | connection timeout to the OCPP-J server
70autoReconnectMaxRetries | | -1 (unlimited) | integer | connection retries to the OCPP-J server
71reconnectExponentialDelay | true/false | false | boolean | connection delay retry to the OCPP-J server
0b13b85d 72registrationMaxRetries | | -1 (unlimited) | integer | charging stations boot notification retries
7decf1b6 73enableStatistics | true/false | true | boolean | enable charging stations statistics
0b13b85d 74voltageOut | | AC:230/DC:400 | integer | charging stations voltage out
c94a349a
JB
75Configuration | | | ChargingStationConfiguration | charging stations OCPP configuration parameters
76AutomaticTransactionGenerator | | | AutomaticTransactionGenerator | charging stations ATG configuration
77Connectors | | | Connectors | charging stations connectors configuration
78
79#### Configuration section
80
81```json
0302da79 82 "Configuration": {
c94a349a
JB
83 "configurationKey": [
84 ...
85 {
86 "key": "StandardKey",
87 "readonly": false,
88 "value": "StandardValue",
89 "visible": true,
90 "reboot": false
91 },
92 ...
93 {
94 "key": "VendorKey",
95 "readonly": false,
96 "value": "VendorValue",
97 "visible": false,
98 "reboot": true
99 },
100 ...
101 ]
102 }
103```
104
105#### AutomaticTransactionGenerator section
106
107```json
0302da79 108 "AutomaticTransactionGenerator": {
c94a349a
JB
109 "enable": false,
110 "minDuration": 60,
111 "maxDuration": 80,
112 "minDelayBetweenTwoTransactions": 15,
113 "maxDelayBetweenTwoTransactions": 30,
114 "probabilityOfStart": 1,
115 "stopAfterHours": 0.3,
116 "stopOnConnectionFailure": true,
117 "requireAuthorize": false
118 }
119```
120#### Connectors section
121
122```json
0302da79 123 "Connectors": {
c94a349a
JB
124 "0": {},
125 "1": {
126 "bootStatus": "Available",
127 "MeterValues": [
128 ...
129 {
130 "unit": "A",
131 "measurand": "Current.Import"
132 },
133 ...
134 {
135 "unit": "Wh"
136 },
137 ...
138 ]
139 }
140 },
141```
142
143## OCPP commands
144
145### Version 1.6
146
147TODO
7dde0b73
JB
148
149## License
150
9f5030ff 151This file and all other files in this repository are licensed under the Apache Software License, v.2 and copyrighted under the copyright in [NOTICE](NOTICE) file, except as noted otherwise in the [LICENSE](LICENSE) file.
7dde0b73
JB
152
153Please note that Docker images can contain other software which may be licensed under different licenses. This LICENSE and NOTICE files are also included in the Docker image. For any usage of built Docker images please make sure to check the licenses of the artifacts contained in the images.