.NET Based OPC UA Client/Server SDK  3.3.3.537
UnifiedAutomation.UaServer.ConditionModel Class Reference

The ConditionType defines all general characteristics of a Condition. All other ConditionTypes derive from it. More...

Inherits UnifiedAutomation.UaServer.BaseEventModel, UnifiedAutomation.UaServer.IMethodDispatcher, UnifiedAutomation.UaServer.ICondition, and UnifiedAutomation.UaServer.IActivatableModel.

Inherited by UnifiedAutomation.UaServer.AcknowledgeableConditionModel, and UnifiedAutomation.UaServer.DialogConditionModel.

Classes

struct  TransitionRaiser
 A helper struct to end a transaction. More...
 

Public Member Functions

void RaiseConditionChangedEvent (ConditionModel model)
 Emits a new condition changed event. More...
 
virtual StatusCode Enable ()
 Changes a Condition instance to the enabled state. More...
 
virtual StatusCode Enable (RequestContext context)
 Changes a Condition instance to the enabled state. More...
 
virtual StatusCode Disable ()
 Changes a Condition instance to the disabled state. More...
 
virtual StatusCode Disable (RequestContext context)
 Changes a Condition instance to the disabled state. More...
 
virtual StatusCode AddComment (byte[] eventId, LocalizedText comment, string clientUserId)
 Applies a comment to a specific state of a Condition instance. More...
 
virtual StatusCode AddComment (RequestContext context, byte[] eventId, LocalizedText comment)
 Applies a comment to a specific state of a Condition instance. More...
 
virtual void UpdateEnabledEffectiveDisplayName ()
 Updates the effect display name for the enabled state. More...
 
virtual void UpdateRetain ()
 Update the retain bit. More...
 
TransitionRaiser MergeTransitions ()
 Merges transitions. More...
 
TransitionRaiser NewTransition ()
 
virtual void ActivateModel (RequestContext context)
 Activates the model. More...
 
virtual void DeactivateModel ()
 Deactivates the model. More...
 
 ConditionModel ()
 Initializes a new instance of the ConditionModel class. More...
 
 ConditionModel (ConditionModel template)
 Initializes a new instance of the ConditionModel class. More...
 
override void UpdateEvent (GenericEvent e)
 Updates the event. More...
 
virtual CallMethodEventHandler GetMethodDispatcher (RequestContext context, NodeId objectId, NodeId methodId)
 Gets the method dispatcher. More...
 
virtual StatusCode DispatchMethod (RequestContext context, MethodHandle methodHandle, IList< Variant > inputArguments, List< StatusCode > inputArgumentResults, List< Variant > outputArguments)
 Dispatches the method. More...
 
- Public Member Functions inherited from UnifiedAutomation.UaServer.BaseEventModel
 BaseEventModel ()
 Initializes a new instance of the BaseEventModel class. More...
 
 BaseEventModel (BaseEventModel template)
 Initializes a new instance of the BaseEventModel class. More...
 
void SetRolePermissions (RolePermissionTypeCollection rolePermissions, BaseNodeManager nodeManager)
 Sets the RolePermissions to an event. Is used to restrict the receiving of the events to certain roles. More...
 
void SetRolePermissionsAndAccessRestriction (Node sourceNode, BaseNodeManager nodeManager)
 Sets the RolePermissions and AccessRestiriction to an event. Is used to restrict the receiving of the events to certain users. More...
 
void NewId ()
 Assigns a new EventId, Time and ReceiveTime to the event. More...
 
virtual GenericEvent CreateEvent (FilterManager manager)
 Creates the event. More...
 
virtual GenericEvent CreateEvent (FilterManager manager, bool autoGenerateEventIdAndTime)
 Creates the event. More...
 
- Public Member Functions inherited from UnifiedAutomation.UaServer.ModelControllerBase
virtual ModelHandle GetModelHandle (StringTable namespaceUris, object instance)
 Gets the metadata handle. More...
 
virtual DataValue GetValue (IMapperContext context, ModelMapping mapping)
 Gets the value associated with the mapping. More...
 
virtual bool SetValue (IMapperContext context, ModelMapping mapping, DataValue value)
 Sets the value associated with the mapping. More...
 
