OpenSCADAWiki: Home Page En/Using/PLC ...

Home | Index | Changes | Comments | Users | Registration | Login  Password:  
 

OpenSCADA into programmable logic controller (PLC)

Name: PLC
Founded: October 2008
Version: 0.5.0
Status: GPL
Members: Roman Savochenko
Translator: Maxim Lysenko
Description: The project is devoted to the creation of: runtime if the PLC, the PLC firmware and hardware configurations of the specialized PLC's.


Contents

1. Introduction

Modern system of automatic process control (APCS) are quite complex. Conventionally, the hierarchy of PCS can be divided into two levels: the lower and upper level. The lower level of PCS contains the field equipment (sensors and actuators), as well as programmable logic controllers (PLC). The upper level consists of the system of operational visualization and monitoring of the process, SCADA system. PLC is the responsible part of the APCS, which performs the function of the data acquisition from the field equipment, calculation and making the regulatory, blocking and other effects on the regulating parts of field equipment.


OpenSCADA is an open implementation of the SCADA system, which is based on the modular architecture that allows to build the ultimate solutions for different requirements. The purpose of OpenSCADA are the systems of upper level, but the high degree of modularity and scalability allows to solve the wide range of tasks of the adjacent areas.

2. Industrial programmable logic controllers

PLC market is saturated with wide range of products with different architecture and design. Architectural PLC can be divided into three groups:


Hard-programmable PLC are typically based on single-crystal microcomputer or chips of programmable logic. The program of such controllers is flashed one-time, enabling the software of parameterization, or formed with the specialized environment endowed with functions of binary firmware compilation of the runtime with the user program, such as ISaGRAF and LabView. As an example of such PLC can be the modules of distributed PCI of Advantech company.


Highly intellectual commercial PLC typically are based on more powerful hardware architecture and are close to full-fledged PC-computer. The main difference from standard PC-compatible PLC is the closed software, and often the hardware architecture. The program software of such controllers is usually based on real time operating system, which is planning several user threads with separation of their priorities. User programming of these PLC is made working in the corporate software which forms, as a result, the binary code of the PLC thread. As an example of such device it can be the PLC of S7 series of Siemens company.


PC-compatible PLC is not the group of the PLC directly compatible with PC, but the PLC which don't have the integrated runtime and which are often delivered without an operating system. Architecture of the such PLC may be different, ranging from cost-effective solutions and ending with the x86 architecture decisions ARM and MIPS. The runtime of the such PLC is usually formed from the software of the same with the hard-programmable PLC class, the result of which is an executable binary file into one of the most common, scalable, or specialized operating system (DOS, QNX, Linux, WinCE, VxWorks). Frequently the specialized solutions for the problem can be met. As an example of this class it can be the PLC of PC/104 form factor.


Variants of constructive execution of the PLC can be divided into monoblock and modular. Monoblock PLC provides the fixed configuration of the CPI, specialized for the limited range of tasks. Modular design provides an easy extension of configuration of CPI for the appropriate task. There are also the hybrid design which is the monoblock, able to expand its CPI by external CPI blocks connected to one of the standard interfaces such as RS-485.

3. OpenSCADA as runtime of the PLC

System architecture of the OpenSCADA allows you to create the final decisions under various requirements and resources through the modular expansion. This feature is useful in the light of resource constraints of PLC. Moreover, given the constant development of hardware, as well as continuous improvement of integration and efficiency of modern microprocessor solutions, OpenSCADA can consistently extend the functionality of the PLC, while maintaining the continuity with the old solutions. For example, on the basis of the OpenSCADA system can be built the solutions with minimal requirements on the level: CPU 100 MHz, memory and flash ROM of 30 MB.


As noted above, the resources of modern PLCs can fluctuate in quite a large range, and the PLC of fixed type, built on single-chip microcomputer further and further forced out into the narrowly specialized fields with the advanced PC-architectures. This trend makes increasingly interesting the possibility of creating the unified open platform for the implementation of the PLC runtime based on unified PC-platforms.


