Abstract:
Abstract: The automatic irrigation control system based on web is a main trend of current water-saving technology development. In order to provide personalized irrigation control scheme and precise water metering, the system needs higher real-time data transmission performance. The real-time performance of web application is currently poor, and difficult to meet the needs of accurate irrigation control. Aiming at this problem, in this paper, the structure and bottleneck of real-time data transmission of web-based automatic irrigation control system was analyzed, and the data push scheme of improving the real-time performance was proposed. Based on observer pattern, the data push mode between data layer and logic layer, and that between logic layer and presentation layer were specifically designed. In the former data transmission process, the observed object is database table, and the observer is Web server monitoring program. After the data is inserted into the data table, the database immediately triggers the stored procedure to notify the relevant Web service program and executes updating data subject. In the latter data transmit process, the observed object is program object running on the Web server, and the observer is client program object running on the browser. Because the Web service program cannot directly initiate data connection to the client program. Therefore, in order to implement the observer pattern, it is essential to establish a real-time tow-way data connection in the client program loading process. Then through subscribing a group of data subjects, the client program can receive real-time data push as soon as the data subjects are updated. The connection between client and Web server is established and maintained by client connect request, then a streaming connection is evoked by client through which Web server streams data down to the client with no poll overhead. But these client-to-server messages are not sent over the streaming connection, instead an internal HTTP connection was used to send data for the duration of the operation. Through database, server and client programming, the construction of web-based irrigation control system and the realization of the real time data push mechanism were implemented. Then tests were carried out to quantitatively assess real-time performance of data acquisition and instruction sending process. The result showed that: the average delay of the data acquisition process was 1.7 seconds, the average delay of the control process was 3.4 seconds, and the real-time performance could basically meet the needs of equipment control and irrigation decision-making. The average delay of one-way data transmission in the software system was no more than 130 milliseconds. The delay factors of the data pull mode were totally eliminated, and this improvement plays an important role in enhancing overall real-time performance of system. The results of this paper showed that, through the reasonable design and development, the real-time performance of the Web based irrigation control system can reach the level of desktop control system. When the system is accessed through internet or 4G mobile communication network, the delay is on the hundreds milliseconds level, which has little effect on the real-time performance of the system. The data push scheme can also be applied to other related monitoring and control software system in internet of things, which can improve the real-time performance with low cost.