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