The DataType Model is used to define simple and structured data types. Data types are used to describe the structure of the Value Attributeof Variables and their VariableTypes. Therefore each Variableand VariableTypeis pointing with its DataType Attributeto a Nodeof the DataType NodeClassas shown in Figure 10.

image013.png

Figure 10– Variables, VariableTypes and their DataTypes

In many cases, the NodeIdof the DataType Node– the DataTypeId– will be well-known to Clientsand Servers. Clause 8defines DataTypesand OPC 10000-6defines their DataTypeIds. In addition, other organizations may define DataTypesthat are well-known in the industry. Well-known DataTypeIdsprovide for commonality across OPC UA Serversand allow Clientsto interpret values without having to read the type description from the Server. Therefore, Serversmay use well-known DataTypeIdswithout representing the corresponding DataType Nodesin their AddressSpaces.

In other cases, DataTypesand their corresponding DataTypeIdsmay be vendor-defined. Serversshould attempt to expose the DataType Nodesand the information about the structure of those DataTypesfor Clientsto read, although this information might not always be available to the Server.

Figure 11illustrates the Nodesused in the AddressSpaceto describe the structure of a DataType. The DataTypepoints to an Objectof type DataTypeEncodingType. Each DataTypecan have several DataTypeEncoding, for example “Default”, “UA Binary” and “XML” encoding. Services in OPC 10000-4allow Clientsto request an encoding or choosing the “Default” encoding. Each DataTypeEncodingis used by exactly one DataType, that is, it is not permitted for two DataTypesto point to the same DataTypeEncoding.

image014.png

Figure 11– DataType Model

Since the NodeIdof the DataTypeEncodingwill be used in some Mappings to identify the DataTypeand it’s encoding as defined in OPC 10000-6, those NodeIdsmay also be well-known for well-known DataTypeIds.

Different kinds of DataTypesare handled differently regarding their encoding and according to whether this encoding is represented in the AddressSpace.

Built-in DataTypesare a fixed set of DataTypes(see OPC 10000-6for a complete list of Built-inDataTypes). They have no encodings visible in the AddressSpacesince the encoding should be known to all OPC UA products. Examples of Built-in DataTypesare Int32(see 8.26) and Double(see 8.12).

Simple DataTypesare subtypes of the Built-in DataTypes. They are handled on the wire like the Built-in DataType, i.e. they cannot be distinguished on the wire from their Built-insupertypes. Since they are handled like Built-in DataTypesregarding the encoding they cannot have encodings defined in the AddressSpace. Clientscan read the DataType Attributeof a Variableor VariableTypeto identify the Simple DataTypeof the Value Attribute. An example of a Simple DataTypeis Duration. It is handled on the wire as a Doublebut the Client can read the DataType Attributeand thus interpret the value as defined by Duration(see 8.13).

Structured DataTypesare DataTypesthat represent structured data and are not defined as Built-in DataTypes. Structured DataTypesinherit directly or indirectly from the DataType Structuredefined in 8.33. Structured DataTypesmay have several encodings and the encodings are exposed in the AddressSpace. How the encoding of Structured DataTypesis handled on the wire is defined in OPC 10000-6. The encoding of the Structured DataTypeis transmitted with each value, thus Clientsare aware of the DataTypewithout reading the DataType Attribute. The encoding has to be transmitted so the Client is able to interpret the data. An example of a Structured DataTypeis Argument(see 8.6).

Enumeration DataTypesare DataTypesthat represent discrete sets of named values. Enumerations are always encoded as Int32 on the wire as defined in OPC 10000-6. EnumerationDataTypesinherit directly or indirectly from the DataType Enumerationdefined in 8.14. Enumerations have no encodings exposed in the AddressSpace. To expose the human-readable representation of an enumerated value the DataType Nodemay have the EnumStrings Propertythat contains an array of LocalizedText. The Integer representation of the enumeration value points to a position within that array. EnumValues Propertycan be used instead of the EnumStringsto support integer representation of enumerations that are not zero-based or have gaps. It contains an array of a Structured DataTypecontaining the integer representation as well as the human-readable representation. An example of an enumeration DataTypecontaining a sparse list of Integers is NodeClasswhich is defined in 8.30.

In addition to the DataTypes described above,abstract DataTypesare also supported, which do not have any encodings and cannot be exchanged on the wire. Variablesand VariableTypesuse abstract DataTypesto indicate that their Valuemay be any one of the subtypes of the abstract DataType. An example of an abstract DataTypeis Integer which is defined in 8.24.

The DataType NodeClassdescribes the syntax of a Variable Value. DataTypesare defined using the DataType NodeClass, as specified in Table 16.

Table 16– DataType NodeClass

Name

Use

Data Type

Description

Attributes

Base NodeClass Attributes

M

--

Inherited from the Base NodeClass. See 5.2.

IsAbstract

M

Boolean

A boolean Attributewith the following values:

TRUEit is an abstract DataType.

FALSEit is not an abstract DataType.

DataTypeDefinition

O

DataTypeDefinition

The DataTypeDefinition Attributeis used to provide the meta data and encoding information for custom DataTypes. The abstract DataTypeDefinition DataTypeis defined in 8.48.

Structure and Union DataTypes

The Attributeis mandatory for DataTypesderived from Structureand Union. For such DataTypes, the Attributecontains a structure of the DataType StructureDefinition. The StructureDefinition DataTypeis defined in 8.49. It is a subtype of DataTypeDefinition.

Enumeration and OptionSet DataTypes

