The ChoiceStateType is a subtype of the StateType and is formally defined in Table 18. An Object of the ChoiceStateType represents a pseudo state that is directly exited when it is entered. The Guards defined on the Transitions from the ChoiceState determine which Transition is used. The Guards shall be defined in a way that at least one Guard is true and a Transition can be determined. If this is not the case, the StateMachine is non-well formed. To avoid this, the specific ElseGuardVariableType can be used, which is only "true" if all other Guards on a ChoiceState are "false". If several Guards are "true", only one of those Transitions is used. The algorithm to determine the Transition is server-specific.

A sample StateMachine using a ChoiceState is given in Figure 16. It provides a simplified representation of a robot. When the StateMachine is in the S1_Initial state, calling the Load() Method loads a program to the robot and triggers the Transition into the ChoiceState (CS). In the ChoiceState the Guards are validated and in case the robot is on the correct position for the loaded program (validated by the guard OnPath = True) the State S3_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() Method puts the robot in the correct position, and triggers the Transition to 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.


Figure 16 – Example of a ChoiceState

As the ChoiceState is directly exited after it is entered there shall be no trigger (using the HasCause ReferenceType or a subtype) defined on any leaving Transition (Transitions referencing the ChoiceState with the FromState Reference or a subtype).

Table 18 – ChoiceStateType













Subtype of the StateType defined in Clause 4.4.8

Conformance Units

Base Info Choice States