Monitor System for Protection Device Based on Embedded RTOS

For the purpose of the monitor system in digital protection, the embedded real-time operating system (RTOS) and the embedded GUI (Graphical User Interface) is introduced to design the monitor system. Combining the necessity and the application value of the operation system, the choice of embedded Linux and Qt/Embedded is completely viable for the monitor system in digital protection for generator-transformer sets. The design with embedded Linux and embedded GUI enriches system information, increases developing efficiency and improve the generality.


Introduction
After the development of digital protection for over 20 years in our country, The rapid development of DSP (Digital Signal Processor) and high performance embedded microprocessor not only make the digital protection function more perfect and reliable, but also can gather and deal with more abundant data [1,2].The system needs precise and fast inner communicating function for transmission of vast data, and it also needs the network technology based on Ethernet with the development of power distribution automation System.It is difficult to achieve the requirement of the high-speed dealing with the data from DSP, including using parallel communication, realizing the smooth and amicable man-machine interface in traditional monitor system and programming technique, so that the choice of the more intelligent embedded system with RTOS is needed imminently.It is the trend of developing monitor system with high-performance embedded system and embedded GUI in future [3].

Embedded System of Real-Time
Operation System

Necessity
Embedded system is made of embedded processor, correlative hardware and embedded software, which can work independently with the hardware and the software.The 32-bit, 64-bit processors are primarily chosen in en-gineering at present.Restricted by factors like cost, energy consumption and chip size, embedded systems are closely linked with their application and market.It is critical to design and develop embedded system products with the proper cost, function and performance.
Embedded system is used in power system for a long time, including data collection, automatic equipment, detection and control of instrument and so on [4,5].Monitor System in digital protection widely adopts embedded system of single chip, Rabbit or ARM without operation system because of the slow processor and the deficient of EMS memory for the moment.Lack of operation system induces single configuration of function, low efficiency, small memory capacity and few user interfaces.The linear programming is the dominating program configuration in this embedded system.It is so flexible that the monitor system should be locked owing to the abnormity of every part of the application, otherwise it is usual hard to realize Chinese display.With the development of integrated automation system, the connection between protection and power dispatching center is based on Ethernet network.It is complicated to add the network protocol stack in circular control of embedded system, on the contrary, the situation in embedded operation system is opposite.Also, it's convenient for the transplantation of the network protocol stack in several system platforms.Consequently, the embedded system which is marked by operation system and internet is needed for the monitor system in digital protection urgently.

Feasibility
The frequency of 32-bit, 64-bit processors is over 100 MHz, moreover the memory system is bigger and its read-write function is more convenient, but their cost is falling in prices.In one side, high performance system could afford the additional consumption from CPU and memory in this embedded system.In the other side, the high ratio performence&price of them is fit for the development of digital protection.

Real-Time Multi-Task Embedded System
The man-machine interface and communicating function of the monitor system are not developed independently owing to the restriction in the speed of manage-CPU, the capability of memory and especially the design of linear program.The traditional monitor system brings us the bad configuration of the program, low efficiency on developing, fussy debugging and so on, so that the embedded system of RTOS is chosen for the new research and development platform of monitor system.In this platform the object-oriented programming which is unlike the ordinary linear frame is available to adopt.Separating and choosing each function as an individual task, while the system should distribute CPU's resource to every task according to their priority levels, which could ensure the real time response of multi-task.It is better to realize abundant manage functions in the monitor system than traditional one.

