The additional properties and components that compose the ProgramStateMachineTypeare listed in Table 5. No ProgramStateMachineType specific semantics are assigned to the other base ObjectTypeor FiniteStateMachineType Attributesor Properties.

Table 5– ProgramStateMachineType

Attribute

Value

Includes all attributes specified for the FiniteStateMachineType

BrowseName

ProgramStateMachineType

IsAbstract

False

References

NodeClass

BrowseName

Data Type

TypeDefinition

Modelling Rule

HasProperty

Variable

Creatable

Boolean

PropertyType

--

HasProperty

Variable

Deletable

Boolean

PropertyType

Mandatory

HasProperty

Variable

AutoDelete

Boolean

PropertyType

Mandatory

HasProperty

Variable

RecycleCount

Int32

PropertyType

Mandatory

HasProperty

Variable

InstanceCount

UInt32

PropertyType

--

HasProperty

Variable

MaxInstanceCount

UInt32

PropertyType

--

HasProperty

Variable

MaxRecycleCount

UInt32

PropertyType

--

HasComponent

Variable

ProgramDiagnostic

ProgramDiagnostic2DataType

ProgramDiagnostic2Type

Optional

HasComponent

Object

Halted

StateType

--

HasComponent

Object

Ready

StateType

--

HasComponent

Object

Running

StateType

--

HasComponent

Object

Suspended

StateType

--

HasComponent

Object

HaltedToReady

TransitionType

--

HasComponent

Object

ReadyToRunning

TransitionType

--

HasComponent

Object

RunningToHalted

TransitionType

--

HasComponent

Object

RunningToReady

TransitionType

--

HasComponent

Object

RunningToSuspended

TransitionType

--

HasComponent

Object

SuspendedToRunning

TransitionType

--

HasComponent

Object

SuspendedToHalted

TransitionType

--

HasComponent

Object

SuspendedToReady

TransitionType

--

HasComponent

Object

ReadyToHalted

TransitionType

--

HasComponent

Method

Start

OptionalPlaceholder

HasComponent

Method

Suspend

OptionalPlaceholder

HasComponent

Method

Reset

OptionalPlaceholder

HasComponent

Method

Halt

OptionalPlaceholder

HasComponent

Method

Resume

OptionalPlaceholder

HasComponent

Object

FinalResultData

BaseObjectType

Optional

The Creatable Propertyis a boolean that specifies if Program Invocationsof this ProgramStateMachineType can be created by a Client. If False, these Program Invocationsare persistent or may only be created by the Server.

The Deletable Propertyis a boolean that specifies if a Program Invocationof this ProgramStateMachineType can be deleted by a Client. If False, these Program Invocationscan only be deleted by the Server.

The AutoDelete Propertyis a boolean that specifies if Program Invocationsof this ProgramStateMachineType are removed by the Server when execution terminates. If False, these Program Invocationspersist on the Server until they are deleted by the Client. When the Program Invocationis deleted, any result data associated with the instance is also removed.

The RecycleCount Propertyis an unsigned integer that specifies the number of times a Program Invocationof this type has been recycled or restarted from its starting point (not resumed). Note that the Reset Method may be required to prepare a Programto be restarted.

The MaxRecycleCount Propertyis an integer that specifies the maximum number of times a Program Invocationof this type can be recycled or restarted from its starting point (not resumed). If the value is less than 0, then there is no limit to the number of restarts. If the value is zero, then the Program may not be recycled or restarted.

The InstanceCount Propertyis an unsigned integer that specifies the number of Program Invocationsof this type that currently exist.

The MaxInstanceCount Propertyis an integer that specifies the maximum number of Program Invocationsof this type that can exist simultaneously on this Server. If the value is less than 0, then there is no limit.

The ProgramStateMachineTypecomponents consist of a set of Referencesto the Objectinstances of StateTypes, TransitionTypes, EventTypesand the Methodsthat collectively define the Program FiniteStateMachine.

image008.png

Figure 5– Program References

Figure 5illustrates the componentReferencesthat define the associations between two of the ProgramStateMachineType’sstates, Ready and Running. The complementary ReferenceTypes have been omitted to simplify the illustration.

Table 6specifies the ProgramStateMachineType’sstate Objects. These Objectsare instances of the StateTypedefined in OPC 10000-5, Annex B. Each state is assigned a unique StateNumber value. Subtypes of the ProgramStateMachineTypecan add references from any state to a subordinate or nested StateMachine Object to extend theFiniteStateMachine.

Table 6– Program states

BrowseName

References

Target BrowseName

