CN111490844A - Clock synchronization method and device and electronic equipment - Google Patents

Clock synchronization method and device and electronic equipment Download PDF

Info

Publication number
CN111490844A
CN111490844A CN202010329926.0A CN202010329926A CN111490844A CN 111490844 A CN111490844 A CN 111490844A CN 202010329926 A CN202010329926 A CN 202010329926A CN 111490844 A CN111490844 A CN 111490844A
Authority
CN
China
Prior art keywords
node
clock
timestamp information
target node
current node
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.)
Granted
Application number
CN202010329926.0A
Other languages
Chinese (zh)
Other versions
CN111490844B (en
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.)
Dalian Linktech Infosystem Co ltd
Original Assignee
Dalian Linktech Infosystem 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 Dalian Linktech Infosystem Co ltd filed Critical Dalian Linktech Infosystem Co ltd
Priority to CN202010329926.0A priority Critical patent/CN111490844B/en
Publication of CN111490844A publication Critical patent/CN111490844A/en
Application granted granted Critical
Publication of CN111490844B publication Critical patent/CN111490844B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W84/00Network topologies
    • H04W84/18Self-organising networks, e.g. ad-hoc networks or sensor networks

Abstract

The application discloses a clock synchronization method, a clock synchronization device and electronic equipment, wherein the method is applied to a current node in a distributed network, and comprises the following steps: receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node; judging whether the timestamp information of the target node is smaller than the timestamp information of the current node, wherein the timestamp information of the current node represents the time of the current node receiving the synchronous signal message of the target node; and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.

Description

