The types defined in this specification are illustrated in Figure 3. The MyFiniteStateMachineType is a minimal example which illustrates how these Types can be used to describe a StateMachine. See OPC 10000-9 and OPC 10000-10 for additional examples of StateMachines.

image005.png

Figure 3 – The StateMachine Information Model

The StateMachineType is the base ObjectType for all StateMachineTypes. It defines a single Variable which represents the current state of the machine. An instance of this ObjectType shall generate an Event whenever a significant state change occurs. The Server decides which state changes are significant. Servers shall use the GeneratesEvent ReferenceType to indicate which Event(s) could be produced by the StateMachine.

Subtypes may add Methods which affect the state of the machine. The Executable Attribute is used to indicate whether the Method is valid given the current state of the machine. The generation of AuditEvents for Methods is defined in OPC 10000-4. A StateMachine may not be active. In this case, the CurrentState and LastTransition Variables shall have a status equal to Bad_StateNotActive (see Table 17).

Subtypes may add components which are instances of StateMachineTypes. These components are considered to be sub-states of the StateMachine. SubStateMachines are only active when the parent machine is in an appropriate state.

Events produced by SubStateMachines may be suppressed by the parent machine. In some cases, the parent machine will produce a single Event that reflects changes in multiple SubStateMachines.

FiniteStateMachineType is a subtype of StateMachineType that provides a mechanism to explicitly define the states and transitions. A Server should use this mechanism if it knows what the possible states are and the state machine is not trivial. The FiniteStateMachineType is defined in clause 4.4.5.

The StateMachineType is formally defined in Table 1.

Table 1 – StateMachineType definition

Attribute

Value

BrowseName

StateMachineType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseObjectType defined in OPC 10000-5

Note that a Reference to this subtype is not shown in the definition of the BaseObjectType.

HasSubtype

ObjectType

FiniteStateMachineType

Defined in 4.4.5

HasComponent

Variable

CurrentState

LocalizedText

StateVariableType

Mandatory

HasComponent

Variable

LastTransition

LocalizedText

TransitionVariableType

Optional

Conformance Units

Base Info State Machine Instance

CurrentState stores the current state of an instance of the StateMachineType. CurrentState provides a human readable name for the current state which may not be suitable for use in application control logic. Applications should use the Id Property of CurrentState if they need a unique identifier for the state.

LastTransition stores the last transition which occurred in an instance of the StateMachineType. LastTransition provides a human readable name for the last transition which may not be suitable for use in application control logic. Applications should use the Id Property of LastTransition if they need a unique identifier for the transition.

The StateVariableType is the base VariableType for Variables that store the current state of a StateMachine as a human readable name.

The StateVariableType is formally defined in Table 2.

Table 2 – StateVariableType definition

Attribute

Value

BrowseName

StateVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in OPC 10000-5

Note that a Reference to this subtype is not shown in the definition of the BaseDataVariableType.

HasSubtype

VariableType

FiniteStateVariableType

Defined in 4.4.6

HasProperty

Variable

Id

BaseDataType

PropertyType

Mandatory

HasProperty

Variable

Name

QualifiedName

PropertyType

Optional

HasProperty

Variable

Number

UInt32

PropertyType

Optional

HasProperty

Variable

EffectiveDisplayName

LocalizedText

PropertyType

Optional

Conformance Units

Base Info State Machine Instance

Id is a name which uniquely identifies the current state within the StateMachineType. A subtype may restrict the DataType.

Name is a QualifiedName which uniquely identifies the current state within the StateMachineType.

Number is an integer which uniquely identifies the current state within the StateMachineType.

EffectiveDisplayName contains a human readable name for the current state of the state machine after taking the state of any SubStateMachines in account. There is no rule specified for which state or sub-state should be used. It is up to the Server and will depend on the semantics of the StateMachineType.

StateMachines produce Events which may include the current state of a StateMachine. In that case Servers shall provide all the optional Properties of the StateVariableType in the Event, even if they are not provided on the instances in the AddressSpace.

The TransitionVariableType is the base VariableType for Variables that store a Transition that occurred within a StateMachine as a human readable name.

The SourceTimestamp for the value specifies when the Transition occurred. This value may also be exposed with the TransitionTime Property.

The TransitionVariableType is formally defined in Table 3.

Table 3 – TransitionVariableType definition

Attribute

Value

BrowseName

TransitionVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in OPC 10000-5