Value

Target TypeDefinition

NOTES

States

Halted

HasProperty

StateNumber

11

PropertyType

ToTransition

HaltedToReady

TransitionType

FromTransition

RunningToHalted

TransitionType

FromTransition

SuspendedToHalted

TransitionType

FromTransition

ReadyToHalted

TransitionType

Ready

HasProperty

StateNumber

12

PropertyType

FromTransition

HaltedToReady

TransitionType

ToTransition

ReadyToRunning

TransitionType

FromTransition

RunningToReady

TransitionType

ToTransition

ReadyToHalted

TransitionType

Running

HasProperty

StateNumber

13

PropertyType

ToTransition

RunningToHalted

TransitionType

ToTransition

RunningToReady

TransitionType

ToTransition

RunningToSuspended

TransitionType

FromTransition

ReadyToRunning

TransitionType

FromTransition

SuspendedToRunning

TransitionType

Suspended

HasProperty

StateNumber

14

PropertyType

ToTransition

SuspendedToRunning

TransitionType

ToTransition

SuspendedToHalted

TransitionType

ToTransition

SuspendedToReady

TransitionType

FromTransition

RunningToSuspended

TransitionType

TheHaltedstate is the idle state for a Program. It can be an initial state or a terminal state. As an initial state, the Program Invocationcannot begin execution due to conditions at the Server. As a terminal state, Halted can indicate either a failed or completed Program. A subordinate state or result can be used to distinguish the nature of the termination. The Halted state references four Transition Objects, which identify the allowed state transitions to the Ready state and from the Ready, Running, and Suspended states.

The Ready state indicates that the Programis prepared to begin execution. Programs that are ready to begin upon their creation may transition immediately to the Ready state. The Ready state references four Transition Objects, which identify the allowed state transitions to the Running and Halted states and from the Halted and Ready states.

The Running state indicates that the Programis actively performing its Function. The Running state references five Transition Objects, which identify the allowed state transitions to the Halted, Ready, and Suspended states and from the Ready and Suspended states.

The Suspended state indicates that the Program has stopped performing its Function, but retains the ability to resume the Functionat the point at which it was executing when suspended. The Suspended state references four Transition Objects, which identify the allowed state transitions to the Ready, Running, and Halted state and from the Readystate.

ProgramStateMachineType Transitions are instances of the TransitionTypedefined in OPC 10000-5which also includes the definitions of the ToState, FromState, HasCause, and HasEffect references used. Table 7specifies the transitions defined for the ProgramStateMachineType. Each transition is assigned a unique TransitionNumber. The Notes column indicates when a cause is referencing Methodsand when effects are optional.

Table 7– Program transitions

BrowseName

References

Target BrowseName

Value

Target TypeDefinition

Notes

Transitions

HaltedToReady

HasProperty

TransitionNumber

1

PropertyType

ToState

Ready

StateType

FromState

Halted

StateType

HasCause

Reset

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

ReadyToRunning

HasProperty

TransitionNumber

2

PropertyType

ToState

Running

StateType

FromState

Ready

StateType

HasCause

Start

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

RunningToHalted

HasProperty

TransitionNumber

3

PropertyType

ToState

Halted

StateType

FromState

Running

StateType

HasCause

Halt

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

RunningToReady

HasProperty

TransitionNumber

4

PropertyType

ToState

Ready

StateType

FromState

Runnning

StateType

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

RunningToSuspended

HasProperty

TransitionNumber

5

PropertyType

ToState

Running

StateType

FromState

Suspended

StateType

HasCause

Suspend

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

SuspendedToRunning

HasProperty

TransitionNumber

6

PropertyType

ToState

Running

StateType

FromState

Suspended

StateType

HasCause

Resume

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

SuspendedToHalted

HasProperty

TransitionNumber

7

PropertyType

ToState

Halted

StateType

FromState

Suspended

StateType

HasCause

Halt

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

SuspendedToReady

HasProperty

TransitionNumber

8

PropertyType

ToState

Ready

StateType

FromState

Suspended

StateType

HasCause

Reset

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

ReadyToHalted

HasProperty

TransitionNumber

9

PropertyType

ToState

Halted

StateType

FromState

Ready

StateType

HasCause

Halt

Method

HasEffect

ProgramTransitionEventType

HasEffect

AuditProgramTransitionEventType

TheHaltedToReady transition specifies the transition from the Halted to Ready states. It may be caused by the Reset Method.

TheReadyToRunning transition specifies the transition from the Ready to Runningstates. It is caused by the Start Method.

