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