VariableTypesare only used for DataVariablesand should be used when there are several Variableshaving the same semantic (e.g. set point). It is not necessary to define a VariableTypethat only reflects the DataTypeof a Variable, e.g. an “Int32VariableType”.
Besides the semantic differences of Propertiesand DataVariablesdescribed in Clause 4there are also syntactical differences. A Propertyis identified by its BrowseName, that is, if Propertieshaving the same semantic are used several times, they should always have the same BrowseName. The same semantic of DataVariablesis captured in the VariableType.
- If it is a complex Variableor it should contain additional information in the form of Properties.
- If the type definition may be refined (subtyping).
- If the type definition should be made available so the Clientcan use the AddNodes Servicedefined in OPC 10000-4to create new instances of the type definition.
- If it is a component of a complex Variableexposing a part of the value of the complex Variable.
When structured data structures should be made available to the Clientthere are basically three different approaches:
- Create several simple Variablesusing simple DataTypesalways reflecting parts of the simple structure. Objectsare used to group the Variablesaccording to the structure of the data.
- Create a Structured DataTypeand a simple Variableusing this DataType.
- Create a Structured DataTypeand a complex Variableusing this DataTypeand also exposing the structured data structure as Variablesof the complex Variableusing simple DataTypes.
The advantages of the first approach are that the complex structure of the data is visible in the AddressSpace. A generic Clientcan easily access the data without knowledge of user-defined DataTypesand the Clientcan access individual parts of the structured data. The disadvantages of the first approach are that accessing the individual data does not provide any transactional context and for a specific Clientthe Serverfirst has to convert the data and the Clienthas to convert the data, again, to get the data structure the underlying system provides.
The advantages of the second approach are, that the data is accessed in a transactional context and the Structured DataTypecan be constructed in a way that the Serverdoes not have to convert the data and can pass directly to the specific Clientthat can directly use them. The disadvantages are that the generic Clientmight not be able to access and interpret the data or has at least the burden to read the DataTypeDefinitionto interpret the data. The structure of the data is not visible in the AddressSpace; additional Propertiesdescribing the data structure cannot be added to the adequate places since they do not exist in the AddressSpace. Individual parts of the data cannot be read without accessing the whole data structure.
The third approach combines the other two approaches. Therefore a specific Clientcan access data in its native format in a transactional context, whereas a generic Clientcan access simple DataTypesof the components of the complex Variable. The disadvantage is that the Servermust be able to provide the native format and also interpret it to be able to provide the information in simple DataTypes.
It is recommended to use the first approach. When a transactional context is needed or the Clientshould be able to get a large amount of data instead of subscribing to several individual values, then the third approach is suitable. However, the Servermight not always have the knowledge to interpret the structured data of the underlying system and therefore has to use the second approach just passing the data to the specific Clientwho is able to interpret the data.