[go: up one dir, main page]

CN113676994A - A wireless sensor network time synchronization method and device - Google Patents

A wireless sensor network time synchronization method and device Download PDF

Info

Publication number
CN113676994A
CN113676994A CN202110969463.9A CN202110969463A CN113676994A CN 113676994 A CN113676994 A CN 113676994A CN 202110969463 A CN202110969463 A CN 202110969463A CN 113676994 A CN113676994 A CN 113676994A
Authority
CN
China
Prior art keywords
node
standard
time synchronization
time
dio
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.)
Pending
Application number
CN202110969463.9A
Other languages
Chinese (zh)
Inventor
赵训威
张春玲
白杰
章灵芝
王志刚
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
State Grid Information and Telecommunication Co Ltd
Original Assignee
State Grid Information and Telecommunication Co Ltd
Priority date (The priority date 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 date listed.)
Filing date
Publication date
Application filed by State Grid Information and Telecommunication Co Ltd filed Critical State Grid Information and Telecommunication Co Ltd
Priority to CN202110969463.9A priority Critical patent/CN113676994A/en
Publication of CN113676994A publication Critical patent/CN113676994A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/1607Details of the supervisory signal
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04LTRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
    • H04L1/00Arrangements for detecting or preventing errors in the information received
    • H04L1/12Arrangements for detecting or preventing errors in the information received by using return channel
    • H04L1/16Arrangements for detecting or preventing errors in the information received by using return channel in which the return channel carries supervisory signals, e.g. repetition request signals
    • H04L1/1607Details of the supervisory signal
    • H04L1/1642Formats specially adapted for sequence numbers
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W28/00Network traffic management; Network resource management
    • H04W28/02Traffic management, e.g. flow control or congestion control
    • H04W28/0289Congestion control
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W4/00Services specially adapted for wireless communication networks; Facilities therefor
    • H04W4/06Selective distribution of broadcast services, e.g. multimedia broadcast multicast service [MBMS]; Services to user groups; One-way selective calling services
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks

Landscapes

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Multimedia (AREA)
  • Mobile Radio Communication Systems (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)

Abstract

本发明公开了一种无线传感器网络的时间同步方法及装置,待入网节点获取无线传感器网络中的广播DIO报文,向发送广播DIO报文的备选父节点发送单播DIO探测报文,当在预设时间段内接收到备选父节点反馈的ACK帧时,解析ACK帧得到ACK帧序列号和标准时间戳,当根据ACK帧序列号确定ACK帧是单播DIO探测报文的MAC层的ACK反馈帧时,根据标准时间戳进行时间同步。本发明将单向的时间同步方法嵌入到无线传感器网络的MAC层确认机制中,将标准时间戳封装在ACK帧中,利用MAC层的ACK确认机制实现标准时间戳的传输,通过向备选父节点发送单播DIO探测报文触发时间同步过程,整个过程不会产生额外通信开销。

Figure 202110969463

The invention discloses a time synchronization method and device for a wireless sensor network. A node to be connected to the network acquires a broadcast DIO message in the wireless sensor network, and sends a unicast DIO detection message to an alternative parent node that sends the broadcast DIO message. When receiving the ACK frame fed back by the alternative parent node within the preset time period, the ACK frame is parsed to obtain the ACK frame sequence number and standard timestamp. When the ACK frame is determined according to the ACK frame sequence number to be the MAC layer of the unicast DIO detection packet When the ACK feedback frame is received, time synchronization is performed according to the standard timestamp. The invention embeds the one-way time synchronization method into the MAC layer confirmation mechanism of the wireless sensor network, encapsulates the standard time stamp in the ACK frame, and utilizes the ACK confirmation mechanism of the MAC layer to realize the transmission of the standard time stamp. Nodes send unicast DIO detection packets to trigger the time synchronization process, and the entire process does not generate additional communication overhead.

Figure 202110969463

Description

