Skip to content
Ralf Steinert edited this page Nov 2, 2026 · 3 revisions

opcua-sim simulates OPC UA devices that behave and fail: a drive that ramps up after Start and latches a trip until Reset, a transmitter whose broken sensor reads BadSensorFailure, alarms that arrive as real events and wait for your Acknowledge. Develop and test SCADA links, HMIs, gateways and data loggers without the plant, also in CI.

The browser demo: simulated devices next to a terminal

Look at it without installing anything: https://opcua-sim.steitec.net runs the device code in your browser, but not the OPC UA wire protocol. See Browser demo.

What it is for

  • Testing the unhappy paths. A value that is Bad has no number at all, a frozen one has a source timestamp that stopped moving, a server restart takes every session and subscription with it.
  • Testing alarm handling. Conditions must be acknowledged with the right EventId and fetched again with ConditionRefresh after a reconnect.
  • Moving between brands. Quotes in Siemens node IDs, the |var| of CODESYS, a namespace index that differs per server.
  • Running OPC UA code in CI. A new server for every test, in a pytest fixture or as a background process.

Where to start

If you want to … read
look at it without installing the server Browser demo
install it and read a first value Getting started
look like an S7-1500, TwinCAT, PLCnext, CODESYS, Omron NX or Leuze BCL 300 Product profiles
use it in pytest and CI pipelines Testing in CI
check that your code copes with misbehaving devices Fault injection recipes
find out why something is refused or does not connect Troubleshooting

The README is the complete reference: the profile format, bench files, every fault, the command line. This wiki adds walkthroughs and background.

At a glance

Install pip install opcua-sim (Python 3.10+; depends on asyncua and PyYAML)
Transport opc.tcp://, default port 4840, control channel on 4841
Security None, Sign, SignAndEncrypt (Basic256Sha256), user names, read-only users
Generic devices pressure-transmitter, temperature-controller, drive, energy-meter, generic-sensor
Product layouts siemens-s7-1500, beckhoff-twincat3, phoenix-plcnext, codesys-control, omron-nx, leuze-bcl300
Device faults bad_status, freeze, stale, drift, reject_write, method_fail, health, plus those of each model
Server faults delay, blackhole, drop_connections, refuse, server_state, service_level, restart
Tested on Linux, Windows, macOS; Python 3.10 and 3.13; cross-checked with asyncua and node-opcua clients
License MIT; the asyncua stack underneath is LGPL-3.0 and installed as a separate package

Not tested against UaExpert, commercial SCADA systems, real PLCs or a conformance tool. If your client disagrees with it, please open an issue.

Clone this wiki locally