Matrix – Copy data

Symbol:

Description:

This function block copies elements from the source matrix MSrc into the destination matrix MDst.

The input signals xDest and yDest define the starting position for writing into the destination. The signals xSrc and ySrc define the starting position for reading from the source. The input signals nCols and nRows determine the number of columns and rows to copy. If this function can only read less columns or rows than requested by nCols or nRows the remaining positions are filled with 0 until the desired number of columns and rows are written (or the last column/row is reached in the destination matrix). The output signals nCpCols and nCpRows give the number of really written columns and rows respectively.

The source and the destination can be the same matrix; therefore it is possible to copy elements within a matrix.

Signals:

Name

I/O

Type(s)

Function

MDest

I/O

Data type independent

Destination matrix

xDest

I

WORD

Index for the starting column at the destination

yDest

I

WORD

Index for starting row at the destination

MSrc

I

Data type independent

Source matrix

xSrc

I

WORD

Index for the starting column at the source

ySrc

I

WORD

Index for the starting row in the source

nCols

I

WORD

Number of columns to copy

nRows

I

WORD

Number of rows to copy

nCpCols

O

WORD

Number of written columns

nCpRow

O

WORD

Number of written rows

Comments:

The first row/column of the matrix has the index of 0.

A negative index is allowed. In this case the first |xDest| column or |yDest| rows read from the source will be ignored and/or the first |xSrc| columns or |ySrc| rows written to the destination will set to 0.

If there is no destination matrix connected a warning will be given before the download and this function block will not operate.


Matrix - Create

Symbol:

Description:

This function block creates a new matrix MY with a determined dimension and initialized with the value at input X.

The initialization will only be done if the Trigger input is set to HIGH. If the Trigger is LOW, the current content of the matrix will not be changed.

Parameter:

The parameter dialog can be used to select a data type and to assign the dimension of the matrix. The number of rows and columns can be set to a value between 1 and 9999 each

Signals:

Name

I/O

Type(s)

Function

X

I

Data type independent

Initial value

Trigger

I

BIT

Initialize matrix

MY

O

Data type independent

Output matrix

Visualization:

The dimension of the matrix is shown in the form of rows x columns in the down right corner of the function block symbol.

Comments:

When choosing a dimension of the matrix, it has to be considered, that a matrix can easily consume large parts of the system memory and therefore can disrupt its proper function. Large matrices can also result in very time consuming operations. The increase of the cycle time may help overcome timing problems.

At the start of a program all matrix elements are set to 0. With the first processing of the function block the appointed init value will be set. If the Trigger input is set to LOW from the beginning, the matrix is filled with 0.

If no connection exists at the output another data type can be assigned by creating a new connection on input X.

If the data type is changed by the parameter dialog all invalid connections will be deleted.


Matrix – Create diagonal matrix

Symbol:

Description:

This function block creates a diagonal matrix out of the input vector VX.

A diagonal matrix is a square matrix in which only the elements of the main diagonal may have non zero values, every other element is 0. The diagonal matrix will either be written to the input MX or a new matrix will be created at output MY.

No designated output matrix (default):

The result will be written back to the additional in-/output matrix MX. No new matrix will be created. The output MY will not be available. The provided matrix MX has to be large enough to hold the diagonal matrix created out of VX. If this is not the case the download will be aborted with an error message.

With designated output matrix:

A new matrix will be created on MY. The dimension of this matrix will be determined automatically out of the input vector. The input MX is not available.

Operation:

Parameter:

The parameter dialog can be used to select the way how to provide the created diagonal matrix.

Signals:

Name

I/O

Type(s)

Function

VX

I

Data type independent

Input vector

MX

I/O

Data type independent

In-/output vector

MY

O

Data type independent

Output vector

Visualization::

If the input signals are connected incorrectly, the symbol will be depicted red in run mode.

Comments:

The data type can be assigned by connecting an input signal.


Matrix - Dimension

Symbol: |
Description: | This function block determines the dimension of the input matrix MX. The number of rows will be given at output m and the number of columns at output n.
Signals: | Name | I/O | Type(s) | Function
 | MX | I | Data type independent | Input matrix
 | m | O | WORD | Number of rows
 | n | O | WORD | Number of columns
Comments: | The data type can be assigned by connecting the input signal.


Matrix - Get

Symbol:

Description:

This function block reads a number of elements from the matrix MX beginning a defined position.

The position will be given by the index of the column (nInd) and the row (mInd). The dimension of the matrix to get can be configured. The new matrix will be given at the output MY.