Time synchronization method and device of wireless sensor network
Technical Field
The present invention relates to the field of wireless communication technologies, and in particular, to a time synchronization method and apparatus for a wireless sensor network.
Background
With the intensive research and development of Wireless Sensor Networks (WSNs), the Wireless sensor Networks have been applied to various fields of the internet of things and become important components of the internet of things. The time synchronization technology is one of key technologies for maintaining stable operation of the wireless sensor network, can unify the time of network nodes of the whole network to standard time, and plays a fundamental role in data acquisition, protocol implementation, power consumption management and other applications of the wireless sensor network.
At present, a time synchronization method of a wireless sensor network mainly adopts a specific time synchronization packet, and realizes time synchronization between network nodes in the wireless sensor network by injecting the specific time synchronization packet into the wireless sensor network. However, the use of a specific time synchronization packet may cause additional communication overhead in addition to data packets in the wireless sensor network, which is not favorable for high-density wireless sensor network deployment.
Disclosure of Invention
In view of this, the present invention discloses a time synchronization method and apparatus for a wireless sensor network, so as to implement time synchronization of the wireless sensor network without increasing additional communication overhead.
A time synchronization method of a wireless sensor network is applied to a node to be accessed into the wireless sensor network, and comprises the following steps:
acquiring a broadcast DIO message in the wireless sensor network;
determining a target network node which sends the broadcast DIO message as an alternative father node, and sending a unicast DIO detection message to the alternative father node;
judging whether an ACK frame fed back by the alternative father node is received in a preset time period;
if the ACK frame is received, analyzing the ACK frame to obtain an ACK frame sequence number and a standard time stamp;
judging whether the ACK frame is an ACK feedback frame according to the ACK frame serial number, wherein the ACK feedback frame is an ACK frame of an MAC layer of the unicast DIO detection message;
and if the ACK frame is the ACK feedback frame, performing time synchronization according to the standard time stamp.
Optionally, the determining, as the alternative parent node, the network node that sends the broadcast DIO packet, and sending the unicast DIO probe packet to the alternative parent node specifically includes:
analyzing the broadcast DIO message to obtain an address field for sending the broadcast DIO message;
determining a target network node for sending the broadcast DIO message based on the address field, and determining the target network node as an alternative father node;
and sending a unicast DIO detection message to the alternative father node.
Optionally, the performing time synchronization according to the standard timestamp specifically includes:
adding the standard time stamp to a standard time stamp queue;
judging whether the alternative father node is the father node of the node to be accessed to the network or not according to a preset father node judgment standard;
when the alternative father node is the father node of the node to be networked, a linear regression algorithm is adopted for the standard timestamp queue to obtain a time synchronization offset;
correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and carrying out time synchronization according to the network standard time.
Alternatively, the time synchronization offset skew is calculated according to the following formula,
Figure BDA0003225094940000021
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and T is the number of standard timestamps in the standard timestamp queueoffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure BDA0003225094940000022
is ToffsetThe average value of (a) of (b),
Figure BDA0003225094940000023
is TarriveIs measured.
Optionally, the network standard timestamp T is calculated according to the following formulaglobal
Figure BDA0003225094940000031
In the formula, TlocalAnd the local time is the local time of the node to be networked.
A time synchronizer of a wireless sensor network is applied to a node to be accessed into the wireless sensor network, and comprises:
the message acquisition unit is used for acquiring a broadcast DIO message in the wireless sensor network;
a father node determining unit, configured to determine a target network node that sends the broadcast DIO packet as an alternative father node, and send a unicast DIO probe packet to the alternative father node;
the first judging unit is used for judging whether an ACK frame fed back by the alternative father node is received in a preset time period;
the analysis unit is used for analyzing the ACK frame to obtain an ACK frame serial number and a standard timestamp under the condition that the first judgment unit judges that the ACK frame is positive;
a second judging unit, configured to judge whether the ACK frame is an ACK feedback frame of an MAC layer of the unicast DIO detection packet according to the ACK frame sequence number;
and a time synchronization unit configured to perform time synchronization according to the standard timestamp if the second determination unit determines that the time stamp is included in the standard timestamp.
Optionally, the parent node determining unit is specifically configured to:
analyzing the broadcast DIO message to obtain an address field for sending the broadcast DIO message;
determining a target network node for sending the broadcast DIO message based on the address field, and determining the target network node as an alternative father node;
and sending a unicast DIO detection message to the alternative father node.
Optionally, the time synchronization unit is specifically configured to:
adding the standard time stamp to a standard time stamp queue;
judging whether the alternative father node is the father node of the node to be accessed to the network or not according to a preset father node judgment standard;
when the alternative father node is the father node of the node to be networked, a linear regression algorithm is adopted for the standard timestamp queue to obtain a time synchronization offset;
correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and carrying out time synchronization according to the network standard time.
Alternatively, the time synchronization offset skew is calculated according to the following formula,
Figure BDA0003225094940000041
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and T is the number of standard timestamps in the standard timestamp queueoffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure BDA0003225094940000042
is ToffsetThe average value of (a) of (b),
Figure BDA0003225094940000043
is TarriveIs measured.
Optionally, the network standard timestamp T is calculated according to the following formulaglobal
Figure BDA0003225094940000044
In the formula, TlocalAnd the local time is the local time of the node to be networked.
According to the technical scheme, the node to be networked acquires a broadcast DIO message in the wireless sensor network, a target network node which sends the broadcast DIO message is determined as an alternative father node, a unicast DIO detection message is sent to the alternative father node, when an ACK frame fed back by the alternative father node is received in a preset time period, the ACK frame is analyzed to obtain an ACK frame serial number and a standard timestamp, when the ACK frame is determined to be an ACK feedback frame according to the ACK frame serial number, the ACK feedback frame is an ACK frame of an MAC layer of the unicast DIO detection message, and time synchronization is carried out according to the standard timestamp. The invention embeds the one-way time synchronization method into the MAC layer confirmation mechanism of the wireless sensor network, encapsulates the standard time stamp into the ACK frame, realizes the transmission of the standard time stamp by utilizing the ACK confirmation mechanism of the MAC layer, has timeliness and does not relate to the processing delay of the upper layer of a network protocol stack, and sends the unicast DIO detection message to the alternative father node through the node to be accessed to trigger the time synchronization process, so that the whole time synchronization process does not generate extra communication overhead, can solve the problem of network congestion caused by extra communication, and is beneficial to the deployment of the high-density wireless sensor network.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, it is obvious that the drawings in the following description are only embodiments of the present invention, and for those skilled in the art, other drawings can be obtained according to the disclosed drawings without creative efforts.
Fig. 1 is a topology structure diagram of a wireless sensor network according to an embodiment of the present invention;
fig. 2 is a flowchart of a time synchronization method of a wireless sensor network according to an embodiment of the present invention;
FIG. 3 is a flowchart of a method for time synchronization according to a standard timestamp according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a time synchronization apparatus of a wireless sensor network according to an embodiment of the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The embodiment of the invention discloses a time synchronization method and a time synchronization device of a wireless sensor network.A node to be networked acquires a broadcast DIO message in the wireless sensor network, determines a target network node which sends the broadcast DIO message as an alternative father node, sends a unicast DIO detection message to the alternative father node, analyzes an ACK frame to obtain an ACK frame serial number and a standard timestamp when receiving an ACK frame fed back by the alternative father node in a preset time period, and performs time synchronization according to the standard timestamp when determining that the ACK frame is the ACK feedback frame according to the ACK frame serial number, wherein the ACK feedback frame is the ACK frame of an MAC layer of the unicast DIO detection message. The invention embeds the one-way time synchronization method into the MAC layer confirmation mechanism of the wireless sensor network, encapsulates the standard time stamp into the ACK frame, realizes the transmission of the standard time stamp by utilizing the ACK confirmation mechanism of the MAC layer, has timeliness and does not relate to the processing delay of the upper layer of a network protocol stack, and sends the unicast DIO detection message to the alternative father node through the node to be accessed to trigger the time synchronization process, so that the whole time synchronization process does not generate extra communication overhead, can solve the problem of network congestion caused by extra communication, and is beneficial to the deployment of the high-density wireless sensor network.
In order to understand the time synchronization process of the wireless sensor network, the invention first introduces a time synchronization application scenario of the wireless sensor network. Referring to fig. 1, a topology structure diagram of a wireless sensor network disclosed in the embodiment of the present invention is shown, where a node 1 is a CCO (Central Coordinator), and also indicates a root node in an RPL Protocol, and the RPL is an IPv6 Routing Protocol for Low-Power and Low network for short. The nodes 2 to 4 shown in fig. 1 are ordinary nodes that have joined the wireless sensor network, and the node 5 represents a node to be networked. The node 1 is connected with a plurality of common nodes through wireless channels, and in addition, all the nodes are mainly Single-Chip microcomputers (Single-Chip microcomputers) matched with a wireless sensor network, such as the CC13XX series developed by Texas instruments and Inc. in America.
Referring to fig. 2, a flowchart of a time synchronization method for a wireless sensor network disclosed in an embodiment of the present invention is applied to a node to be networked, such as the node 5 in fig. 1, which is to join the wireless sensor network, and the time synchronization method includes:
step S101, obtaining a broadcast DIO message in a wireless sensor network;
DIO (DODAG Information Object, DODAG representing a network fabric network Information Object).
For convenience of description, the present embodiment defines a network node to be joined to the wireless sensor network as a "node to be joined to the network".
In this embodiment, a node to be networked seeks to join a wireless sensor network, where the wireless sensor network is based on a network layer RPL protocol, and the node to be networked detects whether a broadcast DIO packet is sent out in the wireless sensor network on its own channel, and acquires the broadcast DIO packet when detecting the broadcast DIO packet. The broadcast DIO packet is a control packet for discovering a new node and maintaining a route.
For example, the node 5 to be networked in fig. 1 needs to join the wireless sensor network to obtain the broadcast DIO packet sent by the network node 4, and the node 5 to be networked and the network node 4 perform time synchronization interaction based on the broadcast DIO packet.
Step S102, determining a target network node which sends the broadcast DIO message as an alternative father node, and sending a unicast DIO detection message to the alternative father node;
in this embodiment, after receiving a broadcast DIO packet, a node to be networked parses the broadcast DIO packet to obtain an address field for sending the broadcast DIO packet, determines a target network node for sending the broadcast DIO packet based on the address field, and determines the target network node as an alternative parent node.
And the node to be accessed to the network sends a unicast DIO detection message to the alternative father node, wherein the unicast DIO detection message is a detection message selected by the RPL protocol father node based on the communication quality between the nodes. After the node to be networked sends the unicast DIO detection message in the network layer, based on the principle of the computer network protocol stack, the unicast DIO detection message will be transmitted in the form of a data frame in the MAC (Media Access Control) layer, and due to the acknowledgement mechanism of the MAC layer, the destination node needs to return an ACK (acknowledgement character) frame representing acknowledgement after receiving the data frame, so that after the node to be networked sends the unicast DIO detection message to the candidate parent node, it will wait for the candidate parent node to feed back an ACK frame.
Step S103, judging whether an ACK frame fed back by the alternative father node is received in a preset time period, if so, executing step S104;
and when the ACK frame fed back by the alternative father node is not received in the preset time period, returning to the step S102, and sending the unicast DIO detection message to the alternative father node again.
Step S104, analyzing the ACK frame to obtain an ACK frame sequence number and a standard time stamp;
the ACK frame sequence number is used to determine a data frame corresponding to the ACK frame, that is, to determine a unicast DIO probe packet corresponding to the ACK frame.
Step S105, judging whether the ACK frame is an ACK feedback frame according to the ACK frame sequence number, if so, executing step S106;
wherein, the ACK feedback frame is an ACK frame of the MAC layer of the unicast DIO detection packet, and when it is determined that the ACK frame is not an ACK feedback frame according to the ACK frame sequence number, the step S102 is returned to.
And step S106, carrying out time synchronization according to the standard time stamp.
In this embodiment, the node to be networked adjusts its own time according to the standard timestamp, thereby achieving time synchronization.
In summary, the invention discloses a time synchronization method of a wireless sensor network, a node to be accessed to the network acquires a broadcast DIO message in the wireless sensor network, determines a target network node sending the broadcast DIO message as an alternative father node, sends a unicast DIO detection message to the alternative father node, analyzes an ACK frame to obtain an ACK frame serial number and a standard timestamp when receiving an ACK frame fed back by the alternative father node in a preset time period, and performs time synchronization according to the standard timestamp when determining that the ACK frame is the ACK feedback frame, wherein the ACK feedback frame is the ACK frame of an MAC layer of the unicast DIO detection message. The invention embeds the one-way time synchronization method into the MAC layer confirmation mechanism of the wireless sensor network, encapsulates the standard time stamp into the ACK frame, realizes the transmission of the standard time stamp by utilizing the ACK confirmation mechanism of the MAC layer, has timeliness and does not relate to the processing delay of the upper layer of a network protocol stack, and sends the unicast DIO detection message to the alternative father node through the node to be accessed to trigger the time synchronization process, so that the whole time synchronization process does not generate extra communication overhead, can solve the problem of network congestion caused by extra communication, and is beneficial to the deployment of the high-density wireless sensor network.
In order to further improve the time synchronization precision of the wireless sensor network, the invention further calculates the time synchronization offset of the standard timestamp fed back by the alternative negative node.
Referring to fig. 3, a flowchart of a method for performing time synchronization according to a standard timestamp is disclosed in an embodiment of the present invention, where the method includes:
step S201, adding a standard timestamp into a standard timestamp queue;
step S202, judging whether the alternative father node is the father node of the node to be accessed to the network according to a preset father node judgment standard, and if so, executing step S108;
and when the alternative parent node is not the parent node of the node to be networked, returning to the step S101.
In practical application, the node to be networked calculates a routing metric value, such as hop count and expected transmission times, according to a preset objective function, and selects the node with the largest or smallest routing metric value as a parent node.
Step S203, obtaining time synchronization offset by adopting a linear regression algorithm to the standard timestamp queue;
when the number of the standard timestamps in the standard timestamp queue reaches a preset number N, for example, N is 8, a linear regression algorithm is used for the standard timestamp queue to obtain the time synchronization offset.
Of course, when the number of the standard timestamps in the standard timestamp queue does not reach the preset number, the time synchronization offset can also be obtained by adopting a linear regression algorithm for the standard timestamp queue.
The standard timestamp queue is a first-in-first-out queue.
Specifically, in practical application, all the standard timestamps in the standard timestamp queue are subjected to straight line fitting to obtain the straight line slope of a fitted straight line, and the time trend can be estimated through a predicted linear function based on the straight line slope so as to realize direct compensation of the standard timestamps.
It should be particularly noted that the time synchronization offset in this embodiment is a time synchronization offset between a node to be networked as a child node and a corresponding parent node.
Calculating the time synchronization offset skew according to the formula (1) and the formula (2), wherein the formula (1) and the formula (2) are as follows:
Figure BDA0003225094940000081
Figure BDA0003225094940000082
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and Toffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure BDA0003225094940000083
is ToffsetThe average value of (a) of (b),
Figure BDA0003225094940000084
is TarriveMean value of (1), TlocalIs the local time of the node to be networked, TglobalIs the network standard time.
Step S204, correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and step S205, performing time synchronization according to the network standard time.
In summary, the invention uses a first-in first-out timestamp queue to store the standard timestamps, obtains the time synchronization offset by adopting a linear regression algorithm to the standard timestamp queue, and obtains the network standard time by correcting the standard timestamps by using the time synchronization offset. The linear regression algorithm adopted by the invention has the advantage of high time synchronization precision, and the computational power of the network nodes can be borne.
Based on the above discussion, the time synchronization method of the wireless sensor disclosed in the present invention can be roughly divided into three stages, which are: a synchronization phase, a time synchronization interaction phase and a time synchronization offset calculation phase are started.
In the synchronization starting stage, if a node to be networked wants to access a wireless sensor network, negotiation needs to be performed through a network layer RPL protocol, once the node to be networked receives a broadcast DIO message of a certain network node in the wireless sensor network, the node to be networked starts to judge whether the network node sending the broadcast DIO message in the wireless sensor network is suitable for being used as a father node of the node, the network node sending the broadcast DIO message is determined to be an alternative father node, a unicast DIO detection message is sent to the alternative father node, the unicast DIO detection message can be used as trigger of time synchronization, and the time synchronization interaction stage is started at this moment.
In the time synchronization interaction stage, according to the principle of a computer network protocol stack, unicast DIO message transmission of a network layer is represented as data frame transmission at an MAC layer, according to an ACK (acknowledgement) mechanism of the MAC layer, if a node to be networked sends a data frame to an alternative father node, the node to be networked waits for the alternative father node to return an ACK frame acknowledgement to the alternative father node, and the ACK frame represents the successful transmission of the corresponding data frame.
In the time synchronization offset calculation stage, the node to be networked stores the standard time stamp received in the ACK frame for the last 8 times by maintaining a standard time stamp queue, for example, a standard time stamp queue with a length of 8, and performs a queuing operation when receiving a new time stamp. And finally, calculating the time synchronization offset of the time by adopting a linear regression algorithm for the standard timestamp queue, correcting the standard timestamp by utilizing the time synchronization offset to obtain network standard time, and carrying out time synchronization on the nodes to be accessed to the network according to the network standard time.
According to the invention, time synchronization is decoupled into three stages, so that the overall time synchronization precision is higher, the CPU calculation power of the sensor node is more suitable, and no additional communication cost is required.
Corresponding to the embodiment of the method, the invention also discloses a time synchronization device of the wireless sensor network.
Referring to fig. 4, a schematic structural diagram of a time synchronization apparatus for a wireless sensor network disclosed in an embodiment of the present invention is applied to a node to be accessed to a wireless sensor network, where the node to be accessed to the wireless sensor network is to be added to the time synchronization apparatus, and the time synchronization apparatus includes:
a message acquiring unit 301, configured to acquire a broadcast DIO message in the wireless sensor network;
for convenience of description, the present embodiment defines a network node to be joined to the wireless sensor network as a "node to be joined to the network".
In this embodiment, a node to be networked seeks to join a wireless sensor network, where the wireless sensor network is based on a network layer RPL protocol, and the node to be networked detects whether a broadcast DIO packet is sent out in the wireless sensor network on its own channel, and acquires the broadcast DIO packet when detecting the broadcast DIO packet. The broadcast DIO packet is a control packet for discovering a new node and maintaining a route.
For example, the node 5 to be networked in fig. 1 needs to join the wireless sensor network to obtain the broadcast DIO packet sent by the network node 4, and the node 5 to be networked and the network node 4 perform time synchronization interaction based on the broadcast DIO packet.
A parent node determining unit 302, configured to determine a target network node that sends the broadcast DIO packet as an alternative parent node, and send a unicast DIO probe packet to the alternative parent node;
in this embodiment, after receiving a broadcast DIO packet, a node to be networked parses the broadcast DIO packet to obtain an address field for sending the broadcast DIO packet, determines a target network node for sending the broadcast DIO packet based on the address field, and determines the target network node as an alternative parent node.
And the node to be accessed to the network sends a unicast DIO detection message to the alternative father node, wherein the unicast DIO detection message is a detection message selected by the RPL protocol father node based on the communication quality between the nodes. After the node to be networked sends the unicast DIO detection message in the network layer, based on the principle of the computer network protocol stack, the unicast DIO detection message will be transmitted in the form of a data frame in the MAC (Media Access Control) layer, and due to the acknowledgement mechanism of the MAC layer, the destination node needs to return an ACK (acknowledgement character) frame representing acknowledgement after receiving the data frame, so that after the node to be networked sends the unicast DIO detection message to the candidate parent node, it will wait for the candidate parent node to feed back an ACK frame.
A first judging unit 303, configured to judge whether an ACK frame fed back by the candidate parent node is received within a preset time period;
when the ACK frame fed back by the candidate parent node is not received within the preset time period, the node returns to the parent node determining unit 302, and sends the unicast DIO detection packet to the candidate parent node again.
An analyzing unit 304, configured to, if the first determining unit 303 determines that the ACK frame is received, analyze the ACK frame to obtain an ACK frame sequence number and a standard timestamp;
the ACK frame sequence number is used to determine a data frame corresponding to the ACK frame, that is, to determine a unicast DIO probe packet corresponding to the ACK frame.
A second determining unit 305, configured to determine whether the ACK frame is an ACK feedback frame according to the ACK frame sequence number, where the ACK feedback frame is an ACK frame of a MAC layer of the unicast DIO detection packet;
when the ACK frame is judged not to be the ACK feedback frame according to the ACK frame sequence number, the parent node determination unit 302 is returned.
A time synchronization unit 306, configured to perform time synchronization according to the standard timestamp if the second determination unit 305 determines that the time stamp is positive.
In this embodiment, the node to be networked adjusts its own time according to the standard timestamp, thereby achieving time synchronization.
In summary, the invention discloses a time synchronization device of a wireless sensor network, a node to be networked acquires a broadcast DIO message in the wireless sensor network, determines a target network node sending the broadcast DIO message as an alternative father node, sends a unicast DIO detection message to the alternative father node, analyzes an ACK frame to obtain an ACK frame serial number and a standard timestamp when receiving an ACK frame fed back by the alternative father node in a preset time period, and performs time synchronization according to the standard timestamp when determining that the ACK frame is the ACK feedback frame, wherein the ACK feedback frame is the ACK frame of an MAC layer of the unicast DIO detection message. The invention embeds the one-way time synchronization method into the MAC layer confirmation mechanism of the wireless sensor network, encapsulates the standard time stamp into the ACK frame, realizes the transmission of the standard time stamp by utilizing the ACK confirmation mechanism of the MAC layer, has timeliness and does not relate to the processing delay of the upper layer of a network protocol stack, and sends the unicast DIO detection message to the alternative father node through the node to be accessed to trigger the time synchronization process, so that the whole time synchronization process does not generate extra communication overhead, can solve the problem of network congestion caused by extra communication, and is beneficial to the deployment of the high-density wireless sensor network.
In order to further improve the time synchronization precision of the wireless sensor network, the invention further calculates the time synchronization offset of the standard timestamp fed back by the alternative negative node.
The time synchronization unit 306 is specifically configured to:
adding the standard time stamp to a standard time stamp queue;
judging whether the alternative father node is the father node of the node to be accessed to the network or not according to a preset father node judgment standard;
when the alternative father node is the father node of the node to be networked, a linear regression algorithm is adopted for the standard timestamp queue to obtain a time synchronization offset;
correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and carrying out time synchronization according to the network standard time.
In practical application, all standard timestamps in the standard timestamp queue are subjected to straight line fitting to obtain the straight line slope of a fitting straight line, and the time trend can be estimated through a predicted linear function based on the straight line slope so as to realize direct compensation of the standard timestamps.
It should be particularly noted that the time synchronization offset in this embodiment is a time synchronization offset between a node to be networked as a child node and a corresponding parent node.
Calculating the time synchronization offset skew according to the formula (1) and the formula (2), wherein the formula (1) and the formula (2) are as follows:
Figure BDA0003225094940000121
Figure BDA0003225094940000122
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and Toffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure BDA0003225094940000123
is ToffsetThe average value of (a) of (b),
Figure BDA0003225094940000124
is TarriveMean value of (1), TlocalIs the local time of the node to be networked, TglobalIs the network standard time.
To further optimize the above embodiment, the parent node determining unit 302 is specifically configured to:
analyzing the broadcast DIO message to obtain an address field for sending the broadcast DIO message;
determining a target network node for sending the broadcast DIO message based on the address field, and determining the target network node as an alternative father node;
and sending a unicast DIO detection message to the alternative father node.
In summary, the invention uses a first-in first-out timestamp queue to store the standard timestamps, obtains the time synchronization offset by adopting a linear regression algorithm to the standard timestamp queue, and obtains the network standard time by correcting the standard timestamps by using the time synchronization offset. The linear regression algorithm adopted by the invention has the advantage of high time synchronization precision, and the computational power of the network nodes can be borne.
It should be noted that, for the specific working principle of each component in the device embodiment, please refer to the corresponding part of the method embodiment, which is not described herein again.
Finally, it should also be noted that, herein, relational terms such as first and second, and the like may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

