This section describes extensions to the StateMachine model allowing choices and guards on StateMachines.

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.

image018.png

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

Attribute

Value

BrowseName

ChoiceStateType

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the StateType defined in Clause 4.4.8

Conformance Units

Base Info Choice States

The HasGuard ReferenceType is a concrete ReferenceType and can be used directly. It is a subtype of HasComponent.

The semantic of this ReferenceType is to point from a Transition to a Guard. The Guard indicates if the Transition can be used or not (see GuardVariableType). A Transition can only be used, if the Guard is "True". A Transition can point to several Guards. In that case, all Guards need to be "True" before the Transition can be used. If there is no Guard, the Transition can always be used (considered as if all Guards are "True").

The SourceNode of this ReferenceType shall be an Object of the ObjectType TransitionType or one of its subtypes. The TargetNode shall be a Variable of the VariableType GuardVariableType or one of its subtypes.

The representation of the HasGuard ReferenceType in the AddressSpace is specified in Table 19.

Table 19 – HasGuard ReferenceType

Attribute

Value

BrowseName

HasGuard

InverseName

GuardOf

Symmetric

False

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the HasComponent ReferenceType defined in OPC 10000-5. Note that a Reference to this subtype is not

shown in the definition of HasComponent.

Conformance Units

Base Info Choice States

The GuardVariableType provides the information of a Guard of a Transition in a StateMachine. A Guard indicates, if the Transition can be used or not. The Guard defines a semantic that can be evaluated to "True" or "False". Only if the semantic is "True", the Transition connected via a HasGuard Reference can be used. The value of the GuardVariableType provides the semantic of the Guard in a human-readable way, that can be used to display the StateMachine.

This base GuardVariableType does not define a machine-readable semantic of the Guard. The calculation, if the Guard is "True" or "False" is server-specific. Subtypes of this VariableType do define concrete machine-readable semantics.

The GuardVariableType is formally defined in Table 20.

Table 20 – GuardVariableType definition

Attribute

Value

BrowseName

GuardVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in Clause OPC 10000-5.

Note that a Reference to this subtype is not shown in the definition of the BaseDataVariableType.

HasSubtype

VariableType

ElseGuardVariableType

Defined in Clause 4.6.6

HasSubtype

VariableType

ExpressionGuardVariableType

Defined in Clause 4.6.5

Conformance Units

Base Info Choice States

The ExpressionGuardVariableType provides, in addition to the human-readable semantic from its GuardVariableType, a machine interpretable representation on the semantic.

The ExpressionGuardVariableType is formally defined in Table 21.

Table 21 – ExpressionGuardVariableType definition

Attribute

Value

BrowseName

ExpressionGuardVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the GuardVariableType defined in Clause 4.6.4

HasProperty

Variable

Expression

ContentFilter

PropertyType

Mandatory

Conformance Units

Base Info Choice States

The mandatory Property Expression provides a ContentFilter, that shall be evaluated on the Object the StateMachine belongs to. This is a machine-readable semantic of the Guard. If the ContentFilter evaluates to "True", the Guard is "True", otherwise the Guard is "False".

The ContentFilter for ExpressionGuardVariableType is restricted to basic operators (see OPC 10000-4 for details).

The ContentFilter can reference any Variables defined on the StateMachineType and are validated on the instance of the StateMachine. If the definition of the Variable is not owned directly by the StateMachine but for example some other type, the StateMachine instance shall reference that Variable.

The ElseGuardVariableType is a specialization of the GuardVariableType defining a concrete semantic for the Guard. The value of the Guard should always be {"en", "Else"} or a translation of this. The ElseGuardVariableType shall only be used on pseudo states like the ChoiceStateType. That means, that it shall only be referenced from Transitions having such a StateType as SourceNode. The ElseGuardVariableType shall only be used once for each State. That means, that each State shall at most have one Transition (referenced as SourceNode) referencing an ElseGuardVariableType. The ElseGuardVariableType shall be the only Guard of a Transition. That means, if a Transition references an instance of an ElseGuardVariableType, it shall not reference any other Guards.

The semantic of the ElseGuardVariableType is, that if a pseudo state is reached and no other Transition exists on the State where all its Guards are validated to "True", this Guards validates to "True" and thus its Transition is used.

The ElseGuardVariableType is formally defined in Table 22.

Table 22 – ElseGuardVariableType definition

Attribute

Value

BrowseName

ElseGuardVariableType

DataType

LocalizedText

ValueRank

−1 (−1 = Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the GuardVariableType defined in Clause 4.6.4

Conformance Units

Base Info Choice States