CN110278049B - Time synchronization method and system - Google Patents

Time synchronization method and system Download PDF

Info

Publication number
CN110278049B
CN110278049B CN201910608165.XA CN201910608165A CN110278049B CN 110278049 B CN110278049 B CN 110278049B CN 201910608165 A CN201910608165 A CN 201910608165A CN 110278049 B CN110278049 B CN 110278049B
Authority
CN
China
Prior art keywords
time
trip delay
fitted
original
delay data
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201910608165.XA
Other languages
Chinese (zh)
Other versions
CN110278049A (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.)
GUIZHOU METROLOGY AND TESTING INSTITUTE
Original Assignee
GUIZHOU METROLOGY AND TESTING 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 GUIZHOU METROLOGY AND TESTING INSTITUTE filed Critical GUIZHOU METROLOGY AND TESTING INSTITUTE
Priority to CN201910608165.XA priority Critical patent/CN110278049B/en
Publication of CN110278049A publication Critical patent/CN110278049A/en
Application granted granted Critical
Publication of CN110278049B publication Critical patent/CN110278049B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • HELECTRICITY
    • H04ELECTRIC COMMUNICATION TECHNIQUE
    • H04JMULTIPLEX COMMUNICATION
    • H04J3/00Time-division multiplex systems
    • H04J3/02Details
    • H04J3/06Synchronising arrangements
    • H04J3/0635Clock or time synchronisation in a network
    • H04J3/0638Clock or time synchronisation among nodes; Internode synchronisation
    • H04J3/0658Clock or time synchronisation among packet nodes
    • H04J3/0661Clock or time synchronisation among packet nodes using timestamps
    • H04J3/0667Bidirectional timestamps, e.g. NTP or PTP for compensation of clock drift and for compensation of propagation delays
    • 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/0682Clock or time synchronisation in a network by delay compensation, e.g. by compensation of propagation delay or variations thereof, by ranging

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 time synchronization method and a time synchronization system. The time synchronization method comprises the following steps: acquiring original communication round-trip delay data; the original communication round trip delay data comprises original round trip delay time and original time deviation, and the original round trip delay time corresponds to the original time deviation one by one; fitting the original communication round-trip delay data, and determining a fitting slope and fitted communication round-trip delay data; the fitted communication round trip delay data comprises a fitted round trip delay time and a fitted time deviation; and synchronizing the local time according to the fitted communication round trip delay data and the original communication round trip delay data. The time synchronization method and the time synchronization system provided by the invention can improve the network time service precision and the time synchronization precision.

Description

