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