Time synchronization method and device based on Kalman filtering, medium and product
By building a dual-state model in a distributed system and introducing a dynamic suppression factor and a block adaptive strategy, the Kalman filter algorithm is improved, the problem of distinguishing the noise characteristics of clock offset and clock drift is solved, and high-precision and robust time synchronization is achieved.
Patent Information
- Application Number
- CN202511307673.6
- Authority / Receiving Office
- CN · China
- Patent Type
- Applications(China)
- Current Assignee / Owner
- Filing Date
- 2025-09-15
- Publication Date
- 2025-10-17
- Estimated Expiration
- 2045-09-15
AI Technical Summary
In distributed systems, clock deviations caused by hardware differences and environmental factors lead to inconsistent timestamps and data alignment errors. Existing Kalman filtering technology has poor accuracy and is prone to divergence in non-stationary noise environments. It fails to effectively distinguish the noise characteristics of clock offset and clock drift, affecting synchronization accuracy and robustness.
By constructing a dual-state model, introducing a dynamic suppression factor to adaptively adjust the observation noise covariance, using a block adaptive strategy to distinguish the process noise covariance of clock offset and clock drift, and improving the Kalman filter algorithm to achieve high-precision synchronization.
The accuracy and robustness of time synchronization are improved, adapting to noise changes in complex environments, and ensuring real-time high accuracy and stability of system state estimation.
Smart Images

