Before you begin
Use Docker Desktop in Linux container mode, Docker Compose and PowerShell. Have an active SPX Product Key available locally. Download the tank demo ZIP and extract it. SimplePLC 2.0.0 is the software PLC (SoftPLC) in this lab. The lab uses SPX Server 1.0.0 from the SPX 1.1.0 stable version set. The Compose file pins both images by digest.
Run the test
1. Run the lab
Open PowerShell in the extracted directory. With SPX_PRODUCT_KEY set in the current session, run:
./run.ps1
To use the environment file created by an existing Windows SPX installation, run this command instead:
$keyFile = "$env:LOCALAPPDATA/SPX/generated/.env"
./run.ps1 -ProductKeyEnvFile $keyFile
The default command runs both protocols. Choose -Protocol opcua or -Protocol modbus to run just one. The runner starts SimplePLC and SPX on an internal Docker network without publishing host ports. It loads main.st and starts one SPX tank variant at a time.
2. Watch the automatic fill
The verifier automatically writes enable=1 to SimplePLC. The PLC program scans every 100 ms and sets pump=1 when enabled and its reported level is below 60%. SPX reads the pump command and advances the virtual tank from 20%. Each simulation step adds one percentage point with the pump on or subtracts one with it off. SPX clamps the result to 20–100%.
3. Watch the automatic drain
The level returns to the PLC as level_pct, completing the feedback loop. The verifier reads the PLC tags over the selected protocol and checks SPX runtime attributes through API v3. It then writes enable=0 and waits for recovery. The runner cleans up the demo resources on exit.
Check the result
In your run, look for the PASS line for each selected protocol and let the whole command exit without error. With the default command, expect both lines:
PASS opcua: wire read/write, SPX response and cleanup
PASS modbus: wire read/write, SPX response and cleanup
For each PASS, the verifier observed the enable write and readback, the pump turning on, a level of at least 25%, and a falling level after disabling the pump. The recovered record must show enable=0, pump=0 and level_pct=20. A protocol verification failure produces The demo verification failed. The runner can still report Cleanup failed after a PASS line if Docker cleanup fails.
For comparison, the ZIP’s evidence.log records these level samples from a Windows x86-64 Docker run. Your intermediate samples can vary with polling. The test turns filling off early, so the 60% limit is outside the verified scenario.
| Stage | Modbus TCP | OPC UA |
|---|---|---|
| Baseline | 20% | 20% |
| Filling | 25% | 26% |
| Draining | 24% | 25% |
| Recovered | 20% | 20% |
Protocol communication
- Modbus TCP. SimplePLC is the server. Native SPX client bindings read the pump register and write the level register.
- OPC UA. SimplePLC is the server. SPX reads the pump node natively. A small adapter reads the simulated level through SPX API v3 and writes a value-only UInt16 to SimplePLC.
The tank and pump are simulated. Keep the unsecured protocol endpoints inside this lab network.
Next steps
Follow the Modbus TCP register walkthrough or the OPC UA node and write walkthrough. See controller and process configurations for the broader SPX use case.