TheRunningToHalted transition specifies the transition from the Runningto Halted states. It is caused by the Halt Method.

TheRunningToReady transition specifies the transition from the Running to Ready states. TheRunningToSuspended transition specifies the Transition from the Running to Suspended states. It is caused by the Suspend Method.

TheSuspendedToRunning transition specifies the transition from the Suspended to Running states. It is caused by the Resume Method.

TheSuspendedToHalted transition specifies the transition from the Suspended to Halted states. It is caused by the Halt Method.

TheSuspendedToReady transition specifies the transition from the Suspended to Ready states. It is caused internally.

TheReadyToHalted transition specifies the transition from the Ready to Halted states. It is caused by the Halt Method.

Two HasEffectreferences are specified for each Programtransition. These effects are Eventsof ProgramTransitionEventTypeand AuditProgramTransitionEventType defined in 5.2.5. The ProgramTransitionEventTypenotifies Clientsof the Programtransition and conveys result data. The AuditProgramTransitionEventTypeis used to audit transitions that result from Program Control Methods. The “Audit Server FacetProfiledefined in OPC 10000-7requires support of the AuditProgramTransitionEventType.

image009.png

Figure 6– ProgramStateMachineType causes and effects

The ProgramStateMachineTypeincludes references to the Causes of specific Programstate transitions. These causes refer to Method instances. Programs thatdo not supporta Program Control Method will omit the Causes reference to that Methodfrom the ProgramStateMachineType references. If a Method’s Causesreference is omitted from the ProgramStateMachineTypethen a Clientcannot cause the associated state transition. The Methodinstances referenced by the ProgramStateMachineTypeidentify the InputArgumentsand OutputArgumentsrequired for the Methodcalls to Program Invocationsof that ProgramStateMachineType. Table 8specifies the Methods defined as Causes forProgramStateMachineTypes. Figure 6illustrates the Referencesassociating the components and Propertiesof Methodsand Eventswith Program transitions.

Table 8– ProgramStateMachineType causes

BrowseName

References

Target BrowseName

Value

Target TypeDefinition

NOTES

Causes

Start

HasProperty

InputArguments

PropertyType

Optional

HasProperty

OutputArguments

PropertyType

Optional

Suspend

HasProperty

InputArguments

PropertyType

Optional

HasProperty

OutputArguments

PropertyType

Optional

Resume

HasProperty

InputArguments

PropertyType

Optional

HasProperty

OutputArguments

PropertyType

Optional

Halt

HasProperty

InputArguments

PropertyType

Optional

HasProperty

OutputArguments

PropertyType

Optional

Reset

HasProperty

InputArguments

PropertyType

Optional

HasProperty

OutputArguments

PropertyType

Optional

The Start Methodcauses the ReadyToRunning Program transition.

The Suspend Methodcauses the RunningToSuspended Program transition.

The Resume Methodcauses the SuspendedToRunning Program transition.

The Halt Methodcauses the RunningToHalted, SuspendedToHalted, or ReadyToHalted Program transitiondepending on thecurrent stateof theProgram.

The Reset Methodcauses the HaltedToReady Program transition.

TheExecutable Methodattribute indicates if a method can currently be executed. For Program Control Methods, this means that the owning Programhas a current statethat supports the transition caused by the Method.

Methodscan reference a set of InputArguments.For each ProgramStateMachineType, a set of InputArgumentsmay be defined for the supported Program Control Methods. The data passed in the arguments supplements the information required by the Programto perform its Function. All calls to a Program Control Methodfor each Program Invocationof that ProgramStateMachineTypeshall pass the specified arguments.

Methodscan reference a set of OutputArguments. For each ProgramStateMachineType, a set of OutputArgumentsis defined for the supported Program Control Methods. All calls to a Program Control Methodfor each Program Invocationof that ProgramStateMachineTypeshall pass the specified arguments.

The ProgramStateMachineTypeincludes component references to the Effects of each of the Program’sstate transitions. These EffectsareEvents. EachTransitionshall have a HasEffect Referenceto a ProgramTransitionEventType and can have anAuditProgramTransitionEventType. When the transition occurs, Eventnotifications of the referenced type are generated for subscribed Clients.The Program Invocationmay serve as the EventNotifierfor these Eventsor an owning Objector the Server Object may provide the notifications.

ProgramTransitionEventTypes provide the means for delivering result data and confirming state transitions for subscribed Clientson each definedProgram State Transition.The AuditProgramTransitionEventTypeallows the auditing of changes to the Program’s state in conjunction with Client Method Calls.

