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.
Getting Started
Section titled “Getting Started”miravo start --template smart-factory --opcuaConnect any OPC UA client (UaExpert, Prosys, Kepware) to:
opc.tcp://localhost:4840/miravoAddress Space Structure
Section titled “Address Space Structure”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)Node Types
Section titled “Node Types”| Model concept | OPC UA mapping |
|---|---|
| Path segments | FolderType nodes |
| Asset instance | Object with HasTypeDefinition |
| Variable member | Variable (componentOf instance) |
| Property member | Property (propertyOf instance, read-only) |
| Method | Method node with typed arguments |
Type Mapping
Section titled “Type Mapping”| Miravo Data Type | OPC UA DataType |
|---|---|
Double | DataType.Double |
Float | DataType.Float |
Int32 | DataType.Int32 |
UInt16 | DataType.UInt16 |
UInt32 | DataType.UInt32 |
Boolean | DataType.Boolean |
String | DataType.String |
Access Levels
Section titled “Access Levels”| Model Access | OPC UA AccessLevel |
|---|---|
read | CurrentRead |
readwrite | CurrentRead + CurrentWrite |
write | CurrentWrite |
Properties are always read-only regardless of declared access.
Engineering Units
Section titled “Engineering Units”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.
Methods
Section titled “Methods”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:
- Browse to the instance node (e.g.,
centrifugal-pump-001) - Select the method (e.g.,
SetSpeed) - Provide input arguments in declaration order (e.g.,
speed_rpm: 900) - 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.
Configuration
Section titled “Configuration”| Option | Env Var | Default | Description |
|---|---|---|---|
--opcua | — | Disabled | Enable OPC UA server |
--opcua-port | MIRAVO_OPCUA_PORT | 4840 | Server port |
--opcua-host | MIRAVO_OPCUA_HOST | 0.0.0.0 | Server bind host |
Advanced tuning:
| Env Var | Default | Description |
|---|---|---|
MIRAVO_OPCUA_WRITE_BUDGET | 8192 | Max address space writes per drain cycle (512-65536) |
Running Multiple Protocols
Section titled “Running Multiple Protocols”MQTT and OPC UA can run simultaneously from the same simulation, and additional protocols (Modbus TCP, Sparkplug B) are on the roadmap:
miravo start --template smart-factory --opcuaThis 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.
Runtime Management
Section titled “Runtime Management”Enable or disable OPC UA while the simulation is running:
Enable OPC UA:
miravo adapter enable opcua --port 4840Disable OPC UA:
miravo adapter disable opcua