Time synchronization method and system
Technical Field
The present invention relates to the field of communications, and in particular, to a time synchronization method and system.
Background
The Network Time Protocol (NTP) is a Time synchronization Protocol widely applied in the internet at present, and is proposed in 1985 by d.l.mills of the university of dravada, usa for the earliest Time, and is designed and implemented to perform clock synchronization with a clock source through a local computer, so that the accuracy of local Time is improved, a uniform and standard Time can be maintained among different machines on the internet, and accurate and reliable Time information is distributed to systems operating in various and wide distributed Network environments.
Network time synchronization technology is constantly evolving. Early time synchronization techniques required the construction of a private network to provide services to each system, which was costly. NTP protocols are a communication protocol designed to maintain the same Time for different machines on the Internet, in addition to unifying the Time of each device in the network to a Time, which may be absolute Time (e.g., Universal Time Coordinated (UTC)) or relative Time (Time of a host in the network), and estimating the round-trip delay of packets on the network, and independently estimating the clock skew of the computer, thereby achieving high accuracy computer timing on the network.
In 3.1992 NTP/v3 came out, which summarizes and integrates the NTP previous version and DTSS, formally introduced the correction principles and improved the algorithms of clock selection and clock filtering, and also introduced the broadcast mode of time messaging, which replaces the previous version of NTP; an important function realized by the NTP is clock adjustment of a computer operating system; while NTP/v3 was studied and introduced, research on improving time keeping functions in the operating system core was also conducted in parallel; the 'RFC 1589' is introduced in 1994, namely a core mode for precise time keeping, and the implementation can keep the time precision of a computer operating system to be in the order of microseconds; at almost the same time, NTP/v4 improvement suggestions are also provided; specific directions are described for improvements in local clock adjustment algorithms, communication modes, new clock drivers, and adaptation rules.
NTP/v4 now under study and test will be applicable to IPV6, improve clock model, predict and adjust frequency and time more accurately in case of various synchronization sources and network paths, propose corresponding new algorithm will reduce the conflict of network jitter and oscillator drift, and will accelerate the time synchronization convergence speed at the start, redesign clock correction algorithm working in frequency lock loop and phase lock loop or both mixed mode; new features will also be provided regarding auto-configuration, reliability, reduction of internet traffic, and enhancement of network security authentication.
The final purpose of the NTP is to synchronize the time of each computer to UTC, the message of the NTP protocol is transmitted in a UDP mode in TCP/IP, and the port is 123.
Assuming that the location of the client is A place and the location of the NTP server is B place, the A place generates a standard NTP information inquiry packet and sends the packet to the B place through the network, and the sending time is T1Reception of message BReturning to A ground and B ground through network after packet receiving time T2Reply to packet time of T3,T2And T3The time is put in a time information packet, and the time of receiving the information packet of the B place at the A place is T4Fig. 1 is a schematic diagram of the NTP protocol provided in the present invention, as shown in fig. 1.
According to the NTP protocol principle, the round-trip delay R of the NTP message at A, B and the time deviation D of the a ground relative to the B ground can be calculated.
R=(T4-T1)-(T3-T2)=tab+tba (1)
Figure BSA0000185633960000021
Wherein, T1,T2,T3And T4Is a point in time, tabIs the delay from A to B, tbaFor the time delay from B to A, the local time is compensated according to the time deviation D obtained by the formula (2) of the A, so that the time synchronization with the B place is realized.
Data transmission in wide area network, in case of symmetric round-trip link, i.e. tab=tbaIf the time offset can be accurately calculated by the equation (2), but in practical application, the round-trip link in the wide area network environment is mostly dual-fiber bidirectional, and there is a case that the communication link is asymmetric, tab≠tbaTherefore, the time deviation calculated by the calculation method of the formula (2) is only an estimated value and is susceptible to tba-tabThe network time service precision is low and the time synchronization precision is low due to the influence of (2).
Disclosure of Invention
The invention aims to provide a time synchronization method and a time synchronization system, which are used for solving the problems of low network time service precision and low time synchronization precision caused by asymmetric communication links in a wide area network environment.
In order to achieve the purpose, the invention provides the following scheme:
a method of time synchronization, comprising:
acquiring original communication round-trip delay data; the original communication round trip delay data comprises original round trip delay time and original time deviation, and the original round trip delay time corresponds to the original time deviation one by one;
fitting the original communication round-trip delay data, and determining a fitting slope and fitted communication round-trip delay data; the fitted communication round trip delay data comprises a fitted round trip delay time and a fitted time deviation;
and synchronizing the local time according to the fitted communication round trip delay data and the original communication round trip delay data.
Optionally, the fitting the original communication round trip delay data to determine a fitting slope and fitted communication round trip delay data specifically includes:
and fitting the original communication round-trip delay data by using a least square method, and determining a fitting slope and the fitted communication round-trip delay data.
Optionally, the synchronizing the local time according to the fitted communication round trip delay data and the original communication round trip delay data specifically includes:
determining a midpoint value of the fitted communication round trip delay data according to the fitted communication round trip delay data;
judging whether the absolute value of the fitting slope is larger than a slope threshold value or not to obtain a first judgment result;
if the first judgment result shows that the absolute value of the fitting slope is larger than the slope threshold, acquiring the minimum original round-trip delay time in original communication round-trip delay data, determining the time deviation between the current standard time and the local time according to the original time deviation corresponding to the minimum original round-trip delay time, and synchronizing the local time;
and if the first judgment result shows that the absolute value of the fitting slope is not greater than the slope threshold, determining the time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, and synchronizing the local time.
Optionally, the determining, according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, a time deviation between a current standard time and a local time, and synchronizing the local time specifically includes:
acquiring a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data;
calculating a midpoint value of the fitted time deviation and each original time deviation to determine a time deviation difference value;
determining a minimum time deviation difference value according to the time deviation difference value;
and taking the original time deviation corresponding to the minimum time deviation difference value as the time deviation between the current standard time and the local time, and synchronizing the local time.
A time synchronization system, comprising:
the original communication round-trip delay data acquisition module is used for acquiring original communication round-trip delay data; the original communication round trip delay data comprises original round trip delay time and original time deviation, and the original round trip delay time corresponds to the original time deviation one by one;
the fitting module is used for fitting the original communication round trip delay data and determining a fitting slope and the fitted communication round trip delay data; the fitted communication round trip delay data comprises a fitted round trip delay time and a fitted time deviation;
and the synchronization module is used for synchronizing the local time according to the fitted communication round-trip delay data and the original communication round-trip delay data.
Optionally, the fitting module specifically includes:
and the fitting unit is used for fitting the original communication round trip delay data by using a least square method and determining a fitting slope and the fitted communication round trip delay data.
Optionally, the synchronization module specifically includes:
a midpoint value determining unit, configured to determine a midpoint value of the fitted communication round-trip delay data according to the fitted communication round-trip delay data;
the first judgment unit is used for judging whether the absolute value of the fitting slope is larger than a slope threshold value or not to obtain a first judgment result;
a first synchronization unit, configured to, if the first determination result indicates that the absolute value of the fitting slope is greater than a slope threshold, obtain a minimum original round-trip delay time in original communication round-trip delay data, determine a time deviation between a current standard time and a local time according to an original time deviation corresponding to the minimum original round-trip delay time, and synchronize the local time;
and the second synchronization unit is used for determining the time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data and synchronizing the local time if the first judgment result shows that the absolute value of the fitted slope is not greater than the slope threshold.
Optionally, the second synchronization unit specifically includes:
a midpoint value obtaining subunit of the time deviation, configured to obtain a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data;
a time deviation difference determining subunit, configured to calculate a midpoint value of the fitted time deviation and each of the original time deviations to determine a time deviation difference;
a minimum time deviation difference determining subunit, configured to determine a minimum time deviation difference according to the time deviation difference;
and the synchronization subunit is used for taking the original time deviation corresponding to the minimum time deviation difference as the time deviation between the current standard time and the local time, and synchronizing the local time.
According to the specific embodiment provided by the invention, the invention discloses the following technical effects: the invention provides a time synchronization method and a time synchronization system, which are used for obtaining fitted communication round-trip delay data by fitting the communication round-trip delay data, so that local time is synchronized according to the fitted communication round-trip delay data and the original communication round-trip delay data, the influence of delay is reduced, the local time can be accurately synchronized, and the network time service precision and the time synchronization precision are improved.
Drawings
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings needed to be used in the embodiments will be briefly described below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings without inventive exercise.
Figure 1 is a schematic diagram of the NTP protocol provided by the present invention;
FIG. 2 is a flow chart of a time synchronization method provided by the present invention;
FIG. 3 is a flow chart of an improved filtering algorithm provided by the present invention;
FIG. 4 is a block diagram of a time synchronization system provided by the present invention;
FIG. 5 is a graph of time offset versus round trip delay provided by the present invention;
FIG. 6 is a graph of a time offset estimator graph according to the present invention;
FIG. 7 is a comparison graph of the time synchronization result of the time synchronization method of the present invention and the time synchronization result of the conventional filtering method;
fig. 8 is a block diagram of the overall design of a physical hardware system provided by the present invention.
Detailed Description
The technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The invention aims to provide a time synchronization method and a time synchronization system, which can improve network time service precision and time synchronization precision.
In order to make the aforementioned objects, features and advantages of the present invention comprehensible, embodiments accompanied with figures are described in further detail below.
Fig. 2 is a flowchart of a time synchronization method provided by the present invention, and as shown in fig. 2, a time synchronization method includes:
step 201: acquiring original communication round-trip delay data; the raw communication round trip delay data includes raw round trip delay times and raw time offsets, and the raw round trip delay times correspond to the raw time offsets one to one.
Step 202: fitting the original communication round-trip delay data, and determining a fitting slope and fitted communication round-trip delay data; the fitted communication round trip delay data includes a fitted round trip delay time and a fitted time offset.
The step 202 specifically includes: and fitting the original communication round-trip delay data by using a least square method, and determining a fitting slope and the fitted communication round-trip delay data.
Step 203: and synchronizing the local time according to the fitted communication round trip delay data and the original communication round trip delay data.
The step 203 specifically includes: determining a midpoint value of the fitted communication round trip delay data according to the fitted communication round trip delay data; judging whether the absolute value of the fitting slope is larger than a slope threshold value or not, if so, acquiring the minimum original round-trip delay time in original communication round-trip delay data, determining the time deviation between the current standard time and the local time according to the original time deviation corresponding to the minimum original round-trip delay time, and synchronizing the local time; if not, determining the time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, and synchronizing the local time.
Determining a time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, and synchronizing the local time, specifically comprising: acquiring a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data; calculating a midpoint value of the fitted time deviation and each original time deviation to determine a time deviation difference value; determining a minimum time deviation difference value according to the time deviation difference value; and taking the original time deviation corresponding to the minimum time deviation difference value as the time deviation between the current standard time and the local time, and synchronizing the local time.
To improve the problem of the current filtering algorithm, fig. 3 is a flow chart of the improved filtering algorithm provided by the present invention, as shown in fig. 3, the steps are as follows:
obtained from 8 synchronizationsi,Di) 1, 2.... 8; wherein R isiTo round-trip delay time, DiIs a time offset;
fitting by using a least square method to obtain a fitting slope K;
setting a slope threshold value alpha, and comparing K with alpha;
when the absolute value of K is less than or equal to alpha, taking the fitted midpoint value (R)m,Dm) D ismAre each independently of Di(i ═ i |1 ≦ i ≦ 8, i ∈ N }) to obtain DminIs DiAnd DmLeast different Di;RmTo the midpoint of the fitted round-trip delay time, DmThe midpoint value of the fitted time deviation;
when K > alpha, take the minimum round-trip delay RminCorresponding time deviation DiAs a minimum time deviation Dmin
Will DminAs deviation data for the final synchronized local time.
Fig. 4 is a structural diagram of a time synchronization system provided by the present invention, and as shown in fig. 4, a time synchronization system includes:
an original communication round-trip delay data acquisition module 401, configured to acquire original communication round-trip delay data; the raw communication round trip delay data includes raw round trip delay times and raw time offsets, and the raw round trip delay times correspond to the raw time offsets one to one.
A fitting module 402, configured to fit the original communication round-trip delay data, and determine a fitting slope and fitted communication round-trip delay data; the fitted communication round trip delay data includes a fitted round trip delay time and a fitted time offset.
The fitting module 402 specifically includes: and the fitting unit is used for fitting the original communication round trip delay data by using a least square method and determining a fitting slope and the fitted communication round trip delay data.
A synchronization module 403, configured to synchronize a local time according to the fitted communication round trip delay data and the original communication round trip delay data.
The synchronization module 403 specifically includes: a midpoint value determining unit, configured to determine a midpoint value of the fitted communication round-trip delay data according to the fitted communication round-trip delay data; the first judgment unit is used for judging whether the absolute value of the fitting slope is larger than a slope threshold value or not to obtain a first judgment result; a first synchronization unit, configured to, if the first determination result indicates that the absolute value of the fitting slope is greater than a slope threshold, obtain a minimum original round-trip delay time in original communication round-trip delay data, determine a time deviation between a current standard time and a local time according to an original time deviation corresponding to the minimum original round-trip delay time, and synchronize the local time; and the second synchronization unit is used for determining the time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data and synchronizing the local time if the first judgment result shows that the absolute value of the fitted slope is not greater than the slope threshold.
The second synchronization unit specifically includes: a midpoint value obtaining subunit of the time deviation, configured to obtain a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data; a time deviation difference determining subunit, configured to calculate a midpoint value of the fitted time deviation and each of the original time deviations to determine a time deviation difference; a minimum time deviation difference determining subunit, configured to determine a minimum time deviation difference according to the time deviation difference; and the synchronization subunit is used for taking the original time deviation corresponding to the minimum time deviation difference as the time deviation between the current standard time and the local time, and synchronizing the local time.
Round-trip delay and time deviation data of one week are acquired through the NTP protocol principle, the sampling interval is 1s, a scatter diagram is generated as shown in figure 5, only data are acquired, and local time is not synchronized.
As can be seen from FIG. 5, the time offset after multiple samples is at the minimum round trip delay RminAt 10.66ms, the time offset corresponding to the point with the smallest round trip delay can be used as the best time offset estimate.
However, in practical application, the synchronization result is susceptible to being acquired only 8 times, and the continuous 8 points in fig. 5 are taken and a scatter diagram is drawn as shown in fig. 6.
According to the experiment of fig. 5, the time deviation should approach 10.66ms, the time deviation of point a in fig. 6 is not the best estimation value 12.06ms, even if the round trip delay of the point is the minimum, 8 points are fitted by the least square method, the slope K is 0.21, let α be 0.25, K ≦ α satisfy the condition, the time deviation of point C is found to be 10.96ms, and the time deviation of point B is 10.81ms as the best estimation value after comparing with other points, the time deviation of point B is used instead of point a at the time of final synchronization.
The time synchronization results of the minimum delay method and the improved filtering algorithm are shown in fig. 7, and the average value of the time deviation after filtering by the minimum delay method is 19.32 ms; the mean time offset using the modified filtering algorithm was 16.70 ms.
The average value of the time deviation after filtering by adopting a minimum delay method is 19.32 ms; the average value of the time deviation of the improved filtering algorithm is 16.70ms, the time synchronization result obtained by the improved NTP filtering algorithm is better than the time synchronization result obtained by the improved NTP filtering algorithm by 2.62ms, the network time service precision can be improved under the wide area network environment, and the influence of the communication link asymmetry on the time synchronization result is reduced.
The time synchronization method and the time synchronization system provided by the invention mainly aim at the following problems:
1) the internal clock of the parking lot timing charging system has poor stability, real-time synchronization and real-time source tracing to UTC (NIM) are not performed, synchronization cannot be performed under the condition of no Internet environment or disconnection of wired connection, and potential safety hazards exist if the GPS time cannot be directly acquired for source tracing; the time of adopting the computer also has the problems of drift and time accumulation.
2) The parking lot is not monitored in real time, the problem that parking lot operators modify timing data cannot be solved, a large amount of data with commercial value generated by the parking lot operators are idle, and powerful support of data mining and big data analysis cannot be provided for government departments and related enterprises and public institutions. The time information and other timing and charging information need to be uploaded to a cloud big data platform.
3) At present, aiming at the problem that a data packet round-trip link is asymmetric, a filtering algorithm of a minimum delay method is adopted to approximately estimate time deviation of two places, the algorithm firstly carries out 8 times of NTP protocol interaction processes (asynchronous local time), data (Ri, Di) of 8 groups of round-trip delay R and time deviation D are obtained, i is { i |1 is not less than i and not more than 8, i belongs to N }, then a group of data (Rmin, Di) with the minimum round-trip delay in 8 groups of data is taken, and the corresponding time deviation is taken as the data of the final synchronous local time; the more data obtained by the algorithm theoretically, the more ideal the final time deviation estimation value is, but in practical application, the time deviation obtained by filtering 8 groups of data is not completely the theoretically optimal value, and meanwhile, the stability and the drift of a local clock are considered, so that more data cannot be acquired, filtered and synchronized.
The time synchronization method and the system provided by the invention can be used for an entity hardware system, the entity hardware system adopts STM32F103ZET6 as a Micro Control Unit (MCU), a micro C/OS real-time operating system and a lightweight Internet Protocol (LWIP) are transplanted, local time is synchronized to a regional time standard (traced to an atomic time scale national measurement reference UTC (NIM)) through an NTP Protocol, and a 4G wireless mobile communication mode is adopted for data interaction; after the system and the standard time are synchronized, time information can be transmitted to the terminal time service software through RS232, RS485 and RJ-45 interfaces, the time of the parking lot time charging system is changed through the terminal time service software, meanwhile, the time information and the deviation of the parking lot time charging system are transmitted back to the system, the system displays the information on an LCD screen and uploads the information to a supervision platform, and the overall design block diagram of the system is shown in FIG. 8.
The micro control unit adopts an STM32F103ZET6 single chip microcomputer with a 32-bit ARM Cortex-M3 inner core, is externally connected with an 8MHz crystal oscillator, and can reach 72MHz working frequency after frequency doubling; on-chip 512kB flash memory; the working voltage is 2.0V-3.6V; the Real-Time Clock (RTC) function is supported internally, and the counting function in power failure is realized by matching with the power supply of an external button battery and the 32.768kHz crystal oscillator. The method has the characteristics of high running speed, portability of an operating system, low cost, RTC function and the like.
The 4G wireless communication module adopts the 4G wireless communication module to communicate with the NTP server and the supervision platform, and is characterized by high transmission rate and low time delay, time synchronization can be carried out on the parking lot under the condition of no internet access, measurement and synchronization procedures are simplified, and the switching of a measurement site is more convenient and faster. The module supplies power with 5V, and is interconnected with the serial port of STM32F103ZET6 through an RS232 interface, so that transparent transmission of sending and receiving data is realized.
The power module and the system adopt a lithium battery mobile power supply or an external wired power supply to provide 5V voltage for the system, one path of the power module provides 5V power for the 4G wireless communication module, and the other path of the power module outputs 3.3V through the AMS-1117 voltage stabilizing chip and provides the 3.3V power for the MCU, the display screen and other interface chips. Through TP4056 chip and charging protection circuit, realize the safe charging to the lithium cell, make this system can not adopt characteristics such as commercial power supply, portable simultaneously, along with measuring and synchronous demand, conveniently carry out the place fast and switch.
The interface circuit comprises RS232, RS485 and RJ-45 interfaces and transmits the synchronized standard time to the parking lot timing charging system, wherein the RS232 interface adopts an SP3232 chip to realize the bidirectional conversion of TTL level and RS232 level (negative logic) of 3.3V; the RS485 interface adopts an SP3485 chip to realize the bidirectional conversion of TTL level and RS485 level (differential signals) of 3.3V; the RJ-45 interface adopts a DM9000 chip, and realizes the communication with the parking lot timing charging system Ethernet interface by matching with a micro control unit programming, the RJ-45 interface and a peripheral circuit, and the chip is equivalent to the realization of the functions of a physical layer and a medium access control layer in TCP/IP.
The display screen adopts 4.3 cun capacitive touch screen, realizes constantly refreshing of data such as electric quantity display, local time, the deviation of local time and standard time, the deviation of local time and parking area timing charging system time and current time synchronization interval, also carries out time synchronization interval setting simultaneously through the touch-sensitive screen, synchronous and uploaded IP setting and other function settings.
The time synchronization method and the time synchronization system optimize the time deviation estimated value obtained through filtering and improve the time synchronization precision.
The embodiments in the present description are described in a progressive manner, each embodiment focuses on differences from other embodiments, and the same and similar parts among the embodiments are referred to each other. For the system disclosed by the embodiment, the description is relatively simple because the system corresponds to the method disclosed by the embodiment, and the relevant points can be referred to the method part for description.
The principles and embodiments of the present invention have been described herein using specific examples, which are provided only to help understand the method and the core concept of the present invention; meanwhile, for a person skilled in the art, according to the idea of the present invention, the specific embodiments and the application range may be changed. In view of the above, the present disclosure should not be construed as limiting the invention.

