A Kalman filtering-based time synchronization method, device, medium and product applied to a distributed system

By constructing a dual-state model and adaptively adjusting the noise covariance, the problem of timestamp inconsistency caused by node clock deviation in distributed systems is solved, achieving high-precision and robust time synchronization that can adapt to noise changes in complex environments.

CN120803209BActive Publication Date: 2025-11-21JIMEI UNIV
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202511307673.6
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2025-09-15
Publication Date
2025-11-21
Estimated Expiration
2045-09-15

AI Technical Summary

Technical Problem

In distributed systems, clock deviations between nodes lead to inconsistent timestamps and data alignment errors. Existing Kalman filtering techniques are not ideal in non-stationary noise environments and are prone to divergence, failing to effectively distinguish the noise characteristics of clock skew and clock drift, thus affecting system performance and accuracy.

Method used

By constructing a dual-state model, introducing a dynamic suppression factor to adaptively adjust the observation noise covariance, employing a block-adaptive strategy to distinguish the process noise covariance of clock offset and clock drift, and using an improved Kalman filter algorithm for system state estimation, high-precision time synchronization is achieved.

Benefits of technology

It improves the accuracy and robustness of time synchronization, adapts to noise changes in complex environments, and ensures the stability and accuracy of system state estimation.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN120803209B_ABST
    Figure CN120803209B_ABST
Patent Text Reader

Abstract

Embodiments of the present application disclose a Kalman filter-based time synchronization method and device applied to a distributed system, a medium and a product. In the method, a double-state model containing clock offset and clock drift is established to improve the precision and speed of time synchronization; a dynamic inhibition factor is introduced to adaptively adjust the observation noise covariance to cope with abnormal noise; a block adaptive strategy is adopted to distinguish and independently adjust the process noise covariance of the clock offset and the clock drift to match their different noise characteristics; and finally, high-precision and high-robustness time synchronization is achieved through Kalman filtering.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of time synchronization, and in particular to a Kalman filtering-based time synchronization method, device, medium and product applied to a distributed system. BACKGROUND

[0002] In many distributed systems, such as multi-agent navigation, distributed sensor networks and the like, the clocks of the nodes in the distributed system must be highly consistent. However, due to hardware differences, temperature changes and environmental factors, there is a certain degree of deviation between the clocks of different nodes, which can cause problems such as inconsistent timestamps, data alignment errors, and the like, thereby affecting the performance and accuracy of the system.

[0003] Kalman filtering, as a real-time state estimation algorithm, has been widely used in time synchronization. However, the traditional Kalman filtering relies on a fixed noise covariance matrix, which is difficult to adapt to non-stationary noise environments; although the existing adaptive Kalman filtering can update the noise covariance matrix online, it has problems such as poor numerical stability and easy divergence, and does not distinguish the noise characteristics of clock offset and clock drift, which limits the synchronization accuracy.

[0004] Therefore, how to realize high-precision and robust time synchronization in a complex environment is a problem to be solved by those skilled in the art. SUMMARY

[0005] The embodiments of the present application provide a Kalman filtering-based time synchronization method, device, medium and product applied to a distributed system, which can realize high-precision and robust time synchronization in a complex environment.

[0006] The first aspect of the present application provides a Kalman filtering-based time synchronization method applied to a distributed system, comprising:

[0007] Obtaining a plurality of timestamp data by performing bidirectional message exchange between a first clock and a second clock;

[0008] Calculating an observation value based on the plurality of timestamp data;

[0009] Constructing a double-state model according to the physical characteristics of the clock error, the state vector of the double-state model including clock offset and clock drift, and the state vector being defined as:

[0010]

[0011] wherein, denotes the clock offset at the t-th moment; denotes the clock drift at the t-th moment; denotes the clock drift at the t-th moment; denotes the clock drift at the t-th moment; denotes the real number set;

[0012] The adjusted observation noise covariance is obtained by adaptively adjusting the observation noise covariance using a dynamic suppression factor. The formula for the dynamic suppression factor is:

[0013]

[0014] in, For the first System status at all times The predicted value; For the first The measured value at time; For the first The value of information at any given moment; This is the sensitivity adjustment coefficient for the algorithm; It is the Euclidean norm; The negative feedback quantity is proportional to the current observation deviation and is used to dynamically adjust the filter parameters;

[0015] Dynamic inhibitory factor The correction formula for the observation noise covariance is:

[0016]

[0017] Among them, symbols Indicates will The calculation result is assigned to ;

[0018] Based on the noise characteristics of clock skew and clock drift, a pre-defined block-based adaptive strategy is proposed to adjust the process noise covariance, resulting in an adjusted process noise covariance. This adjusted process noise covariance includes the process noise covariance due to clock skew and the process noise covariance due to clock drift, as shown in the following formula:

[0019]

[0020] in, Indicates the first The process noise covariance of the time clock offset; Indicates from Time's up The sample variance of the clock offset residuals within a given time period; This is an adaptive adjustment factor for the clock offset covariance value; Indicates the first The noise covariance during time-lapse clock drift; This is the adaptive adjustment coefficient for the clock drift covariance value; Indicates from the first Time to the The change in the estimated clock offset over a given time interval;

