Design of Intelligent Management and Service System for Gas Valve

Xiaoli Wang* , Feifei Wang** , Yuhou Song* , Guirong Zhang* and Shaohui Wang*


Abstract: This paper introduces a design scheme of intelligent gas valve management and service system based on Internet. This scheme adds sensor and general packet radio service (GPRS) modules to the traditional gas valve and establishes communication connection between gas valve and the server through wireless packet communication technology, which makes the traditional gas valve have the networking ability. Compared with the traditional gas valve management and service business, the method proposed in this paper is more convenient and efficient.

Keywords: Gas Valve , Intelligent Management and Service System , Server

1. Introduction

At present, the research on the gas pipeline network infrastructure has made a lot of achievements, and the effectiveness has been verified in practice [1]. With the construction of smart city, automatic meter reading technology gradually replaced the traditional meter reading technology, especially electric meter reading technology has been popularized and promoted [2]. In recent years, gas appliance manufacturers use general packet radio service (GPRS), Bluetooth, Wi-Fi, non-contact radio frequency identification (RFID) and other technologies to transfer the sensor data from the gas valve to the host computer or the server. It has gradually become a trend to process, analyze, share and display the data with the Internet [3-5]. In recent years, the development of Internet of things and cloud computing technology provides a more convenient and efficient way for remote control and real-time processing of a large number of natural gas data. In addition, the safe and stable cloud technology reduces the labor cost of traditional gas management mode, which meets the rapid development of production and living demand [6]. On the other hand, as the center of system data storage and processing, the reliability of database directly determines the performance of the whole system [7].

Traditional gas valves use mechanical or electronic devices to close, open and regulate the gas flow in the pipeline, so there are risks such as gas leakage and abnormal operation of appliances. At present, some manufacturers have installed gas detection and alarm devices on gas valves. These detection devices detect the concentration of combustible gas in the surrounding environment through gas sensors. When the set value is reached, the alarm device will send out to remind the user [8,9]. However, when the gas detection alarm device alarms, but no one at home to deal with it in time, there will still be security risks. This paper will combine the Internet technology and provide a set of intelligent gas valve management and service system design scheme to solve problems on gas security and convenience.

The research of intelligent instrument and remote meter reading has made a lot of progress. With the development of American economy and the improvement of urbanization rate, the concept of automatic meter reading was put forward in 1980s [10]. Biranjeav and Lokhande [11] proposed a smart meter used by a 32-bit low-power ARM chip. It automatically collects data and uploads to a data center server. Compared with the conventional meter, this program obtains more accurate data. The entire system provides many functions: billing management, power parameter monitoring and remote-control valve. At the same time, the program can also be extended to the water meter, gas meter and thermometer meter system. Ladarat and Naetiladdanon [12] use the advanced metering infrastructure (AMI) system to realize the intelligent meter reading and efficient management of the power authority of Thailand, which has contributed to the implementation of the National Smart Grid. Gallo et al. [13] proposed both region-based and maximally stable extremal regions techniques, during the phase involving the localization of the meter area and to detect the meter counter digits in the detection step, respectively. It is of great significance to change traditional gas meter to intelligent gas meter.

This paper will combine the Internet technology and provide a set of intelligent gas valve management and service system design scheme to solve problems on gas security and convenience. The rest of this paper is organized as follows. Section 2 gives the hardware architecture scheme of the system. Section 3 starts with a design scheme of database server. Real-time server is designed in Section 4. Sections 5 and 6 describe the design of web server and mobile terminal server, respectively. Conclusions and remarks on possible further work are given finally in Section 7.

2. Hardware Architecture

In order to build the intelligent gas system, it is necessary to refit the traditional gas valve, including installing GPRS module and gas data acquisition module composed of multiple sensors on the gas valve. These modules are used to collect the pressure and temperature data of the valve, and transmit the data to the real-time server through wireless packet communication technology. The real-time server analyzes the data according to the predetermined communication protocol, and then transmits the data to the database server for storage, or transmits the gas valve flow regulation command back to the gas valve through wireless packet communication technology to operate the gas valve. When installing or repairing the gas valve, engineers can record the installation and maintenance data through app and upload it to the mobile terminal server. The equipment installation and maintenance data will be processed on the mobile terminal server, and then transmitted to the database server for storage. Users and staff can access the web server through the web browser to query, analyze or process the gas data. The hardware architecture of the whole system is shown in Fig. 1.