Claims (6)

1. A method of time synchronization, comprising:
acquiring original communication round-trip delay data; the original communication round trip delay data comprises original round trip delay time and original time deviation, and the original round trip delay time corresponds to the original time deviation one by one;
fitting the original communication round-trip delay data, and determining a fitting slope and fitted communication round-trip delay data; the fitted communication round trip delay data comprises a fitted round trip delay time and a fitted time deviation;
synchronizing local time according to the fitted communication round trip delay data and the original communication round trip delay data; the synchronizing the local time according to the fitted communication round trip delay data and the original communication round trip delay data specifically includes: determining a midpoint value of the fitted communication round trip delay data according to the fitted communication round trip delay data; judging whether the absolute value of the fitting slope is larger than a slope threshold value or not to obtain a first judgment result; if the first judgment result shows that the absolute value of the fitting slope is larger than the slope threshold, acquiring the minimum original round-trip delay time in original communication round-trip delay data, determining the time deviation between the current standard time and the local time according to the original time deviation corresponding to the minimum original round-trip delay time, and synchronizing the local time; if the first judgment result shows that the absolute value of the fitting slope is not greater than the slope threshold, determining the time deviation between the current standard time and the local time according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, and synchronizing the local time; obtained from 8 synchronizationsi,Di) I is 1, 2, … …, 8; wherein R isiTo round-trip delay time, DiIs a time offset;
fitting by using a least square method to obtain a fitting slope K;
setting a slope threshold value alpha, and comparing K with alpha;
when the absolute value of K is less than or equal to alpha, taking the fitted midpoint value (R)m,Dm) D ismAre each independently of Di(i ═ i |1 ≦ i ≦ 8, i ∈ N }) to obtain DminIs DiAnd DmLeast different Di;RmTo the midpoint of the fitted round-trip delay time, DmTo fit toA midpoint value of the latter time offset;
when K > alpha, take the minimum round-trip delay RminCorresponding time deviation DiAs a minimum time deviation Dmin
Will DminAs deviation data for the final synchronized local time.
2. The method according to claim 1, wherein the fitting the raw communication round trip delay data to determine a fitting slope and fitted communication round trip delay data specifically comprises:
and fitting the original communication round-trip delay data by using a least square method, and determining a fitting slope and the fitted communication round-trip delay data.
3. The method according to claim 2, wherein the determining a time deviation between a current standard time and a local time according to the midpoint value of the fitted communication round trip delay data and the original communication round trip delay data, and synchronizing the local time specifically comprises:
acquiring a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data;
calculating a midpoint value of the fitted time deviation and each original time deviation to determine a time deviation difference value;
determining a minimum time deviation difference value according to the time deviation difference value;
and taking the original time deviation corresponding to the minimum time deviation difference value as the time deviation between the current standard time and the local time, and synchronizing the local time.
4. A time synchronization system, comprising:
the original communication round-trip delay data acquisition module is used for acquiring original communication round-trip delay data; the original communication round trip delay data comprises original round trip delay time and original time deviation, and the original round trip delay time corresponds to the original time deviation one by one;
the fitting module is used for fitting the original communication round trip delay data and determining a fitting slope and the fitted communication round trip delay data; the fitted communication round trip delay data comprises a fitted round trip delay time and a fitted time deviation;
a synchronization module, configured to synchronize a local time according to the fitted communication round-trip delay data and the original communication round-trip delay data; the synchronization module specifically includes: a midpoint value determining unit, configured to determine a midpoint value of the fitted communication round-trip delay data according to the fitted communication round-trip delay data; the first judgment unit is used for judging whether the absolute value of the fitting slope is larger than a slope threshold value or not to obtain a first judgment result; a first synchronization unit, configured to, if the first determination result indicates that the absolute value of the fitting slope is greater than a slope threshold, obtain a minimum original round-trip delay time in original communication round-trip delay data, determine a time deviation between a current standard time and a local time according to an original time deviation corresponding to the minimum original round-trip delay time, and synchronize the local time; a second synchronization unit, configured to determine, according to the midpoint value of the fitted communication round-trip delay data and the original communication round-trip delay data, a time deviation between a current standard time and a local time, and synchronize the local time, if the first determination result indicates that the absolute value of the fitted slope is not greater than a slope threshold; obtained from 8 synchronizationsi,Di) I is 1, 2, … …, 8; wherein R isiTo round-trip delay time, DiIs a time offset;
fitting by using a least square method to obtain a fitting slope K;
setting a slope threshold value alpha, and comparing K with alpha;
when the absolute value of K is less than or equal to alpha, taking the fitted midpoint value (R)m,Dm) D ismAre each independently of Di(i ═ i |1 ≦ i ≦ 8, i ∈ N }) to obtain DminIs DiAnd DmLeast different Di;RmFor fitted round trip delay timeMedian value, DmThe midpoint value of the fitted time deviation;
when K > alpha, take the minimum round-trip delay RminCorresponding time deviation DiAs a minimum time deviation Dmin
Will DminAs deviation data for the final synchronized local time.
5. The time synchronization system of claim 4, wherein the fitting module specifically comprises:
and the fitting unit is used for fitting the original communication round trip delay data by using a least square method and determining a fitting slope and the fitted communication round trip delay data.
6. The time synchronization system according to claim 5, wherein the second synchronization unit specifically comprises:
a midpoint value obtaining subunit of the time deviation, configured to obtain a midpoint value of the fitted time deviation from the midpoint values of the fitted communication round-trip delay data;
a time deviation difference determining subunit, configured to calculate a midpoint value of the fitted time deviation and each of the original time deviations to determine a time deviation difference;
a minimum time deviation difference determining subunit, configured to determine a minimum time deviation difference according to the time deviation difference;
and the synchronization subunit is used for taking the original time deviation corresponding to the minimum time deviation difference as the time deviation between the current standard time and the local time, and synchronizing the local time.
CN201910608165.XA 2019-07-08 2019-07-08 Time synchronization method and system Active CN110278049B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910608165.XA CN110278049B (en) 2019-07-08 2019-07-08 Time synchronization method and system

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910608165.XA CN110278049B (en) 2019-07-08 2019-07-08 Time synchronization method and system