[0021] Based on the adjusted observation noise covariance and the adjusted process noise covariance, the system state is estimated using a preset Kalman filter algorithm to obtain clock offset estimates and clock drift estimates, thereby achieving time synchronization between the first clock and the second clock.

[0022] Optionally, a two-state model is constructed based on the physical characteristics of the clock error, including:

[0023] Based on the physical characteristics of clock errors, a two-state model is constructed, and the state vector is defined as follows:

[0024]

[0025] in, Indicates the first Clock offset at a given moment; Indicates the first The clock drifts at a given moment; It represents the set of real numbers.

[0026] Optionally, the modeling of the two-state model includes modeling the discrete state equations of the time deviation estimation system and modeling the observation equations of the time deviation estimation system;

[0027] The discrete state equation model of the time deviation estimation system is as follows:

[0028]

[0029] in, The sampling time interval; For from the first Time to the Process noise during the system state change process over a given time interval; This is the state transition matrix;

[0030] The observation equations of the time deviation estimation system are modeled as follows:

[0031]

[0032] in, This indicates the time when the first clock sends a data packet to the second clock. This indicates the time when the first clock receives the data packet from the second clock. For the first Measurement noise at time, This represents the observation matrix.

[0033] Optionally, the process noise follows a Gaussian distribution, mathematically represented as:

[0034]

[0035] wherein, denotes the standard deviation of the clock bias noise in continuous time; denotes the standard deviation of the clock drift noise in continuous time; is the sampling time interval; is the process noise in the time interval from time to time is the clock bias noise in the time interval from time to time is the clock drift noise in the time interval from time to time denotes the standard deviation of the clock bias noise in continuous time; denotes the standard deviation of the clock drift noise in continuous time; is the clock drift noise in the time interval from time denotes that the mean of the noise vector is a zero vector of 2 rows and 1 column; denotes a Gaussian distribution; denotes the covariance matrix of the process noise;

[0036] The measurement noise is subject to a Gaussian distribution, which is mathematically expressed as:

[0037]

[0038] wherein, denotes the measurement noise at time denotes the measurement noise covariance, denotes the measurement noise standard deviation at time

[0039] Optionally, the observation noise covariance is adaptively adjusted by a dynamic damping factor to obtain an adjusted observation noise covariance, including:

[0040] The formula of the dynamic damping factor is:

[0041]

[0042] wherein, is the predicted value of the system state at time ; is the measurement value at time ; is the innovation value at time ; is the sensitivity adjustment coefficient of the algorithm; is the Euclidean norm; is a negative feedback quantity proportional to the size of the deviation from the current observation, used to dynamically adjust the parameters of the filter; ​​

[0043] Dynamic inhibition factor The correction formula for the observation noise covariance is:

[0044]

[0045] wherein, the symbol represents that the calculation result of is assigned to .

[0046] Optionally, the process noise covariance is adjusted by using a preset block adaptive strategy, including:

[0047] According to the noise characteristics of the clock offset and the clock drift, a preset block adaptive strategy is proposed, and the formula for adjusting the process noise covariance is as follows:

[0048]

[0049] wherein, represents the process noise covariance of the clock offset at the k th moment; represents the sample variance value of the clock offset residual value from the k th moment to the k+1 th moment; is an adaptive adjustment coefficient of the clock offset covariance value; represents the process noise covariance of the clock drift at the k th moment; is an adaptive adjustment coefficient of the clock drift covariance value; represents the change amount of the clock offset estimation value in the time interval from the k th moment to the k+1 th moment. The second aspect of the present application provides a Kalman filtering-based time synchronization product applied to a distributed system, including: The communication module is configured to obtain a plurality of timestamp data by performing bidirectional message exchange between the first clock and the second clock. The calculation module is configured to calculate an observation value based on the plurality of timestamp data.

[0050] The construction module is configured to construct a double-state model according to the physical characteristics of the clock error, and the state vector of the double-state model includes the clock offset and the clock drift.

[0051] The communication module is configured to obtain a plurality of timestamp data by performing bidirectional message exchange between the first clock and the second clock.

[0052] The calculation module is configured to calculate an observation value based on the plurality of timestamp data.

[0053] The construction module is configured to construct a double-state model according to the physical characteristics of the clock error, and the state vector of the double-state model includes the clock offset and the clock drift.

[0054] ​​​The adjustment module is used to adaptively adjust the observation noise covariance through a dynamic suppression factor to obtain the adjusted observation noise covariance; the process noise covariance is adjusted using a preset block adaptive strategy to obtain the adjusted process noise covariance, wherein the adjusted process noise covariance includes the process noise covariance of clock offset and the process noise covariance of clock drift.

[0055] The estimation module is used to estimate the system state based on the adjusted observation noise covariance and the adjusted process noise covariance using a preset Kalman filter algorithm, thereby obtaining clock offset estimates and clock drift estimates, and thus achieving time synchronization between the first clock and the second clock.

[0056] Optionally, building modules are specifically used for,

[0057] Based on the physical characteristics of clock errors, a two-state model is constructed, and the state vector is defined as follows:

[0058]

