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