Before you begin
Install SPX with OPC UA and SPX UI, and have an OPC UA client such as UaExpert ready. Use the ready-made production workcell model; there is no need to create a new model. The OPC UA server runs within SPX.
Run the test
1. Start a workcell
- In Instances → New instance, select
Process.Workcell.OpcUa, create an instance and start it. If the model is missing, import the linked YAML in Models → Load model from file first. - Open Communication → opcua_server to check the endpoint and namespace. Use the reachable host and published port for your client.

2. Connect your client
- Connect to
opc.tcp://SPX_HOST:4841/spx/workcell, replacing the host and port if necessary. For this local demo, select Anonymous / NoSecurity. - Browse the namespace
urn:spx:examples:opcua:workcelland subscribe to Objects → Workcell → State and Objects → Workcell → Cycle → Progress.
3. Run a cycle
- In SPX Attributes, set
target_cycle_time_sto 10 and selectcycle_progress_percentfor the chart. - In Scenarios, start
auto_cycle. Keep your subscriptions open for the full 30 seconds.
Check the result
State changes from idle to running, progress rises and resets, and State returns to idle when the scenario finishes. The number of completed cycles can vary with timing. Restore the original target_cycle_time_s when finished.

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.
| Address / message | Operation / payload | Expected reply |
|---|---|---|
Workcell / State | Read/subscribe; String; read-only | idle initially; running during auto_cycle; idle after it finishes |
Workcell / Cycle / Progress | Read/subscribe; Double; read-only | Progress in %, rising and resetting during operation |
Workcell / Mode | Read/write; String; send manual or auto | Write status Good; read Value back → selected mode |
Workcell / Motion / Robot / TargetPosition | Read/write; Double; target in degrees | Write status Good; target readback matches the request |
Workcell / Motion / Robot / ActualPosition | Read/subscribe; Double; read-only | Actual 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" → GoodNo 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.
Ask your AI agent
Open your SPX workspace in a local agent and ask it to run the example:
Prompt for your AI agent
Set up the SPX OPC UA production workcell example using the Process.Workcell.OpcUa library model. Inspect existing instances and ports first; reuse a matching instance or create and start one if a license slot is free. Do not modify or remove other instances. Find a reachable OPC UA endpoint and browse by namespace URI urn:spx:examples:opcua:workcell rather than assuming its namespace index. Subscribe to Workcell State and Cycle Progress before starting auto_cycle. Set target_cycle_time_s to 10 seconds, run the 30-second scenario, and report observed state and progress updates, endpoint, where to find the chart in SPX UI, and any network or license limitations. Restore the original target cycle time afterward. Do not claim success if the subscription or scenario cannot be verified.
Tested with GPT-6 Luna · Medium
Estimated API cost · $0.0088 per run
We tested this prompt in an agent session with a newly created instance. A client inside the SPX container observed idle → running → idle and progress rising and resetting to 0%. The host port was not published in our setup, so a client outside the container would need a reachable published endpoint.
Next steps
Create a custom OPC UA device with an AI agent. For adapter settings, use the OPC UA guide.
