Part 16: State Machines
| Document number | OPC 10000-16 |
|---|---|
| IEC designation | IEC 62541-16 |
| Colloquially | Part 16 |
| Group | Utility |
Part 16 defines how a state machine is represented in an address space: state and transition nodes, a CurrentState variable, a LastTransition variable, and transition events. Almost every companion specification uses it, so understanding it once saves relearning the same pattern in every model.
What it defines
StateMachineType as the general case and FiniteStateMachineType as the practical one, where the states and transitions are enumerable and modelled as nodes. A state is a node of StateType with a state number, one of which may be an InitialStateType. A transition is a node of TransitionType with its own number, and reference types express which states a transition connects and what causes it. An instance then exposes CurrentState and, optionally, LastTransition.
Reading the current state correctly
CurrentState is a Variable whose Value is localised text intended for display. Beneath it sit properties carrying the machine-readable identity: an Id that is the NodeId of the state node, a Name that is its BrowseName, a Number, and an effective display name that includes any sub-state. The stable thing to compare against is the Id or the Number. Comparing the localised text to a string literal produces an integration that works in the lab and fails the day someone changes the server's locale or a vendor corrects a spelling.
Transitions and sub-machines
A transition raises a TransitionEventType event carrying the transition, the source state and the target state. Subscribing to those events is the only reliable way to observe a machine that changes faster than your subscription interval, because a polled or sampled CurrentState will simply skip states that were held for less time than the sampling period. States can also contain sub-state machines, and the effective display name is how a client renders the composite state without walking the hierarchy itself.
Where you will meet it
Part 16 is infrastructure rather than a destination. The exclusive limit state machine in the alarm model, the shelving state machine, the program state machine, the file transfer state machine, and the PubSub element state machines are all instances of this pattern - as are the machine-state models in the sector companion specifications. Learn the reading rules once and every one of them becomes readable.
What it defines
| Concept | What it is |
|---|---|
| StateMachineType | The general base type, requiring only that CurrentState be exposed. Used where states are not enumerable as nodes. |
| FiniteStateMachineType | The enumerable case, where states and transitions are browsable nodes. This is what companion specifications actually subclass. |
| StateType and InitialStateType | State nodes with a StateNumber. The initial state is marked with its own type so a client knows where the machine begins. |
| TransitionType | A transition node with a TransitionNumber, linked to its source and target states by reference and optionally to what causes it. |
| CurrentState | The instance variable holding the present state. Its Value is display text; its Id, Name and Number properties carry the machine-readable identity. |
| LastTransition | Optional variable naming the most recent transition and when it occurred. Useful, frequently omitted, and no substitute for transition events. |
| TransitionEventType | The event raised on each transition, carrying transition, source state and target state. The reliable way to observe a fast machine. |
| Sub-state machines | A state can contain a nested machine. The effective display name property composes the outer and inner state into one string for display. |
| Causes and effects | Reference types linking a transition to the method that can cause it and to the event it produces, so a client can discover how to drive the machine. |
| Concrete instances in the standard | The exclusive limit and shelving machines in the alarm model, the program state machine, the file transfer state machine and the PubSub element machines. |
Do you need to read it?
Client developers reading any machine state from any companion model, and modellers defining equipment behaviour. If you have ever written code comparing a state string to Running, this is the part that explains why that code is fragile and what to compare instead.
Traps that trace back to this part
- Do not compare the CurrentState value to a string. It is localised display text. Compare the Id property, which is the state node's NodeId, or the Number property. This single mistake accounts for a large share of integrations that break on a server locale change or a vendor's spelling fix.
- Sampling CurrentState misses states. A machine that passes through a state for fifty milliseconds is invisible to a subscription publishing every second, and no amount of queue size fixes it because the sampler never saw the intermediate value. Subscribe to transition events where the sequence matters.
- A type declaring states and transitions does not oblige an instance to expose them usefully. Plenty of servers give you CurrentState and nothing else - no transitions, no LastTransition, no events - so check what is actually browsable before designing a client around the transition graph.
Last verified 7 September 2026 against OPC UA 1.05.07. The specification parts themselves are published by the OPC Foundation. OPC UA Connect is an educational resource and is not affiliated with the OPC Foundation.