Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4MATLAB)  1.26.2
ContainerBlocks
Collaboration diagram for ContainerBlocks:
Container Blocks

Container Blocks

Description

Use the container block group when you need to access a larger set of data repetitively and with maximum update speed. For example input data you want to read each machine cycle.

Important Note

The addresses of the variables of the container content might changes on each download or online change of the PLC application, so you have to stop and destroy your container before you load the PLC application!

Please ensure you do not destroy a container during accessing it (e.g. update, read information)!

A container is a list of items which are described as so called tags. Each tag identifies a data element which can be read or written. For example a symbolic variable from the PLC or data from the input area of the I/O mapping.

The first argument of a tag always defines the type of data to read or write. The following data sources are available:

  • LOGICLIB_MEMORY_AREA: Accessing Input, Output and Marker area of PLC (%I, %O, %M).
  • LOGICLIB_SYMBOL: Accessing variables and arrays of PLC by symbolic name using symbolic variables. Access requires a symbol configuration of desired variables.
  • IOLIB_FIELBUS_IO: Accessing fieldbus IO data directly from fieldbus driver.
  • ALIGNMENT_DUMMY: Dummy elements to align the subsequent tag.

The arguments for the different data sources are as follows.

LOGICLIB_MEMORY_AREA

  • argument 1: application name. (e.g. "Application")
  • argument 2: area. (Either "INPUT", "OUTPUT" or "MARKER")
  • argument 3: bit offset. (e.g. "0" to read from start offset)
  • argument 4: bit length. (Note: single bit access or byte access supported. E.g. "1", "8", "16", "24", ... )

LOGICLIB_SYMBOL

  • argument 1: symbol name. (e.g. "Application.PlcProg.boDummy")

IOLIB_FIELBUS_IO

  • argument 1: master name. (e.g. "Onboard_I_O")
  • argument 2: slave address. (e.g. "1")
  • argument 3: area. (Either "INPUT" or "OUTPUT")
  • argument 4: bit offset. (e.g. "0" to read from start offset)
  • argument 5: bit length. (Note: single bit access or byte access supported. e.g. "1", "8", "16", "24", ... )

ALIGNMENT_DUMMY

  • argument 1: byte length (Note: only "1", "2", "4" or "8" byte supported)

More Information

For more information, refer to mlpiCore documentation: ContainerLib.

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0

m4SContainerGetDataManaged

m4SContainerGetDataManaged

m4SContainerGetDataManaged

Container Block: Get multiple data from MLPI target using container mechanism.

Description

This block reads multiple data from a MLPI target using the container mechanism. The container mechanism is the fastest way to communicate data between a Simulink model and the target. The container mechanism is described in section Container blocks and the mlpiCore documentation.

This block can be used to define one or multiple tags. The block handles the container creation, data communication and container destruction when the model stops. This means that the block does not need - as many other m4S blocks do - a m4SApiConnect block to perform its operation. It creates its own connection and provides the connection handle at an output port so other blocks can use the same connection. It also provides a container handle so that more information about the container can be read.

The block handles one or multiple tags and provides each tag data at an individual output port. All tags must define scalar data of data types:

  • MlpiType.MLPI_TYPE_BOOL8
  • MlpiType.MLPI_TYPE_CHAR
  • MlpiType.MLPI_TYPE_UCHAR
  • MlpiType.MLPI_TYPE_SHORT
  • MlpiType.MLPI_TYPE_USHORT
  • MlpiType.MLPI_TYPE_LONG
  • MlpiType.MLPI_TYPE_ULONG
  • MlpiType.MLPI_TYPE_FLOAT
  • MlpiType.MLPI_TYPE_DOUBLE

For each tag the data type must be specified individually in the dialog parameter Data type in MLPI format. This means that for each tag an enumeration value of the ones mentioned above must be specified.

The correspondance between IEC data type, MLPI data type and MATLAB data type is:

  • BOOL / BOOL8 / logical
  • SINT / CHAR / int8
  • (USINT/BYTE) / UCHAR / uint8
  • INT / SHORT / int16
  • (UINT/WORD) / USHORT / uint16
  • DINT / LONG / int32
  • (UDINT/DWORD) / ULONG / uint32
  • REAL / FLOAT / single
  • LREAL / DOUBLE / double

During the first execution of the block it will create a connection and it will create a read access container. If the connection cannot be created it tries a second time to create it. This means in case the connection cannot be created the block waits twice for the timeout as defined in parameter IP address. If the block cannot connect to the target the model will be blocked until the timeout expires.

Block Inputs

