Optimization and Simulation of Atmospheric Environment Monitoring System Based on Wireless Sensor

With the acceleration of urbanization, the problems in urban construction are becoming increasingly prominent, especially in air pollution. In order to deal with a series of problems brought by urbanization, the state has formulated the strategic layout of smart city construction. As an important measure and practice for the development of smart city, atmospheric environment monitoring is the premise of controlling atmospheric environment problems and plays a great role in environmental protection. The traditional automatic atmospheric environment monitoring station has complex structure, expensive price, and harsh working conditions, which is di ﬃ cult to be popularized throughout the country. Aiming at the problems of poor expansibility and low intelligence of atmospheric environment monitoring system, an atmospheric environment monitoring system based on wireless sensor network is proposed. The system designs sensor module, networking module, gateway module, and monitoring interface, studies the accuracy of data collected by the system and the coverage of wireless sensor network, ﬁ lters the environmental data collected by the sensor module, optimizes the layout of networking module by using improved virtual force algorithm, and ﬁ nally tests the system. The experimental results show that the system realizes the remote monitoring of temperature, humidity, air pressure, and PM2.5 data, and the monitoring data is real and reliable. The improved virtual force algorithm improves the coverage of wireless sensor networks. Comparing the data collected by the system with the monitoring data of the cause control station, the average relative errors of PM2.5 and other particle parameters and NO x and other gas parameters monitored by the system are 3.81% and 3.48%, respectively; the system can be widely used in various environmental monitoring ﬁ elds.


Introduction
Atmospheric environment monitoring is the basis of environmental protection, and its purpose is to provide scientific decision-making basis for environmental protection. The equipment used in the traditional manual sampling laboratory analysis method is relatively simple. The environmental monitoring personnel place the corresponding gas absorption solution as required for a certain time at the site to be monitored, take the absorption solution back to the laboratory, and react with a certain reagent to form a precipitate [1]. By weighing the mass of the precipitate, calculate the average concentration of a certain gas at the monitoring site in a period of time. Although the equipment and operation used in this method are very simple, it has many disadvantages. It can only get the average concentration of the mon-itored gas at the monitoring site in a period of time, the realtime value cannot be provided, and the monitoring results are greatly affected by man-made [2]. When monitoring the site with high harmful gas concentration, placing gas absorption liquid on the site will seriously damage the health of environmental monitoring personnel. This monitoring method is generally only used in small cities and poor and remote areas, the automatic atmospheric environment monitoring station is used to monitor the atmospheric environment quality, and the concentration data of SO 2 , NO 2 , and total inhalable particulate matter can be collected in real time [3]. The automatic atmospheric environment monitoring station has the characteristics of accuracy, sensitivity, and high resolution, but it also has the defects of complex equipment structure, high price, low localization rate, difficult maintenance, and high operation cost, which is difficult to popularize throughout the country [4]. At present, only large cities and their surrounding areas use this method to monitor the atmospheric environment. At the same time, its working environment is harsh, and the main equipment needs to be placed in a constant temperature machine room. It is difficult to meet the requirements on the general environmental monitoring site, and it is difficult to move again once the station location is determined, which limits its ability to monitor the atmospheric environment in the field, vast rural areas, remote areas, factories and mines, and other target areas [5]. Particularly for the monitoring of sudden atmospheric environmental pollution events such as toxic and harmful gas leakage, the automatic atmospheric environmental monitoring station is even more inadequate. In the face of such sudden atmospheric environmental pollution events, environmental monitoring personnel have to adopt the method of manual sampling and laboratory analysis at the emergency site for monitoring; this not only endangers the health and safety of environmental monitoring personnel but also the monitoring results have serious lag, which is difficult to meet the emergency needs of sudden atmospheric environmental pollution events.
The atmospheric environment monitoring system based on wireless sensor network is designed to deal with the shortcomings of the existing atmospheric environment monitoring equipment. Taking the advantages of the two atmospheric environment monitoring methods, it effectively meets the needs of the environmental monitoring department [6]. Environmental monitoring personnel only need to arrange sensor nodes at the site prone to atmospheric environmental pollution events, so they can monitor the concentration of various polluting gases at the site of pollution emergencies in real time, so as to provide a strong technical guarantee for the timely disposal of atmospheric environmental pollution emergencies. The network architecture of wireless sensor network is developed from a function called "perception" back. This network system not only collects and quantifies data but also stores, calculates, and transmits the collected information, so that the monitoring personnel can make timely measures by observing the processed information [7]. Different from general sensors, the installation of wireless sensors can be adapted according to the local geographical environment. More effective monitoring can be carried out in areas where line placement and power supply are difficult and areas where construction personnel work hard (such as rugged mountains, environmental pollution areas, and ecological protection areas). Wireless sensor has no dependence on fixed network and can set up a fast network by itself [8]. The data collected in real time is transmitted through the wireless network built between nodes, which can improve the transmission of the whole system by one level compared with the original and strengthen the defines against natural disasters. This paper mainly focuses on the software design, hardware design, and partial implementation of the optimization and simulation of wireless sensor network in an atmospheric environment monitoring system. The chapters of the paper are arranged as follows: the first section describes the background of the topic of the paper, analyses the shortcomings, disadvantages, and improvements of atmospheric environment monitoring technology, and briefly introduces the innovation of this paper. The second section discusses the related work and analyses the development status of wireless sensor networks at home and abroad. In the third section, the atmospheric environment detection system based on wireless sensor network is designed. In the fourth section, the atmospheric environment monitoring system is tested and simulated. The fifth section summarizes the full text.

