Nothing Special   »   [go: up one dir, main page]

CN114390666A - Communication module time synchronization method, device and computer readable storage medium - Google Patents

Communication module time synchronization method, device and computer readable storage medium Download PDF

Info

Publication number
CN114390666A
CN114390666A CN202210107318.4A CN202210107318A CN114390666A CN 114390666 A CN114390666 A CN 114390666A CN 202210107318 A CN202210107318 A CN 202210107318A CN 114390666 A CN114390666 A CN 114390666A
Authority
CN
China
Prior art keywords
time
slave
clock
master
group
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
CN202210107318.4A
Other languages
Chinese (zh)
Other versions
CN114390666B (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.)
Gaoxing Wulian Technology Co ltd
Original Assignee
Gaoxing Wulian Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Gaoxing Wulian Technology Co ltd filed Critical Gaoxing Wulian Technology Co ltd
Priority to CN202210107318.4A priority Critical patent/CN114390666B/en
Publication of CN114390666A publication Critical patent/CN114390666A/en
Application granted granted Critical
Publication of CN114390666B publication Critical patent/CN114390666B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/003Arrangements to increase tolerance to errors in transmission or reception timing
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • H04W56/0015Synchronization between nodes one node acting as a reference for the others
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/001Synchronization between nodes
    • H04W56/002Mutual synchronization
    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04WWIRELESS COMMUNICATION NETWORKS
    • H04W56/00Synchronisation arrangements
    • H04W56/004Synchronisation arrangements compensating for timing error of reception due to propagation delay
    • 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

  • Engineering & Computer Science (AREA)
  • Computer Networks & Wireless Communication (AREA)
  • Signal Processing (AREA)
  • Synchronisation In Digital Transmission Systems (AREA)
  • Electric Clocks (AREA)

Abstract

The invention discloses a communication module time synchronization method, a device and a computer readable storage medium, wherein the method comprises the following steps: using one of the communication modules as a master clock and the other communication modules as slave clocks which are connected with the master clock maintaining network; acquiring network delay time between each group of master and slave clocks through time deviation measurement and delay measurement between each group of master and slave clocks; carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time; and time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time. The time synchronization when multiple wireless communication modules are networked is realized, and the requirement of an application scene of the Internet of things with higher time precision requirement is met.

Description

