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