CN115642976B - Mixed optimization time synchronization method - Google Patents

Mixed optimization time synchronization method Download PDF

Info

Publication number
CN115642976B
CN115642976B CN202211234713.5A CN202211234713A CN115642976B CN 115642976 B CN115642976 B CN 115642976B CN 202211234713 A CN202211234713 A CN 202211234713A CN 115642976 B CN115642976 B CN 115642976B
Authority
CN
China
Prior art keywords
time
positioning system
time stamp
node
wireless network
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.)
Active
Application number
CN202211234713.5A
Other languages
Chinese (zh)
Other versions
CN115642976A (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.)
Guangdong Yuexin Microsystem Research Institute
Original Assignee
Guangdong Yuexin Microsystem Research Institute
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 Guangdong Yuexin Microsystem Research Institute filed Critical Guangdong Yuexin Microsystem Research Institute
Priority to CN202211234713.5A priority Critical patent/CN115642976B/en
Publication of CN115642976A publication Critical patent/CN115642976A/en
Application granted granted Critical
Publication of CN115642976B publication Critical patent/CN115642976B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D30/00Reducing energy consumption in communication networks
    • Y02D30/70Reducing energy consumption in communication networks in wireless communication networks

Landscapes

  • Synchronisation In Digital Transmission Systems (AREA)
  • Mobile Radio Communication Systems (AREA)

Abstract

The invention relates to a hybrid optimization time synchronization method, belongs to the technical field of wireless communication, and solves the problems that the complexity of a low network time protocol, the high time synchronization precision and the high communication stability cannot be compatible in the prior art. Establishing normal communication between each node in the wireless network and the positioning system respectively; the nodes in normal communication start the master time stamp, and simultaneously close the improved PTP network time synchronization protocol to realize time synchronization with other normal communication nodes; each node monitors whether the communication between the node and a positioning system is normal or not in real time; if a communication failure between a certain node and a positioning system is monitored, the node starts a standby time stamp, and simultaneously starts an improved PTP network time synchronization protocol to obtain time deviation between the node and other normal communication nodes, so that time synchronization is realized between the node and other normal communication nodes. The method realizes high time synchronization precision and high communication stability while meeting the low network time protocol complexity.

Description