result defines if the block will be executed. The input must be a scalar int32 value. The block will not be executed if this value is negative. For negative values the input result is directly fed through to the output result.

Block Outputs

connection contains the connection identifier. The output is a scalar uint32 value. The default value of this port is 0.

result contains the return value of the block. The output is a scalar int32 value. If the output is negative other outputs are invalid. The default value of this output is 0. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

containerHandle contains the handle to access the container with further m4SContainer blocks. The output signal is of type uint32 and is a 1x2 matrix. The first value contains the connectionID and the second value the containerID. The default value of the elements is 0.

tag: x contains the data of tag number x. The output is scalar and of data type as defined in block parameter Data type. The output port label displays the corresponding tag string. The default value of the elements is 0.

Parameters and Dialog Box

IP address specifies the connection string for the container handling. It has to be used identical to the parameter IP address of the block m4SApiConnect.

Number of tag list items specifies the number of tag list items that will be entered in the parameter Enter tag list. The value of the parameter can be an integer number in the range from 1 to M4M_CONST.MEX_CONTAINER_TAGLIST_ITEMS_MAX as defined in M4M_CONST.

Enter tag list specifies one or multiple tag items. The parameter must be a 1xL char array with L limited by the maximum length of a tag list M4M_CONST.MEX_CONTAINER_TAGLIST_LENGTH_MAX as defined in M4M_CONST. For valid tag definitions refer to section Container blocks or the mlpiCore documentation.

Note: the tag list must be a string entered in the edit field of the dialog parameter. This means the text entered must start with a quote and it must end with a quote. A variable to the workspace memory will not be accepted.

Data type in MLPI format specifies the data type for each tag. The parameter must be a row vector of MlpiType enumerations. The number of elements must match the number of tags specified in parameter Number of tag list items.

Sample time (-1 for inherited) specifies the time interval between samples. To inherit the sample time, set this parameter to -1. This block supports discrete sample time, but not continuous sample time.

Enable input signal result specifies if the input signal result is activated or deactivated. If the box is checked, the input signal is visible and the block will be executed as described in the section Block Inputs. If the box is unchecked, the input signal result will be invisible and the block will be executed regardless the execution control signal 'result'. The output signal 'result' contains the result of the internal function call in that case.

Characteristics

Direct Feedthrough

Yes

Sample Time

Fixed Step

Example Model

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4Simulink/blocks:

See also

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0

m4SContainerGetNumberOfContainer

m4SContainerGetNumberOfContainer

m4SContainerGetNumberOfContainer

Container Block: Read total number of data container.

Description

This block reads the total number of container created on a MLPI target. The number of container read includs the container of other applications as well.

Block Inputs

connection defines the connection that will be used. The input must be a scalar uint32 value provided by m4SApiConnect.

result defines if the block will be executed. The input must be a scalar int32 value. The block will not be executed if this value is negative. For negative values the input result is directly fed through to the output result.

Block Outputs

connection contains the connection identifier. The output is a scalar uint32 value. The default value of this port is 0.

result contains the return value of the block. The output is a scalar int32 value. If the output is negative other outputs are invalid. The default value of this output is 0. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

NumOfCon contains the number of container available on the connected MLPI target. The output signal is a scalar uint32 value. The default value of this port is 0.

Parameters and Dialog Box

Sample time (-1 for inherited) specifies the time interval between samples. To inherit the sample time, set this parameter to -1. This block supports discrete sample time, but not continuous sample time.

Characteristics

Direct Feedthrough

Yes

Sample Time

Fixed Step

Example Model

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4Simulink/blocks:

See also

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0

m4SContainerGetSingleDataArrManaged

m4SContainerGetSingleDataArrManaged

m4SContainerGetSingleDataArrManaged

Container Block: Get data from MLPI target using container mechanism.

Description

This block reads data from a MLPI target using the container mechanism. The data can be scalar or a 2D array. The container mechanism is the fastest way to communicate data between a Simulink model and the target. The container mechanism is described in section Container blocks and the mlpiCore documentation.

This block can be used to define a single tag. The block handles the container creation, data communication and container destruction when the model stops. This means that the block does not need - as many other m4S blocks do - a m4SApiConnect block to perform its operation. It creates its own connection and provides the connection handle at an output port so other blocks can use the same connection. It also provides a container handle so that more information about the container can be read.