Fig. 1.
System hardware architecture.

3. Design of Database Server

This system’s database server is consisted of the Swedish MySQL AB company’s free product MySQL 5.6 and Hong Kong PremiumSoft’s paid product Navicat for MySQL. There are two reasons for choosing MySQL software as database management system. On one hand, it is that the combination of these two products can reduce the economic cost of the system operation. On the other hand, there are many mature reference cases about the combination of these two products which brings convenience for early development and post-maintenance [14,15].

3.1 Dual Server Hot Backup

To ensure that the database server is still able to quickly recover and continue to provide data exchange services in case of emergency such as the power cut-out, being hacked by hackers, hardware and software failures and other unforeseen circumstances, the system uses dual server hot backup program on the database servers configuration. The biggest advantage of this strategy is that the switch between the two database servers is automatic and does not need too much manual intervention.

The principle of dual server hot backup is that a database server plays as an active role, and another database server plays as a standby role. In the normal working state, the primary server is in the working state, and the standby server is in the ready state. At this time, the data received by the system is auto¬matically synchronized to the standby server when it is written to the active server. The communication between the two servers is established through TCP/IP heartbeat mechanism. When the primary server is unexpected, the system can automatically switch the data server to make the standby server work.

In order to ensure that the data on the two servers are consistent before automatic synchronization, it is necessary to synchronize the existing data from the primary server to the standby server. First, the server ID in the MySQL configuration file is set to the IP address of the corresponding server, and then restart the two servers. Finally, add a backup server to the active server that is the standby server, and set the standby server mode to Slave.

In order to realize the automatic switch between the two database servers, it is necessary to establish a heartbeat signal between the primary server and the standby server. When the heartbeat between two database servers is periodic and stable, it indicates that both servers are running normally. When the heartbeat signal stops, it indicates that the master server has encountered an unexpected situation. When the system is working, it judges the status of the current master database server by monitoring the heartbeat signal status between the two data servers. When the primary data server is abnormal, the system will replace the original primary server with the standby data server as the active server, and then switch the two servers back to the initial state after the operation and maintenance personnel eliminate the fault of the active server and recover the heartbeat signal.

3.2 Design of Database Forms

To obtain better retrieval performance, the database uses MyISAM engine because the frequency of queries and reads is higher than the frequency of writes and updates. Compared to the transaction system using InnoDB engine, the system using MyISAM engine to implement numerous SELECT query opera¬tions is able to effectively improve the retrieval speed.

In order to reduce the duplication of data in the form and the coupling between forms, the database form is divided into account information, equipment information, address information, billing informa¬tion, log information, and so on. At the same time, each part is subdivided into various forms according to the business needs.

The account information part includes five forms such as administrator information, business personnel information, engineering personnel information, user information and account authority information. The appliance information part includes seven forms which are gas valve information, maintenance and replacement information, operation information, fault information, GPRS module information, user re¬pair information and appliance life information. The address information part includes four forms: city information, regional information, cell information, and area coding information. The billing information part includes two forms: payment record information and charging rules information. The log information part includes login log information and sensitive operation log information.

This paper takes two methods to further improve the query speed of the form. First, set different fields as indexes under different constraints. Specifically, according to the specific business, the system sets the account field in the account information part, the gas valve ID field in the home appliance information part, the address code field in the address information part, the payment bill number field in the billing information part, and the time field in the log information part as the index. In order to compare the impact of adding index and not adding index on query speed, this paper designs a query test experiment, and the results are shown in Table 1.

Table 1.
Effect of adding indexes on query speed

Secondly, in order to solve the problem of slow query speed caused by too much data in the form, this paper adopts the strategy of setting different sub tables. Since GPRS module will regularly update the gas valve information, it can calculate and predict the amount of data to be generated in the related form, and then dynamically create a related form every month to solve the problem.