Claims (10)

1. A time synchronization method of a wireless sensor network is applied to a node to be accessed into the wireless sensor network, and the time synchronization method comprises the following steps:
acquiring a broadcast DIO message in the wireless sensor network;
determining a target network node which sends the broadcast DIO message as an alternative father node, and sending a unicast DIO detection message to the alternative father node;
judging whether an ACK frame fed back by the alternative father node is received in a preset time period;
if the ACK frame is received, analyzing the ACK frame to obtain an ACK frame sequence number and a standard time stamp;
judging whether the ACK frame is an ACK feedback frame according to the ACK frame serial number, wherein the ACK feedback frame is an ACK frame of an MAC layer of the unicast DIO detection message;
and if the ACK frame is the ACK feedback frame, performing time synchronization according to the standard time stamp.
2. The method according to claim 1, wherein the determining the network node that sends the broadcast DIO packet as an alternative parent node and sending a unicast DIO probe packet to the alternative parent node specifically includes:
analyzing the broadcast DIO message to obtain an address field for sending the broadcast DIO message;
determining a target network node for sending the broadcast DIO message based on the address field, and determining the target network node as an alternative father node;
and sending a unicast DIO detection message to the alternative father node.
3. The method for time synchronization according to claim 1, wherein the time synchronization according to the standard timestamp specifically includes:
adding the standard time stamp to a standard time stamp queue;
judging whether the alternative father node is the father node of the node to be accessed to the network or not according to a preset father node judgment standard;
when the alternative father node is the father node of the node to be networked, a linear regression algorithm is adopted for the standard timestamp queue to obtain a time synchronization offset;
correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and carrying out time synchronization according to the network standard time.
4. The time synchronization method according to claim 3, wherein the time synchronization offset skew is calculated according to the following formula,
Figure FDA0003225094930000021
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and T is the number of standard timestamps in the standard timestamp queueoffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure FDA0003225094930000022
is ToffsetThe average value of (a) of (b),
Figure FDA0003225094930000023
is TarriveIs measured.
5. The time synchronization method according to claim 4, wherein the network standard timestamp T is calculated according to the following formulaglobal
Figure FDA0003225094930000024
In the formula, TlocalAnd the local time is the local time of the node to be networked.
6. A time synchronization device of a wireless sensor network is applied to a node to be accessed into the wireless sensor network, and the time synchronization device comprises:
the message acquisition unit is used for acquiring a broadcast DIO message in the wireless sensor network;
a father node determining unit, configured to determine a target network node that sends the broadcast DIO packet as an alternative father node, and send a unicast DIO probe packet to the alternative father node;
the first judging unit is used for judging whether an ACK frame fed back by the alternative father node is received in a preset time period;
the analysis unit is used for analyzing the ACK frame to obtain an ACK frame serial number and a standard timestamp under the condition that the first judgment unit judges that the ACK frame is positive;
a second judging unit, configured to judge whether the ACK frame is an ACK feedback frame according to the ACK frame sequence number, where the ACK feedback frame is an ACK frame of an MAC layer of the unicast DIO detection packet;
and a time synchronization unit configured to perform time synchronization according to the standard timestamp if the second determination unit determines that the time stamp is included in the standard timestamp.
7. The time synchronization apparatus according to claim 6, wherein the parent node determining unit is specifically configured to:
analyzing the broadcast DIO message to obtain an address field for sending the broadcast DIO message;
determining a target network node for sending the broadcast DIO message based on the address field, and determining the target network node as an alternative father node;
and sending a unicast DIO detection message to the alternative father node.
8. The time synchronization apparatus according to claim 6, wherein the time synchronization unit is specifically configured to:
adding the standard time stamp to a standard time stamp queue;
judging whether the alternative father node is the father node of the node to be accessed to the network or not according to a preset father node judgment standard;
when the alternative father node is the father node of the node to be networked, a linear regression algorithm is adopted for the standard timestamp queue to obtain a time synchronization offset;
correcting the standard timestamp by using the time synchronization offset to obtain network standard time;
and carrying out time synchronization according to the network standard time.
9. The time synchronizer of claim 8, wherein the time synchronization offset skew is calculated according to the following formula,
Figure FDA0003225094930000031
wherein N is the number of standard timestamps in the standard timestamp queue, i is the ith standard timestamp in the standard timestamp queue, and T is the number of standard timestamps in the standard timestamp queueoffset=Tsend–Tarrive,TsendFor ACK frame transmission time, TarriveIn order for the ACK frame to be received time,
Figure FDA0003225094930000032
is ToffsetThe average value of (a) of (b),
Figure FDA0003225094930000033
is TarriveIs measured.
10. The time synchronization apparatus of claim 9,calculating the network standard timestamp T according to the following formulaglobal
Figure FDA0003225094930000034
In the formula, TlocalAnd the local time is the local time of the node to be networked.
CN202110969463.9A 2021-08-23 2021-08-23 A wireless sensor network time synchronization method and device Pending CN113676994A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110969463.9A CN113676994A (en) 2021-08-23 2021-08-23 A wireless sensor network time synchronization method and device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110969463.9A CN113676994A (en) 2021-08-23 2021-08-23 A wireless sensor network time synchronization method and device

