The ChoiceStateTypeis a subtype of the StateTypeand is formally defined in Table 18. An Objectof the ChoiceStateTyperepresents a pseudo state that is directly exited when it is entered. The Guardsdefined on the Transitionsfrom the ChoiceStatedetermine which Transitionis used. The Guardsshall be defined in a way that at least one Guardis true and a Transitioncan be determined. If this is not the case, the StateMachineis non-well formed. To avoid this, the specific ElseGuardVariableTypecan be used, which is only "true" if all other Guardson a ChoiceStateare "false". If several Guardsare "true", only one of those Transitionsis used. The algorithm to determine the Transitionis server-specific.

A sample StateMachineusing a ChoiceStateis given in Figure 16. It provides a simplified representation of a robot. When the StateMachineis in the S1_Initial state, calling the Load() Methodloads a program to the robot and triggers the Transitioninto the ChoiceState(CS). In the ChoiceStatethe Guardsare validated and in case the robot is on the correct position for the loaded program (validated by the guard OnPath = True) the StateS3_Ready is entered. In case the robot is not in the correct position (Else) the S2_Loaded State is entered. In that State, the Prepare() Methodputs the robot in the correct position, and triggers the Transitionto S3_Ready. If the robot is ready, it can be started. While it is running, it can be stopped. If the program is finished, the robot goes back to either the loaded or ready state, depending on its position, using the ChoiceState, again.

image018.png

Figure 16– Example of a ChoiceState

As the ChoiceStateis directly exited after it is entered there shall be no trigger (using the HasCause ReferenceTypeor a subtype) defined on any leaving Transition(Transitionsreferencing the ChoiceStatewith the FromState Referenceor a subtype).

Table 18– ChoiceStateType

Attribute

Value

BrowseName

ChoiceStateType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the StateTypedefined in Clause 4.4.8

Conformance Units

Base Info Choice States