Note that a Reference to this subtype is not shown in the definition of the BaseDataVariableType.

HasSubtype

VariableType

FiniteTransitionVariableType

Defined in 4.4.7

HasProperty

Variable

Id

BaseDataType

PropertyType

Mandatory

HasProperty

Variable

Name

QualifiedName

PropertyType

Optional

HasProperty

Variable

Number

UInt32

PropertyType

Optional

HasProperty

Variable

TransitionTime

UtcTime

PropertyType

Optional

HasProperty

Variable

EffectiveTransitionTime

UtcTime

PropertyType

Optional

Conformance Units

Base Info State Machine Instance

Id is a name which uniquely identifies a Transition within the StateMachineType. A subtype may restrict the DataType.

Name is a QualifiedName which uniquely identifies a transition within the StateMachineType.

Number is an integer which uniquely identifies a transition within the StateMachineType.

TransitionTime specifies when the transition occurred.

EffectiveTransitionTime specifies the time when the current state or one of its substates was entered. If, for example, a StateA is active and – while active – switches several times between its substates SubA and SubB, then the TransitionTime stays at the point in time where StateA became active whereas the EffectiveTransitionTime changes with each change of a substate.

The FiniteStateMachineType is the base ObjectType for StateMachines that explicitly define the possible States and Transitions. Once the States and Transitions are defined subtypes shall not add new States and Transitions (see 4.4.18). Subtypes may add causes or effects.

The States of the machine are represented with instances of the StateType ObjectType. Each State shall have a BrowseName which is unique within the StateMachine and shall have a StateNumber which shall also be unique across all States defined in the StateMachine. Be aware that States in a SubStateMachine may have the same StateNumber or BrowseName as States in the parent machine. A concrete subtype of FiniteStateMachineType shall define at least one State.

A StateMachine may define one State which is an instance of the InitialStateType. This State is the State that the machine goes into when it is activated.

The Transitions that may occur are represented with instances of the TransitionType. Each Transition shall have a BrowseName which is unique within the StateMachine and may have a TransitionNumber which shall also be unique across all Transitions defined in the StateMachine.

The initial State for a Transition is a StateType Object which is the target of a FromState Reference. The final State for a Transition is a StateType Object which is the target of a ToState Reference. The FromState and ToState References shall always be specified.

A Transition may produce an Event. The Event is indicated by a HasEffect Reference to a subtype of BaseEventType. The StateMachineType shall have GeneratesEvent References to the targets of a HasEffect Reference for each of its Transitions.

A FiniteStateMachineType may define Methods that cause a transition to occur. These Methods are targets of HasCause References for each of the Transitions that may be triggered by the Method. The Executable Attribute for a Method is used to indicate whether the current State of the machine allows the Method to be called.

A FiniteStateMachineType may have sub-state-machines which are represented as instances of StateMachineType ObjectTypes. Each State shall have a HasSubStateMachine Reference to the StateMachineType Object which represents the child States. The SubStateMachine is not active if the parent State is not active. In this case the CurrentState and LastTransition Variables of the SubStateMachine shall have a status equal to Bad_StateNotActive (see Table 17).

The FiniteStateMachineType is formally defined in Table 4.

Table 4 – FiniteStateMachineType definition

Attribute

Value

BrowseName

FiniteStateMachineType

IsAbstract

True

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the StateMachineType defined in 4.4.2

HasComponent

Variable

CurrentState

LocalizedText

FiniteStateVariableType

Mandatory

HasComponent

Variable

LastTransition

LocalizedText

FiniteTransitionVariableType

Optional

HasComponent

Variable

AvailableStates

NodeId[]

BaseDataVariableType

Optional

HasComponent

Variable

AvailableTransitions

NodeId[]

BaseDataVariableType

Optional

Conformance Units

Base Info Finite State Machine Instance

Base Info Available States and Transitions

In some Servers an instance of a StateMachine may restrict the States and / or Transitions that are available. These restrictions may result from the internal design of the instance. For example, the StateMachine for an instrument’s limit alarm which only supports Hi and HiHi and can not produce a Low or LowLow. An instance of a StateMachine may also dynamically change the available States and/or Transitions based on its operating mode. For example, when a piece of equipment is in a maintenance mode the available States may be limited to some subset of the States available during normal operation.

The AvailableStates Variable provides a NodeId list of the States that are present in the StateMachine instance. The list may change during operation of the Server.