In this way, on the one hand, it can limit the amount of data in a single table to a certain extent; on the In this way, on the one hand, it can limit the amount of data in a single table to a certain extent; on the other hand, it is convenient to query historical information by month. In addition, it is difficult to accurately predict the amount of dynamic information such as account information and log information, so it is not feasible to use the time-based dynamic table building strategy. For this kind of dynamic data with strong randomness, if the amount of data exceeds the current upper limit, the system will create a new form for the data as a sub table.

4. Design of Real-Time Server

4.1 Load Balancing and Concurrent Communication

Under the real conditions, the maximum communication concurrency on the real-time server is deter¬mined by both hardware and software of the system. To ensure that a large number of concurrent com¬munications between GPRS modules and real-time server can be carried out reliably and stably, this paper proposed three methods according to the method of grouping in the field of image processing [16,17]. Firstly, it can limit the maximum load per real-time server. In this system, each real-time server limits up to 100,000 GPRS modules to communicate. In other words, a fixed IP address of a real-time server is used for every 100,000 gas valves. Secondly, it can improve the maximum communication concurrency on the real-time server from the business. 100,000 GPRS modules are divided into 200 groups, and each group are set a different upload time. There are two advantages: first, it can make full use of the server without wasting computing resources; second, it can achieve load balancing because centralized communication is distributed to different times of the day. Finally, in order to solve the problem of each real-time server at the same time up to 500 TCP/IP socket links, this paper use Java non-blocking IO (NIO) technology which is an API provided by jdk1.4 and above. Compared with the conventional blocking IO (BIO) technology, NIO technology can effectively solve the multi-link concurrency problems. Table 2 lists the test results which is obtained by writing client code to simulate the upload data in multiple GPRS modules. It can be seen that using the NIO technology can greatly improve the number of concurrent communication and reach the 500 TCP/IP socket links expected.

Table 2.
Concurrency test of BIO and NIO
4.2 Design of Communication Protocol

In order to establish the communication between the GPRS module and the real-time server, it is necessary to analyze the data uploaded and transmitted according to the communication protocol. The data frame format of the communication protocol designed in this paper is shown in Table 3.

Table 3.
Data frame format for gas valve GPRS module and real-time server communication

Where SOF represents the start of the data frame, and the fixed value is 0x85. EOF represents the end of the data frame, and the fixed value is 0x8A. ADDR is a 5-bytes binary-coded decimal ‎(BCD) representing the address ID. The high bit is in the former and the low bit is in the post when an address ID is transmitted. CMD represents the command of the data, and different commands achieve different functions. LEN represents the length of data. CS verifies whether the error occurred during the current data frame transmission. The verification method is used by accumulating all bytes from SOF to CS without counting an overflow value of more than 0xFF, and it compares all these bytes with the CS to determine whether these two values are consistent.

When the operation information of gas valve is uploaded, CMD is 0x80; LEN is 0x13; and DATA is shown in Table 4.

Table 4.
Upload data content of gas valve operation information

When the abnormal information of gas valve is uploaded: CMD is 0x81; LEN is 0x01; and DATA indicates abnormal states information. Each bit of DATA represents the abnormal state shown in Table 5, where 0 is set as normal state, and 1 is set as exception state. When the abnormal state of gas valve is released, the corresponding data will be uploaded. At this time, CMD is 0x82 and the remaining fields are the same as the uploaded information when the exception occurs.

Table 5.
Upload data content of gas valve abnormal information

The real-time server is able to send command to set gas valve standard time. At this time, CMD is 0x01; LEN is 0x07; and DATA represents the server standard time. The server can also send a self-check command to gas valve. After the gas valve receives this command, it will upload the operation information. If the gas valve is in an abnormal state, the fault message will be uploaded simultaneously. At this time, CMD is 0x02, LEN is 0x00 which means that there is no need to include any data.

4.3 Design of Heartbeat Mechanism

