X-Git-Url: https://git.piment-noir.org/?a=blobdiff_plain;f=README.md;h=50b717bec0ff40ccac9f66389d83a8499d977df6;hb=64818750b8394051b2a77ccf27ea4c2ff2b7af6e;hp=63d48d98eae81e37333574abf1dc07e2438b286b;hpb=9afc34da2221e73aaa138881befbed8b4d849fe5;p=e-mobility-charging-stations-simulator.git diff --git a/README.md b/README.md index 63d48d98..50b717be 100644 --- a/README.md +++ b/README.md @@ -88,22 +88,22 @@ 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/sequential | round-robin | 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": "ROUND_ROBBIN"
} | {
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;
} | 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 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": "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: @@ -201,6 +201,25 @@ But the modifications to test have to be done to the files in the build target d #### AutomaticTransactionGenerator section +Section type definition: + +```ts +type AutomaticTransactionGeneratorConfiguration = { + enable: boolean; + minDuration: number; + maxDuration: number; + minDelayBetweenTwoTransactions: number; + maxDelayBetweenTwoTransactions: number; + probabilityOfStart: number; + stopAfterHours: number; + stopOnConnectionFailure: boolean; + requireAuthorize?: boolean; + idTagDistribution?: 'random' | 'round-robin' | 'connector-affinity'; +}; +``` + +Section example: + ```json "AutomaticTransactionGenerator": { "enable": false, @@ -211,7 +230,8 @@ But the modifications to test have to be done to the files in the build target d "probabilityOfStart": 1, "stopAfterHours": 0.3, "stopOnConnectionFailure": true, - "requireAuthorize": true + "requireAuthorize": true, + "idTagDistribution": "random" } ``` @@ -386,9 +406,13 @@ All kind of OCPP parameters are supported in a charging station configuration or Protocol to control the simulator via a Websocket or HTTP server. -### WebSocket Protocol +### 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. + +### Websocket Protocol -PDU stands for Protocol Data Unit. +SRPC protocol over Websocket. PDU stands for 'Protocol Data Unit'. - Request: [`uuid`, `ProcedureName`, `PDU`] @@ -399,15 +423,15 @@ PDU stands for Protocol Data Unit. - Response: [`uuid`, `PDU`] `uuid`: String uniquely linking the response to the request - `PDU`: Response data to requested procedure + `PDU`: Response parameters to requested procedure -### Version 0.0.1 +#### Version 0.0.1 -Set the WebSocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. +Set the Websocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. -#### Procedures +##### Procedures -##### Start Simulator +###### Start Simulator - Request: `ProcedureName`: 'startSimulator' @@ -415,10 +439,10 @@ Set the WebSocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. - Response: `PDU`: { - `status` + `status`: 'success' | 'failure' } -##### Stop Simulator +###### Stop Simulator - Request: `ProcedureName`: 'stopSimulator' @@ -426,10 +450,10 @@ Set the WebSocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. - Response: `PDU`: { - `status` + `status`: 'success' | 'failure' } -##### List Charging Stations +###### List Charging Stations - Request: `ProcedureName`: 'listChargingStations' @@ -437,96 +461,177 @@ Set the WebSocket header _Sec-Websocket-Protocol_ to `ui0.0.1`. - Response: `PDU`: { - `status`, - `index`: ChargingStationData, - ... - `index`: ChargingStationData + `status`: 'success' | 'failure', + `chargingStations`: ChargingStationData[] } -##### Start Transaction +###### Start Transaction - Request: `ProcedureName`: 'startTransaction' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array, + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), `connectorId`: connector id integer, `idTag`: RFID tag string } - Response: `PDU`: { - `status` + `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 +###### Stop Transaction - Request: `ProcedureName`: 'stopTransaction' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array, + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), `transactionId`: transaction id integer } - Response: `PDU`: { - `status` + `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 +###### Start Charging Station - Request: `ProcedureName`: 'startChargingStation' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `responsesFailed`: failed responses payload array (optional) } - Response: `PDU`: { - `status` + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional) } -##### Stop Charging Station +###### Stop Charging Station - Request: `ProcedureName`: 'stopChargingStation' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations) } - Response: `PDU`: { - `status` + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) } -##### Open Connection +###### Open Connection - Request: `ProcedureName`: 'openConnection' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations) } - Response: `PDU`: { - `status` + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) } -##### Close Connection +###### Close Connection - Request: `ProcedureName`: 'closeConnection' `PDU`: { - `hashId`: charging station unique identifier string (deprecated) | `hashIds`: charging station unique identifier strings array + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations) } - Response: `PDU`: { - `status` + `status`: 'success' | 'failure', + `hashIdsSucceeded`: charging station unique identifier strings array, + `hashIdsFailed`: charging station unique identifier strings array (optional), + `responsesFailed`: failed responses payload array (optional) } -### HTTP Protocol +###### Start Automatic Transaction Generator + +- Request: + `ProcedureName`: 'startAutomaticTransactionGenerator' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `connectorIds`: connector id integer array (optional, default: all connectors) + } + +- 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 Automatic Transaction Generator + +- Request: + `ProcedureName`: 'stopAutomaticTransactionGenerator' + `PDU`: { + `hashIds`: charging station unique identifier strings array (optional, default: all charging stations), + `connectorIds`: connector id integer array (optional, default: all connectors) + } + +- 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) + } -A Postman or [Insomnia](https://insomnia.rest/) collection, to learn how to use the HTTP protocol to pilot the simulator, is available. +###### 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