Related Work
The atmospheric environment monitoring system is an automatic measurement and control system with automatic monitoring instruments as the core. The atmospheric environment monitoring system based on wireless sensor network is designed to deal with the shortcomings of the existing atmospheric environment monitoring equipment [9]. Taking the advantages of the two atmospheric environment monitoring methods, it effectively meets the needs of the environmental monitoring department. Environmental monitoring personnel only need to arrange sensor nodes at the site prone to atmospheric environmental pollution events, so they can monitor the concentration of various polluting gases at the site of pollution emergencies in real time, so as to provide a strong technical guarantee for the timely disposal of atmospheric environmental pollution emergencies [10]. Atmospheric environment monitoring system based on wireless sensor has received extensive attention and development in recent years. In recent years, there have been many advances in the application research of an atmospheric environment monitoring system, some of which are as follows.
Relevant scholars have proposed an intelligent sensor monitoring system for studying air quality and human life comfort to monitor indoor air environment quality and achieved good application results. At the same time, it is demonstrated that good air quality has a positive impact on human health, safety, and emotion [11]. Ventostat 8000 series new products designed by GE sensing and detection technology company can simultaneously monitor the temperature, humidity, and various gas pollutants in the monitoring environment in real time, which brings great convenience to managers. At the same time, Philips is also committed to the production and R&D of atmospheric environment monitoring and purification equipment [12]. The product can effectively remove formaldehyde, allergens, and other harmful gases in the air by detecting various chemical substances harmful to human health in the atmospheric environment and using the air purification device to purify the detected harmful gases. At the same time, the product also has the functions of humidifying and filtering bacteria [13].
Researchers proposed the first step scheme for wireless sensor design, which provides a theoretical basis for the long-term study of rare and endangered organisms. By monitoring bioclimate and climatic factors, the program helps to understand the reasons why a species becomes rare and also gives feasible remedial measures [14]. The system mainly 2 Journal of Sensors measures the environment through wind, humidity, brightness, and temperature sensor nodes and collects the required data, so as to provide data for software analysis. Sensor nodes can be camouflaged by a shell, or they can be masked in areas such as trees [15]. Researchers at the University of Hawaii deploy a large number of sensor nodes to collect the required data and investigate the various conditions of such a wireless sensor network during operation through a large amount of data. In order to increase the communication range of the sensor, the researchers placed the sensor node two meters away from the ground plane. In order to reduce the network traffic in the sensor network, they do not use the way of real-time data transmission but use the form of an exception report. When the data value collected by the sensor exceeds the expected value, they will send this exception report for alarm. In order to reduce the energy consumption of the whole sensor network, researchers put forward the design scheme of supplying and consuming information storage. The scheme to reduce energy consumption mainly adopts the radio transmission mode, turns off the radio as much as possible, and selects the processor chip with the lowest energy consumption. The supply of sensors comes from the storage of power and energy, and researchers prepare energy in the form of solar and wind power and then store electric energy through alkali cells [16]. In the communication of sensor networks, the main energy is focused on the research of routing protocol and transmission protocol.

