CN103200707B - A kind of middleware of the meteorological data observation system based on wireless sensor network - Google Patents
A kind of middleware of the meteorological data observation system based on wireless sensor network Download PDFInfo
- Publication number
- CN103200707B CN103200707B CN201310085684.5A CN201310085684A CN103200707B CN 103200707 B CN103200707 B CN 103200707B CN 201310085684 A CN201310085684 A CN 201310085684A CN 103200707 B CN103200707 B CN 103200707B
- Authority
- CN
- China
- Prior art keywords
- subsystem
- cpc
- module
- network
- cwsn
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 238000012545 processing Methods 0.000 claims abstract description 50
- 238000004891 communication Methods 0.000 claims abstract description 22
- 230000003044 adaptive effect Effects 0.000 claims abstract description 6
- 238000000034 method Methods 0.000 claims description 17
- 230000008569 process Effects 0.000 claims description 13
- 230000006870 function Effects 0.000 description 10
- 238000010586 diagram Methods 0.000 description 5
- 230000003993 interaction Effects 0.000 description 5
- 230000005540 biological transmission Effects 0.000 description 4
- 230000004044 response Effects 0.000 description 4
- 238000011161 development Methods 0.000 description 2
- 230000000694 effects Effects 0.000 description 2
- 238000005538 encapsulation Methods 0.000 description 2
- 230000007613 environmental effect Effects 0.000 description 2
- 238000012546 transfer Methods 0.000 description 2
- 238000012795 verification Methods 0.000 description 2
- 241000282414 Homo sapiens Species 0.000 description 1
- 230000002776 aggregation Effects 0.000 description 1
- 238000004220 aggregation Methods 0.000 description 1
- 230000008859 change Effects 0.000 description 1
- 238000012790 confirmation Methods 0.000 description 1
- 238000013480 data collection Methods 0.000 description 1
- 239000003344 environmental pollutant Substances 0.000 description 1
- 238000012423 maintenance Methods 0.000 description 1
- 238000012544 monitoring process Methods 0.000 description 1
- 231100000719 pollutant Toxicity 0.000 description 1
- 238000011160 research Methods 0.000 description 1
- 238000012360 testing method Methods 0.000 description 1
Landscapes
- Mobile Radio Communication Systems (AREA)
Abstract
本发明公开了一种应用于气象数据观测系统的中间件架构,作为连接无线传感器网络与互联网的桥梁,能够快速在传感器网络端和气象数据观测中心之间进行数据的往来传输,操作灵活,适应范围广。本发明提供的基于无线传感器网络的气象数据观测系统中间件,包括与气象无线传感器网络相连接的CWSN子系统以及与气象数据观测中心连接的CPC子系统,?CWSN子系统和CPC子系统之间通过AD?HOC网络进行通信;所述CPC子系统包括CPC网络连接模块、网络自适应模块、CPC自动升级模块和指令处理模块,所述CWSN子系统包括串口通信模块、CWSN网络连接模块、WSN包处理模块、XML文件处理模块和CWSN自动升级模块。
The invention discloses a middleware framework applied to a meteorological data observation system. As a bridge connecting a wireless sensor network and the Internet, data can be quickly transmitted between a sensor network end and a meteorological data observation center, and the operation is flexible and adaptable. wide range. The middleware of the meteorological data observation system based on the wireless sensor network provided by the present invention includes the CWSN subsystem connected with the meteorological wireless sensor network and the CPC subsystem connected with the meteorological data observation center,? Between CWSN subsystem and CPC subsystem through AD? The HOC network communicates; the CPC subsystem includes a CPC network connection module, a network adaptive module, a CPC automatic upgrade module and an instruction processing module, and the CWSN subsystem includes a serial port communication module, a CWSN network connection module, a WSN packet processing module, XML file processing module and CWSN automatic upgrade module.
Description
技术领域 technical field
本发明属于无线传感器网络中间件技术领域,尤其是涉及一种基于无线传感器网络的气象数据观测系统的中间件。 The invention belongs to the technical field of wireless sensor network middleware, and in particular relates to a middleware of a meteorological data observation system based on a wireless sensor network.
背景技术 Background technique
目前气象数据观测系统按照数据传输方式分为有线和无线两种。有线的传输方式能够很好地实现气象数据的采集,但是具有线路成本高,在山区铺设困难,维修繁琐等缺点。而无线传输方式在节省成本的同时能够提供高服务质量和高效带宽利用,因此目前多数采用无线传输方式进行数据采集。 At present, the meteorological data observation system is divided into wired and wireless according to the data transmission mode. The wired transmission method can realize the collection of meteorological data well, but it has the disadvantages of high line cost, difficulty in laying in mountainous areas, and cumbersome maintenance. The wireless transmission method can provide high service quality and efficient bandwidth utilization while saving costs, so most of them currently use wireless transmission methods for data collection.
气象数据观测系统中通常包含无线传感器网络,无线传感器网络由大量的静止或移动的传感器构成的无线网络,以协作地感知、采集、处理和传输网络覆盖地理区域内被感知对象的信息(比如温度、声音、振动、压力、运动或污染物等等),并最终把这些信息发送给网络所有者。无线传感器网络是继计算机和互联网之后世界信息产业的第三次浪潮,已成为新一轮全球经济和科技发展的战略焦点。随着研究的不断深入,无线传感器网络会逐渐融入人们的日常生活和社会活动的各个领域。如果说互联网构成了逻辑上的信息世界,改变了人与人之间的沟通方式,那么无线传感器网络这将逻辑上的信息世界与客观上的物理世界融合在一起,改变了人与自然界的交互方式。人可以在任何时间、任何地点甚至是任何环境条件下,通过无线传感器网络获取客观世界的大量信息,极大地扩展了网络的功能和人类认识世界的能力。 The meteorological data observation system usually includes a wireless sensor network, which is a wireless network composed of a large number of stationary or moving sensors, to cooperatively sense, collect, process and transmit the information of the perceived object in the geographical area covered by the network (such as temperature , sound, vibration, pressure, motion or pollutants, etc.), and ultimately send this information to the network owner. Wireless sensor network is the third wave of the world's information industry after computers and the Internet, and has become the strategic focus of a new round of global economic and technological development. With the deepening of research, wireless sensor networks will gradually integrate into people's daily life and various fields of social activities. If the Internet constitutes the logical information world and changes the way of communication between people, then the wireless sensor network integrates the logical information world with the objective physical world, changing the interaction between people and nature. Way. People can obtain a large amount of information of the objective world through wireless sensor networks at any time, any place, or even under any environmental conditions, which greatly expands the functions of the network and the ability of human beings to understand the world.
无线传感器网络一般包括传感器节点(sensornode)、汇聚节点(sinknode)。无线传感器网络形成之后,各种传感器节点采集数据,但是各个传感器节点由于资源的有限性,不可能拥有足够大的网络通信能力,采集到的数据更不可能传递给远处的数据监测中心。但是仍然存在高功耗、数据获取不方便、可操作性差、智能化水平低、数据通信不稳定等诸多问题。 A wireless sensor network generally includes a sensor node (sensornode) and a sink node (sinknode). After the wireless sensor network is formed, various sensor nodes collect data, but due to the limited resources of each sensor node, it is impossible to have a large enough network communication capability, and the collected data is even less likely to be transmitted to a remote data monitoring center. However, there are still many problems such as high power consumption, inconvenient data acquisition, poor operability, low level of intelligence, and unstable data communication.
发明内容 Contents of the invention
为解决上述问题,本发明公开了一种应用于气象数据观测系统的中间件架构,作为连接无线传感器网络与互联网的桥梁,能够快速在传感器网络端和气象数据观测中心之间进行数据的往来传输,操作灵活,适应范围广。 In order to solve the above problems, the present invention discloses a middleware architecture applied to the meteorological data observation system, which serves as a bridge connecting the wireless sensor network and the Internet, and can quickly transmit data between the sensor network end and the meteorological data observation center , Flexible operation and wide adaptability.
为了达到上述目的,本发明提供如下技术方案: In order to achieve the above object, the present invention provides the following technical solutions:
一种基于无线传感器网络的气象数据观测系统的中间件,包括与气象无线传感器网络相连接的CWSN子系统以及与气象数据观测中心连接的CPC子系统,CWSN子系统和CPC子系统之间通过ADHOC网络进行通信; A middleware of a meteorological data observation system based on a wireless sensor network, including a CWSN subsystem connected to a meteorological wireless sensor network and a CPC subsystem connected to a meteorological data observation center. The communication between the CWSN subsystem and the CPC subsystem is through ADHOC network for communication;
所述CPC子系统包括CPC网络连接模块、网络自适应模块、CPC自动升级模块和指令处理模块, The CPC subsystem includes a CPC network connection module, a network self-adaptation module, a CPC automatic upgrade module and an instruction processing module,
其中, in,
CPC网络连接模块与CWSN子系统通过ADHOC网络连接,和气象数据观测中心通过Internet连接,接收CWSN子系统发来的数据并将其转发至服务器端、接收服务器发来的数据并将其发送至CWSN子系统; The CPC network connection module is connected with the CWSN subsystem through the ADHOC network, and connected with the meteorological data observation center through the Internet, receives the data sent by the CWSN subsystem and forwards it to the server, receives the data sent by the server and sends it to the CWSN subsystem;
网络自适应模块在CPC子系统与internet首次连接时启动,根据CPC系统与网络的当前连接状态调整接入网络的方式; The network adaptive module starts when the CPC subsystem is connected to the internet for the first time, and adjusts the way of accessing the network according to the current connection status between the CPC system and the network;
指令处理模块用于对气象数据观测中心发送过来指令进行判断与处理; The instruction processing module is used to judge and process the instructions sent by the meteorological data observation center;
CPC自动升级模块获取气象数据观测中心的可以在嵌入式平台上直接运行的可执行文件,更新现有的运行的程序,或者添加嵌入式平台上没有的运行程序; The CPC automatic upgrade module obtains executable files that can be directly run on the embedded platform from the meteorological data observation center, updates existing running programs, or adds running programs that do not exist on the embedded platform;
所述CWSN子系统包括串口通信模块、CWSN网络连接模块、WSN包处理模块、XML文件处理模块和CWSN自动升级模块: Described CWSN subsystem comprises serial port communication module, CWSN network connection module, WSN packet processing module, XML file processing module and CWSN automatic upgrading module:
其中, in,
串口通信模块用于接收无线传感器网络发来的数据并将该数据传输至WSN包处理模块进行处理、接收从CPC子系统的指令并将其传输至无线传感器网络; The serial port communication module is used to receive the data sent by the wireless sensor network and transmit the data to the WSN packet processing module for processing, receive instructions from the CPC subsystem and transmit them to the wireless sensor network;
WSN包处理模块用于解析从串口通信模块接收到的WSN数据包并将解析后数据传输至XML文件处理模块,将从XML文件处理模块传输来的数据封装成WSN数据包后发送给串口通信模块; The WSN packet processing module is used to analyze the WSN data packet received from the serial port communication module and transmit the parsed data to the XML file processing module, and encapsulate the data transmitted from the XML file processing module into a WSN data packet and send it to the serial port communication module ;
XML文件处理模块用于解析从CPC系统发来的XML文件并将其传输给WSN包处理模块,将从WSN包处理模块传输来的数据生成XML文件后发送给CWSN网络连接模块; The XML file processing module is used to analyze the XML file sent from the CPC system and transmit it to the WSN packet processing module, generate an XML file from the data transmitted from the WSN packet processing module and send it to the CWSN network connection module;
CWSN网络连接模块用于连接CPC子系统并与CPC子系统之间进行数据通信; The CWSN network connection module is used to connect the CPC subsystem and perform data communication with the CPC subsystem;
CWSN自动升级模块,通过CPC子系统获取气象数据观测中心的可以在嵌入式平台上直接运行的可执行文件,更新现有的运行的程序,或者添加嵌入式平台上没有的运行程序。 The CWSN automatic upgrade module obtains the executable file of the meteorological data observation center that can be directly run on the embedded platform through the CPC subsystem, updates the existing running program, or adds a running program that does not exist on the embedded platform.
作为本发明的一种优选方案,所述网络自适应模块按照以太网、无线局域网、3G网络的顺序,自动选择通畅的网络进行连接。 As a preferred solution of the present invention, the network adaptive module automatically selects a smooth network for connection according to the sequence of Ethernet, wireless local area network, and 3G network.
与现有技术相比,本发明具有如下优点和技术效果: Compared with the prior art, the present invention has the following advantages and technical effects:
1.使用中间件作为传感器网络端和气象数据观测中心,具有效率高、响应实时、可靠性高、功耗低、抗干扰能力强等特点,同时具有很好的通用性。 1. Using middleware as the sensor network terminal and meteorological data observation center has the characteristics of high efficiency, real-time response, high reliability, low power consumption, strong anti-interference ability, etc., and has good versatility.
2.中间件中的CWSN子系统和CPC子系统形成AdHoc网络,在这类网络中所有的节点地位平等,无需设置中心节点,这样在两个节点无法直接通信的时候,就可以通过多个中间节点的转发来实现数据交换,所以具有很强的抗毁性。 2. The CWSN subsystem and the CPC subsystem in the middleware form an AdHoc network. In this type of network, all nodes are equal, and there is no need to set up a central node. In this way, when two nodes cannot communicate directly, they can pass through multiple intermediate nodes. Node forwarding to achieve data exchange, so it has strong invulnerability.
3.中间件中的各个系统可以根据需要快速地移动,以实现网络拓扑的动态变化来满足不同场合的要求。 3. Each system in the middleware can move quickly according to the needs, so as to realize the dynamic change of the network topology to meet the requirements of different occasions.
4.不管是CPC系统,还是CWSN系统都能实现程序的自动更新,为部署在无人监测区域的中间件自动升级提供了一种途径。 4. Whether it is the CPC system or the CWSN system, the program can be automatically updated, which provides a way for the automatic upgrade of middleware deployed in unmanned monitoring areas.
5.中间件能够根据物理链路的存在与否,进行物理链路的选择,最后选择最为实用的通道,具有很强的自适应性。 5. The middleware can select the physical link according to the existence of the physical link, and finally select the most practical channel, which has strong adaptability.
6.中间件是在嵌入式平台上进行开发和运行的,由于嵌入式设备的本身特性,因此中间件具有高度的集成性。 6. The middleware is developed and run on the embedded platform. Due to the inherent characteristics of the embedded device, the middleware is highly integrated.
附图说明 Description of drawings
图1为本发明提供的中间件结构原理图; Fig. 1 is the schematic diagram of the middleware structure provided by the present invention;
图2为CPC网络连接模块的工作流程示意图; Fig. 2 is the workflow diagram of CPC network connection module;
图3为CPC自动升级模块与数据观测中心之间的信息交互示意图; Fig. 3 is a schematic diagram of information interaction between the CPC automatic upgrade module and the data observation center;
图4为CPC自动升级模块的工作流程示意图; Fig. 4 is the workflow schematic diagram of CPC automatic upgrade module;
图5为CWSN自动升级模块与数据观测中心之间的信息交互示意图; Figure 5 is a schematic diagram of information interaction between the CWSN automatic upgrade module and the data observation center;
具体实施方式 detailed description
以下将结合具体实施例对本发明提供的技术方案进行详细说明,应理解下述具体实施方式仅用于说明本发明而不用于限制本发明的范围。 The technical solutions provided by the present invention will be described in detail below in conjunction with specific examples. It should be understood that the following specific embodiments are only used to illustrate the present invention and are not intended to limit the scope of the present invention.
本发明是在嵌入式平台上进行开发和运行的,本发明使用的是基于S3C6410内核的ARM11开发板,但是其他的嵌入式设备也可以进行开发和运行。基于无线传感器网络的气象数据观测系统的中间件的结构原理如图1所示,包括与气象无线传感器网络相连接的CWSN子系统以及与气象数据观测中心服务器连接的CPC子系统,CWSN子系统和CPC子系统之间通过ADHOC网络进行通信。本发明提供的中间件在气象无线传感器网络和气象数据观测中心服务器之间起到桥梁作用,实现他们之间的信息交互。CWSN子系统和CPC子系统之间为多对一的关系,大量CWSN系统向CPC子系统发出连接请求,CPC子系统通过判断一一响应这些客户端,并且能够实现客户端数据转发至数据观测中心的功能。相反观测中心也可以通过相同的原理发送消息至CWSN系统。 The present invention is developed and operated on an embedded platform, and what the present invention uses is an ARM11 development board based on the S3C6410 kernel, but other embedded devices can also be developed and operated. The structural principle of the middleware of the meteorological data observation system based on the wireless sensor network is shown in Figure 1, including the CWSN subsystem connected with the meteorological wireless sensor network and the CPC subsystem connected with the meteorological data observation center server, the CWSN subsystem and CPC subsystems communicate through the ADHOC network. The middleware provided by the invention acts as a bridge between the meteorological wireless sensor network and the server of the meteorological data observation center to realize the information exchange between them. There is a many-to-one relationship between the CWSN subsystem and the CPC subsystem. A large number of CWSN systems send connection requests to the CPC subsystem. The CPC subsystem responds to these clients one by one through judgment, and can realize the client data forwarding to the data observation center. function. On the contrary, the observation center can also send messages to the CWSN system through the same principle.
所述CPC子系统包括CPC网络连接模块、网络自适应模块、CPC自动升级模块和指令处理模块: The CPC subsystem includes a CPC network connection module, a network self-adaptation module, a CPC automatic upgrade module and an instruction processing module:
其中,CPC网络连接模块与CWSN子系统通过ADHOC网络连接,和气象数据观测中心平台通过Internet连接。 Among them, the CPC network connection module is connected with the CWSN subsystem through the ADHOC network, and connected with the meteorological data observation center platform through the Internet.
具体地说,CPC网络连接模块在执行时包括三个线程,主线程、收发客户端线程和连接PC服务器线程,还创建用于存储客户端上传数据的缓冲区1和用于存储自服务器端传来数据的缓冲区2,其流程图如图2所示。下面对这三个线程的工作流程进行详细的说明: Specifically, the CPC network connection module includes three threads during execution, the main thread, the sending and receiving client thread, and the thread connecting to the PC server. It also creates buffer 1 for storing data uploaded by the client and for storing The buffer 2 of incoming data, its flow chart is shown in Fig. 2. The workflow of these three threads is described in detail below:
主线程。主线程主要负责和CWSN子系统连接,及两个子线程的创建。程序运行时首先获取登录远程服务应用层的服务器地址,如果没有得到地址,程序打印错误消息并退出程序;如果得到正确的地址,则创建连接远程服务器线程,然后再创建收发客户端数据线程。通过socket,bind,listen,accept函数建立本地服务器并不断地监听CWSN子系统的连接请求,一旦有客户端请求,主线程就会发送一个字节的随机码,然后验证客户端发送过来的验证码,如果验证成功则将相应客户端的套接字存储到套接字数组,如果不成功则断开连接并返回到监听CWSN子系统连接的部分。 main thread. The main thread is mainly responsible for connecting with the CWSN subsystem and creating two sub-threads. When the program is running, it first obtains the server address for logging in to the remote service application layer. If the address is not obtained, the program prints an error message and exits the program; if it obtains the correct address, it creates a thread for connecting to the remote server, and then creates a thread for sending and receiving client data. Create a local server through socket, bind, listen, and accept functions and continuously monitor the connection request of the CWSN subsystem. Once there is a client request, the main thread will send a random code of one byte, and then verify the verification code sent by the client. , if the verification is successful, store the socket of the corresponding client in the socket array, and if it is unsuccessful, disconnect and return to the part that monitors the connection of the CWSN subsystem.
收发客户端线程。当CPC子系统接收到客户端(即CWSN子系统)上传的数据时,CPC将会进入收发客户端线程部分,判断数据缓存区1中是否有数据,如果有则等待数据缓存区中数据的处理,如果没有则把数据存储在数据缓存区1中。然后判读数据缓存区2中是否有数据,如果没有则返回判断缓存区1是否有数据部分,如果有则进入判断该数据里的内容是否针对CPC子系统,如果不是针对CPC子系统的则发送数据到每一个CWSN子系统,最后清空数据缓存区2,并返回到收发客户端线程开始部分。如果是针对CPC子系统的则把缓存区2中的数据发送给指令处理模块,让指令处理模块进行相应的处理。 Send and receive client threads. When the CPC subsystem receives the data uploaded by the client (that is, the CWSN subsystem), the CPC will enter the sending and receiving client thread part to determine whether there is data in the data buffer area 1, and if so, wait for the data in the data buffer area to be processed , if not, store the data in data buffer 1. Then judge whether there is data in the data buffer area 2, if not, return to judge whether there is data in the buffer area 1, if there is, enter to judge whether the content in the data is for the CPC subsystem, if not for the CPC subsystem, send the data Go to each CWSN subsystem, and finally empty the data buffer area 2, and return to the beginning part of the sending and receiving client thread. If it is for the CPC subsystem, send the data in the buffer area 2 to the instruction processing module, and let the instruction processing module perform corresponding processing.
连接PC服务器线程。相反CPC接收到服务应用层(即数据观测中心)数据时会判断数据缓存区2中是否有数据,如果有数据则等待,如果没有数据则存储数据到数据缓存区2中。然后判断数据缓存区1中是否有数据,有则调用send()函数,发送数据到远端的服务器,然后清空数据缓存区1中的内容,返回到判断数据缓存区2是否有数据部分,反之直接返回到判断数据缓存区2部分。 Connect PC server thread. On the contrary, when the CPC receives data from the service application layer (that is, the data observation center), it will judge whether there is data in the data buffer area 2, if there is data, it will wait, and if there is no data, it will store the data in the data buffer area 2. Then judge whether there is data in the data cache 1, and then call the send() function to send the data to the remote server, then clear the content in the data cache 1, and return to judging whether there is data in the data cache 2, and vice versa Return directly to the judgment data buffer area 2 part.
网络自适应模块在CPC子系统与internet首次连接时启动,该模块根据CPC系统与网络的当前连接状态调整接入网络的方式。在网络基本设施齐全的情况下,我们可以从以太网,无线局域网,3G网络中任选其中一种。以太网的稳定性比后两者网络都好,但是并不是所有的区域都有以太网的接口,比如说山区,岛屿或者是人烟稀少的地域。当基本设施不健全的情况下我们可以选择无线局域网,只要有连接着观测中心的无线路由器,我们CPC子系统的wifi模块都能够连接上服务应用层。如果上面这两种情况都没办法满足,那么我们就只有选择3G网络,虽然说网络的稳定性和性价比不如上面的两种类型,但是这种网络连接方便,覆盖广,完全能够满足我们系统的要求。网络自适应单元在执行过程中首先启动以太网卡,通过ICMP协议的ping命令,如果以太网卡与路由器之间的物理链接存在时会返回一个固定值,通过比较返回值与固定值,则可以判断CPC系统与远程中心信息展示控制平台的链路是否通畅,如果通畅该单元退出,如果不通畅,则设置wifi网卡参数,启动wifi网卡。然后再次使用ICMP协议进行网络的测试,如果成功这退出,如果不成功则运行3G网卡启动程序。3G网卡启动程序是一个用shell脚本语言写的可执行拨号程序。为了更好地实现USB3G拨号功能,在后台运行了一个服务程序,当开机时这个程序被设置为自动运行,所以当我们执行3G网卡启动程序程序时,会自动通过这个后台服务程序发送指令来进行3G拨号。 The network adaptive module is started when the CPC subsystem is connected to the internet for the first time, and the module adjusts the way of accessing the network according to the current connection status between the CPC system and the network. In the case of complete basic network facilities, we can choose one of Ethernet, wireless LAN, and 3G network. The stability of Ethernet is better than the latter two networks, but not all areas have Ethernet interfaces, such as mountainous areas, islands or sparsely populated areas. When the basic facilities are not perfect, we can choose wireless local area network. As long as there is a wireless router connected to the observation center, the wifi module of our CPC subsystem can be connected to the service application layer. If the above two situations cannot be satisfied, then we can only choose 3G network. Although the stability and cost performance of the network are not as good as the above two types, this kind of network has convenient connection and wide coverage, which can fully meet the needs of our system. Require. During the execution process, the network adaptive unit first starts the Ethernet card. Through the ping command of the ICMP protocol, if the physical link between the Ethernet card and the router exists, it will return a fixed value. By comparing the returned value with the fixed value, the CPC can be judged. The information between the system and the remote center shows whether the link of the control platform is smooth. If it is smooth, the unit exits. If it is not smooth, set the parameters of the wifi network card and start the wifi network card. Then use the ICMP protocol to test the network again. If it is successful, it will exit. If it is unsuccessful, it will run the 3G network card startup program. The 3G network card startup program is an executable dialer program written in shell script language. In order to better implement the USB3G dial-up function, a service program is running in the background. This program is set to run automatically when the machine is turned on, so when we execute the 3G network card startup program, it will automatically send instructions through this background service program to complete the process. 3G dialing.
指令处理模块用于对气象数据观测中心发送过来指令的判断与处理,比如:升级指令,校时指令等等,如果指令处理模块解析出是对cpc子系统进行程序升级的指令,则CPC系统就会立即执行CPC自动升级模块并等待接收气象数据观测中心平台发送来的配置文件。 The instruction processing module is used to judge and process the instructions sent by the meteorological data observation center, such as: upgrade instructions, time adjustment instructions, etc. If the instruction processing module parses out that it is an instruction to upgrade the cpc subsystem, the CPC system will It will immediately execute the CPC automatic upgrade module and wait to receive the configuration file sent by the meteorological data observation center platform.
CPC自动升级模块。由于相对于CWSN子系统而言,CPC子系统为服务器端,而相对于数据观测中心而言,CPC子系统为客户端,因此CPC子系统的程序更新升级主要涉及了两个方面,第一服务器端的程序,第二CPC客户端的程序。CPC自动升级模块升级时与数据观测中心之间的信息交互如图3所示,对于服务器来说主要是ftp服务器的配置,数据观测中心平台向CPC子系统发送客户端程序更新指令,CPC子系统获取客户端指令后确认,数据观测中心平台接收到确认信息后发送ftp登录和更新程序信息到CPC子系统,CPC子系统根据接收到的配置信息进行相应的操作,如符合下载程序的要求则开始下载程序。下载程序后将会对下载的程序进行判断,工作流程如图4所示。当程序下载接收后,再次解析下载的xml文件,提取文件大小信息,即file_size节点的大小,计算被下载更新程序的大小并记为curr_size,比较file_size和curr_size:如果大小数值不相等则说明在程序下载的过程中出现了错误,则重新下载程序;如果数值相等则说明程序下载成功。如果程序下载成功则关闭正在运行的程序,修改旧程序名,然后直接启动刚刚下载的新程序:如果新程序能够成功的运行,则删除旧版本的程序和刚刚下载的xml格式的程序配置文件;如果新程序不能成功的运行,则重新启动旧版本的程序。 CPC automatically upgrades modules. Since the CPC subsystem is the server side relative to the CWSN subsystem, and the CPC subsystem is the client side relative to the data observation center, the program update and upgrade of the CPC subsystem mainly involves two aspects. The first server The program of the terminal, the program of the second CPC client. The information interaction between the CPC automatic upgrade module and the data observation center when it is upgraded is shown in Figure 3. For the server, it is mainly the configuration of the ftp server. The data observation center platform sends the client program update command to the CPC subsystem, and the CPC subsystem Confirm after obtaining the client instructions, and after receiving the confirmation information, the data observation center platform sends ftp login and update program information to the CPC subsystem, and the CPC subsystem performs corresponding operations according to the received configuration information, and starts if it meets the requirements of the download program Download the program. After the program is downloaded, the downloaded program will be judged, and the workflow is shown in Figure 4. When the program is downloaded and received, parse the downloaded xml file again, extract the file size information, that is, the size of the file_size node, calculate the size of the downloaded update program and record it as curr_size, compare file_size and curr_size: if the size values are not equal, it means that the program is in the program If an error occurs during the downloading process, re-download the program; if the values are equal, the program download is successful. If the program is successfully downloaded, close the running program, modify the name of the old program, and then directly start the new program just downloaded: if the new program can run successfully, delete the old version of the program and the program configuration file in xml format just downloaded; If the new program does not run successfully, restart the old version of the program.
所述CWSN子系统包括串口通信模块和CWSN网络连接模块,其中,串口通信模块与无线传感器网络进行通信,CWSN网络连接模块连接着CPC子系统。由于XML格式的文件具有其特有的优势,所以我们选择在CWSN子系统和CPC子系统之间通过XML格式的文件进行数据的传递,而无线传感器网络发来的数据为WSN数据包,因此CWSN子系统中还包含进行数据解析和封装的WSN包处理模块和XML文件处理模块。 The CWSN subsystem includes a serial communication module and a CWSN network connection module, wherein the serial communication module communicates with the wireless sensor network, and the CWSN network connection module is connected to the CPC subsystem. Because the file in XML format has its unique advantages, we choose to transfer data through the file in XML format between the CWSN subsystem and the CPC subsystem, and the data sent by the wireless sensor network is WSN data packets, so the CWSN sub-system The system also includes a WSN packet processing module and an XML file processing module for data parsing and encapsulation.
串口通信模块主要负责无线传感器网络与中间件之间的通信问题,当无线传感器网络中的气象传感器收集到数据时候会定时地发送数据到此网络中唯一的汇聚节点,再由汇聚节点发送刚刚接收到的气象数据至CWSN系统。该模块用于接收无线传感器网络中的汇聚节点发来的数据并将该数据传输至WSN包处理模块进行处理、将从CPC子系统接收的指令传输至无线传感器网络。具体地说,串口程序通信单元负责从无线传感器网络中的汇聚节点获取信息,主要包括传感器节点的工作状态,采集的环境参数,远程服务器命令的执行情况。通过open()函数打开ttySAC1串口文件,并根据是否正确打开的情况来进行下一步操作的执行,如果打开不成功,则程序会一直执行open()这个函数,如果打开成功则进行串口的参数设置,参数的设置主要包括波特率,数据位,停止位和校验位。 The serial port communication module is mainly responsible for the communication between the wireless sensor network and the middleware. When the meteorological sensor in the wireless sensor network collects data, it will regularly send the data to the only sink node in the network, and then the sink node will send the data just received The received meteorological data is sent to the CWSN system. This module is used to receive the data sent by the aggregation node in the wireless sensor network and transmit the data to the WSN packet processing module for processing, and transmit the instructions received from the CPC subsystem to the wireless sensor network. Specifically, the serial program communication unit is responsible for obtaining information from the convergence nodes in the wireless sensor network, mainly including the working status of the sensor nodes, the collected environmental parameters, and the execution of remote server commands. Open the ttySAC1 serial port file through the open() function, and execute the next step according to whether it is opened correctly. If the opening is unsuccessful, the program will always execute the open() function. If the opening is successful, set the parameters of the serial port. , The parameter setting mainly includes baud rate, data bit, stop bit and parity bit.
CWSN网络连接模块,利用Adhoc网络,通过aodv路由协议使CWSN系统与CPC系统进行连接,并通过网络编程实现CWSN和CPC系统的信息交换。 The CWSN network connection module uses the Adhoc network to connect the CWSN system with the CPC system through the aodv routing protocol, and realizes the information exchange between the CWSN and the CPC system through network programming.
WSN包处理模块用于解析和封装WSN数据包;该模块解析从串口通信模块接收到的WSN数据包并将解析后数据传输至XML文件处理模块,将从XML文件处理模块传输来的数据封装成WSN数据包,在封装时添加ARMNode的相应信息到包中,其中ARMNode是用于标识每个CWSN子系统所在的硬件设备的唯一标记符(可以叫做CWSN地址),和用IP地址标识每个计算机的思想相同。无线传感器网络要想和CWSN子系统进行数据的交换必须要制定一种合理的数据包格式即WSN包。下表1为包格式的说明: The WSN packet processing module is used to parse and encapsulate WSN data packets; this module parses the WSN data packets received from the serial port communication module and transmits the parsed data to the XML file processing module, and encapsulates the data transmitted from the XML file processing module into WSN data packet, add the corresponding information of ARMNode to the packet when encapsulating, where ARMNode is a unique identifier used to identify the hardware device where each CWSN subsystem is located (it can be called a CWSN address), and use an IP address to identify each computer same thinking. If the wireless sensor network wants to exchange data with the CWSN subsystem, it must formulate a reasonable data packet format, that is, WSN packet. The following table 1 is a description of the package format:
表1 Table 1
CWSN子系统和无线传感器网络之间所有通信数据都必须以固定字符“0x1A”开始和结束的。Length表示这个数据包的大小。下面的一个字节是传感器节点的唯一标识号。Type是用来表示传感器节点的类型。Data是传感器采集到的数据部分。我们的传感器节点其是一种具有多传感器的模块。比如说有温度,适度,气压的传感器集成到一个传感器节点,这些传感器共享一个射频模块。数据部分两个字节表示一种数据值,目前我们的传感器节点可以支持3个传感器,所以数据的大小制定为6个字节。Workingstate表示传感器节点的工作状态,Remainingpower表示剩余的电量,使用是否处于电量警告的情况下来说明。AcquistitionCycle是射频模块的数据发送周期。WSN包处理模块解析过程为:首先读取所获得WSN数据包的第一个和最后一个字节,判断是否是0x1A,如果其中有一个不是,则会舍弃这个数据包。如果WSN数据包首尾字节符合要求,则读取第二个和第三个字节判断是否和数据包的总字节数大小相等,如果不等,说明这个数据包被损坏,则舍弃该包;如果相等则根据下一字节的内容识别数据的类型,将剩余字节的数据分别存入对应的数据库表中。与WSN数据包解析过程相反,当CWSN子系统发送命令给无线传感器网络中某个传感器时,发送的命令包格式必须能够被传感器节点识别,不然此命令包就会被传感器节点当作无效包处理,因此封装过程为在需要发送的数据基础上加上必要的格式字符使其符合WSN数据包格式。 All communication data between the CWSN subsystem and the wireless sensor network must start and end with the fixed character "0x1A". Length represents the size of this packet. The next byte is the unique identification number of the sensor node. Type is used to represent the type of sensor node. Data is the part of the data collected by the sensor. Our sensor node is a module with multiple sensors. For example, sensors with temperature, temperature, and air pressure are integrated into a sensor node, and these sensors share a radio frequency module. The two bytes of the data part represent a data value. Currently, our sensor node can support 3 sensors, so the size of the data is specified as 6 bytes. Workingstate represents the working state of the sensor node, and Remainingpower represents the remaining power, which is explained by whether it is in power warning. AcquistitionCycle is the data sending cycle of the RF module. The analysis process of the WSN packet processing module is as follows: first read the first and last bytes of the obtained WSN data packet, and judge whether it is 0x1A. If one of them is not, the data packet will be discarded. If the first and last bytes of the WSN data packet meet the requirements, read the second and third bytes to determine whether they are equal to the total number of bytes in the data packet. If not, it means that the data packet is damaged, and discard the packet ; If they are equal, identify the type of data according to the content of the next byte, and store the data of the remaining bytes in the corresponding database table. Contrary to the WSN data packet analysis process, when the CWSN subsystem sends a command to a sensor in the wireless sensor network, the format of the sent command packet must be recognized by the sensor node, otherwise the command packet will be treated as an invalid packet by the sensor node , so the encapsulation process is to add necessary format characters on the basis of the data to be sent to make it conform to the WSN data packet format.
XML文件处理模块用于解析和生成XML文件;该模块解析从CPC系统发来的XML文件并将其传输给WSN包处理模块,将从WSN包处理模块传输来的数据生成XML格式的文件,解析和生成XML文件的过程与WSN包处理过程相似,在此不再赘述。在本系统中xml文件按类型分,主要有定时传递传感器数据的文件和响应远程数据中心命令的回应文件。这两种xml格式的文件生成思想是相同的,都是先从数据库中提取或从WSN文件处理模块获得相应的数据,通过libxml2库函数来建立xml格式的文件,最终通过文件转换成数据包的方式发送出去。XML文件处理模块还包括与CPC子系统中指令处理模块相似的指令处理的功能,即用于对气象数据观测中心经CPC子系统发送过来指令的判断与处理,如果指令处理模块解析出是对CWSN子系统进行程序升级的指令,则CWSN子系统就会立即执行CWSN自动升级模块并等待接收气象数据观测中心平台发送来的配置文件。 The XML file processing module is used to parse and generate XML files; this module parses the XML files sent from the CPC system and transfers them to the WSN packet processing module, generates XML format files from the data transmitted from the WSN packet processing module, and parses them. The process of generating the XML file is similar to the process of processing the WSN package, and will not be repeated here. In this system, the xml files are classified by type, mainly including files that transmit sensor data regularly and response files that respond to commands from remote data centers. The idea of generating files in these two xml formats is the same, they first extract the corresponding data from the database or from the WSN file processing module, create xml format files through libxml2 library functions, and finally convert the files into data packets way to send out. The XML file processing module also includes the command processing function similar to the command processing module in the CPC subsystem, which is used to judge and process the commands sent by the meteorological data observation center through the CPC subsystem. If the command processing module parses out that it is a CWSN The subsystem performs program upgrade instructions, and the CWSN subsystem will immediately execute the CWSN automatic upgrade module and wait to receive the configuration file sent by the meteorological data observation center platform.
CWSN自动升级模块,当数据观测中心有新版本的CWSN程序时,会向CWSN子系统发出程序升级的指令,CWSN系统接收到程序升级指令,会向数据观测中心发出应答消息,表示现在可以接收程序的配置文件,数据观测中心接收到来自CWSN系统的应答消息,如果确认接收配置文件,数据观测中心会向CWSN发送xml格式的配置文件,该文件的格式与CPC系统程序升级中的xml格式相同。CPC自动升级模块进行升级时通过CPC子系统与数据观测中心之间的信息交互如图5所示,CWSN主程序接收到程序更新程序的配置文件后,经过判断确认CWSN主程序是否要被升级,如果升级则向数据观测中心发出确认下载程序的信息,最终完成程序下载的功能。 CWSN automatic upgrade module, when the data observation center has a new version of the CWSN program, it will send a program upgrade command to the CWSN subsystem, and the CWSN system will send a response message to the data observation center after receiving the program upgrade command, indicating that the program can now be received The data observation center receives the response message from the CWSN system. If the configuration file is confirmed to be received, the data observation center will send the configuration file in xml format to CWSN. The format of the file is the same as the xml format in the program upgrade of the CPC system. When the CPC automatic upgrade module is upgraded, the information interaction between the CPC subsystem and the data observation center is shown in Figure 5. After the CWSN main program receives the configuration file of the program update program, it determines whether the CWSN main program is to be upgraded. If it is upgraded, it will send a message confirming the download program to the data observation center, and finally complete the function of program download.
本发明方案所公开的技术手段不仅限于上述实施方式所公开的技术手段,还包括由以上技术特征任意组合所组成的技术方案。 The technical means disclosed in the solutions of the present invention are not limited to the technical means disclosed in the above embodiments, but also include technical solutions composed of any combination of the above technical features.
Claims (2)
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310085684.5A CN103200707B (en) | 2013-03-18 | 2013-03-18 | A kind of middleware of the meteorological data observation system based on wireless sensor network |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201310085684.5A CN103200707B (en) | 2013-03-18 | 2013-03-18 | A kind of middleware of the meteorological data observation system based on wireless sensor network |
Publications (2)
Publication Number | Publication Date |
---|---|
CN103200707A CN103200707A (en) | 2013-07-10 |
CN103200707B true CN103200707B (en) | 2016-01-13 |
Family
ID=48723020
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201310085684.5A Expired - Fee Related CN103200707B (en) | 2013-03-18 | 2013-03-18 | A kind of middleware of the meteorological data observation system based on wireless sensor network |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN103200707B (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN103795574A (en) * | 2014-01-27 | 2014-05-14 | 上海斐讯数据通信技术有限公司 | Method for upgrading optical network terminal configuration file |
Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102096867A (en) * | 2011-02-15 | 2011-06-15 | 上海海事大学 | Wireless sensor network technology based method for designing inland-river management information system |
CN102164424A (en) * | 2011-03-25 | 2011-08-24 | 南京信息工程大学 | Chicken farm cultivation monitoring system based on wireless sensor network |
CN202795663U (en) * | 2012-08-27 | 2013-03-13 | 惠州学院 | Gas monitoring and alarming system based on ZigBee wireless network |
Family Cites Families (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US9432271B2 (en) * | 2009-06-15 | 2016-08-30 | Qualcomm Incorporated | Sensor network management |
-
2013
- 2013-03-18 CN CN201310085684.5A patent/CN103200707B/en not_active Expired - Fee Related
Patent Citations (3)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN102096867A (en) * | 2011-02-15 | 2011-06-15 | 上海海事大学 | Wireless sensor network technology based method for designing inland-river management information system |
CN102164424A (en) * | 2011-03-25 | 2011-08-24 | 南京信息工程大学 | Chicken farm cultivation monitoring system based on wireless sensor network |
CN202795663U (en) * | 2012-08-27 | 2013-03-13 | 惠州学院 | Gas monitoring and alarming system based on ZigBee wireless network |
Non-Patent Citations (1)
Title |
---|
architecture of meteorology observing system based on wireless sensor networks;Jinglin Du et al.;《advanced materials research》;20121231;1244-1247 * |
Also Published As
Publication number | Publication date |
---|---|
CN103200707A (en) | 2013-07-10 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
US10965537B2 (en) | Self-adjusting data processing system | |
WO2022001674A1 (en) | Communication system, method and device for miniature intelligent sensor | |
CN101582895B (en) | EPA-based embedded industrial wireless WIA-PA gateway | |
Baccelli et al. | Information centric networking in the IoT: Experiments with NDN in the wild | |
JP6470770B2 (en) | Network node availability estimation based on historical data | |
CN107172051A (en) | A kind of method that internet of things equipment finds and managed | |
CN111835786A (en) | System for data acquisition and equipment control of multi-protocol equipment and implementation method | |
CN111586120A (en) | Internet of things gateway equipment, data transmission method, storage medium and installation method | |
US20230140769A1 (en) | REMOTE RECONFIGURATION SYSTEM FOR INTERNET OF THINGS (IoT) INTELLIGENT SENSING TERMINAL | |
CN104993979A (en) | Network connection monitoring method, terminal equipment and communication system | |
CN104320347B (en) | A kind of method and apparatus for actively updating LLDP | |
TWI795619B (en) | Gateway device with built-in server module and communication system thereof | |
US8189459B2 (en) | Method and system for guiding packet data protocol activation | |
CN112423322B (en) | Model information sending method, device, storage medium and electronic device | |
CN103841587B (en) | A kind of implementation method, the apparatus and system of Internet of Things Convergence gateway | |
CN104936202A (en) | 6LoWPAN wireless sensor network management system based on CoAP protocol | |
CN103533574A (en) | Method and device for data transmission between wireless sensor network and internet | |
CN103200707B (en) | A kind of middleware of the meteorological data observation system based on wireless sensor network | |
CN107484227B (en) | Wifi networking multi-hot-spot control communication method | |
CN113472637A (en) | LORA gateway | |
KR100929235B1 (en) | Dynamic Reconfiguration Method of Wireless Sensor Network and Its System | |
CN117793660A (en) | Distributed edge system supporting heterogeneous gateway access | |
CN116028580B (en) | Object model management method, device and system | |
CN114599007B (en) | A local area network and wide area network combined Internet of Things efficient communication system and construction method | |
US20140092763A1 (en) | Method for managing a wireless sensor network, and corresponding sensor node, sensor network, and computer program product |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
C06 | Publication | ||
PB01 | Publication | ||
C10 | Entry into substantive examination | ||
SE01 | Entry into force of request for substantive examination | ||
C14 | Grant of patent or utility model | ||
GR01 | Patent grant | ||
CF01 | Termination of patent right due to non-payment of annual fee |
Granted publication date: 20160113 Termination date: 20180318 |
|
CF01 | Termination of patent right due to non-payment of annual fee |