[0059] in , Indicates the first Clock offset at a given moment; Indicates the first The clock drifts at a given moment; It represents the set of real numbers.

[0060] A third aspect of this application provides a Kalman filter-based time synchronization device for distributed systems, comprising: a processor and a memory;

[0061] Memory, used to store instructions;

[0062] A processor for executing instructions in memory to perform any of the above-described time synchronization methods based on Kalman filtering for distributed systems.

[0063] A third aspect of this application provides a computer storage medium for storing a program, which, when executed, implements the Kalman filter-based time synchronization method for distributed systems as described in any of the preceding claims.

[0064] Establishing a dual-state model that includes clock skew and clock drift is beneficial for improving the accuracy and speed of time synchronization. A dynamic suppression factor is introduced to adaptively adjust the observation noise covariance to deal with abnormal noise. A block adaptive strategy is adopted to distinguish and independently adjust the process noise covariance of clock skew and clock drift to match their different noise characteristics. Finally, high-precision and high-robustness time synchronization is achieved through Kalman filtering. Attached Figure Description

[0065] In order to more clearly illustrate the technical solutions in the embodiments of the present application or the prior art, the accompanying drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the accompanying drawings in the following description only constitute some embodiments described in the present application, and for those skilled in the art, other drawings can also be obtained without creative labor on the basis of these drawings.

[0066] Figure 1 A flowchart of a Kalman filter-based time synchronization method applied to a distributed system provided by an embodiment of the present application;

[0067] Figure 2 A topological structure diagram of a clock offset estimation task provided by an embodiment of the present application;

[0068] Figure 3 A structure diagram of a one-time measurement data generation process provided by an embodiment of the present application;

[0069] Figure 4 A flowchart of a Kalman filter-based time synchronization algorithm applied to a distributed system provided by an embodiment of the present application;

[0070] Figure 5 A structure diagram of a Kalman filter-based time synchronization product applied to a distributed system provided by an embodiment of the present application;

[0071] Figure 6 A structure diagram of a Kalman filter-based time synchronization device applied to a distributed system provided by an embodiment of the present application. DETAILED DESCRIPTION

[0072] The embodiments of the present application provide a Kalman filter-based time synchronization method, device, medium and product applied to a distributed system, which can realize high-precision and strong-robustness time synchronization in a complex environment.

[0073] For the convenience of understanding, the application scenarios of the embodiments of the present application are first introduced.

[0074] In many distributed systems, such as multi-agent navigation, distributed sensor networks and other systems, the clocks of the nodes in the system must be highly consistent. Due to hardware differences, temperature changes and environmental factors, there is a certain degree of deviation between the clocks of different nodes, which will cause timestamp inconsistency, data alignment errors, and further affect the system performance and accuracy.

[0075] Kalman filtering is a real-time online system state estimation algorithm, which has been widely applied in time synchronization technology. The existing Kalman filter-based clock synchronization technology has the following deficiencies:

[0076] (1) Traditional Kalman filter relies on fixed noise covariance matrix, which cannot adapt to non-stationarity of noise caused by environmental temperature changes, electromagnetic interference, etc., and the filtering accuracy is often not ideal.

[0077] (2) Although the existing adaptive Kalman filter can update the noise covariance matrix online, it has poor numerical stability and is easy to diverge, such as the problem that the noise covariance may lose positive definiteness in Sage-Husa adaptive filter, leading to divergence. In addition, clock offset and clock drift have different noise characteristics, and the existing filtering methods do not distinguish between them, which limits the accuracy of time synchronization to some extent.

[0078] (3) The observation value is only related to the clock offset, not directly related to the clock drift, and the clock drift estimation completely depends on the state transition matrix and the process noise model. If the model is not accurate (such as errors in sampling time or deviations in noise statistics), the clock drift estimation is easy to diverge.

[0079] To solve the above problems, the application introduces dynamic damping factor, classifies and adjusts process noise, and modifies the observation model, etc. strategies, solves the core problems of environmental adaptability and noise modeling accuracy of the Kalman filter-based time synchronization method applied to distributed systems, and provides reliable technical support for high-precision time synchronization systems.

[0080] Referring to Figure 1 , the figure is a flowchart of a Kalman filter-based time synchronization method applied to a distributed system provided by an embodiment of the application. The Kalman filter-based time synchronization method applied to a distributed system provided by an embodiment of the application can be implemented, for example, by the following steps S101-S106.

[0081] S101: Obtain multiple timestamp data by performing bidirectional message exchange between a first clock and a second clock.

[0082] In the embodiment of the application, two computers to be time synchronized are connected through a predetermined communication mode. The two computers correspond to a first clock as an initiator and a second clock as a responder, respectively, and multiple timestamp data are obtained by performing bidirectional message exchange between the first clock and the second clock.

[0083] It should be noted that in the embodiment of the application, the communication mode between the computers is not limited in the embodiment of the application, and can include RS232 serial communication link, UWB communication link and LaRA communication link, etc.

[0084] S102: Calculate observation value based on multiple timestamp data.

[0085] In the embodiment of the application, the observation value The formula for calculating the timestamps from two-way communication is as follows:

[0086]