Mixed optimization time synchronization method
Technical Field
The invention relates to the technical field of wireless communication, in particular to a hybrid optimization time synchronization method.
Background
In wired network or wireless network communication, the time synchronization technique determines whether communication between network nodes is effective, and thus is important for the wired network or the wireless network.
There are two common methods of time synchronization, network time protocol, represented by NTP (Network Time Protocol ) and PTP (Precision Time Protocol, precision time protocol), GPS (Global Positioning System ); the NTP does not need the cooperation of hardware, the synchronization precision is in the millisecond level, and the method is suitable for scenes with low synchronization precision requirements; the PTP needs special PTP equipment, the synchronization precision can reach sub microsecond level, and the PTP equipment can be used for scenes with higher synchronization precision requirements; the GPS requires equipment to communicate with satellites to synchronize, and the synchronization precision depends on how many satellites the GPS receiver can communicate with at a given time, and the highest synchronization precision can reach the level of nano seconds, so that the GPS device is suitable for scenes with high-precision synchronization requirements.
Wireless networks are limited by the power, complexity, communication stability and synchronization accuracy of the network nodes, i.e. the network nodes of the wireless network should not be too powerful and complex and require high communication stability and synchronization accuracy. However, neither the network time protocol nor the global positioning system GPS is designed for these limitations, because the network time protocol is too complex, the time synchronization convergence speed is slow, and the synchronization accuracy is not high; the GPS synchronization precision is very high, but the time synchronization of the wireless network node is excessively dependent on satellite communication, and the satellite communication failure of the wireless network node can lead to time synchronization failure and poor communication stability.
In summary, the existing time synchronization method of the wireless network node has the problem that the method cannot be compatible with low network time protocol complexity, high time synchronization precision and high communication stability.
Disclosure of Invention
In view of the above analysis, the embodiment of the present invention aims to provide a hybrid optimization time synchronization method, which is used for solving the problem that the existing time synchronization method of a wireless network node cannot achieve low network time protocol complexity, high time synchronization precision and high communication stability.
The aim of the invention is mainly realized by the following technical scheme:
the embodiment of the invention provides a hybrid optimization time synchronization method, which comprises the following steps:
each node in the wireless network respectively establishes normal communication with the positioning system;
each node normally communicating with the positioning system starts a master time stamp, and simultaneously closes an improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master time stamp;
each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if the communication failure between the ith wireless network node and the positioning system is monitored, starting a standby time stamp by the ith wireless network node, and simultaneously starting an improved PTP network time synchronization protocol to obtain time deviation between the ith wireless network node and other normal communication nodes, and realizing time synchronization with the other normal communication nodes based on the standby time stamp and the time deviation;
wherein i is 1,2, …, N, N is the number of nodes in the wireless network, and the normal communication node refers to a node which normally communicates with the positioning system.
Based on a further improvement of the above method, the master time stamp is generated based on a standard clock and a second pulse; the alternate timestamp is generated based on a reference clock frequency; the improved PTP network time synchronization protocol is used for marking the receiving and transmitting message time of the slave clock by the standby time stamp of the communication fault node, marking the receiving and transmitting message time of the master clock by the master time stamp of the normal communication node, and calculating the time deviation based on the receiving and transmitting message time of the slave clock and the receiving and transmitting message time of the master clock.
Based on the further improvement of the method, the standby time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a counting algorithm based on the reference clock frequency generated by the constant temperature crystal module when a wireless network node is in communication failure with the Beidou satellite positioning system or the global positioning system, and the time stamp is a result of refining and dividing the node clock scale.
Based on a further improvement of the above method, time synchronization with other normal communication nodes is achieved based on the standby time stamp and time offset, comprising:
taking a wireless network node which is in communication failure with a positioning system as an application party, taking a current standby time stamp as a reference, interacting with a certain wireless network node which is adjacent to the wireless network node and is in normal communication with the positioning system, namely an applied party, by utilizing an improved PTP network time synchronization protocol, and calculating to obtain time deviation;
summing the current standby time stamp and the time deviation to obtain an updated standby time stamp;
the application party uses the updated standby time stamp as a reference, and interacts with the applied party by using an improved PTP network time synchronization protocol, and calculates to obtain a new time deviation;
repeating the steps to ensure the real-time synchronization of the retention time of the applicant and the applied party.
Based on further improvement of the method, interaction is performed by using an improved PTP network time synchronization protocol, and time deviation is calculated and obtained, wherein the method comprises the following steps:
the clock of the applicant is marked as a slave clock, and the standby time stamp is used for marking the corresponding time when the applicant receives/transmits the message;
the clock of the applied party is marked as a main clock, and the corresponding time when the applied party receives/transmits the message is marked by using the main time stamp;
the slave clock sends Sync_Req message to the master clock and carries Sync_Req message sending time T B 1, after receiving Sync_Req message, the master clock records Sync_Req message receiving time T B 2;
The master clock sends Sync_Resp message to the slave clock and carries delay_Req message sending time T B 3 and Sync_Req message reception time T B 2; after receiving the Sync_Resp message from the clock, recording the Sync_Resp message receiving time T B 4, the time deviation is (T) B 2-T B 1)-[(T B 2-T B 1)+(T B 4-T B 3)]/2。
Based on the further improvement of the method, each node in the wireless network is provided with a hybrid optimization time synchronization system, which comprises the following steps:
the system comprises a GPS/Beidou module, a constant temperature crystal module, a time stamp generation module, a time stamp driving module, an improved PTP network time protocol module and a time synchronization control module; wherein,,
the GPS/Beidou module is used for providing standard clocks and second pulses to the timestamp generation module and sending fault indication to the time synchronization control module in real time when a wireless network node and a Beidou satellite positioning system or a global positioning system have communication faults;
the constant temperature crystal module is used for outputting the frequency of the reference clock to the timestamp generation module;
the time stamp generating module is used for generating a main time stamp based on the standard clock and the second pulse through frequency multiplication calculation, counting based on the frequency of the reference clock and generating a standby time stamp by combining time deviation;
the time stamp driving module is used for inserting and extracting a main time stamp or a standby time stamp, namely, acquiring the main time stamp and the standby time stamp generated by the time stamp generating module;
the improved PTP network time protocol module is used for receiving and analyzing the improved PTP network time protocol and calculating and obtaining time deviation to the time stamp generating module by utilizing the improved PTP network time protocol;
the time synchronization control module is used for switching control whether to output the main time stamp and the standby time stamp generated by the time stamp generating module to the time stamp driving module based on the fault indication, and is also used for controlling the starting and closing of the improved PTP network time protocol.
Based on the further improvement of the method, each node in the wireless network respectively establishes normal communication with the positioning system, and the method comprises the following steps:
each node in the wireless network is respectively locked with a Beidou satellite positioning system or a global positioning system;
when all nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within a limited time, judging that all nodes in the wireless network are normally communicated with the Beidou satellite positioning system or the global positioning system.
Based on the further improvement of the method, each node monitors whether the communication between itself and the positioning system is normal in real time, and the method comprises the following steps:
when one wireless network node is unlocked to the Beidou satellite positioning system or the global positioning system within a limited time, judging that the wireless network node is in communication failure with the Beidou satellite positioning system or the global positioning system;
when one wireless network node locks the Beidou satellite positioning system or the global positioning system within a limited time, the wireless network node is judged to be normally communicated with the Beidou satellite positioning system or the global positioning system.
Based on a further improvement of the above method, the limiting time satisfies:
T1>T2
wherein T1 is the cold start limiting time corresponding to the first locking Beidou satellite positioning system or the global positioning system; t2 is the hot start limiting time corresponding to the Beidou satellite positioning system or the global positioning system which is locked again.
Compared with the prior art, the invention has at least one of the following beneficial effects:
1. according to the embodiment of the invention, the starting time of the PTP network time protocol is set at the moment when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults, the problem of time synchronization failure caused by the communication faults of the Beidou satellite positioning system or the global positioning system and the wireless network node is solved by utilizing the auxiliary synchronization of the improved PTP network time protocol, and the communication stability is high.
2. According to the embodiment of the invention, the clock of the applicant who has communication faults with the positioning system is corrected by using the master timestamp acquired by the applicant from the Beidou satellite positioning system or the global positioning system through the improved PTP network time protocol, so that the time synchronization precision of the applicant and other wireless network nodes which are in normal communication with the Beidou satellite positioning system or the global positioning system is high.
3. Compared with a standard PTP network time protocol, the embodiment of the invention omits the establishment of the master-slave relation with the longest time consumption and the selection process of the optimal clock through the improved PTP network time protocol, optimizes the protocol interaction of two rounds into the protocol interaction of one round, greatly reduces the time synchronization convergence time between wireless network nodes, has low protocol complexity and has high time synchronization convergence speed.
In the invention, the technical schemes can be mutually combined to realize more preferable combination schemes. Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention may be realized and attained by the structure particularly pointed out in the written description and drawings.
Drawings
The drawings are only for purposes of illustrating particular embodiments and are not to be construed as limiting the invention, like reference numerals being used to refer to like parts throughout the several views.
FIG. 1 is a general flow chart of an embodiment of the present invention;
FIG. 2 is a flowchart of the operation of the timestamp generation module according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a receiving and transmitting processing logic of a timestamp driving module according to an embodiment of the present invention;
FIG. 4 is a flowchart of an improved PTP network time protocol operation of an embodiment of the present invention;
FIG. 5 is a diagram illustrating a Sync_Req message format according to an embodiment of the present invention;
FIG. 6 is a diagram illustrating a Sync_Resp message format according to an embodiment of the present invention;
FIG. 7 is a control flow chart of a time synchronization control module according to an embodiment of the invention;
FIG. 8 is a schematic diagram of a relationship A between modules of a time synchronization system according to an embodiment of the present invention;
FIG. 9 is a schematic diagram of a relationship B between modules of a time synchronization system according to an embodiment of the present invention;
FIG. 10 is a schematic diagram of a relationship C between modules of a time synchronization system according to an embodiment of the present invention;
fig. 11 is a standard PTP network time protocol workflow diagram of an embodiment of the invention.
Detailed Description
Preferred embodiments of the present invention will now be described in detail with reference to the accompanying drawings, which form a part hereof, and together with the description serve to explain the principles of the invention, and are not intended to limit the scope of the invention.
Example 1
In one embodiment of the present invention, a hybrid optimization time synchronization method is disclosed, and the flow of the method is shown in fig. 1, and the method comprises the following steps:
s1, each node in a wireless network respectively establishes normal communication with a positioning system;
illustratively, the wireless network may be a wireless ad hoc network communication system such as unmanned aerial vehicle air formation, ship formation, etc.; the positioning system refers to a Beidou satellite positioning system or a global positioning system.
Each node normally communicating with the positioning system starts a master time stamp, and simultaneously closes the improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master time stamp.
S2, each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if the communication failure between the ith wireless network node and the positioning system is monitored, starting a standby time stamp by the ith wireless network node, and simultaneously starting an improved PTP network time synchronization protocol to obtain time deviation between the ith wireless network node and other normal communication nodes, and realizing time synchronization with the other normal communication nodes based on the standby time stamp and the time deviation;
wherein i is 1,2, …, N, N is the number of nodes in the wireless network, and the normal communication node refers to a node which normally communicates with the positioning system.
Compared with the prior art, the embodiment of the invention solves the problem of time synchronization failure caused by communication failure between the Beidou satellite positioning system or the global positioning system and the wireless network node by setting the starting time of the PTP network time protocol at the moment when the communication failure occurs between the wireless network node and the Beidou satellite positioning system or the global positioning system and utilizes the auxiliary synchronization of the improved PTP network time protocol, thereby having strong communication stability; the clock of the applicant who has communication faults with the positioning system is corrected by using the master timestamp of the applied party which is taken from the Beidou satellite positioning system or the global positioning system through the improved PTP network time protocol, so that the time synchronization precision of the applied party and other wireless network nodes which are in normal communication with the Beidou satellite positioning system or the global positioning system is high, compared with the standard PTP network time protocol, the method has the advantages that firstly, the establishment of the master-slave relationship with the longest time consumption and the selection process of the optimal clock are eliminated, secondly, the protocol interaction of two rounds is optimized into the protocol interaction of one round, the time synchronization convergence time between the wireless network nodes is greatly reduced, the protocol complexity is low, and the time synchronization convergence speed is high.
Example 2
The optimization is performed on the basis of the embodiment 1, and the step S1 can be further refined into the following steps:
s11, constructing a hybrid optimization time synchronization system for each node in the wireless network; the type, the number and the functions of the internal modules of the hybrid optimization time synchronization system of each network node are the same.
Specifically, the hybrid optimization time synchronization system comprises a GPS/Beidou module, a constant temperature crystal module, a time stamp generation module, a time stamp driving module, an improved PTP network time protocol module and a time synchronization control module.
The GPS/Beidou module is used for providing a standard clock and a high-precision second pulse to the timestamp generation module and sending a fault indication to the time synchronization control module in real time when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults.
The constant temperature crystal module is used for outputting the reference clock frequency with high stability to the time stamp generating module.
The time stamp generating module adopts an FPGA scheme, the working principle is shown in figure 2, and the time stamp generating module is used for generating a main time stamp based on the standard clock and the second pulse through frequency multiplication calculation, and generating a standby time stamp based on the reference clock frequency through counting and combining time deviation.
Specifically, when a certain wireless network node communicates normally with the positioning system, the node needs to start the master timestamp by using the timestamp generation module. By switching the main/standby switch to the main switch side, the time slot and the main time stamp are output based on the standard clock and the second pulse.
When a certain wireless network node fails to communicate with the positioning system, the node needs to start a standby time stamp by using a time stamp generating module. The time slot and the standby time stamp are output by switching the main/standby switch to the standby switch side based on the reference clock frequency and combining the time deviation output by the improved PTP network time protocol module through the processing of the deviation calculation sub-module.
The time stamp driving module is used for inserting and extracting the primary time stamp or the standby time stamp, namely, acquiring the primary time stamp and the standby time stamp generated by the time stamp generating module.
Specifically, the timestamp driving module needs to adapt to the operating system of the wireless communication module and fill timestamp information during transceiving, and the transceiving processing logic is shown in fig. 3. The time stamp driving module of the node which is in communication with the positioning system is used for receiving the master time stamp of a certain normal communication node in the wireless network, receiving the standby time stamp of the normal communication node and transmitting the master time stamp and the standby time stamp to the improved PTP network time protocol module of the node which is in communication with the positioning system. When both nodes communicate normally with the positioning system, their timestamp drive modules do not need to send and receive timestamps between them because of the high synchronization accuracy.
The improved PTP network time protocol module belongs to an application layer protocol, and the protocol flow and the message format are shown in fig. 4, 5 and 6, and are used for receiving, transmitting and analyzing the improved PTP network time protocol, and calculating and obtaining time deviation to the time stamp generating module by utilizing the improved PTP network time protocol.
The improved PTP network time synchronization protocol is used for marking the receiving and transmitting message time of the slave clock by the standby time stamp of the communication fault node, marking the receiving and transmitting message time of the master clock by the master time stamp of the normal communication node, and calculating the time deviation based on the receiving and transmitting message time of the slave clock and the receiving and transmitting message time of the master clock.
The message data unit is illustratively described as follows:
version (4): version, 4 bits;
PacketType (4): packet type, 4-bit, up to 16-middle packet type;
PacketLength (8): packet length, 8 bits;
T1/T3SendTimeStamp (16): the corresponding time stamp occupies 16 bits when the message is sent, and the transmission requirement of the maximum time stamp 38400 designed by the system can be met;
SlavePeerID (16): a slave node identification;
checksum (16): checksum, occupying 16 bits;
t2RecvTimeStamp (16): the corresponding time stamp occupies 16 bits when receiving the message, and the transmission requirement of the maximum time stamp 38400 designed by the system can be met;
t2RecvTimeOffset (32): the corresponding time offset when receiving the message is 32 bits occupied relative to the current time stamp.
The time synchronization control module belongs to application software, and the control logic is shown in fig. 7, and is used for controlling whether to output the time slot, the main time stamp and the standby time stamp generated by the time stamp generating module to a time stamp driving module in the wireless communication module or the improved PTP network time protocol in a user mode based on fault indication, and is also used for controlling the starting and closing of the improved PTP network time protocol.
The time synchronization system has three module combination modes, namely, a time synchronization system module relation A, a time synchronization system module relation B and a time synchronization system module relation C, which are respectively shown in fig. 8, 9 and 10. Fig. 8 embeds the timestamp driving module into the physical driving layer of the wireless communication module, and the improved PTP network time protocol module is configured in the time synchronization module, and at this time, a more complex protocol transceiver interface needs to be reserved between the time synchronization module and the wireless communication module. Fig. 9 embeds the timestamp driving module into the physical driving layer of the wireless communication module, and the modified PTP network time protocol module is embedded into the network layer of the wireless communication module, and only a simple start switch interface is required to be reserved between the time synchronization module and the wireless communication module. FIG. 10 is a schematic diagram of an improved PTP network time protocol module that incorporates a timestamp driver module and an improved PTP network time protocol module into a user state, embedded in the network layer of a wireless communication module, where only a simple start switch interface is reserved between the time synchronization module and the wireless communication module; the improved PTP network time protocol module in the user mode comprises a time stamp driving module and the functions of the improved PTP network time protocol module, and is a special application form of the linux environment. The latter two combination modes are simple and convenient in application, but the construction process is complex.
It should be noted that, the hybrid optimization time synchronization system of each wireless network node adopts one of the above three combination modes, and neither of the above three combination modes is used to affect the hybrid optimization time synchronization method provided by the embodiment of the present invention.
S12, initializing a hybrid optimization time synchronization system of each wireless network node.
The initialization operation includes setting a slot cycle and a time stamp cycle, waiting for a first lock of the positioning system. If the positioning system is successfully locked for the first time, the initialization is successful, otherwise, the initialization is failed.
S13, each wireless network node establishes normal communication with a positioning system; each node normally communicating with the positioning system starts a master time stamp, closes an improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master time stamp.
The time stamp is the result of refining and dividing the node clock scale, and is the basis of time synchronization among the wireless network nodes, and the time stamp phase synchronization among the network nodes indicates that the time synchronization among the network nodes is successful. The larger the phase error of the time stamp between the network nodes is, the lower the time synchronization precision between the network nodes is; the smaller the phase error of the time stamp between the network nodes, the higher the time synchronization accuracy between the network nodes.
In this embodiment, each node in the wireless network is respectively locked with the Beidou satellite positioning system or the global positioning system; when one wireless network node locks the Beidou satellite positioning system or the global positioning system within a limited time, judging that the wireless network node is normal in communication with the Beidou satellite positioning system or the global positioning system; wherein, according to the state of the art and practical engineering experience, the first locking is cold start, and the limiting time is set to 3 minutes; the re-lock is a hot start and the limit time is set to 1 minute.
When all nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within a limited time, judging that all nodes in the wireless network are normally communicated with the Beidou satellite positioning system or the global positioning system.
Further, the wireless network node enables the master time stamp and simultaneously closes the improved PTP network time synchronization protocol to release network resources occupied by the improved PTP network time synchronization protocol.
The wireless network node realizes time synchronization with other wireless network nodes which normally communicate with a positioning system through a Beidou satellite positioning system or a global positioning system.
The master time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a frequency multiplication algorithm based on a second pulse generated by a GPS/Beidou module and a standard clock when a wireless network node is normally communicated with a Beidou satellite positioning system or a global positioning system, and the time stamp is a result of refining and dividing the node clock scale.
It is noted that, for a plurality of wireless network nodes which communicate normally with the Beidou satellite positioning system or the global positioning system, the time stamp synchronization precision between different wireless network nodes is the same as the GPS/Beidou second pulse synchronization precision, and can reach nanosecond level at most, so that all the time stamps generated by the wireless network nodes which communicate normally with the Beidou satellite positioning system or the global positioning system are all master time stamps.
For example, the time stamp generating module adopts an FPGA scheme, the slot cycle is set to 7.8125ms, the time stamp cycle is set to 5 minutes, and the generating process of the time stamp is as follows:
and generating a master time stamp according to the GPS/Beidou second pulse and the standard clock.
The FPGA obtains a slot cycle of 1/128= 7.8125mm by 7 times of frequency-doubled second pulses, and according to a time stamp cycle of 5 minutes, the maximum time stamp is 128×60×5=38400, the range of the time stamp is 1-38400, and the first second pulse after the 0 th minute or the 5 th minute is counted from 1.
Preferably, step S2 may be further refined as the following steps:
s21, each node monitors whether the communication between the node and the positioning system is normal or not in real time.
When one wireless network node is unlocked in a limited time, determining that the wireless network node is in communication failure with the Beidou satellite positioning system or the global positioning system.
When one wireless network node locks the Beidou satellite positioning system or the global positioning system within a limited time, the wireless network node is judged to be normally communicated with the Beidou satellite positioning system or the global positioning system.
S22, if the communication failure between the ith wireless network node and the positioning system is monitored, starting a standby time stamp by the ith wireless network node, and simultaneously starting an improved PTP network time synchronization protocol to obtain time deviation between the ith wireless network node and other normal communication nodes, and realizing time synchronization with the other normal communication nodes based on the standby time stamp and the time deviation;
wherein i is 1,2, …, N, N is the number of nodes in the wireless network, and the normal communication node refers to a node which normally communicates with the positioning system.
The standby time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a counting algorithm based on the frequency of a reference clock generated by the constant temperature crystal module when communication between the wireless network node and the Beidou satellite positioning system or the global positioning system fails, and the time stamp is a result of refining and dividing the clock scale of the node.
When the reference clock frequency output by the oven module is less than 1pps, the error of the time stamp is approximately hundred nanoseconds.
By means of the improved PTP network time protocol, after the synchronous with the adjacent wireless network nodes which normally communicate with the positioning system, the time stamp generated by the wireless network nodes with communication faults and the time stamp of the wireless network nodes which normally communicate with the positioning system can achieve hundred nanoseconds in synchronous precision.
Illustratively, the oven module employs an oven with 10mhz output of 1pps, and the FPGA counts the waveform periods of the oven to obtain a 7.8125mm slot period, the number of waveform periods being 78125. Also according to a 5-minute time stamp period, the maximum time stamp is 128×60×5=38400, the range of the time stamp is 1 to 38400, and the initial position of the time stamp is fine-tuned according to the modified PTP network time protocol.
And optimizing the standard PTP network time protocol to obtain the improved PTP network time protocol.
Specifically, the standard PTP network time protocol is used to obtain the time offset between the slave clock of the applicant wireless network node and the master clock of the applicant wireless network node, and the synchronization flow is shown in fig. 11. The implementation of time synchronization mainly comprises 5 steps:
the method comprises the steps of performing full-network negotiation on all wireless network nodes, selecting a clock of one wireless network node as an optimal clock, establishing a master-slave relationship among the wireless network nodes step by step based on the optimal clock to obtain a master clock and a slave clock of each stage, and determining a master-slave state of a negotiation port of each stage.
Illustratively, the optimal clock is the master clock of the first stage; the slave clock of the first stage is also the master clock of the second stage; and so on.
For convenience of description, the following steps only consider the time deviation calculation methods of the master clocks and the slave clocks of two wireless network nodes in a certain stage, and the time deviation calculation methods of the master clocks and the slave clocks of other stages are the same.
The master clock sends Sync message to the slave clock and records the sending time T of Sync message A 1, a step of; receiving Sync message from clock and recording Sync message receiving time T A 2;
The master clock transmits Sync followed by a signal with T A A 1-value Follow_Up message to the slave clock;
the slave clock sends a delay_req message to the master clock, and simultaneously records the sending time T of the delay_req message A 3, a step of; the main clock receives the delay_req message and records the receiving time T of the delay_req message A 4;
Master clock to slave clock transmit carry T A 4 message delay_resp. After receiving delay_resp message, slave clock calculates deviation from master clock.
From clock based T A 1、T A 2、T A 3、T A 4, calculating the average round trip time difference as [ (T) A 2-T A 1)+(T A 4-T A 3)]And/2, whereby the time deviation of the slave clock from the master clock is (T) A 2-T A 1)-[(T A 2-T A 1)+(T A 4-T A 3)]And 2, the calculation of the time deviation between the slave clock of the application side wireless network node and the master clock of the applied side wireless network node based on the standard PTP network time protocol is completed.
It is worth noting that, in the first step of the standard PTP network time protocol, the full network negotiation needs to be performed first to select the optimal clock, then the master-slave relationship between the clock and the negotiation port is established step by step according to the selection result, and compared with other steps, the step is complex in interaction and takes the longest time. The embodiment of the invention optimizes the standard PTP network time protocol, sets the starting time of the PTP network time protocol at the moment when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults, has the advantages that the wireless network node is time-synchronized with other wireless network nodes including adjacent wireless network nodes before the communication faults occur, and the wireless network node already realizes the time synchronization with other network nodes when the communication faults occur, so that the process of selecting the optimal clock and establishing the master-slave relationship with the longest time consumption can be omitted, the clock of the adjacent wireless network node which is normally communicated with the Beidou satellite positioning system or the global positioning system is defaulted to be the master clock, and the improved PTP network time protocol flow is directly started.
In the improved PTP network time protocol, the communication failure node transmits a time synchronization application as an application party based on its spare time stamp, and its clock is a slave clock; other communication normal nodes are all master clocks, and among the nodes, a certain node adjacent to the application party is used as the applied party, and the applied party interacts with the application party through receiving and transmitting time stamps. The applicant marks the corresponding time when receiving/transmitting the message by using the standby time stamp, and the applied party marks the corresponding time when receiving/transmitting the message by using the main time stamp.
The improved PTP network time protocol flow is shown in figure 4. The implementation of time synchronization requires only 2 steps:
the slave clock sends Sync_Req message to the master clock and carries Sync_Req message sending time T B 1, after receiving Sync_Req message, the master clock records Sync_Req message receiving time T B 2;
The master clock sends Sync_Resp message to the slave clock and carries delay_Req message sending time T B 3 and Sync_Req message reception time T B 2; after receiving the Sync_Resp message from the clock, recording the Sync_Resp message receiving time T B 4, the time deviation is (T) B 2-T B 1)-[(T B 2-T B 1)+(T B 4-T B 3)]/2。
Compared with the standard PTP network time protocol, the improved PTP network time protocol omits the establishment of the master-slave relation and the selection process of the optimal clock, and optimizes the protocol interaction of two rounds into the protocol interaction of one round, so that the time synchronization convergence time between the wireless network nodes is greatly reduced.
The application party uses the standby time stamp as a reference, and interacts with a certain wireless network node which is in normal communication with the adjacent and positioning systems, namely the applied party, by utilizing an improved PTP network time synchronization protocol, and calculates and obtains time deviation;
as shown in fig. 2, the standby time stamp is summed with the time deviation, i.e. the deviation is calculated, resulting in an updated standby time stamp;
the application party uses the updated standby time stamp as a reference, and interacts with the applied party by using an improved PTP network time synchronization protocol, and calculates to obtain a new time deviation;
repeating the steps to ensure the real-time synchronization of the retention time of the applicant and the applied party.
Compared with the prior art, the embodiment of the invention further discloses a hybrid time synchronization method comprising an improved PTP network time protocol, so that the time synchronization precision of a wireless network node with normal communication between an applicant and other Beidou satellite positioning systems or global positioning systems is high; the method has the advantages that the improvement on the standard PTP network time protocol is provided in detail, firstly, the establishment of the master-slave relation with the longest time consumption and the selection process of the optimal clock are eliminated, and secondly, the protocol interaction of two rounds is optimized into the protocol interaction of one round, so that the time synchronization convergence time between wireless network nodes is greatly reduced, the protocol complexity is low, and the time synchronization convergence speed is high.
Those skilled in the art will appreciate that all or part of the flow of the methods of the embodiments described above may be accomplished by way of a computer program to instruct associated hardware, where the program may be stored on a computer readable storage medium. Wherein the computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory, etc.
The present invention is not limited to the above-mentioned embodiments, and any changes or substitutions that can be easily understood by those skilled in the art within the technical scope of the present invention are intended to be included in the scope of the present invention.

