build(deps-dev): apply updates
[e-mobility-charging-stations-simulator.git] / README.md
1 <!-- markdownlint-disable-file MD033 MD024 -->
2 <div align="center">
3
4 # [e-Mobility charging stations simulator](https://github.com/sap/e-mobility-charging-stations-simulator)
5
6 </div>
7
8 <div align="center">
9
10 [![GitHub Clones](https://img.shields.io/badge/dynamic/json?color=brightgreen&label=Clone&query=count&url=https://gist.githubusercontent.com/jerome-benoit/c7c669b881d5b27dc0b44a639504ff93/raw/clone.json&logo=github)](https://github.com/SAP/e-mobility-charging-stations-simulator/graphs/traffic)
11 [![GitHub commit activity (main)](https://img.shields.io/github/commit-activity/m/SAP/e-mobility-charging-stations-simulator/main?color=brightgreen&logo=github)](https://github.com/SAP/e-mobility-charging-stations-simulator/graphs/commit-activity)
12 [![CI workflow](https://github.com/SAP/e-mobility-charging-stations-simulator/actions/workflows/ci.yml/badge.svg)](https://github.com/SAP/e-mobility-charging-stations-simulator/actions/workflows/ci.yml)
13 [![REUSE status](https://api.reuse.software/badge/github.com/SAP/e-mobility-charging-stations-simulator)](https://api.reuse.software/info/github.com/SAP/e-mobility-charging-stations-simulator)
14 [![Javascript Standard Style Guide](<https://badgen.net/static/code style/standard/green>)](https://standardjs.com)
15
16 </div>
17
18 Simple [node.js](https://nodejs.org/) software to simulate and scale a set of charging stations based on the OCPP-J protocol as part of [SAP e-Mobility](https://www.sap.com/products/scm/e-mobility.html) solution.
19
20 ## Table of contents
21
22 - [Installation](#installation)
23 - [Prerequisites](#prerequisites)
24 - [Windows](#windows)
25 - [MacOSX](#macosx)
26 - [GNU/Linux](#gnulinux)
27 - [Dependencies](#dependencies)
28 - [Initial configuration](#initial-configuration)
29 - [Start simulator](#start-simulator)
30 - [Start Web UI](#start-web-ui)
31 - [Configuration files syntax](#configuration-files-syntax)
32 - [Charging stations simulator configuration](#charging-stations-simulator-configuration)
33 - [Charging station configuration template](#charging-station-configuration-template)
34 - [Charging station configuration](#charging-station-configuration)
35 - [Docker](#docker)
36 - [OCPP-J commands supported](#ocpp-j-commands-supported)
37 - [Version 1.6](#version-16)
38 - [Version 2.x.x](#version-2xx)
39 - [OCPP-J standard parameters supported](#ocpp-j-standard-parameters-supported)
40 - [Version 1.6](#version-16-1)
41 - [Version 2.x.x](#version-2xx-1)
42 - [UI Protocol](#ui-protocol)
43 - [Websocket Protocol](#websocket-protocol)
44 - [HTTP Protocol](#http-protocol)
45 - [Support, Feedback, Contributing](#support-feedback-contributing)
46 - [Code of Conduct](#code-of-conduct)
47 - [Licensing](#licensing)
48
49 ## Installation
50
51 ### Prerequisites
52
53 Install the [node.js](https://nodejs.org/) current LTS or superior version runtime environment:
54
55 #### Windows
56
57 - [Chocolatey](https://chocolatey.org/):
58
59 ```powershell
60 choco install -y nodejs
61 ```
62
63 #### MacOSX
64
65 - [Homebrew](https://brew.sh/):
66
67 ```shell
68 brew install node
69 ```
70
71 #### GNU/Linux
72
73 - [NodeSource](https://github.com/nodesource/distributions) Node.js Binary Distributions for all supported versions.
74
75 #### Dependencies
76
77 Enable corepack if not already done and install latest pnpm version:
78
79 ```shell
80 corepack enable
81 corepack prepare pnpm@latest --activate
82 ```
83
84 In the repository root, run the following command:
85
86 ```shell
87 pnpm install
88 ```
89
90 ## Initial configuration
91
92 Copy the configuration template file [src/assets/config-template.json](./src/assets/config-template.json) to [src/assets/config.json](./src/assets/config.json).
93 Copy the RFID tags template file [src/assets/idtags-template.json](./src/assets/idtags-template.json) to [src/assets/idtags.json](./src/assets/idtags.json).
94
95 Tweak them to your needs by following the section [configuration files syntax](#configuration-files-syntax): OCPP server supervision URL(s), charging station templates, etc.
96
97 ## Start simulator
98
99 ```shell
100 pnpm start
101 ```
102
103 ## Start Web UI
104
105 See Web UI [README.md](./ui/web/README.md) for more information.
106
107 ## Configuration files syntax
108
109 All configuration files are using the JSON standard syntax.
110
111 **Configuration files locations**:
112
113 - charging stations simulator configuration: [src/assets/config.json](./src/assets/config.json);
114 - charging station configuration templates: [src/assets/station-templates](./src/assets/station-templates);
115 - charging station configurations: [dist/assets/configurations](./dist/assets/configurations);
116 - charging station RFID tags lists: [src/assets](./src/assets).
117
118 The charging stations simulator's configuration parameters must be within the `src/assets/config.json` file. A charging station simulator configuration template file is available at [src/assets/config-template.json](./src/assets/config-template.json).
119
120 All charging station configuration templates are in the directory [src/assets/station-templates](./src/assets/station-templates).
121
122 A list of RFID tags must be defined for the automatic transaction generator in a file with the default location and name: `src/assets/idtags.json`. A template file is available at [src/assets/idtags-template.json](./src/assets/idtags-template.json).
123
124 **Configuration files hierarchy and priority**:
125
126 1. charging station configuration: [dist/assets/configurations](./dist/assets/configurations);
127 2. charging station configuration template: [src/assets/station-templates](./src/assets/station-templates);
128 3. charging stations simulator configuration: [src/assets/config.json](./src/assets/config.json).
129
130 The charging stations simulator has an automatic configuration files reload feature at change for:
131
132 - charging stations simulator configuration;
133 - charging station configuration templates;
134 - charging station authorization RFID tags lists.
135
136 But the modifications to test have to be done to the files in the build target directory [dist/assets](./dist/assets). Once the modifications are done, they have to be reported to the matching files in the build source directory [src/assets](./src/assets) to ensure they will be taken into account at next build.
137
138 ### Charging stations simulator configuration
139
140 **src/assets/config.json**:
141
142 | Key | Value(s) | Default Value | Value type | Description |
143 | -------------------------- | -------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
144 | supervisionUrls | | [] | string \| string[] | string or strings array containing global connection URIs to OCPP-J servers |
145 | supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | string | supervision urls distribution policy to simulated charging stations |
146 | log | | {<br />"enabled": true,<br />"file": "logs/combined.log",<br />"errorFile": "logs/error.log",<br />"statisticsInterval": 60,<br />"level": "info",<br />"console": false,<br />"format": "simple",<br />"rotate": true<br />} | {<br />enabled?: boolean;<br />file?: string;<br />errorFile?: string;<br />statisticsInterval?: number;<br />level?: string;<br />console?: boolean;<br />format?: string;<br />rotate?: boolean;<br />maxFiles?: string \| number;<br />maxSize?: string \| number;<br />} | Log configuration section:<br />- _enabled_: enable logging<br />- _file_: log file relative path<br />- _errorFile_: error log file relative path<br />- _statisticsInterval_: seconds between charging stations statistics output in the logs<br />- _level_: emerg/alert/crit/error/warning/notice/info/debug [winston](https://github.com/winstonjs/winston) logging level</br >- _console_: output logs on the console<br />- _format_: [winston](https://github.com/winstonjs/winston) log format<br />- _rotate_: enable daily log files rotation<br />- _maxFiles_: maximum number of log files: https://github.com/winstonjs/winston-daily-rotate-file#options<br />- _maxSize_: maximum size of log files in bytes, or units of kb, mb, and gb: https://github.com/winstonjs/winston-daily-rotate-file#options |
147 | worker | | {<br />"processType": "workerSet",<br />"startDelay": 500,<br />"elementAddDelay": 0,<br />"elementsPerWorker": 'auto',<br />"poolMinSize": 4,<br />"poolMaxSize": 16<br />} | {<br />processType?: WorkerProcessType;<br />startDelay?: number;<br />elementAddDelay?: number;<br />elementsPerWorker?: number \| 'auto' \| 'all';<br />poolMinSize?: number;<br />poolMaxSize?: number;<br />resourceLimits?: ResourceLimits;<br />} | Worker configuration section:<br />- _processType_: worker threads process type (`workerSet`/`fixedPool`/`dynamicPool`)<br />- _startDelay_: milliseconds to wait at worker threads startup (only for `workerSet` worker threads process type)<br />- _elementAddDelay_: milliseconds to wait between charging station add<br />- _elementsPerWorker_: number of charging stations per worker threads for the `workerSet` process type (`auto` means (number of stations) / (number of CPUs) \* 1.5 if (number of stations) > (number of CPUs), otherwise 1; `all` means a unique worker will run all charging stations)<br />- _poolMinSize_: worker threads pool minimum number of threads</br >- _poolMaxSize_: worker threads pool maximum number of threads<br />- _resourceLimits_: worker threads [resource limits](https://nodejs.org/api/worker_threads.html#new-workerfilename-options) object option |
148 | uiServer | | {<br />"enabled": false,<br />"type": "ws",<br />"version": "1.1",<br />"options": {<br />"host": "localhost",<br />"port": 8080<br />}<br />} | {<br />enabled?: boolean;<br />type?: ApplicationProtocol;<br />version?: ApplicationProtocolVersion;<br />options?: ServerOptions;<br />authentication?: {<br />enabled: boolean;<br />type: AuthenticationType;<br />username?: string;<br />password?: string;<br />}<br />} | UI server configuration section:<br />- _enabled_: enable UI server<br />- _type_: 'http' or 'ws'<br />- _version_: HTTP version '1.1' or '2.0'<br />- _options_: node.js net module [listen options](https://nodejs.org/api/net.html#serverlistenoptions-callback)<br />- _authentication_: authentication type configuration section |
149 | performanceStorage | | {<br />"enabled": true,<br />"type": "none",<br />} | {<br />enabled?: boolean;<br />type?: string;<br />uri?: string;<br />} | Performance storage configuration section:<br />- _enabled_: enable performance storage<br />- _type_: 'jsonfile', 'mongodb' or 'none'<br />- _uri_: storage URI |
150 | stationTemplateUrls | | {}[] | {<br />file: string;<br />numberOfStations: number;<br />provisionedNumberOfStations?: number;<br />}[] | array of charging station templates URIs configuration section:<br />- _file_: charging station configuration template file relative path<br />- _numberOfStations_: template number of stations at startup<br />- _provisionedNumberOfStations_: template provisioned number of stations after startup |
151
152 #### Worker process model
153
154 - **workerSet**:
155 Worker set executing each a fixed number (elementsPerWorker) of simulated charging stations from the total
156
157 - **fixedPool**:
158 Fixedly sized worker pool executing a fixed total number of simulated charging stations
159
160 - **dynamicPool** (experimental):
161 Dynamically sized worker pool executing a fixed total number of simulated charging stations
162
163 ### Charging station configuration template
164
165 **src/assets/station-templates/\<name\>.json**:
166
167 | Key | Value(s) | Default Value | Value type | Description |
168 | ---------------------------------------------------- | ------------- | ---------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
169 | supervisionUrls | | [] | string \| string[] | string or strings array containing connection URIs to OCPP-J servers |
170 | supervisionUser | | undefined | string | basic HTTP authentication user to OCPP-J server |
171 | supervisionPassword | | undefined | string | basic HTTP authentication password to OCPP-J server |
172 | supervisionUrlOcppConfiguration | true/false | false | boolean | enable supervision URL configuration via a vendor OCPP parameter key |
173 | supervisionUrlOcppKey | | 'ConnectionUrl' | string | the vendor string that will be used as a vendor OCPP parameter key to set the supervision URL |
174 | autoStart | true/false | true | boolean | enable automatic start of added charging station from template |
175 | ocppVersion | 1.6/2.0/2.0.1 | 1.6 | string | OCPP version |
176 | ocppProtocol | json | json | string | OCPP protocol |
177 | ocppStrictCompliance | true/false | true | boolean | enable strict adherence to the OCPP version and protocol specifications with OCPP commands PDU validation against [OCA](https://www.openchargealliance.org/) JSON schemas |
178 | ocppPersistentConfiguration | true/false | true | boolean | enable persistent OCPP parameters storage by charging stations 'hashId'. The persistency is ensured by the charging stations configuration files in [dist/assets/configurations](./dist/assets/configurations) |
179 | stationInfoPersistentConfiguration | true/false | true | boolean | enable persistent station information and specifications storage by charging stations 'hashId'. The persistency is ensured by the charging stations configuration files in [dist/assets/configurations](./dist/assets/configurations) |
180 | automaticTransactionGeneratorPersistentConfiguration | true/false | true | boolean | enable persistent automatic transaction generator configuration storage by charging stations 'hashId'. The persistency is ensured by the charging stations configuration files in [dist/assets/configurations](./dist/assets/configurations) |
181 | wsOptions | | {} | ClientOptions & ClientRequestArgs | [ws](https://github.com/websockets/ws) and node.js [http](https://nodejs.org/api/http.html) clients options intersection |
182 | idTagsFile | | undefined | string | RFID tags list file relative to [src/assets](./src/assets) path |
183 | baseName | | undefined | string | base name to build charging stations id |
184 | nameSuffix | | undefined | string | name suffix to build charging stations id |
185 | fixedName | true/false | false | boolean | use the 'baseName' as the charging stations unique name |
186 | chargePointModel | | undefined | string | charging stations model |
187 | chargePointVendor | | undefined | string | charging stations vendor |
188 | chargePointSerialNumberPrefix | | undefined | string | charge point serial number prefix |
189 | chargeBoxSerialNumberPrefix | | undefined | string | charge box serial number prefix (deprecated since OCPP 1.6) |
190 | firmwareVersionPattern | | Semantic versioning regular expression: https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string | string | charging stations firmware version pattern |
191 | firmwareVersion | | undefined | string | charging stations firmware version |
192 | power | | | float \| float[] | charging stations maximum power value(s) |
193 | powerSharedByConnectors | true/false | false | boolean | charging stations power shared by its connectors |
194 | powerUnit | W/kW | W | string | charging stations power unit |
195 | currentOutType | AC/DC | AC | string | charging stations current out type |
196 | voltageOut | | AC:230/DC:400 | integer | charging stations voltage out |
197 | numberOfPhases | 0/1/3 | AC:3/DC:0 | integer | charging stations number of phase(s) |
198 | numberOfConnectors | | | integer \| integer[] | charging stations number of connector(s) |
199 | useConnectorId0 | true/false | true | boolean | use connector id 0 definition from the charging station configuration template |
200 | randomConnectors | true/false | false | boolean | randomize runtime connector id affectation from the connector id definition in charging station configuration template |
201 | resetTime | | 60 | integer | seconds to wait before the charging stations come back at reset |
202 | autoRegister | true/false | false | boolean | set charging stations as registered at boot notification for testing purpose |
203 | autoReconnectMaxRetries | | -1 (unlimited) | integer | connection retries to the OCPP-J server |
204 | reconnectExponentialDelay | true/false | false | boolean | connection delay retry to the OCPP-J server |
205 | registrationMaxRetries | | -1 (unlimited) | integer | charging stations boot notification retries |
206 | amperageLimitationOcppKey | | undefined | string | charging stations OCPP parameter key used to set the amperage limit, per phase for each connector on AC and global for DC |
207 | amperageLimitationUnit | A/cA/dA/mA | A | string | charging stations amperage limit unit |
208 | enableStatistics | true/false | false | boolean | enable charging stations statistics |
209 | remoteAuthorization | true/false | true | boolean | enable RFID tags remote authorization |
210 | beginEndMeterValues | true/false | false | boolean | enable Transaction.{Begin,End} MeterValues |
211 | outOfOrderEndMeterValues | true/false | false | boolean | send Transaction.End MeterValues out of order. Need to relax OCPP specifications strict compliance ('ocppStrictCompliance' parameter) |
212 | meteringPerTransaction | true/false | true | boolean | enable metering history on a per transaction basis |
213 | transactionDataMeterValues | true/false | false | boolean | enable transaction data MeterValues at stop transaction |
214 | stopTransactionsOnStopped | true/false | true | boolean | enable stop transactions on charging station stop |
215 | mainVoltageMeterValues | true/false | true | boolean | include charging stations main voltage MeterValues on three phased charging stations |
216 | phaseLineToLineVoltageMeterValues | true/false | false | boolean | include charging stations line to line voltage MeterValues on three phased charging stations |
217 | customValueLimitationMeterValues | true/false | true | boolean | enable limitation on custom fluctuated value in MeterValues |
218 | firmwareUpgrade | | {<br />"versionUpgrade": {<br />"step": 1<br />},<br />"reset": true<br />} | {<br />versionUpgrade?: {<br />patternGroup?: number;<br />step?: number;<br />};<br />reset?: boolean;<br />failureStatus?: 'DownloadFailed' \| 'InstallationFailed';<br />} | Configuration section for simulating firmware upgrade support. |
219 | commandsSupport | | {<br />"incomingCommands": {},<br />"outgoingCommands": {}<br />} | {<br /> incomingCommands: Record<IncomingRequestCommand, boolean>;<br />outgoingCommands?: Record<RequestCommand, boolean>;<br />} | Configuration section for OCPP commands support. Empty section or subsections means all implemented OCPP commands are supported |
220 | messageTriggerSupport | | {} | Record<MessageTrigger, boolean> | Configuration section for OCPP commands trigger support. Empty section means all implemented OCPP trigger commands are supported |
221 | Configuration | | | ChargingStationOcppConfiguration | charging stations OCPP parameters configuration section |
222 | AutomaticTransactionGenerator | | | AutomaticTransactionGeneratorConfiguration | charging stations ATG configuration section |
223 | Connectors | | | Record<string, ConnectorStatus> | charging stations connectors configuration section |
224 | Evses | | | Record<string, EvseTemplate> | charging stations EVSEs configuration section |
225
226 #### Configuration section syntax example
227
228 ```json
229 "Configuration": {
230 "configurationKey": [
231 ...
232 {
233 "key": "StandardKey",
234 "readonly": false,
235 "value": "StandardValue",
236 "visible": true,
237 "reboot": false
238 },
239 ...
240 {
241 "key": "VendorKey",
242 "readonly": false,
243 "value": "VendorValue",
244 "visible": false,
245 "reboot": true
246 },
247 ...
248 ]
249 }
250 ```
251
252 #### AutomaticTransactionGenerator section syntax example
253
254 ##### Type definition:
255
256 ```ts
257 type AutomaticTransactionGeneratorConfiguration = {
258 enable: boolean
259 minDuration: number
260 maxDuration: number
261 minDelayBetweenTwoTransactions: number
262 maxDelayBetweenTwoTransactions: number
263 probabilityOfStart: number
264 stopAfterHours: number
265 stopAbsoluteDuration: boolean
266 requireAuthorize?: boolean
267 idTagDistribution?: 'random' | 'round-robin' | 'connector-affinity'
268 }
269 ```
270
271 ##### Example:
272
273 ```json
274 "AutomaticTransactionGenerator": {
275 "enable": false,
276 "minDuration": 60,
277 "maxDuration": 80,
278 "minDelayBetweenTwoTransactions": 15,
279 "maxDelayBetweenTwoTransactions": 30,
280 "probabilityOfStart": 1,
281 "stopAfterHours": 0.3,
282 "requireAuthorize": true,
283 "idTagDistribution": "random"
284 }
285 ```
286
287 #### Connectors section syntax example
288
289 ```json
290 "Connectors": {
291 "0": {},
292 "1": {
293 "bootStatus": "Available",
294 "MeterValues": [
295 ...
296 {
297 "unit": "W",
298 "measurand": "Power.Active.Import",
299 "phase": "L1-N",
300 "value": "5000",
301 "fluctuationPercent": "10"
302 },
303 ...
304 {
305 "unit": "A",
306 "measurand": "Current.Import",
307 "minimum": "0.5"
308 },
309 ...
310 {
311 "unit": "Wh"
312 },
313 ...
314 ]
315 }
316 },
317 ```
318
319 #### Evses section syntax example
320
321 ```json
322 "Evses": {
323 "0": {
324 "Connectors": {
325 "0": {}
326 }
327 },
328 "1": {
329 "Connectors": {
330 "1": {
331 "bootStatus": "Available",
332 "MeterValues": [
333 ...
334 {
335 "unit": "W",
336 "measurand": "Power.Active.Import",
337 "phase": "L1-N",
338 "value": "5000",
339 "fluctuationPercent": "10"
340 },
341 ...
342 {
343 "unit": "A",
344 "measurand": "Current.Import",
345 "minimum": "0.5"
346 },
347 ...
348 {
349 "unit": "Wh"
350 },
351 ...
352 ]
353 }
354 }
355 }
356 },
357 ```
358
359 ### Charging station configuration
360
361 **dist/assets/configurations/\<hashId\>.json**:
362
363 The charging station configuration file is automatically generated at startup from the charging station configuration template file and is persistent.
364
365 The charging station configuration file content can be regenerated partially on matching charging station configuration template file changes. The charging station serial number is kept unchanged.
366
367 #### stationInfo section (optional)
368
369 The syntax is similar to charging station configuration template with some added fields like the charging station id (name) and the 'Configuration' section removed.
370
371 That section is overwritten on matching charging station configuration template file changes.
372
373 #### connectorsStatus section
374
375 The syntax is similar to charging station configuration template 'Connectors' section with some added fields.
376
377 That section is overwritten on matching charging station configuration template file changes.
378
379 #### evsesStatus section
380
381 The syntax is similar to charging station configuration template 'Evses' section with some added fields.
382
383 That section is overwritten on matching charging station configuration template file changes.
384
385 #### automaticTransactionGenerator section (optional)
386
387 The syntax is similar to the charging station configuration template 'AutomaticTransactionGenerator' section.
388
389 That section is overwritten on matching charging station configuration template file changes.
390
391 #### automaticTransactionGeneratorStatuses section
392
393 That section is not overwritten on matching charging station configuration template file changes.
394
395 #### configurationKey section (optional)
396
397 The syntax is similar to the charging station configuration template 'Configuration' section.
398
399 That section is not overwritten on matching charging station configuration template file changes.
400
401 ## Docker
402
403 In the [docker](./docker) folder:
404
405 ```shell
406 make
407 ```
408
409 <!-- Or with the optional git submodules:
410
411 ```shell
412 make SUBMODULES_INIT=true
413 ``` -->
414
415 ## OCPP-J commands supported
416
417 ### Version 1.6
418
419 #### Core Profile
420
421 - :white_check_mark: Authorize
422 - :white_check_mark: BootNotification
423 - :white_check_mark: ChangeAvailability
424 - :white_check_mark: ChangeConfiguration
425 - :white_check_mark: ClearCache
426 - :white_check_mark: DataTransfer
427 - :white_check_mark: GetConfiguration
428 - :white_check_mark: Heartbeat
429 - :white_check_mark: MeterValues
430 - :white_check_mark: RemoteStartTransaction
431 - :white_check_mark: RemoteStopTransaction
432 - :white_check_mark: Reset
433 - :white_check_mark: StartTransaction
434 - :white_check_mark: StatusNotification
435 - :white_check_mark: StopTransaction
436 - :white_check_mark: UnlockConnector
437
438 #### Firmware Management Profile
439
440 - :white_check_mark: GetDiagnostics
441 - :white_check_mark: DiagnosticsStatusNotification
442 - :white_check_mark: FirmwareStatusNotification
443 - :white_check_mark: UpdateFirmware
444
445 #### Local Auth List Management Profile
446
447 - :x: GetLocalListVersion
448 - :x: SendLocalList
449
450 #### Reservation Profile
451
452 - :white_check_mark: CancelReservation
453 - :white_check_mark: ReserveNow
454
455 #### Smart Charging Profile
456
457 - :white_check_mark: ClearChargingProfile
458 - :white_check_mark: GetCompositeSchedule
459 - :white_check_mark: SetChargingProfile
460
461 #### Remote Trigger Profile
462
463 - :white_check_mark: TriggerMessage
464
465 ### Version 2.x.x
466
467 #### Provisioning
468
469 - :white_check_mark: BootNotification
470
471 #### Authorization
472
473 - :white_check_mark: ClearCache
474
475 #### Availability
476
477 - :white_check_mark: StatusNotification
478 - :white_check_mark: Heartbeat
479
480 ## OCPP-J standard parameters supported
481
482 All kind of OCPP parameters are supported in charging station configuration or charging station configuration template file. The list here mention the standard ones also handled automatically in the simulator.
483
484 ### Version 1.6
485
486 #### Core Profile
487
488 - :white_check_mark: AuthorizeRemoteTxRequests (type: boolean) (units: -)
489 - :x: ClockAlignedDataInterval (type: integer) (units: seconds)
490 - :white_check_mark: ConnectionTimeOut (type: integer) (units: seconds)
491 - :x: GetConfigurationMaxKeys (type: integer) (units: -)
492 - :white_check_mark: HeartbeatInterval (type: integer) (units: seconds)
493 - :x: LocalAuthorizeOffline (type: boolean) (units: -)
494 - :x: LocalPreAuthorize (type: boolean) (units: -)
495 - :x: MeterValuesAlignedData (type: CSL) (units: -)
496 - :white_check_mark: MeterValuesSampledData (type: CSL) (units: -)
497 - :white_check_mark: MeterValueSampleInterval (type: integer) (units: seconds)
498 - :white_check_mark: NumberOfConnectors (type: integer) (units: -)
499 - :x: ResetRetries (type: integer) (units: times)
500 - :white_check_mark: ConnectorPhaseRotation (type: CSL) (units: -)
501 - :x: StopTransactionOnEVSideDisconnect (type: boolean) (units: -)
502 - :x: StopTransactionOnInvalidId (type: boolean) (units: -)
503 - :x: StopTxnAlignedData (type: CSL) (units: -)
504 - :x: StopTxnSampledData (type: CSL) (units: -)
505 - :white_check_mark: SupportedFeatureProfiles (type: CSL) (units: -)
506 - :x: TransactionMessageAttempts (type: integer) (units: times)
507 - :x: TransactionMessageRetryInterval (type: integer) (units: seconds)
508 - :x: UnlockConnectorOnEVSideDisconnect (type: boolean) (units: -)
509 - :white_check_mark: WebSocketPingInterval (type: integer) (units: seconds)
510
511 #### Firmware Management Profile
512
513 - _none_
514
515 #### Local Auth List Management Profile
516
517 - :white_check_mark: LocalAuthListEnabled (type: boolean) (units: -)
518 - :x: LocalAuthListMaxLength (type: integer) (units: -)
519 - :x: SendLocalListMaxLength (type: integer) (units: -)
520
521 #### Reservation Profile
522
523 - :white_check_mark: ReserveConnectorZeroSupported (type: boolean) (units: -)
524
525 #### Smart Charging Profile
526
527 - :x: ChargeProfileMaxStackLevel (type: integer) (units: -)
528 - :x: ChargingScheduleAllowedChargingRateUnit (type: CSL) (units: -)
529 - :x: ChargingScheduleMaxPeriods (type: integer) (units: -)
530 - :x: MaxChargingProfilesInstalled (type: integer) (units: -)
531
532 #### Remote Trigger Profile
533
534 - _none_
535
536 ### Version 2.x.x
537
538 ## UI Protocol
539
540 Protocol to control the simulator via a Websocket or HTTP server:
541
542 ```mermaid
543 sequenceDiagram
544 Client->>UI Server: request
545 UI Server->>Client: response
546 Note over UI Server,Client: HTTP or Websocket
547 ```
548
549 ### Websocket Protocol
550
551 SRPC protocol over Websocket. PDU stands for 'Protocol Data Unit'.
552
553 - Request:
554 [`uuid`, `ProcedureName`, `PDU`]
555 `uuid`: String uniquely representing this request
556 `ProcedureName`: The procedure to run on the simulator
557 `PDU`: The parameters for said procedure
558
559 - Response:
560 [`uuid`, `PDU`]
561 `uuid`: String uniquely linking the response to the request
562 `PDU`: Response parameters to requested procedure
563
564 To learn how to use the Websocket protocol to pilot the simulator, an [Insomnia](https://insomnia.rest/) Websocket requests collection is available in [src/assets/ui-protocol](./src/assets/ui-protocol) directory.
565
566 #### Version 0.0.1
567
568 Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`.
569
570 ##### Procedures
571
572 ###### Simulator State
573
574 - Request:
575 `ProcedureName`: 'simulatorState'
576 `PDU`: {}
577
578 - Response:
579 `PDU`: {
580 `status`: 'success' | 'failure',
581 `state`: {
582 `version`: string,
583 `configuration`: ConfigurationData,
584 `started`: boolean,
585 `templateStatistics`: Record<string, TemplateStatistics>
586 }
587 }
588
589 ###### Start Simulator
590
591 - Request:
592 `ProcedureName`: 'startSimulator'
593 `PDU`: {}
594
595 - Response:
596 `PDU`: {
597 `status`: 'success' | 'failure'
598 }
599
600 ###### Stop Simulator
601
602 - Request:
603 `ProcedureName`: 'stopSimulator'
604 `PDU`: {}
605
606 - Response:
607 `PDU`: {
608 `status`: 'success' | 'failure'
609 }
610
611 ###### List Charging Station Templates
612
613 - Request:
614 `ProcedureName`: 'listTemplates'
615 `PDU`: {}
616
617 - Response:
618 `PDU`: {
619 `status`: 'success' | 'failure',
620 `templates`: string[]
621 }
622
623 ###### Add Charging Stations
624
625 - Request:
626 `ProcedureName`: 'addChargingStations'
627 `PDU`: {
628 `template`: string,
629 `numberOfStations`: number,
630 `options?`: {
631 `supervisionUrls?`: string | string[],
632 `persistentConfiguration?`: boolean,
633 `autoStart?`: boolean,
634 `autoRegister?`: boolean,
635 `enableStatistics?`: boolean,
636 `ocppStrictCompliance?`: boolean,
637 `stopTransactionsOnStopped?`: boolean
638 }
639 }
640
641 - Response:
642 `PDU`: {
643 `status`: 'success' | 'failure',
644 `hashIdsSucceeded`: charging station unique identifier strings array (optional),
645 `hashIdsFailed`: charging station unique identifier strings array (optional)
646 }
647
648 ###### Delete Charging Stations
649
650 - Request:
651 `ProcedureName`: 'deleteChargingStations'
652 `PDU`: {
653 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
654 `deleteConfiguration?`: boolean
655 }
656
657 - Response:
658 `PDU`: {
659 `status`: 'success' | 'failure',
660 `hashIdsSucceeded`: charging station unique identifier strings array,
661 `hashIdsFailed`: charging station unique identifier strings array (optional),
662 `responsesFailed`: failed responses payload array (optional)
663 }
664
665 ###### Set Charging Station Supervision Url
666
667 - Request:
668 `ProcedureName`: 'setSupervisionUrl'
669 `PDU`: {
670 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
671 `url`: string
672 }
673
674 - Response:
675 `PDU`: {
676 `status`: 'success' | 'failure',
677 `hashIdsSucceeded`: charging station unique identifier strings array,
678 `hashIdsFailed`: charging station unique identifier strings array (optional),
679 `responsesFailed`: failed responses payload array (optional)
680 }
681
682 ###### Performance Statistics
683
684 - Request:
685 `ProcedureName`: 'performanceStatistics'
686 `PDU`: {}
687
688 - Response:
689 `PDU`: {
690 `status`: 'success' | 'failure',
691 `performanceStatistics`: Statistics[]
692 }
693
694 ###### List Charging Stations
695
696 - Request:
697 `ProcedureName`: 'listChargingStations'
698 `PDU`: {}
699
700 - Response:
701 `PDU`: {
702 `status`: 'success' | 'failure',
703 `chargingStations`: ChargingStationData[]
704 }
705
706 ###### Start Charging Station
707
708 - Request:
709 `ProcedureName`: 'startChargingStation'
710 `PDU`: {
711 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
712 }
713
714 - Response:
715 `PDU`: {
716 `status`: 'success' | 'failure',
717 `hashIdsSucceeded`: charging station unique identifier strings array,
718 `hashIdsFailed`: charging station unique identifier strings array (optional),
719 `responsesFailed`: failed responses payload array (optional)
720 }
721
722 ###### Stop Charging Station
723
724 - Request:
725 `ProcedureName`: 'stopChargingStation'
726 `PDU`: {
727 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
728 }
729
730 - Response:
731 `PDU`: {
732 `status`: 'success' | 'failure',
733 `hashIdsSucceeded`: charging station unique identifier strings array,
734 `hashIdsFailed`: charging station unique identifier strings array (optional),
735 `responsesFailed`: failed responses payload array (optional)
736 }
737
738 ###### Open Connection
739
740 - Request:
741 `ProcedureName`: 'openConnection'
742 `PDU`: {
743 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
744 }
745
746 - Response:
747 `PDU`: {
748 `status`: 'success' | 'failure',
749 `hashIdsSucceeded`: charging station unique identifier strings array,
750 `hashIdsFailed`: charging station unique identifier strings array (optional),
751 `responsesFailed`: failed responses payload array (optional)
752 }
753
754 ###### Close Connection
755
756 - Request:
757 `ProcedureName`: 'closeConnection'
758 `PDU`: {
759 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
760 }
761
762 - Response:
763 `PDU`: {
764 `status`: 'success' | 'failure',
765 `hashIdsSucceeded`: charging station unique identifier strings array,
766 `hashIdsFailed`: charging station unique identifier strings array (optional),
767 `responsesFailed`: failed responses payload array (optional)
768 }
769
770 ###### Start Automatic Transaction Generator
771
772 - Request:
773 `ProcedureName`: 'startAutomaticTransactionGenerator'
774 `PDU`: {
775 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
776 `connectorIds`: connector id integer array (optional, default: all connectors)
777 }
778
779 - Response:
780 `PDU`: {
781 `status`: 'success' | 'failure',
782 `hashIdsSucceeded`: charging station unique identifier strings array,
783 `hashIdsFailed`: charging station unique identifier strings array (optional),
784 `responsesFailed`: failed responses payload array (optional)
785 }
786
787 ###### Stop Automatic Transaction Generator
788
789 - Request:
790 `ProcedureName`: 'stopAutomaticTransactionGenerator'
791 `PDU`: {
792 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
793 `connectorIds`: connector id integer array (optional, default: all connectors)
794 }
795
796 - Response:
797 `PDU`: {
798 `status`: 'success' | 'failure',
799 `hashIdsSucceeded`: charging station unique identifier strings array,
800 `hashIdsFailed`: charging station unique identifier strings array (optional),
801 `responsesFailed`: failed responses payload array (optional)
802 }
803
804 ###### OCPP commands trigger
805
806 - Request:
807 `ProcedureName`: 'commandName' (the OCPP command name in camel case)
808 `PDU`: {
809 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
810 ...`commandPayload`
811 } (the OCPP command payload with some optional fields added to target the simulated charging stations)
812
813 - Response:
814 `PDU`: {
815 `status`: 'success' | 'failure',
816 `hashIdsSucceeded`: charging station unique identifier strings array,
817 `hashIdsFailed`: charging station unique identifier strings array (optional),
818 `responsesFailed`: failed responses payload array (optional)
819 }
820
821 Examples:
822
823 - **Start Transaction**
824
825 - Request:
826 `ProcedureName`: 'startTransaction'
827 `PDU`: {
828 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
829 `connectorId`: connector id integer,
830 `idTag`: RFID tag string
831 }
832
833 - Response:
834 `PDU`: {
835 `status`: 'success' | 'failure',
836 `hashIdsSucceeded`: charging station unique identifier strings array,
837 `hashIdsFailed`: charging station unique identifier strings array (optional),
838 `responsesFailed`: failed responses payload array (optional)
839 }
840
841 - **Stop Transaction**
842
843 - Request:
844 `ProcedureName`: 'stopTransaction'
845 `PDU`: {
846 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
847 `transactionId`: transaction id integer
848 }
849
850 - Response:
851 `PDU`: {
852 `status`: 'success' | 'failure',
853 `hashIdsSucceeded`: charging station unique identifier strings array,
854 `hashIdsFailed`: charging station unique identifier strings array (optional),
855 `responsesFailed`: failed responses payload array (optional)
856 }
857
858 - **Status Notification**
859
860 - Request:
861 `ProcedureName`: 'statusNotification'
862 `PDU`: {
863 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
864 `connectorId`: connector id integer,
865 `errorCode`: connector error code,
866 `status`: connector status
867 }
868
869 - Response:
870 `PDU`: {
871 `status`: 'success' | 'failure',
872 `hashIdsSucceeded`: charging station unique identifier strings array,
873 `hashIdsFailed`: charging station unique identifier strings array (optional),
874 `responsesFailed`: failed responses payload array (optional)
875 }
876
877 - **Heartbeat**
878
879 - Request:
880 `ProcedureName`: 'heartbeat'
881 `PDU`: {
882 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
883 }
884
885 - Response:
886 `PDU`: {
887 `status`: 'success' | 'failure',
888 `hashIdsSucceeded`: charging station unique identifier strings array,
889 `hashIdsFailed`: charging station unique identifier strings array (optional),
890 `responsesFailed`: failed responses payload array (optional)
891 }
892
893 ### HTTP Protocol
894
895 To learn how to use the HTTP protocol to pilot the simulator, an [Insomnia](https://insomnia.rest/) HTTP requests collection is available in [src/assets/ui-protocol](./src/assets/ui-protocol) directory.
896
897 ## Support, Feedback, Contributing
898
899 This project is open to feature requests/suggestions, bug reports etc. via [GitHub issues](https://github.com/SAP/e-mobility-charging-stations-simulator/issues). Contribution and feedback are encouraged and always welcome. For more information about how to contribute, the project structure, as well as additional contribution information, see our [Contribution Guidelines](./CONTRIBUTING.md).
900
901 ## Code of Conduct
902
903 We as members, contributors, and leaders pledge to make participation in our community a harassment-free experience for everyone. By participating in this project, you agree to abide by its [Code of Conduct](./CODE_OF_CONDUCT.md) at all times.
904
905 ## Licensing
906
907 Copyright 2020-2024 SAP SE or an SAP affiliate company and e-mobility-charging-stations-simulator contributors. Please see our [LICENSE](./LICENSE) for copyright and license information. Detailed information including third-party components and their licensing/copyright information is available [via the REUSE tool](https://api.reuse.software/info/github.com/SAP/e-mobility-charging-stations-simulator).