Design of Atmospheric Environment
Monitoring System Based on Wireless Sensor Network 3.1. Overall Design Principles of the System. Environmental monitoring is a kind of typical sensor network application. Compared with traditional environmental monitoring methods, the use of sensor network technology for environmental monitoring needs to reflect the following advantages and characteristics: first, the volume of sensor nodes should be very small and easy to deploy, so that the human impact of deploying sensor networks on the environment is very small, and it is easy to deploy to areas with difficult wiring and power supply areas inaccessible to personnel and some temporary occasions. Second, the number of sensor network nodes is large and the distribution density is high [17]. Each node can detect the detailed information of the local environment and summarize it to the base station. Therefore, the sensor network has the characteristics of large amount of data acquisition and high precision. Third, sensor nodes should have certain computing power and storage capacity, can carry out more complex monitoring according to the changes of physical environment, have wireless communication ability, and can carry out collaborative monitoring among nodes [18]. By increasing the battery capacity and improving the battery efficiency, and using a low-power wireless communication module and wireless communication protocol, the life cycle of sensor network can last for a long time to ensure the practicability of sensor network.
Fourth, we should have advanced technology and complete functions [19]. When planning and designing, the system should adopt advanced technology, choose advanced equipment, and maintain the advanced nature of the system. In function design, it should consider signal collection and monitoring: information management and comprehensive analysis. Fifth, it should be reliable and easy to expand. The environmental monitoring system based on wireless sensor network technology is an online monitoring and management support system. Whether the system works normally or not is directly related to the evaluation of monitoring performance and the online diagnosis of equipment working state. Therefore, the system is required to work reliably, and reliability should be placed in an important position in planning and design. At the same time, considering the large scale and multiple functions of the future monitoring and information management system, the system scale should be easy to expand. Figure 1 shows the overall structure of the environmental monitoring system based on wireless sensor network technology. The bottom layer is the sensor node deployed in the actual monitoring environment, followed by the transmission network, base station, and finally connected to the internet. In order to ensure the accuracy of data and the robustness of the system, a large number of sensor nodes are densely distributed in several nonadjacent monitoring areas to form multiple sensor networks. The sensor node can self-organize to form a network and transmit the data to a gateway. The gateway node sends the data transmitted by the sensor node to the base station through the transmission network. The transmission network is a local network responsible for the gateway nodes of each sensor network and integrating the information of the gateway nodes. The base station is composed of a wireless node responsible for data aggregation and a computer that can access the internet to complete data transmission and monitoring of network status [20]. At the same time, it is also responsible for your data processing and storage. The base station or any computer connected to the internet can be used as a data server. Any terminal connected to the internet can access the data server or send commands to the base station.
Sensor nodes independently form a multihop network. Nodes at the edge of the sensor network must send data to the gateway through other nodes. Each sensor area has a gateway responsible for collecting data sent by sensor nodes. All gateways are connected to the upper transmission network, the transmission network includes multiple wireless communication nodes with strong computing power and storage capacity and UPS supply, which provides communication bandwidth and communication reliability between gateway nodes and base stations. The sensor network is connected to the Internet through a base station, and the base station is responsible for collecting all the data sent by the transmission network, sending it to the Internet, and saving the log of the sensing data to the local database [21]. According to the requirements of data reliability in practical applications, the data collected by sensor nodes can be transmitted to a central database through the Internet, and the central database provides remote data services.

