Nov 22, 2008 -
‘
08
INTERNATIONAL SCIENTIFIC CONFERENCE 21 – 22 November 2008, GABROVO
WEB-BASED DATA ACQUISITION AND CONTROL SYSTEM Aldeniz Rashidov Technical University of Gabrovo Abstract The paper deals with design and development of Web-based data acquisition and control system, which gives opportunities for data acquisition and data fusion from end devices - sensors, located in the network. It does possible their monitoring, adjustment, configuration and controlling trough the Internet, too. The system integrated the preferences of Web, as well the development of information systems and control of end devices. The model of a database, which ensures a fast and sure processing of the requests coming from the remote stations, is developed. It contains a procedure for processing of a queue of requests, coming from the remote stations to the end device. It calls functions of a driver to realize a link with the enhanced controller. In this way it takes a big part of the functions and procedures of the applications, which realize a database access. System keeps simplified and defended from illegal access interface. It gives opportunity of sending requests for adjustment, configuration and control over the existing end devices in the network. Keywords: Data acquisition, Data fusion, Web-based systems, Information Systems, Control systems.
INTRODUCTION The modern production, transport and communication systems are assessed as a complicated hierarchical structure built on a totally of interrelated and interaction subsystems. The necessity of ensuring of a functional information and program technical compatibility and effectiveness of the detached subsystems consists of the building of integrated systems for control of the production [1]. The collecting of data from different ultimate device as well the further processing of the data in different stations, finds a considerable part in the systems for automatic control with a network communication (SACNC). The link between the SACNC subsystems is realized by an industrial communicational network. The synthesis of a such a network is connected with the ensuring data exchange devices. The serial transmission of digital data [2] has a large application in the industrial communication networks. In that link – they use mostly RS-232 and RS-485 communication interfaces as well serial synchronous protocol IIC and SSI. The numerously of intelligent devices, programmable logical controllers (PLC), intelligent sensors, executive mechanisms, modules for remote input and output, as well communication interfaces. There is a necessity some remote junctions (operative, controlling computer stations and so on) to realize the I-500
observation and the controlling. They are a precondition for projection and realizing of Webbased information and control systems for data fusion and acquisition. The more and more successful integration of the information systems in the Web helps the users about searching and processing data in those systems by remote workstations. The Web-based information and control systems take a leading place among the services, which Internet offers, because of their acquisition, fusion and transmission functions connected with the data, as well the procedures for control and observation on different processes of production direct trough the Web-browser. This work out aims to present the Web-based data information and control system, designed for data acquisition and data fusion from ultimate devices, structured in a local area network. The system sets the task the observation, adjustment, configuration and the control of the devices trough the Internet.
REQUIREMENTS TO THE SYSTEM In view of the task, which the system aims, the Web-based system expands the following main purposes: » Ensuring of work in real time, as the top value of the delay during the data transmission is a constant quantity, irrespective of the network area;
Международна научна конференция “УНИТЕХ’08” – Габрово
» It makes possible the data acquisition and fusion, as well as sensor observation of the temperature, humidity, acoustical quantities, so movement in a room; » Realizes the device control (alarm switch) as a result of data acquisition given by the sensors; » Ensuring of a fast and reliable protocol , work in the communication network, which consists a limited number of additional devices; » Ensuring of a simplified and protected from a illegal access interface; Ensuring a reliable and stable link between the separate points of the communication network at the expense the data exchange speed. The speed doesn’t establish itself as a factor, because there isn’t a big intensity of the data flow.
The link between the main station and the Internet is realized by a network concentrator (ROUTER). In this way, the remote and authorized stations are in able to realize an observation and control of phenomena and processes in the room. The connection of the sensors (S1, S2, S3, S4 and S5) to the main control station involves an additional module in the network. A controller µFlash876B from POND Electronics (fig. 2) [3, 4] is appropriate for that purpose. It has been worked out of a microcontroller PIC16F876 base. The block diagram of this controller is shown on figure 2.
ARCHITECTURE OF THE COMMUNICATION NETWORK The building of a proper structuring of a communication network is a basic point for the building of an automated control system (fig. 1). In view of the requirements for the system, which have been marked, the centralized control is a suitable decision for the realization of the link with the separate sensors. That involves a personal computer (PC) to be included, which would complete a role of a main station in a local area network (LAN).
Fig. 1. Architecture of the communication network
Fig. 2. Block diagram of the controller
It consists of 16 input/output channels. Four analog inputs (P4, P5, P6 and P7) are connected to the built-in analog-to-digital converter of the microcontroller. The temperature sensor, humidity and sound registration are connected to the P4, P5 and P6. The temperature on °Kelvin is reported at the exit by the temperature sensor LM335Z from National Semiconductor [5]. The suggested by Humirel [6] HTM1735 is connected to the analog input P5 and fixes the humidity. The sound registration [7] is done by a sensor, connected to the input P6. Hygrosens PIR-STDN4H [8] registers movements, as at the same time it allows an adjustment of the sensibility by its analog inputs. P8 is connected to a relay, which controls the operating of an alarm. The running of the alarm is realized according to an initial adjustment or after analyzing a done by a remote station, which is authorized to do it. By the communication interface RS-232, included in the configurations of the main station and µFlash876B, the sending of controlling and other kinds of signals are realized.
Международна научна конференция “УНИТЕХ’08” – Габрово
I-501
I-502
Web-based IS
CONTROL MOD.
SUBSYSTEM PR1
OPERATOR MOD.
SQL MODULE
SUBSYSTEM PR2
DR MODULE
MAIN MODULE
SUBSYSTEM PR3
ADC MODULE
The content of the program ensurance (PE) directly depends on the system requirements. The data acquisition requires a database to be chosen (DB). A relational database of Microsoft SQL Server is appropriate for this purpose. The scheme of the data flow, as well the blockscheme of the architecture of the program ensurance are shows on figure 3 and 4. Before to choose a corporative database is connected with the necessity of reliability, ensurance and realization planned in respect lighten the other part of the PE to the highest degree. The specialized PE (Pr3 on fig. 4), which is included in the controller µFlash876B has three basic modules. Its task is the completing of configuration (module Init), diagnostic, control and other commands (module Main), which have been given by the main station. Pr3 converts the analog signal (module ADC), coming from the sensors (D) trough the inputs P4, P5 and P6 as digital data. So by the communication conditions it transfers some data. The PE (Pr2), which is included in the main station, has a particular importance. A part of it (module Dr) is designed to give commands and data exchange between µFlash876B and it should be in synchronously with the interface RS-232, the appliance and the PE of the controller. The abilities, which the database has, allow the Dr to be asked from a request written in a SQL (module SQL). The code of that request – a function, having some input/output parameters, can be stored in the database as well to be planed for execute in an exact time and event. The requirements for a remote observation and control by remote station (O) trough the Internet include a choice of a Web server (W). It should be in able to ensure an opportunity for realization of dynamic Webpages (Pr1) by some authorized users, having exact right of access into Internet. The dynamic Web-pages are written in a Web-oriented language for programming – PHP. They allow many system and other functions to be completed. They include and those ones, which realize an access to the database, as well executing queries in the database of MS SQL Server. Except, they allow the realization of observation on the data, which have been measured by the sensors (module Operator), diagnostics, configuration and control of the devices (module Control).
A succession of activities connected with the data acquisition by a sensor, as well a parallel visualization of the data from an arbitrary remote station: » A remote station by a Web-browser makes a HTTP request on a written statement to the Web server about loading the “Operator” module; » The Web server accepts the request. It chooses right this file, which fits the request and sends it to the PHP interpreter, where it is treated and realized. The interpreter is a part of the Apache Web server; » The PHP script is treated by the interpreter. If in it there are some operations for realization of a link with the database, as well searching and processing some datas in it, the interpreter makes a link with the database and sends the request separately. » The database server receives the requests and treats them. In case that there is such one, which is intended for a data exchange with the controller, the server asks an outer module (driver), as at the same time is giving it some input parameters. In a case that the channel for controller access is not free, the request for exchange is been preserved in a queue requests waiting for an access to the controller. The request to the database is identified as treated and waiting to be executed. If there is a free channel the driver gives commands to the controller. » The controller accepts the request by commands from the main station. The main module (Main) identifies the necessary information and sends it to the sub-modules. In case that the operation requires collecting of data by the temperature sensor, the main module runs the control to the analog-to-digital converter module.
INIT MODULE
ARCHITECTURE OF THE PROGRAM ENSURANCE OF THE SYSTEM
Fig. 3. Block scheme of the architecture of the program ensurance
Международна научна конференция “УНИТЕХ’08” – Габрово
OPERATORS - O ROUTER - R WEB SERVER - W
HUB - H
MAIN STATION - M
CONTROLLER - EC
DEVICES - D
SENSOR1 WEB SERVER APACHE WEB BROWSER Web
Web browse browse
Dr SENSOR2 OPERATING SYSTEM
Pr 3 ENHANCED CONTROLLER
Pr 1 PHP MODULE
DATABASE
SQL
SENSOR3
SENSOR4
ALARM
Fig. 4. Scheme of the data flow
Afterwards the data are sent consecutively by the communication interface RS-232, after the fulfilling had been finished. » The driver which completes the link with the controller reads the data and sends them to the server containing the database. In this way they are stored in the database for a following processing. » The interpreter finishes the realization of the script, which usually includes the results under a code, fit for interpretation from the Webbrowser of the remote station; » The Web server sends the code to the browser, which allows the user to receive the result. In case when the sent require has been stored in the queue of waiting requests the remote station it is in a position waiting for a result. A. Projection of the database of the system
The projection of the DB is one of the most complicated and important tasks, connected with the process of the creating of such a system [912]. The DB must ensure the fast searching and processing of the data which it contains. One additional, but not less important task is the opportunity the DB to take some of the functions and procedures of the final program parts, which complete an access to the DB, to the highest degree. In this link a main point during the realization of the information and control systems is the building of the database model. Figure 5 presents a database model including the following basic tables: » QUERIES – it includes the requests which have been given to the controller of the remote stations. In dependence on the matter of the requests are stored results (resultat), shown by the devices (did), which are directly switched with it. There are data (userid), which identify the user and his unique address in the network, data
(moment), which marks the current moment when the request has been received, as well the preservation of the request (zaiavka). A field (izpylneno) identifies the conditions about the fulfilling of the request. It shows whether the request has been processed or it has been processed, but is waiting to be completed. There are fields, which register the moment when the request has been successfully processed (zaiavka_data), as well the moment when a station confirms the data processing (pregled_data). » CONTROL – stored data during the fulfilling of a queue of requests to the controller and show the conditions concerning the executing and the processing. It write down data (obrabotka) about the moment of the last processing of the queue of requests to the controller, as well a field (krai) which reflects a started process of processing the request to the controller. » USERS – include data, necessary for the system identification; » DEVICES – include data about the available devices (did, devicename), which are switched on to the controller. At the same time it marks if the device is accessible (devactive). » DACCESS – include different combinations of ways for access to the devices. Some ways of access for observation (dev_monitor) are provided, too, controlling (dev_control), diagnostics (dev_diagn) and configuration (dev_config). » UACCESS – include the right way of access to a exactly definite device from a remote station. There is a stored procedure (Obrabotka) in the database. It takes the functions connected the processing of each following queue of requests in the remote stations.
Международна научна конференция “УНИТЕХ’08” – Габрово
I-503
QUERIES
UACCESS
USERS
zid
userid
did (FK) userid (FK) moment zaiavka resultat izpylneno pregled_data zaiavka_data
username userpass name email phone
userid (FK) dev_access (FK) did (FK)
DACCESS DEVICES did devicename devactive
dev_access dev_monitor dev_control dev_diagn dev_config
CONTROL cid obrabotka krai
controller is particularly important. The temperature, humidity and sound detection are switched on to them. The assured possibility Dr to be completed at an arbitrary control station in the local area network is the other particularity. That means that it’s possible many control station, which can be connected to a definite number of final devices by the appropriate controller, to be switched on the communication network. In addition – according to the requests of the remote stations, the procedure of the database (SQL) in the main station defined which of the control station will take the request. C. Particularities of the program ensurance of
Fig. 5. Database model Each request is outer toward the database program ensurance (Dr), which is a part of the system program ensurance of the operating system (Windows). Dr transfers commands and data exchange with µFlash876. All the accepted requires are processed in groups of stations, independent on the moment of accepting. When the processing is started a filed (krai) is established. It points a process of processing of requests which has been started. The procedure writes the result or the condition of the request down in the result field (result). It establishes that the request has been done (izpylneno) and writes the processing moment down (zaiavka_data). The process starting the executing of each following queue of requests is taken by the DB functions, to complete tasks which have been planed according to the time and the event. The configuration and the adjustment of the task are definite depending on the number the reaction time of the devices, as well the number of the separate stations. B. Particularities connected with the asking and
realization of the program ensurance of the data exchange in the controller The data acquisition from the devices, the configuration, adjustment and controlling of the devices is done by program ensurance (Dr) by a controller µFlash876B. It requires the use of the program language – Assembler, or other one, which lets a low program level. The controller itself has specialized program ensurance (Pr3), which fastens the data acquisition. Pr3 introduces some rules, which the Dr should be in conformity with. The algorithm, used by Pr3 during the data acquisition from the analogues inputs of the I-504
the remote stations The program ensurance designed for the remote stations ensures possibility the users to give requests for monitoring, adjustment, configuration and executing of the end devices in the network. They receive an access trough Web. In that link the program ensurance have to use the necessary modules. The separate stations use them according to the regulated access to the system. They are written in a Web-oriented language and have an access to the database. By the Apache Web server, or some other, which can interpret the scripts, they are accessible trough the Internet. A typical particularity of the Web server, which stored the programs for the remote stations, is to be in the same server with the database. The overloading of the resources of the server is to be near the controller. Two basic modules are included in the program ensurance: » CONTROL – allows a remote station to send requests for adjustment, configuration and control of the end devices in the network. These activities are limited according to the whole system and the way of access to some device. » OPERATOR – makes possible a remote station to observe the results from the given requests in the transition module. Such are the data acquisition and data fusion by sensors, the stay after a command has been given for control of relay switch for alarm leading. CONCLUSION The presented Web-based data acquisition and control system gives opportunities for data acquisition and data fusion from end devices, located in the network. It does possible their monitoring, adjustment, configuration and controlling trough the Internet, too. The system
Международна научна конференция “УНИТЕХ’08” – Габрово
integrated the preferences of Web, as well the development of information systems and control of end devices. In addition the system solves the following main tasks: » It offers a communication network model that realizes a link of end devices to a main station, or to other control stations by an additional enhanced controller; » Ensures a reliable and strong link between the separate points of the communication network; » Offers a program model and protocol for realization of a link between a remote station and a end device; » Gives a model of a database, ensuring storing, searching and processing of data from the end devices. The model ensures a fast and sure processing of the requests coming from the remote stations. It contains a procedure for processing of a queue of requests, coming from the remote stations to the end device. It leads functions of a driver to realize a link with the enhanced controller. In this way it takes a big part of the functions and procedures of the applications, which realize a database access. » It ensures work in real time, as the maximum value of the delay during the data exchange is constant quantity, independent of the network loading; » It keeps simplified and defended from illegal access interface. It gives opportunity of sending requests for adjustment, configuration and control over the existing end devices in the network. These activities are limited and depending on the access rights, which a remote station to the system has, as well the way of access to a definite end control device.
REFERENCES [1] Djiev, St., Industrial sets for communication and control, Technical University – Sofia, Sofia, 2003 (In Bulgarian). [2] Modular microprocessor system for data acquisition from analog and digital sensors (OCTOPORT), Mechatronics sensor information systems – BAS, 2003, available at: (In Bulgarian). [3] µFlash876 User Manual, Pond Electronics, Home of the µFlash876 embedded controller, µStack & µConnect bus., 2004, available at: . [4] SMS Transceiver for PIC, Homepage of Wolfgang Rankl, 2006, available at: . [5] LM335 - Precision Temperature Sensor, National Semiconductor, The Power of Analog, 2004, available at: . [6] Humidity temperature sensors, Humirel, available at: . [7] 16F88 ADC sound sensor, Loonaweb, 2007, available at: http://www.sirloon.net/loonaweb/ sirblog/16f88-adc-sound-sensor. [8] Miniature movement alarm unit, Hygrosens instruments, available at: . [9] Relational database design, Karpov I.P., 2007, available at: (In Russian). [10] Digo, S.M., Design and application of databases, Finances and statistics, 1995. [11] Database design, Shishedgiev, FMI, available at: (In Bulgarian). [12] Databases design, electronic book, 2004, available at: (In Russian).
Международна научна конференция “УНИТЕХ’08” – Габрово
I-505