传感数据通信协议及高并发服务的设计与实现
摘 要:为了满足人们对于限定区域监测的需求,解决异构数据的表示、传输以及高并发问题,分析了传统物联网平台在传感数据采集以及传输方面的不足,通过功能模块设计,开发了微环境监测平台。针对平台传感层数据采集工作,设计通信协议,统一数据格式,减少数据传输量和能耗,并制定协议通信流程,利用LoRa技术完成终端到网关之间数据的远程传输;针对平台网络层,设计高并发数据接口实现服务端程序接收并处理数据,最终完成系统的研发和测试。结果表明:设计的通信协议可以完成异构数据格式的统一工作,降低了数据传输量和能耗;验证了数据从终端采集设备到网关,并经过上位机最后到服务器整套传输方案的可行性与可靠性、低延迟性以及高并发数据接口的处理性能。微环境监测平台能够稳定运行,为跨行业物联网应用提供了一套数据采集和传输的解决方案。
关键词:通信传输技术;微环境监测平台;无线传感网络;LoRa;异构数据;高并发接口;线程池
中图分类号:TP393 文献标志码:A
文章编号:1008-1542(2018)04-0356-09doi:10.7535/hbkd.2018yx04010
Abstract:In order to meet people"s needs for limited area monitoring and solve the heterogeneous data representation, transmission and high concurrency issues, the deficiency of traditional Internet platform in sensor data acquisition and transmission is analyzed, and a micro environmental monitoring platform is realized through function module design. As for sensing layer data acquisition work, the communication protocol is designed, the data format is unified to reduce the amount of data transmission and energy consumption, and the communication protocol process is determined. LoRa technology is used to complete the remote transmission of data between the terminal and the gateway. As for the platform network layer, the high concurrency data interface is designed, using the server program to receive and process data. Finally the development and testing of the system is completed. The results show that the designed communication protocol can help unifying heterogeneous data format and reducing the quantity of data transmission and energy consumption. The feasibility, reliability and low latency of the whole transmission plan of the data collected from the terminal equipment to the gateway, through the whole PC to server are verified, as well as the processing performance of the high concurrent data interface. The stable operation of the micro-environment monitoring platform proves it is a set of data collection and transmission solution for the applications of cross-industry Internet.
Keywords:communication transmission technology; micro environment monitoring platform; wireless sensor network; LoRa; heterogeneous data; high concurrence interface; thread pool
近年來,LoRa,NB-IoT等LPWA[1]技术的发展,为物联网在各个业务领域的应用打下了基础。物联网体系结构分为感知层、网络层和应用层。感知层主要完成信息的采集、转换和收集,网络层主要完成信息的传递和处理,应用层主要完成数据管理和数据处理,并将这些数据与行业应用相结合[2]。
现存物联网系统在开展行业应用时,需为各自系统搭建传感层和网络层,导致大量重复性工作,增加了成本。单独针对各个行业的物联网应用系统都有着自己独立的数据采集、传输和存储方案,造成了各行业间数据交流不顺畅,以至于无法综合利用数据做出更为准确的分析,阻碍了为用户提供更为优质的服务[3-5]。微环境监测平台便是为解决该问题而开发的,其统一设计的传感层和传输层业务流程,可以让用户将工作重心放在应用层业务应用上。由于微环境监测平台将提供给各个行业来实现它们的业务,因此相比之前单独针对某个行业的物联网系统,其需要的传感层接入终端设备种类和数量倍增。种类繁多的低端硬件采集器和执行器以及各个厂家的设备可能互不兼容,造成数据多源异构,为数据采集、分析和应用带来难度,如何利用智能终端节点有限的资源将大量的数据进行实时、可靠的远距离传输仍是需要重点考虑的问题。因此,需通过通信协议设计,屏蔽数据异构性,统一数据格式,解决数据多源异构问题;进行高并发数据接口设计并实现服务端程序,解决大数据量并发问题[6]。