The purpose of establish heartbeat mechanism between the real-time server and the gas valve GPRS module is the same as what have done between two database servers. It is a prerequisite to ensure the normal communication between them. If no heartbeat signal is received between the two ends, it indicates that there is a problem in the communication line or one of the servers. At this point, it is necessary to remind the operation and maintenance personnel to carry out the investigation. The design of heartbeat signal format follows Section 4.2. The start and end flags of the heartbeat signal are 0x85 and 0x8A. The CMD and 0x83 is the identification mark of heartbeat signal. Since the data has only one byte, the LEN is 0x01. In the process of communication between the gas valve GPRS module and the real-time server, the real-time server is used as a master device while the GPRS module is used as a slave device. In the process of dual server hot backup between two database servers, the active server is used as a master device while the standby server is used as a slave device. The DATA is 0x55 when the master device sends a heartbeat signal to the slave one, and the DATA is 0x5A when the slave one responds to the heartbeat signal. The ADDR is not changed during whole heartbeat process.

5. Design of Web Server and Mobile Terminal Server

5.1 Struts, Spring and Hibernate Framework

The Web server is built by Struts, Spring, and Hibernate (SSH) framework. The mature framework draws on the classic Model+View+Controller (MVC) design pattern which is a kind of three-tier archi¬tecture. MVC can be used for data exchange, content display and business logic of web server. It can increase the reusability of code and the flexibility of combination among functional modules. However, in the process of actual development and maintenance, the workload is still heavy. Therefore, this paper uses SSH framework to build web server, which can retain the above advantages and reduce the code complexity.

By predicting the maximum flow of the system, a suitable hardware server is selected as the Web server carrier. The hardware of web server is consisted of an Intel Xeon E5-2609 processor, a 32-GB memory and a 1-TB 7200 RPM mechanical hard disk. The software of web server is consisted of Windows Server 2008 as operating system, MyEclipse 2014 and Tomcat7 as development and running environment.

5.2 Multi-level Operation Authority

In order to meet the different needs of different roles, the system is divided into four levels: administrator, business personnel, engineering personnel, and user. Different roles use different types of accounts to log into the system website. The website can provide different services and functions according to different roles. The operation authority division and the corresponding functions are shown in Fig. 2.

Fig. 2.
The operation authority division.

After users login the website, they can query and modify some of their account information and pay for GPRS data traffic. They can also report the situation of gas valve which is in the fault state or exists security risks, and query gas valve fault records and switch records by time. In addition, the system can also detect valve temperature, air pressure, battery voltage and other current status. Engineering personnel can not only query the identity information and electrical information of some users within their juris¬diction through the website, but also view the installation and maintenance records and various report statistics. After logging in to the website, business personnel can complete all operations of engineering personnel, and can also make charging rules, query fault alarm records, remote operation of gas valve and other operations. Administrators can use all the above functions, but also can manage the operation rights.

6. Design of Mobile Terminal Server

The mobile terminal server of this system is only used in the installation and maintenance by engineering personals. The Servlet is used to communicate with application (app), which can not only shorten the development time to reduce economic cost, but also can reliably ensure the realization of data entry function. App and database server interaction principle is shown in Fig. 3. Engineering personals send data from Android client to mobile terminal server by mobile communications network. Then the mobile terminal server receives and processes data by Servlet, and insert data into database server by Java database connectivity (JDBC) technology to prepare for web server.

Fig. 3.
App and database server interaction principle.

This system uses eclipse software to develop an app on the client side to provide services for engineers. When the engineering personals install new valve, repair and replace bad valve, they can use the app to record and upload relevant information immediately, and write to database server from mobile terminal server for storage. Compared with the conventional paper registration and manually information input, this method is more convenient to operate and more conducive for information management.

7. Conclusion