Technical Characteristics of Embedded Linux
There are many embedded operation systems at present, including VxWorks, pSOS, Nucleus, Palm OS, Windows CE, etc.They are all commercial product, so that a lot of small companies can't afford the cost for the digital protection by reason of their high price.Embedded Linux is a new part of embedded operation system.As a result of inherited from Linux, embedded Linux is advanced and strong, therefore it offers a steady runtime environment for the monitor system.The following are the primary reasons of choosing embedded Linux for the digital protection: 1) Embedded Linux has been used on multiform platform, including X86, Alpha., Sparc, MIPS, PPC, ARM, NEC, MOTOROLA, etc, so the work of transplanting should be convenient and fast.Furthermore, it will reduce the developing cost as Linux is free for following the GNU General Public License (GPL).
2) It is confirmed that embedded Linux is fit for embedded system and adding or reducing each part of the system should be easy at any moment due to the high modularization of Linux.
3) Compared with other embedded RTOS, Linux has perfect network function, Communication based on Ethernet network is no longer a problem for digital protection.
4) The digital protection needs lots of memory storage to save SOE and fault report ceaselessly recorded by sets.The embedded Linux2.6 can sustain file system (append NAND FLASH) excellently, so that it is easier and more efficient to manage the plentiful messages from DSP.

According with Embedded System Development
In order to develop high-performance and perfect functions monitor system in embedded Linux, an excellent graph support embedded GUI is needed, which is simple, intuitional and less resource used for limited hardware [6].
There are three mainstream embedded GUI, MiniGUI, Nano-X Window (Microwindows) and QT/Embedded, which is selected.QT/Embedded is an edition for embedded system created and maintained from QT by a software company named Trolltech in Norway.Compared with other embedded GUI, QT/Embedded is fully object-oriented, easily extensible and abundant controls.
Although it has bigger size and costs more resource, it becomes more appropriate for embedded system with the fast development of processors and memory now.There are many embedded Linux developers have turn to QT/ Embedded since it is released under the term of GPL.

Supply High-Performance Display Effect
It is a reason for choosing QT/Embedded, which can improve display effect of monitor system remarkable.QT/Embedded pays attention to all elements of graphic user interface for developers, it works on FrameBuffer directly, which is an abstract graphics equipment independent of hardware.It supplies the mapping of display memory and display register from physical memory in process address space.With developing the driver of FrameBuffer device driver for LCD, it provides running base for GUI and improves operation efficiency of program.Figure 1

Supply Perfect Development Environment
1) Cross Platform: as a monitor system of protection, it is better to fit different platform and has strong transplantation.The Trolltech assured developers that they would maintenance and develop same API on all kinds of operation system, reducing the degree of developing difficulty.
2) Object-Oriented: QT/Embedded is fully object oriented and allows true component programming.It is easy to realize stronger function and more excellent display with plenty of control resource.
3) Internationalization: in order to be accepted by power plant operation personnel, all the information showed on interface should be realized by Chinese.QT/ Embedded tries to make internationalization as pain-less as possible for developers.One of the solutions is using QString for all user visible text.Since QString uses the Unicode encoding internally, every language in the world can be processed transparently using familiar text processing operations, especially Chinese.
4) Powerful Tools: QT/Embedded is supplied with several powerful command line and graphical tools to ease and speed the development process.Furthermore, the reference-documents of QT are extremely detailed through the effort of the Trolltech and all developers of the world.

The Development of Monitor System
Monitor system is the embodiment of the most intelligent design for digital protection.As more and more interface developments with embedded GUI on embedded RTOS, but this application has not been realized in the field of digital protection.According to the requirements of the monitor function in digital protection for large generator-transformer sets at Three Georges's right bank plant, this chapter refers to adopt the 32-bit embedded RISC microprocessor based on ARM920T, and develop a realtime, multi-task, high-performance and flexible monitor system with QT/Embedded-3.3.5 on embedded Linux-2.6.

Hardware Design
The ARM9 processor EP9315 of the CIRRUS LOGIC in U.S. is selected for the manage CPU, and there are many advantages in this hardware platform.Firstly, it has strong computational capacity, whose frequency is as high as 200MHz and it equips the Maverick Crunch coprocessor for floating-point operation.Secondly, it has rich memory function, including 64MB-SDRAM, 32MB-NOR FLASH, 512MB-NAND FLASH and it also allows connecting with IDE hard disk, CF-card and U disk.Thirdly, it has perfect communication function, for instance, two 232-serial ports, four RS485/422-serial ports, two CAN bus and two Ethernet ports.Last but not least, the hardware platform is so powerful that it is also con-sist of standard 8 keyboard, DS1286 real-time clock and 6 inches 640×480 256K-colour LCD. Figure 2 shows the functional configuration of the manage plug-in in this digital protection.

