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

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

The HasGuard ReferenceTypeis a concrete ReferenceTypeand can be used directly. It is a subtype of HasComponent.

The semantic of this ReferenceTypeis to point from a Transitionto a Guard. The Guardindicates if the Transitioncan be used or not (see GuardVariableType). A Transitioncan only be used, if the Guardis "True". A Transitioncan point to several Guards. In that case, all Guardsneed to be "True" before the Transitioncan be used. If there is no Guard, the Transitioncan always be used (considered as if all Guardsare "True").

The SourceNodeof this ReferenceTypeshall be an Objectof the ObjectType TransitionTypeor one of its subtypes. The TargetNodeshall be a Variableof the VariableType GuardVariableTypeor one of its subtypes.

The representation of the HasGuard ReferenceTypein the AddressSpaceis 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 GuardVariableTypeprovides the information of a Guardof a Transitionin a StateMachine. A Guardindicates, if the Transitioncan be used or not. The Guarddefines a semantic that can be evaluated to "True" or "False". Only if the semantic is "True", the Transitionconnected via a HasGuard Referencecan be used. The value of the GuardVariableTypeprovides the semantic of the Guardin a human-readable way, that can be used to display the StateMachine.

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

The GuardVariableTypeis 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 Referenceto 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 ExpressionGuardVariableTypeprovides, in addition to the human-readable semantic from its GuardVariableType, a machine interpretable representation on the semantic.

The ExpressionGuardVariableTypeis 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 Expressionprovides a ContentFilter, that shall be evaluated on the Object the StateMachine belongs to. This is a machine-readable semantic of the Guard. If the ContentFilterevaluates to "True", the Guardis "True", otherwise the Guardis "False".

The ContentFilterfor ExpressionGuardVariableTypeis restricted to basic operators (see OPC 10000-4for details).

The ContentFiltercan reference any Variablesdefined on the StateMachineTypeand are validated on the instance of the StateMachine. If the definition of the Variableis not owned directly by the StateMachinebut for example some other type, the StateMachineinstance shall reference that Variable.

The ElseGuardVariableTypeis a specialization of the GuardVariableTypedefining a concrete semantic for the Guard. The value of the Guardshould always be {"en", "Else"} or a translation of this. The ElseGuardVariableTypeshall only be used on pseudo states like the ChoiceStateType. That means, that it shall only be referenced from Transitions having such a StateTypeas SourceNode. The ElseGuardVariableTypeshall 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 ElseGuardVariableTypeshall be the only Guardof a Transition. That means, if a Transitionreferences an instance of an ElseGuardVariableType, it shall not reference any other Guards.

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

The ElseGuardVariableTypeis 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