The intelligent gas valve management and service system includes two parts: client and server. The client can be divided into web browser and Android app. Web browser is the primary provider of system functions and services. Administrators, business personals, engineering personals and users can login and use the system by web browser on the local computer. Android app which is used by engineering personals can input user information, installation information, maintenance information and replacement information. The gas valve adopts GPRS module to transmit the data collected by temperature sensor, pressure sensor and other sensors to the real-time server. The gas data is processed on the real-time server and then stored in the database server. Web server establishes a connection with database server and provides services to administrators, business personals, engineering personals and users. Mobile terminal server receives data from Android app. This design scheme integrates the use of gas valve, the safety of gas the analysis of appliance data and the payment of users into a system based on the Internet of Things. Compared with conventional business processes, this system is more convenient, economical and efficient. However, there are some deficiencies in this system. For instance, when the system is used for larger customer groups or wider geographical areas, it needs to use other load balancing and concurrent processing methods such as adding a content delivery network (CDN) server and a reverse proxy server in front of the real-time server, adding a cache server in front of the database server, separating data reading and writing to different database servers, and so on. These problems will be studied and solved in the future.


Xiaoli Wang

He received his B.S. degree in electronic information science and technology and his M.E. degree in circuits and systems from Shandong University, Weihai, China, in 2002 and 2008, respectively. He is currently a senior experimentalist in the School of Mechanical, Electrical and Information Engineering, Shandong University, Weihai, China. His current research interests include micro-grid and embedded system development.


Feifei Wang

She received his B.S. degree in electronic information science and technology and his M.E. degree in circuits and systems from Shandong University, Weihai, China, in 2009 and 2012, respectively. She is currently a software engineer in Jinan Glory & Co-creative Power Tech Co. Ltd. Her current research interests include power system automation.


Yuhou Song

He received his B.S. degree in radio electronics from Shandong University, China, in 2003, and his M.E. degree in communication and electronic systems from Shandong University, China, in 2007. He is currently the deputy director of the asset and laboratory management office of Weihai Campus of Shandong University. His current research interests include smart grid technology.


Guirong Zhang

He received his bachelor of engineering degree from Harbin University of Technology, China, in 2015, and his M.E. degree in communication and electronic systems from Shandong University, Weihai, China, in 2018. He currently works in Hangzhou Hikvision Digital Technology Co. Ltd. His current research interests include ETC receivable no leakage technology, micro service component security technology, etc.


Shaohui Wang