Technique and Application of Multithread
In comparison with traditional linear software design, monitor system has always been realized by making use of multithread.The task of main thread is dealing with graphics user interface.There are three threads for communication: the communication with DSP based on MODBUS protocol and CAN bus, the communication with host computer based on MODBUS protocol and Ethernet and the communication with power dispatching center based on IEC 60870-5-103 protocol and Ethernet.The four parallel threads work at the same time, in other words, any normal threads will not be influenced by the one with errors which are caused by intense disturb.Obviously, it is better to improve the stability of the devices for using technique of multithread, and what's more, it is easier to add other new manage functions for better expansibility.
There are two choices for realizing multithread: 1)The design for multithread in Linux.
2)The design for multithread in QT.
In order to reduce the developing difficulty and cooperate with the monitor software developed by QT/ Embedded, the second one is more suitable and convenience.Qt provides thread support in the form of basic platformindependent threading classes, a thread-safe way of posting events, and a global Qt library lock that allows you to call Qt methods from different threads.The most important thread in QT is QThread, then it provides the means to start a new thread, which begins execution in your reimplementation of QThread::run().This is similar to the Java thread class.Don't mix the normal Qt library and the threaded Qt library in your application.This means that if your application uses the threaded Qt library, you should not link with the normal Qt library, dynamically load the normal Qt library or dynamically load another library or plug-in that depends on the normal Qt library.On some systems, doing this can corrupt the static data used in the Qt library.

Improve Display Effect
As can be seen from the analysis of the developing environment, which is fully object-oriented and allows true component programming, the interface developers can devote their mind to graphics design.With high-resolution color LCD, the familiar PC desktop graphic images should be realized in the monitor system of digital protection again, that is to say this new developing technique brings on huge reform of tradition human machine interface.

General Design
As a result of the flexible configure for digital protection, the monitor system is expected good action in the update of same sets and other similar devices being transplanted.So the generality is very important for a successful monitor system.The embedded Linux and QT/Embedded both can be transplanted expediently while it is better to adopt a general design for monitor application.Most important, similar functions of digital protection are the base for the generality.
At the beginning of designing this monitor system, its general requirement has been considered already.The pivotal technique is that all the information including names and interrelated properties displayed when the device is running, such as settings, samplings, digital input and output , SOE and fault/pickup report, should be saved in a special file named configuration file.When initializing the monitor system, the information read in memory from the configuration file should be displayed on the interface.This file needn't be compiled and can be configured flexibly as required.This method has the following advantages: 1) The method of the text configuration is very simple and flexible.During the developing process, we just modify the text file when adjusting any information as actual required.It can raise the efficiency of development and debugging.
2) It realizes the generality of monitor system in generator protection and transformer protection.And it can fit for any digital protection system without any modification of main program.
According to the excellent transplantation of embedded system and embedded GUI, the developing platform of the monitor system can fit for the development of most kinds of digital protection.

Conclusions
The large generator-transformer digital protection has passed type test and dynamic simulation test in Electric Power Research Institute of China.The real-time multitask operating system shows the excellent performance in interface display, hand operations, data acquisition and communication.These devices have done the test-run in 300MVA hydraulic generator sets in Geheyan hydropower station and they work well by far.
The monitor system based on embedded Linux, which is developed on embedded GUI, not only offer enrich man-machine exchange of information, provide high quality of display effect, optimize program structure, and supply powerful function of net, but also save the developing and maintenance cost because of the open source.The development platform of embedded system is so excellent in transplantation and expansibility that it is even fit for developing other automated electric power equipments.To summarize, it will be one of the mainstream platforms for developing monitor system in digital protection in future.