Disclosure of Invention
The embodiment of the invention provides a method for realizing synchronous acquisition, which can realize that each wireless sensor network node acquires data at the same time.
The embodiment of the invention also provides a wireless sensor network system for realizing synchronous acquisition, which can realize that each wireless sensor network node acquires data at the same time.
The embodiment of the invention also provides a synchronization device for realizing synchronous acquisition, which can realize that each wireless sensor network node acquires data at the same absolute time.
The following is a technical scheme provided by the embodiment of the invention:
a method of implementing synchronous acquisition, the method comprising:
each wireless sensor network node of the wireless sensor network system acquires data;
a synchronization device of the wireless sensor network system receives a trigger message, acquires the current time, and sends the current time serving as the trigger time and the received trigger message to each wireless sensor network node;
each wireless sensor network node receives a trigger message and trigger time from a synchronization device of the wireless sensor network system;
and after receiving the trigger message and the trigger time, each wireless sensor network node deletes the data acquired before the trigger time, reserves the data acquired after the trigger time, and transmits or stores the reserved data as effective data.
A wireless sensor network system for implementing synchronous acquisition, the system comprising: the system comprises an upper computer, a synchronization device and a wireless sensor network node;
the upper computer is used for sending an acquisition command to the synchronization device;
the synchronization device is used for sending an acquisition command from the upper computer to the wireless sensor network nodes, receiving a trigger message sent by an external network system when the external network nodes start to acquire data at the same time, acquiring the current time, and sending the current time serving as the trigger time and the received trigger message to each wireless sensor network node;
the wireless sensor network node is used for receiving an acquisition command from the synchronization device, starting to acquire data after receiving the acquisition command, deleting the data acquired before the trigger time after receiving the trigger message and the trigger time, retaining the data acquired after the trigger time, and transmitting or storing the retained data as effective data.
A synchronization apparatus for implementing synchronous acquisition, the synchronization apparatus comprising: the device comprises a time module, a processing module and a triggering module;
the time module is used for acquiring the current time;
the processing module is used for receiving an acquisition command from an upper computer, sending the acquisition command and the current time acquired by the time module to wireless sensor network nodes, receiving a trigger message through the trigger module, extracting the current time acquired by the time module, sending the current time serving as the trigger time and the trigger message to each wireless sensor network node, deleting data acquired before the trigger time after each wireless sensor network node receives the trigger message and the trigger time, reserving data acquired after the trigger time, and transmitting or storing the reserved data serving as effective data;
the trigger module is used for sending the received trigger message to the processing module.
It can be seen from the foregoing technical solutions that, in the method for implementing synchronous acquisition, the wireless sensor network system, and the synchronization apparatus provided in the embodiments of the present invention, each wireless sensor network node starts acquiring data in advance, and starts transmitting or storing valid data after receiving a trigger message, where the valid data is data acquired by the wireless sensor network node after the synchronization apparatus receives the trigger message. Because the time for receiving the trigger message by the synchronization device is unique, the data can be acquired by each wireless sensor network node at the same time.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention more apparent, the present invention will be further described in detail with reference to the accompanying drawings and specific embodiments.
The first embodiment:
fig. 1 is a flowchart of a method for implementing synchronous acquisition according to an embodiment of the present invention. As shown in fig. 1:
step 101: each wireless sensor network node of the wireless sensor network system collects data.
This step can be implemented in the following way:
an upper computer of the wireless sensor network system sends an acquisition command to a synchronization device of the wireless sensor network system;
the synchronization device acquires the current time after receiving the acquisition command, and sends the received acquisition command and the current time to each wireless sensor network node of the wireless sensor network system;
and after receiving the acquisition command and the current time, each wireless sensor network node starts to acquire data.
Step 102: and a synchronization device of the wireless sensor network system receives the trigger message and sends the trigger message to each wireless sensor network node.
This step can be specifically realized in the following manner:
a synchronization device of the wireless sensor network system receives the trigger message;
and after the synchronization device receives the trigger message, acquiring the current time, and sending the current time serving as the trigger time and the received trigger message to each wireless sensor network node.
The trigger message is a trigger message sent by a wireless sensor network node inside the wireless sensor network system, or a trigger message sent by an external network system when the external network node starts to acquire data at the same time.
In this embodiment, the trigger message may be implemented by using a trigger pulse.
Step 103: and each wireless sensor network node starts to transmit or store effective data, wherein the effective data is data acquired by the wireless sensor network nodes after the wireless sensor network system receives the trigger message.
This step can be specifically realized in the following manner:
each wireless sensor network node receives a trigger message and trigger time from a synchronization device of the wireless sensor network system;
and after receiving the trigger message and the trigger time, each wireless sensor network node deletes the data acquired before the trigger time, retains the data acquired after the trigger time, and transmits or stores the retained data as effective data.
The current time may be obtained in one of three ways:
the first method is as follows: the synchronization device acquires current satellite time through a GPS, and the current satellite time is taken as the current time;
the second method comprises the following steps: the synchronization device acquires current reference time through a time reference circuit built by a crystal oscillator, and the current reference time is used as the current time;
the third method comprises the following steps: the synchronization device acquires the current Ethernet time through the Ethernet, and takes the current Ethernet time as the current time.
Second embodiment:
fig. 2 is a flowchart of a method for implementing synchronous acquisition according to an embodiment of the present invention. As shown in fig. 2:
step 201: and the upper computer of the wireless sensor network system sends an acquisition command to the synchronization device of the wireless sensor network system.
Step 202: and the synchronization device acquires the current time after receiving the acquisition command and sends the received acquisition command and the current time to each wireless sensor network node of the wireless sensor network system.
Step 203: and after receiving the acquisition command and the current time, the wireless sensor network node starts to acquire data.
In this step, the wireless sensor network node may be in a trigger waiting state after receiving the acquisition command and the current time, that is, only a low-power-consumption storage recording mode is used to acquire data, and data transmission is not required.
Under the condition of long-time data acquisition or monitoring, a FIFO mechanism can be adopted to ensure the acquisition amount of new effective data.
Step 204: the synchronization device of the wireless sensor network system receives the trigger message.
The trigger message may be a trigger message sent by a wireless sensor network node inside the wireless sensor network system, or may be a trigger message sent by an external network system when the external network node starts to acquire data at the same time.
Through the step, synchronous acquisition of the wireless sensor network system and the external network system can be realized by being triggered by the external network, and synchronous acquisition of each wireless sensor network node in the wireless sensor network system can also be realized by being triggered by the wireless sensor network node in the wireless sensor network system.
Step 205: and the synchronization device acquires the current time, and sends the current time serving as trigger time and the received trigger message to each wireless sensor network node.
Step 206: a wireless sensor network node receives a trigger message and a trigger time from a synchronization device of the wireless sensor network system.
Step 207: and the wireless sensor network node deletes the data acquired before the trigger time, retains the data acquired after the trigger time, and transmits or stores the retained data as effective data.
The above-mentioned obtaining of the current time may be implemented by any one of the following manners:
the first method is as follows: the synchronization device acquires current satellite time through a GPS, and the current satellite time is taken as the current time;
the second method comprises the following steps: the synchronization device acquires current reference time through a time reference circuit built by a crystal oscillator, and the current reference time is used as the current time;
the third method comprises the following steps: the synchronization device acquires the current Ethernet time through the Ethernet, and takes the current Ethernet time as the current time.
The third embodiment:
fig. 3 is a structural diagram of a wireless sensor network system according to an embodiment of the present invention, as shown in fig. 5:
the wireless sensor network system for realizing synchronous acquisition provided by the embodiment of the invention comprises: host computer 301, synchronizer 302 and wireless sensor network node 303.
The upper computer 301 is used for sending an acquisition command to the synchronization device 302;
the synchronization device 302 is used for sending the acquisition command from the upper computer 301 to the wireless sensor network nodes 303, receiving the trigger message, and sending the trigger message to each wireless sensor network node 303.
Here, the trigger message may be a trigger message sent by a wireless sensor network node inside the wireless sensor network system, or may be a trigger message sent by an external network system when the external network node starts to collect data at the same time.
The synchronization device 302 includes: a time module 3021, a processing module 3022, and a trigger module 3023;
the time module 3021 is used to obtain the current time.
The time module 3021 may be implemented in three ways:
the first method is as follows: the time module 3021 is a GPS, and acquires current satellite time by using the GPS, and takes the current satellite time as current time. Of course, periodic corrections to the acquired satellite time may also be made.
The second method comprises the following steps: the time module 3021 is a time reference circuit built by using a crystal oscillator, where the crystal oscillator may be a high-precision active or passive crystal oscillator to provide a reference time, and the reference time is used as the current time.
The third method comprises the following steps: the time module 3021 is a device capable of obtaining ethernet time, and obtains current ethernet time through ethernet, and takes the current ethernet time as the current time. For example, ethernet absolute time synchronization technology may be used to obtain ethernet time, take the current ethernet time as the current time, and periodically correct.
The processing module 3022 is configured to receive an acquisition command from the upper computer 301, send the acquisition command and the current time acquired by the time module 3021 to the wireless sensor network nodes 303, receive a trigger message through the trigger module 3023, extract the current time acquired by the time module 3021, and send the current time serving as a trigger time and the trigger message to each wireless sensor network node 303;
the triggering module 3023 is configured to receive a trigger message, and send the received trigger message to the processing module 3022.
The wireless sensor network node 303 is configured to receive an acquisition command and a trigger message from the synchronization device 302, start to acquire data after receiving the acquisition command, and start to transmit or store valid data after receiving the trigger message, where the valid data is data acquired by the wireless sensor network node 303 after the synchronization device 302 receives the trigger message.
The wireless sensor network node 303 comprises: a time discrimination module 3031 and a data acquisition module 3032;
the time discrimination module 3031 is configured to receive an acquisition command, a trigger message, and trigger time from the synchronization apparatus 302, send the received acquisition command to the data acquisition module 3032 after receiving the acquisition command, delete data acquired before the trigger time in the data acquisition module 3032 after receiving the trigger message and the trigger time, and store or transmit data acquired by the data acquisition module 3032 after the trigger time, where the retained data is valid data;
the data acquisition module 3032 is configured to receive an acquisition command from the time determination module 3032, and start to acquire data after receiving the acquisition command.
In practical applications, the processing module 3022 may be composed of a central controller, a wireless sensor network communication module, and an upper computer communication interface. The wireless sensor network communication module has the function of a wireless sensor network gateway and is used for processing communication between the module and a wireless sensor network node; the upper computer communication interface is used for communication between the processing module and the upper computer; the central controller is used for completing all processing operations of the processing module.
It should be noted that the wireless sensor network node 303 also includes a wireless sensor network communication module, which is used for communicating with the wireless sensor network communication module of the processing module 3022, so as to implement information transmission between the wireless sensor network node 303 and the processing module 3022.
The wireless sensor network communication module can adopt a wireless protocol based on the IEEE802.15.4 standard for data transmission and networking. The wireless sensor network communication module can comprise an 802.15.4 physical layer protocol control and data transceiving chip and an 802.15.4MAC layer protocol analysis chip.
The 802.15.4 physical layer protocol control and data transceiving chip can perform spreading, coding and decoding, Quadrature Phase Shift Keying (O-QPSK) modulation/demodulation, baseband signal processing, signal up/down conversion, data radio frequency transmission and radio frequency reception, and the like of a transceiver. The 802.15.4MAC layer protocol parsing chip may be used for 802.15.4MAC layer protocol parsing, for example: establishing network topology structure connection; realizing the data packing and unpacking functions of the MAC layer; the method realizes the mutual transmission of point-to-point data of the devices in the network through a Coordinator, a Router and an End Device; preventing signal collision; time synchronization is realized for the sensor nodes; a seamless interface of a data link between the data conditioner and the base station equipment is realized; and performing security control on data.
The 802.15.4 physical layer protocol control and data receiving and transmitting chip can be realized by adopting MC13192, and the 802.15.4MAC layer protocol analysis chip is realized by adopting MC9S08GT 60; the 802.15.4 physical layer protocol control and data transceiver chip may also be integrated with the 802.15.4MAC layer protocol parser chip, for example, implemented by using the 802.15.4 protocol integrated chip CC2430 of TI corporation.
The network topology structure of the wireless sensor network communication module can adopt connection modes such as a star network, a point-to-point network, a cluster tree or a mesh network, the same network can accommodate 65000 wireless sensor network nodes and adopts a multi-hop transmission mode, so that a wide range is covered; the appropriate network connections may also be customized to the specific needs of the user.
In practical application, a radio frequency power amplifier and a low noise amplifier can be arranged on a transmitting channel and a receiving channel of the wireless sensor network communication module to amplify the transmitting and receiving power so as to increase the communication distance between the wireless sensor network nodes. The transmitting and receiving antenna of the wireless sensor network communication module can adopt a printed circuit board antenna, and can also adopt a patch antenna or a whip antenna.
When the wireless sensor network is established, the central controller can send the current time acquired by the time module to each wireless sensor node through the wireless sensor network communication module. The wireless sensor node can generate a time service error and a time accumulated error caused by the internal clock of the node due to crystal oscillator deviation and other factors, and the time service error and the time accumulated error can be eliminated by using the existing time synchronization technology, such as RBS, FTSP or DMTS and other algorithms, or the time synchronization technology of Beijing Bizu technology company Limited, so that the time synchronization between the synchronization device and the wireless sensor node is ensured. These time synchronization techniques will not be described in detail here.
The communication interface of the upper computer can be realized by adopting the existing computer interface, such as a USB, RS232 or Ethernet interface, and also can be realized by adopting an industrial bus interface, such as MBUS or HART.
In order to improve industrial reliability and anti-interference capability, an optoelectronic isolation chip may be further used at the input/output terminal of the trigger module 3023.
The central controller can be a single chip microcomputer, an embedded computer or a DSP digital signal processing chip.
In addition, the external network may be a wired network system, or may also be a wireless sensor network system, or of course, may also be a wireless sensor network system provided in the embodiments of the present invention.
Under the condition that the external network system is a wired network system, due to the real-time property of the wired network system, the wired network system can immediately send a trigger message to the wireless sensor network system when the data acquisition is started, so that the synchronous acquisition of the wired network system and the wireless sensor network system can be realized.
It can be seen from the foregoing technical solutions that, in the method for implementing synchronous acquisition, the wireless sensor network system, and the synchronization apparatus provided in the embodiments of the present invention, each wireless controller network node starts acquiring data in advance, and starts transmitting or storing valid data after receiving a trigger message, where the valid data is data acquired by a wireless sensor network node after the synchronization apparatus receives the trigger message. Because the time for receiving the trigger message by the synchronization device is unique, the data can be acquired by each wireless controller network node at the same time.
In addition, the method for realizing synchronous acquisition, the wireless sensor network system and the synchronization device provided by the embodiment of the invention can also provide acquired absolute time, such as GPS satellite time or Ethernet time, for the wireless sensor network nodes, so as to ensure that each wireless sensor network node acquires data at the same time; extra hardware such as a GPS module is not required to be added in the wireless sensor network node, so that the cost and the power consumption of the node are reduced, and the extra power energy consumption and the memory resource waste of the wireless sensor node are reduced.
Moreover, the method for realizing synchronous acquisition, the wireless sensor network system and the synchronization device provided by the embodiment of the invention can be triggered by the wireless sensor network node in the wireless sensor network system to realize synchronous acquisition in the wireless sensor network system; the wireless sensor network system can be triggered by an external network, so that synchronous acquisition of each wireless sensor network node of the wireless sensor network system and nodes of other external network systems is realized, and if the external network system is a wired network system, synchronous acquisition of the wireless sensor network system and the wired network system can be realized.
Due to the fact that resources of batteries and internal memories of nodes of the wireless sensor network are limited, under the condition that the occurrence time of an event is unpredictable, if the existing synchronous acquisition method is adopted, the waste of extra acquisition transmission or storage of the whole network becomes great, and even the risk that some nodes fail in the effective acquisition and recording process due to resource exhaustion exists. The method for realizing synchronous acquisition, the wireless sensor network system and the synchronous device provided by the embodiment of the invention solve the problems in a passive triggering mode.
In summary, the above description is only a preferred embodiment of the present invention, and is not intended to limit the scope of the present invention. Any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.