Structure of Wireless Sensor Network
Nodes. The monitoring of atmospheric environment has the characteristics of wide monitoring range, long monitoring time, and complex monitoring situation. Therefore, a large number of communication nodes need to be arranged in this case. In this kind of sensor network, the node has the dual functions of routing information and sending and receiving information. Collecting, receiving, processing, and sending data will be carried out at the same time, and the data transmitted by the sensor node should be stored, classified, and aggregated. At the same time, it works in cooperation with other sensor acquisition nodes. The gateway node is mainly used to convert the high-level network protocol of the application layer and connect two or more independent networks. Gateway node realizes the interconnection between application layer networks. It is the most complex node in the whole wireless sensor network. Its function is to connect devices with different network communication protocols. Gateway can realize the function of network connection not only in Wan but also in LAN. It is a very important protocol conversion device for wireless sensor networks [22]. The gateway node interconnects two different communication networks and plays the function of protocol conversion, so that the systems with different network protocols, information transmission formats, and wireless network communication structures can communicate. It is more complex than the function of the    Journal of Sensors bridge. The bridge only forwards the data, and the network node needs to reanalyse, arrange, and package the data format in order to interconnect with other networks. The gateway node used for communication protocol conversion in wireless data acquisition node network is more complex in function and structure than the gateway node of ordinary sensors. The information communication between the monitoring centre server and the wireless communication acquisition node in the monitoring area needs to be realized by the gateway node [23]. The data forwarding centre of the wireless communication acquisition node network and information processing equipment is responsible for forwarding the instructions sent by the data processing terminal to the wireless sensor network, receiving the data information sent by the lower wireless sensor network node to the data processing terminal, sorting the information, judging the request instructions, and routing the transmission line, and it plays the role of central control communication in the system with wireless sensor network. The location of the gateway node needs to process a large amount of information, so the node should have the ability of strong computing power, fast processing speed, large amount of stored data, and longdistance data communication [24]. Wireless sensor network nodes are generally composed of four parts: data acquisition unit, data processing unit, data transmission unit, and power supply unit. The data acquisition unit is responsible for collecting information in the monitoring area and completing data conversion. In this design, the data acquisition unit includes temperature, humidity, and light intensity sensors; the data processing unit is responsible for controlling the processing operation, routing protocol, synchronous positioning, power consumption management, etc., of the whole sensor network node. Figure 2 is the gateway node structure.

Workflow of Network
Nodes. The software part on the network node is mainly responsible for the acquisition and control of external data, radio frequency transceiver, and collection. The data packet is packaged according to the network protocol and then transmitted to the gateway node. The working mode of the network node follows sleep, wake-up, and normal operation. In the sleep state, the processor stops working, while the SRAM, SPI port, and interrupt system work normally, and the radio frequency transceiver unit is in the receiving state of low-power consumption. The software flow of network node is shown in Figure 3. The basic idea of system software programming is as follows: initialize SPI port and control port first; enable SPI port and UART port; initialize CC2510 chip; after the radio frequency transceiver module receives the instruction from the gateway node or adjacent nodes, the network node will be awakened. The processor judges the node number  Journal of Sensors according to the instruction. If the object of the instruction is the current node, the node will enter the working state. Otherwise, the network node will enter the sleep state after forwarding the instruction.
3.4. Software Design of Networking Module. The software design of networking module is realized on the basis of protocol stack. The coordinator node mainly constructs the network and receives wireless data and transmits the data to the gateway module through the serial port [25][26][27]. The terminal node finds out whether there is a network to join and joins the network; the receiving sensor module transmits the data wirelessly through the serial port. In order to reduce the energy consumption of network nodes, when there is no data, call the sleep function to make the system in the sleep state [16,28]. When there is data transmission, call the wake-up function to activate the nodes for data transmission. The program flow of networking module is shown in Figure 4

Test and Simulation of Atmospheric
Environment Monitoring System 4.1. System Practicability Test. After the software and hardware platform of the system are built, in order to ensure the normal operation of the system, the power and energy    Journal of Sensors of each part of the system are tested. Select a wide range of park green space for 6-day and 24-hour work test. The system function test mainly includes communication distance test, data acquisition test, and network data upload test.
The data sending and receiving in the environmental monitoring system is completely tested. The system can normally display the monitored environmental parameter information and judge the operation status of each component in the fresh air conditioning system, which greatly saves the time consumed by manual troubleshooting, eliminates faults in a very short time, and makes the equipment operate normally. Filter the data collected by the sensor module, and compare the algorithm with median filter and mean filter; after software filtering, the signal becomes smoother and more stable, filtering out some serious interference. This algorithm removes the sharp components in the signal and makes the data smoother.

