Figure B.7– Example of a StateMachineType using inheritance

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

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


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

Figure B.8gives an example of a StateMachineTypehaving a SubStateMachinefor its “State1”. For simplicity no effects and causes are shown, as well as type information for the Statesor ModellingRules.

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

An Objectof “MyStateMachineType”, called “MyStateMachine” has Variablesfor the current State, but also has an Object“MySubMachine” and a Variablerepresenting the current state of the SubStateMachine. Since the SubStateMachineis only used when “MyStateMachine” is in “State1”, a client would receive a Bad_StateNotActive StatusCodewhen reading the SubStateMachine CurrentState Variableif “MyStateMachine” is in a different State.


Figure B.9– Example of a StateMachineType using containment

Figure B.9gives an example of an ObjectTypenot only representing a StateMachinebut 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”. Objectsof “MyObjectType” also contain such an Objectrepresenting the StateMachine and a Variablecontaining the current state of the StateMachine, as shown in the Figure.

The StateMachinesshown so far only had Transitionsbetween Stateson the same level, that is, on the same StateMachine. Of cause, it is possible and often required to have Transitionsbetween Statesof the StateMachineand Statesof its SubStateMachine.

Because a SubStateMachinecan be defined by another StateMachineTypeand this type can be used in several places, it is not possible to add a bi-directional Referencefrom one of the shared Statesof the SubStateMachineto another StateMachine. In this case it is suitable to expose the FromStateor ToState Referencesuni-directional, that is, only pointing from the Transitionto the Stateand not being able to browse to the other direction. If a Transitionpoints from a Stateof a SubStateMachineto a Stateof another sub-machine, both, the FromStateand the ToState Reference, are handled uni-directional.

A Client shall be able to handle the information of a StateMachineif the ToStateand FromState Referencesare only exposed as forward Referencesand the inverse Referencesare omitted.

Figure B.10gives 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 StateMachineTypein the AddressSpaceis given. The “Transition1”, part of the definition of “MyStateMachineType”, points to the “StateX” of the StateMachineType“AnotherStateMachineType”. The Referenceis only exposed as forward Referenceand the inverse Referenceis omitted. Thus, there is no Referencefrom 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