李淑华, 郝星耀, 周清波, 潘瑜春. 基于Web的自动灌溉控制系统数据实时推送设计与开发[J]. 农业工程学报, 2015, 31(15): 133-139. DOI: 10.11975/j.issn.1002-6819.2015.15.018
    引用本文: 李淑华, 郝星耀, 周清波, 潘瑜春. 基于Web的自动灌溉控制系统数据实时推送设计与开发[J]. 农业工程学报, 2015, 31(15): 133-139. DOI: 10.11975/j.issn.1002-6819.2015.15.018
    Li Shuhua, Hao Xingyao, Zhou Qingbo, Pan Yuchun. Design and development of real time data push in web-based automatic irrigation control system[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2015, 31(15): 133-139. DOI: 10.11975/j.issn.1002-6819.2015.15.018
    Citation: Li Shuhua, Hao Xingyao, Zhou Qingbo, Pan Yuchun. Design and development of real time data push in web-based automatic irrigation control system[J]. Transactions of the Chinese Society of Agricultural Engineering (Transactions of the CSAE), 2015, 31(15): 133-139. DOI: 10.11975/j.issn.1002-6819.2015.15.018

    基于Web的自动灌溉控制系统数据实时推送设计与开发

    Design and development of real time data push in web-based automatic irrigation control system

    • 摘要: 基于Web的自动灌溉控制系统是当前农业节水信息技术发展的主流趋势,为了提供定制灌溉控制方案和精准的用水计量,系统需要较高的数据传输实时性能,而基于Web的应用程序在实时性上表现较差,难以满足应用需求。针对这一问题,该文首先分析了基于Web的自动灌溉控制系统的结构和数据传输实时性瓶颈,提出了通过数据推送模式提高实时性的方案,并对数据层与逻辑层、逻辑层与表现层之间的具体数据推送模式进行了设计。通过编程开发完成基于Web的灌溉控制系统的构建,实现了数据实时推送的机制,并对系统数据采集和控制指令发送过程的实时性进行测试。结果表明:数据采集平均延时为1 676 ms,控制数据从发送到结果返回的平均延时为3 378 ms,基本能够满足其设备控制和灌溉决策的需要;软件系统内采集和控制过程的数据库至客户端数据传输的平均延时分别为124和118 ms,消除了数据拉取模式中的延时因素,对提高系统实时性起到了重要作用。该研究为基于Web的实时监测与控制系统的开发提供了方法参考。

       

      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.

       

    /

    返回文章
    返回