Before you begin
Install SPX with the Modbus package and SPX UI. Have a Modbus TCP client ready. Use the iEM3000 YAML linked in the communication reference.
Run the test
- In Models → Load model from file, import the meter YAML. Create a fresh instance from that registered model with
modbus_port=5023andmodbus_unit_id=1. Start it and confirm RUNNING. - Connect your client to the reachable SPX host and published TCP port. Select FC04, raw start address 3000 and count 2. Decode the result as Float32, big-endian bytes and words. Expect 12 A.
- Keep polling. In SPX Scenarios, start
peak_demandand let the 30-second scenario finish.
Check the result
The current reads 12 → 45 → 12 A. This exercise reads input registers; it does not require a Modbus write. Choose Stop instance when finished.
Protocol communication
Use these settings and messages with the library’s iEM3000 meter model.
- Client / transport
- Modbus TCP → SPX_HOST:5023; unit ID 1
- Docker example
- Our capture maps host TCP 15023 → adapter 5023; use your published port
- Value format
- Float32; 2 consecutive 16-bit registers; big-endian bytes and words
Replace host placeholders with reachable addresses and use your published ports.
Swipe the table to see requests and replies.
| Address / message | Operation / payload | Expected reply |
|---|---|---|
3000–3001 | FC04; start 3000; count 2 — phase L1 current | 12.0 A at the nominal baseline |
3010–3011 | FC04; start 3010; count 2 — average current | About 11.23 A after the first simulation updates |
3028–3029 | FC04; start 3028; count 2 — L1-to-neutral voltage | 230.0 V at the nominal baseline |
3110–3111 | FC04; start 3110; count 2 — frequency | 50.0 Hz at the nominal baseline |
45100–45101 | FC03; start 45100; count 2 — imported energy | Float32 kWh total; increases while the meter runs |
Values describe this model’s nominal setup unless noted. Live measurements change as the simulation runs.
Example request and reply
Poll 3000/count 2, run peak_demand in SPX, and verify 12 → 45 → 12 A. This exercise reads measurements; no Modbus write is needed.
ReadInputRegisters(unit=1, address=3000, count=2)
→ words [0x4140, 0x0000] → Float32 big-endian: 12.0 A
During peak_demand:
→ words [0x4234, 0x0000] → 45.0 ANo reply or an unexpected value?
- SPX_HOST is the reachable server host, not the listen address 0.0.0.0. The published port may differ from 5023.
- Addresses are raw zero-based addresses. Use input registers/FC04 for current and holding registers/FC03 for energy. Do not add a 3xxxx/4xxxx display prefix to the raw address.
- Unexpected near-zero or huge numbers usually mean the wrong Float32 byte/word order. Read both registers together.
Next steps
See the meter walkthrough and its load-pulse chart. For adapter settings, use the MODBUS guide.
