Before you begin
Install SPX with Modbus and SPX UI, and have a Modbus TCP client ready. This quickstart uses the ready-made iEM3000 meter model; there is no need to generate a model.
Run the test
1. Start the meter
- Select
Energy.EnergyMeterIem3000.Modbusin Instances → New instance. If needed, import the linked YAML through Models → Load model from file first. - Create and start an instance with adapter port 5023 and unit ID 1. Check Communication → modbus_slave for its settings.

2. Connect and read
- Connect your Modbus TCP client to the reachable host and published port; the host port can differ from the adapter port.
- Read input registers with FC04, unit 1, raw zero-based address 3000, count 2. Decode both words as Float32, big-endian byte and word order.
- The default phase L1 current is 12 A. Do not add a 3xxxx display prefix to the raw address.
3. Run a load change
- Continue polling while you start
peak_demandin Scenarios. Allow the 30-second scenario to finish. - The client should observe current rising to 45 A, then returning to 12 A. Timing matters: keep polling throughout the run.

Check the result
In our test, FC04 returned words 0x4234 0x0000 during the peak, which decode to 45.0 A. This example reads input registers; no Modbus write is required. Stop your test 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.
Ask your AI agent
Open your SPX workspace in a local AI agent and ask it to run the ready-made example:
Prompt for your AI agent
In the SPX workspace, use the existing catalog model `Energy.EnergyMeterIem3000.Modbus` and create one instance named `EnergyMeterIem3000Quickstart` with Modbus TCP endpoint port 5023 and unit ID 1. Start the `peak_demand` scenario. Using an independent Modbus TCP client, issue a read-input-registers request (function code 04) at raw zero-based start address 3000 for 2 registers; decode the returned two registers as IEEE-754 float32, big-endian. Report the exact client endpoint and request parameters, the raw response (register values and hex words), the decoded float, and whether it matches the expected peak-demand L1 current of 45.0 A. Report the instance key/state. Do not claim protocol success without the actual client response; if the API, endpoint, or client is unavailable, report the exact error and leave other instances untouched.
Tested with GPT-6 Luna · Medium
Estimated API cost · $0.0041 per run
We tested this prompt with GPT-6 Luna · Medium using an independent TCP client. In our setup, host port 5124 was mapped to adapter port 5023; use your own reachable mapping.
Next steps
Create a custom Modbus device with an AI agent. For adapter settings, use the Modbus guide.
