Quickstart

OPC UA Quickstart: Monitor a Workcell

Subscribe to a virtual workcell’s state and progress nodes, then observe a complete production cycle in your OPC UA client.

Before you begin

Install SPX with the OPC UA package and SPX UI. Have an OPC UA client ready. Use the production-workcell YAML linked in the communication reference.

Run the test

  1. Import the YAML in Models → Load model from file, create a fresh instance from that registered model and start it. Keep the default endpoint and 22-second target cycle time.
  2. Connect to opc.tcp://SPX_HOST:4841/spx/workcell using your reachable host and published TCP port. For this local demo, select Anonymous / NoSecurity. Browse namespace urn:spx:examples:opcua:workcell.
  3. Subscribe to Objects → Workcell → State and Objects → Workcell → Cycle → Progress. In SPX Scenarios, start auto_cycle and let the 30-second scenario finish.

Check the result

State changes from idle to running, progress rises and resets, and State returns to idle after the timed scenario. Keep the subscription active for the whole run, then stop the instance.

Protocol communication

Use these settings and messages with the library’s production workcell model.

Client endpoint
opc.tcp://SPX_HOST:4841/spx/workcell
Namespace URI
urn:spx:examples:opcua:workcell
Local demo session
Anonymous; NoSecurity; browse under Objects

Replace host placeholders with reachable addresses and use your published ports.

Swipe the table to see requests and replies.

Addresses, requests and expected replies
Address / messageOperation / payloadExpected reply
Workcell / StateRead/subscribe; String; read-onlyidle initially; running during auto_cycle; idle after it finishes
Workcell / Cycle / ProgressRead/subscribe; Double; read-onlyProgress in %, rising and resetting during operation
Workcell / ModeRead/write; String; send manual or autoWrite status Good; read Value back → selected mode
Workcell / Motion / Robot / TargetPositionRead/write; Double; target in degreesWrite status Good; target readback matches the request
Workcell / Motion / Robot / ActualPositionRead/subscribe; Double; read-onlyActual position moves toward TargetPosition

Values describe this model’s nominal setup unless noted. Live measurements change as the simulation runs.

Example request and reply

Subscribe to State and Progress, then start auto_cycle in SPX. After the scenario finishes, set Mode to manual, read it back, then restore auto.

Connect: opc.tcp://SPX_HOST:4841/spx/workcell
Browse Objects → Workcell → Mode
Read Value → String "auto"
Write Value: String "manual" → Good
Read Value → String "manual"
Restore Value: String "auto" → Good
No reply or an unexpected value?
  • SPX_HOST and its published TCP port must be reachable from your client.
  • Paths are relative to Objects. Resolve namespace indexes and NodeIds by browsing the server; do not copy a numeric ns= index from another session.
  • Write a String to Mode and a Double to TargetPosition. Stop overriding scenarios before a manual write/readback check. NoSecurity is this model’s local-demo configuration.

Next steps

See the workcell walkthrough and its repeated-cycle chart. For adapter settings, use the OPC UA guide.