TheProgramTransitionEventTypeis a subtype of the TransitionEventType. It is used with Programsto acquire intermediate or final results or other data associated with a state transition. A Programcan have a unique ProgramTransitionEventTypedefinition for any transition. Each ProgramTransitionEventTypespecifies the IntermediateResultdata specific to the designated state transition on that ProgramStateMachineType. Each transition can yield different intermediate result data. Table 9specifies the ProgramTransitionEventType.

Table 10identifies the ProgramTransitionEventTypesthat are specified for ProgramStateMachineTypes.

Table 9– ProgramTransitionEventType

Attribute

Value

BrowseName

ProgramTransitionEventType

IsAbstract

True

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the base TransitionEventTypedefined in OPC 10000-5.

HasComponent

Variable

IntermediateResult

BaseDataVariableType

Mandatory

TransitionNumberidentifies the Programtransition that triggered the Event.

FromStateNumberidentifies the state before the Programtransition.

ToStateNumberidentifies the state after the Programtransition.

The IntermediateResultis an Objectthat aggregates a set of Variableswhose values are relevant for the Programat the instant of the associated transition. The ObjectTypefor the IntermediateResultspecifies the collection of Variablesusing a set of HasComponent References.

Table 10– ProgramTransitionEvents

BrowseName

References

Target BrowseName

Value

Target TypeDefinition

Notes

Effects

HaltedToReadyEvent

HasProperty

TransitionNumber

1

PropertyType

HasProperty

FromStateNumber

1

PropertyType

HasProperty

ToStateNumber

2

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

ReadyToRunningEvent

HasProperty

TransitionNumber

2

PropertyType

HasProperty

FromStateNumber

2

PropertyType

HasProperty

ToStateNumber

3

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

RunningToHaltedEvent

HasProperty

TransitionNumber

3

PropertyType

HasProperty

FromStateNumber

3

PropertyType

HasProperty

ToStateNumber

1

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

RunningToReadyEvent

HasProperty

TransitionNumber

4

PropertyType

HasProperty

FromStateNumber

3

PropertyType

HasProperty

ToStateNumber

2

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

RunningToSuspendedEvent

HasProperty

TransitionNumber

5

PropertyType

HasProperty

FromStateNumber

3

PropertyType

HasProperty

ToStateNumber

4

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

SuspendedToRunningEvent

HasProperty

TransitionNumber

6

PropertyType

HasProperty

FromStateNumber

4

PropertyType

HasProperty

ToStateNumber

3

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

SuspendedToHaltedEvent

HasProperty

TransitionNumber

7

PropertyType

HasProperty

FromStateNumber

4

PropertyType

HasProperty

ToStateNumber

1

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

SuspendedToReadyEvent

HasProperty

TransitionNumber

8

PropertyType

HasProperty

FromStateNumber

4

PropertyType

HasProperty

ToStateNumber

2

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

ReadyToHaltedEvent

HasProperty

TransitionNumber

9

PropertyType

HasProperty

FromStateNumber

2

PropertyType

HasProperty

ToStateNumber

1

PropertyType

HasComponent

IntermediateResults

ObjectType

Optional

The AuditProgramTransitionEventType is a subtype of the AuditUpdateStateEventType. It is used with Programs to provide a means to audit the Program State transitionsassociated with any Client invoked Program Control Method. Servers shall generate AuditProgramTransitionEvents if they support the Audit Server Facet Profiledefined in OPC 10000-7.

Table 11specifies the definition of the AuditProgramTransitionEventType.

Table 11– AuditProgramTransitionEventType

Attribute

Value

BrowseName

AuditProgramTransitionEventType

IsAbstract

True

References

NodeClass

BrowseName

DataType

TypeDefinition

ModellingRule

Subtype of the AuditUpdateStateEventTypedefined in OPC 10000-5.

HasProperty

Variable

TransitionNumber

UInt32

PropertyType

Mandatory

This EventTypeinherits all Propertiesof the AuditUpdateStateEventType defined in OPC 10000-5, except as noted below.

The Status Property,specified in OPC 10000-5,, identifies whether the state transition resulted from a Program Control Method call (set Statusto ) or not (set Statusto FALSE).

The SourceNamespecified in OPC 10000-5, identifies the Methodcausing the Program transition when it is the result of a Clientinvoked ProgramControlMethod. The SourceNameis prefixed with “Method/” and the name of the ProgramControlMethod, “Method/Start” for example.

The ClientUserId Property,specified in OPC 10000-5, identifies the user of the Clientthat issued the Program Control Methodif it is associated with this Program state transition.

