Figure B.7 – Example of a StateMachineType using inheritance

In Figure B.7 an example of a StateMachine is given using the Notation defined in OPC 10000-3. First, a new StateMachineType is defined, called “MyStateMachineType”, inheriting from the base FiniteStateMachineType. It contains two States, “State1” and “State2” and a Transition “Transition1” between them. The Transition points to a Method “MyMethod” as the Cause of the Transition and an EventType “EventType1” as the Effect of the Transition.

Instances of “MyStateMachineType” can be created, for example “MyStateMachine”. It has a Variable “CurrentState” representing the current State. The “MyStateMachine” Object only includes the Nodes which expose information specific to the instance.


Figure B.8 – Example of a StateMachineType with a SubStateMachine using inheritance

Figure B.8 gives an example of a StateMachineType having a SubStateMachine for its “State1”. For simplicity no effects and causes are shown, as well as type information for the States or ModellingRules.

The “MyStateMachineType” contains an Object “MySubMachine” of type “AnotherStateMachineType” representing a SubStateMachine. The “State1” references this Object with a HasSubStateMachine Reference, thus it is a SubStateMachine of “State1”. Since “MySubMachine” is an Object of type “AnotherStateMachineType” it has a Variable representing the current State. Since it is used as an InstanceDeclaration, no value is assigned to this Variable.

An Object of “MyStateMachineType”, called “MyStateMachine” has Variables for the current State, but also has an Object “MySubMachine” and a Variable representing the current state of the SubStateMachine. Since the SubStateMachine is only used when “MyStateMachine” is in “State1”, a client would receive a Bad_StateNotActive StatusCode when reading the SubStateMachine CurrentState Variable if “MyStateMachine” is in a different State.


Figure B.9 – Example of a StateMachineType using containment

Figure B.9 gives an example of an ObjectType not only representing a StateMachine but also having some other functionality. The ObjectType “MyObjectType” has an Object “MyComponent” representing this other functionality. But it also contains a StateMachine “MyStateMachine” of the type “MyStateMachineType”. Objects of “MyObjectType” also contain such an Object representing the StateMachine and a Variable containing the current state of the StateMachine, as shown in the Figure.

The StateMachines shown so far only had Transitions between States on the same level, that is, on the same StateMachine. Of cause, it is possible and often required to have Transitions between States of the StateMachine and States of its SubStateMachine.

Because a SubStateMachine can be defined by another StateMachineType and this type can be used in several places, it is not possible to add a bi-directional Reference from one of the shared States of the SubStateMachine to another StateMachine. In this case it is suitable to expose the FromState or ToState References uni-directional, that is, only pointing from the Transition to the State and not being able to browse to the other direction. If a Transition points from a State of a SubStateMachine to a State of another sub-machine, both, the FromState and the ToState Reference, are handled uni-directional.

A Client shall be able to handle the information of a StateMachine if the ToState and FromState References are only exposed as forward References and the inverse References are omitted.

Figure B.10 gives an example of a state machine having a transition from a sub-state to a state.


Figure B.10 – Example of a state machine with transitions from sub-states

In Figure B.11, the representation of this example as StateMachineType in the AddressSpace is given. The “Transition1”, part of the definition of “MyStateMachineType”, points to the “StateX” of the StateMachineType “AnotherStateMachineType”. The Reference is only exposed as forward Reference and the inverse Reference is omitted. Thus, there is no Reference from the “StateX” of “AnotherStateMachineType” to any part of “MyStateMachineType” and “AnotherStateMachineType” can be used in other places as well.


Figure B.11 – Example of a StateMachineType having Transition to SubStateMachine