Integration guide

Connect SimplePLC to an SPX Tank over OPC UA

Read a SimplePLC pump node from SPX, write tank feedback with a value-only OPC UA adapter and verify the simulated response.

Before you begin

Use Docker Desktop in Linux container mode, Docker Compose, PowerShell and a local SPX Product Key. Extract the tank demo ZIP. The verified pair is the SimplePLC 2.0.0 software PLC and SPX Server 1.0.0 from the SPX 1.1.0 stable version set. The feedback adapter and verifier use asyncua 1.1.8 in the SPX image.

Run the test

1. Start the OPC UA variant

With SPX_PRODUCT_KEY set in the current PowerShell session, run this command from the extracted directory:

./run.ps1 -Protocol opcua

To use the environment file created by an existing Windows SPX installation, run this command instead:

$keyFile = "$env:LOCALAPPDATA/SPX/generated/.env"
./run.ps1 -Protocol opcua -ProductKeyEnvFile $keyFile

-Protocol opcua runs only OPC UA. Without -Protocol, the runner tests both protocols. It starts SimplePLC at opc.tcp://plc:4840 on the private network, loads tank_opcua.yaml and starts the SPX instance. The native SPX opcua_client binding polls the PLC's pump node every 100 ms.

2. Watch the automatic feedback

The verifier automatically writes enable=1 as a value-only UInt16 and reads the enable, pump and level nodes. SPX reads the resulting pump command and increases the simulated level. The feedback adapter reads the SPX level through API v3 and writes it to SimplePLC with a value-only DataValue:

node.write_value(
    ua.DataValue(ua.Variant(level, ua.VariantType.UInt16))
)

3. Watch the automatic drain

The verifier writes enable=0, reads back the pump transition and checks that the reported level falls to 20%. It reads SPX runtime state independently through API v3. The runner removes the demo resources on exit.

Check the result

For a successful OPC UA-only run, look for PASS opcua: wire read/write, SPX response and cleanup and let the whole command exit without error. The verifier checks 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 20%, 26%, 25% and 20% at baseline, filling, draining and recovery in a Windows x86-64 Docker run. Your intermediate samples can vary with polling.

Protocol communication

All three nodes use UInt16.

Node IDOwner and direction
ns=1;s=enableThe verifier writes the input and reads it back.
ns=1;s=pumpSimplePLC sets the command and SPX polls it.
ns=1;s=level_pctThe adapter writes the level calculated by SPX.

SimplePLC 2.0.0 returned BadWriteNotSupported for a Write with a source timestamp. SPX Server 1.0.0's native outbound write did not populate the level node in this version pair. The value-only adapter omits the source timestamp and completed the feedback path without a change to either runtime. The OPC UA server uses Security Policy None in this isolated lab.

Next steps

See the full tank control loop, run the same process over Modbus TCP or explore the OPC UA simulator.