0% found this document useful (0 votes)
18 views4 pages

2013 The Design and Implementation of Virtual Machine System in Embedded SoftPLC System

Uploaded by

Yanshi Dong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
18 views4 pages

2013 The Design and Implementation of Virtual Machine System in Embedded SoftPLC System

Uploaded by

Yanshi Dong
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

2013 International Conference on Computer Sciences and Applications

The Design and Implementation of Virtual Machine


System in Embedded SoftPLC System

Minghui Zhang,Yanxia Lu, Tianjiao Xia


Department of Information Technology and Business Management
Dalian Neusoft Institute of Information
Dalian,China
Email:[email protected]

Abstract-Embedded SoftPLC is a new high technology in  It provides powerful and flexible means of
industrial control area, which gets over the defects of connection to network. Information can be shared
traditional PLC and has come to general attention in this area. easily among systems.
Virtual machine system is the kernel of embedded SoftPLC  Industry of embedded system develops rapidly,
system. This article narrates carefully the design and customer can get product with high Q/P
implementation of virtual machine system with the example of (quality/price).
an embedded SoftPLC system product--ESDDC. The virtual
machine designed in this paper will put forward a new plan of  The instruction system of Embedded SoftPLC
SoftPLC programming , and at the same time it also provides a system can be easily extended.
new thinking of software design for software developers.
 The volume of Embedded SoftPLC system is much
Keywords: Virtual Machine, Embedded SoftPLC, ESDDC less than traditional PLC, so it can be easily
integrated into other equipments.
I. INTRODUCTION Presently, many Embedded SoftPLC products have been
Due to the advantages of high reliability, strong anti- put into industry automation area successfully in foreign
interference ability, specialty and modularization. the countries[2]. While in China embedded SoftPLC technology
programmable logic controller(PLC) has been widely used in still has a long way to go.
Industrial control field and other industries, such as home B. Framework of Embedded SoftPLC System
appliance industry. While because of the higher prices , poor
versatility and compatibility and weak ability of information The framework of embedded SoftPLC system is
sharing, development of PL.On the other hand the demand introduced with ESDDC--an embedded SoftPLC system,
for PLC in industrial control field and a variety of embedded which is mainly used in building control automation area. It
devices is growing rapidly. is constituted of two parts: development system(or
IDE:integrated development environment) and Running
In recent years, with the rapid development of computer system (or virtual machine). Fig.1 shows the framework of
science and embedded technology and the establishment of ESDDC.
international standard--IEC61131 on PLC, Embedded
SoftPLC emerged as a new high technology.

II. RESEARCH OF EMBEDDED SOFTPLC SYSTEM

A.Introduction of Embedded SoftPLC System Via Modbus Protocol


Embedded SoftPLC system realizes the basic functions
of traditional PLC with software and runs in embedded
system environment. And so it possesses the same function
as PLC while gets all the advantages of embedded system
product. Embedded SoftPLC control simplifies the
framework of Factory Automation[1] It combines the
controller, communication, HMI and all the other specific Fig.1 The framework of ESDDC
applications and runs on a hardware platform. It has many As is shown in Fig.1, development system is on the top
advantages over traditional PLC: of ESDDC, so we call it the upper machine. At the same
 It owns an open framework, and so customers are time we call the running system as the lower machine.
provided with more choices for choosing products of
different manufacturers.

978-0-7695-5125-8/13 $26.00 © 2013 IEEE 775


DOI 10.1109/CSA.2013.185
Authorized licensed use limited to: Tsinghua University. Downloaded on January 18,2025 at 15:21:55 UTC from IEEE Xplore. Restrictions apply.
The aim of the upper machine is to provide the user a appropriately so as to download object code or debug
application environment that can write a program and a application program.
simulation test tool that can test whether program is correct
or not. To communicate with IDE to allow IDE to get running
data, system state and edition information of virtual machine
As well as Visual Studio series development tools, based system.
on Windows system, the development system includes
Editor, Complier, Linker, Debugger and Communication To supervise field I/O modules via ModBus protocol.
interface. The following picture depicts this.
A.Framework and Implementation of Virtual Machine
System
The virtual machine system is constituted of four parts:
running kernel, system management module, I/O
communication module and slave communication module.
Fig2 is the framework of virtual machine system.

Fig. 2 The scheme of development system

User can write the program in Editor ,and then compile