StatusCode GetStatusCode (string propertyName)
 Retrieve the status code for the given property. If no status code was explicitly set, StatusCodes.Good will be returned.
Parameters
propertyNameThe property name.
Returns
The status code of the property.

 
void SetStatusCode (string propertyName, StatusCode statusCode)
 Sets the status code of the given property. More...
 
- Public Member Functions inherited from UnifiedAutomation.UaServer.ICondition
GenericEvent CreateEvent (FilterManager manager, bool autoGenerateEventIdAndTime)
 Creates an generic event for the condition. More...
 

Protected Member Functions

void RaiseTransition ()
 Ends a merged transitions. More...
 
virtual void Initialize ()
 Called when the model is activated for the first time. More...
 
- Protected Member Functions inherited from UnifiedAutomation.UaServer.ModelControllerBase
void RaisePropertyChangedEvent ([CallerMemberName] string propertyName=null)
 Raises an property change event. More...
 
void RaisePropertyChangeRequestedEvent< T > (T value, [CallerMemberName] string propertyName=null)
 Called when the value of a property is supposed to be changed. More...
 
bool SetField< T > (ref T field, T value, [CallerMemberName] string propertyName=null)
 Sets the backing field to the new value, and triggers a property change event, if the value has changed. More...
 

Properties

bool IsInitialized [get, set]
 Gets or sets if the condition is initialized. More...
 
uint TransitionCount [get]
 
NodeId BranchId [get, set]
 
string ClientUserId [get, set]
 Is related to the Comment field and contains the identity of the user who inserted the most recent Comment. More...
 
ConditionVariableModel
< LocalizedText
Comment [get, set]
 Contains the last comment provided for a certain state (ConditionBranch). More...
 
new NodeId ConditionClassId [get, set]
 Specifies in which domain this Condition is used. More...
 
new LocalizedText ConditionClassName [get, set]
 
string ConditionName [get, set]
 Identifies the Condition instance that the Event originated from. More...
 
TwoStateVariableModel EnabledState [get, set]
 EnabledState indicates whether the Condition is enabled. More...
 
ConditionVariableModel< ushort > LastSeverity [get, set]
 Provides the previous severity of the ConditionBranch. More...
 
ConditionVariableModel
< StatusCode
Quality [get, set]
 Reveals the status of process values or other resources that this Condition instance is based upon. More...
 
bool Retain [get, set]
 
IConditionMethods ConditionMethods [get, set]
 Gets or sets the Condition methods. More...
 
- Properties inherited from UnifiedAutomation.UaServer.BaseEventModel
NodeId NodeId [get, set]
 The node identifier for a representation of an event in the Server address space. Used mainly for ConditionIds. More...
 
byte[] EventId [get, set]
 Generated by the server to uniquely identify a particular Event Notification. More...
 
NodeId EventType [get, set]
 Describes the specific type of Event. More...
 
NodeId SourceNode [get, set]
 Identifies the Node that the Event originated from. More...
 
string SourceName [get, set]
 Provides a description of the source of the Event. More...
 
DateTime Time [get, set]
 Provides the time the Event occurred. More...
 
DateTime ReceiveTime [get, set]
 Provides the time the OPC UA Server received the Event from the underlying device of another Server. More...
 
TimeZoneDataType LocalTime [get, set]
 Contains the Offset and the DaylightSavingInOffset flag. More...
 
LocalizedText Message [get, set]
 Provides a human-readable and localizable text description of the Event. More...
 
ushort Severity [get, set]
 An indication of the urgency of the Event. More...
 
NodeId ConditionClassId [get, set]
 Specifies in which domain this Condition is used. More...
 
LocalizedText ConditionClassName [get, set]
 
NodeId ConditionSubClassId [get, set]
 ConditionSubClassId specifies additional class[es] that apply to the Event. More...
 
LocalizedText ConditionSubClassName [get, set]
 
INodeAccessInfo NodeAccessInfo [get, set]
 Using a NodeAccessInfo can restrict the access of an event to single scopes. More...
 
