【溫馨提示】壓縮包內(nèi)含CAD圖有下方大圖片預(yù)覽,下拉即可直觀呈現(xiàn)眼前查看、盡收眼底縱觀。打包內(nèi)容里dwg后綴的文件為CAD圖,可編輯,無水印,高清圖,壓縮包內(nèi)文檔可直接點開預(yù)覽,需要原稿請自助充值下載,所見才能所得,請見壓縮包內(nèi)的文件及下方預(yù)覽,請細(xì)心查看有疑問可以咨詢QQ:11970985或197216396
Available online at www.sciencedirect.com
Procedia Engineering 15 (2011) 1234 – 1238
Advanced in Control Engineeringand Information Science
The Study of Soft PLC Running System
Quan Liang*a, Li Lia
aSchool of Mechanical Engineering, Shenyang University of Technology, Shenyang 110870, China
Abstract
PC-based automatic control system is low cost, open good, easy to use, etc., so it becomes a new direction in the automation technology. The formulation of international standards EIC61131-3 not only normalizes the field of industrial control programming language, but also provides the conditions for the development of PLC technology. This paper introduces the theory of soft PLC, discusses the PLC software models and implementations based on the EIC61131-3 standard, detailed describes the principle and implementation of soft PLC operating system programs, designs soft PLC running system software based on industrial PC, constructs soft logic control system based on industrial PC. Finally, the real-time performance and reliability of the soft PLC were verified. The results show that the system is reliable and control effect is good.
? 2011 Published by Elsevier Ltd. Open access under CC BY-NC-ND license.
Selection and/or peer-review under responsibility of [CEIS 2011]
Keywords: soft PLC; running system; virtual machine; instruction system; IEC61131-3
1. Introduction
Soft PLC technology is a new type of control technology based on PC, compared with the traditional PLC, which has an open architecture, powerful network communications capability and increased data processing capability, can meet the requirements of modern industrial automation, is a hot spot in the field of industrial automation at present[1,2].
The so called soft PLC, is to use a PC as the hardware support platform, use software to achieve the basic function of traditional PLC. PLC control functions are encapsulated in the software, running on the PC environment..
This control system provides a PLC control system of the same features, but with the advantages of the PC’s. According to the traditional structure of PLC, The achievement of soft PLC is divided into two parts, the development system and running system. Soft PLC running system is the core of the soft PLC,
* Corresponding author. Tel.:+8618940287990 E-mail address: liangquan6@126.com
1877-7058 ? 2011 Published by Elsevier Ltd. Open access under CC BY-NC-ND license.
doi:10.1016/j.proeng.2011.08.228
Quan Liang and Li Li / Procedia Engineering 15 (2011) 1234 – 1238
1237
executes the program and processes the input and output.
This paper describes the characteristics of the traditional PLC and developing trends, and describes the architecture of the soft PLC, the software model. Further, according to international standard IEC61131-3 and with reference to Siemens S7-200 instruction set, the instruction set of soft PLC running system is designed. Then, the architecture of soft PLC running system is introduced, the whole operating system was tested. The test functions show that the function of the system reached the expected requirement and running well.
2. Several realization scheme of soft PLC
At present, there are three kinds of scheme for soft PLC control system[3-6]. One is the traditional PLC control system. This scheme makes the PLC hardware as the hardware platform, and customizes PLC running system for its hardware, then solidify it in the PLC. The disadvantage of this control program is that the running system is customized for certain PLC manufacture, system maintenance and upgrades are difficult, and not open. The second control scheme is based on embedded controller. Embedded controller is a super-small computer system, its software platform is the embedded operating system. This control scheme is more suitable in a small real-time controller. The last one is a control scheme based on industrial PC(IPC). In this control scheme, the system’s software platform can be used WindowsNT and other real-time operating systems[7-9], the hardware interfaces using a common I/O card or I/O terminal board(or filed bus cards, and remote I/O module)[10]. Soft PLC which based on industrial PC control system can take full advantage of PC-rich software and hardware resources, easy to build bus control system and network control systems. This article will study the soft PLC which based on industrial PC operating system.
3. Soft PLC realization method based on IEC61131-3 standard
IEC61131-3 standard is the first international standard which provides standardized programming language for the software design of the industrial automation and control system. IEC61131-3 standard is based on the working of IEC work group which absorbs and references worldwide manufacturers of the PLC programming language and forming a new international programming languages. The software model which based on IEC61131-3 standard is shown below.
task
task
configuration
function block
function block
resources task
resources task
programm
programm
programm
programm
function block
function block
access path
Fig. 2. Software module based on IEC61131-3 standard
The collocation of the PLC software model and different hardware, many kinds of actual control system can be build. In the design of application software, the programming design which based on IEC61131-3 standard follows the principles of software modular, which divides a complex project into several independent modules, every module divides commonly used procedures into several functional units, which is program, functional block and function, encapsulates these unites and constructs the base of programming.
4. Realization of Soft PLC System Virtual Machine
Soft PLC running system is the core of the whole soft PLC system, which takes charge of the administration of whole system, interprets the program, and exchange data with programming system. The construction of soft PLC running system is divided into three parts, which is: communication module, running core module and I/O driver module. The scheme figure of the whole construction is shown figure 3.
The core of the running system is soft PLC running virtual machine, which interprets, organizes and executes the application programming. This paper mainly introduces the realization of soft PLC running system virtual machine.
4.1. Operating principle and construction of virtual machine
The essence of virtual machine is similar to the hardware of computer’s CPU, the kernel function is repeatedly getting value, interpreting codes and executing process, only for soft PLC, these functions are finished by software[11]. The realization of these functions is divided into two ways: one is based on register, the advantage of this method is fast instructions executing velocity, transparent process and easy to debug; the other is based on stack, which is suitable sustain small program, occupy few internal memory, and quickly call functions. Because the shortcut of the stack in calling functions, this scheme is adopted by this paper as designing virtual machine.
The function module of virtual machine includes: instruction reading sub module, instruction analyzing sub module, logic instruction sub module, function operating instruction sub module, etc.
4.2. Formulation of target code
target code
relate to operating system
virtual machine
relate to operating system
operating system
hardware
Fig.4. The relation among target code, virtual machine and operating system
Target code is the code which running in virtual machine. In the soft PLC which studied in this paper, target is a kind of binary code, which is compiled in soft PLC developing systems, and finishing control function by executing in soft PLC running virtual machine system. The relation of target code, virtual machine and operating system are shown in figure3.
Combining IEC61131-3 standard, one PLC project’s structure levels can be divided into: configuration, resources, task and runtime program, etc. In the Soft PLC which realized in this paper, one
configuration correspond one plc system, every configuration can has several resources, the concept of task is described in resources. The whole system is as multithreading program, and executing several control task at the same time.
The format of target code is: the file which produced in developing system is a kind of form file, which can describe various kinds configurations in system, compiler can also produce control algorithm which running a virtual machine.
4.3. Instruction system of virtual machine
The virtual instruction which developed in this paper includes 19 fundamental instructions, 4 function instructions and 3 program control instruction. The fundamental instruction includes:LD, AND, OR, OUT, LDN, ANDN, ORN, LDI, ORI, ANDI, OUTI, LDNI, ORNI, NOT, SET, CLEAR, ALD, OLD;
function instruction includes: TON, TONR, TOF, COUNT; control instruction includes: SUBCALL, RETURN, END.
4.4. The software design of virtual machine
Virtual machine is a kind of imagination computer, which realized in actual processor through software technology. The main function of virtual machine is due to its feature which can run describing language of certain rule. One important character of virtual machine is that it adds a hardware abstract level between computer hardware and software, when transplant virtual machine into other operating system platform, the application programs of it are not need to change.
According the design idea of software assembly, the whole PLC system can be divided into several modules which have several independent function software module, the normative interface is defined among modules, the compose of each software module is shown in below figure.
developing system
IEC61131-3 editor and debuger
read variable
level of interface communicatinod
intermediate code
interface communication level
virtual machine
IEC61131-3 editor and compiler
target code running system
COM/DCOM interface
OPC server
I/O communication interface
standard OPC interface
I/O sub system
I/O sub system
Fig. 5. Block diagram of soft PLC software module
Common PC is selected as the hardware platform of whole control system, software platform is
WindowsXP+RTX8.0, universal I/O cards are adopted as input-output module, other cards can also be adopted for processing analog or digital signal, the card which used in this system is PCI-1710 card which manufactured by Advantech.
The following briefly describe the main function of the virtual machine. The first is the VM_Init() function which is used to initialize system, its main function is used to initialize the register of virtual machine, construct artificial address space, read intermediate codes into this artificial address space, and set initial value for stack pointer, program pointer, empty timer and counter, etc. The second is function VM_Check() which is used to verify target code, its main function is used to verify the correctness of target code which is read into memory. The last is VM_Main() which is the main function of VM_Main(), its function is used to execute the target code. Virtual machine executes instruction from the first instruction of intermediate code file form, until handle the End instruction, then, virtual machine finishes a program executing phase of one scanning circulate.
5. Testing of soft PLC running system
For roundly and objectively evaluating the performance of soft PLC, you need to fully test the whole running system. The test of virtual machine is the main test, which includes the real-time, veracity and reliability of virtual machine.
To verify the real-time of virtual machine, we tested 2000 logic instruction using oscilloscope and the time function which provided by system, according the flicker time of indicator light and electrical level changing of oscilloscope to test the executing time of this program[12]. After testing, the time which is used to executed 2000 logic instruction is 500 microsecond, while common PLC’s scan time is scores of millisecond. So virtual machine achieve the design goal in real-time. To verify the reliability of virtual machine, we run this system in long time, the system working reliably, and can reach the reliability requirement of industrial sites.
References
[1] J. Borges. PC vs PLC for machine and process control. Real-time Magazine, 1997;4; 71-72
[2] Namie, Masaki. Application of PLC for PA and future evolution of PLC based process controller. Japan Technical Assoc of the Pulp and Paper Industry, Japan 2006;37-43
[3] Martin S. OPC standard-basic principles and advantage. Automation Magazien, 2000;3;25-29
[4] IEC61131-3 Programmable controller-part3: programming languages, International Electrotechnieal Commission, 1993
[5] Williams, D. IEC61131-3-A system integrator’s view. 1999;8;1-3
[6] Agustinm Rullan, Ph.D. Programmable logic controllers versus personal computers for process control.
Computers&Industrial Engineer, 1997;33;421-424
[7] Stephen Pouter. Windows NT real-time extensions as used in industrial automation. Real-Time Magazine, 1995;5;55-58
[8] Martin Timmerman. Windows NT real-time extension better or worse. Real-time Magazien, 1998;3;67-71
[9] RTX-8.0 User’s Guide. VenturCom, 2008
[10] Advantech Co., Ltd. PCI-1710 User’s Manual. Taiwan, 2000
[11] Wang Yifei, Li Xining, Compiling prolog to logic virtual machine. IEEE, Piscataway, NJ, USA, 1998;1;317-20
[12] Hassapis, George. Soft-testing of industrial control systems programmed in IEC61131-3 languages. Elsevier Science Ltd, Research Triangle Park. USA, 2000;345-355