The block handles only a single tag and provides the tag data at an output port. The tag must define scalar or 2D data of data types:

  • MlpiType.MLPI_TYPE_BOOL8
  • MlpiType.MLPI_TYPE_CHAR
  • MlpiType.MLPI_TYPE_UCHAR
  • MlpiType.MLPI_TYPE_SHORT
  • MlpiType.MLPI_TYPE_USHORT
  • MlpiType.MLPI_TYPE_LONG
  • MlpiType.MLPI_TYPE_ULONG
  • MlpiType.MLPI_TYPE_FLOAT
  • MlpiType.MLPI_TYPE_DOUBLE

For easier data type identification the block dialog provides a popup field with the permitted data types that show the correspondance between IEC data type, MLPI data type and MATLAB data type.

  • BOOL / BOOL8 / logical
  • SINT / CHAR / int8
  • (USINT/BYTE) / UCHAR / uint8
  • INT / SHORT / int16
  • (UINT/WORD) / USHORT / uint16
  • DINT / LONG / int32
  • (UDINT/DWORD) / ULONG / uint32
  • REAL / FLOAT / single
  • LREAL / DOUBLE / double

During the first execution of the block it will create a connection and it will create a read access container. If the connection cannot be created it tries a second time to create it. This means in case the connection cannot be created the block waits twice for the timeout as defined in parameter IP address. If the block cannot connect to the target the model will be blocked until the timeout expires.

Block Inputs

result defines if the block will be executed. The input must be a scalar int32 value. The block will not be executed if this value is negative. For negative values the input result is directly fed through to the output result.

Block Outputs

connection contains the connection identifier. The output is a scalar uint32 value. The default value of this port is 0.

result contains the return value of the block. The output is a scalar int32 value. If the output is negative other outputs are invalid. The default value of this output is 0. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

data contains the tag data. The output is scalar or a MxN array and of data type as defined in block parameter Data type. The maximum of M or N is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST. The maximum number of elements in this array is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST. A linear IEC array with N elements can be output as row array or column array by defining it as [1,N] or [N,1] array. 3D output signals are not supported. The default value of the elements is 0.

containerHandle contains the handle to access the container with further m4SContainer blocks. The output signal is of type uint32 and is a 1x2 matrix. The first value contains the connectionID and the second value the containerID. The default value of the elements is 0.

Parameters and Dialog Box

IP address specifies the connection string for the container handling. It has to be used identical to the parameter IP address of the block m4SApiConnect.

Enter tag specifies a single tag item. The parameter must be a 1xL char array with L limited by the maximum length of a tag list M4M_CONST.MEX_CONTAINER_TAGLIST_LENGTH_MAX as defined in M4M_CONST. For valid tag definitions refer to section Container blocks or the mlpiCore documentation.

Data type (IEC/MLPI/MATLAB) specifies the data type of the tag. The value can be selected from the popup menue. For more information about data type mapping between IEC, MLPI and MATLAB refer to the enumeration MlpiType.

Array dimensions specifies the dimension of the output signal data. The parameter must be scalar for scalar IEC data and a [M,N] matrix for a IEC data array. M and N must be real numeric integer values. The maximum for M and N is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST. The maximum number of elements in this array is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST.

If the IEC data is scalar use 1.

If the IEC data array is defined as ARRAY [1..N] OF ... use [1,N] to get a row vector output signal or [N,1] to get a column vector output signal data.

If the IEC data array is defined as ARRAY [1..M,1..N] OF ... use [M,N] to get a MxN output signal data. If the 2D IEC array shall be converted to a row vector or a column vector use [1,M*N] or [M*N,1] respectively.

3D output signals are not supported. However, if a 3D IEC data array is defined as ARRAY [1..K,1..M,1..N] OF ... use [1,K*M*N] to get all array elements as row vector output signal or [K*M*N,1] to get a column vector output signal.

Sample time (-1 for inherited) specifies the time interval between samples. To inherit the sample time, set this parameter to -1. This block supports discrete sample time, but not continuous sample time.

Enable input signal result specifies if the input signal result is activated or deactivated. If the box is checked, the input signal is visible and the block will be executed as described in the section Block Inputs. If the box is unchecked, the input signal result will be invisible and the block will be executed regardless the execution control signal 'result'. The output signal 'result' contains the result of the internal function call in that case.

Characteristics

Direct Feedthrough

Yes

Sample Time

Fixed Step

Example Model

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4Simulink/blocks:

See also

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0

m4SContainerSetDataManaged

m4SContainerSetDataManaged

m4SContainerSetDataManaged

Container Block: Write multiple data to MLPI target using container mechanism.

Description

This block writes multiple data to a MLPI target using the container mechanism. The container mechanism is the fastest way to communicate data between a Simulink model and the target. The container mechanism is described in section Container blocks and the mlpiCore documentation.