AccessRestrictionType AccessRestriction [get, set]
 Using the AcccessRestrictions accessing the events can be restricted for users having a secure connection. More...
 
IRolePermissions RolePermissions [get, set]
 Using the RolePermissions accessing the events can be restricted for users having one of the configured roles. More...
 
- Properties inherited from UnifiedAutomation.UaServer.ModelControllerBase
ModelHandle ModelHandle [get, set]
 Gets or sets the metadata handle. More...
 
object UserData [get, set]
 Gets or sets the user data. More...
 
- Properties inherited from UnifiedAutomation.UaServer.INotifyStatusCodeInfo
bool HasStatusCodes [get]
 true if no property has an explicit set status code. Hence when all status codes are implicit StatusCodes.Good. More...
 
- Properties inherited from UnifiedAutomation.UaServer.ICondition
bool Retain [get]
 The retain state. See Part 9: Alarms and Conditions More...
 
NodeId SourceNode [get]
 The source node. See Part 9: Alarms and Conditions More...
 

Events

EventHandler< ConditionModelConditionChanged
 Occurs when the condition changed in a way that a new UA event needs to be emitted. More...
 
- Events inherited from UnifiedAutomation.UaServer.ModelControllerBase
PropertyChangedEventHandler PropertyChanged
 Occurs when a property value changes. More...
 
EventHandler
< PropertyChangeRequestedEventArgs
PropertyChangeRequested
 The event is emitted just before the value will be changed, and gives the observer the opportunity to reject or adjust (e.g. clamp) the property change by setting the PropertyChangeRequestedEventArgs.StatusCode and PropertyChangeRequestedEventArgs.Value properties. More...
 
EventHandler
< StatusCodeChangedEventArgs
StatusCodeChanged
 
- Events inherited from UnifiedAutomation.UaServer.INotifyPropertyChangeRequested
EventHandler
< PropertyChangeRequestedEventArgs
PropertyChangeRequested
 The property change request event. More...
 
- Events inherited from UnifiedAutomation.UaServer.INotifyStatusCodeInfo
EventHandler
< StatusCodeChangedEventArgs
StatusCodeChanged
 Occurs if the status code of a property was changed. More...
 

Additional Inherited Members

- Public Attributes inherited from UnifiedAutomation.UaServer.ModelControllerBase
bool HasStatusCodes => m_statusCodes != null && m_statusCodes.Count > 0
 

Detailed Description

The ConditionType defines all general characteristics of a Condition. All other ConditionTypes derive from it.

The FALSE state of the EnabledState shall not be extended with a substate machine. The ConditionType inherits all Properties of the BaseEventType.

SourceNode identifies the ConditionSource. If the ConditionSource is not a Node in the AddressSpace, the NodeId is set to null. The SourceNode is the Node which the condition is associated with, it may be the same as the InputNode for an alarm, but it may be a separate node. For example, a motor which is a variable with a value that is an RPM may be the ConditionSource for Conditions that are related to the motor, as well as a temperature sensor associated with the motor. In the former, the InputNode for the High RPM alarm is the value of the Motor RPM, while in the later the InputNode of the High Alarm would be the value of the temperature sensor that is associated with the motor.

Events are only generated for Conditions that have their Retain field set to true.

The NodeId of the Condition instance is used as ConditionId. It is not explicitly modelled as a component of the ConditionType. However, it can be requested with the following SimpleAttributeOperand in the SelectClause of the EventFilter:

Name Type Description
typeId NodeId NodeId of the ConditionType Node
browsePath[] QualifiedName empty
attributeId IntegerId Id of the NodeId Attribute

Constructor & Destructor Documentation

UnifiedAutomation.UaServer.ConditionModel.ConditionModel ( )

Initializes a new instance of the ConditionModel class.

UnifiedAutomation.UaServer.ConditionModel.ConditionModel ( ConditionModel  template)

Initializes a new instance of the ConditionModel class.

Parameters
templateThe template.

Member Function Documentation

virtual void UnifiedAutomation.UaServer.ConditionModel.ActivateModel ( RequestContext  context)
virtual
virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.AddComment ( byte[]  eventId,
LocalizedText  comment,
string  clientUserId 
)
virtual

