X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=README.md;h=8493060d7a9f549b18d8b05c26a2682abc7036b6;hb=eaad6e5cf27bf830e4c2ac3a68003a5c09979f23;hp=a515a6c9256625cba48843a2a9684c4725fa7ff4;hpb=156cab2c873524cf2d45013d98679b32910b40b0;p=e-mobility-charging-stations-simulator.git diff --git a/README.md b/README.md index a515a6c9..8493060d 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ ## Summary -Simple [node.js](https://nodejs.org/) software to simulate a set of charging stations based on the OCPP-J 1.6 protocol as part of SAP e-Mobility solution. +Simple [node.js](https://nodejs.org/) software to simulate and scale a set of charging stations based on the OCPP-J 1.6 protocol as part of SAP e-Mobility solution. ## Prerequisites @@ -53,7 +53,7 @@ To start the program, run: `npm start`. ## Start Web UI -See Web UI [README.md](src/ui/web/README.md) for more information. +See Web UI [README.md](ui/web/README.md) for more information. ## Configuration files syntax @@ -90,22 +90,23 @@ But the modifications to test have to be done to the files in the build target d **src/assets/config.json**: -| Key | Value(s) | Default Value | Value type | Description | -| -------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -| supervisionUrls | | [] | string \| string[] | string or array of global connection URIs to OCPP-J servers | -| supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | boolean | supervision urls distribution policy to simulated charging stations | -| logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs | -| logConsole | true/false | false | boolean | output logs on the console | -| logFormat | | simple | string | winston log format | -| logRotate | true/false | true | boolean | enable daily log files rotation | -| logMaxFiles | | 7 | integer | maximum number of log files to keep | -| logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | winston logging level | -| logFile | | combined.log | string | log file relative path | -| logErrorFile | | error.log | string | error log file relative path | -| worker | | {
"processType": "workerSet",
"startDelay": 500,
"elementStartDelay": 0,
"elementsPerWorker": 1,
"poolMinSize": 4,
"poolMaxSize": 16,
"poolStrategy": "FAIR_SHARE"
} | {
processType: WorkerProcessType;
startDelay: number;
elementStartDelay: number;
elementsPerWorker: number;
poolMinSize: number;
poolMaxSize: number;
poolStrategy: WorkerChoiceStrategy;
} | Worker configuration section:
- processType: worker threads process type (workerSet/staticPool/dynamicPool)
- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)
- elementStartDelay: milliseconds to wait at charging station startup
- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type
- poolMinSize: worker threads pool minimum number of threads
- poolMaxSize: worker threads pool maximum number of threads
- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy | -| uiServer | | {
"enabled": true,
"type": "ws",
"options": {
"host": "localhost",
"port": 8080
}
} | {
enabled: boolean;
type: ApplicationProtocol;
options: ServerOptions;
authentication: {
enabled: boolean;
type: AuthenticationType;
username: string;
password: string;
}
} | UI server configuration section | -| performanceStorage | | {
"enabled": false,
"type": "jsonfile",
"file:///performanceRecords.json"
} | {
enabled: boolean;
type: string;
URI: string;
}
where type can be 'jsonfile' or 'mongodb' | performance storage configuration section | -| stationTemplateUrls | | {}[] | {
file: string;
numberOfStations: number;
}[] | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations) | +| Key | Value(s) | Default Value | Value type | Description | +| -------------------------- | ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | +| supervisionUrls | | [] | string \| string[] | string or array of global connection URIs to OCPP-J servers | +| supervisionUrlDistribution | round-robin/random/charging-station-affinity | charging-station-affinity | boolean | supervision urls distribution policy to simulated charging stations | +| logStatisticsInterval | | 60 | integer | seconds between charging stations statistics output in the logs | +| logConsole | true/false | false | boolean | output logs on the console | +| logFormat | | simple | string | [winston](https://github.com/winstonjs/winston) log format | +| logRotate | true/false | true | boolean | enable daily log files rotation | +| logMaxFiles | x, "xd" where x is an integer | undefined | integer \| string | maximum number of log files | +| logMaxSize | x, "xk", "xm", "xg" where x is a number | undefined | number \| string | maximum size of log files in bytes, or units of kB, mB, and gB | +| logLevel | emerg/alert/crit/error/warning/notice/info/debug | info | string | [winston](https://github.com/winstonjs/winston) logging level | +| logFile | | combined.log | string | log file relative path | +| logErrorFile | | error.log | string | error log file relative path | +| worker | | {
"processType": "workerSet",
"startDelay": 500,
"elementStartDelay": 0,
"elementsPerWorker": 1,
"poolMinSize": 4,
"poolMaxSize": 16,
"poolStrategy": "ROUND_ROBIN"
} | {
processType: WorkerProcessType;
startDelay: number;
elementStartDelay: number;
elementsPerWorker: number;
poolMinSize: number;
poolMaxSize: number;
poolStrategy: WorkerChoiceStrategy;
} | Worker configuration section:
- processType: worker threads process type (workerSet/staticPool/dynamicPool)
- startDelay: milliseconds to wait at worker threads startup (only for workerSet threads process type)
- elementStartDelay: milliseconds to wait at charging station startup
- elementsPerWorker: number of charging stations per worker threads for the `workerSet` process type
- poolMinSize: worker threads pool minimum number of threads
- poolMaxSize: worker threads pool maximum number of threads
- poolStrategy: worker threads pool [poolifier](https://github.com/poolifier/poolifier) worker choice strategy | +| uiServer | | {
"enabled": true,
"type": "ws",
"options": {
"host": "localhost",
"port": 8080
}
} | {
enabled: boolean;
type: ApplicationProtocol;
options: ServerOptions;
authentication: {
enabled: boolean;
type: AuthenticationType;
username: string;
password: string;
}
} | UI server configuration section | +| performanceStorage | | {
"enabled": false,
"type": "jsonfile",
"file:///performanceRecords.json"
} | {
enabled: boolean;
type: string;
URI: string;
}
where type can be 'jsonfile' or 'mongodb' | performance storage configuration section | +| stationTemplateUrls | | {}[] | {
file: string;
numberOfStations: number;
}[] | array of charging station configuration templates URIs configuration section (charging station configuration template file name and number of stations) | #### Worker process model @@ -170,7 +171,8 @@ But the modifications to test have to be done to the files in the build target d | mainVoltageMeterValues | true/false | true | boolean | include charging stations main voltage MeterValues on three phased charging stations | | phaseLineToLineVoltageMeterValues | true/false | true | boolean | include charging stations line to line voltage MeterValues on three phased charging stations | | customValueLimitationMeterValues | true/false | true | boolean | enable limitation on custom fluctuated value in MeterValues | -| commandsSupport | | {
"incomingCommands": {},
"outgoingCommands": {}
} | {
incomingCommands: Record;
outgoingCommands?: Record;
} | Configuration section for OCPP commands support. Empty section or subsections means all implemented commands are supported | +| commandsSupport | | {
"incomingCommands": {},
"outgoingCommands": {}
} | {
incomingCommands: Record;
outgoingCommands?: Record;
} | Configuration section for OCPP commands support. Empty section or subsections means all implemented OCPP commands are supported | +| messageTriggerSupport | | {} | Record | Configuration section for OCPP commands trigger support. Empty section means all implemented OCPP trigger commands are supported | | Configuration | | | ChargingStationConfiguration | charging stations OCPP parameters configuration section | | AutomaticTransactionGenerator | | | AutomaticTransactionGenerator | charging stations ATG configuration section | | Connectors | | | Connectors | charging stations connectors configuration section | @@ -309,7 +311,7 @@ make SUBMODULES_INIT=true - :white_check_mark: ChangeAvailability - :white_check_mark: ChangeConfiguration - :white_check_mark: ClearCache -- :x: DataTransfer +- :white_check_mark: DataTransfer - :white_check_mark: GetConfiguration - :white_check_mark: Heartbeat - :white_check_mark: MeterValues @@ -410,7 +412,7 @@ Protocol to control the simulator via a Websocket or HTTP server. ### HTTP Protocol -To learn how to use the HTTP protocol to pilot the simulator, an [Insomnia](https://insomnia.rest/) requests collection is available in [src/assets/ui-protocol](./src/assets/ui-protocol) directory. +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. ### Websocket Protocol @@ -427,6 +429,8 @@ SRPC protocol over Websocket. PDU stands for 'Protocol Data Unit'. `uuid`: String uniquely linking the response to the request `PDU`: Response parameters to requested procedure +An [Insomnia](https://insomnia.rest/) WebSocket requests collection is available in [src/assets/ui-protocol](./src/assets/ui-protocol) directory. + #### Version 0.0.1 Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. @@ -467,48 +471,12 @@ Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. `chargingStations`: ChargingStationData[] } -###### Start Transaction - -- Request: - `ProcedureName`: 'startTransaction' - `PDU`: { - `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), - `connectorId`: connector id integer, - `idTag`: RFID tag string - } - -- Response: - `PDU`: { - `status`: 'success' | 'failure', - `hashIdsSucceeded`: charging station unique identifier strings array, - `hashIdsFailed`: charging station unique identifier strings array (optional), - `responsesFailed`: failed responses payload array (optional) - } - -###### Stop Transaction - -- Request: - `ProcedureName`: 'stopTransaction' - `PDU`: { - `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), - `transactionId`: transaction id integer - } - -- Response: - `PDU`: { - `status`: 'success' | 'failure', - `hashIdsSucceeded`: charging station unique identifier strings array, - `hashIdsFailed`: charging station unique identifier strings array (optional), - `responsesFailed`: failed responses payload array (optional) - } - ###### Start Charging Station - Request: `ProcedureName`: 'startChargingStation' `PDU`: { - `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), - `responsesFailed`: failed responses payload array (optional) + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations) } - Response: @@ -516,6 +484,7 @@ Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. `status`: 'success' | 'failure', `hashIdsSucceeded`: charging station unique identifier strings array, `hashIdsFailed`: charging station unique identifier strings array (optional) + `responsesFailed`: failed responses payload array (optional) } ###### Stop Charging Station @@ -600,40 +569,94 @@ Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. `responsesFailed`: failed responses payload array (optional) } -###### Status Notification +###### OCPP commands trigger - Request: - `ProcedureName`: 'StatusNotification' + `ProcedureName`: 'commandName' (the OCPP command name in camel case) `PDU`: { - `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), - `connectorId`: connector id integer, - `errorCode`: connector error code, - `status`: connector status - } + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + ...`commandPayload` + } (the OCPP command payload with some optional fields added to target the simulated charging stations) - Response: - `PDU`: { - `status`: 'success' | 'failure', - `hashIdsSucceeded`: charging station unique identifier strings array, - `hashIdsFailed`: charging station unique identifier strings array (optional), - `responsesFailed`: failed responses payload array (optional) - } + `PDU`: { + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) + } + +Examples: + +- **Start Transaction** + + - Request: + `ProcedureName`: 'startTransaction' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `connectorId`: connector id integer, + `idTag`: RFID tag string + } -###### Heartbeat + - Response: + `PDU`: { + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) + } -- Request: - `ProcedureName`: 'Heartbeat' - `PDU`: { - `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), - } +- **Stop Transaction** -- Response: - `PDU`: { - `status`: 'success' | 'failure', - `hashIdsSucceeded`: charging station unique identifier strings array, - `hashIdsFailed`: charging station unique identifier strings array (optional), - `responsesFailed`: failed responses payload array (optional) - } + - Request: + `ProcedureName`: 'stopTransaction' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `transactionId`: transaction id integer + } + + - Response: + `PDU`: { + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) + } + +- **Status Notification** + + - Request: + `ProcedureName`: 'statusNotification' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `connectorId`: connector id integer, + `errorCode`: connector error code, + `status`: connector status + } + + - Response: + `PDU`: { + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) + } + +- **Heartbeat** + + - Request: + `ProcedureName`: 'heartbeat' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + } + + - Response: + `PDU`: { + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) + } ## Support, Feedback, Contributing