OPC UA provides the information if a value is an array in the Variable Attributes ValueRank and ArrayDimensions. Every data type can be exposed as array. Arrays can have multiple dimensions. The dimension is defined through the Attribute ValueRank. Arrays can have variable or fixed lengths. The length of each dimension is defined by the Attribute ArrayDimensions. The array index starts with zero.
IEC 61131-3 allows the declaration of array data types with one or multiple dimensions and an index range instead of a length.
OPC UA has no standard concept for defining special array data types or exposing index ranges.
Example for an array data type declaration in IEC 61131-3:
TYPE
ANALOG_16_INPUT_DATA : ARRAY [1..16] OF INT ;
END_TYPE
Example for use of an array in a Ctrl Variable instantiation in IEC 61131-3:
VAR
MyArray : ARRAY [1..16] OF INT;
END_VAR
The IEC 61131-3 array data type is mapped to three OPC UA properties defined in Table 31.
Table 31 – Array Data Type Property Definition
References |
NodeClass |
BrowseName |
DataType |
TypeDefinition |
ModellingRule |
|
Instance of any VariableType or a DataType Node. |
||||||
HasProperty |
Variable |
Dimensions |
UInt32 |
PropertyType |
Mandatory |
|
HasProperty |
Variable |
IndexMin |
Int32 [ ] |
PropertyType |
Mandatory |
|
HasProperty |
Variable |
IndexMax |
Int32 [ ] |
PropertyType |
Mandatory |
The Property Dimensions contains the number of dimensions of the array.
The Property IndexMin contains an array of lower bounds, one for each array dimension.
The Property IndexMax contains an array of upper bounds, one for each array dimension.
The IEC 61131-3 array data type is mapped to an OPC UA data type derived from the corresponding elementary data types defined in Table 27. The data type has the two Properties defined in Table 31. The IEC example in this chapter is mapped to an OPC UA data type with the name ANALOG_16_INPUT_DATA which is a subtype of Int16.
The IEC 61131-3 array in a Ctrl Variable declaration is mapped to the two Properties defined in Table 31. The Properties are children of the OPC UA Variable representing the Ctrl Variable.