Test of Monitoring Node Channel Transmission.
The reliability and stability of wireless signal propagation in complex field environment are very easy to be disturbed by the external environment, which is mainly manifested in that the transmission of wireless signal is easy to be disturbed and lost [22,[29][30][31]. For example, it is affected by the height and coverage density of vegetation, the height of transmitting and receiving nodes, environmental climate, and so on. The transmission of wireless signal in field environment is complex and changeable. In order to establish an efficient, stable, and reasonable wireless sensor network (WSN), it is necessary to measure the propagation and attenuation characteristics of wireless signals. The atmospheric environment monitoring system is mainly collected by the Zigbcc node of 2.4 GHz. Therefore, the intensity change law is tested with the test frequency of 2.4 GHz. In this paper, the park green space is selected as the test site. The terrain in the site is relatively flat.  Figure 5. It can be seen from Figure 5 that RSSI decreases with the increase of distance. When it is less than 500 m, the rate of reduction is faster, and the rate of attenuation decreases with the increase of distance. When the distance is the same and the height is 3 m, the RSSI is the largest, because it is at the top of the tree canopy at 3 m and the branches and leaves are sparse. The signal does not need to pass through the dense leaves and branches. Because the signal is less blocked by the leaves and branches, the RSSI is the largest. The attenuation rate is fast at the distance below 2 m. This is because the height of shrubs is about 1.5 m, and the main branches of trees are seriously shielded, so the RSSI attenuation is fast. It has attenuated to about -60 dbm at about 500 m. Through the analysis of experimental results, when deploying WSN in the field, the position slightly higher than the canopy item end should be the best height for placing the antenna, or the closer it is to the canopy item, the better.

Comparative Analysis of Monitoring Results of
Substations. In order to verify the effectiveness of the system, outdoor monitoring tests were carried out on three sensor nodes. Since PM2.5 were measured by particulate matter sensors, and the four parameters of NO 2 , SO 2 , O 3 , and CO were series industrial sensors of the same model, the parameters of NO 2 and PM2.5 in the three sensor nodes were selected for comparison. The experimental area is set as three areas, respectively. Sensor node 1 is arranged in a green park. Sensor node 2 is on the roadside of the street, and sensor node 3 is arranged near the boiler room. The two types of data of the three sensor nodes are monitored and compared daily, and the data of one day are collected at an interval of three hours, as shown in Figure 6.
In this test, the values of NO 2 and PM2.5 in the 24-hour period on August 25, 2020, were intercepted from the atmospheric environment real-time release system. As shown in Figure 7, comparing the test results with the updated data of the environmental master station, it can be seen that the change trend is consistent with the data monitored by the sensor node, indicating that the data collected by the system can accurately and reasonably reflect the actual pollution situation in the atmosphere.   Journal of Sensors to the interference of external noise, the bit error rate is a key performance index. When there are obstacles in the outdoor environment, the working voltage of the sensor network node is 2.8-3.0 v, and the measured data results are shown in Figure 8.
It can be seen from the figure that when the communication distance is 5 m, 10 m, 15 m, and 30 m, respectively, the indicators such as illumination, humidity, and temperature fluctuate slightly with the change of distance, but the overall change is small, indicating that the effect of monitoring these three indicators will not be significantly affected by the distance. With the distance getting farther, the bit error rate increases from 0.02% to 0.05%, indicating that the wireless communication is disturbed by external noise. The bit error rate is a key performance index, which needs to be paid attention to.

Conclusion
This paper summarizes the current environmental conditions and existing problems and points out the necessity of constructing the corresponding monitoring system. A design scheme of an atmospheric environment monitoring system based on wireless sensor is presented and simulated. The main work and innovations of this paper include the following parts: (1) An air quality monitoring system based on wireless sensor network is designed. Firstly, the requirement analysis and overall design of the system are made. The environmental information acquisition terminal collects the concentration information of various gas pollutants and dust and uploads the data to the mobile client and server through wireless network (2) The algorithm to improve the accuracy of air quality measurement in wireless sensor network is studied. From the demand analysis and overall design of the monitoring system to the design and implementation of each functional module, and combined with the accuracy requirements of air quality acquisition, an algorithm to improve the accuracy of air quality measurement based on Granger causality and multiple regression analysis is proposed; the purpose of timely and accurate monitoring of air quality is achieved (3) Although the system can monitor the atmospheric environment in real time, it needs to be further optimized and developed for its application in production practice. In the future, it needs to be further developed in the aspects of data acquisition terminal hardware, server-side and client-side stability

Data Availability
The data used to support the findings of this study are available from the corresponding author upon request.  Journal of Sensors

Conflicts of Interest
The author declares that they have no known competing financial interests or personal relationships that could have appeared to influence the work reported in this paper.