Variable Node Class |
Variables are defined using the Variable node class. Two types of variables are defined: properties and data variables. Although they differ in the way they are used as described in Variable and have different constraints.
This topic contains the following sections:
Variables are used to represent values which may be simple or complex.
Variables are always defined as properties or data variables of other nodes in the Address Space. They are never defined by themselves.
Note |
---|
The Variable node is always part of at least one other node, but may be related to any number of other nodes. |
Variables are defined using the Variable node class.
The Variable node class inherits the base attributes from the Basenode class.
The Variable node class also defines a set of attributes that describe the variable’s runtime value. The Value attribute represents the variable value. The DataType, ValueRank and ArrayDimensions attributes provide the capability to describe simple and complex values.
The AccessLevel attribute indicates the accessibility of the value of a variable not taking user access rights into account. If the OPC Unified Architecture server does not have the ability to get the AccessLevel information from the underlying system, it should state that it is read and writable. If a read or write operation is called on the Variable, the server should transfer this request and return the corresponding StatusCode if such a request is rejected. Status codes are described in section Services.
The SemanticChange bit of the AccessLevel attribute shall be set when the property describes the semantic of the node that owns the property and changes of the property value will generate semantic change events
For example, a property describing the engineering unit of a DataVariable has the bit set, whereas a property containing an icon of the DataVariable will not. This behaviour is exactly the same as described by the SemanticsChanged bit of the StatusCode described in section Services. However, if you subscribe to a Variable you should look at the StatusCode to identify if the semantic has changed in order to receive this information before you are processing the value of the Variable.
The UserAccessLevel attribute indicates the accessibility of the Value of a variable taking user access rights into account. If the OPC Unified Architecture server does not have the ability to get any user access rights related information from the underlying system, it should use the same bit mask as used in the AccessLevel attribute. The UserAccessLevel attribute can restrict the accessibility indicated by the AccessLevel attribute, but not exceed it.
The MinimumSamplingInterval attribute specifies how fast the server can reasonably sample the value for changes. The accuracy of this value (the ability of the server to attain “best case” performance) can be greatly affected by system load and other factors.
The Historizing attribute indicates whether the Server is actively collecting data for the history of the Variable. See section Historical Access for details on historizing Variables.
Clients may read or write Variable values, or monitor them for value changes, as described in section Services. Section Data Access describes additional rules when using the services for automation data.
To specify its modelling rule, a variable can use at most one HasModellingRule reference pointing to a ModellingRule node.
A variable shall use at most one HasModelParent reference to specify its model parent.
If the variable is created based on an instance declaration (see Type Definition ) it shall have the same BrowseName as its instance declaration.
The other references are described separately for properties and data variables in the following subclauses.
Properties are used to define the characteristics of nodes. Properties are defined using the Variable node class.
Properties are the leaf of any hierarchy; therefore they shall not be the source node of any hierarchical references. This includes the HasComponent or HasProperty reference, that is, properties do not contain properties and cannot expose their complex structure. However, they may be the source node of any non-hierarchical references.
The HasTypeDefinition reference points to the VariableType of the Property. Since Properties are uniquely identified by their BrowseName attribute, all properties shall point to the PropertyType described in section Standard Variable Types.
Note |
---|
Properties shall always be defined in the context of another node and shall be the target node of at least one HasProperty reference. |
To distinguish them from data variables, they shall not be the target node of any HasComponent reference. Thus, a HasProperty reference pointing to a variable node defines this node as a property.
The BrowseName of a Property is always unique in the context of a Node. It is not permitted for a Node to refer to two Variables using HasProperty References having the same BrowseName.
The DataVariable node represent the content of an object. Data variables are defined using the Variable node class.
Data variables identify their properties using HasProperty references. Complex data variables use HasComponent references to expose their component data variables.
The property NodeVersion indicates the version of the DataVariable node. The property TimeZone indicates the difference between the SourceTimestamp of the value and the standard time at the location in which the value was obtained. The property DaylightSavingTime indicates if a daylight saving time offset shall be added to the TimeZone value in order to get a result with respect to daylight saving time. The property DataTypeVersion is used only for data type dictionaries and data type descriptions as defined in DataType . The standard property DictionaryFragment is used only for data type descriptions as defined in DataType. The property AllowNulls indicates if NULL values are allowed for the Value attribute. Section Data Access describes a set of properties that can be used for data variables.
Data variables may use additional references to define relationships to other nodes. No restrictions are placed on the types of references used or on the node classes of the nodes that may be referenced. However, restrictions may be defined by the ReferenceType excluding its use for data variables. Standard reference types are described in Standard Reference Types.
A DataVariable nodes are intended to be defined in the context of an object. However, complex data variables may expose other data variables, and object types and complex variable types may also contain data variables. Therefore each DataVariable shall be the target node of at least one HasComponent reference coming from an Object, an ObjectType, a DataVariable or a VariableType. Data variables shall not be the target node of any HasProperty references. Therefore, a HasComponent reference pointing to a Variable node identifies it as a DataVariable.
The HasTypeDefinition reference points to the VariableType used as type definition of the DataVariable.
If the DataVariable is used as instance declaration (see Type Definition ) all nodes referenced with hierarchical references in forward direction shall have unique browse names in the context of this DataVariable.