Applies a comment to a specific state of a Condition instance.

Normally, the MethodId passed to the Call Service is found by browsing the Condition instance in the AddressSpace. However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers shall allow Clients to call the AddComment Method by specifying ConditionId as the ObjectId and the well known NodeId of the Method declaration on the ConditionType as the MethodId. The Method cannot be called on the ConditionType Node.

Method result codes:

ResultCode Description
Bad_MethodInvalid The method id does not refer to a method for the specified object. The addressed Condition does not support adding comments.
Bad_EventIdUnknown The specified EventId is not known to the Server.
Bad_NodeIdUnknown The node id refers to a node that does not exist in the server address space. Used to indicate that the specified Condition is not valid or that the Method was called on the ConditionType Node.
Parameters
eventIdThe identifier for the event to comment.
commentThe comment to add to the condition.
clientUserIdThe client user id.
virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.AddComment ( RequestContext  context,
byte[]  eventId,
LocalizedText  comment 
)
virtual

Applies a comment to a specific state of a Condition instance.

Parameters
context
eventIdThe identifier for the event to comment.
commentThe comment to add to the condition.
virtual void UnifiedAutomation.UaServer.ConditionModel.DeactivateModel ( )
virtual

Deactivates the model.

This method does nothing, but can be overriden in a derived class.

Implements UnifiedAutomation.UaServer.IActivatableModel.

virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.Disable ( )
virtual

Changes a Condition instance to the disabled state.

Normally, the MethodId passed to the Call Service is found by browsing the Condition instance in the AddressSpace. However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers shall allow Clients to call the Enable Method by specifying ConditionId as the ObjectId and the well known NodeId of the Method declaration on the ConditionType as the MethodId.

Method result codes:

ResultCode Description
Bad_ConditionAlreadyEnabled The addressed Condition is already enabled.
virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.Disable ( RequestContext  context)
virtual

Changes a Condition instance to the disabled state.

Parameters
contextUnused parameter.
virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.DispatchMethod ( RequestContext  context,
MethodHandle  methodHandle,
IList< Variant inputArguments,
List< StatusCode inputArgumentResults,
List< Variant outputArguments 
)
virtual

Dispatches the method.

Parameters
contextThe context.
methodHandleThe method handle.
inputArgumentsThe input arguments.
inputArgumentResultsThe input argument results.
outputArgumentsThe output arguments.
Returns

Reimplemented in UnifiedAutomation.UaServer.DialogConditionModel, UnifiedAutomation.UaServer.AlarmConditionModel, and UnifiedAutomation.UaServer.AcknowledgeableConditionModel.

virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.Enable ( )
virtual

Changes a Condition instance to the enabled state.

Normally, the MethodId passed to the Call Service is found by browsing the Condition instance in the AddressSpace. However, some Servers do not expose Condition instances in the AddressSpace. Therefore all Servers shall allow Clients to call the Disable Method by specifying ConditionId as the ObjectId and the well known NodeId of the Method declaration on the ConditionType as the MethodId.

Method result codes:

ResultCode Description
Bad_ConditionAlreadyDisabled The addressed Condition is already disabled.
virtual StatusCode UnifiedAutomation.UaServer.ConditionModel.Enable ( RequestContext  context)
virtual

Changes a Condition instance to the enabled state.

Parameters
contextUnused parameter.
virtual CallMethodEventHandler UnifiedAutomation.UaServer.ConditionModel.GetMethodDispatcher ( RequestContext  context,
NodeId  objectId,
NodeId  methodId 
)
virtual

Gets the method dispatcher.

Parameters
contextThe context.
objectIdThe object id.
methodIdThe method id.
Returns

Implements UnifiedAutomation.UaServer.IMethodDispatcher.

Reimplemented in UnifiedAutomation.UaServer.DialogConditionModel, UnifiedAutomation.UaServer.AlarmConditionModel, and UnifiedAutomation.UaServer.AcknowledgeableConditionModel.

virtual void UnifiedAutomation.UaServer.ConditionModel.Initialize ( )
protectedvirtual

Called when the model is activated for the first time.

