Indentation cleanup
[e-mobility-charging-stations-simulator.git] / README.md
CommitLineData
ae8ee665 1# [charging-stations-simulator](https://github.com/jerome-benoit/charging-stations-simulator)
7dde0b73
JB
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
696ce53a
JB
7## Prerequisites
8
9### Windows
10
11* [Chocolatey](https://chocolatey.org/):
12
13```powershell
14choco install -y nodejs-lts
15```
16
17### MacOSX
18
19* [Homebrew](https://brew.sh/):
20
21```shell
22brew install node@14
23```
24
2c28fc83
JB
25## Configuration syntax
26
27All configuration files are in the JSON standard format.
28
29The 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).
30
31All charging station templates are in the directory [src/assets/station-templates](src/assets/station-templates).
32
33A 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).
34
35### Global configuration
36
b1d6e944 37**src/assets/config.json**:
2c28fc83
JB
38
39Key | Value(s) | Default Value | Value type | Description
40--- | -------| --------------| ---------- | ------------
41supervisionURLs | | [] | string[] | array of connection URIs to OCPP-J servers
42distributeStationsToTenantsEqually | true/false | true | boolean | distribute charging stations uniformly to the OCPP-J servers
326ab6fd
JB
43workerProcess | workerSet/staticPool/dynamicPool | workerSet | string | worker threads process type
44workerStartDelay | | 500 | integer | milliseconds to wait at charging station worker threads startup
2c28fc83
JB
45workerPoolMinSize | | 4 | integer | worker threads pool minimum number of threads
46workerPoolMaxSize | | 16 | integer | worker threads pool maximum number of threads
4be5abe3 47workerPoolStrategy | ROUND_ROBIN/LESS_RECENTLY_USED/... | [poolifier](https://github.com/poolifier/poolifier) default: ROUND_ROBBIN | string | worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy
2c28fc83 48chargingStationsPerWorker | | 1 | integer | number of charging stations per worker threads for the `workerSet` process type
72f041bd 49logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs
2c28fc83
JB
50logConsole | true/false | false | boolean | output logs on the console
51logFormat | | simple | string | winston log format
52logRotate | true/false | true | boolean | enable daily log files rotation
0302da79 53logMaxFiles | | 7 | integer | maximum number of log files to keep
2c28fc83
JB
54logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level
55logFile | | combined.log | string | log file relative path
56logErrorFile | | error.log | string | error log file relative path
c27c3eee 57performanceStorage | | { "enabled": false, "type": "jsonfile", "file:///performanceMeasurements.json" } | { enabled: string; type: string; URI: string; } where type can be 'jsonfile', 'mysql', 'mariadb', 'sqlite' or 'mongodb' | performance storage configuration section
72f041bd 58stationTemplateURLs | | {}[] | { file: string; numberOfStations: number; }[] | array of charging station templates URIs configuration section (template file name and number of stations)
a6b3c6c3
JB
59
60#### Worker process model:
61
62- **workerSet**:
63 Worker set executing each a static number (chargingStationsPerWorker) of simulated charging stations from the total
64
65- **staticPool**:
66 Statically sized worker pool executing a static total number of simulated charging stations
67
68- **dynamicPool**:
69 Dynamically sized worker pool executing a static total number of simulated charging stations
70
2c28fc83 71### Charging station template
2e6e52f3 72
2c28fc83
JB
73Key | Value(s) | Default Value | Value type | Description
74--- | -------| --------------| ---------- | ------------
a02da55f 75supervisionURL | | '' | string | connection URI to OCPP-J server
15042c5f
JB
76supervisionUser | | '' | string | basic HTTP authentication user to OCPP-J server
77supervisionPassword | | '' | string | basic HTTP authentication password to OCPP-J server
a02da55f
JB
78ocppVersion | 1.6 | 1.6 | string | OCPP version
79ocppProtocol | json | json | string | OCPP protocol
2c28fc83 80authorizationFile | | '' | string | RFID tags list file relative to src/assets path
a02da55f
JB
81baseName | | '' | string | base name to build charging stations name
82nameSuffix | | '' | string | name suffix to build charging stations name
83fixedName | true/false | false | boolean | use the baseName as the charging stations unique name
84chargePointModel | | '' | string | charging stations model
85chargePointVendor | | '' | string | charging stations vendor
86chargeBoxSerialNumberPrefix | | '' | string | charging stations serial number prefix
87firmwareVersion | | '' | string | charging stations firmware version
4a1857a2 88power | | | float\|float[] | charging stations maximum power value(s)
c6f76013 89powerSharedByConnectors | true/false | false | boolean | charging stations power shared by its connectors
ef16e252 90powerUnit | W/kW | W | string | charging stations power unit
7decf1b6 91currentOutType | AC/DC | AC | string | charging stations current out type
6ed92bc1 92voltageOut | | AC:230/DC:400 | integer | charging stations voltage out
c706280d 93numberOfPhases | 0/1/3 | AC:3/DC:0 | integer | charging stations number of phase(s)
7decf1b6
JB
94numberOfConnectors | | | integer\|integer[] | charging stations number of connector(s)
95useConnectorId0 | true/false | true | boolean | use connector id 0 definition from the template
11b056bb 96randomConnectors | true/false | false | boolean | randomize runtime connector id affectation from the connector id definition in template
7decf1b6 97resetTime | | 60 | integer | seconds to wait before the charging stations come back at reset
47e22477 98autoRegister | true/false | false | boolean | set the charging station as registered at boot notification for testing purpose
7decf1b6
JB
99autoReconnectMaxRetries | | -1 (unlimited) | integer | connection retries to the OCPP-J server
100reconnectExponentialDelay | true/false | false | boolean | connection delay retry to the OCPP-J server
0b13b85d 101registrationMaxRetries | | -1 (unlimited) | integer | charging stations boot notification retries
6ed92bc1 102enableStatistics | true/false | true | boolean | enable charging stations statistics
a7fc8211 103mayAuthorizeAtRemoteStart | true/false | true | boolean | always send authorize at remote start transaction when AuthorizeRemoteTxRequests is enabled
6ed92bc1
JB
104beginEndMeterValues | true/false | false | boolean | enable Transaction.{Begin,End} MeterValues
105outOfOrderEndMeterValues | true/false | false | boolean | send Transaction.End MeterValues out of order
a7fc8211 106meteringPerTransaction | true/false | true | boolean | enable metering history on a per transaction basis
fd0c36fa 107transactionDataMeterValues | true/false | false | boolean | enable transaction data MeterValues at stop transaction
9ccca265 108mainVoltageMeterValues | true/false | true | boolean | include charging station main voltage MeterValues on three phased charging stations
6b10669b 109phaseLineToLineVoltageMeterValues | true/false | true | boolean | include charging station line to line voltage MeterValues on three phased charging stations
72f041bd
JB
110Configuration | | | ChargingStationConfiguration | charging stations OCPP parameters configuration section
111AutomaticTransactionGenerator | | | AutomaticTransactionGenerator | charging stations ATG configuration section
112Connectors | | | Connectors | charging stations connectors configuration section
c94a349a
JB
113
114#### Configuration section
115
116```json
0302da79 117 "Configuration": {
c94a349a
JB
118 "configurationKey": [
119 ...
120 {
121 "key": "StandardKey",
122 "readonly": false,
123 "value": "StandardValue",
124 "visible": true,
125 "reboot": false
126 },
127 ...
128 {
129 "key": "VendorKey",
130 "readonly": false,
131 "value": "VendorValue",
132 "visible": false,
133 "reboot": true
134 },
135 ...
136 ]
137 }
138```
139
140#### AutomaticTransactionGenerator section
141
142```json
0302da79 143 "AutomaticTransactionGenerator": {
c94a349a
JB
144 "enable": false,
145 "minDuration": 60,
146 "maxDuration": 80,
147 "minDelayBetweenTwoTransactions": 15,
148 "maxDelayBetweenTwoTransactions": 30,
149 "probabilityOfStart": 1,
150 "stopAfterHours": 0.3,
151 "stopOnConnectionFailure": true,
e644918b 152 "requireAuthorize": true
c94a349a
JB
153 }
154```
155#### Connectors section
156
157```json
0302da79 158 "Connectors": {
c94a349a
JB
159 "0": {},
160 "1": {
161 "bootStatus": "Available",
162 "MeterValues": [
9bd87386
JB
163 ...
164 {
165 "unit": "W",
166 "measurand": "Power.Active.Import",
167 "phase": "L1-N",
168 "value": "5000",
169 "fluctuationPercent": "10"
170 },
c94a349a
JB
171 ...
172 {
173 "unit": "A",
174 "measurand": "Current.Import"
175 },
176 ...
177 {
178 "unit": "Wh"
179 },
180 ...
181 ]
182 }
183 },
184```
185
6f0ec20e
JB
186## Start
187
188To start the program, run: `npm start`.
189
190## Docker
191
192In the [docker](./docker) folder:
193
194```bash
195make
196```
197
198Or without the optional git submodules:
199
200```bash
201make SUBMODULES_INIT=false
202```
203
204## OCPP-J commands supported
c94a349a
JB
205
206### Version 1.6
207
c56d42f1 208#### Core Profile
6f0ec20e 209
778f7924
JB
210- :white_check_mark: Authorize
211- :white_check_mark: BootNotification
212- :white_check_mark: ChangeAvailability
213- :white_check_mark: ChangeConfiguration
214- :white_check_mark: ClearCache
9e1b12e4 215- :x: DataTransfer
778f7924
JB
216- :white_check_mark: GetConfiguration
217- :white_check_mark: Heartbeat
218- :white_check_mark: MeterValues
219- :white_check_mark: RemoteStartTransaction
220- :white_check_mark: RemoteStopTransaction
221- :white_check_mark: Reset
222- :white_check_mark: StartTransaction
223- :white_check_mark: StatusNotification
224- :white_check_mark: StopTransaction
225- :white_check_mark: UnlockConnector
6f0ec20e 226
c56d42f1 227#### Firmware Management Profile
6f0ec20e 228
b652b0c3 229- :white_check_mark: GetDiagnostics
9e1b12e4
JB
230- :x: DiagnosticsStatusNotification
231- :x: FirmwareStatusNotification
232- :x: UpdateFirmware
6f0ec20e 233
c56d42f1 234#### Local Auth List Management Profile
6f0ec20e 235
9e1b12e4
JB
236- :x: GetLocalListVersion
237- :x: SendLocalList
6f0ec20e 238
c56d42f1 239#### Reservation Profile
6f0ec20e 240
9e1b12e4
JB
241- :x: CancelReservation
242- :x: ReserveNow
6f0ec20e 243
c56d42f1 244#### Smart Charging Profile
6f0ec20e 245
778f7924
JB
246- :white_check_mark: ClearChargingProfile
247- :white_check_mark: GetCompositeSchedule
248- :white_check_mark: SetChargingProfile
6f0ec20e 249
c56d42f1 250#### Remote Trigger Profile
6f0ec20e 251
802cfa13 252- :white_check_mark: TriggerMessage
7dde0b73 253
7e1dc878
JB
254## OCPP-J standard parameters supported
255
adf16e64 256All kind of OCPP parameters are supported in a charging station template. The list here mention the standard ones also handled automatically in the simulator.
7e1dc878
JB
257
258### Version 1.6
259
c56d42f1 260#### Core Profile
7e1dc878
JB
261
262- :white_check_mark: AuthorizeRemoteTxRequests (type: boolean) (units: -)
263- :x: ClockAlignedDataInterval (type: integer) (units: seconds)
291cb255 264- :white_check_mark: ConnectionTimeOut (type: integer) (units: seconds)
7e1dc878
JB
265- :x: GetConfigurationMaxKeys (type: integer) (units: -)
266- :white_check_mark: HeartbeatInterval (type: integer) (units: seconds)
267- :x: LocalAuthorizeOffline (type: boolean) (units: -)
268- :x: LocalPreAuthorize (type: boolean) (units: -)
269- :x: MeterValuesAlignedData (type: CSL) (units: -)
270- :white_check_mark: MeterValuesSampledData (type: CSL) (units: -)
271- :white_check_mark: MeterValueSampleInterval (type: integer) (units: seconds)
272- :white_check_mark: NumberOfConnectors (type: integer) (units: -)
273- :x: ResetRetries (type: integer) (units: times)
274- :white_check_mark: ConnectorPhaseRotation (type: CSL) (units: -)
275- :x: StopTransactionOnEVSideDisconnect (type: boolean) (units: -)
276- :x: StopTransactionOnInvalidId (type: boolean) (units: -)
277- :x: StopTxnAlignedData (type: CSL) (units: -)
278- :x: StopTxnSampledData (type: CSL) (units: -)
36f6a92e 279- :white_check_mark: SupportedFeatureProfiles (type: CSL) (units: -)
7e1dc878
JB
280- :x: TransactionMessageAttempts (type: integer) (units: times)
281- :x: TransactionMessageRetryInterval (type: integer) (units: seconds)
282- :x: UnlockConnectorOnEVSideDisconnect (type: boolean) (units: -)
36f6a92e 283- :white_check_mark: WebSocketPingInterval (type: integer) (units: seconds)
7e1dc878 284
c56d42f1 285#### Firmware Management Profile
7e1dc878
JB
286
287- *none*
288
c56d42f1 289#### Local Auth List Management Profile
7e1dc878 290
36f6a92e 291- :white_check_mark: LocalAuthListEnabled (type: boolean) (units: -)
7e1dc878
JB
292- :x: LocalAuthListMaxLength (type: integer) (units: -)
293- :x: SendLocalListMaxLength (type: integer) (units: -)
294
c56d42f1 295#### Reservation Profile
7e1dc878
JB
296
297- *none*
298
c56d42f1 299#### Smart Charging Profile
7e1dc878
JB
300
301- :x: ChargeProfileMaxStackLevel (type: integer) (units: -)
302- :x: ChargingScheduleAllowedChargingRateUnit (type: CSL) (units: -)
303- :x: ChargingScheduleMaxPeriods (type: integer) (units: -)
304- :x: MaxChargingProfilesInstalled (type: integer) (units: -)
305
c56d42f1 306#### Remote Trigger Profile
7e1dc878
JB
307
308- *none*
309
7dde0b73
JB
310## License
311
25c7bbb9 312This 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 or the code source file header.
7dde0b73
JB
313
314Please 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.