OpenSCADA allows the realization of the idea of creating an open platform for the implementation of the runtime of PLC. Already, on the basis of version 0.6.2, you can make the PLC's runtime slightly inferior to the commercial intellectual controllers, and in many respects superior to them, due to the possibility of integration of functions specific to SCADA systems into the runtime of the PLC, enhancing the functionality and user characteristics of the PLC and leading him to unified with SCADA code base, as well as optimizing the cost of the final solution.


Here are the functions which are solved by OpenSCADA within the runtime of PLC:


4. PLC firmware

The following requirements were pulled out to the implementation of the PLC firmware:


Given the above requirements, for the creation of the firmware it was chosen the package's repository of the distributive of OS Linux ALTLinux and the tool for creating the distributions mkimage. mkimage is the tool for building Sisyphus-based system on the basis of the template. As an initial set of templates it was used the set of templates of formation of ALTLinux distributions at git://git.altlinux.org/people/boyarsh/packages/mkimage-profiles-desktop by the command:

As the basis it was taken the "rescue" template, as the most compact and close to the target PLC.

4.1. Creation

Firstly it was created the configuration of PLC without local display in mind of the availability of this type of equipment and lack of equipment for the Touch-panels.


New PLC template was named "plc", it was tested on the boards of PC/104 form factor MOPSlcdLX of Kontron company, ATH400-128 of Diamond Systems company and modular PLC LP-8781 of the ICP DAS company. The archive of the resulting mkimage tree with "plc" template can be downloaded here ftp://ftp.oscada.org/OpenSCADA/PLC (templates and materials of individual controllers are placed in their own directories).


The key features of the configuration of new template was the writing of the new init script (rc.sysinit), the script of the after installation configuration of the firmware's image and the list of packages in the image of firmware.The first script is designed as the package "startup-plc". The second script is embedded in the template "plc" on the way: profiles/pls/image-scripts.d/01system. The list of packages is embedded in the template "plc" on the way: profiles/pkg/lists/plñ.in .


The procedure of creating the firmware from the image is the following:


The result is an output directory in the profiles/out/ of the type:

4.2. Installation

It is possible to download the firmware to: USB-flash, IDE-flash and HDD. However, in the case of the USB-flash there is the problem with waiting for initialization of USB-subsystem and you'll have to pass some dialogues.


The file system can be fat or ext2/ext3. In the case of ext3 the root is mounted as in ext2, again because of problems in the initializer. In the case of ext2/ext3 you'll need to use not the syslinux boot, but extlinux, the configuration of which, incidentally, is almost the same one.


Next, lets mount the medium and place the files from the output directory on it as follows.
In the case with fat and syslinux:

In the case with ext2/ext3 and extlinux:


To ensure the reliable operation of the operating data stored in the file "work" with the file system ext3. The file system of this file is checked for integrity at the initialization. This file file is created as follows:


In the case of the file system ext2/ext3 on the target disk the "work" file may not be created. In this case, the working data will be placed in the directory root of the target disk. Warning. This is an unreliable solution because the root file system of the target disk is not static and its check is not possible, because of earlier mounting in the "ro" and the potential unreliability of the check of the file system, mounted at "ro", as well as because of the inability to remount as ext3.


The next step is the configuration and initialization of the loader. To configure the loader it is necessary to edit the file syslinux/syslinux.cfg or extlinux/extlinux.conf as follows:


In the case of selection the identification of the bootable partition by the identifier you can get the ID of our partition with the command: blkid.


In the case of the label it is a bit harder, since it needs to be set, and this is done for different file systems in different ways.


For the file systems ext2/ext3 it is done by the utility e2label. For example: e2label /dev/sdb1 PLC


For the FAT file system it is done by the set of utilities that come with mtools as follows:


Now we can initialize the loader:


That is all with the boot and initialization of firmware. If the resulting disc is not loaded:

4.3. Result

The result is the firmware with the size from 30Mb to 100Mb, satisfying all stated requirements and it provides:

4.4. OpenSCADA

