CN115642976A - Hybrid optimization time synchronization method - Google Patents

Hybrid optimization time synchronization method Download PDF

Info

Publication number
CN115642976A
CN115642976A CN202211234713.5A CN202211234713A CN115642976A CN 115642976 A CN115642976 A CN 115642976A CN 202211234713 A CN202211234713 A CN 202211234713A CN 115642976 A CN115642976 A CN 115642976A
Authority
CN
China
Prior art keywords
time
timestamp
positioning system
node
time synchronization
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
CN202211234713.5A
Other languages
Chinese (zh)
Other versions
CN115642976B (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

Images

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 low network time protocol complexity, high time synchronization precision and high communication stability cannot be compatible in the prior art. Establishing normal communication with a positioning system by enabling each node in a wireless network to respectively establish normal communication with the positioning system; all nodes in normal communication start the master timestamp, 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 fault between a certain node and the positioning system is monitored, the node starts a standby timestamp, and simultaneously starts an improved PTP network time synchronization protocol to obtain the time deviation between the node and other normal communication nodes, so as to realize time synchronization with other normal communication nodes. The method meets the requirement of low network time protocol complexity, and realizes high time synchronization precision and high communication stability.

Description

Hybrid 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, a time synchronization technique determines whether communication between network nodes is effective, and thus is very important for the wired network or the wireless network.
Two common Time synchronization methods are available, namely, a Network Time Protocol and a Global Positioning System (GPS), where the Network Time Protocol is represented by NTP (Network Time Protocol) and PTP (Precision Time Protocol); the NTP does not need to be matched with hardware, the synchronization precision is in the millisecond level, and the method is suitable for scenes with low synchronization precision requirements; PTP needs special PTP equipment, the synchronization precision can reach sub-microsecond level, and the method can be used for scenes with high synchronization precision requirements; the GPS needs equipment to communicate with a satellite to synchronize, the synchronization precision depends on how many satellites the GPS receiver can communicate with at a given time, the highest synchronization precision can reach nanosecond level, and the method is suitable for scenes with high-precision synchronization requirements.
The wireless network is limited by the power, complexity, communication stability and synchronization accuracy of the network nodes, that is, the power and complexity of the network nodes of the wireless network are not too high, and the communication stability and synchronization accuracy are required to be high. However, neither network time protocols nor global positioning system GPS are designed for these limitations because network time protocols are too complex, time synchronization convergence speed is slow, and synchronization accuracy is not high; the GPS synchronization precision is high, but the time synchronization of the wireless network nodes is over dependent on satellite communication, the satellite communication failure of the wireless network nodes can cause the time synchronization failure, and the communication stability is poor.
In summary, the current time synchronization method for wireless network nodes has the problem that the time synchronization 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 foregoing analysis, embodiments of the present invention provide a hybrid optimization time synchronization method, so as to solve the problem that the existing time synchronization method for a wireless network node cannot consider both low network time protocol complexity, high time synchronization precision and high communication stability.
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 establishes normal communication with a positioning system respectively;
each node normally communicating with the positioning system starts a master timestamp, closes an improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master timestamp;
each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if communication faults between the ith wireless network node and the positioning system are monitored, the node starts a standby timestamp, an improved PTP network time synchronization protocol is started to obtain time deviation between the node and other normal communication nodes, and time synchronization with other normal communication nodes is achieved based on the standby timestamp and the time deviation;
wherein i belongs to 1,2, \8230, N and N are the number of nodes in the wireless network, and the normal communication node refers to a node normally communicating with the positioning system.
Based on the further improvement of the method, the main timestamp is generated based on a standard clock and a second pulse; the backup timestamp is generated based on a reference clock frequency; the improved PTP network time synchronization protocol is used for marking the message receiving and sending time of the slave clock of a communication fault node by using the standby timestamp of the communication fault node, marking the message receiving and sending time of the master clock of a normal communication node by using the master timestamp of the normal communication node, and calculating to obtain time deviation based on the message receiving and sending time of the slave clock and the message receiving and sending time of the master clock.
Based on the further improvement of the method, the standby timestamp is the timestamp of the wireless network node generated by the timestamp generation module through a counting algorithm based on the reference clock frequency generated by the constant temperature crystal module when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults, and the timestamp is the result of thinning and dividing the clock scale of the node.
Based on the further improvement of the method, the time synchronization with other normal communication nodes is realized based on the standby timestamp and the time offset, and the method comprises the following steps:
taking a wireless network node with a communication fault with a positioning system as an application party, taking a current standby timestamp as a reference, and interacting with a certain wireless network node which is adjacent and normally communicates with the positioning system, namely an applied party, by utilizing an improved PTP network time synchronization protocol to calculate and obtain a time deviation;
summing the current standby timestamp with the time deviation to obtain an updated standby timestamp;
the applicant takes the updated standby timestamp as a reference, interacts with the applicant by using an improved PTP network time synchronization protocol, and calculates to obtain a new time deviation;
and repeating the steps to ensure that the time synchronization between the applicant and the requested party is kept in real time.
Based on the further improvement of the method, the interaction is carried out by utilizing the improved PTP network time synchronization protocol, and the time deviation is obtained by calculation, which comprises the following steps:
the clock of the applicant is marked as a slave clock, and the corresponding time when the application receives/sends the message is marked by using the standby timestamp;
the clock of the requested party is marked as a master clock, and the corresponding time when the requested party receives/sends the message is marked by using the master timestamp;
the slave clock sends a Sync _ Req message to the master clock and carries the sending time T of the Sync _ Req message B 1, recording the receiving time T of the Sync _ Req message after the Sync _ Req message is received by the master clock B 2;
The master clock sends a Sync _ Resp message to the slave clock and carries Delay _ Req message sending time T B 3 Sync _ Req message receiving time T B 2; after receiving the Sync _ Resp message from the clock, recording the receiving time T of the Sync _ Resp message B 4, then the time offset 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 system comprises a GPS/Beidou module, a constant temperature crystal module, a timestamp generation module, a timestamp driving module, an improved PTP network time protocol module and a time synchronization control module; wherein, the first and the second end of the pipe are connected with each other,
the GPS/Beidou module is used for providing a standard clock and a second pulse to the timestamp generation module and is also used for sending a fault indication to the time synchronization control module in real time when a communication fault occurs between the wireless network node and a Beidou satellite positioning system or a global positioning system;
the constant temperature crystal module is used for outputting a reference clock frequency to the timestamp generation module;
the time stamp generating module is used for generating a main time stamp based on standard clock and second pulse through frequency multiplication calculation, counting based on reference clock frequency and generating a standby time stamp by combining time deviation;
the timestamp driving module is used for inserting and extracting the main timestamp or the standby timestamp, namely acquiring the main timestamp and the standby timestamp generated by the timestamp generating module;
the improved PTP network time protocol module is used for receiving, transmitting and analyzing the improved PTP network time protocol, and calculating to obtain a time deviation to the timestamp generation module by utilizing the improved PTP network time protocol;
the time synchronization control module is used for controlling whether to output the main timestamp and the standby timestamp generated by the timestamp generation module to the timestamp driving module for switching 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 the nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within the limited time, the communication between all the nodes in the wireless network and the Beidou satellite positioning system or the global positioning system is judged to be normal.
Based on the further improvement of the method, each node monitors whether the communication between the node and the positioning system is normal in real time, and the method comprises the following steps:
when a wireless network node does not lock a Beidou satellite positioning system or a global positioning system within limited time, judging that the wireless network node has a communication fault 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 normally communicate with the Beidou satellite positioning system or the global positioning system.
Based on further improvement of the method, the time limit satisfies the following conditions:
T1>T2
the method comprises the following steps that T1 is cold start limited time corresponding to a Beidou satellite positioning system or a global positioning system which is locked for the first time; and T2 is the hot start limited time corresponding to the re-locking of the Beidou satellite positioning system or the global positioning system.
Compared with the prior art, the invention can realize 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 communication fault occurs between the wireless network node and the Beidou satellite positioning system or the global positioning system, the problem of time synchronization failure caused by the communication fault between the Beidou satellite positioning system or the global positioning system and the wireless network node is solved by using the auxiliary synchronization of the improved PTP network time protocol, and the communication stability is strong.
2. According to the embodiment of the invention, through an improved PTP network time protocol, the clock of the applicant with a communication fault with the positioning system is corrected by using the master timestamp of the applicant obtained from the Beidou satellite positioning system or the global positioning system, 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 the standard PTP network time protocol, the embodiment of the invention removes the establishment of the master-slave relationship with the longest time consumption and the selection process of the optimal clock through the improved PTP network time protocol, and optimizes the protocol interaction of two rounds 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.
In the invention, the technical schemes can be combined with each other 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 will 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, wherein like reference numerals are used to designate like parts throughout.
FIG. 1 is a general flow diagram of an embodiment of the present invention;
FIG. 2 is a flowchart of the timestamp generation module operation according to an embodiment of the present invention;
FIG. 3 is a schematic diagram of a transmit-receive processing logic of a timestamp driver module according to an embodiment of the present invention;
FIG. 4 is a flow chart of an improved PTP network time protocol operation according to an embodiment of the present invention;
FIG. 5 is a diagram of a Sync _ Req message format according to an embodiment of the present invention;
FIG. 6 is a schematic diagram of a Sync _ Resp message format according to an embodiment of the present invention;
FIG. 7 is a control flow diagram of the time synchronization control module according to an embodiment of the present invention;
FIG. 8 is a diagram illustrating a relationship A between modules of the time synchronization system according to an embodiment of the present invention;
FIG. 9 is a diagram illustrating a relationship B between modules of the time synchronization system according to an embodiment of the present invention;
FIG. 10 is a diagram illustrating the relationship C between modules of the time synchronization system according to the embodiment of the present invention;
fig. 11 is a flowchart of a standard PTP network time protocol operation according to an embodiment of the present invention.
Detailed Description
The accompanying drawings, which are incorporated in and constitute a part of this application, illustrate preferred embodiments of the invention and together with the description, serve to explain the principles of the invention and not to limit the scope of the invention.
Example 1
A specific embodiment of the present invention discloses a hybrid optimization time synchronization method, the flow of which is shown in fig. 1, and the method includes the following steps:
s1, each node in a wireless network establishes normal communication with a positioning system respectively;
illustratively, the wireless network may be a wireless ad hoc network communication system such as unmanned aerial vehicle formation, ship formation, and the like; the positioning system refers to a Beidou satellite positioning system or a global positioning system.
Each node which normally communicates with the positioning system starts a main time stamp, closes the improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the main time stamp.
S2, each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if communication faults between the ith wireless network node and the positioning system are monitored, the node starts a standby timestamp, an improved PTP network time synchronization protocol is started to obtain time deviation between the node and other normal communication nodes, and time synchronization with other normal communication nodes is achieved based on the standby timestamp and the time deviation;
wherein i belongs to 1,2, \ 8230, N, N is the number of nodes in the wireless network, and the normal communication node refers to the node which normally communicates with the positioning system.
Compared with the prior art, the embodiment of the invention sets the starting time of the PTP network time protocol at the time when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults, and utilizes the auxiliary synchronization of the improved PTP network time protocol to solve 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, and the communication stability is strong; through an improved PTP network time protocol, a master timestamp of an applicant who is accessed from a Beidou satellite positioning system or a global positioning system is utilized to correct a clock of the applicant who has a communication fault with the positioning system, so that the time synchronization precision of the applicant and other wireless network nodes which normally communicate with the Beidou satellite positioning system or the global positioning system is high.
Example 2
The optimization is carried out 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 types, 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 timestamp generation module, a timestamp 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 is also used for 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 a high-stability reference clock frequency to the timestamp generation 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 standard clock and second pulse through frequency multiplication calculation, counting based on reference clock frequency and generating a standby time stamp by combining time deviation.
Specifically, when a certain wireless network node is in normal communication with the positioning system, the node needs to start the master timestamp by using the timestamp generation module. By switching the master/backup change-over switch to one side of the master switch, the time slot and the master timestamp are output based on the standard clock and the pulse per second.
When a wireless network node fails to communicate with the positioning system, the node needs to start a standby timestamp by using a timestamp generation module. The time slot and the standby timestamp are output by switching the main/standby switch to one side of the standby switch, combining the time deviation output by the improved PTP network time protocol module based on the reference clock frequency and through the processing of the deviation calculation submodule.
The timestamp driving module is used for inserting and extracting the main timestamp or the standby timestamp, namely acquiring the main timestamp and the standby timestamp generated by the timestamp generating module.
Specifically, the timestamp driving module needs to be adapted to an operating system of the wireless communication module and to fill timestamp information during transmission and reception, and the transmission and reception processing logic is shown in fig. 3. The timestamp driving module of the node with the communication fault of the positioning system is used for receiving a primary timestamp of a certain normal communication node in a wireless network, receiving a standby timestamp of the node with the communication fault and transmitting the primary timestamp and the standby timestamp to the improved PTP network time protocol module of the node with the communication fault. When both nodes are in normal communication with the positioning system, their timestamp driving modules do not need to transmit and receive timestamps between them because of the high synchronization accuracy.
The improved PTP network time protocol module belongs to an application layer protocol, the protocol flow and the message format are shown in figures 4, 5 and 6, and the module is used for receiving, transmitting and analyzing the improved PTP network time protocol, and calculating to obtain the time deviation by utilizing the improved PTP network time protocol to the timestamp generation module.
The improved PTP network time synchronization protocol is used for marking the message receiving and sending time of the slave clock by using the standby timestamp of the communication fault node, marking the message receiving and sending time of the master clock by using the master timestamp of the normal communication node, and calculating the time deviation based on the message receiving and sending time of the slave clock and the message receiving and sending time of the master clock.
Illustratively, the message data unit is illustrated as follows:
version (4): version, 4 bits;
PacketType (4): the packet type occupies 4 bits, and most of the packet types in 16 packets are supported;
PacketLength (8): packet length, accounting for 8 bits;
T1/T3SendTimeStamp (16): the corresponding timestamp occupies 16 bits when the message is sent, and the transmission requirement of the maximum timestamp 38400 designed by the system can be met;
SlavePeerID (16): a slave node identification;
checksum (16): checksum, taking 16 bits;
t2RecvTimeStamp (16): the corresponding timestamp occupies 16 bits when the message is received, and can meet the transmission requirement of the maximum timestamp 38400 designed by the system;
t2RecvTimeOffset (32): the corresponding time offset when the message is received occupies 32 bits relative to the current timestamp.
The time synchronization control module belongs to application software, and the control logic is as shown in fig. 7, and is configured to control, based on the failure indication, whether to output the time slot, the primary timestamp, and the backup timestamp generated by the timestamp generation module to the timestamp driving module in the wireless communication module or to control the start and the stop of the improved PTP network time protocol in the user state.
There are three types of module combinations of the time synchronization system, namely, a relationship a between time synchronization system modules, a relationship B between time synchronization system modules, and a relationship C between time synchronization system modules, as shown in fig. 8, 9, and 10, respectively. Fig. 8 is a diagram in which a timestamp driving module is embedded in a physical driving layer of a wireless communication module, an improved PTP network time protocol module is configured in a time synchronization module, and a more complex protocol transceiving 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 improved PTP network time protocol module is embedded into the network layer of the wireless communication module, and at this time, only a simple start switch interface needs to be reserved between the time synchronization module and the wireless communication module. Fig. 10 is a diagram that a timestamp driving module and an improved PTP network time protocol module are combined into a user-state improved PTP network time protocol module, which is embedded into a network layer of a wireless communication module, and at this time, only a simple start switch interface needs to be reserved between a time synchronization module and the wireless communication module; the improved PTP network time protocol module in the user mode comprises functions of a timestamp driving module and the improved PTP network time protocol module, and is a special application mode of the linux environment. The latter two combination modes are simpler and more convenient to apply, but the construction process is more complex.
It should be noted that the hybrid optimized time synchronization system of each wireless network node adopts one of the three combination manners, and whichever manner is adopted does not affect the hybrid optimized time synchronization method provided by the embodiment of the present invention.
And S12, completing initialization of the hybrid optimization time synchronization system of each wireless network node.
The initialization operation includes setting a slot cycle and a timestamp cycle, and waiting for a first lock on the positioning system. If the first locking of the positioning system is successful, the initialization is successful, otherwise, the initialization fails.
S13, each wireless network node establishes normal communication with a positioning system; each node in normal communication with the positioning system starts a master timestamp, closes the improved PTP network time synchronization protocol, and realizes time synchronization with other normal communication nodes based on the master timestamp.
The time stamp is the result of thinning and dividing the clock scale of the node, and is also the basis of time synchronization among the wireless network nodes, and the phase synchronization of the time stamp among the network nodes indicates that the time synchronization among the network nodes is successful. The larger the phase error of the timestamps 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 accuracy of the time synchronization between the network nodes.
In this embodiment, each node in the wireless network locks the beidou satellite positioning system or the global positioning system respectively; when a wireless network node locks a Beidou satellite positioning system or a global positioning system within a limited time, judging that the wireless network node and the Beidou satellite positioning system or the global positioning system are normally communicated; wherein, according to the prior art level and the practical engineering experience, the first locking is cold start, and the limited time is set to be 3 minutes; the relocking is a warm start with a limit time set to 1 minute.
When all the nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within the limited time, the communication between all the nodes in the wireless network and the Beidou satellite positioning system or the global positioning system is judged to be normal.
Further, the wireless network node enables the master timestamp and closes the improved PTP network time synchronization protocol at the same time, so as 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 timestamp is the timestamp of the wireless network node generated by the timestamp generation module through a frequency doubling algorithm based on the second pulse and the standard clock generated by the GPS/Beidou module when the wireless network node is normally communicated with the Beidou satellite positioning system or the global positioning system, and the timestamp is the result of thinning and dividing the clock scale of the node.
It is worth noting that for a plurality of wireless network nodes which normally communicate with the Beidou satellite positioning system or the global positioning system, the timestamp synchronization precision between different wireless network nodes is the same as the GPS/Beidou second pulse synchronization precision, and the highest precision can reach nanosecond level, so that all timestamps generated by the wireless network nodes which normally communicate with the Beidou satellite positioning system or the global positioning system are main timestamps.
Illustratively, the timestamp generation module adopts an FPGA scheme, the slot cycle is set to 7.8125ms, the timestamp cycle is set to 5 minutes, and the timestamp generation process is as follows:
and generating a master timestamp 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 doubling second pulses, the maximum timestamp is 128 × 60 × 5=38400 according to the timestamp cycle of 5 minutes, the range of the timestamp is 1-38400, and the first second pulse after 0 minute or 5 minute is counted from 1.
Preferably, step S2 can be further refined into the following steps:
and S21, each node monitors whether the communication between the node and the positioning system is normal in real time.
When one wireless network node does not lock the Beidou satellite positioning system or the global positioning system within the limited time, the communication fault between the wireless network node and the Beidou satellite positioning system or the global positioning system is judged.
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 normally communicate with the Beidou satellite positioning system or the global positioning system.
S22, if communication faults of the ith wireless network node and the positioning system are monitored, the node starts a standby timestamp, an improved PTP network time synchronization protocol is started to obtain time deviation between the node and other normal communication nodes, and time synchronization with other normal communication nodes is achieved based on the standby timestamp and the time deviation;
wherein i belongs to 1,2, \ 8230, N, N is the number of nodes in the wireless network, and the normal communication node refers to the node which normally communicates with the positioning system.
The standby timestamp is the timestamp of the wireless network node generated by the timestamp generation 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 fault with a Beidou satellite positioning system or a global positioning system, and the timestamp is the result of thinning and dividing the clock scale of the node.
When the reference clock frequency output by the oven crystal module is less than 1pps, the error of the time stamp is approximately one hundred nanoseconds.
Through an improved PTP network time protocol, after the synchronization with the wireless network node which is adjacent and normally communicates with the positioning system, the synchronization precision of the timestamp generated by the wireless network node with the communication fault and the timestamp of the wireless network node which normally communicates with the positioning system can reach hundreds of nanoseconds.
Illustratively, the constant temperature crystal module adopts a constant temperature compensation crystal output by 10Mhz and 1pps, and the FPGA obtains a time slot period of 7.8125mm by counting the waveform period of the constant temperature crystal, wherein the number of the waveform periods is 78125. Also in terms of a 5 minute timestamp period, the maximum timestamp is 128 x 60 x 5=38400, the range of timestamps is 1-38400, and the initial position of the timestamp is fine-tuned according to the modified PTP network time protocol.
And optimizing a standard PTP network time protocol to obtain an 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 supplicant wireless network node and the master clock of the supplicant wireless network node, and the synchronization process is shown in fig. 11. The implementation of time synchronization mainly comprises 5 steps:
the method comprises the steps of carrying out whole network negotiation on all wireless network nodes, selecting a clock of a certain wireless network node as an optimal clock, establishing a master-slave relationship among all the wireless network nodes step by step based on the optimal clock, obtaining a master clock and a slave clock of each stage, and determining the master-slave state of a negotiation port of each stage.
Illustratively, the optimal clock is a master clock of a 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 clock and the slave clock of two wireless network nodes in a certain stage, and the time deviation calculation methods of the master clock and the slave clock of other stages are the same.
The master clock sends a Sync message to the slave clock and simultaneously records the sending time T of the Sync message A 1; receiving a Sync message from a clock and recording the receiving time T of the Sync message A 2;
After the master clock has sent out the Sync, it sends out a signal with T A A Follow _ Up message with a value of 1 is sent to a slave clock;
sending a Delay _ Req message from the slave clock to the master clock, and simultaneously recording the sending time T of the Delay _ Req message A 3; the main clock receives the Delay _ Req message and records the receiving time T of the Delay _ Req message at the same time A 4;
Transmitting a carry T from a master clock to a slave clock A 4 Delay _ Resp. After receiving the Delay _ Resp message, the slave clock can calculate the deviation with the master clock.
From the clock according to the derived T A 1、T A 2、T A 3、T A 4, calculating the average time difference between the round trips as [ (T) A 2-T A 1)+(T A 4-T A 3)]/2, it can be seen that the time deviation of the slave clock with respect to the master clock is (T) A 2-T A 1)-[(T A 2-T A 1)+(T A 4-T A 3)]And/2, calculating the time deviation between the slave clock of the node of the applicant wireless network and the master clock of the node of the requested wireless network based on the standard PTP network time protocol.
It is worth noting that the first step of the standard PTP network time protocol requires first performing a whole network negotiation to select an optimal clock, and then establishing a master-slave relationship between the clock and a negotiation port step by step according to a selection result, which is complex in interaction and takes the longest time compared with other steps. The embodiment of the invention optimizes the standard PTP network time protocol, and sets the starting time of the PTP network time protocol at the time when the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults, so the invention has the advantages that because the wireless network node is time-synchronized with other wireless network nodes including adjacent wireless network nodes before the communication faults occur, the wireless network node can already realize time synchronization with other network nodes when the communication faults occur, the process of selecting the optimal clock and establishing the master-slave relationship, which takes the longest time, is omitted, the clock of the adjacent wireless network node which normally communicates with the Beidou satellite positioning system or the global positioning system is defaulted as the master clock, and the improved PTP network time protocol flow is directly started.
It should be noted that, in the improved PTP network time protocol, a communication failure node, based on its standby timestamp, sends a time synchronization application as an applicant, and its clock is a slave clock; the clocks of other normal communication nodes are master clocks, and in the nodes, a certain node adjacent to the applicant is used as the requested party and interacts with the applicant through the sending and receiving time stamps. The application side uses the standby timestamp to mark the time corresponding to the message receiving/sending, and the applied side uses the main timestamp to mark the time corresponding to the message receiving/sending.
The modified PTP network time protocol flow is shown in figure 4. The implementation of time synchronization requires only 2 steps:
the slave clock sends a Sync _ Req message to the master clock and carries the sending time T of the Sync _ Req message B 1, recording Sync _ Req message receiving time T after the master clock receives the Sync _ Req message B 2;
The master clock sends a Sync _ Resp message to the slave clock and carries Delay _ Req message sending time T B 3 Sync _ Req message receiving time T B 2; after receiving the Sync _ Resp message from the clock, recording the receiving time T of the Sync _ Resp message B 4, then the time offset 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 eliminates the processes of establishing a master-slave relationship which consumes the longest time and selecting an 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 wireless network nodes is greatly reduced.
The method comprises the steps that an applicant takes a standby time stamp as a reference, and interacts with a certain wireless network node which is adjacent and normally communicates with a positioning system, namely an applicant, by utilizing an improved PTP network time synchronization protocol, and time deviation is obtained through calculation;
as shown in fig. 2, the backup timestamp is summed with the time offset, i.e., the offset is calculated, to obtain an updated backup timestamp;
the applicant and the applicant use the updated standby timestamp as a reference, interact with each other by using an improved PTP network time synchronization protocol, and calculate to obtain a new time deviation;
and repeating the steps to ensure that the time synchronization between the applicant and the requested party is kept in real time.
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 an applicant and other wireless network nodes which normally communicate with a Beidou satellite positioning system or a global positioning system is high; the improvement of the standard PTP network time protocol is given in detail, firstly, the establishment of the master-slave relationship which consumes the longest time and the selection process of the optimal clock are removed, 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 processes for implementing the methods of the embodiments described above can be implemented by a computer program, which can be stored in a computer-readable storage medium, for instructing the relevant hardware. The computer readable storage medium is a magnetic disk, an optical disk, a read-only memory or a random access memory.
The above description is only for the preferred embodiment of the present invention, but the scope of the present invention is not limited thereto, and any changes or substitutions that can be easily conceived by those skilled in the art within the technical scope of the present invention are included in the scope of the present invention.