Communication module time synchronization method, device and computer readable storage medium
Technical Field
The present invention relates to the field of mobile communications, and in particular, to a method and apparatus for time synchronization of a communication module, and a computer-readable storage medium.
Background
In the prior art, NTP (network time protocol) time of a communication module is obtained from an NTP server through a network application protocol, but the following network transmission delay inevitably exists due to mobile communication: and (3) sending time delay: the time for the nodes to construct synchronous messages and deliver the messages to the MAC layer; channel access delay: the time for the synchronous message to start sending the message from the detection of whether the channel is idle to the physical layer is long, the channel access delay randomness is large, and the influence of the current channel idle degree and the network load condition is large; transmission delay: the time used by the sending node to transmit the synchronous message outwards through the antenna; propagation delay: the time taken for a node to travel from a sending node to a receiving node in the medium; receiving time delay: the time used by the physical layer of the receiving node to receive the synchronous message through the antenna; processing time delay: and the time for processing the message by the receiving node.
In summary, in view of the fact that the accuracy of the transmission delay of the existing multi-radio communication module during networking is only tens of milliseconds to one second, which cannot meet the requirement of high-accuracy time synchronization in the application field of the internet of things, a technical solution capable of correcting the transmission delay of the multi-radio communication module during networking and improving the transmission accuracy is urgently needed.
Disclosure of Invention
In order to solve the technical defects in the prior art, the invention provides a communication module time synchronization method, which comprises the following steps:
one of the communication modules is used as a master clock, and the other communication modules are used as slave clocks connected with the master clock maintaining network.
And acquiring the network delay time between the master clock and the slave clock of each group through the time deviation measurement and the delay measurement between the master clock and the slave clock of each group.
And carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time.
And time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time.
Optionally, the using one of the communication modules as a master clock and the other communication modules as slave clocks connected to the master clock holding network includes:
and determining all the communication modules connected with the time synchronization server.
When the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
Optionally, the obtaining of the network delay time between each group of master and slave clocks by time offset measurement and delay measurement between each group of master and slave clocks includes:
and calculating the deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous.
And acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
Optionally, the performing a weighted average on the network delay times between the master clocks and the slave clocks of all the groups to obtain a normalized network delay time includes:
obtaining the network delay time T between each group of master and slave clocksdelay[k]And k is the group number of the master clock and the slave clock.
By passing
Figure BDA0003493838460000021
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure BDA0003493838460000022
the normalized network delay time.
Optionally, the time compensating and calibrating the synchronization time of each slave clock by the normalized network delay time includes:
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure BDA0003493838460000023
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
The invention also provides a communication module time synchronization device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the computer program realizes that:
one of the communication modules is used as a master clock, and the other communication modules are used as slave clocks connected with the master clock maintaining network.
And acquiring the network delay time between the master clock and the slave clock of each group through the time deviation measurement and the delay measurement between the master clock and the slave clock of each group.
And carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time.
And time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time.
Optionally, the computer program when executed by the processor implements:
and determining all the communication modules connected with the time synchronization server.
When the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
Optionally, the computer program when executed by the processor implements:
and calculating the deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous.
And acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
Optionally, the computer program when executed by the processor implements:
obtaining the network delay time T between each group of master and slave clocksdelay[k]And k is the group number of the master clock and the slave clock.
By passing
Figure BDA0003493838460000031
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure BDA0003493838460000032
delaying the normalized network delay time;
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure BDA0003493838460000033
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
The present invention further provides a computer-readable storage medium having a communication module time synchronization program stored thereon, where the communication module time synchronization program, when executed by a processor, implements the steps of the communication module time synchronization method as described in any of the above.
The communication module time synchronization method, the equipment and the computer readable storage medium implement the invention, one of a plurality of communication modules is used as a master clock, and other communication modules are used as slave clocks which are connected with the master clock maintaining network; acquiring network delay time between each group of master and slave clocks through time deviation measurement and delay measurement between each group of master and slave clocks; carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time; and time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time. The time synchronization when multiple wireless communication modules are networked is realized, and the requirement of an application scene of the Internet of things with higher time precision requirement is met.
Drawings
The invention will be further described with reference to the accompanying drawings and examples, in which:
FIG. 1 is a flow chart of a first embodiment of a method for time synchronization of communication modules according to the present invention;
FIG. 2 is a connection diagram of a second embodiment of the time synchronization method for communication modules according to the present invention;
fig. 3 is a measurement diagram illustrating a communication module time synchronization method according to a second embodiment of the present invention.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
In the following description, suffixes such as "module", "component", or "unit" used to denote elements are used only for facilitating the explanation of the present invention, and have no specific meaning in itself. Thus, "module", "component" or "unit" may be used mixedly.
Example one
Fig. 1 is a flowchart of a communication module time synchronization method according to a first embodiment of the present invention. A method for time synchronization of communication modules, the method comprising:
and S1, taking one of the communication modules as a master clock, and taking other communication modules as slave clocks connected with the master clock holding network.
And S2, acquiring the network delay time between each group of master and slave clocks through the time deviation measurement and the delay measurement between each group of master and slave clocks.
And S3, carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time.
And S4, performing time compensation and calibration on the synchronous time of each slave clock through the normalized network delay time.
In this embodiment, first, the NTP time acquired by one communication module is selected as a master clock, and the NTP times acquired by other communication modules are selected as slave clocks; then, deviation measurement and delay measurement are carried out by adopting an IEEE1588v2 protocol, and network transmission delay time between each master clock group and each slave clock group is obtained; and finally, carrying out weighted average on the network delay time of each master clock group and each slave clock group to obtain the normalized network delay time.
In the embodiment, the time synchronization algorithm of the single step mode in IEEE1588v2 can be divided into two stages of deviation measurement and delay measurement. Based on the above, one set of master and slave clocks is selected for description.
First, in the first stage, a time offset T is performedoffsetAnd (6) measuring. Specifically, the slave clock obtains T by calculating the deviation value between the slave clock and the master clock to correct the time of the slave clockstartAnd TendCalculating the deviation value of the master clock and the slave clock by using the following formula after two timestamps:
Toffset=Tend-Tstart-Tdelay
calculating T from a clockoffsetAfter the value, subtract T from the current timeoffsetSynchronizing itself to the master clock.
Then, in a second phase, a delay measurement is performed. Specifically, the delay time of the message in the network transmission is measured, including that the slave clock is at TreqSending Delay _ Req message to a master clock in time, wherein the master clock is at TrespAfter receiving the message, and sending TrespPut into a Delay _ Resp message and send back to the slave clock. When the Delay _ Resp message is received from the clock, the following calculation formula can be obtained
Tresp-Treq=Tdelay-Toffset
The network transmission delay is calculated by the two calculation formulas:
Figure BDA0003493838460000053
then, obtaining the network delay time T of each group of master and slave clocksdelay[k]Then, carrying out weighted average by the following formula to obtain the normalized network delay time
Figure BDA0003493838460000051
Figure BDA0003493838460000052
Wherein, the weight is determined according to the number k (k is more than 1) of the actual master clock group and the actual slave clock group.
Finally, in the third stage, aiming at the NTP time of each wireless communication module, the fusion normalization network delay time can be combined through the following formula
Figure BDA0003493838460000061
Obtaining:
Figure BDA0003493838460000062
therefore, time synchronization during networking of multiple wireless communication modules is achieved, and the requirement of the Internet of things application scene with high time precision requirement is met.
It can be seen that, in this embodiment, based on the IEEE1588v2(PTP) precision time protocol, a wireless communication module time synchronization scheme is proposed, specifically, an NTP time acquired by one communication module is selected as a master clock, NTP times acquired by other communication modules are selected as slave clocks, the IEEE1588v2 protocol is used to perform deviation measurement and delay measurement, delay time between the master clock and the slave clocks is acquired, and time synchronization between the communication modules is further implemented. According to the embodiment, the NTP time service precision of the wireless communication module can be effectively improved, time synchronization during networking of multiple wireless communication modules is realized, and the method can be applied to an application scene of the Internet of things with high requirements on time precision.
Example two
Based on the above-mentioned embodiment, referring to the connection diagram shown in fig. 2, the taking one of the communication modules as a master clock and the other communication modules as slave clocks that maintain network connection with the master clock includes:
and determining all the communication modules connected with the time synchronization server.
When the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
In this embodiment, the master and slave clocks may be established through networking via network protocols, including but not limited to a TCP protocol server-client form, and an LWM2M protocol form, and the purpose of networking the master and slave clocks is to connect the master clock device with the slave clock device.
In this embodiment, the number of slave clock groups is k, and k >1 is required; optionally, if the k value is larger, the number of finally acquired samples is larger, and the finally calculated normalized network delay time is more accurate.
In this embodiment, the obtaining the network delay time between each set of master and slave clocks by time offset measurement and delay measurement between each set of master and slave clocks includes:
and calculating the deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous.
And acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
In the present embodiment, T is considereddelay[k]The network delay time of each master clock group and each slave clock group can be determined by the network delay when the NTP time is acquired, the acquired NTP time is acquired through a TCP protocol and can be calculated through a timestamp in a network message; due to the firing of each deviceThe frequency parameters, the network environment and other factors have certain differences. Therefore, there is a certain error, and therefore, it is necessary to subtract the time offset Toffset of the master and slave clocks.
In this embodiment, referring to the measurement schematic diagram shown in fig. 3, the performing a weighted average on the network delay times between the master clocks and the slave clocks of all the groups to obtain a normalized network delay time includes:
obtaining the network delay time T between each group of master and slave clocksdelay[k]And k is the group number of the master clock and the slave clock.
By passing
Figure BDA0003493838460000071
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure BDA0003493838460000072
the normalized network delay time.
In this embodiment, the master clock is unique, e.g., may be denoted as P, and there are k slave clocks, e.g., may be denoted as S1, S2.. ska.. then P-S1, P-S2.. a.p-ska.. may be grouped into a distributed set of master and slave clocks; the weight of each group is the reciprocal of the k value.
In this embodiment, because of uncertainty and unpredictability of network delay, the network delay time in the same networking domain is weighted and averaged by collecting k sets of master and slave devices to obtain a normalized network delay time, so that NTP time finally obtained by k slave devices can be further refined.
In this embodiment, the time compensating and calibrating the synchronization time of each slave clock by the normalized network delay time includes:
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure BDA0003493838460000073
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
In this embodiment, a 1-K distributed mode is adopted, 1 master clock device and K slave clock devices are set, and on the premise that the master clocks are consistent, time deviation and network delay are calculated with the K slave clocks, and finally the clocks are synchronized to K, so that the reliability and accuracy are higher.
In this embodiment, the master clock and the k slave clocks all obtain the same time from the NTP server as the start time, and then the IEEE1588v2(PTP) precision time protocol is used to measure the time deviation and the network delay between the master clock and the slave clock, so as to perform time compensation and calibration on the k slave clock devices, and finally achieve the purpose of time synchronization of the k devices.
EXAMPLE III
The invention also provides a communication module time synchronization device, which comprises a memory, a processor and a computer program stored on the memory and capable of running on the processor, wherein when the computer program is executed by the processor, the computer program realizes that:
one of the communication modules is used as a master clock, and the other communication modules are used as slave clocks connected with the master clock maintaining network.
And acquiring the network delay time between the master clock and the slave clock of each group through the time deviation measurement and the delay measurement between the master clock and the slave clock of each group.
And carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time.
And time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time.
In this embodiment, first, the NTP time acquired by one communication module is selected as a master clock, and the NTP times acquired by other communication modules are selected as slave clocks; then, deviation measurement and delay measurement are carried out by adopting an IEEE1588v2 protocol, and network transmission delay time between each master clock group and each slave clock group is obtained; and finally, carrying out weighted average on the network delay time of each master clock group and each slave clock group to obtain the normalized network delay time.
In the embodiment, the time synchronization algorithm of the single step mode in IEEE1588v2 can be divided into two stages of deviation measurement and delay measurement. Based on the above, one set of master and slave clocks is selected for description.
First, in the first stage, a time offset T is performedoffsetAnd (6) measuring. Specifically, the slave clock obtains T by calculating the deviation value between the slave clock and the master clock to correct the time of the slave clockstartAnd TendCalculating the deviation value of the master clock and the slave clock by using the following formula after two timestamps:
Toffset=Tend-Tstart-Tdelay
calculating T from a clockoffsetAfter the value, subtract T from the current timeoffsetSynchronizing itself to the master clock.
Then, in a second phase, a delay measurement is performed. Specifically, the delay time of the message in the network transmission is measured, including that the slave clock is at TreqSending Delay _ Req message to a master clock in time, wherein the master clock is at TrespAfter receiving the message, and sending TrespPut into a Delay _ Resp message and send back to the slave clock. When the Delay _ Resp message is received from the clock, the following calculation formula can be obtained
Tresp-Treq=Tdelay-Toffset
The network transmission delay is calculated by the two calculation formulas:
Tdelay=[(Tend-Tstart)-(Tresp-Treq)]/2。
then, obtaining the network delay time T of each group of master and slave clocksdelay[k]Then, carrying out weighted average by the following formula to obtain the normalized network delay time
Figure BDA0003493838460000091
Figure BDA0003493838460000092
Wherein, the weight is determined according to the number k (k is more than 1) of the actual master clock group and the actual slave clock group.
Finally, in the third stage, aiming at the NTP time of each wireless communication module, the fusion normalization network delay time can be combined through the following formula
Figure BDA0003493838460000093
Obtaining:
Figure BDA0003493838460000094
therefore, time synchronization during networking of multiple wireless communication modules is achieved, and the requirement of the Internet of things application scene with high time precision requirement is met.
It can be seen that, in this embodiment, based on the IEEE1588v2(PTP) precision time protocol, a wireless communication module time synchronization scheme is proposed, specifically, an NTP time acquired by one communication module is selected as a master clock, NTP times acquired by other communication modules are selected as slave clocks, the IEEE1588v2 protocol is used to perform deviation measurement and delay measurement, delay time between the master clock and the slave clocks is acquired, and time synchronization between the communication modules is further implemented. According to the embodiment, the NTP time service precision of the wireless communication module can be effectively improved, time synchronization during networking of multiple wireless communication modules is realized, and the method can be applied to an application scene of the Internet of things with high requirements on time precision.
Example four
Based on the above embodiments, the computer program when executed by the processor implements:
and determining all the communication modules connected with the time synchronization server.
When the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
Optionally, the computer program when executed by the processor implements:
and calculating the deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous.
And acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
Optionally, the computer program when executed by the processor implements:
obtaining the network delay time T between each group of master and slave clocksdelay[k]And k is the group number of the master clock and the slave clock.
By passing
Figure BDA0003493838460000101
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure BDA0003493838460000102
delaying the normalized network delay time;
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure BDA0003493838460000103
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
Based on the above-mentioned embodiment, referring to the connection diagram shown in fig. 2, the taking one of the communication modules as a master clock and the other communication modules as slave clocks that maintain network connection with the master clock includes:
and determining all the communication modules connected with the time synchronization server.
When the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
In this embodiment, the master and slave clocks may be established through networking via network protocols, including but not limited to a TCP protocol server-client form, and an LWM2M protocol form, and the purpose of networking the master and slave clocks is to connect the master clock device with the slave clock device.
In this embodiment, the number of slave clock groups is k, and k is required to be greater than 1; optionally, if the k value is larger, the number of finally acquired samples is larger, and the finally calculated normalized network delay time is more accurate.
In this embodiment, the obtaining the network delay time between each set of master and slave clocks by time offset measurement and delay measurement between each set of master and slave clocks includes:
and calculating the deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous.
And acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
In the present embodiment, T is considereddelay[k]The network delay time of each master clock group and each slave clock group can be determined by the network delay when the NTP time is acquired, the acquired NTP time is acquired through a TCP protocol and can be calculated through a timestamp in a network message; there is a certain difference due to factors such as the radio frequency parameters of each device, the network environment, etc. Therefore, there is a certain error, and therefore, it is necessary to subtract the time offset Toffset of the master and slave clocks.
In this embodiment, referring to the measurement schematic diagram shown in fig. 3, the performing a weighted average on the network delay times between the master clocks and the slave clocks of all the groups to obtain a normalized network delay time includes:
obtaining the network delay time T between each group of master and slave clocksdelay[k]And k is the group number of the master clock and the slave clock.
By passing
Figure BDA0003493838460000111
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure BDA0003493838460000112
the normalized network delay time.
In this embodiment, the master clock is unique, e.g., may be denoted as P, and there are k slave clocks, e.g., may be denoted as S1, S2.. ska.. then P-S1, P-S2.. a.p-ska.. may be grouped into a distributed set of master and slave clocks; the weight of each group is the reciprocal of the k value.
In this embodiment, because of uncertainty and unpredictability of network delay, the network delay time in the same networking domain is weighted and averaged by collecting k sets of master and slave devices to obtain a normalized network delay time, so that NTP time finally obtained by k slave devices can be further refined.
In this embodiment, the time compensating and calibrating the synchronization time of each slave clock by the normalized network delay time includes:
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure BDA0003493838460000121
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein,Tkand obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
In this embodiment, a 1-K distributed mode is adopted, 1 master clock device and K slave clock devices are set, and on the premise that the master clocks are consistent, time deviation and network delay are calculated with the K slave clocks, and finally the clocks are synchronized to K, so that the reliability and accuracy are higher.
In this embodiment, the master clock and the k slave clocks all obtain the same time from the NTP server as the start time, and then the IEEE1588v2(PTP) precision time protocol is used to measure the time deviation and the network delay between the master clock and the slave clock, so as to perform time compensation and calibration on the k slave clock devices, and finally achieve the purpose of time synchronization of the k devices.
EXAMPLE five
Based on the foregoing embodiments, the present invention further provides a computer-readable storage medium, in which a communication module time synchronization program is stored, and when the communication module time synchronization program is executed by a processor, the steps of the communication module time synchronization method according to any one of the foregoing embodiments are implemented.
It should be noted that the media embodiment and the method embodiment belong to the same concept, and specific implementation processes thereof are detailed in the method embodiment, and technical features in the method embodiment are correspondingly applicable in the media embodiment, which is not described herein again.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be embodied in the form of a software product, which is stored in a storage medium (such as ROM/RAM, magnetic disk, optical disk) and includes instructions for enabling a terminal (such as a mobile phone, a computer, a server, an air conditioner, or a network device) to execute the method according to the embodiments of the present invention.
While the present invention has been described with reference to the embodiments shown in the drawings, the present invention is not limited to the embodiments, which are illustrative and not restrictive, and it will be apparent to those skilled in the art that various changes and modifications can be made therein without departing from the spirit and scope of the invention as defined in the appended claims.