Reimplemented in UnifiedAutomation.UaServer.AlarmConditionModel, and UnifiedAutomation.UaServer.AcknowledgeableConditionModel.

TransitionRaiser UnifiedAutomation.UaServer.ConditionModel.MergeTransitions ( )

Merges transitions.

Returns
A releaser to end the merged transitions.
TransitionRaiser UnifiedAutomation.UaServer.ConditionModel.NewTransition ( )

This method may only be called inside of a MergeTransitions block.

void UnifiedAutomation.UaServer.ConditionModel.RaiseConditionChangedEvent ( ConditionModel  model)

Emits a new condition changed event.

void UnifiedAutomation.UaServer.ConditionModel.RaiseTransition ( )
protected

Ends a merged transitions.

Usually, the return value of the MergeTransitions is used to end the transaction and not this method directly.

virtual void UnifiedAutomation.UaServer.ConditionModel.UpdateEnabledEffectiveDisplayName ( )
virtual

Updates the effect display name for the enabled state.

Reimplemented in UnifiedAutomation.UaServer.AlarmConditionModel, and UnifiedAutomation.UaServer.AcknowledgeableConditionModel.

virtual void UnifiedAutomation.UaServer.ConditionModel.UpdateRetain ( )
virtual

Update the retain bit.

The retain bit of the ConditionModel depends solely on the EnabledState.

Reimplemented in UnifiedAutomation.UaServer.AlarmConditionModel, and UnifiedAutomation.UaServer.AcknowledgeableConditionModel.

Property Documentation

NodeId UnifiedAutomation.UaServer.ConditionModel.BranchId
getset

BranchId is Null for all Event Notifications that relate to the current state of the Condition instance. If BranchId is not Null it identifies a previous state of this Condition instance that still needs attention by an Operator. If the current ConditionBranch is transformed into a previous ConditionBranch then the Server needs to assign a non-null BranchId. An initial Event for the branch will be generated with the values of the ConditionBranch and the new BranchId. The ConditionBranch can be updated many times before it is no longer needed. When the ConditionBranch no longer requires Operator input the final Event will have Retain set to FALSE. The retain bit on the current Event is TRUE, as long as any ConditionBranches require Operator input.The BranchId DataType is NodeId although the Server is not required to have ConditionBranches in the Address Space. The use of a NodeId allows the Server to use simple numeric identifiers, strings or arrays of bytes.

string UnifiedAutomation.UaServer.ConditionModel.ClientUserId
getset

Is related to the Comment field and contains the identity of the user who inserted the most recent Comment.

The logic to obtain the ClientUserId is defined in Part 5 of the OPC UA Specification.

ConditionVariableModel<LocalizedText> UnifiedAutomation.UaServer.ConditionModel.Comment
getset

Contains the last comment provided for a certain state (ConditionBranch).

It may have been provided by an AddComment method, some other method or in some other manner. The initial value of this Variable is null, unless it is provided in some other manner. If a method provides as an option the ability to set a Comment, then the value of this Variable is reset to null if an optional comment is not provided.

new NodeId UnifiedAutomation.UaServer.ConditionModel.ConditionClassId
getset

Specifies in which domain this Condition is used.

It is the NodeId of the corresponding ConditionClassType. When using this Property for filtering, Clients have to specify all individual ConditionClassType NodeIds. The OfType operator cannot be applied. BaseConditionClassType is used as class whenever a Condition cannot be assigned to a more concrete class.

new LocalizedText UnifiedAutomation.UaServer.ConditionModel.ConditionClassName
getset

ConditionClassName provides the display name of the ConditionClassType.

IConditionMethods UnifiedAutomation.UaServer.ConditionModel.ConditionMethods
getset

Gets or sets the Condition methods.

The Condition methods.

string UnifiedAutomation.UaServer.ConditionModel.ConditionName
getset

Identifies the Condition instance that the Event originated from.

It can be used together with the SourceName in a user display to distinguish between different Condition instances. If a ConditionSource has only one instance of a ConditionType, and the Server has no instance name, the Server shall supply the ConditionType browse name.

TwoStateVariableModel UnifiedAutomation.UaServer.ConditionModel.EnabledState
getset