[0087] in, The local timestamp corresponding to the initiator's first clock. The local timestamp corresponding to the second clock of the responder.

[0088] S103: Construct a two-state model based on the physical characteristics of clock errors.

[0089] In this embodiment, a two-state model is constructed based on the physical characteristics of clock errors, and the state vector is defined as follows:

[0090]

[0091] in, Indicates the first Clock offset at a given moment; This indicates the clock drift at time i; It represents the set of real numbers.

[0092] Specifically, the modeling of the two-state model includes the modeling of the discrete state equations of the time deviation estimation system and the modeling of the observation equations of the time deviation estimation system.

[0093] The discrete state equation model of the time deviation estimation system is as follows:

[0094]

[0095] in, The sampling time interval; For from the first Time to the Process noise during the system state change process over a given time interval; Let be the state transition matrix; and assuming the process noise follows a Gaussian distribution, mathematically represented as:

[0096]

[0097] in, This represents the standard deviation of clock skew noise over continuous time. This represents the standard deviation of clock drift noise over continuous time. The sampling time interval; For from the first Time to the Process noise during the system state change process over a given time interval; For from the first Time to the Clock offset noise over the time interval; For from the first Time to the Clock drift noise over the specified time interval; The mean of the noise vector is represented by a 2x1 zero vector; Indicates a Gaussian distribution; The covariance matrix represents the process noise;

[0098] and The specific value can be determined by looking up the technical parameter table of the clock source or by conducting multiple tests; this application does not impose any specific restrictions.

[0099] The observation equations of the time deviation estimation system are modeled as follows:

[0100]

[0101] in, This indicates the time when the first clock sends a data packet to the second clock. This indicates the time when the first clock receives the data packet from the second clock. For the first Measurement noise at time, Let represent the observation matrix. And assuming the measurement noise follows a Gaussian distribution, mathematically represented as:

[0102]

[0103] in, Indicates the first Measurement noise at time, This represents the measurement noise covariance. Indicates the first The standard deviation of the measurement noise at any given time.

[0104] S104: Adaptively adjusts the observation noise covariance through a dynamic suppression factor.

[0105] In this embodiment of the application, to address the problem of excessive observation noise, a dynamic suppression factor is introduced based on the Sage-Husa adaptive Kalman filter algorithm to improve the dynamic adaptability of the time bias estimation method to environmental factors.

[0106] Specifically, the formula for the dynamic inhibitory factor is:

[0107]

[0108] in, For the first System status at all times The predicted value; For the first measurement value of the time instant; is the first innovation value (also called observation residual value) of the time instant; is the sensitivity adjustment coefficient of the algorithm, and a typical value is 0.01; is the Euclidean norm; is a negative feedback quantity proportional to the size of the current observation deviation, and is used for dynamically adjusting the parameters of the filter;

[0109] dynamic suppression factor The correction formula for the observation noise covariance is:

[0110]

[0111] wherein, the symbol represents that the calculation result of is assigned to .

[0112] dynamic suppression factor The mechanism of the dynamic suppression factor is that when the abnormal noise causes the observation residual value to increase, the process noise covariance is increased to reduce the Kalman gain, so as to weaken the influence of the abnormal observation value on the system state, and avoid the divergence phenomenon of the estimation algorithm.

[0113] S105: The process noise covariance is adjusted by using a preset block adaptive strategy.

[0114] In the embodiments of the present application, a block adaptive strategy is proposed according to different noise characteristics of the clock offset and drift.

[0115] The formula for adjusting the process noise covariance is as follows:

[0116]

[0117] wherein, represents the process noise covariance of the clock offset at the time instant ; and represents the sample variance value of the clock offset residual value from the time instant to the time instant ; and is an adaptive adjustment coefficient of the clock offset covariance value. represents the process noise covariance of the clock drift at the time instant ; and is an adaptive adjustment coefficient of the clock drift covariance value. represents the change amount of the clock offset estimation value in the time interval from the time instant to the time instant .

[0118] It should be noted that in the embodiments of the present application, A typical value can be 0.8. The typical value can be 1.0, and the values ​​of both can be determined according to actual needs.

[0119] S106: Based on the adjusted observation noise covariance and the adjusted process noise covariance, the system state is estimated using a preset Kalman filter algorithm.

[0120] In this embodiment, after adaptively correcting the process noise covariance and measurement noise covariance, the Kalman filter algorithm is used to estimate the system state, thereby obtaining the clock offset estimate and clock drift estimate, thus achieving time synchronization between the first clock and the second clock.

[0121] Specifically, the formula for Kalman filter prediction of observations is as follows:

[0122] System state prediction formula:

[0123] Formula for calculating prior covariance:

[0124] in, Indicates the first The prior estimate of the system state at time t. Indicates the first The posterior estimate of the system state at time t. For process noise covariance, Here is the state transition matrix. This is the transpose operator for matrices.

[0125] The Kalman filter observation update process is as follows:

[0126] Formula for calculating measurement residuals:

[0127] Formula for calculating measurement residual covariance:

[0128] Kalman gain calculation formula:

[0129] System status update calculation formula:

[0130] Formula for calculating posterior covariance:

