A variable of the MATRIX
data type encapsulates a two
dimensional matrix of 32-bit floating-point values (corresponding to
the IEC 61131-3 data type REAL
) in [row][column]
format.
Literal values
Literal values of MATRIX
variables can be expressed in
BNF syntax as follows:
The syntax of float_value
is any string accepted by the
java.lang.Float.valueOf(String)
method.
Each vector_literal
element represents a row of
the matrix; for instance, the literal [[1,2],[3,4]]
represents the matrix
Missing elements are assigned zero values; for instance, the literal
[[],[1,2],[3,4,5]]
represents the matrix
For examples of the use of MATRIX
literals, see the
MATRIX_DEMO
and M_OPS_DEMO
system configurations.
ASN.1 Encoding
MATRIX
data is transferred according to the following
modified ASN.1 syntax:
The encoding of MATRIX
elements is constructed
in the sense of ISO/IEC 8825, with the following extensions to
the COMPACT encoding described in Annex E of IEC
61499-1:
-
rows
andcols
, representing the number of rows and columns in the matrix respectively, are encoded as values of theUSINT
type without identifier or length octets, i.e., as two successive 8-bit unsigned integers.-
This restricts the maximum number of elements of a
MATRIX
to 65025 (255×255). -
If the matrix data is to be transferred via
PUBLISH/SUBSCRIBE
, the maximum number of elements is further restricted by the maximum number of octets (1472) that can be transferred in a single UDP packet without segmentation; otherwise, anOVERFLOW
error will be declared by the corresponding FB instance. -
Since the encoding of a
REAL
value requires 32 bits (4 octets), the maximum number of elements in aMATRIX
instance to be transmitted viaPUBLISH/SUBSCRIBE
would then be (maximum octets - tag octets - length octets)/(element length) = (1472-1-2)/4 = 367 elements. For instance, a square matrix with 19 rows and columns, containing 361 elements, would fit in a UDP packet. -
MATRIX
data larger than the allowed UDP transfer should be transferred using theCLIENT/SERVER
mechanism.
-
This restricts the maximum number of elements of a
-
The matrix contents are encoded using the COMPACT syntax for an
ARRAY of IEC 61131-3
REAL
values, without any tag or length subfields. -
Data is encoded in column order; for instance, the matrix
would be encoded in the order
For an example of the application of these encoding rules, see the CODEC_TEST2
system configuration.