EnabledState indicates whether the Condition is enabled.

EnabledState/Id is TRUE if enabled, FALSE otherwise. EnabledState/TransitionTime defines when the EnabledState last changed. Recommended state names for LocaleIds are listed in the following table.

LocaleId FALSE State Name TRUE State Name
en Disabled Enabled
de Ausgeschaltet Eingeschaltet
fr Hors Service En Service

A Condition’s EnabledState effects the generation of Event Notifications and as such results in the following specific behaviour:

  • When the Condition instance enters the Disabled state, the Retain Property of this Condition shall be set to FALSE by the Server to indicate to the Client that the Condition instance is currently not of interest to Clients.
  • When the Condition instance enters the enabled state, the Condition shall be evaluated and all of its Properties updated to reflect the current values. If this evaluation causes the Retain Property to transition to TRUE for any ConditionBranch, then an Event Notification shall be generated for that ConditionBranch.
  • The Server may choose to continue to test for a Condition instance while it is Disabled. However, no Event Notifications will be generated while the Condition instance is disabled.
  • For any Condition that exists in the AddressSpace the Attributes and the following Variables will continue to have valid values even in the Disabled state: EventId, Event Type, Source Node, Source Name, Time, and EnabledState. Other properties may no longer provide current valid values. All Variables that are no longer provided shall return a status of Bad_ConditionDisabled. The Event that reports the Disabled state should report the properties as NULL or with a status of Bad_ConditionDisabled.

When enabled, changes to the following components shall cause a ConditionType Event Notification:

  • Quality
  • Severity (inherited from BaseEventType)
  • Comment

This may not be the complete list. Subtypes may define additional Variables that trigger Event Notifications. In general changes to Variables of the types TwoStateVariableType or ConditionVariableType trigger Event Notifications.

bool UnifiedAutomation.UaServer.ConditionModel.IsInitialized
getset

Gets or sets if the condition is initialized.

If false, the Initialize method will be called on activation.

ConditionVariableModel<ushort> UnifiedAutomation.UaServer.ConditionModel.LastSeverity
getset

Provides the previous severity of the ConditionBranch.

Initially this Variable contains a zero value; it will return a value only after a severity change. The new severity is supplied via the Severity Property which is inherited from the BaseEventType.

ConditionVariableModel<StatusCode> UnifiedAutomation.UaServer.ConditionModel.Quality
getset

Reveals the status of process values or other resources that this Condition instance is based upon.

If, for example, a process value is “Uncertain”, the associated “LevelAlarm” Condition is also questionable. Values for the Quality can be any of the OPC StatusCodes defined in Part 8 of the OPC UA Specification as well as Good, Uncertain and Bad as defined in Part 4 of the OPC UA Specification. These StatusCodes are similar to but slightly more generic than the description of data quality in the various field bus Specifications. It is the responsibility of the Server to map internal status information to these codes. A Server which supports no quality information shall return Good. This quality can also reflect the communication status associated with the system that this value or resource is based on and from which this Alarm was received. For communication errors to the underlying system, especially those that result in some unavailable Event fields, the quality shall be Bad_NoCommunication error.

bool UnifiedAutomation.UaServer.ConditionModel.Retain
getset

Retain when TRUE describes a Condition (or ConditionBranch) as being in a state that is interesting for a Client wishing to synchronize its state with the Server’s state. The logic to determine how this flag is set is Server specific. Typically all Active Alarms would have the Retain flag set; however, it is also possible for inactive Alarms to have their Retain flag set to TRUE. In normal processing, when a Client receives an Event with the Retain flag set to FALSE, the Client should consider this as a ConditionBranch that is no longer of interest, in the case of a “current Alarm display” the ConditionBranch would be removed from the display.

uint UnifiedAutomation.UaServer.ConditionModel.TransitionCount
get

Counts the emitted transitions.

This property can be used to see if changes to a condition resulted in a event generation.

Event Documentation

EventHandler<ConditionModel> UnifiedAutomation.UaServer.ConditionModel.ConditionChanged

Occurs when the condition changed in a way that a new UA event needs to be emitted.


The documentation for this class was generated from the following files: