How to Use the EV Charger Simulator
Purpose
Drive a simulated OCPP charge point: plug and unplug a vehicle, watch the transaction, its state of charge, power and energy, and let the EMS's dynamic load balancing act on it.
Prerequisites
- Simulator stack up.
- The simulator container's charging pile is connected to the OCPP server.
- The EMS is configured to see the charge point.
Two channels: OCPP and Modbus
A charging pile has two separate faces in this simulator:
| Channel | What it carries | Where it lives |
|---|---|---|
| OCPP over WebSocket | Charge-point and session messaging | The OCPP page; the client starts with the container |
| Modbus TCP | The pile's register map (measurements 4000+, status 4060+, alarm flags 4080+, control 4120+) |
bess-simulator-backend:1630–:1641 for ev_charger1–ev_charger12 |
Both are real, and the EMS uses both: it polls the Modbus map for measurements and speaks OCPP to the same pile for sessions.
The Write Monitor will not show OCPP traffic
The Write Monitor records Modbus writes only. OCPP messages — including every EMS command to the charger — never appear there. Do not conclude "the EMS sent nothing" from an empty monitor; use the OCPP page instead. This is the single most common misreading of this page.
The OCPP page
Open OCPP (/ocpp). It polls GET /api/ocpp/charging on its own, so the
view stays live without refreshing.
| Column | Meaning |
|---|---|
| Charge point | The charge point identity |
| Connection | Whether it is connected to the OCPP server |
| OCPP status | The reported status |
| Vehicle | Vehicle identity, when a session reports one |
| Transaction | The active transaction id |
| SoC | State of charge |
| Power (kW) | Current charging power |
| Energy (kWh, session) | Energy delivered in this session |
| Last heartbeat | Last OCPP heartbeat |
| Plug | The plug/unplug control |
Step-by-step
Step 1 — Confirm the connection
Connection should show connected and Last heartbeat should be recent. If it is stale, the charge point is not talking to the OCPP server and nothing else on this page will behave.
Step 2 — Plug in a vehicle
Press the Plug control in the row. The form posts to ocpp.plug
(POST /ocpp/plug), which forwards to POST /api/ocpp/charging on the simulator
backend.
Step 3 — Watch the session start
Within a poll interval an OCPP status should appear, a Transaction id should be assigned, and Power (kW) should become non-zero.
Step 4 — Watch energy accumulate
Energy (kWh, session) increases while charging. This is the figure to compare against what the EMS believes it is allowing.
Step 5 — Observe the EMS's load balancing
When the EMS reduces available power, Power (kW) should fall to the new limit. Correlate the change with the EMS's own view, and with what it writes to the other devices — the EMS's balancing decision is a Modbus action elsewhere, which the Write Monitor will show, even though the charger's response is OCPP.
Step 6 — Unplug
Press the control again to disconnect. The transaction should end and power fall to zero.
Failing the OCPP link on purpose
The OCPP client is deliberately exempt from the device deny list — "the charger is
the point of the simulation" — so you cannot take it off the air from the
Active Models page. Fail it directly instead, from inside the simulator
container. That boundary matters: ocpp-backend is the central system for the
whole stack on host port 9000, so failing it there would drop every charge
point at once.
# take only this charge point's OCPP client down
docker exec bess-simulator-backend sh -c \
"kill \$(ps -eo pid,args | grep '[c]p_service' | awk '{print \$1}')"
Observed on the test host:
| Side | Before | After the kill | After recovery |
|---|---|---|---|
Simulator (ocpp_charger_status.json) |
connection: connected, heartbeats about every 7 s |
connection: stopped within 5 s, heartbeat frozen |
connected |
Central system (docker logs ocpp-backend) |
live session for CP-001 |
ocpp16.server: Disconnected: CP-001, session cleaned up |
Handshake OK: CP-001, then BootNotification |
Recovery is a simulator restart rather than an automatic respawn, so it takes roughly two minutes, not seconds:
docker restart bess-simulator-backend
Two cautions:
- Restarting the container also cycles every Modbus server, so it is not a way to fail the charger alone — it is only how the client comes back.
- Do not stop
ocpp-backendto test this. Many other containers reference it, so stopping it drops every charge point at once, including ones outside this simulator.
Functions the brief asks for that are NOT implemented
| Requested | Status |
|---|---|
| OCPP communication failure simulation | Not available through the deny list. start_simulator.sh deliberately exempts the OCPP client — "the charger is the point of the simulation, so it always runs with the container". Break connectivity to the OCPP server instead. The pile's Modbus map can be taken offline per device on Active Models |
| Charging power / current setpoint control from the simulator UI | Not present. The page reports power; it does not set it. Power follows the EMS's decision |
| Explicit OCPP 1.6J vs 2.0.1 selection | Only 1.6J is deployed, and there is no control to switch. The pile's client connects with subprotocol ocpp1.6 to ws://ocpp-backend:9000/ocpp/CP-001, and the live session reports connected with heartbeats; no 2.0.1 build exists anywhere in the stack |
Charging alarms are only triggerable if they exist in the alarm map for the relevant device.
Verification
| Check | Expected |
|---|---|
| Connection | Connected, recent heartbeat |
| Plug | Status and transaction appear, power rises |
| Energy | Session energy increases over time |
| Load balancing | Power follows the EMS's limit |
| Unplug | Transaction ends, power zero |
| EMS commands visible | In the Write Monitor only if they were Modbus to another device |
Troubleshooting
| Symptom | Cause | Fix |
|---|---|---|
| Nothing in the Write Monitor | OCPP is not Modbus | Read the OCPP page; this is expected |
| Heartbeat stale | Charging pile not connected to the OCPP server | Check the simulator container's logs and the OCPP server |
| Plug does nothing | The charge point is not connected | Fix the connection first |
| Power never rises | The EMS has not authorised charging | Check the EMS's limits and session state |
| Transaction id missing | No session started | Confirm the plug took effect |