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