1 # [charging-stations-simulator](https://github.com/jerome-benoit/charging-stations-simulator)
5 Simple [node.js](https://nodejs.org/) program to simulate a set of charging stations based on the OCPP-J 1.6 protocol.
7 ## Configuration syntax
9 All configuration files are in the JSON standard format.
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).
13 All charging station templates are in the directory [src/assets/station-templates](src/assets/station-templates).
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).
17 ### Global configuration
19 **src/assets/config.json**:
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; } where type can be 'jsonfile', 'mysql', 'mariadb', 'sqlite' or 'mongodb' | 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)
42 #### Worker process model:
45 Worker set executing each a static number (chargingStationsPerWorker) of simulated charging stations from the total
48 Statically sized worker pool executing a static total number of simulated charging stations
51 Dynamically sized worker pool executing a static total number of simulated charging stations
53 ### Charging station template
55 Key | Value(s) | Default Value | Value type | Description
56 --- | -------| --------------| ---------- | ------------
57 supervisionURL | | '' | string | connection URI to OCPP-J server
58 supervisionUser | | '' | string | basic HTTP authentication user to OCPP-J server
59 supervisionPassword | | '' | string | basic HTTP authentication password to OCPP-J server
60 ocppVersion | 1.6 | 1.6 | string | OCPP version
61 ocppProtocol | json | json | string | OCPP protocol
62 authorizationFile | | '' | string | RFID tags list file relative to src/assets path
63 baseName | | '' | string | base name to build charging stations name
64 nameSuffix | | '' | string | name suffix to build charging stations name
65 fixedName | true/false | false | boolean | use the baseName as the charging stations unique name
66 chargePointModel | | '' | string | charging stations model
67 chargePointVendor | | '' | string | charging stations vendor
68 chargeBoxSerialNumberPrefix | | '' | string | charging stations serial number prefix
69 firmwareVersion | | '' | string | charging stations firmware version
70 power | | | float\|float[] | charging stations maximum power value(s)
71 powerSharedByConnectors | true/false | false | boolean | charging stations power shared by its connectors
72 powerUnit | W/kW | W | string | charging stations power unit
73 currentOutType | AC/DC | AC | string | charging stations current out type
74 voltageOut | | AC:230/DC:400 | integer | charging stations voltage out
75 numberOfPhases | 0/1/3 | AC:3/DC:0 | integer | charging stations number of phase(s)
76 numberOfConnectors | | | integer\|integer[] | charging stations number of connector(s)
77 useConnectorId0 | true/false | true | boolean | use connector id 0 definition from the template
78 randomConnectors | true/false | false | boolean | randomize runtime connector id affectation from the connector id definition in template
79 resetTime | | 60 | integer | seconds to wait before the charging stations come back at reset
80 autoRegister | true/false | false | boolean | set the charging station as registered at boot notification for testing purpose
81 autoReconnectMaxRetries | | -1 (unlimited) | integer | connection retries to the OCPP-J server
82 reconnectExponentialDelay | true/false | false | boolean | connection delay retry to the OCPP-J server
83 registrationMaxRetries | | -1 (unlimited) | integer | charging stations boot notification retries
84 enableStatistics | true/false | true | boolean | enable charging stations statistics
85 mayAuthorizeAtRemoteStart | true/false | true | boolean | always send authorize at remote start transaction when AuthorizeRemoteTxRequests is enabled
86 beginEndMeterValues | true/false | false | boolean | enable Transaction.{Begin,End} MeterValues
87 outOfOrderEndMeterValues | true/false | false | boolean | send Transaction.End MeterValues out of order
88 meteringPerTransaction | true/false | true | boolean | enable metering history on a per transaction basis
89 transactionDataMeterValues | true/false | false | boolean | enable transaction data MeterValues at stop transaction
90 mainVoltageMeterValues | true/false | true | boolean | include charging station main voltage MeterValues on three phased charging stations
91 phaseLineToLineVoltageMeterValues | true/false | true | boolean | include charging station line to line voltage MeterValues on three phased charging stations
92 Configuration | | | ChargingStationConfiguration | charging stations OCPP parameters configuration section
93 AutomaticTransactionGenerator | | | AutomaticTransactionGenerator | charging stations ATG configuration section
94 Connectors | | | Connectors | charging stations connectors configuration section
96 #### Configuration section
100 "configurationKey": [
103 "key": "StandardKey",
105 "value": "StandardValue",
113 "value": "VendorValue",
122 #### AutomaticTransactionGenerator section
125 "AutomaticTransactionGenerator": {
129 "minDelayBetweenTwoTransactions": 15,
130 "maxDelayBetweenTwoTransactions": 30,
131 "probabilityOfStart": 1,
132 "stopAfterHours": 0.3,
133 "stopOnConnectionFailure": true,
134 "requireAuthorize": true
137 #### Connectors section
143 "bootStatus": "Available",
148 "measurand": "Power.Active.Import",
151 "fluctuationPercent": "10"
156 "measurand": "Current.Import"
170 To start the program, run: `npm start`.
174 In the [docker](./docker) folder:
180 Or without the optional git submodules:
183 make SUBMODULES_INIT=false
186 ## OCPP-J commands supported
192 - :white_check_mark: Authorize
193 - :white_check_mark: BootNotification
194 - :white_check_mark: ChangeAvailability
195 - :white_check_mark: ChangeConfiguration
196 - :white_check_mark: ClearCache
198 - :white_check_mark: GetConfiguration
199 - :white_check_mark: Heartbeat
200 - :white_check_mark: MeterValues
201 - :white_check_mark: RemoteStartTransaction
202 - :white_check_mark: RemoteStopTransaction
203 - :white_check_mark: Reset
204 - :white_check_mark: StartTransaction
205 - :white_check_mark: StatusNotification
206 - :white_check_mark: StopTransaction
207 - :white_check_mark: UnlockConnector
209 #### Firmware Management Profile
211 - :white_check_mark: GetDiagnostics
212 - :x: DiagnosticsStatusNotification
213 - :x: FirmwareStatusNotification
216 #### Local Auth List Management Profile
218 - :x: GetLocalListVersion
221 #### Reservation Profile
223 - :x: CancelReservation
226 #### Smart Charging Profile
228 - :white_check_mark: ClearChargingProfile
229 - :white_check_mark: GetCompositeSchedule
230 - :white_check_mark: SetChargingProfile
232 #### Remote Trigger Profile
234 - :white_check_mark: TriggerMessage
236 ## OCPP-J standard parameters supported
238 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.
244 - :white_check_mark: AuthorizeRemoteTxRequests (type: boolean) (units: -)
245 - :x: ClockAlignedDataInterval (type: integer) (units: seconds)
246 - :white_check_mark: ConnectionTimeOut (type: integer) (units: seconds)
247 - :x: GetConfigurationMaxKeys (type: integer) (units: -)
248 - :white_check_mark: HeartbeatInterval (type: integer) (units: seconds)
249 - :x: LocalAuthorizeOffline (type: boolean) (units: -)
250 - :x: LocalPreAuthorize (type: boolean) (units: -)
251 - :x: MeterValuesAlignedData (type: CSL) (units: -)
252 - :white_check_mark: MeterValuesSampledData (type: CSL) (units: -)
253 - :white_check_mark: MeterValueSampleInterval (type: integer) (units: seconds)
254 - :white_check_mark: NumberOfConnectors (type: integer) (units: -)
255 - :x: ResetRetries (type: integer) (units: times)
256 - :white_check_mark: ConnectorPhaseRotation (type: CSL) (units: -)
257 - :x: StopTransactionOnEVSideDisconnect (type: boolean) (units: -)
258 - :x: StopTransactionOnInvalidId (type: boolean) (units: -)
259 - :x: StopTxnAlignedData (type: CSL) (units: -)
260 - :x: StopTxnSampledData (type: CSL) (units: -)
261 - :white_check_mark: SupportedFeatureProfiles (type: CSL) (units: -)
262 - :x: TransactionMessageAttempts (type: integer) (units: times)
263 - :x: TransactionMessageRetryInterval (type: integer) (units: seconds)
264 - :x: UnlockConnectorOnEVSideDisconnect (type: boolean) (units: -)
265 - :white_check_mark: WebSocketPingInterval (type: integer) (units: seconds)
267 #### Firmware Management Profile
271 #### Local Auth List Management Profile
273 - :white_check_mark: LocalAuthListEnabled (type: boolean) (units: -)
274 - :x: LocalAuthListMaxLength (type: integer) (units: -)
275 - :x: SendLocalListMaxLength (type: integer) (units: -)
277 #### Reservation Profile
281 #### Smart Charging Profile
283 - :x: ChargeProfileMaxStackLevel (type: integer) (units: -)
284 - :x: ChargingScheduleAllowedChargingRateUnit (type: CSL) (units: -)
285 - :x: ChargingScheduleMaxPeriods (type: integer) (units: -)
286 - :x: MaxChargingProfilesInstalled (type: integer) (units: -)
288 #### Remote Trigger Profile
294 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.
296 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.