the program in the Compiler in order to find the error of this
program. If there is no error ,the object code will be created
in the Linker. The object code can be debugged in debugger
environment. After this code is confirmed ,it will be
download to the running system by communication interface .
Fig. 3. The framework of the virtual machine system
The aim of lower machine (running system) is to execute
the object code produced by development and finally achieve 1) Running Kernel of Virtual Machine System.
the goal of control.The running platform for IDE is PC that The running kernel is constituted of clock management
is equipped with Windows 2003. IDE supports three module, scheduling module and interpreter. It is responsible
programming languages which are defined in IEC61131-3: for scheduling and executing task, interrupting and resuming
FBD,ST and LD [3]. In effect, IDE provides users with an task, scanning of I/O equipments and offering debugging
environment to write application program. Moreover, support. It is the central part of the virtual machine system[5].
debugging and emulating tools are included to help user To some extent, the function of interpreter is like CPU while
verify the correctness of his program. IDE is constituted of the other parts are like OS.
five parts: editor, compiler, linker, debugger and a) Scheduling Task and Clock Management.
communication interface. Scheduling module is responsible for task scheduling. It
The Virtual machine system is running on an embedded works according to task PRI and task state. In order to
ARM board that is equipped with uCLinux—an embedded improve the real time performance, scheduling module
OS. It can interpret and execute application program that is adopts priority-based preemptive policy [6]. In ESDDC,
developed with IDE to supervise the field I/O equipments. It periodic task is set low PRI while time one with high PRI.
is constituted of three parts: communication interface to IDE, The scheduling module is located in an independent
running kernel and I/O interface[4]. process. When working, it chooses the task with the highest
Modbus is chosen to be the communication protocol of PRI from the ready queue that stores the tasks with ready
the two communication pairs. state. If there are several tasks with same PRI, it will choose
the one whose waiting time is the longest.
III. DESIGN AND IMPLEMENTATION OF VIRTUAL Clock management module alters the PRI of task
MACHINE SYSTEM according to task state and how long the task exists so as to
The virtual machine system is responsible for execution, interrupt the low PRI task and enforce the high PRI task. For
administration, control and debugging program. It is the PRI is relatively high, time task can get much more
kernel of ESDDC. Its main functions are described as opportunities than other kinds of task.
following: b) Interpreter.
To config running time system according to object file. Interpreter is used to interpret and execute object
At the same time, it schedules and executes the tasks instruction just like CPU does to some extent. It has running
according to their properties (such as task type, PRI, stack and some register variables that are similar to registers
scheduling interval etc). in X86 chip[7]. The way interpreter works is very like CPU
does in PC too. Interpreter can be realized as a procedure. In
To communicate with IDE to make the virtual machine the procedure, there is a large Switch-Case expression. Every
system to operate (such as run, stop and reset etc) object instruction is realized as a branch.

776

Authorized licensed use limited to: Tsinghua University. Downloaded on January 18,2025 at 15:21:55 UTC from IEEE Xplore. Restrictions apply.
c) Task Interruption. equipments, global variables and POU local variables of
Task with higher PRI is entitled to interrupt the running project.
task with lower PRI. In a general way, occasions which task
is interrupted are described as following: The I/O communication module is used to communicate
with I/O equipments being supervised. It keeps on gathering
 Periodical task is completed. data from I/O equipments and put it into input-variable
mapping section that is allocated to store input data. At the
 Task received stop request. same time, it keeps on inspecting the commands for writing
 Task received interrupt request. to I/O equipments so as to write data to I/O equipments
correctly and timely[8]. When data is read and written,
 Timer task with high PRI is ready for running. synchronization should be paid attention to.
Scheduling module maintains a running state flag, which
3) System Management Module.
is checked up by every running instruction so as to know if
The missions of this module are described as following:
the current task should be interrupted. Here is an algorithm
showing how time task with higher PRI interrupts task with  To manage system states and I/O mapping
lower PRI: information and retained variable.
 To provide IDE with information about editions of
bool on_time_mgr (dword dwTick)
virtual machine system and application program and
information of errors occasionally occurred.
{
 To allocate memory for running data of task and
program instances according to object file.
if SystemState != STATE_RUNNING then
 To give debug function support to IDE, such as
return 0;
constrained variable management, break point management
and monitored variable management etc.
Get the TaskLists;
B.Instruction Set
for (int i = 0;i<TaskCount;i++) There are 54 object instructions in the virtual machine
system. An instruction is constituted of operation code and
{ operand. The length of operation code is one byte. In the
operation code byte, the fore 5 bits denote son coding while
CurrentTask=TaskLists[i]; the other 3 bits imply instruction type. The total 54 object
instructions are divided into seven groups according to
if(CurrentTask.TaskType == instruction type:
TASKTYPE_TIME)
 Transference instruction (15, instruction type is 0);
{  Boolean calculation instruction (4, instruction type
is 1)
if (PRI of running
task<CurrentTask.PRI &&  Mathematical operation instruction (8, instruction
CurrentTask.WaitingTime> type is 2)
Interval of time task &&
CurrentTask.TaskState is  Comparison operation instruction (14, instruction
TASKTYPE_SLEEP or TASKTYPE type is 3)
_WAITING)  Bit operation instruction (4, instruction type is 4)
then interrupt the running task˗  Jump instruction (8, instruction type is 5)
 Debugging instruction (1, instruction type is 6)
}
Object instruction may have variable operands from 0 to
} 2. But the length of an operand is four bytes so as to simplify
the structure of instruction. The data type of operand may be
} address of variable, address of code and constant.