Operation:

nInd

mInd

MX (3x3)

MY (3x2)

0

0

1

1

7

5

-1

0

Parameter:

The parameter dialog can be used to select a data type and to assign the dimension of the output matrix. The number of rows and columns can be set to a value between 1 and 9999 each

Signals:

Name

I/O

Type(s)

Function

MX

I

Data type independent

Input matrix

nInd

I

WORD

Starting index for columns

mInd

I

WORD

Starting index for rows

MY

O

Data type independent

Output matrix

Visualization:

The dimension of the output matrix is shown in the form of rows x columns in the down right corner of the function block symbol.

Comments:

The first row/column of the matrix has the index of 0.

A negative index is allowed. In this case the first |mInd| rows or |nInd| columns of the output matrix are set to 0, until the first appropriate element of the input matrix is reached.

If the function block is set to get elements beyond the last row or column of the input matrix, these elements are set to 0 in the output matrix.

If no connection exists at the output another data type can be assigned by creating a new connection on input MX.

If the data type is changed by the parameter dialog all invalid connections will be deleted.


Matrix - Rotate

Symbol: |
Description: | This function block rotates a given matrix at input MX by n rows or columns. The rows or the columns of the matrix MX will be shifted downwards/to the right (if n>0) or upwards/to the left (if n<0). Rows or columns moved beyond the matrix will be inserted at the beginning. The result will be written back to MX.
Parameter: | The parameter dialog can be used to select whether rotate the rows or the columns.
Signals: | Name | I/O | Type(s) | Function
 | MX | I/O | Data type independent | In-/Output matrix
 | n | I | WORD | Number of positions to rotate
Visualization: | An indication of the rotation mode will be shown in the symbol.
Comments: | The data type can be assigned by connecting the input MX.


Matrix - Set

Symbol:

Description:

This function block will set the elements from input MX2 to the destination matrix MX1 beginning from a defined position (row mInd and column nInd).

A single value, a vector, or a matrix is allowed for MX2. The original values in the matrix MX1 will be either overwritten or shifted away.

Parameter:

The parameter dialog can be used to select whether the new values will be overwrite the old ones or the new values will be inserted and the old ones will be shifted. When selecting the insert mode, the moving direction of the original values can be selected.

Signals:

Name

I/O

Type(s)

Function

MX1

I/O

Data type independent

In-/output matrix

MX2

I

Data type independent

Input matrix

nInd

I

WORD

Starting index for columns

mInd

I

WORD

Starting index for rows

Visualization:

An indication of the set mode will be shown in the symbol.

Comments:

The first row/column of the matrix has the index of 0.

A negative index is allowed. In this case the first |mInd| rows or |nInd| columns of the Matrix MX2 are not set until the first appropriate element of the output matrix is reached.

Only elements up to the maximum row/column of the output matrix will be set. Elements not fit into the output matrix will be ignored.

The data type can be assigned by connecting an input signal.


Matrix - Transpose

Symbol:

Description:

This function block transforms an m*n matrix at MX1 into an n*m matrix by changing all rows into columns and vice versa.

The transposed matrix will either be written to the input MX2 or a new matrix will be created at output MY.

No designated output matrix (default):

The result will be written back to the additional in-/output matrix MX2. No new matrix will be created. The output MY will not be available. The provided matrix MX2 has to be large enough to hold the transposed matrix of MX1. If this is not the case the download will be aborted with an error message.

With designated output matrix:

A new matrix will be created on MY. The dimension of this matrix will be determined automatically out of the input matrix MX1. The input MX2 is not available.

Operation:

Parameter:

The parameter dialog can be used to select the way how to provide the transposed matrix.

Signals:

Name

I/O

Type(s)

Function

MX1

I

Data type independent

Input matrix

MX2

I/O

Data type independent

In-/output matrix

MY

O

Data type independent

Output matrix

Visualization:

If the input signals are connected incorrectly, the symbol will be depicted red in run mode.

Comments:

An input matrix connected to MX1 is not allowed to be connected at MX2 as the result matrix!

The data type can be assigned by connecting an input signal.


Vektor – Copy data

Vector/Matrix basic operations

Vector – Copy data

Symbol:

Description:

This function block copies elements from the source vector VSrc into the destination vector VDest.

The position to start reading elements from the source is determined by ISrc. The position to start writing elements in the destination is given by IDest. The number of elements to copy is given by nElem. If this function can only read less elements from the source than requested by nElem, the remaining positions are filled with 0 until nElem elements are written to the destination (of the destination vector ends). The output nCpElem contains the number of really written elements.

