A DataTypeRefinement is represented by an Object of DataTypeRefinementType (see OPC 10000-5) or a subtype. A DataTypeRefinement Object shall always be referenced using a HasDataTypeRefinement Reference (see 7.30) or subtype from exactly one DataType Node representing a Structured DataType that is being refined.

For each field having a refinement, a Variable of BaseDataVariableType or subtype is referenced using a Reference of HasFieldDescription ReferenceType (see 7.25) or a subtype. The BrowseName of the Variable shall use a BrowseName equal to the name of the field. The Namespace of the BrowseName shall be ignored by a Client when performing an equality check with a field name.

A DataTypeRefinement Object shall not reference any Node with a HasFieldDescription or subtype which is not representing a field of the DataType it refines and shall reference at most one Variable for each field with a HasFieldDescription or subtype.

For the restriction of the field, the rules defined in 5.8.5.1 apply. In Table 17, the mapping of the fields in the StructureField of the DataTypeDefinition Attribute to concepts of a Variable is defined.

Table 17 – Mapping of DataTypeDefinition

StructureField

Variable Concept

Comment

Name

String part of BrowseName Attribute

Must match

Description

Description Attribute

No requirements

DataType

DataType Attribute

Variable must have the same DataType or a subtype

ValueRank

ValueRank Attribute

Must match

ArrayDimensions

ArrayDimensions Attribute

For each dimension: If 0, Variable is allowed to be non-zero, otherwise they must match

MaxStringLength

MaxStringLength Property

If MaxStringLength is 0, Variable is allowed to be non-zero, otherwise must match

IsOptional and StructureWithOptionalFields

Reference to Variable either using HasFieldDescription (stays optional) HasFieldDescriptionSetMandatory (becomes mandatory) or IsDisabledOptionalField (optional field not used)

Only allowed if IsOptional is true. Otherwise IsDisabledOptionalField and HasFieldDescriptionSetMandatory are not allowed.

IsOptional and StructureWithSubtypedValues or UnionWithSubtypedValues

AccessLevelEx Attribute, bit NoSubDataTypes

Only allowed if IsOptional is true to set the NoSubDataTypes to true.

If IsOptional is false, NoSubDataTypes shall be set.

By using the subtypes HasFieldDescriptionSetMandatory (see 7.26) a field becomes mandatory, and by IsDisabledOptionalField (see 7.27) an optional field shall not be present. In the AccessLevelEx Attribute, the NoSubDataTypes bit can be used to express that a field where subtypes are allowed, no longer allows subtypes.

Depending on the Structured DataType, some limitations on the DataTypeRefinement occur.

In Figure 20, an example is given. The structure of X:SuperDataType and X:SubDataType is provided in pseudo-code. The Y:Refinement_1 is refining the X:SubDataType and referenced from the DataType with a HasDataTypeRefinement Reference.

The field1 is defined in the DataType as Number, the DataTypeRefinement restricts this to an Int32. As meta data, the EngineeringUnits is defined as Kelvin, therefore the AnalogUnitType is used as VariableType.

The optional field2 is refined to “not used” by referencing the corresponding Variable with IsDisabledOptionalField.

The field3 is defined in the DataType as Number and a one-dimensional array without a size limitation. In the DataTypeRefinement it is refined as an array of Int32 with the maximum length of 5.

The optional field4, added in the subtype X:SubDataType, of String without a maximum length, becomes in the DataTypeRefinement a mandatory field of String with the MaxStringLength of 50.

The field5 is not refined and stays as an Int32.

image023.png

Figure 20 – Example of a DataTypeRefinement

As fields of Structured DataTypes may use Structured DataTypes, it may be desirable to refine fields of those fields as well. This can be done as shown in Figure 21. In this example, the Y:Refinement_2 provides similar refinements as Y:Refinement_1, but makes the optional field4 “not used”.

The new optional field6, introduced by X:SubSubDataType, uses the X:SubDataType as DataType. The Y:Refinement_2 makes this optional field mandatory, and by letting the X:field6 Variable reference the Y:Refinement_1 with UsesDataTypeRefinement (see 7.24), this DataTypeRefinement is applied to field6.

image024.png

Figure 21 – Example of a DataTypeRefinement using a Structured DataType