MATRIX Data Type

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:

matrix_literal ::=
   '[' [vector_literal {',' vector_literal}] ']'
vector_literal ::=
   '[' [float_value {',' float_value}] ']'

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

1.0 2.0
3.0 4.0

Missing elements are assigned zero values; for instance, the literal [[],[1,2],[3,4,5]] represents the matrix

0.0 0.0 0.0
1.0 2.0 0.0
3.0 4.0 5.0

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:
MATRIX ::= [APPLICATION 23] IMPLICIT SEQUENCE {
   rows IMPLICIT USINT,
   cols IMPLICIT USINT,
   IMPLICIT SEQUENCE OF IMPLICIT REAL}
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:
  1. rows and cols, representing the number of rows and columns in the matrix respectively, are encoded as values of the USINT type without identifier or length octets, i.e., as two successive 8-bit unsigned integers.
  2. The matrix contents are encoded using the COMPACT syntax for an ARRAY of IEC 61131-3 REAL values, without any tag or length subfields.
  3. Data is encoded in column order; for instance, the matrix
    0.0 0.0 0.0
    1.0 2.0 0.0
    3.0 4.0 5.0
    would be encoded in the order (0.0,1.0,3.0,0.0,2.0,4.0,0.0,0.0,5.0).
For an example of the application of these encoding rules, see the CODEC_TEST2 system configuration.

Last updated: 2015-02-09.
©2011-2015 Holobloc Inc.
All rights reserved.