Claims (10)

1. A hybrid optimization time synchronization method, comprising the steps of:
each node in the wireless network establishes normal communication with a positioning system respectively;
each node which normally communicates with the positioning system starts a main timestamp, closes an improved PTP network time synchronization protocol at the same time, and realizes time synchronization with other normal communication nodes based on the main timestamp;
each node monitors whether the communication between the node and a positioning system is normal or not in real time;
if communication faults between the ith wireless network node and the positioning system are monitored, the node starts a standby timestamp, an improved PTP network time synchronization protocol is started to obtain time deviation between the node and other normal communication nodes, and time synchronization is achieved with other normal communication nodes based on the standby timestamp and the time deviation;
wherein i belongs to 1,2, \8230, N and N are the number of nodes in the wireless network, and the normal communication node refers to a node normally communicating with the positioning system.
2. The hybrid optimized time synchronization method of claim 1, wherein the primary timestamp is generated based on a standard clock and a pulse-per-second; the backup timestamp is generated based on a reference clock frequency; the improved PTP network time synchronization protocol is used for marking the message receiving and sending time of the slave clock of a communication fault node by using the standby timestamp of the communication fault node, marking the message receiving and sending time of the master clock of a normal communication node by using the master timestamp of the normal communication node, and calculating to obtain time deviation based on the message receiving and sending time of the slave clock and the message receiving and sending time of the master clock.
3. The hybrid optimization time synchronization method according to claim 2, wherein the primary timestamp is a timestamp of the wireless network node generated by the timestamp generation module through a frequency multiplication algorithm based on a pulse per second and a standard clock generated by the GPS/beidou module when a wireless network node is in normal communication with the beidou satellite positioning system or the global positioning system, and the timestamp is a result of thinning and dividing a clock scale of the node.
4. The hybrid optimized time synchronization method according to claim 2, wherein the backup timestamp is a timestamp of a wireless network node generated by a timestamp generation module through a counting algorithm based on a reference clock frequency generated by a constant temperature crystal module when the wireless network node has a communication fault with a Beidou satellite positioning system or a global positioning system, and the timestamp is a result of performing refinement and segmentation on a clock scale of the node.
5. The hybrid optimized time synchronization method of claim 1, wherein time synchronization with other normal communication nodes based on the backup timestamp and time offset comprises:
taking a wireless network node with a communication fault with a positioning system as an applicant, taking a current standby timestamp as a reference, and carrying out interaction with a certain adjacent wireless network node which is normally communicated with the positioning system, namely an applicant by utilizing an improved PTP network time synchronization protocol to calculate and obtain a time deviation;
summing the current standby timestamp and the time deviation to obtain an updated standby timestamp;
the applicant and the applicant use the updated standby timestamp as a reference, interact with each other by using an improved PTP network time synchronization protocol, and calculate to obtain a new time deviation;
and repeating the steps to ensure that the time synchronization between the applicant and the requested party is kept in real time.
6. The hybrid optimized time synchronization method according to claim 5, wherein the interacting and calculating the time deviation by using the improved PTP network time synchronization protocol comprises:
the clock of the applicant is marked as a slave clock, and the corresponding time when the application receives/sends the message is marked by using the standby timestamp;
the clock of the requested party is marked as a master clock, and the corresponding time when the requested party receives/sends the message is marked by using the master timestamp;
the slave clock sends a Sync _ Req message to the master clock and carries the sending time T of the Sync _ Req message B 1, recording Sync _ Req message receiving time T after the master clock receives the Sync _ Req message B 2;
The master clock sends a Sync _ Resp message to the slave clock and carries Delay _ Req message sending time T B 3 and Sync _ Req message receiving time T B 2; after receiving the Sync _ Resp message from the clock, recording the receiving time T of the Sync _ Resp message B 4, then the time offset 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 is configured with a hybrid optimized time synchronization system, comprising:
the system comprises a GPS/Beidou module, a constant temperature crystal module, a timestamp generation module, a timestamp driving module, an improved PTP network time protocol module and a time synchronization control module; wherein the content of the first and second substances,
the GPS/Beidou module is used for providing a standard clock and a second pulse to the timestamp generation module and is also used for sending a fault indication to the time synchronization control module in real time when a communication fault occurs between the wireless network node and a Beidou satellite positioning system or a global positioning system;
the constant temperature crystal module is used for outputting a reference clock frequency to the timestamp generation module;
the timestamp generation module is used for generating a main timestamp through frequency multiplication calculation based on a standard clock and a second pulse, counting based on a reference clock frequency, and generating a standby timestamp by combining time deviation;
the timestamp driving module is used for inserting and extracting the main timestamp or the standby timestamp, namely acquiring the main timestamp and the standby timestamp generated by the timestamp generating module;
the improved PTP network time protocol module is used for receiving, transmitting and analyzing the improved PTP network time protocol, and calculating to obtain a time deviation to the timestamp generation module by utilizing the improved PTP network time protocol;
the time synchronization control module is used for controlling whether to output the main timestamp and the standby timestamp generated by the timestamp generation module to the timestamp driving module for switching 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, and comprises:
each node in the wireless network is respectively locked with a Beidou satellite positioning system or a global positioning system;
when all the nodes in the wireless network meet the requirement of locking the Beidou satellite positioning system or the global positioning system within the limited time, the communication between all the nodes in the wireless network and the Beidou satellite positioning system or the global positioning system is judged to be normal.
9. The hybrid optimized 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 a wireless network node does not lock a Beidou satellite positioning system or a global positioning system within a limited time, judging that the wireless network node and the Beidou satellite positioning system or the global positioning system have communication faults;
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 normally communicate with the Beidou satellite positioning system or the global positioning system.
10. The hybrid optimized time synchronization method of claim 9, wherein the time limit is defined by:
T1>T2
wherein T1 is cold start limited time corresponding to the first locking of the Beidou satellite positioning system or the global positioning system; and T2 is the hot start limited time corresponding to the re-locking of the Beidou satellite positioning system or the global positioning system.
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 true CN115642976A (en) 2023-01-24
CN115642976B 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)

