Simple, configurable, terminaland UI based OCPP Charging Station simulator written in Node.js with S
10K+
Simple, configurable, terminal-based OCPP Charging Station simulator written in Node.js with Schema validation.
Run:
npm install
Configure env variables:
WS_URL - websocket endpoint
CP_ID - ID of this VCP
PASSWORD - if used for OCPP Authentication, otherwise can be left blank
ADMIN_PORT - port for admin access (default is 9999), can be left blank
LOG_LEVEL - Log level, can be left blank
CP_TYPE - available chargepoint types to start, allowed values: 16, 20, 21 (default is 16)
POWER - Chargepoint power in kW (7.4 or 22 for example), can be left blank. (default is 7.4)
CP_NB_SOCKETS - number of connectors of chargepoint (default is 1)
CP_VENDOR - Chargepoint vendor, can be left blank
CP_MODEL - Chargepoint model, can be left blank
CP_SN - Chargepoint serial Number, can be left blank
CP_FW_VERSION - Chargepoint serial number, can be left blank
CP_METER_INTERVALSEC - Interval in seconds for metervalue in transaction, can be left blank
Run OCPP 1.6:
WS_URL=ws://localhost:3000 CP_ID=vcp_16_test CP_TYPE=16 npx tsx ./start.ts
Run OCPP 2.0.1:
WS_URL=ws://localhost:3000 CP_ID=vcp_201_test CP_TYPE=20 npx tsx ./start.ts
Run OCPP 2.1:
WS_URL=ws://localhost:3000 CP_ID=vcp_21_test CP_TYPE=21 npx tsx ./start.ts
When testing different configurations, you can create multiple .env files and pass the env file as an argument, for example:
npx tsx --env-file=.env2 ./start.ts
> WS_URL=ws://localhost:3000 CP_ID=vcp_16_test npx tsx ./start.ts
2023-03-27 13:09:17 info: Connecting... | {
endpoint: 'ws://localhost:3000',
chargePointId: 'vcp_16_test',
ocppVersion: 'OCPP_1.6',
basicAuthPassword: 'password',
adminWsPort: 9999
}
2023-03-27 13:09:17 info: Sending message ➡️ [2,"5fe44756-05e1-4065-9c91-11b456b55913","BootNotification",{"chargePointVendor":"Solidstudio","chargePointModel":"test","chargePointSerialNumber":"S001","firmwareVersion":"1.0.0"}]
2023-03-27 13:09:17 info: Sending message ➡️ [2,"aad8d05d-3a6b-4c51-a9fc-7275d4a6cbc3","StatusNotification",{"connectorId":1,"errorCode":"NoError","status":"Available"}]
2023-03-27 13:09:17 info: Receive message ⬅️ [3,"5fe44756-05e1-4065-9c91-11b456b55913",{"currentTime":"2023-03-27T11:09:17.883Z","interval":30,"status":"Accepted"}]
2023-03-27 13:09:17 info: Receive message ⬅️ [2,"658c8f5b-9f86-487f-91f8-1d656453978a","ChangeConfiguration",{"key":"MeterValueSampleInterval","value":"60"}]
2023-03-27 13:09:17 info: Responding with ➡️ [3,"658c8f5b-9f86-487f-91f8-1d656453978a",{"status":"Accepted"}]
2023-03-27 13:09:17 info: Receive message ⬅️ [2,"34fc4673-deff-48d3-bb8e-d94d75fa619a","GetConfiguration",{"key":["SupportedFeatureProfiles"]}]
2023-03-27 13:09:17 info: Responding with ➡️ [3,"34fc4673-deff-48d3-bb8e-d94d75fa619a",{"configurationKey":[{"key":"SupportedFeatureProfiles","readonly":true,"value":"Core,FirmwareManagement,LocalAuthListManagement,Reservation,SmartCharging,RemoteTrigger"},{"key":"ChargeProfileMaxStackLevel","readonly":true,"value":"99"},{"key":"HeartbeatInterval","readonly":false,"value":"300"},{"key":"GetConfigurationMaxKeys","readonly":true,"value":"99"}]}]
2023-03-27 13:09:17 info: Receive message ⬅️ [3,"aad8d05d-3a6b-4c51-a9fc-7275d4a6cbc3",{}]
2023-03-27 13:09:18 info: Receive message ⬅️ [2,"d7610ad2-63d0-470f-9bd9-6e47d5483429","SetChargingProfile",{"connectorId":0,"csChargingProfiles":{"chargingProfileId":30,"stackLevel":0,"chargingProfilePurpose":"ChargePointMaxProfile","chargingProfileKind":"Absolute","chargingSchedule":{"chargingRateUnit":"A","chargingSchedulePeriod":[{"startPeriod":0,"limit":10.0}]}}}]
2023-03-27 13:09:18 info: Responding with ➡️ [3,"d7610ad2-63d0-470f-9bd9-6e47d5483429",{"status":"Accepted"}]
2023-03-27 13:10:17 info: Sending message ➡️ [2,"79a41b2e-2c4a-4a65-9d7e-417967a8f95f","Heartbeat",{}]
2023-03-27 13:10:17 info: Receive message ⬅️ [3,"79a41b2e-2c4a-4a65-9d7e-417967a8f95f",{"currentTime":"2023-03-27T11:10:17.955Z"}]
cd docker && docker compose up --build
Some messages are automatically sent by the VCP, for example, BootNotification or StartTransaction and StopTransaction.
However, for Operations initiated by Charge Point (compare e.g. with OCPP 1.6, Chapter 4) one can send the messages using admin functionality.
VCP exposes a separate Websocket endpoint that will "proxy" all messages to Central System Websocket.
For example usage, see admin/ folder.
npx tsx admin/v16/Authorize/authorize.ts
You can send admin commands by a simple web interface available at http://your-ip-address:ADMIN_PORT
Please use the issue tracker to report any bugs or file feature requests.
We encourage contributions through pull requests and follow the standard "fork-and-pull" git workflow. Feel free to create a fork of the repository, make your changes, and submit a pull request for review. We appreciate your contributions!
When creating your pull request, please include a clear description of the changes you have made, and any relevant context or reasoning behind those changes.
Content type
Image
Digest
sha256:bd777d911…
Size
82 MB
Last updated
9 months ago
docker pull wocha/ocpp-cp-virtual