Merge pull request #1037 from SAP/dependabot/github_actions/pnpm/action-setup-4
[e-mobility-charging-stations-simulator.git] / README.md
CommitLineData
d6b76da3 1<!-- markdownlint-disable-file MD033 MD024 -->
aef08642 2<div align="center">
9e0845f7 3
aef08642 4# [e-Mobility charging stations simulator](https://github.com/sap/e-mobility-charging-stations-simulator)
7dde0b73 5
aef08642
JB
6</div>
7
8<div align="center">
7b0ca523 9
b0b6537f
JB
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)
f1fded7b 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)
4d188eb9 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)
b157a1df 14[![Javascript Standard Style Guide](<https://badgen.net/static/code style/standard/green>)](https://standardjs.com)
0a3d08ef 15
aef08642
JB
16</div>
17
18Simple [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
99a3209e
JB
20## Table of contents
21
99a3209e
JB
22- [Installation](#installation)
23 - [Prerequisites](#prerequisites)
24 - [Windows](#windows)
25 - [MacOSX](#macosx)
26 - [GNU/Linux](#gnulinux)
27 - [Dependencies](#dependencies)
28- [Initial configuration](#initial-configuration)
ea208169 29- [Start simulator](#start-simulator)
99a3209e
JB
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)
e35d61ad 42- [UI Protocol](#ui-protocol)
99a3209e
JB
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
99a3209e
JB
49## Installation
50
51### Prerequisites
696ce53a 52
5845e83d 53Install the [node.js](https://nodejs.org/) current LTS or superior version runtime environment:
007ee642 54
99a3209e 55#### Windows
696ce53a 56
e7aeea18 57- [Chocolatey](https://chocolatey.org/):
696ce53a
JB
58
59```powershell
5845e83d 60choco install -y nodejs
696ce53a
JB
61```
62
99a3209e 63#### MacOSX
696ce53a 64
e7aeea18 65- [Homebrew](https://brew.sh/):
696ce53a
JB
66
67```shell
5845e83d 68brew install node
696ce53a
JB
69```
70
99a3209e 71#### GNU/Linux
511780c3 72
eef659c1 73- [NodeSource](https://github.com/nodesource/distributions) Node.js Binary Distributions for all supported versions.
511780c3 74
99a3209e 75#### Dependencies
007ee642 76
1a662d29 77Enable corepack if not already done and install latest pnpm version:
5845e83d
JB
78
79```shell
80corepack enable
1a662d29 81corepack prepare pnpm@latest --activate
5845e83d
JB
82```
83
007ee642
JB
84In the repository root, run the following command:
85
86```shell
881f450c 87pnpm install
007ee642
JB
88```
89
90## Initial configuration
91
f80e9e18
JB
92Copy the configuration template file [src/assets/config-template.json](./src/assets/config-template.json) to [src/assets/config.json](./src/assets/config.json).
93Copy the RFID tags template file [src/assets/idtags-template.json](./src/assets/idtags-template.json) to [src/assets/idtags.json](./src/assets/idtags.json).
db70b600 94
352ea56d 95Tweak them to your needs by following the section [configuration files syntax](#configuration-files-syntax): OCPP server supervision URL(s), charging station templates, etc.
007ee642 96
ea208169 97## Start simulator
007ee642 98
c1936747
JB
99```shell
100pnpm start
101```
007ee642 102
4e3ff94d 103## Start Web UI
007ee642 104
f80e9e18 105See Web UI [README.md](./ui/web/README.md) for more information.
b8cc885d 106
4d3821a2 107## Configuration files syntax
2c28fc83 108
ea208169 109All configuration files are using the JSON standard syntax.
2c28fc83 110
ff82dc5f 111**Configuration files locations**:
2c28fc83 112
f80e9e18
JB
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).
2c28fc83 117
f80e9e18 118The 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).
1816f743 119
f80e9e18 120All charging station configuration templates are in the directory [src/assets/station-templates](./src/assets/station-templates).
1816f743 121
f80e9e18 122A 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).
1816f743
JB
123
124**Configuration files hierarchy and priority**:
125
f80e9e18
JB
1261. charging station configuration: [dist/assets/configurations](./dist/assets/configurations);
1272. charging station configuration template: [src/assets/station-templates](./src/assets/station-templates);
1283. charging stations simulator configuration: [src/assets/config.json](./src/assets/config.json).
511780c3 129
3a28512c 130The charging stations simulator has an automatic configuration files reload feature at change for:
511780c3 131
170bec53 132- charging stations simulator configuration;
1816f743 133- charging station configuration templates;
170bec53 134- charging station authorization RFID tags lists.
2c28fc83 135
f80e9e18 136But 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.
e7aeea18 137
170bec53 138### Charging stations simulator configuration
2c28fc83 139
b1d6e944 140**src/assets/config.json**:
2c28fc83 141
da47bc29
JB
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 |
8f8f87c4 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 |
e7aeea18 151
d6b76da3 152#### Worker process model
a6b3c6c3
JB
153
154- **workerSet**:
1d8f226b 155 Worker set executing each a fixed number (elementsPerWorker) of simulated charging stations from the total
a6b3c6c3 156
1d8f226b
JB
157- **fixedPool**:
158 Fixedly sized worker pool executing a fixed total number of simulated charging stations
a6b3c6c3 159
56e2e1ab 160- **dynamicPool** (experimental):
1d8f226b 161 Dynamically sized worker pool executing a fixed total number of simulated charging stations
a6b3c6c3 162
1816f743
JB
163### Charging station configuration template
164
afccb423 165**src/assets/station-templates/\<name\>.json**:
1816f743 166
f80e9e18
JB
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 |
c94a349a 225
3e1dfe42 226#### Configuration section syntax example
c94a349a
JB
227
228```json
0302da79 229 "Configuration": {
c94a349a
JB
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
3e1dfe42 252#### AutomaticTransactionGenerator section syntax example
c94a349a 253
20f09970 254##### Type definition:
c72f6634
JB
255
256```ts
257type AutomaticTransactionGeneratorConfiguration = {
66a7748d
JB
258 enable: boolean
259 minDuration: number
260 maxDuration: number
261 minDelayBetweenTwoTransactions: number
262 maxDelayBetweenTwoTransactions: number
263 probabilityOfStart: number
264 stopAfterHours: number
46a830d2 265 stopAbsoluteDuration: boolean
66a7748d
JB
266 requireAuthorize?: boolean
267 idTagDistribution?: 'random' | 'round-robin' | 'connector-affinity'
268}
c72f6634
JB
269```
270
20f09970 271##### Example:
c72f6634 272
c94a349a 273```json
0302da79 274 "AutomaticTransactionGenerator": {
c94a349a
JB
275 "enable": false,
276 "minDuration": 60,
277 "maxDuration": 80,
278 "minDelayBetweenTwoTransactions": 15,
279 "maxDelayBetweenTwoTransactions": 30,
280 "probabilityOfStart": 1,
281 "stopAfterHours": 0.3,
c72f6634
JB
282 "requireAuthorize": true,
283 "idTagDistribution": "random"
c94a349a
JB
284 }
285```
e7aeea18 286
3e1dfe42 287#### Connectors section syntax example
c94a349a
JB
288
289```json
0302da79 290 "Connectors": {
c94a349a
JB
291 "0": {},
292 "1": {
293 "bootStatus": "Available",
294 "MeterValues": [
9bd87386
JB
295 ...
296 {
297 "unit": "W",
298 "measurand": "Power.Active.Import",
299 "phase": "L1-N",
300 "value": "5000",
301 "fluctuationPercent": "10"
302 },
c94a349a
JB
303 ...
304 {
305 "unit": "A",
860ef183
JB
306 "measurand": "Current.Import",
307 "minimum": "0.5"
c94a349a
JB
308 },
309 ...
310 {
311 "unit": "Wh"
312 },
313 ...
314 ]
315 }
316 },
317```
318
3e1dfe42
JB
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
1816f743
JB
359### Charging station configuration
360
1c51fd1d 361**dist/assets/configurations/\<hashId\>.json**:
1816f743 362
a9ec2018 363The charging station configuration file is automatically generated at startup from the charging station configuration template file and is persistent.
1816f743
JB
364
365The 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
09810639 367#### stationInfo section (optional)
1816f743
JB
368
369The syntax is similar to charging station configuration template with some added fields like the charging station id (name) and the 'Configuration' section removed.
370
10211789 371That section is overwritten on matching charging station configuration template file changes.
1816f743 372
10211789
JB
373#### connectorsStatus section
374
375The syntax is similar to charging station configuration template 'Connectors' section with some added fields.
376
377That section is overwritten on matching charging station configuration template file changes.
1816f743 378
0aa874ce
JB
379#### evsesStatus section
380
381The syntax is similar to charging station configuration template 'Evses' section with some added fields.
382
383That section is overwritten on matching charging station configuration template file changes.
384
09810639 385#### automaticTransactionGenerator section (optional)
3a28512c
JB
386
387The syntax is similar to the charging station configuration template 'AutomaticTransactionGenerator' section.
388
10211789
JB
389That section is overwritten on matching charging station configuration template file changes.
390
391#### automaticTransactionGeneratorStatuses section
392
393That section is not overwritten on matching charging station configuration template file changes.
394
09810639 395#### configurationKey section (optional)
10211789
JB
396
397The syntax is similar to the charging station configuration template 'Configuration' section.
398
399That section is not overwritten on matching charging station configuration template file changes.
400
6f0ec20e
JB
401## Docker
402
403In the [docker](./docker) folder:
404
81ed2a48 405```shell
6f0ec20e
JB
406make
407```
408
673dceeb 409<!-- Or with the optional git submodules:
6f0ec20e 410
81ed2a48 411```shell
bfcad885 412make SUBMODULES_INIT=true
673dceeb 413``` -->
6f0ec20e
JB
414
415## OCPP-J commands supported
c94a349a
JB
416
417### Version 1.6
418
c56d42f1 419#### Core Profile
6f0ec20e 420
778f7924
JB
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
91a7d3ea 426- :white_check_mark: DataTransfer
778f7924
JB
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
6f0ec20e 437
c56d42f1 438#### Firmware Management Profile
6f0ec20e 439
b652b0c3 440- :white_check_mark: GetDiagnostics
d50343bd 441- :white_check_mark: DiagnosticsStatusNotification
c9a4f9ea
JB
442- :white_check_mark: FirmwareStatusNotification
443- :white_check_mark: UpdateFirmware
6f0ec20e 444
c56d42f1 445#### Local Auth List Management Profile
6f0ec20e 446
9e1b12e4
JB
447- :x: GetLocalListVersion
448- :x: SendLocalList
6f0ec20e 449
c56d42f1 450#### Reservation Profile
6f0ec20e 451
24578c31
JB
452- :white_check_mark: CancelReservation
453- :white_check_mark: ReserveNow
6f0ec20e 454
c56d42f1 455#### Smart Charging Profile
6f0ec20e 456
778f7924 457- :white_check_mark: ClearChargingProfile
e1d9a0f4 458- :white_check_mark: GetCompositeSchedule
778f7924 459- :white_check_mark: SetChargingProfile
6f0ec20e 460
c56d42f1 461#### Remote Trigger Profile
6f0ec20e 462
802cfa13 463- :white_check_mark: TriggerMessage
7dde0b73 464
d4371252
JB
465### Version 2.x.x
466
467#### Provisioning
468
469- :white_check_mark: BootNotification
470
bc950df1 471#### Authorization
d4371252
JB
472
473- :white_check_mark: ClearCache
474
475#### Availability
476
477- :white_check_mark: StatusNotification
478- :white_check_mark: Heartbeat
479
7e1dc878
JB
480## OCPP-J standard parameters supported
481
3a28512c 482All 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.
7e1dc878
JB
483
484### Version 1.6
485
c56d42f1 486#### Core Profile
7e1dc878
JB
487
488- :white_check_mark: AuthorizeRemoteTxRequests (type: boolean) (units: -)
489- :x: ClockAlignedDataInterval (type: integer) (units: seconds)
291cb255 490- :white_check_mark: ConnectionTimeOut (type: integer) (units: seconds)
7e1dc878
JB
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: -)
36f6a92e 505- :white_check_mark: SupportedFeatureProfiles (type: CSL) (units: -)
7e1dc878
JB
506- :x: TransactionMessageAttempts (type: integer) (units: times)
507- :x: TransactionMessageRetryInterval (type: integer) (units: seconds)
508- :x: UnlockConnectorOnEVSideDisconnect (type: boolean) (units: -)
36f6a92e 509- :white_check_mark: WebSocketPingInterval (type: integer) (units: seconds)
7e1dc878 510
c56d42f1 511#### Firmware Management Profile
7e1dc878 512
e7aeea18 513- _none_
7e1dc878 514
c56d42f1 515#### Local Auth List Management Profile
7e1dc878 516
36f6a92e 517- :white_check_mark: LocalAuthListEnabled (type: boolean) (units: -)
7e1dc878
JB
518- :x: LocalAuthListMaxLength (type: integer) (units: -)
519- :x: SendLocalListMaxLength (type: integer) (units: -)
520
c56d42f1 521#### Reservation Profile
7e1dc878 522
66dd3447 523- :white_check_mark: ReserveConnectorZeroSupported (type: boolean) (units: -)
7e1dc878 524
c56d42f1 525#### Smart Charging Profile
7e1dc878
JB
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
c56d42f1 532#### Remote Trigger Profile
7e1dc878 533
e7aeea18 534- _none_
7e1dc878 535
d4371252
JB
536### Version 2.x.x
537
e35d61ad 538## UI Protocol
32de5a57 539
6ca7a41d 540Protocol to control the simulator via a Websocket or HTTP server:
32de5a57 541
5d8bbc63
JB
542```mermaid
543sequenceDiagram
544Client->>UI Server: request
545UI Server->>Client: response
738acbf7 546Note over UI Server,Client: HTTP or Websocket
5d8bbc63
JB
547```
548
02cde3b7 549### Websocket Protocol
32de5a57 550
02cde3b7 551SRPC protocol over Websocket. PDU stands for 'Protocol Data Unit'.
32de5a57 552
03ebf4c1
JB
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
32de5a57 558
03ebf4c1
JB
559- Response:
560 [`uuid`, `PDU`]
561 `uuid`: String uniquely linking the response to the request
02cde3b7 562 `PDU`: Response parameters to requested procedure
32de5a57 563
c03dea88 564To 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.
97c19696 565
d3140adc 566#### Version 0.0.1
4e3ff94d 567
02cde3b7 568Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`.
4e3ff94d 569
d3140adc 570##### Procedures
32de5a57 571
a997fb63
JB
572###### Simulator State
573
574- Request:
575 `ProcedureName`: 'simulatorState'
576 `PDU`: {}
577
578- Response:
579 `PDU`: {
df893e68 580 `status`: 'success' | 'failure',
a997fb63 581 `state`: {
df893e68 582 `version`: string,
74bb0739 583 `configuration`: ConfigurationData,
df893e68 584 `started`: boolean,
a997fb63
JB
585 `templateStatistics`: Record<string, TemplateStatistics>
586 }
587 }
588
d3140adc 589###### Start Simulator
5612b691 590
03ebf4c1
JB
591- Request:
592 `ProcedureName`: 'startSimulator'
593 `PDU`: {}
5612b691 594
03ebf4c1
JB
595- Response:
596 `PDU`: {
6ca7a41d 597 `status`: 'success' | 'failure'
03ebf4c1 598 }
5612b691 599
d3140adc 600###### Stop Simulator
5612b691 601
03ebf4c1
JB
602- Request:
603 `ProcedureName`: 'stopSimulator'
604 `PDU`: {}
5612b691 605
03ebf4c1
JB
606- Response:
607 `PDU`: {
6ca7a41d
JB
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,
95c7658e
JB
629 `numberOfStations`: number,
630 `options?`: {
6eb63615 631 `supervisionUrls?`: string | string[],
9a08f38e 632 `persistentConfiguration?`: boolean,
52c58949 633 `autoStart?`: boolean,
43e04bb7
JB
634 `autoRegister?`: boolean,
635 `enableStatistics?`: boolean,
1feac591
JB
636 `ocppStrictCompliance?`: boolean,
637 `stopTransactionsOnStopped?`: boolean
95c7658e 638 }
6ca7a41d
JB
639 }
640
641- Response:
642 `PDU`: {
5aeeae82 643 `status`: 'success' | 'failure',
3b09e788
JB
644 `hashIdsSucceeded`: charging station unique identifier strings array (optional),
645 `hashIdsFailed`: charging station unique identifier strings array (optional)
03ebf4c1 646 }
5612b691 647
09e5a7a8
JB
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
1e534dab
JB
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),
a66bbcfe 671 `url`: string
1e534dab
JB
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
a66bbcfe
JB
682###### Performance Statistics
683
684- Request:
685 `ProcedureName`: 'performanceStatistics'
686 `PDU`: {}
687
688- Response:
689 `PDU`: {
df893e68 690 `status`: 'success' | 'failure',
a66bbcfe
JB
691 `performanceStatistics`: Statistics[]
692 }
693
d3140adc 694###### List Charging Stations
32de5a57 695
03ebf4c1
JB
696- Request:
697 `ProcedureName`: 'listChargingStations'
698 `PDU`: {}
32de5a57 699
03ebf4c1
JB
700- Response:
701 `PDU`: {
6ca7a41d
JB
702 `status`: 'success' | 'failure',
703 `chargingStations`: ChargingStationData[]
03ebf4c1 704 }
32de5a57 705
d3140adc 706###### Start Charging Station
80a3704c 707
03ebf4c1
JB
708- Request:
709 `ProcedureName`: 'startChargingStation'
710 `PDU`: {
6ca7a41d 711 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
03ebf4c1 712 }
80a3704c 713
03ebf4c1
JB
714- Response:
715 `PDU`: {
6ca7a41d
JB
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)
03ebf4c1 720 }
80a3704c 721
d3140adc 722###### Stop Charging Station
80a3704c 723
03ebf4c1
JB
724- Request:
725 `ProcedureName`: 'stopChargingStation'
726 `PDU`: {
6ca7a41d 727 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
03ebf4c1 728 }
80a3704c 729
03ebf4c1
JB
730- Response:
731 `PDU`: {
6ca7a41d
JB
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)
03ebf4c1 736 }
80a3704c 737
d3140adc 738###### Open Connection
e4df816e 739
03ebf4c1
JB
740- Request:
741 `ProcedureName`: 'openConnection'
742 `PDU`: {
6ca7a41d 743 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
03ebf4c1 744 }
e4df816e 745
03ebf4c1
JB
746- Response:
747 `PDU`: {
6ca7a41d
JB
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)
03ebf4c1 752 }
e4df816e 753
d3140adc 754###### Close Connection
e4df816e 755
03ebf4c1
JB
756- Request:
757 `ProcedureName`: 'closeConnection'
758 `PDU`: {
6ca7a41d 759 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
03ebf4c1
JB
760 }
761
762- Response:
763 `PDU`: {
6ca7a41d
JB
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)
853ed24a
JB
768 }
769
770###### Start Automatic Transaction Generator
771
772- Request:
773 `ProcedureName`: 'startAutomaticTransactionGenerator'
774 `PDU`: {
6ca7a41d
JB
775 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
776 `connectorIds`: connector id integer array (optional, default: all connectors)
853ed24a
JB
777 }
778
779- Response:
780 `PDU`: {
6ca7a41d
JB
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)
853ed24a
JB
785 }
786
787###### Stop Automatic Transaction Generator
788
789- Request:
790 `ProcedureName`: 'stopAutomaticTransactionGenerator'
791 `PDU`: {
6ca7a41d
JB
792 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
793 `connectorIds`: connector id integer array (optional, default: all connectors)
853ed24a
JB
794 }
795
796- Response:
797 `PDU`: {
6ca7a41d
JB
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)
03ebf4c1
JB
802 }
803
91a7d3ea 804###### OCPP commands trigger
a9ed42b2 805
82cbef8d
JB
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`
1e534dab 811 } (the OCPP command payload with some optional fields added to target the simulated charging stations)
10db00b2 812
82cbef8d 813- Response:
7f9d5299 814 `PDU`: {
82cbef8d
JB
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)
1e534dab 819 }
10db00b2 820
91a7d3ea 821Examples:
10db00b2 822
91a7d3ea 823- **Start Transaction**
a9ed42b2 824
91a7d3ea
JB
825 - Request:
826 `ProcedureName`: 'startTransaction'
827 `PDU`: {
6ca7a41d
JB
828 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
829 `connectorId`: connector id integer,
830 `idTag`: RFID tag string
91a7d3ea
JB
831 }
832
833 - Response:
834 `PDU`: {
6ca7a41d
JB
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)
91a7d3ea
JB
839 }
840
841- **Stop Transaction**
842
843 - Request:
844 `ProcedureName`: 'stopTransaction'
845 `PDU`: {
6ca7a41d
JB
846 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations),
847 `transactionId`: transaction id integer
91a7d3ea
JB
848 }
849
850 - Response:
851 `PDU`: {
1e534dab 852 `status`: 'success' | 'failure',
6ca7a41d
JB
853 `hashIdsSucceeded`: charging station unique identifier strings array,
854 `hashIdsFailed`: charging station unique identifier strings array (optional),
855 `responsesFailed`: failed responses payload array (optional)
91a7d3ea
JB
856 }
857
858- **Status Notification**
859
860 - Request:
82cbef8d 861 `ProcedureName`: 'statusNotification'
91a7d3ea 862 `PDU`: {
6ca7a41d
JB
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
91a7d3ea
JB
867 }
868
869 - Response:
870 `PDU`: {
6ca7a41d
JB
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)
91a7d3ea
JB
875 }
876
877- **Heartbeat**
878
879 - Request:
82cbef8d 880 `ProcedureName`: 'heartbeat'
91a7d3ea 881 `PDU`: {
5aeeae82 882 `hashIds`: charging station unique identifier strings array (optional, default: all charging stations)
91a7d3ea
JB
883 }
884
885 - Response:
886 `PDU`: {
6ca7a41d
JB
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)
91a7d3ea 891 }
a9ed42b2 892
6ca7a41d
JB
893### HTTP Protocol
894
895To 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
251fff5c 897## Support, Feedback, Contributing
7dde0b73 898
f80e9e18 899This 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).
7dde0b73 900
251fff5c
JB
901## Code of Conduct
902
f80e9e18 903We 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.
251fff5c
JB
904
905## Licensing
906
f80e9e18 907Copyright 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).