Cited By (1)

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

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102013931A (en) * 2009-09-08 2011-04-13 中兴通讯股份有限公司 Time synchronization method and system, salve timing device and main timing device
EP2541815A1 (en) * 2011-06-28 2013-01-02 Alcatel Lucent Clock synchronization network
WO2016054884A1 (en) * 2014-10-08 2016-04-14 中兴通讯股份有限公司 Frequency deviation monitoring method, device and computer storage medium
CN108667547A (en) * 2018-08-10 2018-10-16 电信科学技术第五研究所有限公司 A kind of Network Time Protocol conversion method and system
CN111555834A (en) * 2020-04-30 2020-08-18 北京邮电大学 Clock synchronization method and system of wireless network based on IEEE1588 protocol
CN112583512A (en) * 2020-12-10 2021-03-30 北京航星机器制造有限公司 Time synchronization device and method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102013931A (en) * 2009-09-08 2011-04-13 中兴通讯股份有限公司 Time synchronization method and system, salve timing device and main timing device
EP2541815A1 (en) * 2011-06-28 2013-01-02 Alcatel Lucent Clock synchronization network
WO2016054884A1 (en) * 2014-10-08 2016-04-14 中兴通讯股份有限公司 Frequency deviation monitoring method, device and computer storage medium
CN108667547A (en) * 2018-08-10 2018-10-16 电信科学技术第五研究所有限公司 A kind of Network Time Protocol conversion method and system
CN111555834A (en) * 2020-04-30 2020-08-18 北京邮电大学 Clock synchronization method and system of wireless network based on IEEE1588 protocol
CN112583512A (en) * 2020-12-10 2021-03-30 北京航星机器制造有限公司 Time synchronization device and method