Claims (10)

1. A method for time synchronization of communication modules, the method comprising:
using one of the communication modules as a master clock and the other communication modules as slave clocks which are connected with the master clock maintaining network;
acquiring network delay time between each group of master and slave clocks through time deviation measurement and delay measurement between each group of master and slave clocks;
carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time;
and time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time.
2. The method for time synchronization of communication modules according to claim 1, wherein said using one of a plurality of communication modules as a master clock and the other communication modules as slave clocks that maintain network connection with the master clock comprises:
determining all the communication modules connected with the time synchronization server;
when the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
3. The method for time synchronization of communication modules according to claim 2, wherein said obtaining the network delay time between each set of master and slave clocks by time offset measurement and delay measurement between each set of master and slave clocks comprises:
calculating a deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous;
and acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
4. The method according to claim 3, wherein the weighted averaging of the network delay times between the master and slave clocks of all groups to obtain a normalized network delay time comprises:
obtaining the network delay time T between each group of master and slave clocksdelay[k]Wherein k is the group number of the master clock and the slave clock;
by passing
Figure FDA0003493838450000021
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure FDA0003493838450000022
the normalized network delay time.
5. The method for time synchronizing communication modules according to claim 4, wherein said time compensating and calibrating the synchronization time of each of said slave clocks by said normalized network delay time comprises:
recording the synchronization time acquired from the kth slave clock to the time synchronization server as Tk-ntp
According to
Figure FDA0003493838450000023
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
6. A communication module time synchronization apparatus, comprising a memory, a processor, and a computer program stored on the memory and executable on the processor, the computer program when executed by the processor implementing:
using one of the communication modules as a master clock and the other communication modules as slave clocks which are connected with the master clock maintaining network;
acquiring network delay time between each group of master and slave clocks through time deviation measurement and delay measurement between each group of master and slave clocks;
carrying out weighted average on the network delay time between the master clock and the slave clock of all the groups to obtain normalized network delay time;
and time compensation and calibration are carried out on the synchronous time of each slave clock through the normalized network delay time.
7. The method for time synchronization of communication modules according to claim 6, wherein said computer program when executed by said processor implements:
determining all the communication modules connected with the time synchronization server;
when the compensation and calibration requirements of the synchronous time are generated, one communication module is selected from all the communication modules to be used as a master clock, other communication modules are used as slave clocks, and network connection between the master clock and the slave clocks of each group is established.
8. The method for time synchronization of communication modules according to claim 7, wherein said computer program when executed by said processor implements:
calculating a deviation value of the slave clock and the master clock between each group of master and slave clocks, and performing time correction on the slave clock through the deviation value so as to keep each group of master and slave clocks synchronous;
and acquiring the network delay time between the master clock and the slave clock of each group through delay measurement and the deviation value at the time of each group of master clock and slave clock.
9. The method for time synchronization of communication modules according to claim 8, wherein said computer program when executed by said processor implements:
obtaining the network delay time T between each group of master and slave clocksdelay[k]Wherein k is the group number of the master clock and the slave clock;
by passing
Figure FDA0003493838450000031
Performing a weighted average of the network delay times between master and slave clocks of all groups, wherein,
Figure FDA0003493838450000032
delaying the normalized network delay time;
synchronizing the kth slave clock to the time synchronization serverThe time is recorded as Tk-ntp
According to
Figure FDA0003493838450000033
Time compensating and calibrating the synchronization time of each of the slave clocks, wherein TkAnd obtaining the calibrated synchronization time from the kth slave clock to the time synchronization server.
10. A computer-readable storage medium, characterized in that the computer-readable storage medium has stored thereon a communication module time synchronization program, which when executed by a processor implements the steps of the communication module time synchronization method according to any one of claims 1 to 5.
CN202210107318.4A 2022-01-28 2022-01-28 Communication module time synchronization method, equipment and computer readable storage medium Active CN114390666B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210107318.4A CN114390666B (en) 2022-01-28 2022-01-28 Communication module time synchronization method, equipment and computer readable storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210107318.4A CN114390666B (en) 2022-01-28 2022-01-28 Communication module time synchronization method, equipment and computer readable storage medium