He received his B.S. degree from Shanxi Agricultural University, China, in 2015, and his M.E. degree in communication and electronic systems from Shandong University, Weihai, China, in 2018. He currently works in the network management software development post of Nanjing Zhongxing New Software Co. Ltd. His current research interests include signal and information processing, network management software development.


  • 1 S. Talari, M. Shafie-khah, P. Siano, V. Loia, A. Tommasetti, J. Catalao, "A review of smart cities based on the Internet of Things concept," Energies, vol. 10, no. 4, 2017.custom:[[[-]]]
  • 2 X. Deng, Z. Li, J. Zhang, L. Huang, "The development and operation of integrated automatic meter reading system in Shanghai," in Proceedings of 2016 IEEE PES Asia-Pacific Power and Energy Engineering Conference (APPEEC), Xi’an, China, 2016;pp. 1675-1678. custom:[[[-]]]
  • 3 P. Shao, Z. Wang, B. Zhang, "Mobile Internet Oriented Smart Home Systems," Computer Measurement & Control, vol. 20, no. 2, pp. 474-479, 2012.custom:[[[-]]]
  • 4 D. Alahakoon, X. Y u, "Smart electricity meter data intelligence for future energy systems: a survey," IEEE Transactions on Industrial Informatics, vol. 12, no. 1, pp. 425-436, 2016.doi:[[[10.1109/TII.2015.2414355]]]
  • 5 J. Cui, Z. Duan, Z. Qi, Y. Gong, X. Lian, "Remote control system of gas boiler based on internet of things cloud platform," Computer Systems & Applications, vol. 24, no. 9, pp. 56-60, 2015.custom:[[[-]]]
  • 6 I. Jawhar, N. Mohamed, J. Al-Jaroodi, "Networking architectures and protocols for smart city systems," Journal of Internet Services and Applications, vol. 9, no. 1, 2018.custom:[[[-]]]
  • 7 D. K. Rawal, M. Ram, V. V. Singh, "Modeling and availability analysis of internet data center with various maintenance policies. International Journal of Engineering, vol. 27, no. 4, pp. 599-608, 2014.custom:[[[-]]]
  • 8 A. R. Trudel, M. Barbulescu, Y. N. Tong, "Fault gas alarm system," US Patent 8836523Sep 16, 2014.custom:[[[-]]]
  • 9 Z. Shao, Y. Quan, H. Xiang, Y. Wu, "Safety shutoff remote smart gas meter," WIPO (PCT) 2015043351Apr 2, 2015.custom:[[[-]]]
  • 10 A. Mahmood, M. Aamir, M. I. Anis, "Design and implementation of AMR smart grid system," in Proceedings of the IEEE Canada Electric Power Conference, V ancouver, Canada, 2008;pp. 1-6. custom:[[[-]]]
  • 11 A. Biranje, S. S. Lokhande, "Wireless ARM-based automatic meter reading & control system (WAMRCS)," in Proceedings of 2015 International Conference on Pervasive Computing (ICPC), Pune, India, 2015;pp. 1-6. custom:[[[-]]]
  • 12 W. Ladarat, S. Naetiladdanon, "PEA automatic meter reading system: progress and lessons learned," in Proceedings of the 12th International Conference on Electrical Engineering/Electronics, Computer, Telecommunications and Information Technology (ECTI-CON), Hua Hin, Thailand, 2015;pp. 1-5. custom:[[[-]]]
  • 13 I. Gallo, A. Zamberletti, L. Noce, "Robust angle invariant gas meter reading," in Proceedings of the 2015 International Conference on Digital Image Computing: Techniques and Applications (DICTA), Adelaide, Australia, 2015;pp. 1-7. custom:[[[-]]]
  • 14 R. Li, J. Wang, "Application of MySQL database in automatic test systems," Journal of Computer Applications, vol. 31(Suppl. 2), pp. 169-171, 2011.custom:[[[-]]]
  • 15 C. Wu, Y. Lan, H. Zhang, "MySQL database-based optimization," Electronic Science & T echnology, vol. 26, no. 9, pp. 182-184, 2013.custom:[[[-]]]
  • 16 C. Yan, B. Gong, Y. Wei, and Y. Gao, IEEE Transactions on Pattern Analysis and Machine Intelligence, 2020.,
  • 17 C. Yan, B. Shao, H. Zhao, R. Ning, Y. Zhang, and F. Xu, IEEE Transactions on Multimedia, 2020.,

Table 1.

Effect of adding indexes on query speed
Data amount in form [TeX:] $$10^{5}$$ [TeX:] $$10^{6}$$ [TeX:] $$8 \times 10^{6}$$ [TeX:] $$1.5 \times 10^{7}$$
Average query time with indexes (s) 0.12 0.19 0.48 0.62
Average query time without indexes (s) 0.21 0.83 4.38 15.98

Table 2.

Concurrency test of BIO and NIO
First test Second test Third test Fourth test Fifth test
Using NIO 635 612 598 624 579
Using BIO 57 57 42 61 46

Table 3.

Data frame format for gas valve GPRS module and real-time server communication
Description Start of frame Address ID Command Length Data Check sequence End of frame
Length (byte) 1 5 1 1 Uncertain 1 1

Table 4.

Upload data content of gas valve operation information
Opening time Closing time Pressure Temperature Battery voltage Timing
Unit Pa [TeX:] $${ }^{\circ} \mathrm{C}$$ V Minute
Examples 07E00313131C 07E00313141C 09C4 1E 23 0078
Content 2016-03-19 19:28 2016-03-19 20:28 2500Pa [TeX:] $$30^{\circ} \mathrm{C}$$ 3.5V 120 minutes

Table 5.

Upload data content of gas valve abnormal information
Bit1 Bit2 Bit3 Bit4 Bit5 Bit6 Bit7
Description Gas leakage Temperature exceeded Traffic exceeded Not closed Battery undervoltage Connection failure Other failures
System hardware architecture.
The operation authority division.
App and database server interaction principle.