Clock synchronization method and device and electronic equipment
Technical Field
The present application relates to the field of network communication technologies, and in particular, to a clock synchronization method and apparatus, and an electronic device.
Background
Clock synchronization is an important basic support technology of the wireless self-organizing network, is the basis for the effective operation and the normal development of the application of the network, is an important problem of the research of the wireless self-organizing network technology, and relates to each stage of the design, the configuration and the specific application of the wireless self-organizing network. In the clock synchronization, a local physical clock or a logical clock of a node is corrected by equipping a special clock synchronization device or designing a corresponding clock synchronization algorithm, so that different nodes in a network have the same clock reference.
The currently common synchronization modes include external synchronization and internal synchronization. The external synchronization uses a satellite pulse per second signal as a time reference to provide a synchronization source for the whole network section, but the external synchronization must rely on the satellite pulse signal, and once the pulse signal is unavailable, the network cannot operate. The internal synchronization scheme generally adopts a structural clock synchronization scheme, which depends on a reference node clock and a specific network topology structure, the clock state of the nodes of the whole network needs to have certain structural division, and if the reference node fails, the clock synchronization of the whole network cannot be realized, so that the internal synchronization scheme cannot be completely adapted to the distributed centerless wireless self-organizing network.
Therefore, a technical solution for realizing clock synchronization in a distributed mobile ad hoc network quickly and effectively is needed.
Disclosure of Invention
In view of the above, the present application provides a clock synchronization method, a clock synchronization device, and an electronic device, including:
a clock synchronization method applied to a current node in a distributed network, the method comprising:
receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
judging whether the timestamp information of the target node is smaller than the timestamp information of the current node, wherein the timestamp information of the current node represents the time of the current node receiving the synchronous signal message of the target node;
and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
Preferably, before determining whether the timestamp information of the target node is less than the timestamp information of the current node, the method further includes:
and correcting the timestamp information of the target node.
Preferably, the method for correcting the timestamp information of the target node includes:
and correcting the timestamp information of the target node by using the transmission delay between the target node and the current node.
Preferably, the method for adjusting the clock of the current node by using the timestamp information of the target node includes:
according to the timestamp information of the target node, obtaining the timestamp offset and the drift amount of the current node relative to the target node;
and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
The above method, preferably, further comprises:
and transmitting a synchronous signal message to at least one other node, wherein the synchronous signal message comprises the timestamp information of the current node, so that the other node at least adjusts the clocks of the other nodes according to the timestamp information of the current node.
A clock synchronization apparatus applied to a current node in a distributed network, the apparatus comprising:
the message receiving unit is used for receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
a timestamp judging unit, configured to judge whether timestamp information of the target node is smaller than timestamp information of the current node, where the timestamp information of the current node represents time when the current node receives a synchronization signal packet of the target node; if the timestamp information of the target node is smaller than the timestamp information of the current node, triggering a clock adjusting unit;
and the clock adjusting unit is used for adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
The above apparatus, preferably, the apparatus further comprises:
and the timestamp correction unit is used for correcting the timestamp information of the target node by using the transmission delay between the target node and the current node before the timestamp judgment unit judges whether the timestamp information of the target node is smaller than the timestamp information of the current node.
Preferably, in the above apparatus, the clock adjusting unit is specifically configured to: according to the timestamp information of the target node, obtaining the timestamp offset and the drift amount of the current node relative to the target node; and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
The above apparatus, preferably, the apparatus further comprises:
a message transmission unit, configured to transmit a synchronization signal message to at least one other node, where the synchronization signal message includes timestamp information of the current node, so that the other node adjusts a clock of the other node at least according to the timestamp information of the current node.
An electronic device that is a current node in a distributed network, the electronic device comprising:
the transmission interface is used for receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
the processor is used for judging whether the timestamp information of the target node is smaller than the timestamp information of the current node, wherein the timestamp information of the current node represents the time when the current node receives the synchronous signal message of the target node; and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
According to the scheme, the clock synchronization method, the clock synchronization device and the electronic equipment provided by the application, the clock adjustment is performed on the current node under the condition that the timestamp information sent by the target node of the neighbor is acquired on any node in the distributed network and the timestamp sent by the target node is smaller than the timestamp of the current node, so that the application does not rely on a certain specific reference node or a specific network topology structure any more, even if a certain neighbor node fails, the clock synchronization can be realized by using other neighbor nodes, the condition of single-point failure in the network is avoided, and the reliability of the clock synchronization in the network is improved.
Meanwhile, in the method, the clock synchronization is carried out on the clock reference of the node with the earlier clock in the whole network, only one broadcast message needs to be periodically sent on each network node, and the clock synchronization can be realized on each network node through the timestamp information of other neighbor nodes through a simple synchronization algorithm based on the broadcast message.
Drawings
In order to more clearly illustrate the technical solutions of the embodiments of the present application, the drawings needed to be used in the description of the embodiments are briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present application, and it is obvious for those skilled in the art to obtain other drawings without creative efforts.
Fig. 1 is a flowchart of a clock synchronization method according to an embodiment of the present application;
fig. 2 is another flowchart of a clock synchronization method according to an embodiment of the present application;
FIG. 3 is a partial flowchart of a first embodiment of the present application;
fig. 4 is a schematic structural diagram of a clock synchronization apparatus according to a second embodiment of the present application;
fig. 5 is another schematic structural diagram of a clock synchronization apparatus according to a second embodiment of the present application;
fig. 6 is a schematic structural diagram of an electronic device according to a third embodiment of the present application;
fig. 7-12 are diagrams illustrating an application of the present application to a wireless ad hoc network.
Detailed Description
Clock synchronization, i.e. the local physical or logical clocks of the nodes in the network are corrected by equipping with special clock synchronization equipment or designing a corresponding clock synchronization algorithm, so that different nodes have the same clock reference. Due to the difference of the hardware quality of each node device, the respective clock crystal oscillation frequencies of the node devices are not completely equal, and external environmental factors such as temperature, humidity, node voltage change and the like also affect the hardware clock source. How to design a clock synchronization scheme to enable nodes in the whole network to have a common clock reference is the clock synchronization problem of the distributed network.
Taking the distributed network as an example of the wireless ad hoc network, in practical applications, clock synchronization is one of the core technologies in the research of wireless ad hoc network technology, and is the key to perform a large number of operations.
First, as a mobile wireless communication network, a wireless ad hoc network, terminals depend on batteries for power supply. In wireless communication, an automatic sleep and wake-up mechanism is typically employed to conserve power of the terminal. If the terminal cannot be awakened or dormant synchronously, normal communication cannot be carried out, so that the time synchronization ensures the synchronism of terminal power management and is particularly important for energy-saving management of the wireless self-organizing network.
Secondly, as the application range of the wireless ad hoc network is gradually expanded, the amount of information transmitted by nodes in the wireless ad hoc network is also rapidly increased, and the traditional contention-based medium access control protocol cannot meet the service requirement. And a Time Division Multiple Access (TDMA) protocol can guarantee the requirements of transmission bandwidth and end-to-end Time delay. In a medium access control protocol using TDMA, each node transmits data in its assigned time slot to ensure that there is no collision with each other, so that the problem of node channel contention can be solved. Since the nodes in the network all use the local clock to determine the position of the time slot, the clocks of the entire network must be kept synchronized. Therefore, clock synchronization is an important basis for the design and implementation of the medium access control protocol of the wireless ad hoc network.
Thirdly, the sensor network is a special wireless self-organizing network, and the network needs mutual cooperation among nodes to realize the collection, transmission and processing of information. For example, in information fusion applications, information collected by a node is meaningful only when clocks of the nodes are consistent; in addition, in the application of automobile speed measurement, only when the speed measurement nodes of the observed motor vehicle keep clock synchronization, the speed information of the measured vehicle can be comprehensively calculated by utilizing the time and position information respectively obtained by each speed measurement node. Therefore, clock synchronization is the basis for the normal deployment of wireless ad hoc network applications.
Finally, wireless ad hoc networks have found wide application in the military field. For example, cooperative attack has wide application prospect in modern war. In the cooperative attack, weapons in different positions and platforms are required to be launched simultaneously, arrive simultaneously and attack targets cooperatively. In this case, each weapon platform must achieve high-precision clock synchronization when self-organizing to form a network, so as to meet the task requirements of cooperative guidance and cooperative attack. In addition, situation awareness and control information is the main service in military application, and if a large clock error exists between nodes, misunderstanding of battlefield situations and command commands can be caused, and the battle effect is seriously influenced.
In summary, clock synchronization is an important basic supporting technology of the wireless ad hoc network, is a basis for the effective operation and normal development of the application of the network, is an important problem of the research of the wireless ad hoc network technology, and relates to each stage of the design, configuration and specific application of the wireless ad hoc network.
It can be seen that the main role of clock synchronization is to keep the time references of the nodes consistent, and the nodes are kept synchronized, so that the common radio resource can be used in a TDMA manner.
The inventor of the present application found through research that: the common synchronization methods include external synchronization and internal synchronization. The external synchronization uses the second pulse signal of GPS or Beidou as a time reference to provide a synchronization source for the whole network section. The method has the advantages of simple realization, high precision, no problems of network splitting and fusion and the like. However, the disadvantage is that it must rely on GPS or beidou pulse signals, and once the pulse signals are unavailable, the network cannot operate. In contrast, internal synchronization does not rely on an external clock source. The internal synchronization scheme can be further divided into a structural type and a distributed type from the perspective of whether the reference node clock in the network is relied on or not. The structural clock synchronization scheme depends on a reference node clock and a specific network topological structure, and the clock state of the nodes of the whole network has certain structural division; the distributed clock synchronization scheme does not depend on a reference node, only focuses on communication with a neighbor node, and is suitable for any network topology structure, and node clock states in the whole network are equal. The method comprises the following specific steps:
1. structured clock synchronization scheme
The structural clock synchronization scheme depends on the clock of a reference node in the clock synchronization process, and the clock state of the nodes of the whole network has certain structural division. The structured clock synchronization scheme has the advantages of simple algorithm, high convergence speed, high convergence precision, suitability for centralized control and the like, but the node clock state distribution has a specific structure, and the clock synchronization depends on a special reference node and a specific network topological structure and cannot be completely adapted to a distributed centerless wireless self-organizing network. Due to the dependence on the reference node and the network topology, the structural clock synchronization scheme has the problems of single-point failure, low robustness and expandability and high overhead of establishing and maintaining the structured logic distribution.
The structural clock synchronization scheme can be divided into three models according to different functions of a reference clock: sender model, sender-receiver model, receiver-receiver model. In the scheme based on the sender model, a reference clock periodically sends unidirectional broadcast messages, and all nodes in the whole network are synchronous to the reference clock; in the scheme based on the sender-receiver model, receiving nodes are synchronized to a reference clock in a bidirectional message exchange mode; in a receiver-receiver model based scheme, the receiving node indirectly synchronizes to a reference clock. The three models are also three typical modes of clock synchronization of every two nodes, namely one-way synchronization, two-way interactive synchronization and mutual synchronization between receiving nodes.
(1) Based on sender model
In the communication process of the structured clock synchronization scheme based on the sender model, firstly, a node is selected as a root node, the root node periodically sends a unidirectional broadcast message carrying local time information to a neighbor node, a receiving node measures the transmission delay of the message, the local time is adjusted to be the time value contained in the received message plus the message transmission delay, and all nodes in the message broadcast range can be synchronized with the root node.
The structural clock synchronization scheme based on the sender model spreads the local clock information in a one-way message broadcasting mode, can effectively reduce the message exchange amount in the communication process, reduces the energy consumption and has expandability. But the sender model ignores the propagation delay in the message transmission process and influences the clock synchronization precision. Although the way of relying on MAC layer time stamps and even physical layer time stamps can improve the synchronization accuracy, the investment cost is high in a large-scale wireless ad hoc network scene.
(2) Based on sender-receiver model
In the communication process of the structured clock synchronization scheme based on the sender-receiver model, messages carrying timestamps are exchanged between the receiving node and the reference node in a two-way mode, and clock deviation between the receiving node and the reference node can be calculated according to the four timestamps. This synchronization mode is also called a master-slave synchronization mode.
The structural clock synchronization scheme based on the sender-receiver model adopts a method for calculating clock deviation based on a two-way timestamp exchange mechanism, considers transmission delay in the whole communication process, and then uses an estimation method to carry out optimization processing on the calculated clock deviation, so that the method is a feasible and effective mode.
(3) Based on a receiver-receiver model
In the communication process of the structured clock synchronization scheme based on the receiver-receiver model, a reference node is used as a third party node to periodically send broadcast messages to neighbors of the reference node, all other nodes which almost simultaneously receive the messages compare receiving timestamps of the broadcast messages through unidirectional message exchange between every two reference nodes, so that clock synchronization between a receiver and the receiver is realized, and the synchronization mode which takes the reference node as the third party is also called a mutual synchronization mode.
The structural clock synchronization scheme based on the receiver-receiver model adopts a mutual synchronization mode, although the clock deviation can be calculated more accurately, when a node in a network has only one neighbor, the current situation that a suspended node cannot be synchronized exists, and the whole network synchronization cannot be effectively ensured. Therefore, the mutual synchronization method is not perfectly suitable for calculating the clock offset, but the precise clock offset calculated by the mutual synchronization method can be used for performing comparative compensation on the clock offset calculated by other methods.
2. Distributed clock synchronization scheme
The wireless self-organizing network is a special network without communication infrastructure support, does not have a central node, and has a dynamic network topology structure. Therefore, the method for the distributed convergence of the nodes of the whole network to the virtual clock accords with the characteristics of the wireless self-organizing network, and can well solve the defects of the structural clock synchronization scheme. The distributed clock synchronization scheme only focuses on communication with the neighbor nodes, so that the distributed clock synchronization scheme is suitable for any network topology structure and has the advantages of strong robustness, high expandability and the like. However, the distributed clock synchronization scheme also has significant disadvantages: when the method is applied to a large-scale wireless self-organizing network, the clock convergence speed of the network node is low; the algorithm for determining the whole network reference is high in complexity, and the nodes are required to have strong processing capacity.
The whole network clock distributed synchronization is based on the clock synchronization of two nodes. Current distributed clock synchronization schemes are largely divided into two categories: relative synchronization methods and absolute synchronization methods based on consistency, the latter being dominant. In the relative synchronization method, only the clock difference between nodes is calculated by each algorithm, the node clock is not adjusted, and the multi-hop synchronization is only executed according to the application requirement, so that the method does not achieve the real full-network clock synchronization. A typical Relative Synchronization method is a Relative reference Receiver/Receiver clock Synchronization protocol R4Syn (Relative reference Receiver/Receiver Synchronization) that calculates a two-point clock bias based on a Receiver-Receiver model, and when a node in a network has only one neighbor, the protocol has a problem that a suspended node cannot be synchronized, and cannot effectively ensure Synchronization of the whole network. The consistency algorithm is a classical distributed algorithm, and the current consistency-based distributed clock synchronization protocol can be divided into two types from the execution scale of the consistency algorithm: a point-to-point consistency model and a group consistency model.
(1) Point-to-point consistency model
According to the distributed clock synchronization scheme based on the point-to-point consistency model, a consistency algorithm is executed and a local clock is adjusted immediately after clock information of a single neighbor node is received, and the clock adjustment between paired nodes is realized. Average Time synchronization ats (average Time sync) is a typical point-to-point coherent clock synchronization protocol, and the main idea is that a node converges to a common virtual clock reference by averaging the logical clocks of each neighboring node.
During actual operation, the ATS is divided into two stages: firstly, a node periodically broadcasts a message carrying a local clock value to a neighbor node, the neighbor node marks a receiving timestamp on an MAC layer after receiving the message, and relative clock drift of a local clock and a sender clock is estimated based on a consistency theory by utilizing the linear property of a hardware clock; and then, the current estimation of the clock drift of the broadcasting node relative to the virtual clock is carried out, and the estimation of the clock drift of other nodes is received, so that the clock drift and the offset of the broadcasting node relative to the virtual clock are estimated based on a consistency theory, the local clock is further adjusted, and the convergence from the whole network to the virtual clock is realized.
The disadvantages of the ATS protocol are evident: propagation delay is ignored due to the sender model used to estimate relative clock drift and virtual clock offset. When there is an indeterminate delay, the ATS cannot be made uniform and the clock synchronization performance will deteriorate. Researchers realize an ATSP (access time synchronization protocol) protocol based on point-to-point consistency through a two-way timestamp exchange mode, but the protocol adopts a unicast communication mode, carries out consistency operation with one-hop neighbor nodes in each iteration process, exchanges six timestamps through three-way handshaking, and has longer synchronization time and more required message exchange amount. When node movement or node loss occurs, the ATSP protocol causes large fluctuation in the synchronization process, and the robustness of the system is not strong.
The Gossip algorithm is a traditional distributed consistency scheme, and the algorithm only utilizes local information of network nodes and information of neighbor nodes to perform data exchange and arithmetic mean, so that all node information in the distributed network tends to be consistent. Distributed clock synchronization based on Gossip algorithm is also a typical point-to-point consistency synchronization. Some researchers apply the Gossip algorithm to a distributed wireless underwater acoustic sensor network, and combine a closed-loop theory and a maximum selection rule to select the best node in the neighborhood for average consistent synchronization, so as to realize the rapid distributed synchronization of the node clocks of the whole network. However, in the scheme, the nodes firstly need to exchange bidirectional messages through unicast, and then calculate clock deviation and drift between the nodes and all one-hop neighbor nodes, so that the message traffic is large, and the network communication load is large.
(2) Group consistency based model
According to the distributed clock synchronization scheme based on the group consistency model, a consistency algorithm is executed and a local clock is updated after clock information of all neighbor nodes is received, and clock adjustment between a node and all one-hop neighbor nodes is realized. The echelon Time Synchronization protocol gtsp (gradient Time Synchronization protocol) is a typical group coherence clock Synchronization scheme, and its main idea is: after receiving the clock information of all neighbors, the local node adjusts the local clock offset and the clock drift according to the consistency theory until the whole network converges to a uniform value. The method adopts a one-way broadcast mode to send a time message with a local clock value to a neighbor node, and marks a message timestamp on an MAC layer.
The GTSP protocol based on group consistency has the advantages of simple protocol, high convergence precision, strong robustness and expandability and the like. However, the GTSP also ignores propagation delay in the message passing process, and directly uses the neighbor clock value in the message, so that the neighbor clock used in each iteration is not accurate. Also having the same problem is the broadcast reception protocol BRS (broadcast and Receive synchronization). Different from the GTSP, each node in the BRS protocol only carries out average consistent operation on the clock values and the clock frequencies of all one-hop neighbors which do not contain the node. The group neighbor average gna (group neighbor average) protocol overcomes the influence of transmission delay by adopting two-way timestamp switching, and each node (taking an i node as an example) needs to send two broadcast packets and N unicast packets in the one-time whole network iteration process, so that the message switching amount is large, and the network communication load is large.
In summary, since the wireless ad hoc network is a distributed centerless network and there is no central node providing a clock reference, the structural clock synchronization scheme needs to adopt a specific algorithm to select a certain clock as a reference clock in the whole network, and this way faces the problem that: the single point failure problem exists, and the robustness of the algorithm is not high; the overhead of maintaining a network topology of a structural formula is large; the performance is sharply reduced when the network topology changes rapidly; the problem of clock reference adjustment when multiple networks are combined needs to be solved. The distributed clock synchronization scheme determines a coordinated virtual reference clock through whole network coordination, and the mode has low convergence speed and high algorithm complexity and requires that nodes have strong processing capacity.
Through further research, the inventor of the application provides a distributed self-adaptive clock reference determination algorithm, and combines the advantages of a structural formula and a distributed clock synchronization algorithm, so that the network synchronization method is simple in algorithm, fast in convergence, strong in robustness and high in expandability. The time reference determination algorithm of the scheme determines the virtual clock reference only by calculating the precedence relationship of the time information contained in the clock signal received within a certain time, does not need a specific network topology structure and does not depend on the identity information of the nodes in the network, so that the characteristics of distribution and topology change of the wireless self-organizing network can be better adapted. Based on the clock reference self-adaptive network synchronization algorithm, the rapid initial clock synchronization during network establishment can be realized, the clock synchronization during the network operation process is maintained, and the problems of single-point failure, incapability of adapting to rapid change of network topology and clock reference adjustment during merging of a plurality of networks in the traditional structural clock synchronization scheme are solved. The method comprises the following specific steps:
on the basis of the method, if the timestamp information of the target node is smaller than the timestamp information of the current node, the clock of the current node is adjusted by using the timestamp information of the target node, so that the clock of the current node and the clock of the target node keep synchronous.
In specific implementation, before determining whether the timestamp information of the target node is less than the timestamp information of the current node, the timestamp information of the target node may be corrected first on the current node, for example, the timestamp information of the target node is corrected by using a transmission delay between the target node and the current node, and then it is determined whether the corrected timestamp information of the target node is less than the timestamp information of the current node, and if the corrected timestamp information of the target node is less than the timestamp information of the current node, the clock of the current node is adjusted by using the corrected timestamp information of the target node, so that the clock of the current node and the clock of the target node are kept synchronous.
In an implementation manner, when the current node adjusts the clock of the current node by using the timestamp information of the target node, the timestamp offset and the drift amount of the current node relative to the target node may be obtained according to the timestamp information of the target node, and then the clock of the current node is adjusted according to at least the timestamp offset and the drift amount, so that the clock of the current node and the clock of the target node are kept synchronous.
In addition, the current node can also transmit a synchronization signal message to at least one other node, wherein the synchronization signal message comprises the timestamp information of the current node, so that the other node can adjust the clocks of the other nodes at least according to the timestamp information of the current node.
Therefore, in the scheme provided by the inventor of the application, clock adjustment is performed on the current node only when timestamp information sent by a target node of a neighbor is acquired on any node in the distributed network and the timestamp sent by the target node is smaller than the timestamp of the current node, so that the application does not rely on a specific reference node or a specific network topology, and even if a certain neighbor node fails, clock synchronization can be realized by using other neighbor nodes, thereby avoiding the condition of single point failure in the network and improving the reliability of clock synchronization in the network.
Meanwhile, in the scheme provided by the inventor of the application, clock synchronization is performed in the whole network by taking the clock of the node with an earlier clock as a clock reference, only one broadcast message needs to be periodically sent on each network node, and clock synchronization can be realized on each network node through timestamp information of other neighbor nodes through a simple synchronization algorithm based on the broadcast message.
The technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are only a part of the embodiments of the present application, 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 application.
Referring to fig. 1, a flowchart of an implementation of a clock synchronization method provided in an embodiment of the present application is shown, where the method may be applied to any current node in a distributed network that needs to perform clock synchronization. The distributed network in this embodiment may take a wireless (mobile) ad hoc network as an example, and nodes in the network refer to various electronic devices such as mobile terminals. The technical scheme in the embodiment is mainly used for realizing clock synchronization among all nodes in the distributed network and improving the reliability of the clock synchronization.
Specifically, the method in this embodiment may include the following steps:
step 101: and receiving a synchronous signal message transmitted by at least one target node.
The target node may be understood as a node capable of performing message interaction with the current node, and may be a neighbor node performing message interaction with the current node for the first time, or a neighbor node performing message interaction with the current node once. In this embodiment, the synchronization signal packet of the target node at least includes timestamp information of the target node, and certainly, the synchronization signal packet may also include node-related information of the target node, such as a node identifier.
Note that the timestamp information of the target node means: when the target node generates the synchronous signal message, the time corresponding to the target node when the clock synchronous signal message of the target node is generated is represented according to the clock on the target node, the time and other information input into the synchronous signal message.
In this embodiment, the current node may receive a synchronization signal packet periodically transmitted by one target node, or in this embodiment, the current node may receive synchronization signal packets periodically transmitted by a plurality of target nodes within a certain time period.
Step 102: and judging whether the timestamp information of the target node is smaller than that of the current node, if so, executing the step 103, otherwise, not processing.
The timestamp information of the current node represents the time when the current node receives the synchronous signal message of the target node.
In a specific implementation, in the case that there is one synchronization signal message, in this embodiment, only the timestamp information of the target node in the synchronization signal message is compared with the timestamp information of the current node, and if the timestamp information of the target node is smaller than the timestamp information of the current node, step 103 is executed;
in the case that there are multiple synchronization signal messages, in this embodiment, the timestamp information of the target node in the multiple synchronization signal messages may be sorted according to size, then the sorted minimum timestamp information is compared with the timestamp information of the current node, and in the case that the minimum timestamp information is smaller than the timestamp information of the current node, step 103 is executed;
alternatively, in the case that there are a plurality of synchronization signal messages, in this embodiment, the time stamp information of the target node in the plurality of synchronization signal messages may be sequentially compared with the time stamp information of the current node in size, when there is a target node whose time stamp information is smaller than the time stamp information of the current node, step 103 may be executed, and when the time stamp information of the target node is not smaller than the time stamp information of the current node, no processing may be performed.
Step 103: and adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
Specifically, in this embodiment, the clock of the current node is adjusted, so that the current node uses the clock of the target node as the virtual clock reference, and thus, the clock of the current node can keep synchronous with the clock of the target node.
According to the scheme, in the clock synchronization method provided by the embodiment of the application, the clock adjustment is performed on the current node under the condition that the timestamp information sent by the target node of the neighbor is acquired on any node in the distributed network and the timestamp sent by the target node is smaller than the timestamp of the current node, so that the application does not depend on a certain specific reference node or a specific network topology structure any more, and even if a certain neighbor node fails, the clock synchronization can be realized by using other neighbor nodes, so that the condition of single-point failure in the network is avoided, and the reliability of the clock synchronization in the network is improved.
Meanwhile, in the first embodiment of the present application, clock synchronization is performed in the whole network with the clock of a node with an earlier clock as a clock reference, only one broadcast packet needs to be periodically sent on each network node, and clock synchronization can be achieved on each network node through timestamp information of other neighboring nodes through a simple synchronization algorithm based on the broadcast packet.
Based on the above implementation, the current node in this embodiment also periodically transmits a synchronization signal packet to at least one other node, for example, broadcasts a synchronization signal packet at regular intervals, where the synchronization signal packet transmitted by the current node includes timestamp information of the current node, so that the other node at least adjusts clocks of the other nodes according to the timestamp information of the current node. And when the other nodes adjust the clocks of the other nodes according to the timestamp information of the current node, the other nodes can be implemented according to the synchronization scheme described in the foregoing fig. 1 and related contents, and details are not described here.
In an implementation manner, because there is a transmission delay in packet transmission between the current node and the target node, in step 102 in this embodiment, before determining whether the timestamp information of the target node is less than the timestamp information of the current node, the method may further include the following steps, as shown in fig. 2:
step 104: and correcting the timestamp information of the target node.
In specific implementation, the timestamp information of the target node may be corrected by a correction function according to the prior information, for example, in this embodiment, the transmission delay between the target node and the current node is obtained in advance as the prior information, and then the transmission delay between the target node and the current node is used to correct the timestamp information of the target node.
Specifically, the transmission delay between the current node and the target node may be performed in advance by performing packet interaction between the current node and the target node, so that the transmission delay is obtained through a plurality of timestamps in the interactive packet, the priori information is preset according to the transmission delay, and when the timestamp information of the target node needs to be corrected, the timestamp information of the target node is corrected directly according to the transmission delay in the priori information by using the correction function.
For example, for the current node a and the target node b, ta is the timestamp information of the current node a, tb is the timestamp information of the target node b, the correction function is f (tb) ═ tb + tba, tba is the transmission delay between the target node and the current node, and therefore, in the present embodiment, after the timestamp information tb of the target node is obtained, tb is substituted into the correction function, that is, tb is added to tba, and the timestamp information tb of the target node after correction is obtained.
In one implementation manner, in the present embodiment, when the clock of the current node is adjusted by using the timestamp information of the target node, step 103 may be specifically implemented in the following manner, as shown in fig. 3:
step 301: and according to the timestamp information of the target node, acquiring the timestamp offset and the drift amount of the current node relative to the target node.
For example, in this embodiment, the timestamp information of the target node is subtracted from the timestamp information of the current node to obtain a time difference between the timestamp information of the target node and the timestamp information of the current node, that is, a timestamp offset of the current node relative to the target node, and a drift amount of the current node relative to the target node is estimated or calculated according to the timestamp offset, where the drift amount represents a time deviation between the current node and the target node in unit time.
Step 302: and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
Specifically, in this embodiment, the clock of the current node may be compensated by using the timestamp offset, so that the clock of the current node is as consistent as possible with the virtual clock reference.
For example, for a current node a and a target node b, ta is timestamp information of the current node a, tb is timestamp information of the target node b, and the clock of the current node a is compensated by using a timestamp offset y between the target node and the current node, that is, the clock of the current node T subtracts y, so as to obtain an adjusted clock of the current node which is synchronous with the clock of the target node b.
Further, in this embodiment, a clock drift amount between the target node and the current node may be estimated in advance, and based on this, the timestamp offset and the clock drift amount in this embodiment compensate the clock of the current node, so that the clock of the current node is as consistent as possible with the virtual clock reference.
For example, the clock of the current node a is compensated by using the timestamp offset y and the clock drift x between the target node and the current node, that is, the clock T of the current node is multiplied by x, and then y is subtracted to obtain the adjusted clock of the current node which is synchronous with the clock of the target node b.
Referring to fig. 4, a schematic structural diagram of a clock synchronization apparatus according to a second embodiment of the present disclosure is provided, where the apparatus may be configured at any current node in a distributed network that needs to perform clock synchronization. The distributed network in this embodiment may take a wireless (mobile) ad hoc network as an example, and nodes in the network refer to various electronic devices such as mobile terminals. The technical scheme in the embodiment is mainly used for realizing clock synchronization among all nodes in the distributed network and improving the reliability of the clock synchronization.
Specifically, the apparatus in this embodiment may include the following units:
a message receiving unit 401, configured to receive a synchronization signal message transmitted by at least one target node, where the synchronization signal message at least includes timestamp information of the target node to which the synchronization signal message belongs;
a timestamp determining unit 402, configured to determine whether timestamp information of the target node is smaller than timestamp information of the current node, where the timestamp information of the current node represents time when the current node receives a synchronization signal packet of the target node; if the timestamp information of the target node is smaller than the timestamp information of the current node, triggering a clock adjusting unit;
a clock adjusting unit 403, configured to adjust the clock of the current node by using the timestamp information of the target node, so that the clock of the current node and the clock of the target node keep synchronous.
In a specific implementation, the clock adjusting unit 403 is specifically configured to: according to the timestamp information of the target node, obtaining the timestamp offset and the drift amount of the current node relative to the target node; and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
It can be known from the foregoing solution that, in a clock synchronization apparatus provided in the second embodiment of the present application, clock adjustment is performed on a current node only when timestamp information sent by a target node of a neighbor is acquired on any node in a distributed network and a timestamp sent by the target node is smaller than a timestamp of the current node, so that the present application does not rely on a specific reference node or a specific network topology, and even if a certain neighbor node fails, clock synchronization can be implemented by using another other neighbor nodes, thereby avoiding a case of single-point failure in the network, and improving reliability of clock synchronization in the network.
Meanwhile, in the second embodiment of the present application, clock synchronization is performed in the whole network with the clock of the node with an earlier clock as a clock reference, only one broadcast packet needs to be periodically sent on each network node, and based on the broadcast packet, clock synchronization can be achieved on each network node through timestamp information of other neighboring nodes by a simple synchronization algorithm, so that the node does not need to have strong processing capability, fast convergence of the whole network clock synchronization can be achieved, and a large amount of packet interaction does not need to be performed in the network, and the clock synchronization can be spread to each node in the network through the simple algorithm, so that the packet interaction amount in the network can be obviously reduced, thereby reducing the network load in the clock synchronization process, and further accelerating the convergence of the whole network clock synchronization.
In one implementation, the following units may also be included in the apparatus in this embodiment, as shown in fig. 5:
a timestamp correction unit 404, configured to correct the timestamp information of the target node by using the transmission delay between the target node and the current node before the timestamp determination unit determines whether the timestamp information of the target node is smaller than the timestamp information of the current node.
A message transmitting unit 405, configured to transmit a synchronization signal message to at least one other node, where the synchronization signal message includes timestamp information of the current node, so that the other node adjusts a clock of the other node at least according to the timestamp information of the current node.
It should be noted that, for the specific implementation of each unit in the present embodiment, reference may be made to the corresponding content in the foregoing, and details are not described here.
Referring to fig. 6, a schematic structural diagram of an electronic device provided in the third embodiment of the present application is shown, where the electronic device may be any current node in a distributed network that needs to perform clock synchronization. The distributed network in this embodiment may take a wireless (mobile) ad hoc network as an example, and nodes in the network refer to various electronic devices such as mobile terminals. The technical scheme in the embodiment is mainly used for realizing clock synchronization among all nodes in the distributed network and improving the reliability of the clock synchronization.
Specifically, the electronic device in this embodiment may include the following structure:
a transmission interface 601, configured to receive a synchronization signal packet transmitted by at least one target node, where the synchronization signal packet at least includes timestamp information of the target node to which the synchronization signal packet belongs;
a processor 602, configured to determine whether timestamp information of the target node is smaller than timestamp information of the current node, where the timestamp information of the current node represents time when the current node receives a synchronization signal packet of the target node; and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
It should be noted that, before determining whether the timestamp information of the target node is less than the timestamp information of the current node, the processor 602 is further configured to: and correcting the timestamp information of the target node by using the transmission delay between the target node and the current node.
Certainly, the transmission interface 601 is further configured to transmit a synchronization signal packet of the current node to another node, where the synchronization signal of the current node includes at least timestamp information of the current node, so that the other node adjusts a clock of the other node at least according to the timestamp information of the current node.
According to the scheme, in the electronic device provided by the third embodiment of the present application, the timestamp information sent by the target node of the neighbor is acquired at any node in the distributed network, and the clock of the current node is adjusted only when the timestamp sent by the target node is smaller than the timestamp of the current node.
Meanwhile, in the third embodiment of the present application, clock synchronization is performed in the whole network with the clock of the node with an earlier clock as a clock reference, only one broadcast packet needs to be periodically sent on each network node, and clock synchronization can be achieved on each network node through timestamp information of other neighboring nodes through a simple synchronization algorithm based on the broadcast packet.
The following takes the implementation of clock synchronization in a wireless ad hoc network as an example to illustrate the clock reference adaptive determination algorithm implemented in the present application:
the time reference self-adaptive determination algorithm in the application determines a virtual clock reference in a distributed and self-adaptive manner by comparing the precedence relationship of time (timestamp) information contained in clock signals of different nodes, and provides a reference clock for a subsequent clock synchronization algorithm.
It is assumed that each node in the wireless ad hoc network periodically transmits its clock signal, i.e., a synchronization signal message containing timestamp information, the synchronization signal message contains necessary time information, and the synchronization signal messages transmitted by each node after the network synchronization do not collide. The node which needs to perform clock synchronization firstly receives the synchronization signal messages sent by other nodes within a certain time, extracts corresponding time information, then sorts the messages according to the sequence of the obtained time information, compares the time information with the first time information after sorting, and finally selects the corresponding time information as a virtual clock reference according to the comparison result, wherein the specific algorithm flow is as shown in fig. 7:
1. and the node a receives the synchronous signal messages sent by other nodes within a certain time, extracts corresponding time information, assumes that the time information of the node a is t _ a, receives the synchronous signal messages of the nodes b, c and d, and obtains corresponding time information t _ b ', t _ c ' and t _ d '.
2. The node a corrects the obtained time information according to the prior information, and assumes that the corrected time information is t _ b ═ f (t _ b '), t _ c ═ f (t _ c '), and t _ d ═ f (t _ d '), where the correction function f (x) is determined according to actual needs. For example, as shown in fig. 8, node a knows that the transmission time delays of nodes b, c, d are t _ ba, t _ ca, t _ da, and if the corresponding correction function is determined to be f (x _ i) ═ x _ i + t _ ia, then t _ b ═ t _ b ' + t _ ba, t _ c ═ t _ c ' + t _ ca, and t _ d ═ t _ d ' + t _ da.
3. And the node a sorts the corrected time information according to the sequence to obtain time information sequences of other nodes, and if the corrected result is shown in fig. 8, t _ d < t _ c < t _ b.
4. The node a compares the self time information t _ a with the precedence order of the first element t _ d of the time information sequence after sequencing, and if t _ d is less than t _ a, the t _ d is determined to be the virtual clock reference of the node a; if t _ a < t _ d, determining its own time information as the virtual clock reference.
5. During the network synchronization process, the nodes are in equal status, so that other nodes b, c and d in the network also determine their virtual clock references in the same way as node a.
As described above, the nodes in the network determine the sequence of the clocks of the neighboring nodes according to the received time information of the neighboring nodes and the transmission delay of the prior information of the nodes, and then select the node clock at the top as the virtual clock reference to implement the adopted clock synchronization method to perform network synchronization. The acquisition of the time information of the neighbor node is mainly obtained by receiving a synchronization signal message of the neighbor node, and the acquisition of the prior information can be obtained by interacting the synchronization signal message with the neighbor node, or by interacting other types of messages.
Therefore, the virtual clock reference determined in the application does not depend on a specific network topology and the identity of the nodes in the network, so that when some nodes in the network fail, the determination of the virtual clock reference of other nodes is not influenced, namely, the problem of single point failure does not exist. As shown in fig. 8, the node a determines a virtual clock reference with reference to the time information of the node d by using a clock reference adaptive determination algorithm, and adjusts its own time information according to a network time synchronization method. When the node d fails, the virtual clock reference re-determined by the node a according to the algorithm is the time information of the node a, so that no adjustment is needed, namely, the reference time information of the virtual clock reference determined by the node a realizes smooth transition among network nodes. More generally, for any node that completes network synchronization, the time information of the node has been adjusted according to the virtual reference clock, so the time information of the node itself becomes a backup of the virtual clock reference, and when the reference node of the virtual clock reference fails, the time information of the node itself becomes a new virtual clock reference.
In addition, no specific network topology information is used in the execution process of the technical scheme, so that the determined virtual clock reference can be kept stable when the network topology structure is dynamically changed, and the method is favorable for fast convergence of network synchronization and improvement of synchronization precision.
The simplest example of a structured clock synchronization scheme combining a clock reference adaptive determination algorithm with one-way synchronization is given below, and the advantages of no single point failure problem and no dependence on a specific network topology are mainly illustrated. After the network node uses the clock reference self-adaptive determination algorithm to determine the virtual clock reference, a structured clock synchronization scheme based on a sender model is adopted. It is assumed that there is no clock drift between clocks of network nodes and propagation delay of the time information packet is ignored in the time synchronization process. Therefore, the node time synchronization in the example only needs to estimate the clock offset, and then the network node directly adjusts the local time to the time of the virtual clock reference according to the clock offset estimation, and the corresponding correction function is f (x _ i) ═ x _ i.
As shown in fig. 9, an example of synchronization performed by a network with 4 nodes is given, where fig. 9(a) gives a neighbor relationship between nodes, fig. 9(b) gives time information (t _ a, t _ b, t _ c, t _ d) of each node at an initial time, a precedence relationship between each other (t _ a > t _ b > t _ c > t _ d) and a precedence order of arrival of a sent time information packet at each node, and after the following time synchronization process, the nodes in the network complete time synchronization:
1. and the node a receives the synchronous signal messages sent by other nodes within a certain time T and extracts corresponding time information, and supposing that the time information of the node a is T _ a, the synchronous signal messages of the nodes b, c and d are received to obtain corresponding time information T _ b ', T _ c ' and T _ d '.
2. The node a calculates the time information t _ b, t _ c, t _ d provided by the synchronization signal message according to the correction function f (x).
3. And the node a sorts the obtained time information according to the sequence to obtain a time information sequence t _ d < t _ c < t _ b of other nodes.
4. And the node a compares the self time information t _ a with the sequence of the first element t _ d of the time information sequence after sequencing. Because t _ d < t _ a, t _ d is determined to be its own virtual clock reference and its own time information is adjusted.
Similarly, nodes b, c, d also determine their virtual clock references in the same manner as node a. Finally, the node b and the node c determine t _ d as the virtual clock reference of the node b and the node d determines the time of the node b as the virtual clock reference.
As shown in fig. 9(c), the time information (t _ a, t _ b, t _ c, and t _ d) after each node completes synchronization, the precedence relationship between each node (t _ b > t _ c > t _ a > t _ d), and the arrival order of the transmitted time information packets at each node are given. According to the network synchronization process, the node synchronization process only uses the precedence relationship of the time information contained in the time information message received within a certain time, and the information is irrelevant to the specific network topology structure, the identity of the node in the network and other information, so that the characteristics of the wireless self-organizing network distribution type and topology change can be better adapted.
In addition, after network synchronization, if the nodes a, b and c fail, obviously, the network synchronization of other nodes is not affected, because the virtual reference clocks of other nodes are not the nodes a, b and c; if the node d fails, as shown in fig. 10, the nodes a, b, and c all find that their own time information is prior to the time information of other nodes, and use their own time information as a virtual reference clock without any adjustment to the network synchronization of the nodes. Therefore, the network synchronization algorithm provided by the invention realizes the smooth transition of the virtual clock reference and solves the single-point failure problem of the traditional structural clock synchronization scheme.
The wireless self-organizing network node is assumed to use the clock reference self-adaptive structural network synchronization method provided by the application to carry out initial network synchronization. After the node is started, the time information messages broadcast by other nodes are received within a certain time T, and then the time information messages of the node are periodically broadcast according to the appointed time interval. However, there may be no neighbor node, a single neighbor node, a plurality of neighbor nodes, etc. for the nodes in the network, and the network synchronization process of the nodes is described in the following cases.
(1) Non-neighbor node
After the node is started, if the time information message broadcasted by any node is not received within the time length of T, the node is considered to be an isolated node, so that the time information message of the node is periodically broadcasted according to the appointed time interval, other nodes are allowed to receive the time information message, a network synchronization process is initiated, and meanwhile, the time information message broadcasted by other nodes is continuously received within a certain time T.
(2) Single neighbor node
After a node is started, a time information message broadcasted by the node is received within a time length of T, a virtual reference clock is determined according to the received time information message and the time information of the node, the time information of the node is adjusted, the time information message of the node is periodically broadcasted according to an appointed time interval, other nodes are allowed to receive the time information message, a network synchronization process is initiated, meanwhile, the time information message broadcasted by other nodes is continuously received within a certain time T, and the time information of the node is adjusted according to needs.
(3) Multiple neighbor nodes
After a node is started, receiving time information messages broadcast by a plurality of nodes within the time length of T, determining a virtual reference clock according to the received time information messages and the time information of the node, adjusting the time information of the node, periodically broadcasting the time information messages of the node according to an appointed time interval, allowing other nodes to receive the time information messages, initiating a network synchronization process, continuously receiving the time information messages broadcast by other nodes within a certain time T, and adjusting the time information of the node according to needs.
There may be multiple scenarios when a node receives a time information packet broadcast by multiple nodes, and three possible typical scenarios are shown in fig. 11. In fig. 11(a), node B has received the time information packet from node A, C, D, and nodes a and C have completed network synchronization with each other, while node D is an isolated node; in fig. 11(B), node B has received the time information packets of node a and node C, and node A, C, D has completed network synchronization with each other; in fig. 11(c), the node B receives the time information packet from the node A, C, E, G, and the node A, C, D and the node E, F, G have respectively completed network synchronization, forming two independent sets of synchronization nodes. Although the node exists in the process of network synchronization and is not limited to the various scenarios described above, because the network synchronization method provided by the present application does not depend on the specific network topology and the identity information of the network node, and only executes the corresponding algorithm according to the sequence in which the node receives the time information of other nodes, the node B in fig. 11 only needs to execute network synchronization in a uniform processing manner. Eventually, after several iterations, the nodes in the network will reach and maintain full network synchronization.
In addition, the scenario shown in fig. 11(c) can also be regarded as a specific example of network merging, i.e., a process in which a synchronization network ACD and a synchronization network EFG are merged to form a larger synchronization network or a part of the larger synchronization network. The network merging process can be subdivided into the following steps:
1. the node B receives other node time information messages, extracts corresponding time information, and compares the time information of the synchronous network ACD, the time information of the synchronous network EFG and the sequence of the time information of the node B;
2. if the time information of the synchronous network ACD is earlier, the node B synchronizes to the synchronous network ACD, sends an adjusted time information message according to a given time interval, and then the synchronous network EFG gradually synchronizes to the time information of the node B, so as to finally realize the network synchronization of the whole network ABCDEFG;
3. if the time information of the synchronous network EFG is earlier, the node B synchronizes to the synchronous network EFG, sends an adjusted time information message according to a given time interval, and then the synchronous network ACD gradually synchronizes to the time information of the node B, thereby finally realizing the network synchronization of the whole network ABCDEFG;
4. if the time information of the node B is earlier, the node B does not adjust the time information of the node B, only sends the time information message of the node B according to the appointed time interval, then synchronizes the ACD and the EFG of the network gradually to the time information of the node B, and finally realizes the network synchronization of the whole network ABCDEFG.
As shown in fig. 12, it can be seen that the method and the device for adjusting the clock reference simply, quickly and effectively solve the problem of adjusting the clock reference when multiple networks are combined, and can realize quick combination of multiple networks.
Therefore, the virtual clock reference can be determined only by calculating the precedence relationship of the time information contained in the clock signals received within a certain time. Therefore, the advantages of the structural formula and the distributed clock synchronization algorithm are combined, so that the network synchronization method is simple in algorithm, fast in convergence, strong in robustness and high in expandability. Moreover, the method and the device do not need a specific network topology structure, do not depend on the identity information of the nodes in the network, and can better adapt to the characteristics of the wireless self-organizing network distribution and topology change. Meanwhile, the method and the device solve the problems of single-point failure, incapability of adapting to rapid change of network topology and clock reference adjustment during merging of a plurality of networks in the traditional structural clock synchronization scheme.
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 device disclosed by the embodiment corresponds to the method disclosed by the embodiment, so that the description is simple, and the relevant points can be referred to the method part for description.
Those of skill would further appreciate that the various illustrative elements and algorithm steps described in connection with the embodiments disclosed herein may be implemented as electronic hardware, computer software, or combinations of both, and that the various illustrative components and steps have been described above generally in terms of their functionality in order to clearly illustrate this interchangeability of hardware and software. Whether such functionality is implemented as hardware or software depends upon the particular application and design constraints imposed on the implementation. Skilled artisans may implement the described functionality in varying ways for each particular application, but such implementation decisions should not be interpreted as causing a departure from the scope of the present application.
The steps of a method or algorithm described in connection with the embodiments disclosed herein may be embodied directly in hardware, in a software module executed by a processor, or in a combination of the two. A software module may reside in Random Access Memory (RAM), memory, Read Only Memory (ROM), electrically programmable ROM, electrically erasable programmable ROM, registers, hard disk, a removable disk, a CD-ROM, or any other form of storage medium known in the art.
The previous description of the disclosed embodiments is provided to enable any person skilled in the art to make or use the present application. 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 application. Thus, the present application 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 clock synchronization method applied to a current node in a distributed network, the method comprising:
receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
judging whether the timestamp information of the target node is smaller than the timestamp information of the current node, wherein the timestamp information of the current node represents the time of the current node receiving the synchronous signal message of the target node;
and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
2. The method of claim 1, wherein prior to determining whether the timestamp information of the target node is less than the timestamp information of the current node, the method further comprises:
and correcting the timestamp information of the target node.
3. The method of claim 2, wherein modifying the timestamp information of the target node comprises:
and correcting the timestamp information of the target node by using the transmission delay between the target node and the current node.
4. The method of claim 1 or 2, wherein adjusting the clock of the current node using the timestamp information of the target node comprises:
according to the timestamp information of the target node, obtaining the timestamp offset and the drift amount of the current node relative to the target node;
and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
5. The method of claim 1 or 2, further comprising:
and transmitting a synchronous signal message to at least one other node, wherein the synchronous signal message comprises the timestamp information of the current node, so that the other node at least adjusts the clocks of the other nodes according to the timestamp information of the current node.
6. A clock synchronization apparatus applied to a current node in a distributed network, the apparatus comprising:
the message receiving unit is used for receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
a timestamp judging unit, configured to judge whether timestamp information of the target node is smaller than timestamp information of the current node, where the timestamp information of the current node represents time when the current node receives a synchronization signal packet of the target node; if the timestamp information of the target node is smaller than the timestamp information of the current node, triggering a clock adjusting unit;
and the clock adjusting unit is used for adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
7. The apparatus of claim 6, further comprising:
and the timestamp correction unit is used for correcting the timestamp information of the target node by using the transmission delay between the target node and the current node before the timestamp judgment unit judges whether the timestamp information of the target node is smaller than the timestamp information of the current node.
8. The apparatus according to claim 6 or 7, wherein the clock adjustment unit is specifically configured to: according to the timestamp information of the target node, obtaining the timestamp offset and the drift amount of the current node relative to the target node; and adjusting the clock of the current node at least according to the timestamp offset and the drift amount so as to keep the clock of the current node and the clock of the target node synchronous.
9. The apparatus of claim 6 or 7, further comprising:
a message transmission unit, configured to transmit a synchronization signal message to at least one other node, where the synchronization signal message includes timestamp information of the current node, so that the other node adjusts a clock of the other node at least according to the timestamp information of the current node.
10. An electronic device, wherein the electronic device is a current node in a distributed network, the electronic device comprising:
the transmission interface is used for receiving a synchronous signal message transmitted by at least one target node, wherein the synchronous signal message at least comprises timestamp information of the target node;
the processor is used for judging whether the timestamp information of the target node is smaller than the timestamp information of the current node, wherein the timestamp information of the current node represents the time when the current node receives the synchronous signal message of the target node; and if the timestamp information of the target node is smaller than the timestamp information of the current node, adjusting the clock of the current node by using the timestamp information of the target node so as to keep the clock of the current node and the clock of the target node synchronous.
CN202010329926.0A 2020-04-24 2020-04-24 Clock synchronization method and device and electronic equipment Active CN111490844B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202010329926.0A CN111490844B (en) 2020-04-24 2020-04-24 Clock synchronization method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202010329926.0A CN111490844B (en) 2020-04-24 2020-04-24 Clock synchronization method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN111490844A true CN111490844A (en) 2020-08-04
CN111490844B CN111490844B (en) 2022-07-19

Family

ID=71811854

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202010329926.0A Active CN111490844B (en) 2020-04-24 2020-04-24 Clock synchronization method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN111490844B (en)

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113726466A (en) * 2021-07-21 2021-11-30 歌尔股份有限公司 Wearable device and signal acquisition method thereof
WO2022027534A1 (en) * 2020-08-07 2022-02-10 福州通安电子有限公司 Lamp synchronization method and terminal
CN114089258A (en) * 2021-11-10 2022-02-25 许继集团有限公司 Clock acceleration simulation operation method and system for intelligent electric energy meter
CN115038161A (en) * 2022-07-25 2022-09-09 苏州德姆斯信息技术有限公司 Vibration data wireless synchronous acquisition method and system and vibration monitoring system
CN117880957A (en) * 2024-03-11 2024-04-12 山东浪潮数据库技术有限公司 Ad hoc network subnet fusion method based on LTE channel

Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7256627B1 (en) * 2005-01-13 2007-08-14 Advanced Micro Devices, Inc. Alignment of local transmit clock to synchronous data transfer clock having programmable transfer rate
WO2013113380A1 (en) * 2012-02-01 2013-08-08 Abb Technology Ag Updating data of a controller of a primary device of a power substation
CN107949047A (en) * 2018-01-15 2018-04-20 重庆邮电大学 Reduce the wireless sensor network uniformity method for synchronizing time of Internet traffic
CN108632989A (en) * 2018-05-15 2018-10-09 中山大学 A kind of wireless sensor network consistency Distributed Time synchronous method
CN110366258A (en) * 2018-04-09 2019-10-22 华为技术有限公司 A kind of method, relevant device and the communication system of data transmission

Patent Citations (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7256627B1 (en) * 2005-01-13 2007-08-14 Advanced Micro Devices, Inc. Alignment of local transmit clock to synchronous data transfer clock having programmable transfer rate
WO2013113380A1 (en) * 2012-02-01 2013-08-08 Abb Technology Ag Updating data of a controller of a primary device of a power substation
CN107949047A (en) * 2018-01-15 2018-04-20 重庆邮电大学 Reduce the wireless sensor network uniformity method for synchronizing time of Internet traffic
CN110366258A (en) * 2018-04-09 2019-10-22 华为技术有限公司 A kind of method, relevant device and the communication system of data transmission
CN108632989A (en) * 2018-05-15 2018-10-09 中山大学 A kind of wireless sensor network consistency Distributed Time synchronous method

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2022027534A1 (en) * 2020-08-07 2022-02-10 福州通安电子有限公司 Lamp synchronization method and terminal
CN113726466A (en) * 2021-07-21 2021-11-30 歌尔股份有限公司 Wearable device and signal acquisition method thereof
CN113726466B (en) * 2021-07-21 2023-12-01 歌尔股份有限公司 Wearable device and signal acquisition method thereof
CN114089258A (en) * 2021-11-10 2022-02-25 许继集团有限公司 Clock acceleration simulation operation method and system for intelligent electric energy meter
CN114089258B (en) * 2021-11-10 2023-12-26 河南源网荷储电气研究院有限公司 Clock acceleration simulation operation method and system for intelligent electric energy meter
CN115038161A (en) * 2022-07-25 2022-09-09 苏州德姆斯信息技术有限公司 Vibration data wireless synchronous acquisition method and system and vibration monitoring system
CN115038161B (en) * 2022-07-25 2023-10-13 苏州德姆斯信息技术有限公司 Vibration data wireless synchronous acquisition method, system and vibration monitoring system
CN117880957A (en) * 2024-03-11 2024-04-12 山东浪潮数据库技术有限公司 Ad hoc network subnet fusion method based on LTE channel

Also Published As

Publication number Publication date
CN111490844B (en) 2022-07-19

Similar Documents

Publication Publication Date Title
CN111490844B (en) Clock synchronization method and device and electronic equipment
KR101523104B1 (en) Method and device for time synchronization in a tdma multi-hop wireless network
CN113098674B (en) Time synchronization method and system for data link terminal of high-speed carrier self-organizing network
EP2429105B1 (en) Node in a wireless system with time and clock frequency synchronizing and corresponding method
US7221686B1 (en) System and method for computing the signal propagation time and the clock correction for mobile stations in a wireless network
KR20100131015A (en) Method and system for implementing the time division multiple access method to ad-hoc multihopping wireless networks
CN101729180A (en) Method and system for synchronizing precision clocks, and precision clock frequency/time synchronizing device
CN110278048B (en) Hierarchical Ad Hoc network time synchronization method based on clustering algorithm
CN110290579A (en) Wireless ad hoc network method for synchronizing time, node and wireless ad hoc network under a kind of narrowband condition
Pinho et al. A robust gradient clock synchronization algorithm for wireless sensor networks
Rahamatkar et al. A reference based, tree structured time synchronization approach and its analysis in WSN
US20220046561A1 (en) Synchronization Method and Apparatus, Network Element, and Computer Storage Medium
CN112235861B (en) Time synchronization method, time synchronization system and equipment suitable for self-organizing network
So et al. MTSF: A timing synchronization protocol to support synchronous operations in multihop wireless networks
Wang et al. A survey of time synchronization algorithms for wireless sensor networks
CN114584246B (en) FPGA-based wireless ad hoc network time synchronization method, system and medium
CN110545153A (en) Underwater wireless network time synchronization method capable of adapting to channel environment
CN109068385A (en) A kind of underwater wireless method for synchronizing network time with fault-tolerance
CN111885694B (en) Air self-organizing network time synchronization system
KR102146917B1 (en) Apparatus and method for managing node for time synchronization
Saarnisaari et al. Internetwork Time Synchronization of Mobile Ad Hoc Networks
CN111867042B (en) MESH network synchronization method with time difference detection function
US20230239925A1 (en) Scheduling system and method
Chen et al. A routing based time synchronization protocol for multi-hop wireless networks
Cai et al. Motion-Aware Clock Synchronization for Mobile Ad-Hoc Networks

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
GR01 Patent grant
GR01 Patent grant