Publications (2)

Publication Number Publication Date
CN114390666A true CN114390666A (en) 2022-04-22
CN114390666B CN114390666B (en) 2023-08-15

Family

ID=81203261

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210107318.4A Active CN114390666B (en) 2022-01-28 2022-01-28 Communication module time synchronization method, equipment and computer readable storage medium

Country Status (1)

Country Link
CN (1) CN114390666B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227246A (en) * 2008-01-28 2008-07-23 中兴通讯股份有限公司 Method and apparatus for master-salve clock synchronization
CN101820500A (en) * 2009-02-27 2010-09-01 索尼公司 From the device, from the device time synchronization method, main device and electronic apparatus system
CN101834712A (en) * 2010-04-19 2010-09-15 浙江大学 Method for realizing accurate time synchronization by utilizing IEEE1588 protocol
CN102264011A (en) * 2010-05-27 2011-11-30 大唐移动通信设备有限公司 Method and device for determining time delay and performing clock synchronization based on GPON (gigabit-capable passive optical network)
CN103763055A (en) * 2013-10-18 2014-04-30 杭州联汇数字科技有限公司 Method for precise time synchronization
CN103988453A (en) * 2011-11-30 2014-08-13 大陆汽车有限责任公司 Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method
US20160241381A1 (en) * 2011-07-20 2016-08-18 Aviat U.S., Inc. Systems and methods of clock synchronization between devices on a network
CN108418235A (en) * 2018-01-30 2018-08-17 国网电力科学研究院武汉南瑞有限责任公司 The compensation method that signal transmission clock applied to four fracture series trip devices synchronizes
CN108924207A (en) * 2018-06-26 2018-11-30 深圳高新兴物联科技有限公司 Terminal device and its system file update method, system and computer storage medium
CN109104261A (en) * 2018-09-28 2018-12-28 深圳高新兴物联科技有限公司 Local zone time acquisition methods, terminal and storage medium based on LBS
CN110572230A (en) * 2019-09-10 2019-12-13 北京邮电大学 correction method and device for realizing time synchronization
CN112751641A (en) * 2020-12-31 2021-05-04 网络通信与安全紫金山实验室 TSN network time synchronization method, equipment and storage medium

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101227246A (en) * 2008-01-28 2008-07-23 中兴通讯股份有限公司 Method and apparatus for master-salve clock synchronization
CN101820500A (en) * 2009-02-27 2010-09-01 索尼公司 From the device, from the device time synchronization method, main device and electronic apparatus system
CN101834712A (en) * 2010-04-19 2010-09-15 浙江大学 Method for realizing accurate time synchronization by utilizing IEEE1588 protocol
CN102264011A (en) * 2010-05-27 2011-11-30 大唐移动通信设备有限公司 Method and device for determining time delay and performing clock synchronization based on GPON (gigabit-capable passive optical network)
US20160241381A1 (en) * 2011-07-20 2016-08-18 Aviat U.S., Inc. Systems and methods of clock synchronization between devices on a network
CN103988453A (en) * 2011-11-30 2014-08-13 大陆汽车有限责任公司 Method for synchronizing clocks in nodes of a vehicle network and node designed to perform the method
CN103763055A (en) * 2013-10-18 2014-04-30 杭州联汇数字科技有限公司 Method for precise time synchronization
CN108418235A (en) * 2018-01-30 2018-08-17 国网电力科学研究院武汉南瑞有限责任公司 The compensation method that signal transmission clock applied to four fracture series trip devices synchronizes
CN108924207A (en) * 2018-06-26 2018-11-30 深圳高新兴物联科技有限公司 Terminal device and its system file update method, system and computer storage medium
CN109104261A (en) * 2018-09-28 2018-12-28 深圳高新兴物联科技有限公司 Local zone time acquisition methods, terminal and storage medium based on LBS
CN110572230A (en) * 2019-09-10 2019-12-13 北京邮电大学 correction method and device for realizing time synchronization
CN112751641A (en) * 2020-12-31 2021-05-04 网络通信与安全紫金山实验室 TSN network time synchronization method, equipment and storage medium

