Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4MATLAB)  1.26.2
LogicLib
Collaboration diagram for LogicLib:
Logic Functions

Logic Functions

Description

The logic functions group contains functions to control and manage the PLC runtime system on the target device. Furthermore this function group provides the symbolic read and write access to logic variables and the possibility to read and write memory areas such as the input area.

More Information

For more information, refer to mlpiCore documentation: LogicLib.

Copyright

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

m4MLogicGetAddressOfSingleSymbol

m4MLogicGetAddressOfSingleSymbol

m4MLogicGetAddressOfSingleSymbol

Logic-Function: Get the address of a single symbolic variable.

Description

This function reads the physical kernel space address of one symbolic variable of a PLC application.

The symbolic variable must be available in the 'symbol configuration' of the PLC.

Note: This function can only be used within a real time application on the target and only within the kernel space!

Attention: The address might change on every download or online change of the PLC application.

Syntax

[symbolAddress]         = m4MLogicGetAddressOfSingleSymbol(connection,...
varSymbol)
[symbolAddress, result] = m4MLogicGetAddressOfSingleSymbol(connection,...
varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument must be as follows:

  • 1xL char array: To read the address of a single symbolic variable.

Output Arguments

symbolAddress contains the address of the symbolic variable. The argument is of type uint32 and is scalar.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetAddressOfSingleSymbol

Copyright

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

m4MLogicGetAddressOfSymbol

m4MLogicGetAddressOfSymbol

m4MLogicGetAddressOfSymbol

Logic-Function: Get the address of one or multiple symbolic variables.

Description

This function reads the physical kernel space address of one or multiple symbolic variables of a PLC application.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

This function does not support code generation.

Note: This function can only be used within a real time application on the target and there only whithin the kernel space!

Attention: This address might change on every download or online change of PLC application.

Syntax

[symbolAddress]         = m4MLogicGetAddressOfSymbol(connection,...
varSymbol)
[symbolAddress, result] = m4MLogicGetAddressOfSymbol(connection,...
varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be as follows:

  • 1xL char array: To read the address of a single symbolic variable.
  • Mx1 cell array: To read the address of multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To read the address of multiple symbolic variables. Each cell must be a 1xL char array.

Output Arguments

symbolAddress contains the addresses of the symbolic variables. The argument is of type uint32 and is scalar or a Mx1 vector.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetAddressOfSymbol

Copyright

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

m4MLogicGetInformationOfSymbol

m4MLogicGetInformationOfSymbol

m4MLogicGetInformationOfSymbol

Logic-Function: Get information of one or multiple symbolic variables.

Description

This function reads the types, size, number of elements, array information and access rights of one or multiple symbol variables of a PLC application. It therefore combines the functionality of m4MLogicGetTypeOfSymbol, m4MLogicGetSizeOfSymbol, m4MLogicGetNumElementsOfSymbol, m4MLogicGetDimensionOfSymbol, m4MLogicGetArrayRangeOfSymbol, m4MLogicGetAccessRightsOfSymbol in a single call.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

Syntax

[symbolInfo]         = m4MLogicGetInformationOfSymbol(connection,...
varSymbol)
[symbolInfo, result] = m4MLogicGetInformationOfSymbol(connection,...
varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be as follows:

  • 1xL char array: To read information from a single symbolic variable.
  • Mx1 cell array: To read information from multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To read information from multiple symbolic variables. Each cell must be a 1xL char array.

Output Arguments

symbolInfo contains information of the symbolic variable. The argument is a MlpiLogicSymbolInformation structure and is scalar or a Mx1 vector.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetInformationOfSymbol

Copyright

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

m4MLogicGetNumberOfApplications

m4SLogicGetNumberOfApplications

m4SLogicGetNumberOfApplications

Logic-Function: Read the number of applications.

Description

This function reads the number of applications on a MLPI target.

Syntax

[number]         = m4SLogicGetNumberOfApplications(connection)
[number, result] = m4SLogicGetNumberOfApplications(connection)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

Output Arguments

number contains the number of applications. The argument is a scalar uint32 value.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetAddressOfSingleSymbol

Copyright

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

m4MLogicGetSizeOfSingleSymbol

m4MLogicGetSizeOfSingleSymbol

m4MLogicGetSizeOfSingleSymbol

Logic-Function: Get the size of a single symbolic variable.

Description

This function reads the size in bytes of a symbol variable of a PLC application. This and further information can also be read by m4MLogicGetInformationOfSingleSymbol.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

Syntax

[varSize]         = m4MLogicGetSizeOfSingleSymbol(connection, varSymbol)
[varSize, result] = m4MLogicGetSizeOfSingleSymbol(connection, varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of the symbolic variable. The argument must be a 1xL char array.

Output Arguments

varSize contains the size of the symbolic variables in byte. The argument is a scalar of type uint32.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetSizeOfSymbol

Copyright

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

m4MLogicGetSizeOfSymbol

m4MLogicGetSizeOfSymbol

m4MLogicGetSizeOfSymbol

Logic-Function: Get the size of one or multiple symbolic variables.

Description

This function reads the size in bytes of a symbol variable of a PLC application. This and further information can also be read by m4MLogicGetInformationOfSymbol.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

This function does not support code generation. For code generation refer to function m4MLogicGetSizeOfSingleSymbol.

Syntax

[varSize]         = m4MLogicGetSizeOfSymbol(connection, varSymbol)
[varSize, result] = m4MLogicGetSizeOfSymbol(connection, varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be as follows:

  • 1xL char array: To read the size of a single symbolic variable.
  • Mx1 cell array: To read the size of multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To read the size of multiple symbolic variables. Each cell must be a 1xL char array.

Output Arguments

varSize contains the size of the symbolic variables in byte. The argument is of type uint32 and is scalar or a Mx1 vector.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetSizeOfSymbol

Copyright

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

m4MLogicGetTypeOfSymbol

m4MLogicGetTypeOfSymbol

m4MLogicGetTypeOfSymbol

Logic-Function: Get the type of one or multiple symbolic variables.

Description

This function reads the type and subtype of a symbolic variable of a PLC application. This and further information can also be read by m4MLogicGetInformationOfSymbol.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

This function does not support code generation. For code generation refer to function m4MLogicGetTypeOfSingleSymbol.

Syntax

[varType, varSubtype]         = m4MLogicGetTypeOfSymbol(connection,...
varSymbol)
[varType, varSubtype, result] = m4MLogicGetTypeOfSymbol(connection,...
varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be as follows:

  • 1xL char array: To read the type of a single symbolic variable.
  • Mx1 cell array: To read the type of multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To read the type of multiple symbolic variables. Each cell must be a 1xL char array.

Output Arguments

varType contains the type of the symbolic variables. The argument is of a MlpiLogicType enumeration and is scalar or a Mx1 vector.

varSubtype contains the subtype of the symbolic variables. The argument is of a MlpiLogicType enumeration and is scalar or a Mx1 vector.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicGetTypeOfSymbol

Copyright

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

m4MLogicReadMemoryArea

m4MLogicReadMemoryArea

m4MLogicReadMemoryArea

Logic-Function: Get data from PLC memory area.

Description

This function reads the following memory areas: Ix (Input), Qx (Output) and Mx (Marker) from the target defined by the argument memArea. The function reads the raw bit stream from the memory and reconstructs the data and the data type as defined by the argument dataType.

The meaning of offset depends on the argument dataType. The offset value is an offset in bytes for all types except logical. If the type of data is logical, offset is a bit-offset.

The function does not support reading an array of logical values.

Syntax

[data]         = m4MLogicReadMemoryArea(connection, application,...
memArea, offset, dataType, varargin)
[data, result] = m4MLogicReadMemoryArea(connection, application,...
memArea, offset, dataType, varargin)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

application defines the name of the application that manages the memory area. The argument must be a 1xL char array.

memArea defines the type of the memory area. The argument must be a scalar MlpiApplicationMemoryArea enumeration.

offset defines the numeric offset value from where the data will be read. If the dataType is logical the offset is a bit-offset otherwise it is a byte-offset. The argument must be a scalar numeric uint32 value.

dataType defines the data type of the output argument. The argument must be a scalar MlpiType enumeration.

varargin is an optional input argument that defines the number M of elements if an array of data shall be read. The argument must be a scalar numeric uint32 value.

Output Arguments

data contains the values that were read from the memory area. The argument is scalar or a Mx1 matrix with the data type defined by the input argument dataType. If the function was not able to read M elements because M was too high, the number of elements will be reduced to the maximum number of data available.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicReadMemoryArea

Copyright

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

m4MLogicReadSingleVariableBySymbol

m4MLogicReadSingleVariableBySymbol

m4MLogicReadSingleVariableBySymbol

Logic-Function: Read data from a single symbolic variable.

Description

This function reads data from a single symbolic variable and returns it as variable specific type. If multiple variables shall be read with one function call refer to function m4MLogicReadVariableBySymbol.

This function does not supported code generation. For code generation use the function m4MLogicReadVariableBySymbolData.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

Syntax

[data]         = m4MLogicReadSingleVariableBySymbol(connection,...
varSymbol)
[data, result] = m4MLogicReadSingleVariableBySymbol(connection,...
varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of a single symbolic variables. The argument must be a 1xL char array.

Output Arguments

data contains the data read from the symbolic variable. The type of the argument is the MATLAB data type that corresponds to the data type of the symbolic variable. The argument can have the following dimensions for native data types of the symbolic variable:

  • scalar: if the symbolic variable is scalar.
  • 1xL char array: if the symbolic variable is a string.
  • Mx1 matrix: if the symbolic variable is a 1-dimensional array.
  • MxN matrix: if the symbolic variable is a 2-dimensional array.
  • MxNxK matrix: if the symbolic is a 3-dimensional array.

The argument can have the following form if the symbolic variable is a user defined structure or an array of a user defined structure:

  • 1xM matrix: with numeric uint8 values while this is a byte sequence of the memory layout of the symbolic variable. The original structure can be reconstructed by use of the information provided by the function m4MLogicGetInformationOfUserType

Some data types available in the PLC environment are not available as native data types in MATLAB. The following data types will be returned as described:

  • TIME: uint32 value as time in milliseconds.
  • DATE: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • DATEANDTIME: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • TIMEOFDAY: uint32 value as time in milliseconds, time begins at 12:00 a.m. (00:00 a.m.).
  • ENUM: int16 value.

Other PLC data types are not supported.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicReadVariableBySymbol

Copyright

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

m4MLogicReadVariableBySymbolData

m4MLogicReadVariableBySymbolData

m4MLogicReadVariableBySymbolData

Logic-Function: Read data from a single symbolic variable.

Description

This function reads data from a single symbolic variable and returns it as predefined data type. This function supports code generation.

The function reads data from a single symbolic variable. The IEC data type of the variable can be BOOL, BYTE, WORD, DWORD, SINT, INT, DINT, USINT, UINT, UDINT, REAL, LREAL, STRING, TIME, DATE, TIME_OF_DAY, DATE_AND_TIME and ENUM. The dimension can be a scalar, a 1D, a 2D or a 3D array.

According to the IEC data types the input argument data must be predefined with a MATLAB data type. The function handles data types logical, uint8, int8, uint16, int16, uint32, int32, single, double and char. Variables of type STRING must be predefined as 1xL char array. If an empty string is read from the target all characters will be set to char(0).

The correspondance table for IEC data types and MATLAB data types can be found in the introduction section. Another correspondance table for mlpiCore data types and MATLAB data types can be found in the type definition of MlpiType.

In order to define the data type and size of the output argument data it has to be predefined prior to calling the function. Refer to the sample file for details.

Caution: The function performs a dimension and type check between symbolic variable and input argument data except for char arrays if it is used in MATLAB. If code is generated from this function the code does not perform a dimension nor a type check for performance reasons.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

Syntax

[data]         = m4MLogicReadVariableBySymbolData(connection,...
varSymbol, data)
[data, result] = m4MLogicReadVariableBySymbolData(connection,...
varSymbol, data)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of a single symbolic variables. The argument must be a 1xL char array.

data specifies the dimension and type of output argument data. The input argument will be filled by the function with values read from the symbolic variable. The argument can be of type logical, uint8, int8, uint16, int16, uint32, int32, single, double or char.

The argument can have the following dimensions for native data types of the symbolic variable:

  • scalar: if the symbolic variable is scalar.
  • 1xL char array: if the symbolic variable is a string.
  • Mx1 matrix: if the symbolic variable is a 1-dimensional array.
  • MxN matrix: if the symbolic variable is a 2-dimensional array.
  • MxNxK matrix: if the symbolic is a 3-dimensional array.

K, M, and N must be smaller than M4M_CONST.MEX_ARRAY_ELEMENTS_MAX+1. The maximum number of elements is M4M_CONST.MEX_ARRAY_ELEMENTS_MAX.

Some data types available in the PLC environment are not available as native data types in MATLAB. The following data types can be predefined to read the PLC data types:

  • uint32 to read TIME. The value is the time in milliseconds.
  • uint32 to read DATE. The value is the time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • uint32 to read DATEANDTIME. The value is the time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • uint32 to read TIMEOFDAY. The value is the time in milliseconds, time begins at 12:00 a.m. (00:00 a.m.).
  • int16 to read an ENUM value.

Non-native IEC data types are not supported by this function.

Output Arguments

data contains the data read from the symbolic variable. The type and the dimension of the argument is equal to the input argument data. The values of the input argument will be overwritten.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicReadVariableBySymbol

Copyright

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

m4MLogicReadVariableBySymbol

m4MLogicReadVariableBySymbol

m4MLogicReadVariableBySymbol

Logic-Function: Read data from a single or multiple symbolic variables.

Description

This function reads data from a single or multiple symbolic variable and returns the values as cell array. If a single variable shall be read that does not return a cell array refer to function m4MLogicReadSingleVariableBySymbol.

This function does not supported code generation. For code generation use the function m4MLogicReadVariableBySymbolData.

The symbolic variables must be available in the 'symbol configuration' of the PLC.

Syntax

[data]         = m4MLogicReadVariableBySymbol(connection, varSymbol)
[data, result] = m4MLogicReadVariableBySymbol(connection, varSymbol)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be:

  • 1xL char array: To read data from a single symbolic variable.
  • Mx1 cell array: To read data from multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To read data from multiple symbolic variables. Each cell must be a 1xL char array.

Output Arguments

data contains the data read from the symbolic variable(s). The argument is a scalar cell array for a single symbolic variable or a Mx1 cell array if multiple symbolic variables are read. The type of each cells can be different and is the MATLAB data type that corresponds to the data type of the symbolic variable. The array in the cells can have the following forms for native IEC data types of the symbolic variable:

  • scalar: if the symbolic variable is scalar.
  • 1xL char array: if the symbolic variable is a string.
  • Mx1 matrix: if the symbolic variable is a 1-dimensional array.
  • MxN matrix: if the symbolic variable is a 2-dimensional array.
  • MxNxK matrix: if the symbolic variable is a 3-dimensional array.

The array in the cells can have the following form if the symbolic variable is a user defined structure or an array of a user defined structure:

  • 1xM matrix: with numeric uint8 values while this is a byte sequence of the memory layout of the symbolic variable. The original structure can be reconstructed by use of the information provided by the function m4MLogicGetInformationOfUserType

Some data types available in the PLC environment are not available as native data types in MATLAB. The following data types will be returned as described:

  • TIME: uint32 value as time in milliseconds.
  • DATE: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • DATEANDTIME: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • TIMEOFDAY: uint32 value as time in milliseconds, time begins at 12:00 a.m. (00:00 a.m.).
  • ENUM: int16 value.

Other PLC data types are not supported.

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. If the function call fails, other output arguments will be set to NaN. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicReadVariableBySymbol

Copyright

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

m4MLogicRunSingleCycleApplication

m4MLogicRunSingleCycleApplication

m4MLogicRunSingleCycleApplication

Logic-Function: Run single cycle of one or all applications.

Description

This function will run a single cycle of one or all applications.

Syntax

m4MLogicRunSingleCycleApplication(connection)
result = m4MLogicRunSingleCycleApplication(connection)

m4MLogicRunSingleCycleApplication(connection,application)
result = m4MLogicRunSingleCycleApplication(connection, application)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

Optional Input Argument

application specifies the name of the application that will be run for a single cycle. The argument must be a 1xL char array. If this argument is not used all applications will be run for a single cycle.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicRunSingleCycleApplication

Copyright

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

m4MLogicStartApplication

m4MLogicStartApplication

m4MLogicStartApplication

Logic-Function: Start one or all applications.

Description

This function will start one or all applications.

Syntax

m4MLogicStartApplication(connection)
result = m4MLogicStartApplication(connection)

m4MLogicStartApplication(connection,application)
result = m4MLogicStartApplication(connection, application)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

Optional Input Argument

application specifies the name of the application that will be started. The argument must be a 1xL char array. If this argument is not used all applications will be started.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicStartApplication

Copyright

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

m4MLogicStopApplication

m4MLogicStopApplication

m4MLogicStopApplication

Logic-Function: Stop one or all applications.

Description

This function will stop one or all applications.

Note: All motion that is assigned to the applications will stop!

Syntax

m4MLogicStopApplication(connection)
result = m4MLogicStopApplication(connection)

m4MLogicStopApplication(connection,application)
result = m4MLogicStopApplication(connection, application)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

Optional Input Argument

application specifies the name of the application that will be stopped. The argument must be a 1xL char array. If this argument is not used all applications will be stopped.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicStopApplication

Copyright

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

m4MLogicWriteMemoryArea

m4MLogicWriteMemoryArea

m4MLogicWriteMemoryArea

Logic-Function: Write data to PLC memory area.

Description

This function writes data to the memory area of the target. As the memory area in a PLC can be addressed with different data types, the type of the argument data must be provided explicitly. The offset depends on the type of argument data. The offset value is an offset in bytes for all types except logical. If the type of data is logical, offset is a bit-offset.

Caution: It is possible to call the function with memArea = MlpiApplicationMemoryArea.MLPI_MEMORY_AREA_INPUT for some particular cases. However, this will cause an error in a physical target as write access is not allowed for physical inputs.

Syntax

m4MLogicWriteMemoryArea(connection, application, memArea,...
offset, data)
result = m4MLogicWriteMemoryArea(connection, application, memArea,...
offset, data)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

application defines the name of the application that manages the memory area. The argument must be a 1xL char array.

memArea defines the type of the memory area. The argument must be a scalar MlpiApplicationMemoryArea enumeration.

offset defines the numeric offset value from where the data will be written. If the dataType is logical the offset is a bit-offset otherwise it is a byte-offset. The argument must be a scalar numeric uint32 value.

data defines the data that will be written to the memory area. The type of this arguments defines the number of bytes that will be written to the memory. Refer to MlpiType for valid data types. The argument can be scalar, a Mx1 or a 1xM matrix.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicWriteMemoryArea

Copyright

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

m4MLogicWriteSingleVariableBySymbol

m4MLogicWriteSingleVariableBySymbol

m4MLogicWriteSingleVariableBySymbol

Logic-Function: Write data to a symbolic variable.

Description

This function writes data to one symbolic variable.

The symbolic variable must be available in the 'symbol configuration' of the PLC.

Syntax

m4MLogicWriteSingleVariableBySymbol(connection, varSymbol, data)
result = m4MLogicWriteSingleVariableBySymbol(connection, varSymbol, data)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one symbolic variables. The argument can be as follows:

  • 1xL char array: To write data to a single symbolic variable.

data contains the data that will be writen to the symbolic variable. The argument can be scalar or a MxNxK array. The type of data must be the MATLAB data type that corresponds to the data type of the symbolic variable. data can have the following forms for native data types of the symbolic variable:

  • scalar: if the symbolic variable is scalar.
  • 1xL char array: if the symbolic variable is a string.
  • Mx1 matrix: if the symbolic variable is a 1-dimensional array.
  • MxN matrix: if the symbolic variable is a 2-dimensional array.
  • MxNxK matrix: if the symbolic variable is a 3-dimensional array.

data must be one of the following data types: logical, int8, uint8, int16, uint16, int32, uint32, single, double, char.

data can not be int64 or uint64 as MATLAB Coder does not support these data types.

Some data types available in the PLC environment are not available as native data types in MATLAB. The following data types must be used to write to the following PLC data types:

  • MLPI_LOGIC_TIME: uint32 value as time in milliseconds.
  • MLPI_LOGIC_DATE: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_DATEANDTIME: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_TIMEOFDAY: uint32 value as time in milliseconds, time begins at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_ENUM: int16 value.

Other PLC data types are not supported by this function.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicWriteSingleVariableBySymbol

Copyright

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

m4MLogicWriteVariableBySymbol

m4MLogicWriteVariableBySymbol

m4MLogicWriteVariableBySymbol

Logic-Function: Write data to a symbolic variable.

Description

This function writes data to one or multiple symbolic variables. This function cannot be used for code generation.

The symbolic variable must be available in the 'symbol configuration' of the PLC.

Syntax

m4MLogicWriteVariableBySymbol(connection, varSymbol, data)
result = m4MLogicWriteVariableBySymbol(connection, varSymbol, data)

Input Arguments

connection defines the connection that will be used. The argument must be scalar and of type MlpiConnection.

varSymbol specifies the complete instance path of one or multiple symbolic variables. The argument can be as follows:

  • 1xL char array: To write data to a single symbolic variable.
  • Mx1 cell array: To write data to multiple symbolic variables. Each cell must be a 1xL char array.
  • 1xM cell array: To write data to multiple symbolic variables. Each cell must be a 1xL char array.

data contains the data that will be writen to the symbolic variable(s). The argument is scalar, a Mx1 or a 1xM cell array. The type of the cells must be the MATLAB data type that corresponds to the data type of the symbolic variable. The cells can have the following forms for native data types of the symbolic variable:

  • scalar: if the symbolic variable is scalar.
  • 1xL char array: if the symbolic variable is a string.
  • Mx1 matrix: if the symbolic variable is a 1-dimensional array.
  • MxN matrix: if the symbolic variable is a 2-dimensional array.
  • MxNxK matrix: if the symbolic variable is a 3-dimensional array.

The cells can have the following form if the symbolic variable is a user defined structure or an array of a user defined structure:

  • 1xM matrix: with numeric uint8 values while this is a byte sequence of the memory layout of the symbolic variable. The original structure can be reconstructed by use of the information provided by the function m4MLogicGetInformationOfUserType

Some data types available in the PLC environment are not available as native data types in MATLAB. The following data types must be used to write to the following PLC data types:

  • MLPI_LOGIC_TIME: uint32 value as time in milliseconds.
  • MLPI_LOGIC_DATE: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_DATEANDTIME: uint32 value as time in seconds beginning with January 1, 1970 at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_TIMEOFDAY: uint32 value as time in milliseconds, time begins at 12:00 a.m. (00:00 a.m.).
  • MLPI_LOGIC_ENUM: int16 value.

Other PLC data types are not supported.

Output Arguments

result contains the return value of the MLPI function. The argument is scalar and of type int32. Negative values indicate a failed function call. For details refer to the section Error Identification and Handling in Fundamentals of MLPI Programming.

Example Files

Here you will find instructions to use the examples.

The following example is available in the folder ./mlpi/mlpi4MATLAB/bin:

See also

Reference to mlpiCore

This function maps to the mlpiCore function: mlpiLogicWriteVariableBySymbol

Copyright

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