Variables are used to represent values which may be simple or complex. Variables are defined by VariableTypes, as specified in 5.6.5.

Variables are always defined as Properties or DataVariables of other Nodes in the AddressSpace. They are never defined by themselves. A Variable 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 NodeClass, specified in Table 13.

Table 13 – Variable NodeClass

Name

Use

Data Type

Description

Attributes

Base NodeClass Attributes

M

--

Inherited from the Base NodeClass. See 5.2.

Value

M

Defined by the DataType Attribute

The most recent value of the Variable that the Server has. Its data type is defined by the DataType Attribute. It is the only Attribute that does not have a data type associated with it. This allows all Variables to have a value defined by the same Value Attribute.

DataType

M

NodeId

NodeId of the DataType definition for the Value Attribute. Standard DataTypes are defined in Clause 8.

ValueRank

M

Int32

This Attribute indicates whether the Value Attribute of the Variable is an array and how many dimensions the array has.

It may have the following values:

n  > 1: the Value is an array with the specified number of dimensions.

OneDimension (1): The value is an array with one dimension.

OneOrMoreDimensions (0): The value is an array with one or more dimensions.

Scalar (−1): The value is not an array.

Any (−2): The value can be a scalar or an array with any number of dimensions.

ScalarOrOneDimension (−3): The value can be a scalar or a one dimensional array.

All DataTypes are considered to be scalar, even if they have array-like semantics like ByteString and String.

ArrayDimensions

O

UInt32[]

This Attribute specifies the maximum supported length of each dimension. If the maximum is unknown the value shall be 0.

The number of elements shall be equal to the value of the ValueRank Attribute. This Attribute shall be null if ValueRank ≤ 0.

For example, if a Variable is defined by the following C array:

Int32 myArray[346];

then this Variable’s DataType would point to an Int32 and the Variable’s ValueRank has the value 1 and the ArrayDimensions is an array with one entry having the value 346.

The maximum number of elements of an array transferred on the wire is 2147483647 (max Int32).

AccessLevel

M

AccessLevelType

The AccessLevel Attribute is used to indicate how the Value of a Variable can be accessed (read/write) and if it contains current and/or historic data. The AccessLevel does not take any user access rights into account, i.e. although the Variable is writable this may be restricted to a certain user / user group.

The AccessLevelType is defined in 8.57.

UserAccessLevel

M

AccessLevelType

The UserAccessLevel Attribute is used to indicate how the Value of a Variable can be accessed (read/write) and if it contains current or historic data taking user access rights into account.

The AccessLevelType is defined in 8.57.

MinimumSamplingInterval

O

Duration

The MinimumSamplingInterval Attribute indicates how “current” the Value of the Variable will be kept. It specifies (in milliseconds) how fast the Server can reasonably sample the value for changes (see OPC 10000-4 for a detailed description of sampling interval).

A MinimumSamplingInterval of 0 indicates that the Server is to monitor the item continuously. A MinimumSamplingInterval of -1 means indeterminate.

Historizing

M

Boolean

The Historizing Attribute indicates whether the Server is actively collecting data for the history of the Variable. This differs from the AccessLevel Attribute which identifies if the Variable has any historical data. A value of TRUE indicates that the Server is actively collecting data. A value of FALSE indicates the Server is not actively collecting data. Default value is FALSE.

AccessLevelEx

O

AccessLevelExType

The AccessLevelEx Attribute is used to indicate how the Value of a Variable can be accessed (read/write), if it contains current and/or historic data and its atomicity. The AccessLevelEx does not take any user access rights into account, i.e. although the Variable is writable this may be restricted to a certain user / user group. The AccessLevelEx is an extended version of the AccessLevel attribute and as such contains the 8 bits of the AccessLevel attribute as the first 8 bits.

The AccessLevelEx is a 32-bit unsigned integer with the structure defined in the 8.58.

If this Attribute is not provided the information provided by these additional Fields is unknown.

References

HasModellingRule

0..1

Variables can point to at most one ModellingRule Object using a HasModellingRule Reference (see 6.4.4 for details on ModellingRules).

HasProperty

0..*

HasProperty References are used to identify the Properties of a DataVariable.

Properties are not allowed to be the SourceNode of HasProperty References.

HasComponent

0..*

HasComponent References are used by complex DataVariables to identify their composed DataVariables.

Properties are not allowed to use this Reference.

HasTypeDefinition

1

The HasTypeDefinition Reference points to the type definition of the Variable. Each Variable shall have exactly one type definition and therefore be the SourceNode of exactly one HasTypeDefinition Reference pointing to a VariableType. See 4.5 for a description of type definitions.

<other References>

0..*

Data Variables may be the SourceNode of any other References.

Properties may only be the SourceNode of any non-hierarchical Reference.

Standard Properties

NodeVersion

O

String

The NodeVersion Property is used to indicate the version of a DataVariable. It does not apply to Properties.