This block can be used to define one or multiple tags. The block handles the container creation, data communication and container destruction when the model stops. This means that the block does not need - as many other m4S blocks do - a m4SApiConnect block to perform its operation. It creates its own connection and provides the connection handle at an output port so other blocks can use the same connection. It also provides a container handle so that more information about the container can be read.

The block handles one or multiple tags. It reads the tag data from the signals connected to the input ports and writes it to the container. All tags must define scalar data of data types:

  • MlpiType.MLPI_TYPE_BOOL8
  • MlpiType.MLPI_TYPE_CHAR
  • MlpiType.MLPI_TYPE_UCHAR
  • MlpiType.MLPI_TYPE_SHORT
  • MlpiType.MLPI_TYPE_USHORT
  • MlpiType.MLPI_TYPE_LONG
  • MlpiType.MLPI_TYPE_ULONG
  • MlpiType.MLPI_TYPE_FLOAT
  • MlpiType.MLPI_TYPE_DOUBLE

For each tag the data type must be specified individually in the dialog parameter Data type in MLPI format. This means that for each tag an enumeration value of the ones mentioned above must be specified.

The correspondance between IEC data type, MLPI data type and MATLAB data type is:

  • BOOL / BOOL8 / logical
  • SINT / CHAR / int8
  • (USINT/BYTE) / UCHAR / uint8
  • INT / SHORT / int16
  • (UINT/WORD) / USHORT / uint16
  • DINT / LONG / int32
  • (UDINT/DWORD) / ULONG / uint32
  • REAL / FLOAT / single
  • LREAL / DOUBLE / double

During the first execution of the block it will create a connection and it will create a write access container. If the connection cannot be created it tries a second time to create it. This means in case the connection cannot be created the block waits twice for the timeout as defined in parameter IP address. If the block cannot connect to the target the model will be blocked until the timeout expires.

Block Inputs

result defines if the block will be executed. The input must be a scalar int32 value. The block will not be executed if this value is negative. For negative values the input result is directly fed through to the output result.

tag: x defines the data of tag number x. The input signal must be scalar and of data type as defined in dialog parameter Data type in MLPI format. The input port label displays the corresponding tag string.

Block Outputs

connection contains the connection identifier. The output is a scalar uint32 value. The default value of this port is 0.

result contains the return value of the block. The output is a scalar int32 value. If the output is negative other outputs are invalid. The default value of this output is 0. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

containerHandle contains the handle to access the container with further m4SContainer blocks. The output signal is of type uint32 and is a 1x2 matrix. The first value contains the connectionID and the second value the containerID. The default value of the elements is 0.

Parameters and Dialog Box

IP address specifies the connection string for the container handling. It has to be used identical to the parameter IP address of the block m4SApiConnect.

Number of tag list items specifies the number of tag list items that will be entered in the parameter Enter tag list. The value of the parameter can be an integer number in the range from 1 to M4M_CONST.MEX_CONTAINER_TAGLIST_ITEMS_MAX as defined in M4M_CONST.

Enter tag list specifies one or multiple tag items. The parameter must be a 1xL char array with L limited by the maximum length of a tag list M4M_CONST.MEX_CONTAINER_TAGLIST_LENGTH_MAX as defined in M4M_CONST. For valid tag definitions refer to section Container blocks or the mlpiCore documentation.

Note: the tag list must be a string entered in the edit field of the dialog parameter. This means the text entered must start with a quote and it must end with a quote. A variable to the workspace memory will not be accepted.

Data type in MLPI format specifies the data type for each tag. The parameter must be a row vector of MlpiType enumerations. The number of elements must match the number of tags specified in parameter Number of tag list items.

Sample time (-1 for inherited) specifies the time interval between samples. To inherit the sample time, set this parameter to -1. This block supports discrete sample time, but not continuous sample time.

Characteristics

Direct Feedthrough

Yes

Sample Time

Fixed Step

Example Model

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4Simulink/blocks:

See also

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0

m4SContainerSetSingleDataArrManaged

m4SContainerSetSingleDataArrManaged

m4SContainerSetSingleDataArrManaged

Container Block: Write data to MLPI target using container mechanism.

Description

This block writes data to a MLPI target using the container mechanism. The data can be scalar or a 2D array. The container mechanism is the fastest way to communicate data between a Simulink model and the target. The container mechanism is described in section Container blocks and the mlpiCore documentation.

