Research on application of real-time database for air quality automatic monitoring system

With the increase of city air monitoring sites and monitoring project, monitoring instruments and monitoring data are increasing rapidly. When using the traditional relational database in processing huge real-time data, the throughput and timeliness of monitoring system has been unable to meet the needs of the business. In order to solve this problem, this paper introduces the real-time database into the air quality automatic monitoring system. According to the design principles, the paper outlines the four aspects of the design: the composition of the system, the overall structure of the system, the data flow and the network topology. Aim at assembling the embedded system architecture, distributed system, database technology, network browser/server computing mode, client/server network computing technology, and large-scale computer application system of virtual private network connection based on public network. In the specific design, this paper design substation and central station architecture based on the real-time databases and complete the function of field data collection and storage, equipment control, data transmission, human-computer interaction, data exchange interface with third party system and other function. Finally, according to the observation results of the city air quality automatic monitoring system, the project realizes the functions of the system and improve the real-time quality of environmental air monitoring and the capacity of instrument supervision.


Introduction
With the rapid development of the economy of our country, the air pollution becomes more and more serious. In recent years, air pollution caused by the haze covered the majority of provinces and cities in our country, and brought great threat to people's health. As a result, more and more people begin to pay attention to the status of air quality. Air quality automatic monitoring system is an important part in the field of environmental monitoring. It is also an important means for the Ministry of Environmental Protection to collect air pollutant concentration data and analyze environmental air quality. Environmental air quality automatic monitoring system is a set of monitoring instrument with the core of automatic test, control system, continuous monitoring of the concentration of pollutants in the air, and is capable of automatic control monitor instrument [1].
The air quality automatic monitoring system in our country is developed by software platform and information management system which is based on a relational database. A relational database is a database that uses a relational model as a data organization method, consisted of a collection of connections between all entities in a given field. However, as the country vigorously promotes the urban environmental monitoring system, monitoring sites and projects continue to increase, leading to the need to maintain a large amount of data and control signals, and to complete the processing of its time-based application activities within the specified time. The functions and characteristics of both database and real-time processing are urgently needed in environmental monitoring system. Database technology is needed to support data management, data sharing, and data consistency and complete its tasks and functions in real time. When the relational database implements data manage, it does not consider the timing restrictions of data processing, and it is difficult to meet the needs of real-time applications. Therefore, it is difficult to meet the needs of the monitoring system by only relying on relational databases. And real-time databases have been applied into many cases, such as substation hotspot monitoring [2], pipeline deformation [3] and power monitoring in company [4]. In order to solve the current bottleneck, this paper introduces the real-time database into the air quality automatic monitoring system. These parts work together to construct a new type of environmental air quality automatic monitoring system. The real-time database has the advantages of permanent memory, fast data read and write speed, and can handle real-time changing data. Nowadays, the construction of power dispatch automation system at home and abroad adopts real-time database management system to realize the real-time performance of the system [5]. During the operation of the air quality automatic monitoring system, a large amount of real-time data needs to be collected to realize real-time on-site control of each monitoring substation, and has the function of fault data recovery. With reference to the successful experience of the power dispatch system, we introduced a real-time database into environmental air quality automatic monitoring system, which can meet the requirements of real-time control and information management at the same time.

Air quality automatic monitoring system
The air quality automatic monitoring system takes environmental analysis instruments as the core, and can continuously monitor the environmental air quality online for 24 hours.

System composition
The environmental air quality automatic monitoring system is composed of 4 parts: the monitoring substation, the central station, the quality assurance laboratory and the system support laboratory. Among them, the monitoring substation and the central station are the focus of this paper.
The main task of the monitoring substation: continuously monitor environment air quality and meteorological conditions; acquire and store the data of monitoring equipment and analysis instrument; according to the instruction of the central station, transmit the data of monitoring and equipment status information to central station, calibrate the monitoring instruments in the field manually or automatically.
The main task of the center station: receive, discriminate, inspect and store monitoring data and device status information collected by substation through wired or wireless communications; process and analysis the collected data; remote diagnosis and calibration the monitoring instruments of substation; generate and uploaded the monitoring data from substation in the standard form.
The main task of the quality assurance laboratory: calibrate and verify the equipment used in the system; assess the maintained equipment whether meet the requirements; formulate and implement the measures of monitoring quality control system.
The main task of the system support laboratory: routinely maintain the instruments and equipment according to the operation requirements; overhaul or replace the faulty equipment timely.

System general structure
As shown in Figure 1, the overall structure of the environmental air quality automatic monitoring platform, the system is composed of substations, monitoring station office, data monitoring center, information center of Municipal Environmental Protection Bureau, information center of provincial environmental protection department, provincial environmental monitoring center station, national environmental monitoring station, mobile and remote monitoring terminal and third-party operation center, which are connected through VPN. All departments and institutions can access the collected real-time monitoring data through the client or browser anytime and anywhere. In this structure, the unity, applicability, standardization, scalability, security and maintainability of the system have been enhanced.