The AvailableTransitions Variable provides a NodeId list of the Transitions that are present in the StateMachine instance. The list may change during operation of the Server.

An example of a FiniteStateMachine type is shown in Figure 4.

image006.png

Figure 4 – Example of a FiniteStateMachine type

An example instance of the type is shown in Figure 5. In this example the States {7,8,9} and the Transitions {G,H,I,J} are not available in this instance.

image007.png

Figure 5 – Example of a FiniteStateMachine instance

The FiniteStateVariableType is a subtype of StateVariableType and is used to store the current state of a FiniteStateMachine as a human readable name.

The FiniteStateVariableType is formally defined in Table 5.

Table 5 – FiniteStateVariableType definition

Attribute

Value

BrowseName

FiniteStateVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the StateVariableType defined 4.4.3

HasProperty

Variable

Id

NodeId

PropertyType

Mandatory

Conformance Units

Base Info Finite State Machine Instance

Id is inherited from the StateVariableType and overridden to reflect the required DataType. This value shall be the NodeId of one of the State Objects of the FiniteStateMachineType. If the FiniteStateMachine is subtyped, it shall be the NodeId of the State defined on the supertype, i.e., where the State is defined the first time in the type hierarchy.

The Name Property is inherited from StateVariableType. Its Value shall be the BrowseName of one of the State Objects of the FiniteStateMachineType.

The Number Property is inherited from StateVariableType. Its Value shall be the StateNumber for one of the State Objects of the FiniteStateMachineType.

The FiniteTransitionVariableType is a subtype of TransitionVariableType and is used to store a Transition that occurred within a FiniteStateMachine as a human readable name.

The FiniteTransitionVariableType is formally defined in Table 6.

Table 6 – FiniteTransitionVariableType definition

Attribute

Value

BrowseName

FiniteTransitionVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the TransitionVariableType defined in 4.4.4

Note that a Reference to this subtype is not shown in the definition of the BaseDataVariableType.

HasProperty

Variable

Id

NodeId

PropertyType

Mandatory

Conformance Units

Base Info Finite State Machine Instance

Id is inherited from the TransitionVariableType and overridden to reflect the required DataType. This value shall be the NodeId of one of the Transition Objects of the FiniteStateMachineType. If the FiniteStateMachine is subtyped, it shall be the NodeId of the Transition defined on the supertype, i.e., where the Transition is defined the first time in the type hierarchy.

The Name Property is inherited from the TransitionVariableType. Its Value shall be the BrowseName of one of the Transition Objects of the FiniteStateMachineType.

The Number Property is inherited from the TransitionVariableType. Its Value shall be the TransitionNumber for one of the Transition Objects of the FiniteStateMachineType.

States of a FiniteStateMachine are represented as Objects of the StateType. Each Object of the StateType or one of its subtypes shall be referenced from the ObjectType FiniteStateMachineType or one of its subtypes using a HasComponent Reference or a subtype of HasComponent and shall not have a ModellingRule as they are not applied on the instances.

The StateType is formally defined in Table 7.

Table 7 – StateType definition

Attribute

Value

BrowseName

StateType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseObjectType defined in OPC 10000-5

Note that a Reference to this subtype is not shown in the definition of the BaseObjectType.

HasProperty

Variable

StateNumber

UInt32

PropertyType

Mandatory

HasSubtype

ObjectType

InitialStateType

Defined in 4.4.9

HasSubtype

ObjectType

ChoiceStateType

Defined in 4.6.2

Conformance Units

Base Info Finite State Machine Instance

The InitialStateType is a subtype of the StateType and is formally defined in Table 8. An Object of the InitialStateType represents the State that a FiniteStateMachine enters when it is activated. Each FiniteStateMachine can have at most one State of type InitialStateType, but a FiniteStateMachine does not have to have a State of this type.

A SubStateMachine goes into its initial state whenever the parent state is entered. However, a state machine may define a transition that goes directly to a state of the SubStateMachine. In this case the SubStateMachine goes into that State instead of the initial State. The two scenarios are illustrated in Figure 6. The transition from "State5" to "State6" causes the SubStateMachine to go into the initial State ("State7"), however, the transition from "State4" to "State8" causes the parent machine to go to "State6" and the SubStateMachine will go to "State8".

image008.png

Figure 6 – Example of an initial State in a sub-machine

If no initial state for a SubStateMachine exists and the State having the SubStateMachine is entered directly, then the State of the SubStateMachine is server-specific.

