Setting up emtrion's hardware using as PLC (Programmable Logic Controller)
In general most of emtrion’s hardware comes with interfaces like Ethernet, RS232, CAN, GPIOs, I2C, SPI. In addition, the used CPU modules are supported by a powerful microprocessor.
Such preconditions are predestinated in controlling industrial systems. In many cases, programming in this environment is based on the widely-known standard IEC 61131-3.
If you consider these items, the question to ask is, are there any reason why you are not using emtrion's hardware as PLC. Not really. On the one hand it's dependent on the use case and its requirements such as real-time, certification etc. and the other hand on the effort needed to transform it to a PLC.
Transforming is an independent part of the use case and means to make an emtrion hardware a PLC. The transformation is limited by adding a piece of software, the so called RTS (runtime system) to the RFS (root filesystem).
The RTS we used, it is possible to make a PLC in less than one work day.
Following the proceeding steps are described.
Picking up the hardware is dependent on the architecture the RTS was being built for. In our case a free demo version is available for the architecture ARMv7. So you can use either our SBC-SAMA5D36 or the DIMM-AM335x.
Board Support Package
Each of the above-named hardware is supported by a BSP based on Yocto dizzy version 1.7.2. The provided RFS has to be expanded in two positions. First, the RTS has to be integrated. Second, while the RTS uses authentication, supporting of libssl is necessary too.
We used the software package logi.CAD 3 compact from the company logi.cals to succeed our plan. logi.cals is a provider of software tools for industrial automation. The package includes the RTS "logi.RTS" and the programming system "logi.CAD 3 compact".
logi.RTS is available for different platforms and must be licensed. If not, you can run logi.RTS as full version for 1 hour. logi.RTS supports multi-tasking, multi- resourcing(several control applications run at one CPU) and includes a webSERVER.
The package logi.CAD 3 compact includes several archives of logi.RTS. Due to the required CPU architecture ARMv7 we are using the raspbian archive. To install this archive, the preferred practice is to take a RFS from the corresponding BSP above and share it by NFS. The RFS needs an extra directory /opt/RTS where the archive has to be unpacked to. After unpacking, be sure the files have the attribute executable.Due to the RTS uses authentication, libssl is required. libssl can be added to the RFS by two methods.
- Manually by the libssl binary package, available at emtrion.
- Customizing of the recipe emtrion-devkit-image.bbappend of the corresponding BSP Yocto-Layer and building a new RFS.
You can start logi.RTS either manually or automatically.
- Manually --> Perform a netboot on the target system. Using the serial console to change to the directory /opt/RTS/bin and type ./startPLC &. Press enter a second time to get the scope of the console visible again
- Automatically --> If you want to start logi.RTS at system start, you have to create an init start script first. Then locate the script in the directory/etc/rcS.d/ of the RFS. An example is described in the documentation of logi.CAD3. In addition the name of the start script has to be prefixed by a start number Sxy. The same you can do for starting the webSERVER. Then perform a netboot on the target system.
logi.CAD 3 compact
The programming system needs a Windows host running Windwos 7 or Windows 8.1 and later. There is a 32bit and 64bit version available. The programming system doesn't require a license. You can create applications in the language ST, based on IEC 61131-3. Further you can download the application to the target, starting, stopping, debugging, watching variables and something more. A professional version "logi.CAD 3" is available too, but needs a license. This version has some more features like SFC, FBD, integrating of C-code into the application and more.
Installing logi.CAD 3 compact
Installing of logi.CAD 3 compact is done by unpacking of the corresponding windows archive. After this step you can start it by performing of the executable logi.CAD3.exe. From that point you are ready for writing an I/O independent application.
Assuming, both the target system and host are connected to the network. The remote channel of the PLC-Object of the application has to be set up with the IP address of the target.
It is supported by the product webSERVER of logi.cals and 3rd party software.
Logi.CAD 3 provides function blocks which support a subset of linux system calls. Based on these functions you can access I/O drivers. An example how you can access the I2C interface is available. Writing function blocks by yourself accessing other I/O interfaces is also possible, but requires some knowledge.
It depends on the features used by the logi.cals product.
Making a hardware a PLC is not so a time-consuming process. With a piece of software and a suitable hardware you can start your project. Within one work day you are ready to program your first application based on IEC 61131-3. Moreover, you are able to download, start, stop and test your application and watching variables.
In addition, you will be familiar with the programming system and getting knowledge about the provided libraries, programming features like function blocks, tasks and resources designing your application.