System data flow
The data flow of the environmental air quality automatic monitoring platform: the substation and central station data platform is based on real-time database, ensuring the real-time data and historical data can flow timely and completely in the whole link.
The instruments and equipment in the substation acquire real-time data through the communication protocol and send it to the real-time database of the substation, and then the real-time data update to central station's real-time database by TCP or OPC protocol, the central real-time database provide data services for other real-time or non-real-time system through XML, OPC, TCP, FTP and SMTP.
The data of the substation's real-time database is regularly stored to the relation database, and synchronize to the relation database of the central station through OLEDB, providing historical data services for central station service platform.

System network topology
Combined with the requirements of the environmental air quality automatic monitoring system, the system network topology should have the following protections: (1) the stability of the environmental air quality monitoring system: substation must meet the requirements of the 24-hours uninterrupted work, and the data collection also needs to maintain continuity. Therefore, the stability and reliability of the network communication must meet the requirements.
(2) the security of the environmental air quality monitoring system: environmental monitoring data is highly sensitive. In order to ensure the confidentiality and integrity of the monitoring data, it is  (3) the real-time guarantee of the environmental air quality monitoring system: The data of the air quality monitoring system requires high real-time performance. In order to timely monitor the status of the equipment and data of substation timely in central station, the network of the system should have a high real-time transmission capability.
According to the structural characteristics and construction principles of the system, the final choice of the substation is to connect the ADSL and GPRS dual-redundant network to the Internet. The central station accesses the Internet through optical fiber, and establishes an IPSec VPN tunnel on the routers to transmit between routers. The substation and central station are transmitted from the original simple network to the virtual private network based on the public network [6][7][8]. Therefore, both ends of the subnet are in the local area network, which improves the stability and security of the whole network. The system network topology is shown in Figure 2.

Real-time database design
Real-time database system with its rich data acquisition drive, powerful real-time data scheduling core, open data interface and easy-to-learn interface development tools is the core platform of the system development. Establishing real-time database system in substation and central station, fulfill the function of data acquisition and build the information exchange platform for central station and substation. Not only improve the work efficiency of station's duty staff, but also reduce the work intensity. With the increasing of city observation point, the design of this system will have more and more obvious advantages.

Substation real-time database architecture design
As a part of the whole system, substation system can run independently, and when a substation has fault, the others will not be affected. The architecture of the substation real-time database is divided into three levels: field equipment layer, real-time data service layer and client application layer. The architecture of the substation real-time database is shown in Figure 3. Field equipment layer: the object of data acquisition of this system is in field equipment layer. The equipment is connected to the real-time database server in the form of fieldbus. The corresponding driver interface is configured in the server according to the different protocols provided by the equipment to fulfill the acquisition of field instruments.
Real-time data service layer: the real-time data service layer mainly manages the real-time data from the field equipment layer and provides real-time servers to the customer application layer.
Client application layer: HMI application based on real time database core.

Central station real-time database architecture design
The whole system uses the distributed real-time databases, these are many substation in the city, if only a real-time database is set up in the monitoring center to collect the data of each substation, the load of the server and network will be too heavy so, in the system, we store the substation real-time data in the substation real-time database after real-time data acquisition and processing, and send to central station real-time database, the users can access any network node in the real-time database, not only improve the efficiency of the system operation, but also enhance the reliability of the system. In the meantime, the central station real-time database can serve as a service to provide real-time service for different superior systems. Through the above analysis, the whole system adopts the architecture of a distributed real-time database, the central station's real-time database works as the main server, and has many substation servers. The system architecture is shown in Figure 4. The substation real-time database system transmits the real-time data to central real-time database system by TCP/IP or OPC (OLE for Process Control, OLE for process control). Similarly, the way for central real-time database to transmit realtime data to other regulatory departments can also use TCP/IP, OPC to other real-time data transmission system. the center of the real-time database system. For information system, use XML (eXtensible Markup Language) as the transport, for other system, use FTP (File Transfer Protocol), SMTP (Simple Mail Transfer Protocol) etc.

