User manual
Scripting
5
4. Scripting
The behaviour of the gpio.ipCore can be automated through scripts. In the process, the
database (Redis), and Modbus and the REST servers form uniform interfaces. Supported
scripting languages are Lua, Python and JavaScript. Figure4.1, “Internal structure” shows
the interaction of the components involved.
[RS485]
…
[USB1]
…
[USB2]
…
[RS485]
…
[USB1]
…
[USB2]
…
/etc/mbtcp.conf
MBTCP-
Server
MBTCP-
Server
„ RS485“
„ USB1“
„ USB2“
LEM
LUA m achine
LEM
LUA m achine
LUA
script
Python
Python
Pyt hon
script
nodeJS
nodeJS
Java
Script
Database
Database
REST-
Server
REST-
Server
HTTP,
JSON
Figure4.1.Internal structure
The scripts may run in parallel to each other and send enquiries to the Modbus server.
The necessary Modbus libraries are preinstalled for the respective languages. Processes
that, for instance, check on threshold values or intervene in a regulating manner
without external assistance, that is, without additional logic from outside, can be realised
completely in the ipCore itself. Nonetheless, the entire hardware connected is also
available to the outside via a REST interface. The system gains full flexibility through the
connection between script and database and between database and the REST server. In
this way, it is possible to transmit user-defined keys whose meaning is defined by a script,
to an external front end. Even more complex control instructions that require changes to
several Modbus modules or that are to effect state changes to the standard script, can
thus be given efficiently with just one HTTP access.