StateMachineType |
For the state machines definition we assume that state machines are types and instances of a type have their states and semantics specified by the type. For some types this means that the states and transitions are fixed. For other types the states and transitions may be dynamic or unknown. A state machine where all the states are specified explicitly by the type is called a finite state machine.
Therefore we distinguish between StateMachineType and StateMachine. The StateMachineType specifies a description of the state machine – its states, transitions, etc. – whereas the StateMachine is an instance of the StateMachineType and contains the current state only.
Each StateMachine contains information about the current state. If the StateMachineType has SubStateMachines, the StateMachine also contains information about the current state of the SubStateMachines. StateMachines which have their states completely defined by the type are instances of a FiniteStateMachineType.
The information model provides constructs that can be used to model discrete object behavior in terms of the states an object can reside in and the transitions that can happen between those states. State machines are built as complex objects using dedicated ObjectTypes, VariableTypes and ReferenceTypes, whose behavior is governed by the rules that must be strictly observed.
A state is a condition in which an object can be at some point during its lifetime, for some finite amount of time. A transition is a change of an object from one state (the source state) to another (the target state). The transition is triggered ("fires") when an event of interest – cause - to a given object occurs. According to the information model concept, causes are represented in the form of Methods that have to be called, but a vendor can define other items or have them be internal (i.e. nothing is listed causing the transition). There may also be an action associated with a triggered transition. This action called an “effect” is executed unconditionally before the object enters the target state. Effects are Events that are generated.
The simplified state machine model described above can be freely expanded to provide more complex functionality like sub-machines, parallel states, forks and joins, history states, choices and junctions, etc.
State machines are represented in the Address Space as an object of a type derived from the StateMachineType that defines a single Variable of the StateVariableType, which represents the current state of the machine. An instance of the StateMachineType shall generate an event whenever a state change occurs. Transitions are represented as objects of the TransitionType. Each valid transition shall have exactly one FromState reference and exactly one ToState reference, each pointing to an object of the StateType.
Using the above terminology we can represent any state machine from Figure 1 as a diagram shown in Figure 2 . For this diagram it is assumed that MyStateMachineType is derived directly or indirectly from the StateMachineType. All states, transitions and methods are components of this type.