MiravoMiravo

OPC UA

Browse a running Miravo factory as a typed OPC UA address space. Read values, subscribe to changes and call asset methods.

OPC UA

Connect

ItemDefault
Endpointopc.tcp://127.0.0.1:4840 (--opcua-port, --opcua-host)
SecurityMode None, anonymous login
Namespaceurn:miravo:server, index 1
Node IDsns=1;s=<browse path>/<member>

Example from smart-factory. The CNC spindle speed setpoint is:

ns=1;s=MiravoWorks/smart-factory/production/machining/cnc-001/spindle_speed_setpoint

It is a Double AnalogItemType variable. Its EngineeringUnits property has display name rpm and its EURange is 0 to 12000. List every node ID of a running factory with miravo adapter inspect opcua.

Miravo serves the running factory as a typed address space. Objects are organized by enterprise, site, area and line, and variables update live. Assets expose methods such as Start and Stop, which any OPC UA client can call.

Built-in templates enable OPC UA. A custom template enables it with protocols.opcua, or pass --opcua to miravo start.

Browse with a client

Point your OPC UA client at opc.tcp://localhost:4840.

Browse from Root/Objects.

Expand into the enterprise or site folder for the running factory.

Verify the surface

Verified

  • Enterprise, site, area and line folders appear under Root/Objects.
  • Each asset is an object with readable values. Some are writable.
  • Variables that define a unit or range carry EngineeringUnits and EURange.
  • Writing a value outside the range returns BadOutOfRange and the variable keeps its value.

Identity

The application URI and the namespace URI are both urn:miravo:server. The namespace index is 1, and every node ID uses it, for example ns=1;s=<browse path>/<member>. ServerStatus/BuildInfo reports the product name Miravo and the running version. Node IDs do not change.

Units and ranges

Numeric variables with a unit have an EngineeringUnits property (EUInformation, with a display name such as degC or bar). Numeric variables with an eu_range are AnalogItemType nodes with an EURange. A unit Miravo does not recognise still carries its text as the display name.

Write values

Writable variables (readwrite, write) go through the engine, so the Console, MQTT and Modbus see the same value. A write is rejected and changes nothing when the data type differs (BadTypeMismatch, which includes NaN and infinite doubles), when the value is outside the member eu_range (BadOutOfRange), or when the variable is read-only (BadNotWritable).

Rejected writes are the client's error, not an engine error. The adapter counts them in its rejectedWrites metric and leaves errorsCount and the engine error count alone. The log shows the first rejection per variable at warn level, then at most one summary line per 10 s (N more rejected writes to <asset>.<member> in the last 10 s).

Call methods

Asset methods are ordinary OPC UA methods. Start, Stop and the others change the same running factory the Console shows, and the next read reflects the new state. A method declares InputArguments when it takes arguments, and OutputArguments (for example accepted) when the model defines outputs. An argument outside the target member's eu_range, such as SetSpeed(1000) on a [0, 10] setpoint, is rejected and the method returns accepted = false.

Check that a client is connected

connected in adapters[].metrics (/api/metrics, miravo status --json) only says the OPC UA server is up. It does not say a client is reading. adapters[].metrics.clients does: active is the number of open sessions and subscriptions the number of subscriptions they hold. miravo status prints OPC UA: connected | 2 sessions | .... 0 sessions after you pointed a client at Miravo means it never created a session.

Next

Was this page useful?

Last updated on