The ActionTimeStamp Property,specified in OPC 10000-5“AuditEventType”, identifies when the time the Program state transition that resulted in the Eventbeing generated occurred.

The TransitionNumber Propertyis a Variablethat identifies the transition that triggered the Event.

The FinalResultData ObjectTypespecifies the VariableTypesthat are preserved when the Programhas completed its Function. The ObjectType includesa HasComponent for a VariableTypeof each Variablethat comprises the final result data.

This structure contains elements that chronicle the Program Invocation’sactivity and can be used to aid in the diagnosis of Programproblems.

Note The original ProgramDiagnosticDataType had flaws. To avoid collisions with existing implementations, a new version with name ProgramDiagnostic2DataType has been created.

Its composition is defined in Table 12.

Table 12– ProgramDiagnostic2DataType structure

Name

Type

Description

ProgramDiagnostic2DataType

structure

createSessionId

NodeId

The CreateSessionIdcontains the SessionIdof the Sessionon which the call to the Create Method was issued to create the Program Invocation.

createClientName

String

The CreateClientNameis the name of the Clientof the Sessionthat created the Program Invocation.

invocationCreationTime

UtcTime

The InvocationCreationTimeidentifies the time the Program Invocationwas created.

lastTransitionTime

UtcTime

The LastTransitionTimeidentifies the time of the last Program state transition that occurred.

lastMethodCall

String

The LastMethodCallidentifies the last Program Methodcalled on the Program Invocation.

lastMethodSessionId

NodeId

The LastMethodSessionIdcontains the SessionIdof the Sessionon which the last Program Control Methodcall to the Program Invocationwas issued.

lastMethodInputArguments

Argument[]

The LastMethodInputArgumentsprovides the input arguments on the last Program Methodcall.

lastMethodOutputArguments

Argument[]

The LastMethodOutputArgumentsprovides the output arguments on the last Program Methodcall.

lastMethodInputValues

BaseDataType[]

The LastMethodInputValuespreserves the values of the input arguments on the last Program Methodcall. The size and order of this list matches the size and order of the lastMethodInputArgumentsfield.

lastMethodOutputValues

BaseDataType[]

The LastMethodOutputValuespreserves the values of the output arguments on the last Program Methodcall. The size and order of this list matches the size and order of the lastMethodOutputArgumentsfield.

lastMethodCallTime

UtcTime

The LastMethodCallTimeidentifies the time of the last Method call to the Program Invocation.

lastMethodReturnStatus

StatusResult

The LastMethodReturnStatus preserves the value of the return statusfor the last Program Control Method requested forthis Program Invocation.

Its representation in the AddressSpaceis defined in Table 13.

Table 13– ProgramDiagnostic2DataType definition

Attributes

Value

BrowseName

ProgramDiagnostic2DataType

This VariableTypeaggregates simple Variablesusing simple DataTypesthat reflect the elements of the ProgramDiagnosticDataType structure. Its DataVariableshave the same semantic as defined in in 5.2.8.

Note The original ProgramDiagnosticType VariableType had the same flaws as the structure. To avoid collisions with existing implementations, a new version with name ProgramDiagnostic2Type has been created.

The VariableTypeis formally defined in Table 14.

Table 14– ProgramDiagnostic2Type VariableType

Attribute

Value

BrowseName

ProgramDiagnostic2Type

DataType

ProgramDiagnostic2DataType

ValueRank

-1 (Scalar)

IsAbstract

False

References

NodeClass

BrowseName

DataType / TypeDefinition

ModellingRule

Subtype of the BaseDataVariableType defined in OPC 10000-5.

HasComponent

Variable

CreateSessionId

NodeId

Mandatory

HasComponent

Variable

CreateClientName

String

Mandatory

HasComponent

Variable

InvocationCreationTime

UtcTime

Mandatory

HasProperty

Variable

LastTransitionTime

UtcTime

Mandatory

HasComponent

Variable

LastMethodCall

String

Mandatory

HasComponent

Variable

LastMethodSessionId

NodeId

Mandatory

HasComponent

Variable

LastMethodInputArguments

Argument[]

Mandatory

HasComponent

Variable

LastMethodOutputArguments

Argument[]

Mandatory

HasComponent

Variable

LastMethodInputValues

BaseDataType[]

Mandatory

HasComponent

Variable

LastMethodOutputValues

BaseDataType[]

Mandatory

HasComponent

Variable

LastMethodCallTime

UtcTime

Mandatory

HasComponent

Variable

LastMethodReturnStatus

StatusCode

Mandatory