Claims (10)

1. The hybrid optimization time synchronization method is characterized by comprising the following steps of:
each node in the wireless network respectively establishes normal communication with the positioning system;
each node normally communicating with the positioning system starts a master time stamp, and simultaneously closes an improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master time stamp;
each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if the communication failure between the ith wireless network node and the positioning system is monitored, starting a standby time stamp by the ith wireless network node, and simultaneously starting an improved PTP network time synchronization protocol to obtain time deviation between the ith wireless network node and other normal communication nodes, and realizing time synchronization with the other normal communication nodes based on the standby time stamp and the time deviation;
wherein,,
i is 1,2, …, N, N is the number of nodes in the wireless network, and the normal communication node refers to a node which normally communicates with the positioning system;
the master time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a frequency multiplication algorithm based on a second pulse generated by a GPS/Beidou module and a standard clock when a wireless network node is normally communicated with a Beidou satellite positioning system or a global positioning system, and the time stamp is a result of refining and dividing the node clock scale;
the standby time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a counting algorithm based on the frequency of a reference clock generated by the constant temperature crystal module when communication between the wireless network node and the Beidou satellite positioning system or the global positioning system fails, and the time stamp is a result of refining and dividing the clock scale of the node.
2. The hybrid optimized time synchronization method of claim 1, wherein the master time stamp is generated based on a standard clock and a second pulse; the alternate timestamp is generated based on a reference clock frequency; the improved PTP network time synchronization protocol is used for marking the receiving and transmitting message time of the slave clock by the standby time stamp of the communication fault node, marking the receiving and transmitting message time of the master clock by the master time stamp of the normal communication node, and calculating the time deviation based on the receiving and transmitting message time of the slave clock and the receiving and transmitting message time of the master clock.
3. The hybrid optimization time synchronization method according to claim 2, wherein the master time stamp is a time stamp of the wireless network node generated by a time stamp generating module through a frequency multiplication algorithm based on a second pulse generated by a GPS/beidou module and a standard clock when a wireless network node communicates normally with a beidou satellite positioning system or a global positioning system, and the time stamp is a result of performing refinement segmentation on the node clock scale.
4. The hybrid-optimal time synchronization method according to claim 2, wherein the standby time stamp is a time stamp of the wireless network node generated by a time stamp generating module by a counting algorithm based on a reference clock frequency generated by a constant temperature crystal module when a wireless network node fails to communicate with a Beidou satellite positioning system or a global positioning system, and the time stamp is a result of finely dividing the node clock scale.
5. The hybrid-optimized time synchronization method of claim 1, wherein time synchronization with other normal communication nodes is achieved based on the standby time stamp and time offset, comprising:
taking a wireless network node which is in communication failure with a positioning system as an application party, taking a current standby time stamp as a reference, interacting with a certain wireless network node which is adjacent to the wireless network node and is in normal communication with the positioning system, namely an applied party, by utilizing an improved PTP network time synchronization protocol, and calculating to obtain time deviation;
summing the current standby time stamp and the time deviation to obtain an updated standby time stamp;
the application party uses the updated standby time stamp as a reference, and interacts with the applied party by using an improved PTP network time synchronization protocol, and calculates to obtain a new time deviation;
repeating the steps to ensure the real-time synchronization of the retention time of the applicant and the applied party.
6. The hybrid-optimized time synchronization method of claim 5, wherein the interacting, computing the obtained time offset using a modified PTP network time synchronization protocol, comprises:
the clock of the applicant is marked as a slave clock, and the standby time stamp is used for marking the corresponding time when the applicant receives/transmits the message;
the clock of the applied party is marked as a main clock, and the corresponding time when the applied party receives/transmits the message is marked by using the main time stamp;
the slave clock sends Sync_Req message to the master clock and carries Sync_Req message sending time T B 1, after receiving Sync_Req message, the master clock records Sync_Req message receiving time T B 2;
The master clock sends Sync_Resp message to the slave clock and carries delay_Req message sending time T B 3 and Sync_Req message reception time T B 2; after receiving the Sync_Resp message from the clock, recording the Sync_Resp message receiving time T B 4, the time deviation is (T) B 2-T B 1)-[(T B 2-T B 1)+(T B 4-T B 3)]/2。
7. The hybrid-optimized time synchronization method of claim 6, wherein each node in the wireless network sets a hybrid-optimized time synchronization system, comprising:
the system comprises a GPS/Beidou module, a constant temperature crystal module, a time stamp generation module, a time stamp driving module, an improved PTP network time protocol module and a time synchronization control module; wherein,,
the GPS/Beidou module is used for providing standard clocks and second pulses to the timestamp generation module and sending fault indication to the time synchronization control module in real time when a wireless network node and a Beidou satellite positioning system or a global positioning system have communication faults;
the constant temperature crystal module is used for outputting the frequency of the reference clock to the timestamp generation module;
the time stamp generating module is used for generating a main time stamp based on the standard clock and the second pulse through frequency multiplication calculation, counting based on the frequency of the reference clock and generating a standby time stamp by combining time deviation;
the time stamp driving module is used for inserting and extracting a main time stamp or a standby time stamp, namely, acquiring the main time stamp and the standby time stamp generated by the time stamp generating module;
the improved PTP network time protocol module is used for receiving and analyzing the improved PTP network time protocol and calculating and obtaining time deviation to the time stamp generating module by utilizing the improved PTP network time protocol;
the time synchronization control module is used for switching control whether to output the main time stamp and the standby time stamp generated by the time stamp generating module to the time stamp driving module based on the fault indication, and is also used for controlling the starting and closing of the improved PTP network time protocol.
8. The hybrid-optimized time synchronization method of claim 7, wherein each node in the wireless network establishes normal communication with the positioning system, respectively, comprising:
each node in the wireless network is respectively locked with a Beidou satellite positioning system or a global positioning system;
when all nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within a limited time, judging that all nodes in the wireless network are normally communicated with the Beidou satellite positioning system or the global positioning system.
9. The hybrid-optimal time synchronization method of claim 8, wherein each node monitors in real time whether its own communication with the positioning system is normal, comprising:
when one wireless network node is unlocked to the Beidou satellite positioning system or the global positioning system within a limited time, judging that the wireless network node is in communication failure with the Beidou satellite positioning system or the global positioning system;
when one wireless network node locks the Beidou satellite positioning system or the global positioning system within a limited time, the wireless network node is judged to be normally communicated with the Beidou satellite positioning system or the global positioning system.
10. The hybrid-optimized time synchronization method of claim 9, wherein the defined time satisfies:
T1>T2
wherein T1 is the cold start limiting time corresponding to the first locking Beidou satellite positioning system or the global positioning system; t2 is the hot start limiting time corresponding to the Beidou satellite positioning system or the global positioning system which is locked again.
CN202211234713.5A 2022-10-10 2022-10-10 Mixed optimization time synchronization method Active CN115642976B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211234713.5A CN115642976B (en) 2022-10-10 2022-10-10 Mixed optimization time synchronization method

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211234713.5A CN115642976B (en) 2022-10-10 2022-10-10 Mixed optimization time synchronization method

