8.4 VisionStepModelStateMachineType

8.4.1 Operation of the VisionStepModelStateMachine

Vision systems frequently require interaction with external systems during image acquisition. For example, it may be required to capture images in several different positions, i.e., moving the part between image capturing operations. In that case, the vision system will signal to the PLC when it has captured an image, so that the part may be safely moved, and the PLC will in turn signal to the vision system when the part is in the next position to capture the next image.

To enable the states of the VisionAutomaticModeStateMachineType to do such interaction, each is a complex state with an optional SubStateMachine of the VisionStepModelStateMachineType.

Figure 32 shows the entire SubStateMachine diagram.

Figure 32 – States and transitions of the VisionStepModelStateMachineType
8.4.1.1 Entering the step model SubStateMachine

It is supposed that a SubStateMachine is entered automatically if it is present in the superior state. Since the Entry state is of InitialStateType it will be entered automatically.

Upon entering the SubStateMachine there is a check in the Entry state whether there is a step-sequence to execute. This is application-dependent and may depend on the situation (e.g. on the currently active recipe) and the way of determining this is application-specific.

8.4.1.2 Executing a step sequence

If in the Entry state the system decides that there is a step sequence to be executed, the SubStateMachine informs the client about this by firing an EnterStepSequence event. It then enters the Wait state to wait for a synchronization event.

The synchronization can occur by a Sync method call from an OPC UA client, typically the control system. The synchronization can also occur internally, typically due to communication events on other interfaces, e.g. a digital trigger.

The system then enters the Step state, where it does the actual work required in this state of the step model and decides whether there are any steps left in the step sequence. This is application-specific, as is the original decision to execute a step sequence at all.

The system indicates the need for another step-sequence cycle by firing a NextStep event and re-enters the Wait state. In this manner, an arbitrary and dynamic number of steps can be executed. It is not necessary to predefine the number of steps.

To use the common example of image acquisition: There may be one image acquisition in each Step state, but it is also possible that the step sequence is used only for mechanical synchronization and all acquisition is done in the Exit state.

8.4.1.3 Completing the SubStateMachine

If no step-sequence is to be executed at all, the system will transition into the Exit state directly from the Entry state and perform the actual task of the superior state. After the task is finished, the superior state will transition to whatever is its target state, thus de-activating the SubStateMachine.

When a step sequence is being executed and the system decides in the Step state that there are no more steps to execute in the step sequence, it fires a LeaveStepSequence event, transitions to the Exit state and proceeds as in the case without a step sequence.

How the work of the superior state and of the steps of the sequence is distributed between the states of the step model is application-specific.

8.4.1.4 Leaving the superior state

The superior state of a currently active VisionStepModelStateMachine is some state in the VisionStateMachineType or the VisionAutomaticModeStateMachineType.

Each of these states can be left due to internal causes (like error conditions) or external causes (like the Stop, Abort, Halt, Reset method calls). In that case, the SubStateMachine becomes inactive and will be in state Bad_StateNotActive, as explained in Section 8.1.2.

How and when these transitions take place is at the discretion of the vision system underlying the OPC UA server. In particular, the vision system can disable the Executable flag on each of these methods when the current operation does not allow for, e.g. an Abort command to be carried out.

8.4.2 VisionStepModelStateMachineType Overview

This ObjectType is a subtype of FiniteStateMachineType and it is used to represent interactions of the vision system with external components/systems for synchronization purposes. It is formally defined in Table 114.

Figure 33 – Overview VisionStepModelStateMachineType

8.4.3 VisionStepModelStateMachineType Definition

VisionStepModelStateMachineType is formally defined in Table 114.