[0131] in, For the first The information matrix of time, For the first The Kalman gain matrix at time t. and The first The posterior estimate of the system state and the covariance matrix at time t. It is a two-dimensional identity matrix.

[0132] This application proposes a Kalman filter-based time synchronization method for distributed systems to establish a two-state clock error model, where the state vector includes clock offset and clock drift. Discrete state equations and observation equations are constructed to clarify the statistical characteristics of process noise and observation noise. A dynamic suppression factor is introduced to adaptively adjust the observation noise covariance based on the innovation value, enhancing robustness to anomalous noise. A block-adaptive strategy is proposed to adjust the process noise covariance of clock offset and clock drift separately, improving model adaptability. An improved Sage-Husa adaptive Kalman filter algorithm is used to achieve real-time, high-precision estimation of the system state.

[0133] Now combined Figure 2 , Figure 3 and Figure 4 For example. Figure 2 A schematic diagram of the topology of the clock offset estimation task provided in the embodiments of this application; Figure 3 A schematic diagram of the structure of a single measurement data generation process provided in an embodiment of this application; Figure 4 A flowchart of a time synchronization algorithm based on Kalman filtering for distributed systems provided in this application embodiment;

[0134] like Figure 2 As shown, two computers A and B (corresponding to clocks A and B, respectively) to be synchronized in time are connected using a certain communication method. Common connection methods include RS232 serial communication link, UWB communication link and LaRA communication link. Assume that computer A is the initiator of time synchronization and computer B is the responder of time synchronization.

[0135] Step 1: In computer A, as follows Figure 3 As shown, in Computer A sends data packet 1 to computer B. Data packet 1 contains three timestamps, and the values ​​of the three timestamps are as follows: , and .

[0136] Step 2: In computer B, in At that moment, computer B received data packet 1 from computer A and copied the timestamp from data packet 1. It is read into the memory of computer B.

[0137] Step 3: In Time, like Figure 3As shown, computer B sends computer A a data packet 2, which includes three time stamps, the values of which are , and .

[0138] Step 4: In computer A, at time , computer A receives data packet 2 from computer B, and reads the time stamps , and in data packet 2 into the memory in computer A.

[0139] Step 5: Determine whether initialization is completed. If yes, go to step 6; if no, initialize and return to step 1.

[0140] In computer A, let the initialization time of the algorithm be (i.e., the 0th time), and let the initial estimated value of the algorithm state be:

[0141]

[0142] where , and are the posterior estimated values of the clock offset, clock drift and covariance at the 0th time.

[0143] Initialize the algorithm parameters:

[0144]

[0145] where is a sensitivity adjustment coefficient in the algorithm, is a time window size, is a clock offset process noise adaptive adjustment coefficient, is a clock drift process noise adaptive adjustment coefficient, , and are the clock offset process noise covariance, clock drift process noise covariance and observation noise covariance at the 0th time.

[0146] Step 6: Adaptively adjust the Kalman filter parameters.

[0147] Specifically, the step includes:

[0148] calculating the latest measurement value :

[0149]

[0150] ​According to the Kalman filter prediction equation, the predicted value of the system state is calculated:

[0151]

[0152] wherein, is the time difference between the two times when computer A receives data packet 2 from computer B, i.e. the sampling time interval of the Kalman filter algorithm, represents the prior estimate of the system state at time , represents the posterior estimate of the system state at time .

[0153] The innovation value of the measurement is calculated :

[0154]

[0155] wherein, is the latest time when computer A receives data packet 2, .

[0156] The measurement noise covariance value is adaptively adjusted :

[0157]

[0158] wherein, the symbol represents assigning the calculation result of to , is the Euclidean norm; is a negative feedback quantity proportional to the size of the current observation deviation, used to dynamically adjust the parameters of the filter.

[0159] The process noise covariance value is adaptively adjusted :

[0160]

[0161] wherein, represents the process noise covariance of the clock offset at time , represents the sample variance of the residual value from time to time , represents the process noise covariance of the clock drift at time ; is the adaptive adjustment coefficient of the clock drift covariance value;

[0162] represents the sample variance of the residual value from time to time a change in the clock offset estimate value over a time interval.

[0163] Step 7: Kalman filter estimation process.

[0164] calculating a prior estimate of the system state covariance

[0165]

[0166] calculating a Kalman filter gain matrix

[0167]

[0168] calculating a posterior estimate of the system state

[0169]

[0170] calculating a posterior estimate of the system state covariance

[0171]

[0172] wherein, is a new information matrix at the kth time point, is a Kalman gain matrix at the kth time point, and are a posterior estimate of the system state and a covariance matrix of the system state at the kth time point, respectively. Step 8: determining whether the time synchronization is suspended, and once the suspension condition is met, the algorithm stops running, otherwise returning to S002 and repeating the above steps. There are two common suspension conditions: (1) computer A receives a user's suspension instruction; (2) computer A does not receive a data packet from computer B for more than 1 minute.

[0173] Based on the method provided in the above embodiment, the embodiment of the present application further provides a Kalman filter-based time synchronization product applied to a distributed system, which will be introduced below in combination with the drawings.

[0174] Referring to

