PLC programming with logi.CAD 3

Being a frequent reader of our Newsletter you already know that Revolution Pi enables you to use logi.CAD 3 as IEC 61131-3 compliant editor for PLC programming. Such programs are executed by the runtime system logi.RTS which is part of RevPi Core software.
Here are some facts about logi.CAD 3

  • Runs on Windows, Linux and Mac OS
  • No installation necessary
  • State-of-the-Art ST-Editor
  • Plain text format for project files
  • Simple integration of C and C++ Code
  • Ready for cross platform communication using MQTT (“Industry 4.0”)
  • Expandable by plug-ins (FBD-Editor, central source code administration,…)

Basic Concept of logi.CAD 3

logi.CAD 3 is an Eclipse based IEC 61131-3 PLC programming tool which is independent from hardware manufacturers and runs on any system from 8 bit microcontrollers up to multicore PLCs. It comes with a project template for Revolution Pi which does contain the initial configuration for a RevPi Core. Any connected in- and output lines are defined using our configuration tool “PiCtory” and saved in a configuration file for logi.CAD 3. Therefore you can simply use symbolic names for any in- or Output in logi.CAD 3. The SCL (ST) editor is free of charge and you only need to buy a logi.RTS license key for 20 € (single task version) or 40 € (multi task version) in our online shop.

There will also be a professional version with graphical FBD editor available in our shop (price TBA).

Creating an application

With the basic editor version you will have SCL (Structured Control Langues, aka “ST”, “Structured Text”) as language to create your PLC program. This tool can be downloaded free of charge from our Revolution Pi platform starting in November. If you don’t want to wait just go to the manufacturers site www.logicad3.com for a free download

Maybe it’s a good idea to download it now – the following explanations will be much easier to follow…

After downloading you need to unpack logi.CAD 3 into a local folder and just start it without installation by clicking on logiCAD3.exe. Choose any workspace for the project files and use the project wizard for starting the Revolution Pi template. Next step is to create your specific application using the SCL editor. “Content Assist” (Ctrl + space) will show you context sensitive proposals for any valid constructs, commands, function calls and variables. There are several useful short cuts with which you can easily insert code snippets. E. g. inserting a local variable can be done by pressing Ctrl + space and then entering “vl”. The inserted code snippet can be completed just like a form.

Code Snippet Screenshot

You can of course create your own code snippets. There is a continuous real time error check which enhances your code engineering by immediately marking any syntax errors. A “local history” function does protocol every code change and saves them for revision-safe archiving.

A function called “rename element” allows you to easily change the names of variables or functions throughout the whole project.

Are you a power user? Then you might be excited to hear that you may write your own C or C++ modules to realize any low level system function. Simply create an object “ST-interface” for your project and put {extern c} or {extern cxx} in its code together with the module’s interface. Saving this object will generate a C-file in which you may insert your specific C/C++ code.
Watch following video demonstrating C-code integration: https://youtu.be/dJ7K5Kuk69w
You may find further information in the comprehensive online help: http://help.logicals.com

Testing your application

Using application or online test you can debug your application. Without a RevPi Core connected you can only do this with “offline simulation”. You can switch the editor’s view into “application test” to use the editor’s GUI as testing tool. There is a possibility for saving and recalling several individual views.

The instance tree view shows the integrated local test system (offline simulation) and the runtime system of Revolution Pi (online test). After choosing the controller platform (when using online test you might need to change the IP address listed in the Revolution Pi configuration file) you need to click the function “connect to PLC” and transfer the application to the PLC using “load application”. Without RevPi Core the only way is to simulate the PLC using the “test system” instance. By the way – C code generation is already done during SCL programming while saving your program. You can drag and drop any variable into the list of variable values to watch its current live value or change its value to influence program behavior.

variable values Screenshot

Connectivity

You can not only use data from modules connected by PiBridge when programming with logi.CAD 3 but also data from any self-made interface. The only requirement in order to treat your interface as an “adapter” is to load its “RAP” file (RevPi Adapter Profile) into our configuration tool PiCtory before exporting the ST configuration file for logi.CAD. And of course you need to write a driver which cyclically exchanges data between your interface and the central process image (we provide simple function calls for this task).

There is a possibility to exchange data using Modbus TCP with logi.RTS. logi.cals has developed a library (“logi.library”) which provides all necessary functions to set up a Modbus TCP connectivity to any Modbus device which can by connected via LAN. But this option does only support logi.RTS as data consumer/producer. If any other driver or application apart from logi.RTS shall share this data we would advise you to use the Modbus driver provided by Revolution Pi which does exchange its data via the central process image and thus shares it with any other application using this process image.

There is also a possibility to push or pull data from the controller level to any higher process level (like SCADA). Just use the MQTT functions of the logi.library. You need to build up a connection to the MQTT broker using “MQTT Connect”. For reading or writing data to this broker just use “MQTT Publish” or “MQTT Receive”.

Libraries MQTT Screenshot

Runtime system logi.RTS

Revolution Pi uses a highly efficient and portable runtime system from logi.cals called “logi.RTS”. There is absolutely no limitation like number of blocks or number of IOs. Depending on the program size you can freely define cycle times down to 1 ms. Be aware that you cannot overall reach such cycle times when using PiBridge devices and our central driver PiControl because logi.RTS will synchronize to this driver which offers cycle times typically like 5 to 10 ms (depends on number and type of IO data). logi.RTS has a modular architecture which allows you as an expert programmer to set up self-written system services which can be accessed by your PLC (SCL) program.

Extension possibilities

logi.CAD 3 is ready for future. You will have possibilities for future extension plug-ins from logi.cals. E.g. in spring 2017 there will be a light edition of the graphical FBD editor as plug-in module. We will inform you when things get ready. And you can get an SDK for the runtime system to develop and integrate self-written system services.