Table 114 – VisionStepModelStateMachineType definition
Attribute Value
Includes all attributes specified for the FiniteStateMachineType
BrowseNameVisionStepModelStateMachineType
IsAbstractFalse
References NodeClass BrowseName DataType TypeDefinition ModellingRule
Subtype of the FiniteStateMachineType defined in OPC 10000-5 Annex B.4.5
HasComponentObject Entry --InitialStateType--
HasComponentObject Exit --StateType--
HasComponentObject Wait --StateType--
HasComponentObject Step --StateType--
HasComponentObjectEntryToExitAuto--TransitionType--
HasComponentObjectEntryToWaitAuto--TransitionType--
HasComponentObjectWaitToStep--TransitionType--
HasComponentObjectWaitToStepAuto--TransitionType--
HasComponentObjectStepToExitAuto--TransitionType--
HasComponentObjectStepToWaitAuto--TransitionType--
HasComponentMethod Sync ----Mandatory

8.4.4 VisionStepModelStateMachineType States

Table 115 lists the states of VisionStepModelStateMachineType. See Table 116 for a brief description of the states. These will be detailed in the following subsections.

Table 115 – VisionStepModelStateMachineType states
BrowseName References Target BrowseName Value Target TypeDefinition Notes
EntryHasPropertyStateNumber11PropertyType--
ToTransitionEntryToExitAutoTransitionType--
ToTransitionEntryToWaitAutoTransitionType--
ExitHasPropertyStateNumber12PropertyType--
FromTransitionEntryToExitAutoTransitionType--
FromTransitionStepToExitAutoTransitionType--
WaitHasPropertyStateNumber13PropertyType--
FromTransitionEntryToWaitAutoTransitionType--
FromTransitionStepToWaitAutoTransitionType--
ToTransitionWaitToStepTransitionType--
ToTransitionWaitToStepAutoTransitionType--
StepHasPropertyStateNumber14PropertyType--
FromTransitionWaitToStepTransitionType--
FromTransitionWaitToStepAutoTransitionType--
ToTransitionStepToExitAutoTransitionType--
ToTransitionStepToWaitAutoTransitionType--
Table 116 – VisionStepModelStateMachineType state descriptions
StateName Description
EntryIf a superior state has a step model SubStateMachine, this state will be entered automatically.
In this state, the step model SubStateMachine decides whether a step model execution is required or not. This decision may depend on the current recipe or other factors.
ExitIn this state, the SubStateMachine signals to the superior state that its work is finished so that the superior state can be completed and transition to its target state. The superior state may also be left at any time due to other reasons regardless of the current state of the step model.
WaitIn this state, the system waits for a synchronization event. This may be a call to the Sync method or other internal or external factor, e.g. communication via a different interface.
StepIn this state, the system carries out the work for the current step, then decides based on the current situation whether more steps are required, in which case the state machine transitions back into state Wait, or not, in which case the state machine transitions to the Exit state.

8.4.5 VisionStepModelStateMachineType Transitions

Table 117 lists the transitions of VisionStepModelStateMachineType.

Table 117 – VisionStepModelStateMachineType transitions
BrowseName References Target BrowseName Value Target TypeDefinition Notes
EntryToExitAutoHasPropertyTransitionNumber11120PropertyType--
FromStateEntryStateType--
ToStateExitStateType--
HasEffectStateChangedEventType--
EntryToWaitAutoHasPropertyTransitionNumber11130PropertyType--
FromStateEntryStateType--
ToStateWaitStateType--
HasEffectEnterStepSequenceEventType--
HasEffectStateChangedEventType--
WaitToStepHasPropertyTransitionNumber13141PropertyType--
FromStateWaitStateType--
ToStateStepStateType--
HasCauseSyncMethod--
HasEffectStateChangedEventType--
WaitToStepAutoHasPropertyTransitionNumber13140PropertyType--
FromStateWaitStateType--
ToStateStepStateType--
HasEffectStateChangedEventType--
StepToExitAutoHasPropertyTransitionNumber14120PropertyType--
FromStateStepStateType--
ToStateExitStateType--
HasEffectLeaveStepSequenceEventType--
HasEffectStateChangedEventType--
StepToWaitAutoHasPropertyTransitionNumber14130PropertyType--
FromStateStepStateType--
ToStateWaitStateType--
HasEffectNextStepEventType--
HasEffectStateChangedEventType--