[0175] , the figure is a structural schematic diagram of a Kalman filter-based time synchronization product applied to a distributed system provided by the embodiment of the present application.

[0176] Figure 5

[0177] ​​​​​​​The application embodiment provided by the application provides a Kalman filtering-based time synchronization device 500 applied to a distributed system, which comprises a communication module 501, a calculation module 502, a construction module 503, an adjustment module 504 and an estimation module 505.

[0178] The communication module 501 is configured to acquire a plurality of timestamp data by performing bidirectional message exchange between the first clock and the second clock.

[0179] The calculation module 502 is configured to calculate an observation value based on the plurality of timestamp data.

[0180] The construction module 503 is configured to construct a two-state model according to the physical characteristics of the clock error, and a state vector of the two-state model comprises a clock offset and a clock drift.

[0181] The adjustment module 504 is configured to adaptively adjust an observation noise covariance by a dynamic damping factor to obtain an adjusted observation noise covariance, and adjust a process noise covariance by a preset block adaptive strategy to obtain an adjusted process noise covariance, wherein the adjusted process noise covariance comprises a process noise covariance of the clock offset and a process noise covariance of the clock drift.

[0182] The estimation module 505 is configured to perform system state estimation by a preset Kalman filtering algorithm based on the adjusted observation noise covariance and the adjusted process noise covariance to obtain a clock offset estimation value and a clock drift estimation value, so as to realize time synchronization between the first clock and the second clock.

[0183] In a possible implementation manner, the construction module 503 is specifically configured to:

[0184] construct a two-state model according to the physical characteristics of the clock error, and a state vector is defined as:

[0185]

[0186] wherein, represents a clock offset at the i th moment; represents a clock drift at the i th moment. represents a clock drift at the i th moment. represents a real number set.

[0187] In a possible implementation manner, the construction module 503 is specifically configured to:

[0188] The modeling of the two-state model comprises discrete state equation modeling of the time deviation estimation system and observation equation modeling of the time deviation estimation system.

[0189] The discrete state equation modeling of the time deviation estimation system is: ​

[0190]

[0191] wherein, is a sampling time interval; is the process noise in the system state change process in the time interval from the moment to the moment; is a state transition matrix;

[0192] The observation equation of the time bias estimation system is modeled as:

[0193]

[0194] wherein, represents the moment when the first clock sends a data packet to the second clock, represents the moment when the first clock receives the data packet of the second clock, is the measurement noise at the moment, represents an observation matrix.

[0195] In a possible implementation, the construction module 503 is specifically configured to:

[0196] The process noise is subject to a Gaussian distribution, which is mathematically expressed as:

[0197]

[0198] wherein, represents the standard deviation of the clock bias noise in continuous time; represents the standard deviation of the clock drift noise in continuous time; is a sampling time interval; is the process noise in the system state change process in the time interval from the moment to the moment; is the clock bias noise in the time interval from the moment to the moment; is the clock drift noise in the time interval from the moment to the moment; represents that the mean of the noise vector is a zero vector with 2 rows and 1 column; represents a Gaussian distribution; represents the covariance matrix of the process noise;

[0199] The measurement noise is subject to a Gaussian distribution, which is mathematically expressed as:

[0200]

[0201] wherein, represents the measurement noise at the time point, represents the measurement noise covariance, represents the measurement noise standard deviation at the time point.

[0202] In a possible implementation, the adjusting module 504 is specifically configured to:

[0203] The formula of the dynamic suppression factor is:

[0204]

[0205] wherein, is the predicted value of the system state at the time point; is the measurement value at the time point; is the innovation value at the time point; is the sensitivity adjustment coefficient of the algorithm; is the Euclidean norm; is a negative feedback quantity proportional to the size of the deviation from the current observation, which is used to dynamically adjust the parameters of the filter;

[0206] The dynamic suppression factor is a modified formula for the observation noise covariance:

[0207]

[0208] wherein, the symbol represents that the calculation result of is assigned to .

[0209] In a possible implementation, the adjusting module 504 is specifically configured to:

[0210] According to the noise characteristics of the clock offset and the clock drift, a preset block adaptive strategy is proposed, and the formula for adjusting the process noise covariance is as follows:

[0211]

[0212] wherein, represents the process noise covariance of the clock offset at the time point; represents the sample variance value of the clock offset residual value from the time point to the time point; an adaptive adjustment coefficient of the clock drift covariance value; a process noise covariance representing a clock drift at the time instant; an adaptive adjustment coefficient of the clock drift covariance value; a process noise covariance representing a clock drift at the time instant; a variation of the clock offset estimation value over a time interval from the

[0213] Since the product 500 is a product corresponding to the Kalman filtering based time synchronization method applied to a distributed system provided in the above method embodiments, the specific implementation of each unit of the product 500 is the same as the same concept as the above method embodiments, and therefore, the specific implementation of each unit of the product 500 can be referred to the description of the Kalman filtering based time synchronization method applied to a distributed system in the above method embodiments, which will not be repeated here.

[0214] The application further provides a Kalman filtering based time synchronization device applied to a distributed system, the device comprising: a processor and a memory;

[0215] a memory for storing instructions;