The Attributeis mandatory for DataTypesderived from Enumeration, OptionSetand subtypes of UInteger representing an OptionSet. For such DataTypes, the Attributecontains a structure of the DataType EnumDefinition. The EnumDefinition DataTypeis defined in 8.50. It is a subtype of DataTypeDefinition.

References

HasProperty

0..*

HasProperty Referencesidentify the Propertiesfor the DataType.

HasSubtype

0..*

HasSubtype References may be used to span a data type hierarchy.

HasEncoding

0..*

HasEncoding References identify the encodings of the DataTyperepresented as Objectsof type DataTypeEncodingType.

Only concrete Structured DataTypesmay use HasEncoding References. Abstract, Built-in, Enumeration,and Simple DataTypesare not allowed to be the SourceNodeof a HasEncoding Reference.

Each concrete Structured DataTypeshall point to at least one DataTypeEncoding Objectwith the BrowseName“Default Binary” or “Default XML” having the NamespaceIndex0. The BrowseNameof the DataTypeEncoding Objectsshall be unique in the context of a DataType, i.e. a DataTypeshall not point to two DataTypeEncodingshaving the same BrowseName.

Standard Properties

NodeVersion

O

String

The NodeVersion Propertyis used to indicate the version of a Node.

The NodeVersion Propertyis updated each time a Referenceis added or deleted to the Nodethe Propertybelongs to. Attributevalue changes do not cause the NodeVersionto change. Clients may read the NodeVersion Propertyor subscribe to it to determine when the structure of a Nodehas changed. Clientsshall not use the content for programmatic purposes except for equality comparisions.

EnumStrings

O

LocalizedText[]

The EnumStrings Propertyonly applies for Enumeration DataTypes. It shall not be applied for other DataTypes. If the EnumValues Propertyis provided, the EnumStrings Propertyshall not be provided.

Each entry of the array of LocalizedTextin this Propertyrepresents the human-readable representation of an enumerated value. The Integer representation of the enumeration value points to a position of the array.

EnumValues

O

EnumValueType[]

The EnumValues Propertyonly applies for Enumeration DataTypes. It shall not be applied for other DataTypes. If the EnumStrings Propertyis provided, the EnumValues Propertyshall not be provided.

Using the EnumValues Propertyit is possible to represent Enumerations with integers that are not zero-based or have gaps (e.g. 1, 2, 4, 8, and 16).

Each entry of the array of EnumValueTypein this Propertyrepresents one enumeration value with its integer notation, human-readable representation and help information.

OptionSetValues

O

LocalizedText[]

The OptionSetValues Propertyonly applies for OptionSet DataTypes and UInteger DataTypes.

An OptionSet DataTypeis used to represent a bit mask and the OptionSetValues Propertycontains the human-readable representation for each bit of the bit mask.

The OptionSetValues Propertyprovides an array of LocalizedTextcontaining the human-readable representation for each bit.

The DataType NodeClassinherits the base Attributesfrom the Base NodeClassdefined in 5.2. The IsAbstract Attribute specifies if the DataTypeis abstract or not. Abstract DataTypescan be used in the AddressSpace, i.e. Variablesand VariableTypescan point with their DataType Attributeto an abstract DataType. However, concrete values can never be of an abstract DataTypeand shall always be of a concrete subtype of the abstract DataType.

HasProperty Referencesare used to identify the Propertiesof a DataType. The Property NodeVersionis used to indicate the version of the DataType. The Property EnumStringscontains human-readable representations of enumeration values and is only applied to Enumeration DataTypes. Instead of the EnumStrings Propertyan Enumeration DataTypecan also use the EnumValues Propertyto represent Enumerationswith integer values that are not zero-based or containing gaps. There are no additional Propertiesdefined for DataTypesin this standard. Additional parts of this series of standards may define additional Propertiesfor DataTypes.

HasSubtype Referencesmay be used to expose a data type hierarchy in the AddressSpace. The semantic of subtyping is only defined to the point, that a Server may provide instances of the subtype instead of the DataType. Clientsshould not make any assumptions about any other semantic with that information. For example, it might not be possible to cast a value of one data type to its base data type. Serversneed not provide HasSubtype References, even if their DataTypesspan a type hierarchy. Some restrictions apply for subtyping enumeration DataTypes as defined in 8.14.

HasEncoding Referencespoint from the DataTypeto its DataTypeEncodings. Each concrete Structured DataTypecan point to many DataTypeEncodings, but each DataTypeEncodingshall belong to one DataType, that is, it is not permitted for two DataType Nodesto point to the same DataTypeEncoding Objectusing HasEncoding References.

An abstract DataTypeis not the SourceNodeof a HasEncoding Reference. The DataTypeEncodingof an abstract DataTypeis provided by its concrete subtypes.

DataType Nodesshall not be the SourceNodeof other types of References. However, they may be the TargetNodeof other References.

If a DataType Nodeis exposed in the AddressSpace, it shall provide its DataTypeEncodingsusing HasEncoding References. These Referencesshall be bi-directional. Figure 12provides an example how DataTypesare modelled in the AddressSpace.

image015.png

Figure 12– Example of DataType Modelling

The information on how to encode the DataTypeis provided in the Attribute DataTypeDefinitionof the DataType Node. The content of this Attributeshall not be changed once it had been provided to Clientssince Clientsmight persistently cache this information. If the encoding of a DataTypeneeds to be changed conceptually a new DataTypeneeds to be provided, meaning that a new NodeIdshall be used for the DataType. Since Clientsidentify the DataTypevia the DataTypeEncodings, also the NodeIdsfor the DataTypeEncodingsof the DataTypeshall be changed, when the encoding changes.