8.4.6 VisionStepModelStateMachineType Methods

8.4.6.1 Sync method

This method can be called to cause a transition from the Wait state in the step model to the ExecuteStep state.

Signature

	Sync ([in]	Int32	cause[in]	String	causeDescription[out]	Int32	error);
Table 118 – Sync Method Arguments
Argument Description
causeImplementation-specific number denoting circumstances of the command
causeDescriptionDescription of the circumstances, e.g. for logging purposes. May be empty.
error

0 – OK

Values > 0 are reserved for errors defined by this and future standards.

Values < 0 shall be used for application-specific errors.

Table 119 – Sync Method AddressSpace Definition
Attribute Value
BrowseNameSync
References NodeClass BrowseName DataType TypeDefinition ModellingRule
HasPropertyVariableInputArgumentsArgument[]PropertyTypeMandatory
HasPropertyVariableOutputArgumentsArgument[]PropertyTypeMandatory

The cause argument given to the method can only be interpreted by the underlying vision system It can be used, for example, for ending the step model prematurely.

8.4.7 VisionStepModelStateMachine Events

8.4.7.1 EnterStepSequenceEventType

EnterStepSequenceEventType is an EventType subtype of BaseEventType, defined in OPC 10000-5. This event is to be triggered by the server when in the Entry state the decision is taken that under the current circumstances (superior state, recipe etc.) a step sequence is to be executed and the transition into the first Wait state is initiated. The structure is defined in Figure 34. It is formally defined in Table 120.

Event properties

Steps: number of steps to expect. If the number of steps is not known, this should be -1. Even if this is a positive value, the client should not rely on it because circumstances occurring during execution of the step model may change the number of steps required, for example a call to the Sync method with a particular mode argument.

Figure 34 – Overview EnterStepSequenceEvent
Table 120 – EnterStepSequenceEventType definition
Attribute Value
BrowseNameEnterStepSequenceEventType
IsAbstractFalse
References NodeClass BrowseName DataType TypeDefinition ModellingRule
Subtype of the BaseEventType defined in OPC 10000-5
HasPropertyVariableStepsInt32PropertyTypeMandatory
8.4.7.2 NextStepEventType

NextStepEventType is an EventType subtype of BaseEventType, defined in OPC 10000-5. This event is to be triggered by the server when in the Step state the decision is reached that under the current circumstances (superior state, recipe, number of steps already taken, parameter of Sync method) another step has to be taken and the state machine must translate to the Wait state. It is formally defined in Table 121

Event properties

State NodeId

Running number of the step

Figure 35 – Overview NextStepEvent
Table 121 – NextStepEventType definition
Attribute Value
BrowseNameNextStepEventType
IsAbstractFalse
References NodeClass BrowseName DataType TypeDefinition ModellingRule
Subtype of the BaseEventType defined in OPC 10000-5
HasPropertyVariableStepInt32PropertyTypeMandatory
8.4.7.3 LeaveStepSequenceEventType

LeaveStepSequenceEventType is an EventType subtype of BaseEventType, defined in OPC 10000-5, this event is to be triggered by the server when in the Step state the decision is reached that under the current circumstances (superior state, recipe, number of steps already taken, parameter of Sync method) no further steps have to be taken and the transition into the Exit state is initiated. It is formally defined in Table 122.

Figure 36 – Overview LeaveStepSequenceEventType
Table 122 – LeaveStepSequenceEventType definition
Attribute Value
BrowseNameLeaveStepSequenceEventType
IsAbstractFalse
References NodeClass BrowseName DataType TypeDefinition ModellingRule
Subtype of the BaseEventType defined in OPC 10000-5