As the PLC runtime system the OpenSCADA is used. For this case we'll take the building with separate packages for each module and indicate to install the virtual package openscada-plc, which contains all the dependences on all the OpenSCADA packages, needed for this configuration. The package of gd2 graphics library has been rebuilt without the support of xpm graphic file format and library was called libgd2-noxpm. All this was done in order to avoid the heavy dependencies on the libraries of GUI XOrg.


The result is the runtime of the PLC with support:


The current configuration of OpenSCADA runs in demon mode in locale uk_UA.UTF-8 using the local database SQLite, providing the following default network services:

4.5. Implementation details

In this section we'll examine the details of the OS tree of the firmware, the initialization script rc.sysinit.plc and the script of preparation of the OS tree of firmware.


To build the PLC firmware it was used the following list of packages:


List of the modules of the loader's system kernel with the purpose to reduce the initialization image size was reduced to the following one:


To the script of tree preparation there were added the following functions:


Initialization script (rc.sysinit.plc) was provided with the following functions:


As the result of these action the mount table of the resulting PLC tree looks like:

4.6. Customizing the GUI

One option of the firmware is built with a graphical interface, which, however, necessary to configure for automatic startup with the visualization area of OpenSCADA. In addition, it should be noted that the firmware with a graphical interface does not contain all the drivers and you may have to rebuild it under the right equipment.


After downloading and logging to the console it is necessary to configure the XServer, automatic graphical login, start of the graphical environment and automatic startup of OpenSCADA from the IceWM environment:


5. PLC solutions

This section contains information about the PLC models actually built or planned to be so on the basis of the developed runtime and PLC firmware.


PLC components Price, $ Notes
CPU: Kontron MOPSlcdLX 430 AMDGeodeLX800(i686)-500MHz, 0°-60°C, 5W, Video
CPU: Diamond ATHM500-256A 1275(1160) VIA Mark(i686)-500MHz, 256Mb, -40°-85°C, 10W, Video, 16AI, 4AO, 24DIO
CPU: Diamond ATHM500-256N 889(807) VIA Mark(i686)-500MHz, 256Mb, -40°-85°C, 10W, Video
CPU: Rhodeus ? AMDGeodeLX800(i686)-500MHz, -20°-70°C, 5W, Video
CPU: Tri-M VSX104 380 Vortex x86SX(i486sx)-300MHz, 128Mb, -40°-85°C, 2W, not tested
MEM: DDR-SODIM-256M 15 for Kontron MOPSlcdLX
Flash Disk: Kontron chipDISK/1000-IDE 100 1Gb, 0°-70°C
Flash Disk: M-Systems MD1171-D1024 42 1Gb, 0°-70°C
Flash Disk: M-Systems MD1171-D256 22 256Mb, 0°-70°C
Flash Disk: M-Systems MD1171-D128 18 128Mb, 0°-70°C
Flash Disk: Diamond systems FD-128-XT ? 128Mb, -40°-85°C
Flash Disk: Diamond systems FD-1G-XT ? 128Mb, -40°-85°C
Box: PB-300-K 118(96)
Box: PB-EAP-300-K 275(248)
Box: CT-4 171(162)
Power unit: MMEANWELL DR-4505 30
IO: DMM-16-AT (16AI, 4AO, 16DIO) 744(597) -40°-85°C
IO: DMM-32X-AT (32AI, 4AO, 24DIO) 883(742) -40°-85°C
RS485: EMM-OPT4-XT 396(376) -40°-85°C
ICP DAS LP-8x81
CPU: LP-8781 945
IO: I-8017HW (8AI DE, 16AI SI) 215 Parallel bus, acquisition up to the 30 kHz
IO: I-87019RW (8AI) 205 Additional surge protection, support for thermocouples and resistance thermometers.
IO: I-87024W (4AO) 210 Output of current and voltage.
IO: I-8042W (16DI + 16DO) 125 Parallel bus

6. Links


Referring pages: HomePageEn/Using/Irkutsk
HomePageEn/Using/LP8x81
HomePageEn/Using/PLC


 
There are no files on this page.[Display files/form]
There is no comment on this page. [Display comments/form]