The source and the destination can be the same vector; therefore it is possible to copy elements within a vector.

Signals:

Name

I/O

Type(s)

Function

VDest

I/O

Data type independent

Destination vector

IDest

I

WORD

Starting index for writing into the destination

VSrc

I

Data type independent

Source vector

ISrc

I

WORD

Starting index for reading from source

nElem

I

WORD

Number of elements to copy

nCpElem

O

WORD

Number of written elements

Comments:

The first element of the vector has the index of 0.

A negative index is allowed. In this case the first |IDest| elements read from the source will be ignored or the first |ISrc| elements of the destination will set to 0.

If there is no destination vector connected a warning will be given before the download and this function block will not operate.

The data type can be assigned by connecting one of the vector input signals.


Vector - Create

Symbol:

Description:

This function block creates a new vector VY with a defined number of elements The vector can be initialized with the value on input X.

This initialization will only performed when the Trigger input is set to HIGH. If the Trigger is LOW, the current content of the vector will not be changed.

Parameter:

With the parameter dialog the data type can be selected and the number of vector elements can be assigned (minimum 1, maximum 9999).

Signals:

Name

I/O

Type(s)

Function

X

I

Data type independent

Initial value

Trigger

I

BIT

Initialize vector

VY

O

Data type independent

Output vector

Visualization:

The number of elements is shown in the down right corner of the symbol.

Comments:

Because large vectors result in time consuming operations, a suitable number of elements have to be considered.

At the start of a program all vector elements are set to 0. With the first processing of the function block the appointed init value will be set. If the Trigger input is set to LOW from the beginning, the vector is filled with 0.

If no connection exists at the output another data type can be assigned by creating a new connection on input X.

If the data type is changed by the parameter dialog all invalid connections will be deleted.


Vector - Get

Symbol:

Description:

This function block reads a number of elements of the vector VX beginning at position Ind.

The number of elements to read can be defined. These elements are provided as a new vector VY.

Parameter:

The parameter dialog can be used to select the data type and to assign the number of elements for the new vector (minimum 1, maximum 9999).

Signals:

Name

I/O

Type(s)

Function

VX

I

Data type independent

Input vector

Ind

I

WORD

Index of starting point

VY

O

Data type independent

Output vector

Visualization:

The number of elements is shown in the down right corner of the symbol.

Comments:

The first element of the vector has the index of 0.

A negative index is allowed. In this case the first elements of the output vector are set to 0, until the first element of the input vector is reached.

In the case of trying to get elements beyond the last index of the input vector, these elements are set to 0 at the output vector.

If no connection exists at the output another data type can be assigned by creating a new connection on input VX.

If the data type is changed by the parameter dialog all invalid connections will be deleted.


Vector - Length

Symbol: |
Description: | This function block determines the length of the input vector VX. The number of elements of the input vectors VX will be given at the output n.
Signals: | Name | I/O | Type(s) | Function
 | VX | I | Data type independent | Input vector
 | n | O | WORD | Number of elements
Comments: | The data type will be assigned by connecting an input signal.


Vektor - Rotate

Vector/Matrix basic operations

Vector - Rotate

Symbol: |
Description: | This function block will rotate the vector VX by n positions. The elements of the vector are shifted upwards (n>0) or downwards (n<0) and elements shifted beyond the end of the vector will be inserted at the beginning. The result will be written back to VX.
Signals: | Name | I/O | Type(s) | Function
 | VX | I/O | Data type independent | In-/output vector
 | n | I | WORD | Number of positions to rotate
Comments: | The data type will be assigned by connecting the input vector.


Vector - Set

Symbol:

Description:

This function block will set the elements from input VX2 to the in-/output vector VX1 beginning from position Ind.

A single value or a complete vector is allowed for VX2. The original values will be either overwritten or shifted.

Parameter:

The parameter dialog can be used to select the set mode: Either overwrite the old values or insert new ones and shift the old ones.

Signals:

Name

I/O

Type(s)

Function

VX1

I/O

Data type independent

In-/output vector

VX2

I

Data type independent

Input Vector

Ind

I

WORD

Index of starting point

Visualization:

An indication of the set mode will be shown in the symbol.

Comments:

The first element of the vector has the index of 0.

A negative index is allowed. In this case the first elements of the vector VX2 are not set until the first element of the destination vector is reached.

Only elements up to the maximum index of the output vector will be set. Elements not fit into the output vector will be ignored.

The data type will be assigned by connecting an input signal.