[0216] a processor for executing the instructions in the memory, and executing the Kalman filtering based time synchronization method applied to a distributed system executed by the analysis device mentioned in the above embodiments.

[0217] It should be noted that the hardware structure of the Kalman filtering based time synchronization device applied to a distributed system provided in the application embodiments can be the structure as shown in Figure 6 , Figure 6 a structure diagram of the Kalman filtering based time synchronization device applied to a distributed system provided in the application embodiments.

[0218] Please refer to Figure 6 , the Kalman filtering based time synchronization device applied to a distributed system 600 comprises: a processor 610, a communication interface 620 and a memory 630. The number of processors 610 in the device 600 can be one or more, Figure 6 In the embodiment, the processor 610, the communication interface 620 and the memory 630 are connected through a bus system or other means, wherein, Figure 5 In the embodiment, the connection through the bus system 640 is taken as an example.

[0219] The processor 610 can be a central processing unit (CPU), a network processor (NP), or a combination of CPU and NP. The processor 610 can further include a hardware chip. The hardware chip can be an application-specific integrated circuit (ASIC), a programmable logic device (PLD), or a combination thereof. The PLD can be a complex programmable logic device (CPLD), a field-programmable gate array (FPGA), a generic array logic (GAL), or any combination thereof.

[0220] The memory 630 can include a volatile memory (e.g., random-access memory (RAM)), and can also include a non-volatile memory (e.g., flash memory, hard disk drive (HDD), or solid-state drive (SSD)). The memory 630 can also include a combination of the above-mentioned types of memories.

[0221] Optionally, the memory 630 stores an operating system and programs, executable modules, or data structures, or a subset thereof, or an extended set thereof, wherein the programs can include various operation instructions for implementing various operations. The operating system can include various system programs for implementing various basic services and processing hardware-based tasks. The processor 610 can read the programs in the memory 630 to implement the Kalman filtering-based time synchronization method applied to a distributed system provided by the embodiments of the present application.

[0222] The bus system 640 can be a peripheral component interconnect (PCI) bus, an extended industry standard architecture (EISA) bus, or the like. The bus system 640 can be divided into an address bus, a data bus, a control bus, and the like. For ease of representation, Figure 6Only one bus or type of bus can exist, however.

[0223] The embodiment of the present application further provides a computer readable storage medium comprising instructions which, when executed on a computer, cause the computer to perform the Kalman filter based time synchronization method applied to a distributed system mentioned in the above embodiment.

[0224] The embodiment of the present application further provides a computer program product comprising instructions which, when executed on a computer, cause the computer to perform the Kalman filter based time synchronization method applied to a distributed system mentioned in the above embodiment.

[0225] The terms "first", "second", and the like, if any, in the description and claims of the present application and above-described accompanying drawings are used to distinguish similar objects and are not necessarily used to describe a particular sequential or chronological order. It should be understood that the data thus used can be interchanged, where appropriate, so that the embodiments described herein can be carried out in sequences other than those illustrated or described herein. Furthermore, the terms "comprise" and "have", and any variations thereof, are intended to cover a non-exclusive inclusion, for example, a process, method, system, product, or apparatus that comprises a list of steps or units is not necessarily limited to those clearly listed, but can include other steps or units not clearly listed or inherent to such processes, methods, products, or apparatus.

[0226] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working processes of the above-described system, product and unit can refer to the corresponding processes in the foregoing method embodiments, which will not be described here.

[0227] The above detailed description of the specific embodiments, the purposes, technical solutions and beneficial effects of the present application have been further described in detail, and it should be understood that the above is only a specific embodiment of the present application.

[0228] The above, the above embodiments are only used to illustrate the technical solutions of the present application, and not to limit them; although the present application has been described in detail with reference to the foregoing embodiments, those skilled in the art should understand that they can still modify the technical solutions recorded in the foregoing embodiments, or make equivalent replacement for part of the technical features; and these modifications or replacements do not make the essence of the corresponding technical solutions deviate from the scope of the technical solutions of the embodiments of the present application.

Claims

1. A time synchronization method based on Kalman filtering for distributed systems, characterized in that, include: Multiple timestamp data are obtained by bidirectional message exchange between the first clock and the second clock. Calculate the observation value based on the multiple timestamp data; A two-state model is constructed based on the physical characteristics of clock errors. The state vector of the two-state model includes clock offset and clock drift, and the state vector is defined as follows: in, Indicates the first Clock offset at a given moment; Indicates the first The clock drifts at a given moment; Represents the set of real numbers; The adjusted observation noise covariance is obtained by adaptively adjusting the observation noise covariance using a dynamic suppression factor. The formula for the dynamic suppression factor is as follows: in, For the first System status at all times The predicted value; For the first The measured value at time; For the first The value of information at any given moment; This is the sensitivity adjustment coefficient for the algorithm; It is the Euclidean norm; The negative feedback quantity is proportional to the current observation deviation and is used to dynamically adjust the filter parameters; The dynamic inhibitory factor The correction formula for the observed noise covariance is: Among them, symbols Indicates will The calculation result is assigned to ; Based on the noise characteristics of the clock offset and clock drift, a preset block adaptive strategy is proposed to adjust the process noise covariance, resulting in an adjusted process noise covariance. The adjusted process noise covariance includes the process noise covariance of the clock offset and the process noise covariance of the clock drift, as shown in the following formula: in, Indicates the first The process noise covariance of the time clock offset; Indicates from Time's up The sample variance of the clock offset residuals within a given time period; This is an adaptive adjustment factor for the clock offset covariance value; Indicates the first The noise covariance during time-lapse clock drift; This is the adaptive adjustment coefficient for the clock drift covariance value; Indicates from the first Time to the The change in the estimated clock offset over a given time interval; Based on the adjusted observation noise covariance and the adjusted process noise covariance, the system state is estimated using a preset Kalman filter algorithm to obtain clock offset estimates and clock drift estimates, thereby achieving time synchronization between the first clock and the second clock.