Table 8 – InitialStateType definition

Attribute

Value

BrowseName

InitialStateType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the StateType defined in 4.4.8

Conformance Units

Base Info Finite State Machine Instance

Transitions of a FiniteStateMachine are represented as Objects of the ObjectType TransitionType formally defined in Table 9. Each Object of the TransitionType or one of its subtypes shall be referenced from the ObjectType FiniteStateMachineType or one of its subtypes using a HasComponent Reference or a subtype of HasComponent and shall not have a ModellingRule as they are not applied on the instances.

Each valid Transition shall have exactly one FromState Reference and exactly one ToState Reference, each pointing to an Object of the ObjectType StateType.

Each Transition can have one or more HasCause References pointing to the cause that triggers the Transition.

Each Transition can have one or more HasEffect References pointing to the effects that occur when the Transition was triggered.

Table 9 – TransitionType definition

Attribute

Value

BrowseName

TransitionType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseObjectType defined in OPC 10000-5

Note that a Reference to this subtype is not shown in the definition of the BaseObjectType.

HasProperty

Variable

TransitionNumber

UInt32

PropertyType

Mandatory

Conformance Units

Base Info Finite State Machine Instance

The FromState ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to point from a Transition to the starting State the Transition connects.

The SourceNode of this ReferenceType shall be an Object of the ObjectType TransitionType or one of its subtypes. The TargetNode of this ReferenceType shall be an Object of the ObjectType StateType or one of its subtypes.

The representation of the FromState ReferenceType in the AddressSpace is specified in Table 10.

Table 10 – FromState ReferenceType

Attributes

Value

BrowseName

FromState

InverseName

ToTransition

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

Conformance Units

Base Info Finite State Machine Instance

The ToState ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to point from a Transition to the ending State the Transition connects.

The SourceNode of this ReferenceType shall be an Object of the ObjectType TransitionType or one of its subtypes. The TargetNode of this ReferenceType shall be an Object of the ObjectType StateType or one of its subtypes.

References of this ReferenceType may be only exposed uni-directional. Sometimes this is required, for example, if a Transition points to a State of a sub-machine.

The representation of the ToState ReferenceType in the AddressSpace is specified in Table 11.

Table 11 – ToState ReferenceType

Attributes

Value

BrowseName

ToState

InverseName

FromTransition

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

Conformance Units

Base Info Finite State Machine Instance

The HasCause ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to point from a Transition to something that causes the Transition. In this specification we only define Methods as Causes. However, the ReferenceType is not restricted to point to Methods. The referenced Methods can, but do not have to point to a Method of the StateMachineType. For example, it is allowed to point to a server-wide restart Method leading the state machine to go into its initial state.

The SourceNode of this ReferenceType shall be an Object of the ObjectType TransitionType or one of its subtypes. The TargetNode can be of any NodeClass.

The representation of the HasCause ReferenceType in the AddressSpace is specified in Table 12.

Table 12 – HasCause ReferenceType

Attributes

Value

BrowseName

HasCause

InverseName

MayBeCausedBy

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

Conformance Units

Base Info Finite State Machine Instance

The HasEffect ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to point from a Transition to something that will be effected when the Transition is triggered. In this specification we only define EventTypes as Effects. However, the ReferenceType is not restricted to point to EventTypes.

The SourceNode of this ReferenceType shall be an Object of the ObjectType TransitionType or one of its subtypes. The TargetNode can be of any NodeClass.

If the TargetNode is an EventType, each time the Transition is triggered (either by a Client or internally in the Server) an Event of that EventType or a subtype shall be generated.

The representation of the HasEffect ReferenceType in the AddressSpace is specified in Table 13.

Table 13 – HasEffect ReferenceType

Attributes

Value

BrowseName

HasEffect

InverseName

MayBeEffectedBy

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

Conformance Units

Base Info Finite State Machine Instance

The HasSubStateMachine ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of NonHierarchicalReferences.

The semantic of this ReferenceType is to point from a State to an instance of a StateMachineType which represents the sub-states for the State.

The SourceNode of this ReferenceType shall be an Object of the ObjectType StateType. The TargetNode shall be an Object of the ObjectType StateMachineType or one of its subtypes. Each Object can be the TargetNode of at most one HasSubStateMachine Reference.

The SourceNode (the state) and the TargetNode (the SubStateMachine) shall belong to the same StateMachine. Therefore, the SourceNode shall be referenced from the ObjectType FiniteStateMachineType or one of its subtypes and the TargetNode shall be referenced from the same ObjectType, both using a HasComponent Reference or a subtype of HasComponent.