This block can be used to define a single tag. The block handles the container creation, data communication and container destruction when the model stops. This means that the block does not need - as many other m4S blocks do - a m4SApiConnect block to perform its operation. It creates its own connection and provides the connection handle at an output port so other blocks can use the same connection. It also provides a container handle so that more information about the container can be read.

The block handles only a single tag and writes data that is provided at the input port to the container. The tag must define scalar data or 2D data of data types:

  • MlpiType.MLPI_TYPE_BOOL8
  • MlpiType.MLPI_TYPE_CHAR
  • MlpiType.MLPI_TYPE_UCHAR
  • MlpiType.MLPI_TYPE_SHORT
  • MlpiType.MLPI_TYPE_USHORT
  • MlpiType.MLPI_TYPE_LONG
  • MlpiType.MLPI_TYPE_ULONG
  • MlpiType.MLPI_TYPE_FLOAT
  • MlpiType.MLPI_TYPE_DOUBLE

Note: The data type is not inherited from the input port data in order to perform plausibility checks.

The correspondance between IEC data type, MLPI data type and MATLAB data type is as follows:

  • BOOL / BOOL8 / logical
  • SINT / CHAR / int8
  • (USINT/BYTE) / UCHAR / uint8
  • INT / SHORT / int16
  • (UINT/WORD) / USHORT / uint16
  • DINT / LONG / int32
  • (UDINT/DWORD) / ULONG / uint32
  • REAL / FLOAT / single
  • LREAL / DOUBLE / double

During the first execution of the block it will create a connection and it will create a write access container. If the connection cannot be created it tries a second time to create it. This means in case the connection cannot be created the block waits twice for the timeout as defined in parameter IP address. If the block cannot connect to the target the model will be blocked until the timeout expires.

Block Inputs

result defines if the block will be executed. The input must be a scalar int32 value. The block will not be executed if this value is negative. For negative values the input result is directly fed through to the output result.

data defines the data that will be written to the tag. The input signal must be scalar, a row vector, a column vector or a MxN matrix. Refer to dialog parameter Array dimensions to see the necessary configuration to accept these input signal dimensions. The data type must be set as described above.

Block Outputs

connection contains the connection identifier. The output is a scalar uint32 value. The default value of this port is 0.

result contains the return value of the block. The output is a scalar int32 value. If the output is negative other outputs are invalid. The default value of this output is 0. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

containerHandle contains the handle to access the container with further m4SContainer blocks. The output signal is of type uint32 and is a 1x2 matrix. The first value contains the connectionID and the second value the containerID. The default value of the elements is 0.

Parameters and Dialog Box

IP address specifies the connection string for the container handling. It has to be used identical to the parameter IP address of the block m4SApiConnect.

Enter tag specifies a single tag item. The parameter must be a 1xL char array with L limited by the maximum length of a tag list M4M_CONST.MEX_CONTAINER_TAGLIST_LENGTH_MAX as defined in M4M_CONST. For valid tag definitions refer to section Container blocks or the mlpiCore documentation.

Data type (IEC/MLPI/MATLAB) specifies the data type of the tag. The value can be selected from the popup menue. For more information about data type mapping between IEC, MLPI and MATLAB refer to the enumeration MlpiType.

Array dimensions specifies the dimension of the input signal data. The parameter must be scalar for scalar IEC data and a [M,N] matrix for a IEC data array. M and N must be real numeric integer values. The maximum for M and N is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST. The maximum number of elements in this array is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX as defined in M4M_CONST.

If the IEC data is scalar use 1.

If the IEC data array is defined as ARRAY [1..N] OF ... use [1,N] to write a row vector input signal or [N,1] to write a column vector input signal data.

If the IEC data array is defined as ARRAY [1..M,1..N] OF ... use [M,N] to write a MxN input signal data. If the 2D IEC array shall be converted to a row vector or a column vector use [1,M*N] or [M*N,1] respectively.

3D input signals are not supported. However, if a 3D IEC data array is defined as ARRAY [1..K,1..M,1..N] OF ... use [1,K*M*N] to write all array elements as row vector input signal or [K*M*N,1] to write a column vector input signal.

Sample time (-1 for inherited) specifies the time interval between samples. To inherit the sample time, set this parameter to -1. This block supports discrete sample time, but not continuous sample time.

Characteristics

Direct Feedthrough

Yes

Sample Time

Fixed Step

Example Model

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4Simulink/blocks:

See also

Copyright

Legal notice and version: © 2017 Bosch Rexroth Corporation http://www.boschrexroth.com DC-AE/EAS1 (MGo) Library version: 1.26.2.0.0