Open Core Interface - MLPI
MLPI-MotionLogicProgrammingInterface(mlpi4Lua)  1.26.2
MLPI Lua Reference (mlpi4Lua)

Introduction

The MLPI (Motion Logic Programming Interface) is a programming interface used to write applications to configure and run a BoschRexroth device which supports the MLPI interface technology. One example is a IndraMotion MLC/XLC. It includes a set of headers, libraries and some sample code.

overview.png

As you can use PLC Function Blocks to program a device using a PLC task, the MLPI allows you to program the device using a higher-level programming language and a third-party development environment, such as Lua Development Tools (LDT).

Installation

This section describes various pieces of information and notes about the installation of the MLPI. Please read this before using the MLPI for the first time.

Tools and IDE

To use the MLPI, you need to install the following packages:

  • A development environment for Lua like Lua Develoment Tools (LDT).
  • MLPI-SDK, which contains
    • MLPI Libraries and Header files
    • Documentation and help plug-ins (including this document)
    • Sample Code
  • mlpi4Lua-package, which contains
    • MLPI Libraries implemented for Lua

Layout

Listed below are some directories you might want to know about.

<install> = The directory where you installed the mlpiCore SDK.

  • <install>\bin
    Various DLLs needed if you want to use dynamic linking. Might also contain some useful executables for documentation and debugging.
  • <install>\lib
    API libraries for static linking.
  • <install>\doc
    This documentation in different formats.
  • <install>\samples
    Find some examples of projects using the MLPI in here.
Note
You may want to include these paths to the default search path of your development environment. This way, you don't need to worry about absolute paths or the copying of the libs and headers to your project directory.

Overview

MLPI-API Libraries

The MLPI-API is separated into different libraries. To use these libraries in Lua you have to in require mlpi4lua. Each library is a own entry in returned table. For more information look at luadoc documentation in execution environment of Lua development tools (LDT).

Example
...
mlpi = require("mlpi")
mlpi.accesscontrol -- access control library
mlpi.api -- api library
mlpi.security -- security library
mlpi.system -- system library
mlpi.motion -- motion library
mlpi.logic -- logic library
mlpi.param -- param library
mlpi.watchdog -- watchdog library
mlpi.task -- task library
mlpi.trace -- trace library
mlpi.robot -- root library

First Steps

Learn how to setup a simple application based on the platform and development environment where you want to run the executable of your application.

Specifics in mlpi4Lua

The user of the mlpi4Lua package needs to know some specifics of the mlpi4Lua:

  • Lua has four data types(String, Boolean, Integer, Number), in IEC61131 there are much more(e.g. Short, Ushort, Long, Ulong, etc.)
  • Because of the first point, only related data types were casted. That means that Short, Ushort, Long, Ulong, Llong, Ullong are represented by the Lua integer datatype. The Lua Integer in Lua 5.1 has 32-Bit and the Llong has 64-Bit. Therefore the user has to be carfefull with the use of values larger then 32-Bit(for further information about the data types look at the table below). In Lua 5.3 64-Bit Integers are supported.
  • For reading or writing an Array in the LogicLib and ParameterLib, has not to care about array size. mlpi4lua automaticaly detects size of lua tables and returns lua tables with correct size as results.

Data types of the IndraLogic, MLPI and Lua

The table shows the PLC data types within the IEC61131 environment 'IndraLogic', the corresponding data types within the C/C++ environment of the MLPI and the corresponding type within the Lua environment.

Number of Bits Data types of PLC Data types of MLPI Data types of Lua
8 BOOL BOOL8 Boolean
8 SINT CHAR Integer
16 INT SHORT Integer
32 DINT LONG Integer
64 LINT LLONG Integer
8 USINT UCHAR Integer
16 UINT USHORT Integer
32 UDINT ULONG Integer
64 ULINT ULLONG Integer
8 BYTE UCHAR Integer
16 WORD USHORT Integer
32 DWORD ULONG Integer
64 LWORD ULLONG Integer
32 REAL FLOAT Number
64 LREAL DOUBLE Number
8n STRING WCHAR16 String