Also Published As

Publication number Publication date
CN114390666B (en) 2023-08-15

Similar Documents

Publication Publication Date Title
US9344981B2 (en) Method for synchronizing clocks in a communication network
JP4810169B2 (en) Method for synchronizing transmitter transmit clock and receiver receive clock in a wireless communication network
CN103929293B (en) Asymmetrically-delayed time synchronization method and system
EP2731303B1 (en) Method and device for implementing automatic compensation for asymmetric delay of 1588 link
WO2017071270A1 (en) Local clock adjustment method, and time service method and device
US11153838B1 (en) Time synchronization enhancements for integrated 5G-TSN networking
WO2010115357A1 (en) Method and system for clock correction of wireless base station based on internet protocol (ip) network
KR20100124195A (en) Method and apparatus for performing time synchronization between nodes
KR20090071923A (en) Method for synchronization using single timesync frame in bridged local area network and appratus thereof
CN101455014A (en) Methods and devices for sending transmission-time or reception-time information for a transmitted or received message
CN102197611A (en) Method and device for packet network synchronization
CN114157377B (en) Power distribution terminal real-time clock synchronization method, synchronization system and power distribution terminal
Sallai et al. On the scalability of routing integrated time synchronization
CN113965288A (en) Method and device for improving precision time protocol PTP time synchronization precision
CN110933096A (en) Software-defined network time service system and time service method
CN115865246A (en) Time synchronization device, system and method
CN114390666A (en) Communication module time synchronization method, device and computer readable storage medium
KR20190072745A (en) Stable Network-based Time Synchronization Method
KR20100048124A (en) Time synchronization method in bridged local area network
KR101605316B1 (en) frequency error estimating apparatus using Rx delay in PTP
CN114285542A (en) Network time correction method, equipment and computer readable storage medium
KR101665924B1 (en) Frequency offset estimation system using network time protocol time offset
EP3849112A1 (en) A method for time synchronization between a master and at least one slave
US20070177572A1 (en) Method and system for reporting synchronization status in a network of RF receivers
KR20120031511A (en) Method for synchronizing a client clock frequency with a server clock frequency

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
CB02 Change of applicant information
CB02 Change of applicant information

Address after: 518000 606, block a, sharing building, No. 78, Keyuan North Road, songpingshan community, Xili street, Nanshan District, Shenzhen, Guangdong

Applicant after: Gosuncn IOT Technology Co.,Ltd.

Address before: 518000 606, block a, sharing building, No. 78, Keyuan North Road, songpingshan community, Xili street, Nanshan District, Shenzhen, Guangdong

Applicant before: Gaoxing Wulian Technology Co.,Ltd.

GR01 Patent grant
GR01 Patent grant