Cited By (2)

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

Also Published As

Publication number Publication date
CN115642976B (en) 2023-07-21

Similar Documents

Publication Publication Date Title
KR101749202B1 (en) Method, apparatus, and system for generating timestamp
CN111585683B (en) High-reliability clock synchronization system and method for time-sensitive network
CN102104475B (en) IEEE 1588-based synchronization system and synchronization method thereof
CN101882990B (en) Method for selecting master clock based on PTP (Picture Transfer Protocol) and link quality, slave clock and system
CN101977104A (en) IEEE1588 based accurate clock synchronization protocol system and synchronization method thereof
US20100074383A1 (en) Timestamping method and apparatus for precise network synchronization
CN104272664A (en) Gateway, nodes, and method for a vehicle
CN102983927B (en) Time compensation method for master-slave clock timing based on IEEE 1588 protocol
CN108259109B (en) Network equipment in PTP domain and TOD synchronization method
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
WO2020043181A1 (en) Clock synchronization method and apparatus, system, storage medium, and electronic device
WO2018082665A1 (en) Frequency synchronization method and slave clock
CN104836630A (en) IEEE1588 clock synchronization system and implementation method therefor
CN115642976B (en) Mixed optimization time synchronization method
CN103188064A (en) Clock synchronization method and clock synchronization device
CN115642977B (en) Mixed optimization time synchronization system
JP6227888B2 (en) Communication system, synchronization system, and communication method
EP3656077B1 (en) Cross domain synchronization in a communication network
CN111698050A (en) Wireless terminal, clock synchronization method and system
CN103138865A (en) Time synchronization method and time synchronization device
CN114584246A (en) Wireless ad hoc network time synchronization method, system and medium based on FPGA
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
CN102404103B (en) Method and system for improving PTP time synchronization precision
CN115243362B (en) Time synchronization system and method applied to traveling wave positioning device
KR20100048124A (en) Time synchronization method in bridged local area network

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