Function design of real-time database
Real-time database system serves as a provides for the environment data monitoring platform to collect monitoring data and monitor the running state of system, ensuring the accuracy and reliability of platform running condition. Real-time database, as a bridge, building a data transmission link between monitoring substations and the central station, providing an ideal platform for environmental air quality monitoring system to monitor timely and efficiently. The main functions of real-time database include: data collection, data management, device control, data exchange, data applications.
Data acquisition: the main parts of the environmental air quality monitoring are pollutant analysis instruments, meteorological instruments, visibility meters, temperature and humidity sensors, UPS (uninterruptible power supply) and intelligent instruments, which usually have a serial communication interface (RS232/485) and ethernet interface for data acquisition instrument and communication. In this design, we use Modbus interface provided by real-time database for standard Modbus protocol; and for the ASCII protocol, we can use real-time database programming scripting environment combined design protocol of character sending and receiving driver interface, and input the monitoring data to real-time database after the protocol parsing; for external files, we can acquire data directly by using file manipulation API functions provided by real-time database. Data acquisition concludes two parts: command sending and information reception. The analysis instruments send the corresponding message after receive the command from the drives and acquire the data by analysis.
Data management: as an important function of real-time database, it is responsible for data access and real-time/historical data management in real-time database. Before real-time database system developing we need to define tags according to the requirements of the monitoring items and process control. The acquired data is sent to real-time databases to display and stored in relational database as historical data.
Equipment control: equipment control mainly refers to the control of the analysis instrument. By inputting zero gas or standard gas to analysis instrument calibrator to measuring the degree of the deviation. Calibration control is a difficult problem in many automatic air monitoring systems, but the application of recipe management functions of real-time database into Process control can solve the problem easily. By store the key parameters such as the valve switch state, the types of calibration gas, calibration gas concentration, calibration gas flow and the calibration time in the form of recipes, trigger formula will load to tag and then perform calibration procedure.
Data exchange: in the system design, we need to consider the integration of real-time database and relational database; the data transmission between substation real-time databases and central station real-time databases; real-time/non-real-time data interaction between real-time database and other applications. We use open database connectivity(ODBC), dynamic data exchange(DDE), ole for process control(OPC), Extensible Markup Language(XML) to fulfill the interacting between databases.
Application data: according to the customer demand for data applications, we develop the real-time data display, the trend of the history diagram, historical data query, alarm notification/query, event notification/query process flow chart and report production by HMI tool and third-party control.

Environmental air quality monitoring system of a city
There are 9 state-controlled monitoring sites, a state-controlled comparison site, 9 city-control monitoring sites in the city and in charge of central station automated room. Far away from each other, these 19 monitoring sites are located in various zones of the city, and the control center is needed in central station to centralized monitor and complete report tasks automatically. To ensure the validity and integrity of data, real-time monitoring is important for station equipment. Designing a set point monitoring system with fewer staff and more sites is necessary with the personnel tense and expanding of monitoring sites. According the requirement and characteristics of the system, wo choose Indusoft Web Studio (IWS) real-time database management software of Schneider Inc, which has simple and easy development environment and stable characteristics, support C/S and B/S architecture, cross platform, provide 512000 points at most and unlimited driving add, is ideal choice in environmental monitoring field.

Hardware implementation
The main hardware of data acquisition controller of air quality monitoring substation is composed of the industrial DC power supply, industrial VPN router, industrial Ethernet, industrial control units, industrial input and output interface unit and embedded computing platform. Acquisition controller modular provides interface access of Analog, Digital, Ethernet and serial communication. It also has output interface such as video output, infrared output and DC power output in order to complete data and events' collection, processing, display, recording, storage, transmission, distribution, synchronization and provide DC power supply to the instrument and device.

Implementation of software
The air quality monitoring substation data acquisition controller's software configuration is Microsoft's embedded operating system (WES7), having the standard interface, development tools, operating system features and good stability, which makes it the ideal platform for industrial automation systems.
The air quality monitoring substation databases' software configuration is SQL Server which can support 1CPU and save 5 years of substation data with 10G database size. Forward database can save temporary data, without occupying database space.
Substation uses Schneider's Local Control Local control layer version IWS7 (Indusoft Web Studio SP7) series of industrial automation as the core real-time database. Central station uses Advanced Version Control Room Edition version of IWS7 series as the core, supporting huge scale real-time data, providing powerful engine for the automatic environmental air quality monitoring platform and ensure the normal operation of daily data. Figure 5 is the data display interface of the gaseous pollution analysis instrument of the substation, including the instantaneous value, minute value and hour value of SO 2 , NO 2 , CO, O 3 , the pipeline connection between the instruments is the gas path trend diagram. Figure 6 shows the internal schematic diagram of a CO analyzer. In this figure, the staff on duty can judge whether the instrument is working normally according to the operating status of the instrument, and timely maintain the operating status of the instrument to ensure the accuracy of the data. It also has real-time trend interface, showing the real-time monitoring curve of pollutant concentration, reporting interface and real-time releasing interface. Through these interfaces, we can sense the external changes of the substation in real time, helping the staff quickly make a judgment.

Conclusions
This paper introduces the real-time database into the air quality automatic monitoring system, presents an outline design in the overall structure, network topology and function design and set up the structure of substation and central station based on the application of real-time databases. The system is operated on IWS real-time database software platform, realizing the function of air monitoring system, and improve the stability and reliability of data collection, real-time monitoring ability and data interaction ability. At present, there are still some defects in the system. For example, the intelligence of the system in the decision-making level is not enough, a large number of collected data lacking of data cleaning, sorting, mining, analysis and other deep processing means. In the future, it still needs new technique such as deep learning to improve the data perception and processing capabilities.