Publications (2)

Publication Number Publication Date
CN115642976A CN115642976A (en) 2023-01-24
CN115642976B true CN115642976B (en) 2023-07-21

Family

ID=84944595

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211234713.5A Active CN115642976B (en) 2022-10-10 2022-10-10 Mixed optimization time synchronization method

Country Status (1)

Country Link
CN (1) CN115642976B (en)

Families Citing this family (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN116599620B (en) * 2023-07-17 2023-11-21 成都谐盈科技有限公司 Self-adaptive network time synchronization method

Family Cites Families (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102013931B (en) * 2009-09-08 2015-04-01 中兴通讯股份有限公司 Time synchronization method and system, salve timing device and main timing device
EP2541815B1 (en) * 2011-06-28 2013-12-18 Alcatel Lucent Clock synchronization network
CN105577348B (en) * 2014-10-08 2020-06-30 中兴通讯股份有限公司 Frequency deviation monitoring method and device based on time synchronization network
CN108667547B (en) * 2018-08-10 2019-10-11 电信科学技术第五研究所有限公司 A kind of Network Time Protocol conversion method and system
CN111555834B (en) * 2020-04-30 2021-10-01 北京邮电大学 Clock synchronization method and system of wireless network based on IEEE1588 protocol
CN112583512B (en) * 2020-12-10 2023-04-11 北京航星机器制造有限公司 Time synchronization device and method

Also Published As

Publication number Publication date
CN115642976A (en) 2023-01-24

Similar Documents

Publication Publication Date Title
EP2378718B1 (en) Method, node and system for controlling version in distributed system
CN111585683B (en) High-reliability clock synchronization system and method for time-sensitive network
KR101749202B1 (en) Method, apparatus, and system for generating timestamp
US7146516B2 (en) Time synchronization schemes wherein at least one data message associates a hardware pulse with a future time
CN115642976B (en) Mixed optimization time synchronization method
CN104272664A (en) Gateway, nodes, and method for a vehicle
CN103916950A (en) Time synchronization method and system
EP2802097B1 (en) Clock synchronization method and device
CN108259109B (en) Network equipment in PTP domain and TOD synchronization method
CN102035638B (en) Clock source selection processing method, device and system
CN103166729B (en) Clock synchronizing method and equipment
CN115642977B (en) Mixed optimization time synchronization system
WO2020043181A1 (en) Clock synchronization method and apparatus, system, storage medium, and electronic device
US6807398B1 (en) Time synchronization system, satellite system applied to the time synchronization system, ground system applied in the time synchronization system, time synchronization method and a computer-readable recording medium with a program
WO2018082665A1 (en) Frequency synchronization method and slave clock
CN102983927A (en) Time compensation method for master-slave clock timing based on IEEE 1588 protocol
CN102195769A (en) Clock synchronization method for automobile CAN (Control Area Network)
CN111740800B (en) Multi-precision clock synchronization method based on SDN framework 5G intelligent node
CN104243079A (en) Microsecond clock synchronization method for real-time Ethernet
CN111698050A (en) Wireless terminal, clock synchronization method and system
CN102342051B (en) For coming the method for synchronised clock and relevant system and module by separating transmission first and second data via at least one time distribution protocol
CN113099527B (en) 5G wireless edge absolute time synchronization method based on timing message exchange
CN207884639U (en) A kind of network node, temporal noise transmission characteristic measuring device and synchronous communication network
CN102404103B (en) Method and system for improving PTP time synchronization precision
CN115243362B (en) Time synchronization system and method applied to traveling wave positioning device

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