Figure CN120803209A_ABST
Abstract
Description
TECHNICAL FIELD
[0001] The present application relates to the field of time synchronization, and in particular to a time synchronization method and device based on Kalman filtering, a medium and a product. 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 kept 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 filter relies on a fixed noise covariance matrix, which is difficult to adapt to non-stationary noise environments; although the existing adaptive Kalman filter can update the noise covariance matrix online, it has problems such as poor numerical stability and easy divergence, and does not distinguish between the noise characteristics of clock offset and clock drift, which limits the synchronization accuracy.
[0004] Therefore, how to achieve high-precision and robust time synchronization in complex environments is a problem that needs to be solved by those skilled in the art. SUMMARY
[0005] The embodiments of the present application provide a time synchronization method and device based on Kalman filtering, a medium and a product, which can achieve high-precision and robust time synchronization in complex environments.
[0006] The first aspect of the present application provides a time synchronization method based on Kalman filtering, comprising: Obtaining a plurality of timestamp data by performing bidirectional message exchange between a first clock and a second clock; Calculating an observation value based on the plurality of timestamp data; 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; Adaptively adjusting the observation noise covariance through a dynamic damping factor to obtain an adjusted observation noise covariance; Adjusting the process noise covariance using a preset block adaptive strategy to obtain an adjusted process noise covariance, wherein the adjusted process noise covariance includes a process noise covariance of the clock offset and a process noise covariance of the clock drift; Based on the adjusted observation noise covariance and the adjusted process noise covariance, performing system state estimation through a preset Kalman filtering algorithm to obtain a clock offset estimation value and a clock drift estimation value, thereby realizing time synchronization between the first clock and the second clock.
[0007] Optionally, the double-state model is constructed according to the physical characteristics of the clock error, including: According to the physical characteristics of the clock error, the double-state model is constructed, and a state vector is defined as:
[0008] wherein, denotes the clock offset at the time t; denotes the clock drift at the time t; denotes the clock offset at the time t; denotes the clock drift at the time t; denotes a real set.
[0009] Optionally, the modeling of the double-state model includes discrete state equation modeling of the time bias estimation system and observation equation modeling of the time bias estimation system; The discrete state equation modeling of the time bias estimation system is:
[0010] wherein, is a sampling time interval; is the process noise in the system state change process from the time t to the time t; is a state transition matrix; The observation equation modeling of the time bias estimation system is:
[0011] wherein, denotes the time at which the first clock sends a data packet to the second clock, denotes the time at which the first clock receives the data packet of the second clock, is the measurement noise at the time t, denotes an observation matrix.
[0012] Optionally, the process noise is subject to a Gaussian distribution, which is mathematically expressed as:
[0013] wherein, denotes the standard deviation of the clock offset noise in continuous time; denotes 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 from the time t to the time t; is a state transition matrix; is the measurement noise at the time t; is a state transition matrix; Time to Clock offset noise in the time interval; For the Time to Clock drift noise in the time interval; Indicates that the mean of the noise vector is a zero vector with 2 rows and 1 column; represents Gaussian distribution; represents the covariance matrix of the process noise; The measurement noise follows a Gaussian distribution, which can be expressed mathematically as:
[0014] in, Indicates the The measurement noise at the moment, represents the measurement noise covariance, Indicates the The standard deviation of the measurement noise at time t.
[0015] Optionally, adaptively adjusting the observation noise covariance by a dynamic suppression factor to obtain an adjusted observation noise covariance includes: The formula for the dynamic inhibition factor is:
[0016] in, For the System status at all times The predicted value of For the The measured value at the moment; For the Innovation value at the moment; is the sensitivity adjustment coefficient of the algorithm; is the Euclidean norm; It is a negative feedback amount proportional to the current observation deviation, which is used to dynamically adjust the filter parameters; Dynamic inhibitory factor The correction formula for the observation noise covariance is:
[0017] Among them, the symbol Indicates that The result of the calculation is assigned to .
[0018] Optionally, a preset block adaptive strategy is used to adjust the process noise covariance, including: Based on the noise characteristics of clock offset and clock drift, a preset block adaptive strategy is proposed. The formula for adjusting the process noise covariance is as follows:
[0019] in, Indicates the Process noise covariance of the clock offset at the moment; Indicates from Time has come The sample variance of the clock offset residual value within the moment; is the adaptive adjustment coefficient of the clock offset covariance value; Indicates the The process noise covariance of the moment clock drift; is the adaptive adjustment coefficient of the clock drift covariance value; Indicates that from Time to The change in the estimated clock offset over the time interval.
[0020] A second aspect of the present application provides a time synchronization product based on Kalman filtering, comprising: A communication module, configured to obtain a plurality of timestamp data by performing bidirectional message exchange between the first clock and the second clock; A calculation module, used to calculate observation values based on multiple timestamp data; A building module is used to build a two-state model according to the physical characteristics of the clock error, where the state vector of the two-state model includes clock offset and clock drift; An adjustment module is configured to adaptively adjust the observation noise covariance by a dynamic suppression factor to obtain an adjusted observation noise covariance; and to adjust the process noise covariance by a preset block adaptive strategy to obtain an 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; The estimation module is used to perform system state estimation based on the adjusted observation noise covariance and the adjusted process noise covariance through a preset Kalman filter algorithm to obtain a clock offset estimation value and a clock drift estimation value, thereby achieving time synchronization between the first clock and the second clock.
[0021] Optionally, a building block is specifically configured to: According to the physical characteristics of clock error, a two-state model is constructed, and the state vector is defined as:
[0022] in , Indicates the The clock offset of the moment; Indicates the The clock drifts at the moment; represents a real number set.
[0023] The third aspect of the present application provides a Kalman filtering based time synchronization device, comprising a processor and a memory; The memory is configured to store instructions. The processor is configured to execute the instructions in the memory, and execute the Kalman filtering based time synchronization method according to any one of the preceding aspects.
[0024] The third aspect of the present application provides a computer storage medium for storing a program, when the program is executed, a method for implementing the Kalman filtering based time synchronization according to any one of the preceding aspects.
[0025] The double-state model containing clock offset and clock drift is established, which is beneficial to improving the precision and speed of time synchronization; the dynamic inhibition factor is introduced to adaptively adjust the observation noise covariance to cope with abnormal noise; the block adaptive strategy is adopted to distinguish and independently adjust the process noise covariance of clock offset and clock drift to match their different noise characteristics; and finally, the Kalman filtering is adopted to realize high-precision and high-robustness time synchronization. BRIEF DESCRIPTION OF DRAWINGS
[0026] In order to more clearly illustrate the technical solutions of the embodiments of the present application or the prior art, the drawings needed to be used in the embodiments or prior art description will be briefly introduced. Obviously, the drawings in the following description are only some embodiments described in the present application, and those skilled in the art can also obtain other drawings according to these drawings without creative labor.
[0027] Figure 1 A flowchart of a Kalman filtering based time synchronization method provided by an embodiment of the present application is shown; Figure 2 A topological structure diagram of a clock offset estimation task provided by an embodiment of the present application is shown; Figure 3 A structure diagram of a one-time measurement data generation process provided by an embodiment of the present application is shown; Figure 4 A flowchart of a Kalman filtering based time synchronization algorithm provided by an embodiment of the present application is shown; Figure 5 A structure diagram of a Kalman filtering based time synchronization product provided by an embodiment of the present application is shown; Figure 6 A structure diagram of a Kalman filtering based time synchronization device provided by an embodiment of the present application is shown. DETAILED DESCRIPTION
[0028] The embodiment of the application provides a time synchronization method and device based on Kalman filtering, a medium and product, which can realize high-precision and strong-robustness time synchronization in a complex environment.
[0029] For the convenience of understanding, the application scenarios of the embodiments of the application are introduced first.
[0030] In many distributed systems, such as multi-agent navigation and distributed sensor networks, 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 can cause timestamp inconsistency, data alignment errors, and further affect the performance and accuracy of the system.
[0031] Kalman filtering is a real-time online system state estimation algorithm, which is widely used in time synchronization technology. The existing Kalman filtering-based clock synchronization technology has the following shortcomings: (1) The traditional Kalman filtering relies on a fixed noise covariance matrix, and cannot adapt to the non-stationarity of noise caused by environmental temperature changes, electromagnetic interference, etc., and the filtering accuracy is often not ideal.
[0032] (2) Although the existing adaptive Kalman filtering can update the noise covariance matrix online, it has poor numerical stability and is easy to diverge, for example, the noise covariance in Sage-Husa adaptive filtering can lose positive definiteness and cause 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.
[0033] (3) The observation value is only related to the clock offset, and is not directly related to the clock drift. The estimation of the clock drift completely depends on the state transition matrix and the process noise model. If the model is not accurate (such as the existence of sampling time error or noise statistics deviation), the estimation of the clock drift is easy to diverge.
[0034] To solve the above problems, the application introduces a dynamic damping factor, classifies and adjusts the process noise, and modifies the observation model, which solves the core problems of environmental adaptability and noise modeling accuracy of the Kalman filtering-based time synchronization method, and provides reliable technical support for high-precision time synchronization systems.
[0035] Referring to Figure 1 , the figure is a flowchart of a Kalman filtering-based time synchronization method provided by the embodiments of the application. The Kalman filtering-based time synchronization method provided by the embodiments of the application can be realized by the following steps S101-S106.
[0036] S101: Obtain a plurality of timestamp data by performing bidirectional message exchange between a first clock and a second clock.
[0037] In an embodiment of the present application, two computers to be time-synchronized are connected via a pre-set communication method. The two computers correspond to a first clock as the initiator and a second clock as the responder, respectively. Multiple timestamp data are obtained by bidirectionally exchanging messages between the first clock and the second clock.
[0038] It should be noted that in the embodiment of the present application, the communication method between computers is not specifically limited in the embodiment of the present application, and may include RS232 serial communication link, UWB communication link and LaRA communication link, etc.
[0039] S102: Calculate observation values based on multiple timestamp data.
[0040] In the embodiment of the present application, the observation value Calculated by two-way communication timestamp, the formula is as follows:
[0041] in, The local timestamp corresponding to the initiator's first clock, The local timestamp corresponding to the responder's second clock.
[0042] S103: Construct a two-state model according to the physical characteristics of the clock error.
[0043] In the embodiment of the present application, a two-state model is constructed based on the physical characteristics of the clock error, and the state vector is defined as:
[0044] in, Indicates the The clock offset of the moment; Indicates the clock drift at the moment; represents the set of real numbers.
[0045] Specifically, the modeling of the two-state model includes discrete state equation modeling of the time deviation estimation system and observation equation modeling of the time deviation estimation system; The discrete state equation of the time deviation estimation system is modeled as:
[0046] in, is the sampling time interval; For the Time to Process noise during the system state change process in the time interval; is the state transfer matrix; and assuming that the process noise obeys Gaussian distribution, the mathematical expression is:
[0047] 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 the time instant to the time instant is the clock bias noise in the time interval from the time instant to the time instant is the clock drift noise in the time interval from the time instant to the time instant is the clock bias noise in the time interval from the time instant to the time instant is the clock drift noise in the time interval from the time instant 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; and The specific values can be determined by looking up the technical parameter table of the clock source or determined by multiple tests, and the present application does not make specific limitations.
[0048] The observation equation of the time deviation estimation system is modeled as:
[0049] wherein, denotes the time instant at which the first clock sends a data packet to the second clock, denotes the time instant at which the first clock receives a data packet from the second clock, is the measurement noise at the time instant denotes the observation matrix. And it is assumed that the measurement noise obeys a Gaussian distribution, which is mathematically expressed as: wherein,
[0050] denotes the measurement noise at the time instant denotes the measurement noise covariance, denotes the standard deviation of the measurement noise at the time instant S104: adaptively adjust the observation noise covariance through a dynamic damping factor.
[0051] S104: adaptively adjust the observation noise covariance through a dynamic damping factor.
[0052] In an embodiment of the present 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 deviation estimation method to environmental factors.
[0053] Specifically, the formula for the dynamic inhibition factor is:
[0054] in, For the System status at all times The predicted value of For the The measured value at the moment; For the The innovation value at time t (also called the observation residual value); is the sensitivity adjustment coefficient of the algorithm, with a typical value of 0.01; is the Euclidean norm; It is a negative feedback amount proportional to the current observation deviation, which is used to dynamically adjust the filter parameters; Dynamic inhibitory factor The correction formula for the observation noise covariance is:
[0055] Among them, the symbol Indicates that The result of the calculation is assigned to .
[0056] Dynamic inhibitory factor The mechanism of action is that when abnormal noise causes the observation residual value to increase, the Kalman gain is reduced by increasing the process noise covariance, thereby weakening the impact of abnormal observations on the system state and avoiding the divergence of the estimation algorithm.
[0057] S105: Using a preset block adaptive strategy to adjust the process noise covariance.
[0058] In the embodiment of the present application, a block adaptive strategy is proposed according to the different noise characteristics of clock offset and drift.
[0059] The formula for adjusting for process noise covariance is as follows:
[0060] in, Indicates the The process noise covariance of the moment clock offset; Indicates from Time has come The sample variance of the clock offset residual value within the moment; is the adaptive adjustment coefficient of the clock offset covariance value; Indicates the The process noise covariance of the moment clock drift; is the adaptive adjustment coefficient of the clock drift covariance value; Indicates that from Time to The change in the estimated clock offset over the time interval.
[0061] It should be noted that in the embodiments of this application, The typical value of can be 0.8, The typical value of can be 1.0, and the values of the two are determined according to actual needs.
[0062] S106: Based on the adjusted observation noise covariance and the adjusted process noise covariance, perform system state estimation using a preset Kalman filter algorithm.
[0063] In an embodiment of the present application, after adaptively correcting the process noise covariance and the measurement noise covariance, the Kalman filter algorithm is used to perform system state estimation to obtain a clock offset estimate and a clock drift estimate, thereby achieving time synchronization between the first clock and the second clock.
[0064] Specifically, the formula for Kalman filter prediction observation is as follows: System status prediction formula:
[0065] Prior covariance calculation formula:
[0066] in, Indicates the The prior estimate of the system state at time t, Indicates the The posterior estimate of the system state at time , is the process noise covariance, is the state transition matrix, is the matrix transpose operator.
[0067] The Kalman filter observation update process is: The measurement residual calculation formula is:
[0068] The formula for calculating the measurement residual covariance is:
[0069] Kalman gain calculation formula:
[0070] System status update calculation formula:
[0071] The formula for calculating the posterior covariance is:
[0072] in, For the The innovation matrix at each moment, For the The Kalman gain matrix at time , and Respectively The posterior estimate and covariance matrix of the system state at time , is the two-dimensional identity matrix.
[0073] The embodiment of the present application proposes a time synchronization method based on Kalman filtering to establish a dual-state clock error model, where the state vector includes clock offset and clock drift; constructs discrete state equations and observation equations to clarify the statistical characteristics of process noise and observation noise; introduces a dynamic suppression factor to adaptively adjust the observation noise covariance according to the new information value to enhance the robustness to abnormal noise; proposes a block adaptive strategy to adjust the process noise covariance of clock offset and clock drift respectively to improve the adaptability of the model; and adopts an improved Sage-Husa adaptive Kalman filtering algorithm to achieve real-time and high-precision estimation of the system state.
[0074] Now combined Figure 2 、 Figure 3 and Figure 4 Give an example. Figure 2 A schematic diagram of the topological structure of the clock offset estimation task provided in an embodiment of the present application; Figure 3 A schematic diagram of the structure of a measurement data generation process provided in an embodiment of the present application; Figure 4 A flow chart of a time synchronization algorithm based on Kalman filtering provided in an embodiment of the present application; like Figure 2 As shown, the two computers A and B (corresponding to clocks A and B respectively) to be time synchronized are connected using a communication method. Common connection methods include RS232 serial communication link, UWB communication link and LaRA communication link. It is assumed that computer A is the initiator of time synchronization and computer B is the responder of time synchronization.
[0075] Step 1: On computer A, Figure 3 As shown, in At this moment, computer A sends data packet 1 to computer B. Data packet 1 includes three timestamps. The values of the three timestamps are 、 and .
[0076] Step 2: On computer B, At this moment, computer B receives data packet 1 from computer A and replaces the timestamp in data packet 1 with Read into the memory of computer B.
[0077] Step 3: Moment, such as Figure 3 As shown, computer B sends data packet 2 to computer A. Data packet 2 includes three timestamps. The values of the three timestamps are 、 and . Step 4: On computer A, At this moment, computer A receives data packet 2 from computer B and sets the timestamp in data packet 2 to 、 and Read into the memory of computer A.
[0078] Step 5: Determine whether initialization is completed. If completed, proceed to step 6. If not, perform initialization and then return to step 1.
[0079] In computer A, let the initialization time of the algorithm be (i.e. At this moment), the initial estimated value of the algorithm state is set to:
[0080] in, 、 and are the a posteriori estimates of the clock offset, clock drift, and covariance at time 0, respectively.
[0081] Initialize the algorithm parameters:
[0082] in, is the sensitivity adjustment coefficient in the algorithm, is the time window size, is the clock offset process noise adaptive adjustment coefficient, is the adaptive adjustment coefficient of the clock drift process noise, 、 and are the clock offset process noise covariance, clock drift process noise covariance and observation noise covariance at time 0 respectively.
[0083] Step 6: Adaptively adjust Kalman filter parameters.
[0084] Specifically include: Calculate the latest measurement value :
[0085] According to the Kalman filter prediction equation, the predicted value of the system state is calculated:
[0086] in, is the time difference between computer A receiving data packet 2 from computer B twice, that is, the sampling time interval of the Kalman filter algorithm, Indicates the The prior estimate of the system state at time , Indicates the The a posteriori estimate of the system state at time t.
[0087] Calculate the innovation value of the measurement :
[0088] in, is the latest time when computer A receives data packet 2, .
[0089] Adaptive adjustment of measurement noise covariance value :
[0090] Among them, the symbol Indicates that The result of the calculation is assigned to , is the Euclidean norm.
[0091] Adaptively adjust the process noise covariance value :
[0092] in, Indicates the The process noise covariance of the clock offset at time , Indicates from Time has come The sample variance of the residual value within the time period, Indicates the The process noise covariance of the moment clock drift; is the adaptive adjustment coefficient of the clock drift covariance value; Indicates that from Time to The change in the estimated clock offset over the time interval.
[0093] Step 7: Kalman filter estimation process.
[0094] Compute a priori estimates of the system state covariance :
[0095] Calculate the Kalman filter gain matrix :
[0096] Compute a posterior estimate of the system state :
[0097] Compute a posterior estimate of the system state covariance :
[0098] in, For the The innovation matrix at each moment, For the The Kalman gain matrix at time , and Respectively The posterior estimate and covariance matrix of the system state at time .
[0099] Step 8: Determine whether time synchronization is terminated. Once the termination condition is met, the algorithm stops running, otherwise returns to S002 and repeats the above steps.
[0100] There are two common termination conditions: (1) Computer A receives a termination command from the user; (2) Computer A does not receive a data packet from Computer B for more than 1 minute.
[0101] Based on the method provided in the above embodiment, the embodiment of the present application further provides a time synchronization product based on Kalman filtering. The time synchronization product based on Kalman filtering is introduced below with reference to the accompanying drawings.
[0102] See also Figure 5 , this figure is a structural diagram of a time synchronization product based on Kalman filtering provided in an embodiment of the present application.
[0103] The time synchronization device 500 based on Kalman filtering provided in an embodiment of the present application includes: a communication module 501, a calculation module 502, a construction module 503, an adjustment module 504 and an estimation module 505.
[0104] The communication module 501 is configured to obtain a plurality of timestamp data by performing a two-way message exchange between a first clock and a second clock; The computing module 502 is configured to calculate an observation value based on the plurality of timestamp data; The constructing 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 includes a clock offset and a clock drift; The adjusting 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 includes a process noise covariance of the clock offset and a process noise covariance of the clock drift; The estimating 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.
[0105] In a possible implementation, the constructing module 503 is specifically configured to: construct a two-state model according to the physical characteristics of the clock error, and a state vector is defined as:
[0106] wherein, denotes a clock offset at the t th moment; denotes a clock drift at the t th moment; denotes a clock drift at the t th moment; denotes a real number set. In a possible implementation, the constructing module 503 is specifically configured to: The modeling of the two-state model includes discrete state equation modeling of the time deviation estimation system and observation equation modeling of the time deviation estimation system; The discrete state equation modeling of the time deviation estimation system is:
[0107] wherein, is a sampling time interval; is a process noise in a system state change process from a t th moment to a t+1 th moment in a time interval; is a state transition matrix; The observation equation modeling of the time deviation estimation system is:
[0108] wherein, denotes a moment at which the first clock sends a data packet to the second clock, represents the time instant when the first clock receives the data packet of the second clock, is the measurement noise at the time instant, represents the observation matrix.
[0109] In a possible implementation, the constructing module 503 is specifically configured to: The process noise is subject to a Gaussian distribution, which is mathematically expressed as:
[0110] wherein, represents the standard deviation of the clock offset noise in continuous time; represents the standard deviation of the clock drift noise in continuous time; is the sampling time interval; is the process noise in the process of the change of the system state in the time interval from the time instant to the time instant; is the clock offset noise in the time interval from the time instant to the time instant; is the clock drift noise in the time interval from the time instant to the time instant; 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; The measurement noise is subject to a Gaussian distribution, which is mathematically expressed as:
[0111] wherein, represents the measurement noise at the time instant, represents the measurement noise covariance, represents the standard deviation of the measurement noise at the time instant.
[0112] In a possible implementation, the adjusting module 504 is specifically configured to: The formula of the dynamic suppression factor is:
[0113] wherein, is the predicted value of the system state at the time instant; is the measurement value at the time instant; is the innovation value at the time instant; is the sensitivity adjustment coefficient of the algorithm; is the Euclidean norm; It is a negative feedback amount proportional to the current observation deviation, which is used to dynamically adjust the filter parameters; Dynamic inhibitory factor The correction formula for the observation noise covariance is:
[0114] Among them, the symbol Indicates that The result of the calculation is assigned to .
[0115] In a possible implementation, the adjustment module 504 is specifically configured to: Based on the noise characteristics of clock offset and clock drift, a preset block adaptive strategy is proposed. The formula for adjusting the process noise covariance is as follows:
[0116] in, Indicates the Process noise covariance of the clock offset at the moment; Indicates from Time has come The sample variance of the clock offset residual value within the moment; is the adaptive adjustment coefficient of the clock offset covariance value; Indicates the The process noise covariance of the moment clock drift; is the adaptive adjustment coefficient of the clock drift covariance value; Indicates that from Time to The change in the estimated clock offset over the time interval.
[0117] Since product 500 is a product corresponding to a time synchronization method based on Kalman filtering provided in the above method embodiment, the specific implementation of each unit of product 500 is based on the same concept as the above method embodiment. Therefore, regarding the specific implementation of each unit of product 500, you can refer to the description part of the time synchronization method based on Kalman filtering in the above method embodiment, which will not be repeated here.
[0118] The embodiment of the present application further provides a time synchronization device based on Kalman filtering, the device comprising: a processor and a memory; a memory for storing instructions; The processor is configured to execute instructions in the memory to implement the Kalman filter-based time synchronization method performed by the analysis device mentioned in the above embodiment.
[0119] It should be noted that the hardware structure of the time synchronization device based on Kalman filtering provided in the embodiments of the present application can be the structure as shown in Figure 6 Figure 6 The structure of the time synchronization device based on Kalman filtering provided in the embodiments of the present application is shown in the structure diagram.
[0120] Referring to Figure 6 , the time synchronization device based on Kalman filtering 600 includes 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 embodiments of the present application, the processor 610, the communication interface 620 and the memory 630 can be connected through a bus system or other means, wherein, Figure 5 In the embodiments of the present application, the processor 610, the communication interface 620 and the memory 630 can be connected through a bus system or other means, wherein,
[0121] 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.
[0122] The memory 630 can include volatile memory (English: volatile memory), such as random access memory (RAM); the memory 630 can also include non-volatile memory (English: non-volatile memory), such as flash memory, hard disk drive (HDD) or solid-state drive (SSD); the memory 630 can also include a combination of the above types of memory.
[0123] Optionally, the memory 630 stores an operating system and a program, an executable module, or a data structure, or a subset of them, or an extended set of them, wherein the program 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 program in the memory 630 to implement the Kalman filtering-based time synchronization method provided in the embodiments of the present application.
[0124] The bus system 640 can be a peripheral component interconnect (PCI) bus or an extended industry standard architecture (EISA) bus, etc. The bus system 640 can be divided into an address bus, a data bus, a control bus, etc. For the convenience of representation, Figure 6 Only one thick line is used in the figure to represent the bus, but it does not mean that there is only one bus or only one type of bus.
[0125] The embodiments of the present application also provide a computer readable storage medium, including instructions, when running on a computer, causing the computer to execute the Kalman filtering-based time synchronization method mentioned in the above embodiments.
[0126] The embodiments of the present application also provide a computer program product including instructions, when running on a computer, causing the computer to execute the Kalman filtering-based time synchronization method mentioned in the above embodiments.
[0127] The terms "first", "second", and the like (if any) in the specification and claims of the present application and the above-described drawings are used to distinguish similar objects, and do not necessarily indicate a specific order or sequence. It should be understood that the data thus used can be interchanged under appropriate circumstances, so that the embodiments described herein can be implemented in an order other than that illustrated or described herein. In addition, the terms "include" and "have" and any variations thereof are intended to cover non-exclusive inclusion, for example, a process, method, system, product, or device including a series of steps or units does not necessarily have to be limited to those steps or units clearly listed, but can include other steps or units not clearly listed or inherent to these processes, methods, products, or devices.
[0128] 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.
[0129] The above detailed description of the specific implementation is further detailed for the purpose of the present application, technical solutions and beneficial effects, and it should be understood that the above is only a specific implementation of the present application.
[0130] The above, the above examples are only used to illustrate the technical solutions of the present application, but not limit them; although the present application is described in detail with reference to the foregoing examples, those skilled in the art should understand that the technical solutions recorded in the foregoing examples can still be modified, or some technical features can be replaced by equivalents; 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, characterized in that: include: Acquire multiple timestamp data by performing bidirectional message exchange between the first clock and the second clock; calculating observation values based on the plurality of time-stamped data; Constructing a two-state model according to the physical characteristics of the clock error, wherein the state vector of the two-state model includes clock offset and clock drift; Adaptively adjusting the observation noise covariance through a dynamic suppression factor to obtain an adjusted observation noise covariance; Adopting a preset block adaptive strategy to adjust the process noise covariance to obtain an 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; Based on the adjusted observation noise covariance and the adjusted process noise covariance, system state estimation is performed through a preset Kalman filtering algorithm to obtain a clock offset estimation value and a clock drift estimation value, thereby achieving time synchronization between the first clock and the second clock.
2. The time synchronization method based on Kalman filtering according to claim 1, characterized in that: The dual-state model is constructed according to the physical characteristics of the clock error, including: According to the physical characteristics of clock error, a two-state model is constructed, and the state vector is defined as: in, Indicates the The clock offset of the moment; Indicates the The clock drifts at the moment; represents the set of real numbers.
3. The time synchronization method based on Kalman filtering according to claim 2, characterized in that: The modeling of the dual-state model includes discrete state equation modeling of the time deviation estimation system and observation equation modeling of the time deviation estimation system; The discrete state equation modeling of the time deviation estimation system is: in, Indicates the The clock offset of the moment; Indicates the The clock drifts at the moment; is the sampling time interval; For the Time to Process noise during the system state change process in the time interval; is the state transfer matrix; The observation equation of the time deviation estimation system is modeled as: in, Indicates the time when the first clock sends a data packet to the second clock, Indicates the time when the first clock receives the data packet of the second clock, For the The measurement noise at the moment, represents the observation matrix.
4. The time synchronization method based on Kalman filtering according to claim 3, characterized in that: The process noise obeys Gaussian distribution, which can be expressed mathematically as follows: in, represents the standard deviation of clock offset noise in continuous time; represents the standard deviation of clock drift noise in continuous time; is the sampling time interval; For the Time to Process noise during the system state change process in the time interval; For the Time to Clock offset noise in the time interval; For the Time to Clock drift noise in the time interval; Indicates that the mean of the noise vector is a zero vector with 2 rows and 1 column; represents Gaussian distribution; represents the covariance matrix of the process noise; The measurement noise obeys Gaussian distribution, which can be expressed mathematically as follows: middle, Indicates the The measurement noise at the moment, represents the measurement noise covariance, Indicates the The standard deviation of the measurement noise at time t.
5. The time synchronization method based on Kalman filtering according to claim 1, characterized in that: Adaptively adjusting the observation noise covariance by the dynamic suppression factor to obtain the adjusted observation noise covariance includes: The formula for the dynamic inhibition factor is: in, For the System status at all times The predicted value of For the The measured value at the moment; For the Innovation value at the moment; is the sensitivity adjustment coefficient of the algorithm; is the Euclidean norm; It is a negative feedback amount proportional to the current observation deviation, which is used to dynamically adjust the filter parameters; The dynamic inhibitory factor The correction formula for the observation noise covariance is: Among them, the symbol Indicates that The result of the calculation is assigned to .
6. The time synchronization method based on Kalman filtering according to claim 1, characterized in that: The process noise covariance is adjusted by using a preset block adaptive strategy, including: The preset block adaptive strategy is proposed based on the noise characteristics of the clock offset and the clock drift, and the formula for adjusting the process noise covariance is as follows: in, Indicates the Process noise covariance of the clock offset at the moment; Indicates from Time has come The sample variance of the clock offset residual value within the moment; is the adaptive adjustment coefficient of the clock offset covariance value; Indicates the The process noise covariance of the moment clock drift; is the adaptive adjustment coefficient of the clock drift covariance value; Indicates that from Time to The change in the estimated clock offset over the time interval.
7. Time synchronization product based on Kalman filtering, characterized by: include: A communication module, configured to obtain a plurality of timestamp data by performing bidirectional message exchange between the first clock and the second clock; A calculation module, configured to calculate an observation value based on the plurality of timestamp data; A construction module, configured to construct a dual-state model according to the physical characteristics of the clock error, wherein the state vector of the dual-state model includes clock offset and clock drift; An adjustment module is configured to adaptively adjust the observation noise covariance by a dynamic suppression factor to obtain an adjusted observation noise covariance; and to adjust the process noise covariance by a preset block adaptive strategy to obtain an 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; An estimation module is used to perform system state estimation based on the adjusted observation noise covariance and the adjusted process noise covariance through a preset Kalman filtering algorithm to obtain a clock offset estimation value and a clock drift estimation value, thereby achieving time synchronization between the first clock and the second clock.
8. The time synchronization product based on Kalman filtering according to claim 7, characterized in that: The building blocks are specifically used to: According to the physical characteristics of clock error, a two-state model is constructed, and the state vector is defined as: in, Indicates the The clock offset of the moment; Indicates the The clock drifts at the moment; represents the set of real numbers.
9. A time synchronization device based on Kalman filtering, characterized in that: The device includes: a processor and a memory; The memory is used to store instructions; The processor is used to execute the instructions in the memory and perform the Kalman filter-based time synchronization method according to any one of claims 1 to 6.
10. A computer-readable storage medium, characterized in that The method comprises instructions which, when executed on a computer, enable the computer to execute the time synchronization method based on Kalman filtering as described in any one of claims 1 to 6.
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
Timestamp-free synchronization clock parameter tracking method based on extended kalman filter
US20240201728A1
Cited By
AGV (Automatic Guided Vehicle) cooperative blockage avoidance path planning method for real-time road condition
CN121165742A
Bus communication method, equipment and system of PLC (Programmable Logic Controller) system
CN122110873A