Publications (2)

Publication Number Publication Date
CN110278049A CN110278049A (en) 2019-09-24
CN110278049B true CN110278049B (en) 2021-03-30

Family

ID=67962997

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910608165.XA Active CN110278049B (en) 2019-07-08 2019-07-08 Time synchronization method and system

Country Status (1)

Country Link
CN (1) CN110278049B (en)

Families Citing this family (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111698049B (en) * 2020-05-19 2023-05-02 东南大学 High-precision clock synchronization method considering round trip delay asymmetry
CN111817793B (en) * 2020-08-27 2020-12-04 北京中创为南京量子通信技术有限公司 Detector delay value acquisition method, bit synchronization method and device
CN114221731B (en) * 2021-12-09 2024-04-16 北京罗克维尔斯科技有限公司 Time synchronization precision determining method and system and electronic equipment

Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1839573A (en) * 2003-08-22 2006-09-27 艾利森电话股份有限公司 Remote synchronization in packet-switched networks
CN103516508A (en) * 2013-09-17 2014-01-15 中国科学院计算技术研究所 Method and system for correcting clock drift in one-way and two-way delay variation measurement
CN105959079A (en) * 2016-07-14 2016-09-21 深圳市旗众智能自动化有限公司 Clock synchronization method based on distributed control system
CN106992829A (en) * 2017-03-10 2017-07-28 国网上海市电力公司 A kind of formula method for synchronizing time that floods based on SFD catch mechanisms

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN104184571B (en) * 2013-05-20 2019-04-23 中兴通讯股份有限公司 From the time correcting method and device of clockwork
CN103309229A (en) * 2013-07-10 2013-09-18 中国人民解放军国防科学技术大学 Satellite-to-ground dynamic bidirectional time synchronization and ranging combined algorithm based on fitting method

Patent Citations (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN1839573A (en) * 2003-08-22 2006-09-27 艾利森电话股份有限公司 Remote synchronization in packet-switched networks
CN103516508A (en) * 2013-09-17 2014-01-15 中国科学院计算技术研究所 Method and system for correcting clock drift in one-way and two-way delay variation measurement
CN105959079A (en) * 2016-07-14 2016-09-21 深圳市旗众智能自动化有限公司 Clock synchronization method based on distributed control system
CN106992829A (en) * 2017-03-10 2017-07-28 国网上海市电力公司 A kind of formula method for synchronizing time that floods based on SFD catch mechanisms

Also Published As

Publication number Publication date
CN110278049A (en) 2019-09-24

Similar Documents

Publication Publication Date Title
CN110278049B (en) Time synchronization method and system
CN104836630B (en) IEEE1588 clock synchronization system and implementation method therefor
CN102104475B (en) IEEE 1588-based synchronization system and synchronization method thereof
US7916758B2 (en) Method and system for precise-clock synchronization, and device for precise-clock frequency/time synchronization
CN101977104A (en) IEEE1588 based accurate clock synchronization protocol system and synchronization method thereof
CN105680975A (en) Time synchronization method of master-slave structure multi-node network
Kim et al. Energy-efficient time synchronization based on asynchronous source clock frequency recovery and reverse two-way message exchanges in wireless sensor networks
CN106603183B (en) A kind of timestamp filter method and device
WO2022083070A1 (en) Data transmission method of 5g differential protection apparatus
WO2018082665A1 (en) Frequency synchronization method and slave clock
CN112616181B (en) Current differential protection data synchronization method and system adaptive to 5G communication
CN103763055A (en) Method for precise time synchronization
CN108768577B (en) Communication network time service method and system based on PTP time synchronization signal
Chen et al. An implementation of IEEE 1588 protocol for IEEE 802.11 WLAN
CN102480350A (en) Method and device for time synchronization and maintaining based on frequency deviation estimation
JP2017521941A (en) Clock time stamp compensation method and apparatus
CN114095109A (en) Clock synchronization method, device, equipment and storage medium
CN110113124A (en) Clock synchronizing method and device for optical fiber vibration sensing system
Jie et al. Research on network timing system based on NTP
CN115576295A (en) Domain controller time service system, domain controller and engineering machinery
CN103596261B (en) A kind of clock synchronizing method of vehicle detecting system
CN104869587B (en) Time Synchronization for Wireless Sensor Networks error assay method
Huan et al. A Microsecond Energy-Efficient LoRa Time Synchronization Based on Low-Layer Timestamping and Asymmetric Time Translation
CN115102657B (en) Clock frequency synchronization method and device of metering device and storage medium
CN205283557U (en) PTP time synchronizer based on synchronous ethernet

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