The NodeVersion Property is updated each time a Reference is added or deleted to the Node the Property belongs to. Attribute value changes except for the DataType Attribute do not cause the NodeVersion to change. Clients may read the NodeVersion Property or subscribe to it to determine when the structure of a Node has changed.

Although the relationship of a Variable to its DataType is not modelled using References, changes to the DataType Attribute of a Variable lead to an update of the NodeVersion Property.

LocalTime

O

TimeZoneDataType

The LocalTime Property is only used for DataVariables. It does not apply to Properties.

This Property is a structure containing the Offset and the DaylightSavingInOffset flag. The Offset specifies the time difference (in minutes) between the SourceTimestamp (UTC) associated with the value and the time at the location in which the value was obtained. The SourceTimestamp is defined in OPC 10000-4.

If DaylightSavingInOffset is TRUE, then Standard/Daylight savings time (DST) at the originating location is in effect and Offset includes the DST correction. If FALSE then the Offset does not include DST correction and DST may or may not have been in effect.

AllowNulls

O

Boolean

The AllowNulls Property is only used for DataVariables. It does not apply to Properties.

This Property specifies if a null value is allowed for the Value Attribute of the DataVariable. If it is set to true, the Server may return null values and accept writing of null values. If it is set to false, the Server shall never return a null value and shall reject any request writing a null value.

If this Property is not provided, it is Server-specific if null values are allowed or not.

ValueAsText

O

LocalizedText

It is used for DataVariables with a finite set of LocalizedTexts associated with its value. For example any DataVariables having an Enumeration DataType.

This optional Property provides the localized text representation of the value. It can be used by Clients only interested in displaying the text to subscribe to the Property instead of the value attribute.

MaxStringLength

O

UInt32

Only used for DataVariables having a String DataType.

This optional Property indicates the maximum number of bytes supported by the DataVariable.

MaxCharacters

O

UInt32

Only used for DataVariables having a String DataType.

This optional Property indicates the maximum number of Unicode characters supported by the DataVariable.

MaxByteStringLength

O

UInt32

Only used for DataVariables having a ByteString DataType.

This optional Property indicates the maximum number of bytes supported by the DataVariable.

MaxArrayLength

O

UInt32

Only used for DataVariables having its ValueRank Attribute not set to scalar.

This optional Property indicates the maximum length of an array supported by the DataVariable. In a multidimensional array it indicates the overall length. For example, a three-dimensional array of 2 x 3 x 10 has the array length of 60.

NOTE In order to expose the length of an array of bytes do not use the DataType ByteString but an array of the DataType Byte. In that case the MaxArrayLength applies.

EngineeringUnits

O

EUInformation

Only used for DataVariables having a Number DataType.

This optional Property indicates the engineering units for the value of the DataVariable (e.g. hertz or seconds). Details about the Property and what engineering units should be used are defined in OPC 10000-8. The DataType EUInformation is also defined in OPC 10000-8.

The Variable NodeClass inherits the base Attributes from the Base NodeClass defined in 5.2.

The Variable NodeClass 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 UA Server does not have the ability to get the AccessLevel information from the underlying system then it should state that it is readable and writable. If a read or write operation is called on the Variable then the Server should transfer this request and return the corresponding StatusCode even if such a request is rejected. StatusCodes are defined in OPC 10000-4.

The SemanticChange flag of the AccessLevel Attribute is used for Properties that may change and define semantic aspects of the parent Node. For example, the EngineeringUnit Property describes the semantic of a DataVariable, whereas the Icon Property does not. In this example, if the EngineeringUnit Property may change while the Server is running, the SemanticChange flag shall be set for it.

Servers that support Event subscriptions shall generate a SemanticChangeEvent whenever a Property with SemanticChange flag set changes.

If a Variable having a Property with SemanticChange flag set is used in a Subscription and the Property value changes, then the SemanticsChanged bit of the StatusCode shall be set as defined in OPC 10000-4. Clients subscribing to a Variable should look at the StatusCode to identify if the semantic has changed and retrieve the relevant Properties before processing the value returned from the Subscription.

The UserAccessLevel Attribute indicates the accessibility of the Value of a Variable taking user access rights into account. If the OPC UA Server does not have the ability to get any user access rights related information from the underlying system then 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. Clients should not assume access rights based on the UserAccessLevel Attribute. For example it is possible that the Server returns an error due to some server specific change which was not reflected in the state of this Attribute at the time the Client accessed the Variable.

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 OPC 10000-11 for details on historizing Variables.

Clients may read or write Variable values, or monitor them for value changes, as specified in OPC 10000-4. OPC 10000-8 defines additional rules when using the Services for automation data.

To specify its ModellingRule, a Variable can use at most one HasModellingRule Reference pointing to a ModellingRule Object. ModellingRules are defined in 6.4.4.

If the Variable is created based on an InstanceDeclaration (see 4.5) it shall have the same BrowseName as its InstanceDeclaration.

The other References are described separately for Properties and DataVariables in the remainder of 5.6