Publications (1)

Publication Number Publication Date
CN113676994A true CN113676994A (en) 2021-11-19

Family

ID=78545291

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110969463.9A Pending CN113676994A (en) 2021-08-23 2021-08-23 A wireless sensor network time synchronization method and device

Country Status (1)

Country Link
CN (1) CN113676994A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553358A (en) * 2022-02-25 2022-05-27 重庆邮电大学 A distributed precise time synchronization method for the Internet of Things

Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200004580A (en) * 2018-07-04 2020-01-14 부산대학교 산학협력단 System and Method for Supporting Improved Mobility for Downward Traffic in RPL
CN111083775A (en) * 2019-11-06 2020-04-28 重庆邮电大学 A Time Synchronization Method for IPv6 Wireless Sensor Network Based on RPL Routing Protocol

Patent Citations (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
KR20200004580A (en) * 2018-07-04 2020-01-14 부산대학교 산학협력단 System and Method for Supporting Improved Mobility for Downward Traffic in RPL
CN111083775A (en) * 2019-11-06 2020-04-28 重庆邮电大学 A Time Synchronization Method for IPv6 Wireless Sensor Network Based on RPL Routing Protocol

Non-Patent Citations (3)

* Cited by examiner, † Cited by third party
Title
张安然: "无线传感网络的FTSP时间同步算法优化与实现", 中国知网优秀硕士学位论文, pages 3 *
蒋智鹰: "基于WSN网络的时间同步算法研究", 中国知网优秀硕士学位论文, pages 2 *
赵成: "无线传感器网络技术 基于CC2530与STM32W108芯片的实例与实训", 31 December 2016 *

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114553358A (en) * 2022-02-25 2022-05-27 重庆邮电大学 A distributed precise time synchronization method for the Internet of Things
CN114553358B (en) * 2022-02-25 2023-09-01 深圳市兴海物联科技有限公司 Distributed accurate time synchronization method for Internet of things

Similar Documents

Publication Publication Date Title
CN102457933B (en) Wireless network device, wireless network system and routing control method
Zhang et al. Novel quick start (QS) method for optimization of TCP
JP2004112791A (en) Method of measuring network operation parameter
US20030152110A1 (en) Synchronization of remote network nodes
JPWO2005067227A1 (en) Load balancing method, node and control program
JPWO2005067227A6 (en) Load balancing method, node and control program
CN106162787B (en) A kind of method for routing foundation and device
Kazantzidis et al. End-to-end versus explicit feedback measurement in 802.11 networks
US8804762B2 (en) Method and system for timestamp inclusion in virtual local area network tag
US11909623B2 (en) Device presence method and system for mesh network management
Tan et al. Information quality aware routing in event-driven sensor networks
CN113676994A (en) A wireless sensor network time synchronization method and device
Vallati et al. Analysis of the interplay between RPL and the congestion control strategies for CoAP
US20090276520A1 (en) Method and apparatus for server election, discovery and selection in mobile ad hoc networks
CN102227110A (en) Method, device and communication system for measuring one-way delay
Alaparthi et al. Dynamic source routing protocol—a comparative analysis with AODV and DYMO in zigbeebased wireless personal area network
Sengupta et al. Designing an enhanced ZRP algorithm for MANET and simulation using OPNET
CN103036648A (en) Control and provisioning of wireless access point (CAPWAP) message processing method and processing device
Basagni et al. Localization error-resilient geographic routing for wireless sensor networks
US11677651B2 (en) UDPING—continuous one-way monitoring of multiple network links
CN115001999A (en) A network state detection method in a wireless ad hoc network
Despaux et al. Extracting Markov chain models from protocol execution traces for end to end delay evaluation in wireless sensor networks
Bachran et al. A framework for multicast and quality based forwarding in manets.
JP6698700B2 (en) Aggregating target and exploration queries
Kumar Passive Bandwidth Estimation Techniques for QoS Routing in Wireless LANs

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
RJ01 Rejection of invention patent application after publication
RJ01 Rejection of invention patent application after publication

Application publication date: 20211119