The representation of the HasSubStateMachine ReferenceType in the AddressSpace is specified in Table 14.

Table 14 – HasSubStateMachine ReferenceType

Attributes

Value

BrowseName

HasSubStateMachine

InverseName

SubStateMachineOf

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

Comment

Conformance Units

Base Info Finite State Machine Instance

The TransitionEventType is a subtype of the BaseEventType. It can be used to generate an Event identifying that a Transition of a StateMachine was triggered. It is formally defined in Table 15.

Table 15 – TransitionEventType

Attribute

Value

BrowseName

TransitionEventType

IsAbstract

True

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the base BaseEventType defined in OPC 10000-5

HasComponent

Variable

Transition

LocalizedText

TransitionVariableType

Mandatory

HasComponent

Variable

FromState

LocalizedText

StateVariableType

Mandatory

HasComponent

Variable

ToState

LocalizedText

StateVariableType

Mandatory

Conformance Units

Base Info Finite State Machine Instance

The TransitionEventType inherits the Properties of the BaseEventType.

The inherited Property SourceNode shall be filled with the NodeId of the StateMachine instance where the Transition occurs. If the Transition occurs in a SubStateMachine, then the NodeId of the SubStateMachine has to be used. If the Transition occurs between a StateMachine and a SubStateMachine, then the NodeId of the StateMachine has to be used, independent of the direction of the Transition.

Transition identifies the Transition that triggered the Event.

FromState identifies the State before the Transition.

ToState identifies the State after the Transition.

The AuditUpdateStateEventType is a subtype of the AuditUpdateMethodEventType. It can be used to generate an Event identifying that a Transition of a StateMachine was triggered. It is formally defined in Table 16.

Table 16 – AuditUpdateStateEventType

Attribute

Value

BrowseName

AuditUpdateStateEventType

IsAbstract

True

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the AuditUpdateMethodEventType defined in OPC 10000-5

HasProperty

Variable

OldStateId

BaseDataType

PropertyType

Mandatory

HasProperty

Variable

NewStateId

BaseDataType

PropertyType

Mandatory

Conformance Units

Auditing UpdateStates

The AuditUpdateStateEventType inherits the Properties of the AuditUpdateMethodEventType.

The inherited Property SourceNode shall be filled with the NodeId of the StateMachine instance where the State changed. If the State changed in a SubStateMachine, then the NodeId of the SubStateMachine has to be used.

The SourceName for Events of this type should be the effect that generated the event (e.g. the name of a Method). If the effect was generated by a Method call, the SourceName should be the name of the Method prefixed with "Method/".

OldStateId reflects the Id of the state prior the change.

NewStateId reflects the new Id of the state after the change.

In general, all rules on subtyping apply for StateMachine types as well. Some additional rules apply for StateMachine types.

States and Transitions are not instantiated, this information is only provided on the ObjectType. They have no ModellingRule, and thus, also the inheritance of States and Transitions is not defined. Therefore, the following rules apply for subtyping StateMachines. Each State and Transition defined on the supertype shall be available on the subtype as well. That is, for each State defined on the supertype another Node of the same ObjectType having the same BrowseName and the same StateNumber shall be defined on the subtype. For each Transition defined on the supertype another Node of the same ObjectType having the same BrowseName and the same TransitionNumber shall be defined on the subtype. All references defining the StateMachine (HasCause, HasEffect, FromState, ToState, HasSubStateMachine, HasGuard) shall be replicated in the subtype as well. If InstanceDeclarations are referenced (e.g., Methods used to trigger Transitions) either the InstanceDeclaration of the supertype is referenced or the InstanceDeclaration is overridden, and in the latter case the overridden InstanceDeclaration of the subtype shall be referenced.

If a StateMachine type is not abstract, subtypes of it shall not change the behaviour of it. That means, that in this case a subtype shall not add States and it shall not add Transitions between its States. However, a subtype may add SubStateMachines, it may add Transitions from the States to the States of the SubStateMachine, and it may add Causes and Effects to a Transition. In addition, a subtype of a StateMachine type shall not remove States or Transitions.

In Table 17 specific StatusCodes used for StateMachines are defined.

Table 17 – Specific StatusCodes for StateMachines

Symbolic Id

Description

Bad_ StateNotActive

The accessed state is not active.