一类基于嵌入式动态Web的网络化监控系统
2013-08-22周国清
周国清,李 雷
1.重庆电子工程职业学院 建筑与材料学院,重庆 401331;2.重庆大学自动化学院,重庆 400044
1.Introduction
The applications of Web technology have become a hot topic in monitoring field[1-3],and the Web service has been widely used for industrial applications currently.With the help of embedded Web server of field control device in the bottom layer of industrial control system,all control devices of the industrial fields could be accessed and monitored through Internet in anywhere using general Web browser[4-6],and achieved the objectives of monitoring field device expediently.The page layout through Web stored in the field control device can dynamically reflect the running state of field device and feedback information after executing the monitoring operation,collect the real time data of field running device more accurately,make various checking analysis,control the field devices,and execute system maintenance easily and so on.For convenience of explaining the application and owning the representativeness,this paper takes the monitoring system of gas stations in oil product retail network as an example,and explores a sort of realization of monitoring system based on embedded dynamic Web.
2.Architecture of networked monitoring system
The system architecture of networked monitoring system for the whole gas stations is shown in Fig.1.
In Fig.1,the field devices in forecourt of gas stations such as dispensers,tank level gauges etc,are directly connected to the Intranet/Internet through embedded Web server,and then by means of Ethernet port or wireless port it can be connected to the browsing monitoring station or moving browsing monitoring station based on Web.It is very propitious to implement the data communication and monitoring in real time,network security and encrypt system for this sort of architecture,and adopt Web with embedded technology for implementing the dynamic monitoring and integrated management.The superiorities are mainly incarnated as the aspects of the following.For instance,it is more convenient in implementing the intelligent communication,configurable and controllable in device on line,realizable in store-forward of real time data,and ensures the integrality and security of data transfer.
Fig.1 Architecture of networked monitoring system
2.1.Software frame of the system
The implementation of software system is applied by embedded dynamic Web.The software system consists of three parts which are operating system,Web server and application software,and the structure of software system is shown in Fig.2.
Fig.2 Embedded dynamic Web
1)Intellectualization in communication
The front-end device adopts the embedded intelligent computer of industrial grade to be suitable for field scurvy environment,it is used for processing various data of heterogeneous oil device,and therefore it is propitious to the monitoring and extension of whole system,and to the structured program development of collectivity design and object oriented for communication software from systematic hierarchy.According to the data communication protocol of different devices,it can design different module to implement the intelligent communication,and it is convenient to actualize the unification control and management for different field oil devices.
2)Device configuration and monitoring on line
The mode of system development is used by dynamic Web based on Apache+PHP+data file for Linux.The device configuration and status setting of various kind of forecourt devices can be neatly implemented by means of the page layout of Web,and through the page layout it can dynamically reflect the real time status of each device such as oil gun state of dispensers,look over the log file of forecourt controller running,and analyze the statistic log file to acquire the running statistic data that offers the base of the first hand data for erratum and correcting fault.Each user owns its different management purview according to the specified access content of purview enactment,and only the supervisor has double purview of both read and writing.Therefore it can completely ensure the data security transfer over network and offer the accessing function of encrypt security,renew and load the price list of oil plants and oil grade in real time,implement the monitoring for all forecourt devices such as dispensers and oil gun being on or off,and monitor the manifold oil device that will be more complex in instance and higher in control difficulty.
3)Real time data store-forward
The inner ROM of front end control device is easily divided into four areas,and they are Boot Loader,Linux Kernel,Mini Root File System and User Root File System.When the system is resulted in breakdown rooted from user program reason,the Mini Root File System can be used as emergency root file system.When User Root File System in the Boot Loader is loaded to be failed,it can activate the Mini Root File System,and introduce a sort of inner embedded mechanism to prevent the system breakdown so as to ensure the steady reliability of system running.Once the system fault occurs in background network,the data communication of Store-Forward can be used,and the data is stored into the file of JFFS2.After the fault is eliminated,the collected data will be automatically transmitted into the corresponding main computer.And it does not influence the normal work of dispensers and related devices.Therefore the function of real time data store-forward ensured the integrality and security of system very well.
2.2.Hardware structure of Web server
The Web server is an embedded computer of high performance in which a NOR Flash ROM of 32MB and a SDRAM of 128MB are configured,as shown in Fig.3.The hardware system is configured by rich resources such as eight serial ports,double 10/100 Mbps Ether port,wireless communication of PCMCIA,8-channel data input and 8-channel data output,and extended interface of CompactFlash.
Fig.3 Inner structure of Web server
3.Software function of system
The core part of system is an embedded computer configured by embedded system of Montavista Embedded Linux[7-9],and it is shown in Fig.4.By means of scheme of Apache+Html+PHP,the system can implement dynamic browse and modify the system configuration of Web server dynamically.
Fig.4 System structure of Linux
By means of development tool such as GCC etc[10],it can develop the user program so as to implement the monitoring for field device of gas stations.The implemented software function of Web server includes the following application program development.
①Monitoring of the status for various dispensers in real time,configuration of the devices for gas stations,and setting of the work status for dispensers.
②Monitoring of the log file of Web server running,statistic and analysis for running statistic data so as to offer the base for eliminating erratum.
③Configuration of the accessing purview can ensure the data being security transfers in network,and provide the accessing function of secret security.
④Control of the parameters such as dispensers work status,setting oilcan and price brand under the condition of a certain control of security level.
4.Implementation of protocol conversion
The protocol conversion consists of tow modules that are respectively the IFSF interface module based on TCP/IP and the conversion module between forecourt device interface protocol and IFSF protocol[11].Its function is to implement information conversion from forecourt device interface protocol to IFSF protocol based on TCP/IP and real time information processing of forecourt device in the embedded Web server.
1)IFSF protocol interface based TCP/IP
The interface consists of four modules are shown in Fig.5.① Application module of IFSF is used to control the implement of application program of forecourt device.② IP protocol stack module is used to implement the IPprotocol connected by network,and it provides the function such as network connection management and IP address parsing etc.③ DHCP server is used to connect the device assigning address of Ethernet.④ Conversion module between IFSF and IP is used to implement the three functions that are to receive and send the Heartbeat by use of Heartbeat Proxy,to manage all the link lists connected,to send and receive all the data through TCP connection.
Fig.5 Structure of IFSF based TCP/IP
2)Protocol conversion between forecourt device interface and IFSF
The protocol conversion consists of two function modules are shown in Fig.6.
Fig.6 Protocol conversion
One is the protocol interface module of forecourt device,and another is proxy module of IFSF.The former implements the interface for idiographic forecourt device.Its main function is to parse communication frame of device,monitor the oil process,and make the response for special case of dispenser.And the latter is used to respond the“write/read”for each node request of IFSF.According to the protocol and frame format of IFSF,it implements the accessing among IFSF nodes.The communication is actualized by database among the above modules.The proxy module accesses the database that it represents to access the forecourt device.The database stored all the information of dispenser and forecourt device,including oil gun state,protocol version of dispenser,oil price version,trade record list and accumulative total of trade statistic data etc.In all the information,the data that has higher demand of time effect is all with the time stamp.If senting write/reading information from other IFSF node wants to access the data that is time sensitive,then it can directly access the data through database.Otherwise it can send the data request order forward to forecourt device protocol interface module through another information transfer channel between device protocol interface module and IFSF proxy module,and the device protocol interface module must make response in a certain time.It can implement the monitoring and management for the function in some data file such as oil quality file and general information of gas stations of data base through integrated monitoring module.Once the module of device protocol interface apperceives that the file variety is happened,it will be automatically start up to general information query instruction in the program and go into the information renewing stage.The function of control and management is to transfer the trade record of all dispensers into the main computer.If it is off line(for example,the signal interrupting rooted in line fault)then the trade record can be directly stored in local area.When the fault is eliminated,the data will be automatically transferred into the main computer so as to ensure the data integrality of management system.
3)Software design
For saving system resource and implementing share data,the conversion function is implemented by means of creating thread mode.Each serial port creates a thread to implement the communication between device and conversion so as to ensure communication independent one another between device and conversion.In addition,the sub-thread of Ethernet should be created.The forecourt controller end is considered as server end,through creating connection with POS,it can realize the communication between protocol conversion and POS.The data interaction of thread is implemented by means of sharing data storage.The system flowchart is shown as in Fig.7.The POScarries through control and data transfer for field device of gas stations by forecourt controller.And vice versa,the process is that the data in each forecourt device is packed in format of IFSF frame to be transferred after data being parsed through forecourt controller,finally the POS transfers data to background server.
Fig.7 System flowchart
4)Serial communication module
In terms of configuring file,it carries through parameter needed setting for each serial port.In the program,through reading in configuring file it makes the serial port complete initialization.For avoiding from long time waiting,each serial port assigns a thread so as to complete time-sharing operation.Each thread assigns a private data buffer.When the data sets in,it is accepted into data buffer by use of function of recv(),after right checkout it is packed,and transfers into the POS.When the net is off line,the oil data will be stored temporarily.In main program,the oil data stores by means of static structure array.
5.Implementation of dynamic Web server
All the user interfaces of dynamic Web server can be implemented by the WWW browser.In which the part of affair logic can be implemented in the front end.But the main affair logic is still implemented in the server end,and forms so called 3-tier structure shown in Fig.8.This mode is the direct access between Web server and browser.The application program is put in the server,and it is unnecessary to develop client end program.There are two sorts of development methods,CGI(Common Gateway Interface)technology and embedded technology.In this paper,the latter will be used.It makes special script,such as Javascript,VBscript and PHP,be embedded into HTML by specified mark.When the client browser sues,the Web server is able to explain engine execution to script by using of corresponding script,and completes the operations of query and modification for background database in terms of idiographic condition,and finally the results will be returned back to browser end.In the development mode of dynamic Web of Apache+PHP+database based on Linux,Apache is a sort of HTTP server of open source code,through simple extension of API,the decipher,such as Perl/Python etc,can be translated and edited into the server.The PHPis a sort of script language of typical server end used by creating and executing dynamic Web page layout in the server.Combining PHP with Apache server and making it as a module,and it is embedded into the Apache not only to implement code simplification,but also to execute higher efficient and more shortcut.The work flowchart of Web server in detail is shown in Fig.8.
6.Experiments
The experiment simulates the receiving&sending data and order of POSand dispenser respectively by using two computers,by means of software server platform of Apache+PHP,after completing compiling of protocol conversion of main program and related program,it will be loaded into the development device.And at the same time,the compiling of the Web page layout will also be entered into it,then it runs the development device,we can directly view the testing results from display menu at client end.The interface of parameter setting is shown in Fig.9.
Fig.9 Interface of parameter setting
From the Fig.9,we can modify and look over port configuring file,and the POS can simulate to control the dispenser to oil,to set oil parameters,and to control the oil card inserting and exiting.Also it can simulate the operations of dispenser such as lifting the oil gun,hanging the oil gun and making balance etc.The testing result shows that it can complete protocol conversion of dispenser and POS,implement all the functions controlled by POS.
7.Conclusions
It is a necessary trend to integrate and communicate among different protocols for industrial automation control development in future.Through the application example above,it shows that it can better actualize the monitoring in system and sharing in data information,and make the maintaining easier for networked monitoring system based on embedded dynamic Web.
Fig.8 The structure mode of PHP service
[1] Cercone N,HOULijun,Keselj V,et al.From computa-tional intelligence to Web intelligence[J].Computer,2002,35(11):72-76.
[2] Smimov A,Pashkin M,Chilov N,et al.Agent based Web intelligence for logistics support in networked organizations[C].The 7th International IEEE Conference on,October 2004:922-927.
[3] Butz C J,Hua S,Maguire R B.A Web Based Intelligent Tutoring System for Computer Programming[C].Proceedings IEEE/WIC/AMC International Conference on,September 2004:159-165.
[4] XU Wei,TANDerong.Development of control and management system based on network for gas station[J].Journal of Shandong University of Technology(Sci&Tech),2004,18:59-63.
[5] SONG Hongwei,ZHEN Ran.Design and realization of gas station central control system[J].Microcomputer information,2006,22:106-108.
[6] WU Qiuqin.Development of remote monitoring system based on embedded web server[J].Journal of Xihua U-niversity(Natural Science Edition),2006,25(6):39-41.
[7] LIZhuoheng.Linux network programming[M].Beijing:China machine press,2000.
[8] Wehrle K,Pahlke F.The Linux Networking Architecture[M].America,Prentice Hall,2004.
[9] Matthew N.Richard Stones.Beginning Linux Programming(The 3rd Edition)[M].Canada,Wiley Publishing,Inc.2004:187-189.
[10] Comparison between PHP and other CGI[EB/OL].http://www.51iter.com/wangzhan/php/200508/wangzhan_708.html.
[11] International Forecourt Standard Forum[S].Communication on specification over TCP/IP,2002.