2) Communication Modules. C. Development Method of Virtual Machine System


The hardware platform of the virtual machine system is
There are two communication modules in virtual an embedded ARM board equipped with 2.0.38 uCLinux.
machine: slave communication module and I/O uCLinux adopts real memory management policy, moreover
communication module. They both communicate with the 2.0.38 uCLinux does not support fork() or IPC directly, so it
MODBUS protocol. is more difficult to develop the virtual machine system in
The slave communication module is responsible for embedded environment than on PC.
communicating with IDE. It receives object code and control The development of virtual machine is a typical
commands and feeds some running data and information of embedded system development. In the development process,
the virtual machine system back to IDE. Information of the the most common development mode: Host-target platform
virtual machine system includes: system state, data of I/O development mode was adopted. The virtual machine system
is programmed with C language. Because the target platform

777

Authorized licensed use limited to: Tsinghua University. Downloaded on January 18,2025 at 15:21:55 UTC from IEEE Xplore. Restrictions apply.
is equipped with uCLinux, so Red Hat Linux 9.0 was chosen REFERENCES
to be the host platform OS for the sake of compatibility. The [1] Fu Yinghong, Li Xiaofan, Xiang Jinjie.: The SoftPLC Technology,
arm-elf tools chain of GNU is selected as cross compile tools: Products and its Discussion of Application Control Solution. Control
arm-elf-gcc is compiler, arm-elf-ld is linker, arm-elf-gdb is & Automation. 12 (2003) 11-13
debugging tool. In order to accelerate the development [2] HUANG Yanyan, LIN Yue, YU Haibin.: Research and
process, Special JTAG emulator for ARM is used to debug Implementation of SoftPLC Technology. Computer Engineering. 1
the virtual machine system software. (2004) 165-167
[3] ZHU Wen-kai, WANG Wei-hua, DING Han, XIONG You-lun.:
Open Architecture of SoftPLC Based on Embedded PC. Machinery &
IV. CONCLUSIONS AND FUTURE WORK Electronics. 3 (2002) 3-7
The ESDDC system is put into use in building control [4] PENG Yu.: The Latest Development of PC-based Control. World
area successfully. The virtual machine system works very Instrument & Automation. 3 (2001)14-22
well. Owing to good design and implementation, the virtual [5] PENG Yu.: The Status and Development of IEC-61131 Industrial
Control Programming Language. International Mechanics
machine system can be easily transplanted to other hardware Technology. 1(2004) 42-49
platform. Embedded SoftPLC technology possesses [6] Huang Yanyan, Lin Yue, YuHaibin.Research and implementation of
tremendous potential and value. It is predictable that the SoftPLC technology.ComputerEngineering, 2004, 30( 1): 165-
embedded SoftPLC system will emerge like bamboo shoots 167.
after a spring rain in automatic control area in later years in [7] Jiang Lianhai.Realization of SoftPLC inembedded controlsystem
China. development platform . Wuhan: HuazhongUniversity of Science and
Technology, 2005.
Soft PLC technology has great potential and value, more [8] Ren Zhibin. The research and implementation of Embedded SoftPLC
and more people has paid more attention to it in the next System .Haerbing Engerneering University.2005
few years it can be predicted that soft PLC products would
like bamboo shoots after a spring rain emerged,and made
great progress in the field of industrial control and embedded
system.

V. ACKNOWLEDGMENT
This paper is supported by the general project of
scientific research of Department of education of Liaoning
Province: Research on the key technology of application of
dynamic service network for supply chain. Its granted
number is L2011240. At the same time, three authors of this
paper thanks to Dalian Neusoft Information University. It
gives us financial and data support for the research.

778

Authorized licensed use limited to: Tsinghua University. Downloaded on January 18,2025 at 15:21:55 UTC from IEEE Xplore. Restrictions apply.

You might also like