Skip to content

OPC UA

Expose Miravo simulations as a browsable OPC UA server with typed ObjectTypes, engineering units, EURange, AccessLevel metadata, and executable methods.

Miravo’s OPC UA adapter projects the asset graph into a typed OPC UA address space. OPC UA is opt-in — enable it with --opcua.

Terminal window
miravo start --template smart-factory --opcua

Connect any OPC UA client (UaExpert, Prosys, Kepware) to:

opc.tcp://localhost:4840/miravo

The browse path hierarchy maps directly to OPC UA nodes:

Root/Objects/
MiravoWorks (FolderType)
smart-factory (FolderType)
production (FolderType)
line-1 (FolderType)
centrifugal-pump-001 (Object, typeDefinition: centrifugal-pump)
rpm (Variable, Double, AccessLevel: CurrentRead)
speed_command (Variable, Double, AccessLevel: CurrentRead|CurrentWrite)
serial_number (Property, String, AccessLevel: CurrentRead)
Start (Method)
Stop (Method)
Model conceptOPC UA mapping
Path segmentsFolderType nodes
Asset instanceObject with HasTypeDefinition
Variable memberVariable (componentOf instance)
Property memberProperty (propertyOf instance, read-only)
MethodMethod node with typed arguments
Miravo Data TypeOPC UA DataType
DoubleDataType.Double
FloatDataType.Float
Int32DataType.Int32
UInt16DataType.UInt16
UInt32DataType.UInt32
BooleanDataType.Boolean
StringDataType.String
Model AccessOPC UA AccessLevel
readCurrentRead
readwriteCurrentRead + CurrentWrite
writeCurrentWrite

Properties are always read-only regardless of declared access.

Members with unit metadata get OPC UA EUInformation nodes. Members with eu_range get EURange nodes. This allows OPC UA clients to display proper units and scaling.

Model methods with runtime metadata are executable from OPC UA clients. Input and output arguments are typed and follow the declaration order in the model.

Use any OPC UA client (UaExpert, Prosys, or opcua-commander) to call a method:

  1. Browse to the instance node (e.g., centrifugal-pump-001)
  2. Select the method (e.g., SetSpeed)
  3. Provide input arguments in declaration order (e.g., speed_rpm: 900)
  4. Execute — the engine applies the method and returns the output arguments

Methods without a runtime block appear in the address space for browsing but return an error if called.

OptionEnv VarDefaultDescription
--opcuaDisabledEnable OPC UA server
--opcua-portMIRAVO_OPCUA_PORT4840Server port
--opcua-hostMIRAVO_OPCUA_HOST0.0.0.0Server bind host

Advanced tuning:

Env VarDefaultDescription
MIRAVO_OPCUA_WRITE_BUDGET8192Max address space writes per drain cycle (512-65536)

MQTT and OPC UA can run simultaneously from the same simulation, and additional protocols (Modbus TCP, Sparkplug B) are on the roadmap:

Terminal window
miravo start --template smart-factory --opcua

This starts MQTT on port 1883 and OPC UA on port 4840. All adapters read from the same asset graph on each tick. The data is consistent across protocols.

Enable or disable OPC UA while the simulation is running:

Enable OPC UA:

Terminal window
miravo adapter enable opcua --port 4840

Disable OPC UA:

Terminal window
miravo adapter disable opcua