2. The time synchronization method based on Kalman filtering applied to distributed systems according to claim 1, characterized in that, The modeling of the dual-state model includes the modeling of the discrete state equations of the time deviation estimation system and the modeling of the observation equations of the time deviation estimation system. The discrete state equation of the time deviation estimation system is modeled as follows: in, Indicates the first Clock offset at a given moment; Indicates the first The clock drifts at a given moment; The sampling time interval; For from the first Time to the Process noise during the system state change process over a given time interval; This is the state transition matrix; The observation equation of the time deviation estimation system is modeled as follows: in, This indicates the time when the first clock sends a data packet to the second clock. This indicates the time when the first clock receives the data packet from the second clock. For the first Measurement noise at time, This represents the observation matrix.

3. The time synchronization method based on Kalman filtering applied to distributed systems according to claim 2, characterized in that, The process noise follows a Gaussian distribution, mathematically represented as: in, This represents the standard deviation of clock skew noise over continuous time. This represents the standard deviation of clock drift noise over continuous time. The sampling time interval; For from the first Time to the Process noise during the system state change process over a given time interval; For from the first Time to the Clock offset noise over the time interval; For from the first Time to the Clock drift noise over a given time interval; The mean of the noise vector is represented by a 2x1 zero vector; Indicates a Gaussian distribution; The covariance matrix represents the process noise; The measurement noise follows a Gaussian distribution, mathematically represented as: middle, Indicates the first Measurement noise at time, This represents the measurement noise covariance. Indicates the first The standard deviation of measurement noise at time.

4. A time synchronization product based on Kalman filtering for distributed systems, characterized in that, include: The communication module is used to acquire multiple timestamp data by exchanging messages bidirectionally between the first clock and the second clock. The calculation module is used to calculate the observation value based on the multiple timestamp data; The construction module is used to construct a two-state model based on the physical characteristics of clock errors. The state vector of the two-state model includes clock offset and clock drift, and the state vector is defined as follows: in, Indicates the first Clock offset at a given moment; Indicates the first The clock drifts at a given moment; Represents the set of real numbers; The adjustment module is used to adaptively adjust the observation noise covariance using a dynamic suppression factor to obtain the adjusted observation noise covariance. The formula for the dynamic suppression factor is: in, For the first System status at all times The predicted value; For the first The measured value at time; For the first The value of information at any given moment; This is the sensitivity adjustment coefficient for the algorithm; It is the Euclidean norm; The negative feedback quantity is proportional to the current observation deviation and is used to dynamically adjust the filter parameters; The dynamic inhibitory factor The correction formula for the observed noise covariance is: Among them, symbols Indicates will The calculation result is assigned to ; Based on the noise characteristics of the clock offset and clock drift, a preset block adaptive strategy is proposed to adjust the process noise covariance, resulting in an adjusted process noise covariance. The adjusted process noise covariance includes the process noise covariance of the clock offset and the process noise covariance of the clock drift, as shown in the following formula: in, Indicates the first The process noise covariance of the time clock offset; Indicates from Time's up The sample variance of the clock offset residuals within a given time period; This is an adaptive adjustment factor for the clock offset covariance value; Indicates the first The noise covariance during time-lapse clock drift; This is the adaptive adjustment coefficient for the clock drift covariance value; Indicates from the first Time to the The change in the estimated clock offset over a given time interval; The estimation module is used to perform system state estimation based on the adjusted observation noise covariance and the adjusted process noise covariance using a preset Kalman filter algorithm, thereby obtaining clock offset estimates and clock drift estimates, and thus achieving time synchronization between the first clock and the second clock.

5. A time synchronization device based on Kalman filtering for use in distributed systems, characterized in that, The device includes: a processor and a memory; The memory is used to store instructions; The processor is configured to execute the instructions in the memory to perform the time synchronization method based on Kalman filtering applied to a distributed system as described in any one of claims 1-3.

6. A computer-readable storage medium, characterized in that, The instructions, when executed on a computer, cause the computer to perform the Kalman filter-based time synchronization method for distributed systems as described in any one of claims 1-3 above.

Citation Information

Patent Citations

  • Underground sensing equipment time synchronization method based on time sensitive network

    CN111682919A

  • Accurate time synchronization parameter tracking method based on alternative minimization Kalman filtering

    CN120560444A