This VariableType defines the general characteristics of a DataItem. All other DataItem Types derive from it. The DataItemType derives from the BaseDataVariableType and therefore shares the variable model as described in OPC 10000-3 and OPC 10000-5. It is formally defined in Table 1.
Table 1 – DataItemType definition
|ValueRank||−2 (−2 = ‘Any’)|
Subtype of the BaseDataVariableType defined in OPC 10000-5; i.e the Properties of that type are inherited.
|HasSubtype||VariableType||BaseAnalogType||Defined in 184.108.40.206|
|HasSubtype||VariableType||DiscreteItemType||Defined in 5.3.3|
|HasSubtype||VariableType||ArrayItemType||Defined in 5.3.4|
|Data Access DataItems|
Definition is a vendor-specific, human readable string that specifies how the value of this DataItem is calculated. Definition is non-localized and will often contain an equation that can be parsed by certain clients.
Example: Definition::= “(TempA – 25) + TempB”
ValuePrecision specifies the maximum precision that the Server can maintain for the item based on restrictions in the target environment.
ValuePrecision can be used for the following DataTypes:
For Float, Double, and Decimal values it specifies the number of digits after the decimal place when it is a positive number. When it is a negative number, it specifies the number of insignificant digits to the left of the decimal place. For example a ValuePrecision of -2 specifies that the precision of the Value is to the nearest 100. The ValuePrecision should always be a whole number and it shall always be interpreted as a whole number by rounding it to the nearest whole number.
- For DateTime values it shall always be a positive number which indicates the minimum time difference in nanoseconds. For example, a ValuePrecision of 20 000 000 defines a precision of 20 ms. The ValuePrecision should always be a whole number and it shall always be interpreted as a whole number by rounding it to the nearest whole number.
- ValuePrecision can also be used for other subtypes of Double (like Duration) and other Number subtypes that can be represented by a Double. The ValuePrecision Property is an approximation that is intended to provide guidance to a Client. A Server is expected to silently round any value with more precision that it supports. This implies that a Client may encounter cases where the value read back from a Server differs from the value that it wrote to the Server. This difference shall be no more than the difference suggested by this Property.
The algorithm for rounding should follow the so-called “Banker’s rounding” (aka [Round half to even](https://en.wikipedia.org/wiki/Rounding” \l “Round_half_to_even)), in which numbers which are equidistant from the two nearest integers are rounded to the nearest even integer. Thus, 0.5 rounds down to 0; 1.5 rounds up to 2.
Other decimal fractions round as you would expect–0.4 to 0, 0.6 to 1, 1.4 to 1, 1.6 to 2, etc. Only x.5 numbers get the “special” treatment.