Time synchronization parameter tracking method based on unknown input kalman filtering

By using the Kalman filtering method for unknowns, a joint tracking state-space model of clock phase offset and clock frequency offset is constructed, which solves the problem of accuracy and robustness of clock synchronization under temperature changes and achieves high-precision clock synchronization.

WO2026232671A1PCT designated stage Publication Date: 2026-11-12CHONGQING UNIV OF POSTS & TELECOMM
View PDF 0 Cites 0 Cited by

Patent Information

Application Number
PCT/CN2025/101610
Authority / Receiving Office
WO · WO
Patent Type
Applications
Current Assignee / Owner
Priority Date
2025-05-08
Filing Date
2025-06-18
Publication Date
2026-11-12

AI Technical Summary

Technical Problem

Existing technologies struggle to effectively track clock frequency and phase offsets in industrial networks, especially when ambient temperature changes, resulting in insufficient clock synchronization accuracy and robustness.

Method used

A method based on unknown Kalman filtering is adopted. By modeling the relationship between the clock crystal output frequency and temperature change, the temperature influence factor is introduced as an unknown into the clock parameter tracking state equation. Combined with a precise time synchronization protocol, a joint tracking state space model of clock phase offset and clock frequency offset is constructed, and the parameters are estimated using unknown Kalman filtering.

Benefits of technology

It improves the accuracy and robustness of clock synchronization, is suitable for environments with dynamic temperature changes, reduces synchronization energy consumption, and enhances adaptability to changes in ambient temperature.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN2025101610_12112026_PF_FP_ABST
    Figure CN2025101610_12112026_PF_FP_ABST
Patent Text Reader

Abstract

The present invention relates to the technical field of time synchronization, and to a time synchronization parameter tracking method based on unknown input Kalman filtering, comprising the following steps: S1: for a network communication scenario in which an ambient temperature dynamically changes, modeling a variation relationship between an output frequency of a clock crystal oscillator and the temperature of an environment in which the crystal oscillator is located as a quadratic function, and introducing a temperature influence factor as an unknown input into a clock parameter tracking state equation; S2: establishing a clock observation equation using a bidirectional information exchange process of a precise time protocol, and constructing, in combination with a clock state equation, a state-space model for joint tracking of clock offset and clock skew under dynamic changes in ambient temperature; and S3: using minimum variance unbiased estimation as a criterion, jointly tracking a clock skew value and a clock offset value for the established clock state-space model by means of the unknown input Kalman filtering.
Need to check novelty before this filing date? Find Prior Art

Description

A Time Synchronization Parameter Tracking Method Based on Unknown Kalman Filtering Technical Field

[0001] This invention belongs to the field of time synchronization technology and relates to a time synchronization parameter tracking method based on unknown Kalman filtering. Background Technology

[0002] Time synchronization, as an indispensable supporting technology in industrial networks, is a fundamental prerequisite for the normal operation of the network. The requirements for time synchronization in industrial networks stem from both their underlying operating mechanisms and upper-layer application scenarios. At the underlying protocol architecture level, the network transmission mechanism based on time slot scheduling imposes stringent standards on time accuracy. The time synchronization accuracy of industrial networks is mainly constrained by two key indicators: phase synchronization error and frequency stability. Industrial equipment typically uses crystal oscillators to generate periodic clock signals with a specific frequency, but the actual output frequency of the clock pulses deviates from its nominal value as the operating temperature changes. This frequency drift causes differences in the clock's clock cycle, resulting in clock phase offset. Therefore, it is necessary to perform joint dynamic tracking of clock frequency offset and clock phase offset. Tracking the phase offset can improve the accuracy of single synchronization; tracking the frequency drift can reveal the crystal oscillator variation pattern, reduce the resynchronization frequency, and lower synchronization energy consumption. However, a key challenge in designing a joint tracking method for clock frequency offset and clock phase offset is how to characterize the impact of temperature changes on clock frequency offset and enhance the robustness of clock synchronization parameter tracking to environmental temperature variations. Therefore, there is an urgent need for a joint tracking method for clock frequency offset and clock phase offset based on Kalman filtering with unknown variables. Summary of the Invention

[0003] In view of this, the purpose of this invention is to provide a time synchronization parameter tracking method based on unknown Kalman filtering.

[0004] To achieve the above objectives, the present invention provides the following technical solution:

[0005] A time synchronization parameter tracking method based on unknown Kalman filtering, characterized by the following steps:

[0006] S1: For network communication scenarios with dynamic changes in ambient temperature, the clock crystal output frequency and its variation with the ambient temperature are modeled as a quadratic function, and the temperature influence factor is introduced as an unknown into the clock parameter tracking state equation.

[0007] S2: Utilize the two-way information exchange process of the precise time synchronization protocol to establish the clock observation equation, and combine it with the clock state equation to construct a joint tracking state space model of clock phase offset and clock frequency offset under dynamic changes in ambient temperature.

[0008] S3: Using Kalman filtering with unknowns and taking minimum variance unbiased estimation as the criterion, the clock frequency offset and clock phase offset are jointly tracked for the established clock state-space model.

[0009] Furthermore, step S1 specifically includes the following steps:

[0010] S11: Measure temperature changes and calibrate the clock frequency using an empirical model, modeling the output frequency as highly correlated with temperature as: f k =f0(1+β(T) k -T0) 2 )

[0011] Where β represents the temperature coefficient, T0 represents the transition temperature, and T k f represents the temperature value at time k, f0 represents the rated oscillation frequency of the crystal oscillator under standard environmental conditions, i.e., the nominal frequency, f k Represents the actual output frequency;

[0012] S12: The frequency of the crystal oscillator drifts with temperature changes, causing the actual frequency f to... k There is a difference between the clock output and the nominal frequency f0. As time accumulates, this causes a clock frequency offset between the clock output and the actual time, which can be expressed as:

[0013] Where, δ k The clock frequency offset of the node is used as a representation. Combining this with the formula for the high correlation between frequency and temperature, and the expression for clock frequency offset, the relationship between temperature and node clock frequency offset is derived: δ k =δ0+β(T) k -T0) 2 +ω k

[0014] Where, ω k The clock frequency offset noise effect represents the node; δ0 represents the initial value of the clock frequency offset.

[0015] When the temperature sampling interval is sufficiently small, the recursive equation for the clock frequency offset is expressed as:

[0016] in, μk As an unknown quantity, the temperature variable is considered an unknown factor. μk Impact factor; ω k,δ This indicates that the mean is zero and the variance is... Clock frequency offset noise;

[0017] S13: Clock phase offset refers to the difference between the clock readings of two nodes, expressed as: θ(t)=D A (t)-D B (t)

[0018] Where D A (t) represents the time at node A, and D B (t) represents the time at node B;

[0019] Meanwhile, the clock phase offset θ(t) is calculated using the clock frequency offset formula: θ(t)=δ(t)τ+θ0

[0020] Where δ(t) represents the clock frequency offset, τ represents the sampling time, and θ0 represents the initial value of the clock phase offset;

[0021] When the temperature sampling interval is sufficiently small, the recursive equation for clock phase offset is expressed as: θ k =θ k-1 +Δτδ k-1 +ω θ,k

[0022] Where Δτ represents the sampling interval, δ k-1 ω represents the clock frequency offset at the previous moment. θ,k This indicates that the mean is zero and the variance is... Clock phase offset noise;

[0023] S14: Based on the derivation formulas for clock frequency offset and clock phase offset, let X k =[θ k ,δ k ] T The state transition equation, representing the PTP clock state vector, is rewritten in matrix form as follows: X k+1 =AX k +Bμ k +W k

[0024] in, μ k W represents an unknown input quantity; k =[ω θ,k ,δ δ,k ] T Let be the process noise vector, and its covariance matrix be... This represents the variance of the phase offset noise in the clock state equation. This represents the variance of the frequency offset noise in the clock state equation.

[0025] Furthermore, step S2 specifically includes the following steps:

[0026] S21: Use a precise time synchronization protocol to exchange timestamp messages, calculate network latency and clock skew, and adjust the time from the clock to achieve clock synchronization;

[0027] S22: Utilizing the interaction of the PTP clock model, the clock parameters between nodes are written as follows:

[0028] Where, d ms and d sm Represents path delay; θ[n] represents the clock phase offset at time n; t1[n], t2[n], t3[n], t4[n] represent the timestamps of PTP protocol interactions; the following timestamp differences are calculated from the node and expressed as:

[0029] Among them, t 21 [n] and t 43 [n] represents the timestamp difference, which is typically used for clock offset estimation assuming a symmetrical delay, resulting in:

[0030] in, Represents the observation offset;

[0031] The actual noise clock offset measurement and calculation are as follows:

[0032] Where ω[n] represents the clock phase offset observation noise;

[0033] S23: In discrete time, the frequency offset is expressed as:

[0034] Where t1[n]-t1[nN] is the time interval between θ[n] and θ[nN];

[0035] The actual generated noise clock frequency offset is:

[0036] in, This represents the actual noise clock frequency offset.

[0037] The actual measured value of the noise clock frequency offset is:

[0038] Where υ[n] represents the clock frequency offset observation noise;

[0039] S24: Order The PTP clock observation vector is represented by the following matrix form:

[0040] Z k =CX k +V k

[0041] in, Represents node clock observation noise;

[0042] S25: Introducing a temperature factor into the state equation model of PTP, the evolution behavior of the PTP clock is modeled. The PTP clock state transition equation is expressed as:

[0043] Where τ represents the sampling interval;

[0044] Based on the clock phase offset and clock frequency offset observation equations obtained during bidirectional communication using the PTP protocol, the state-space model of PTP is constructed as follows:

[0045] Where, μ k W represents the input of an unknown quantity. k The representative process noise has a mean of zero and a covariance of Q and V. k This represents observation noise with a mean of zero and a covariance of R.

[0046] Furthermore, the steps in step S21 for achieving clock synchronization using a precise time synchronization protocol are as follows:

[0047] S211: The master clock periodically sends a synchronization request message Sync and records the sending time t1;

[0048] S212: The clock records the precise time t2 when the Sync message arrives;

[0049] S213: After the master clock periodically sends a synchronization request message Sync, it will send a Follow_up message containing the precise time.

[0050] S214: Send a Delay_Req message from the slave clock and record the exact time t3 when the message leaves the slave clock;

[0051] S215: The master clock records the exact time t4 when the Delay_Req message arrives; then the master clock sends a Delay_Resq message containing the time t4 to the slave clock.

[0052] Furthermore, in step S3, the clock parameters are tracked using an estimation method based on the unknown Kalman filter to estimate the clock synchronization parameters in a minimum variance unbiased manner, including the following steps:

[0053] S31: State Prediction: Let the prior estimate of the state vector be expressed as It can be calculated using the following equation:

[0054] in, It is X k-1 Unbiased estimation;

[0055] S32: Estimation of Unknown Inputs: Let Represents a fixed unknown input quantity μ k The unbiased estimator is defined by the analytical expression as follows:

[0056] Among them, H k The gain matrix is ​​for unknown input quantities;

[0057] S33: Measurement Update: Order X represents k The posterior state estimate is expressed by the following equation:

[0058] Among them, K k The state estimation gain matrix is ​​used to obtain X. k The minimum variance unbiased estimate;

[0059] This transforms the problem of estimating the unknown Kalman filter into solving for two optimal gain matrices, namely M. k Unknown input gain matrix and K k State estimation gain matrix.

[0060] Furthermore, steps S31-S33 specifically include:

[0061] The purpose of state prediction is to obtain a priori estimates based on the state equation. and prior covariance P k|k-1 ;

[0062] make X represents time k-1 k-1 The posterior unbiased estimate is obtained by calculating the equation. It is an unbiased estimate, therefore definition The prediction error is:

[0063] Among them, e x,k|k-1 express The estimation error; ω k-1 This represents the prediction error noise at time k-1;

[0064] The prior estimate of the covariance matrix is ​​given by the following equation: P k|k-1 =E[e x,k|k-1 e x,k|k-1 T ] = AP k-1|k-1 A T +Q = AP k-1|k-1 A T +Q

[0065] Among them, P k-1|k-1 =E[ex,k-1|k-1 e x,k-1|k-1 T [] represents the posterior estimation error covariance matrix; Q represents the measurement process noise matrix;

[0066] From the observation equation, we know that the measurement residual r k It can be expressed by the following formula:

[0067] in Substituting this into the equation for estimating the unknown input, we get:

[0068] because Both are unbiased, υ k The mean of all of them is zero; therefore The mean is given by the following formula:

[0069] Therefore, as long as the gain matrix H k Satisfying H k If CB = I, then the unknown input quantity is estimated. For unbiased estimation, This is the minimum variance unbiased estimate;

[0070] Using the measured value Z k Prior state estimation The update is performed to derive the posterior state estimate with minimum variance unbiased property. and the posterior covariance matrix P k|k The posterior state estimation error is given by the following formula: (IK k A)e x,k|k-1 -K k CBμ k -K k υ k

[0071] Because of e x,k|k-1 and υk The mean of is zero, therefore, if and only if K k Satisfy, K k =L k +(IL k C)BH k L k Represents the gain matrix of the unknown quantity. For unbiased estimation, the posterior covariance matrix P k|k Represented as:

[0072] Where H k R represents the observation matrix, which maps the state space to the measurement space. kThe covariance matrix representing the measurement noise;

[0073] Optimal posterior state estimate and its covariance matrix P k|k They are represented as follows: K k =L k +(IL k C)BH k

[0074] Based on the above derivation and analysis, the clock frequency offset and clock phase offset of the precise time synchronization protocol can be jointly tracked by using the unknown Kalman filter.

[0075] The beneficial effects of this invention are as follows:

[0076] (1) This invention proposes a joint tracking method for time synchronization parameters based on Kalman filtering with unknowns. Considering the network communication scenario with dynamic changes in ambient temperature, the influence factor of ambient temperature is introduced as an unknown into the clock parameter tracking state equation. This method is not only suitable for evaluating the impact of clock noise on clock stability, but also supports the simulation and implementation of the PTP clock synchronization protocol using low-complexity iterative filtering techniques.

[0077] (2) This invention utilizes the PTP protocol to establish observation equations and, in conjunction with state equations, constructs a state-space model for joint tracking of clock phase offset and clock frequency offset under dynamic changes in ambient temperature. Based on the empirical model, the clock frequency is calibrated to achieve the accuracy of time-varying parameter tracking.

[0078] (3) This invention utilizes the Kalman filtering concept, takes the minimum variance unbiased estimation as the criterion, and combines it with a precise time synchronization protocol to achieve joint tracking of parameters including clock phase offset and clock frequency offset with unknown input quantities. This effectively compensates for the time-varying uncertainty input quantity introduced by the high dynamic change of ambient temperature, and significantly improves the robustness of the synchronization system to the high dynamic change of ambient temperature.

[0079] Other advantages, objectives, and features of the invention will be set forth in part in the description which follows, and in part will be apparent to those skilled in the art from the following examination, or may be learned from practice of the invention. The objectives and other advantages of the invention can be realized and obtained through the following description. Attached Figure Description

[0080] To make the objectives, technical solutions, and advantages of the present invention clearer, the preferred embodiments of the present invention will be described in detail below with reference to the accompanying drawings, wherein:

[0081] Figure 1 shows the protocol interaction flow of the PTP model;

[0082] Figure 2 is a flowchart of the time synchronization parameter joint tracking method based on unknown Kalman filtering described in Example 2. Detailed Implementation

[0083] The following specific examples illustrate the implementation of the present invention. Those skilled in the art can easily understand other advantages and effects of the present invention from the content disclosed in this specification. The present invention can also be implemented or applied through other different specific embodiments, and various details in this specification can be modified or changed based on different viewpoints and applications without departing from the spirit of the present invention. It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Unless otherwise specified, the following embodiments and features can be combined with each other.

[0084] It should be noted that the illustrations provided in the following embodiments are only schematic representations of the basic concept of the present invention. Therefore, the drawings only show the components related to the present invention and are not drawn according to the actual number, shape and size of the components in the actual implementation. In the actual implementation, the form, quantity and proportion of each component can be arbitrarily changed, and the layout of the components may also be more complex.

[0085] In the following description, numerous details are explored to provide a more thorough explanation of embodiments of the invention. However, it will be apparent to those skilled in the art that embodiments of the invention may be practiced without these specific details. In other embodiments, well-known structures and devices are shown in block diagram form rather than in detail to avoid obscuring embodiments of the invention.

[0086] Example 1:

[0087] This invention provides a joint clock frequency offset and clock phase offset tracking method based on Kalman filtering for unknowns. Targeting network communication scenarios with dynamically changing ambient temperatures, it considers the impact of temperature changes on clock synchronization accuracy. The method models the variation of the clock crystal output frequency with its ambient temperature as a quadratic function, and introduces the temperature influence factor as an unknown into the clock parameter tracking state equation, constructing a joint tracking state space model for clock phase offset and clock frequency offset under dynamically changing ambient temperatures. The highly dynamically changing temperature of the real environment is modeled as an unknown influence factor. Based on the Kalman filtering concept and using minimum variance unbiased estimation as the criterion, combined with a precise time synchronization protocol, parameter tracking of clock phase offset and clock frequency offset, including unknown inputs, is achieved. This overcomes the problem of decreased clock synchronization parameter tracking accuracy caused by ambient temperature changes.

[0088] This method considers the impact of dynamic temperature changes in the network on clock synchronization accuracy. It models the variation of the clock crystal output frequency with its ambient temperature as a quadratic function, introducing it as an unknown quantity into the clock parameter tracking state equation. This constructs a joint tracking state space model for clock phase offset and clock frequency offset under dynamic ambient temperature changes. Combined with a precise time synchronization protocol, it achieves parameter tracking of clock phase offset and clock frequency offset, including unknown input quantities. The method specifically includes the following steps:

[0089] S1: For network communication scenarios with dynamic changes in ambient temperature, the clock crystal output frequency and its variation with the ambient temperature are modeled as a quadratic function, and the temperature influence factor is introduced as an unknown into the clock parameter tracking state equation.

[0090] The frequency-temperature characteristics of crystal oscillators typically exhibit a parabolic relationship, meaning that the frequency drift is minimal near a specific temperature point (called the inflection point temperature), while the frequency drift intensifies as the temperature moves away from this point. Therefore, accurately modeling the effect of temperature on crystal oscillator frequency and employing appropriate compensation techniques are crucial for improving the accuracy and stability of clock models.

[0091] Therefore, this invention reduces the impact of temperature on time synchronization by measuring temperature changes and calibrating the clock frequency based on an empirical model. The output frequency is highly correlated with temperature, modeled as: f k =f0(1+β(T) k -T0) 2 )

[0092] Where β represents the temperature coefficient, T0 represents the transition temperature, and T k f represents the temperature value at time k, f0 represents the nominal frequency (the rated oscillation frequency of the crystal oscillator under standard environmental conditions), f k This represents the actual output frequency.

[0093] The clock output is essentially a count of clock ticks, and the duration of each clock tick is determined by the frequency of the crystal oscillator. The frequency of the crystal oscillator drifts with temperature changes, i.e., the frequency f... k It is temperature T k The function. When the actual frequency f k When there is a difference between the clock frequency and the nominal frequency f0, the duration of the clock tick deviates from the ideal value, causing clock skew. This frequency deviation accumulates over time, resulting in a significant discrepancy between the clock output and the actual time, known as clock frequency offset, which is specifically expressed as:

[0094] Where, δ kThe clock frequency offset of the node, combined with the formula for the high correlation between frequency and temperature and the expression for clock frequency offset, allows us to derive the relationship between temperature and node clock frequency offset: δ k =δ0+β(T) k -T0) 2 +ω k

[0095] Where, ω k The clock frequency offset noise of the representative node.

[0096] When the temperature sampling interval is sufficiently small, the recursive equation for the clock frequency offset can be expressed as the sum of the clock frequency offset from the previous sampling time and the temperature change with unknown coefficients. The recursive equation for the clock frequency offset can be expressed as:

[0097] in, μk As an unknown quantity, the temperature variable, an unknown factor, is treated as the unknown quantity μ. k Impact factor; ω k,δ This indicates that the mean is zero and the variance is... Clock frequency offset noise.

[0098] Clock phase offset refers to the difference between the clock readings of two nodes. Specifically, it is the time difference displayed by clocks at different nodes at the same moment. It can be expressed as: θ(t) = D A (t)-D B (t)

[0099] Where D A (t) represents the time at node A, and D B (t) represents the time of node B.

[0100] Meanwhile, the clock phase offset can be calculated using the clock frequency offset formula: θ(t)=δ(t)τ+θ0

[0101] Where δ(t) represents the clock frequency offset, τ represents the sampling time, and θ0 represents the initial value of the clock phase offset.

[0102] As mentioned above, when the sampling interval is sufficiently small, the recursive equation for clock phase offset can be expressed as the sum of the clock phase offset from the previous sampling time and the clock frequency offset change with the sampling coefficient τ. The recursive equation for clock phase offset can be expressed as: θ k =θ k-1 +Δτδ k-1 +ω θ,k

[0103] Where Δτ represents the sampling interval, δ k-1 ω represents the clock frequency offset at the previous moment. θ,k This indicates that the mean is zero and the variance is... Clock phase bias noise.

[0104] Based on the above derivation formulas for clock frequency offset and clock phase offset, let X k =[θ k ,δ k ] T Representing the PTP clock state vector, the above state transition equation can be rewritten in matrix form as follows: X k+1 =AX k +Bμ k +W k

[0105] Among them, W k =[ω θ,k ,δ δ,k ] T Let be the process noise vector, and its covariance matrix be...

[0106] S2: Utilize the two-way information exchange process of the precise time synchronization protocol to establish the clock observation equation, and combine it with the clock state equation to construct a joint tracking state space model of clock phase offset and clock frequency offset under dynamic changes in ambient temperature.

[0107] Precision time synchronization protocols are primarily used in industrial networks to ensure clock synchronization between devices with microsecond or even nanosecond precision. Its working principle involves calculating network latency and clock skew by exchanging timestamp messages, thereby adjusting the clock time. As shown in Figure 1, the main steps are as follows:

[0108] (1) The master clock periodically sends synchronization request information Sync and records the sending time t1;

[0109] (2) The clock records the precise time t2 when the Sync message arrives;

[0110] (3) After the master clock periodically sends the synchronization request information Sync, it will send a Follow_up message, which contains the precise time;

[0111] (4) Send a Delay_Req message from the slave clock and record the exact time t3 when the message leaves the slave clock;

[0112] (5) The master clock records the exact time t4 when the Delay_Req message arrives; then the master clock sends a Delay_Resq message containing the time t4 to the slave clock.

[0113] The essence of PTP time synchronization is to dynamically adjust the slave clock's time to match the master clock by measuring clock skew and network latency. However, in real-world environments, the impact of temperature on clock crystals is significant. In environments with dynamically changing temperatures, the clock frequency may drift significantly in a short period, leading to increased time synchronization errors. Reducing the impact of dynamic temperature on time synchronization is one of the key factors in ensuring synchronization accuracy and stability.

[0114] This invention utilizes the interaction of the PTP clock model to write the clock parameters between nodes as follows:

[0115] Where, d ms and d sm This represents path delay. In the equations above, clock offset is calculated as the slave node's time minus the master node's time, and adjusted using delay. The slave node only observes the timestamps and is unaware of the one-way delay. The slave node can calculate the following timestamp difference, expressed as:

[0116] Among them, t 21 [n] and t 43 [n] represents the timestamp difference. Clock skew estimation typically assumes a symmetrical delay. Therefore, we can obtain:

[0117] in, Representing the observed offset, and combining the above formulas, we can obtain the actual generated noise clock offset measurement, expressed as:

[0118] Where ω[n] represents the clock phase offset observation noise.

[0119] Frequency offset compensation is crucial for clock phase offset estimation. In PTP networks, slave nodes synchronize their time counters based on frequency offset measurements. A common method for frequency offset measurement is based on the discrete-time derivative of θ[n]. Therefore, in discrete time, the frequency offset is expressed as:

[0120] Where t1[n]-t1[nN] is the time interval between θ[n] and θ[nN]. Therefore, the actual generated noise clock frequency offset can be obtained, expressed as:

[0121] in, The actual noise clock frequency offset represents the actual generated noise clock frequency offset. The actual noise clock frequency offset measurement value can be obtained and expressed as:

[0122] Where υ[n] represents the clock frequency offset observation noise.

[0123] Integrating the derivation of the above formulas, let This represents the PTP clock observation vector, which can be rewritten in matrix form: Z k =CX k +V k

[0124] in, This represents the noise observed by the node clock.

[0125] The PTP state transition model incorporates a temperature factor to model the evolution behavior of the PTP clock. This model is not only suitable for evaluating the impact of clock noise on clock stability, but also supports the simulation and implementation of the PTP clock synchronization protocol using low-complexity iterative filtering techniques. Based on this, the PTP clock state transition equation can be expressed as:

[0126] Where τ represents the sampling interval, ω θ,k The mean is zero and the variance is . The clock phase offset, ω k,δ The mean is zero and the variance is . The clock frequency offset value.

[0127] Based on the clock phase offset and clock frequency offset observation equations obtained during bidirectional communication using the PTP protocol, the state-space model of PTP can be constructed as follows:

[0128] Where, μ k W represents the input of an unknown quantity. k The representative process noise has a mean of zero and a covariance of Q and V. k This represents observation noise, with a mean of zero and a covariance of R. As can be seen from our constructed state-space model, treating the temperature variable as an unknown input requires no prior assumptions.

[0129] S3: Using Kalman filtering with unknowns and taking minimum variance unbiased estimation as the criterion, the clock frequency offset and clock phase offset are jointly tracked for the established clock state-space model.

[0130] The established PTP state-space model can be reduced to a nonlinear discrete dynamic model with unknown input noise interference. For this state-space model, due to the nonlinear nature of the derived state equations, traditional Kalman filtering cannot be directly used for estimating system state variables. Therefore, this invention develops an estimation method based on the Kalman filtering principle for tracking clock parameters. This algorithm can estimate clock synchronization parameters in a minimum variance unbiased manner. The algorithm steps can be summarized as follows:

[0131] (1) State prediction: Let the prior estimate of the state vector be expressed as It can be calculated using the following equation:

[0132] in, It is X k-1 An unbiased estimate.

[0133] (2) Estimation of unknown inputs: Let Represents a fixed unknown input quantity μ k The unbiased estimator is defined by the analytical expression as follows:

[0134] Among them, H k The gain matrix is ​​for unknown input quantities.

[0135] (3) Measurement update: Let X represents k The posterior state estimate can be expressed by the following equation:

[0136] Among them, K k The state estimation gain matrix is ​​used to obtain X. k The minimum variance unbiased estimate.

[0137] Based on the above analysis, the problem of estimating the unknown Kalman filter is transformed into solving for two optimal gain matrices, namely M. k Unknown input gain matrix and K k State estimation gain matrix. The following will detail the three main steps. First, the purpose of the first step, state prediction, is to obtain a priori estimates based on the state equations. and prior covariance P k|k-1 Specifically, let X represents time k-1 k-1 The posterior unbiased estimate can be obtained by calculating the equation. And we know from the following lemma that, It is an unbiased estimate, therefore definition The prediction error is:

[0138] Among them, e x,k|k-1 express The estimation error. Therefore, the prior estimated covariance matrix can be given by the following equation: P k|k-1 =E[e x,k|k-1 e x,k|k-1 T ] = AP k-1|k-1 A T+Q = AP k-1|k-1 A T +Q

[0139] Among them, P k-1|k-1 =E[e x,k-1|k-1 e x,k-1|k-1 T ] represents the posterior estimation error covariance matrix.

[0140] Lemma: Assumption If H is unbiased, then the estimation of the unknown input in the second step is unbiased if and only if H... k Satisfying H k CB = I.

[0141] Proof: Because It is unbiased, and the mean of the process noise is zero, therefore E(e) can be obtained. x,k|k-1 ) = 0. Combining this with equation e x,k|k-1 From the definition, we can know that:

[0142] Therefore, for all k, All are unbiased.

[0143] Consider how to find the gain matrix H k This makes unknown input quantity μk The minimum variance unbiased estimate. From the observation equation, we know that the measurement residual r... k It can be expressed by the following formula:

[0144] in Substituting this into the equation for estimating the unknown input, we can obtain...

[0145] because Both are unbiased, υ k The mean of all of them is zero. Therefore The mean can be given by the following formula:

[0146] Therefore, as long as the gain matrix H k Satisfying H k If CB = I, then the unknown input quantity is estimated. This is an unbiased estimate. Furthermore, there is a theorem that... It is the minimum variance unbiased estimate.

[0147] Theorem: Estimation of unknown input quantities in the form of equations For the minimum variance unbiased estimate, H is obtained if and only if H k for:

[0148] Among them, F k =CB, then estimate the unknown input quantity. The minimum variance unbiased estimate can be obtained through r k Given that the variance of this unknown input estimate is:

[0149] Proof: Under the assumption If the matrix is ​​positive definite, an invertible matrix can always be found. satisfy Therefore, we can use Koleski decomposition and apply the weighting factors as follows: The weighted least squares estimation method can be used to derive the minimum variance unbiased estimate. Specifically, multiply both sides of the equation by... We can obtain:

[0150] Clearly, the equation satisfies the conditions of Gauss-Markov's theorem. Therefore, the minimum variance unbiased estimate can be derived using the least squares estimation method. for:

[0151] at this time, The variance is:

[0152] Minimum variance unbiased estimation Substituting into the initial equation for estimating the unknown input, H k It can be represented as:

[0153] The proof is complete.

[0154] It is worth noting that this theorem can be used to derive the unknown input quantity μ. k Minimum variance unbiased estimator This estimator also belongs to the category of optimal linear unbiased estimators. Finally, the measured value Z is used. k Prior state estimation By updating, a posterior state estimate with minimum variance and unbiased property can be derived. and the posterior covariance matrix P k|k Specifically, according to the equation, the posterior state estimation error can be given by the following formula: (IK k A)e x,k|k-1 -K k CBμ k -K k υ k

[0155] Because of ex,k|k-1 and υk The mean of is zero, therefore, if and only if K k Satisfy, K k =L k +(IL k C)BH k .in This is an unbiased estimate. At this point, the posterior covariance matrix P... k|k , can be represented as:

[0156] Combining the above equations, the optimal posterior state estimate is... and its covariance matrix P k|k , can be represented as: K k =L k +(IL k C)BH k

[0157] Based on the above derivation and analysis, the clock frequency offset and clock phase offset of the precise time synchronization protocol can be jointly tracked by using the unknown Kalman filter.

[0158] Example 2:

[0159] Figure 2 is a flowchart of a clock synchronization parameter tracking method based on unknown Kalman filtering according to an embodiment of the present invention. The present invention provides a clock synchronization parameter tracking method based on unknown Kalman filtering, as shown in Figure 2, with the following specific steps:

[0160] V1: Initializes the state-space model parameters, including initial state values ​​and initial covariance.

[0161] V2: Given the initial state estimate, predict the state for the next moment to obtain the prior state estimate and prior covariance.

[0162] V3: Find the gain matrix such that let For unknown input quantity μ k The minimum variance unbiased estimate.

[0163] V4: Combines prior estimates, prior covariance, and Kalman filter gain to estimate the unknown input.

[0164] V5: Using the estimated unknown inputs and the gain matrix, the posterior estimate and posterior covariance of the correction phase are obtained. This enables joint tracking of clock parameters with unknown inputs.

[0165] Example 3:

[0166] An electronic device, comprising a memory and a processor;

[0167] The memory is used to store computer programs;

[0168] The processor is configured to implement the method described in Embodiment 1 when executing the computer program.

[0169] Example 4:

[0170] A computer-readable storage medium storing a computer program that, when executed by a processor, implements the method described in Embodiment 1.

[0171] Example 5:

[0172] A computer program product includes a computer program that, when executed by a processor, implements the method described in Example 1.

[0173] In the above embodiments, the reference to "this embodiment" in the specification indicates that a specific feature, structure, or characteristic described in connection with the embodiment is included in at least some embodiments, but not necessarily all embodiments. Multiple appearances of "this embodiment" do not necessarily refer to the same embodiment.

[0174] In the above embodiments, although the invention has been described in conjunction with specific embodiments thereof, many substitutions, modifications, and variations of these embodiments will be apparent to those skilled in the art from the foregoing description. For example, other memory structures (e.g., dynamic RAM (DRAM)) may be used with the embodiments discussed. The embodiments of the invention are intended to cover all such substitutions, modifications, and variations falling within the broad scope of the appended claims.

[0175] As will be understood by those skilled in the art, the computer-readable storage medium described in this embodiment allows for the implementation of all or part of the steps in the above method embodiments by computer program-related hardware. The aforementioned computer program can be stored in a computer-readable storage medium. When executed, the program performs the steps of the above method embodiments; and the aforementioned storage medium includes various media capable of storing program code, such as ROM, RAM, magnetic disks, or optical disks.

[0176] The electronic terminal provided in this embodiment includes a processor, a memory, a transceiver, and a communication interface. The memory and the communication interface are connected to the processor and the transceiver and complete communication between them. The memory is used to store computer programs, the communication interface is used to perform communication, and the processor and the transceiver are used to run the computer programs, so that the electronic terminal performs the steps of the above method.

[0177] In this embodiment, the memory may include random access memory (RAM) and may also include non-volatile memory, such as at least one disk storage device.

[0178] The processors mentioned above can be general-purpose processors, including central processing units (CPUs), network processors (NPs), etc.; they can also be digital signal processors (DSPs), application-specific integrated circuits (ASICs), field-programmable gate arrays (FPGAs), or other programmable logic devices, discrete gate or transistor logic devices, or discrete hardware components.

[0179] This invention can be used in a wide range of general-purpose or special-purpose computing system environments or configurations. Examples include: personal computers, server computers, handheld or portable devices, tablet devices, multiprocessor systems, microprocessor-based systems, set-top boxes, programmable consumer electronics, network PCs, minicomputers, mainframe computers, and distributed computing environments including any of the above systems or devices, etc.

[0180] This invention can be described in the general context of computer-executable instructions, such as program modules, that are executed by a computer. Generally, program modules include routines, programs, objects, components, data structures, etc., that perform a specific task or implement a specific abstract data type. This invention can also be practiced in distributed computing environments where tasks are performed by remote processing devices connected via a communication network. In distributed computing environments, program modules can reside in local and remote computer storage media, including storage devices.

[0181] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention and are not intended to limit it. Although the present invention has been described in detail with reference to preferred embodiments, those skilled in the art should understand that modifications or equivalent substitutions can be made to the technical solutions of the present invention without departing from the spirit and scope of the present invention, and all such modifications or substitutions should be covered within the scope of the claims of the present invention.

Claims

1. A time synchronization parameter tracking method based on unknown quantity Kalman filtering, characterized in that: Includes the following steps: S1: For network communication scenarios with dynamic changes in ambient temperature, the clock crystal output frequency and its variation with the ambient temperature are modeled as a quadratic function, and the temperature influence factor is introduced as an unknown into the clock parameter tracking state equation. S2: Utilize the two-way information exchange process of the precise time synchronization protocol to establish the clock observation equation, and combine it with the clock state equation to construct a joint tracking state space model of clock phase offset and clock frequency offset under dynamic changes in ambient temperature. S3: Using Kalman filtering with unknowns and taking minimum variance unbiased estimation as the criterion, the clock frequency offset and clock phase offset are jointly tracked for the established clock state-space model.

2. The time synchronization parameter tracking method based on unknown quantity Kalman filtering according to claim 1, characterized in that: Step S1 specifically includes the following steps: S11: Measure temperature changes and calibrate the clock frequency using an empirical model, modeling the output frequency as highly correlated with temperature as follows: f k = f0(1 + β(T k - T0) 2 ) wherein β represents a temperature coefficient, T0represents a conversion temperature, T k represents a temperature value at time k, f0represents a nominal oscillation frequency of the crystal oscillator under standard environmental conditions, i.e. a nominal frequency, f k represents an actual output frequency; S12: The frequency of the crystal oscillator drifts with temperature changes, so that the actual frequency f k There is a difference between the nominal frequency f0and the actual frequency f, which accumulates over time, resulting in a clock frequency deviation between the clock output and the actual time, which is expressed as: where δ k The relationship between temperature and clock frequency offset of the node is derived by combining the frequency-temperature high correlation formula and the clock frequency offset expression: delta k = delta0 + beta (T k - T0) 2 + omega k where ω k represents the clock frequency offset noise impact of the representative node; δ0represents the initial value of the clock frequency offset; When the sampling interval of temperature is small enough, the recursive equation of clock frequency offset is expressed as: Where, μ k As an unknown quantity, the temperature variable unknown factor is taken as an unknown quantity μ k The impact factor; ω k,δ Indicates that the mean is zero, and the variance is Clock frequency offset noise; S13: Clock phase offset refers to the difference between the clock readings of two nodes, expressed as: θ(t) = D A (t) - D B (t) where D A (t) denotes the time at node A, D B (t) denotes the time at node B; Meanwhile, the clock phase offset θ(t) is calculated using the clock frequency offset formula: θ(t)=δ(t)τ+θ0 Where δ(t) represents the clock frequency offset, τ represents the sampling time, and θ0 represents the initial value of the clock phase offset; When the temperature sampling interval is sufficiently small, the recursive equation for clock phase offset is expressed as: θ k = θ k-1 + Δτδ k-1 + ω θ,k where Δτ represents the sampling interval, δ k-1 denotes the clock frequency offset at the previous time, ω θ,k denotes that the mean is zero and the variance is Clock phase offset noise; S14: Based on the derivation formula of clock frequency offset and clock phase offset, let X k = [θ k , δ k ] T represent the PTP clock state vector, and the state transition equation is rewritten in the form of matrix as follows: X k+1 = AX k + Bμ k + W k wherein, μ k represents unknown inputs; W k = [ω θ,k , δ δ,k ] T is a process noise vector with covariance matrix a variance value representing a clock state equation phase noise, This represents the variance of the frequency offset noise in the clock state equation.

3. The time synchronization parameter tracking method based on unknown quantity Kalman filtering according to claim 2, characterized in that: Step S2 specifically includes the following steps: S21: Use a precise time synchronization protocol to exchange timestamp messages, calculate network latency and clock skew, and adjust the time from the clock to achieve clock synchronization; S22: Using the PTP clock model interaction, write the clock parameters between nodes as: wherein d ms and d sm represent the path latency; θ[n] represents the clock phase offset at time n, t1[n], t2[n], t3[n], t4[n] represent the time stamps of the PTP protocol interaction; the following time stamp difference is calculated by the slave node, expressed as: where t 21 [n] and t 43 [n] represents the time stamp difference, for clock offset estimation usually is assumed symmetric delay, get: wherein Represents the observation offset; The actual generated noise clock offset measurement is calculated as follows: Where ω[n] represents the clock phase offset observation noise; S23: In discrete time, the frequency offset is expressed as: Where t1[n]-t1[nN] is the time interval between θ[n] and θ[nN]; The actual generated noise clock frequency deviation is: wherein This represents the actual noise clock frequency offset. The actual noise clock frequency deviation measurement value is: Where υ[n] represents the clock frequency offset observation noise; S24: Let The PTP clock observation vector is represented by the following matrix form: Z k = CX k + V k wherein, Represents node clock observation noise; S25: Introduce temperature factor in the state equation model of PTP, model the evolution behavior of PTP clock, and the state transition equation of the PTP clock is expressed as: Where τ represents the sampling interval; Based on the clock phase offset and clock frequency offset observation equations measured in the two-way communication process of the PTP protocol, a state space model of the PTP is constructed and expressed as: where μ k represents the unknown input, W k represents the process noise, with zero mean and covariance Q, V k represents the observation noise, with zero mean and covariance R.

4. The time synchronization parameter tracking method based on unknown quantity Kalman filtering according to claim 3, characterized in that: The steps for achieving clock synchronization using a precise time synchronization protocol described in step S21 are as follows: S211: The master clock periodically sends a synchronization request message Sync and records the sending time t1; S212: The clock records the precise time t2 when the Sync message arrives; S213: After the master clock periodically sends a synchronization request message Sync, it will send a Follow_up message containing the precise time. S214: Send a Delay_Req message from the slave clock and record the exact time t3 when the message leaves the slave clock; S215: The master clock records the exact time t4 when the Delay_Req message arrives; then the master clock sends a Delay_Resq message containing the time t4 to the slave clock.

5. The time synchronization parameter tracking method based on unknown quantity Kalman filtering according to claim 3, characterized in that: In step S3, the clock parameters are tracked using an estimation method based on the unknown Kalman filter to estimate the clock synchronization parameters in a minimum variance unbiased manner. This includes the following steps: S31: State prediction: Let the a priori estimate of the state vector be denoted as It can be calculated by the following equation: wherein is X k-1 an unbiased estimate of X S32: Unknown input estimation: Let denotes an unbiased estimate of the unknown input quantity μ k with the analytical expression defined as where H k is the unknown input gain matrix; S33: Measurement Update: Let represents X k the posterior state estimate of X is expressed by the following equation: where K k is a state estimation gain matrix used to obtain the minimum variance unbiased estimate of X k ; Thus the unknown input Kalman filter estimation problem is converted to the problem of solving two optimal gain matrices, i.e. M k unknown input gain matrix and K k state estimation gain matrix.

6. The time synchronization parameter tracking method based on unknown quantity Kalman filtering according to claim 5, characterized in that: Steps S31-S33 specifically include: The purpose of the state prediction is to obtain a priori estimates from the state equation and the prior covariance P k|k-1 ; Let represents the posterior unbiased estimate of X at time k - 1, computed by the equation k-1 ​ For an unbiased estimate, therefore Definitions The prediction error for the first frame is: wherein e x,k|k-1 represents an estimate error; ω k-1 denotes the prediction error noise at time k-1; The prior estimate of the covariance matrix is ​​given by the following equation: P k|k-1 = E[e x,k|k-1 e x,k|k-1 T ] = AP k-1|k-1 A T + Q = AP k-1|k-1 A T +Q where P k-1|k-1 = E[e x,k-1|k-1 e x,k-1|k-1 T ] represents the posteriori estimation error covariance matrix; Q represents the measurement process noise matrix; From the observation equation, the measurement residual r k is expressed by the following equation: wherein Bringing this into the unknown input estimation equation, we get: Due to are unbiased, υ k The mean of both is zero; hence The mean of the values of the function f(x) is given by the formula Thus, as long as the gain matrix H k satisfies H k CB = I, the unknown input estimate for an unbiased estimate, This is the minimum variance unbiased estimate; Adopting the measured value Z k On prior state estimation updating, deriving a posteriori state estimates with minimum variance unbiased properties and the posterior covariance matrix P k|k The posterior state estimation error is given by (I-K k A)e x,k|k-1 -K k CBμ k -K k υ k Since e x,k|k-1 and u k have zero mean, K k satisfies K k = L k + (I - L k C)BH k , L k denotes an unknown gain matrix, For an unbiased estimate, the posterior covariance matrix P k|k is expressed as: where H k represents an observation matrix mapping the state space to the measurement space, R k represents a covariance matrix of the measurement noise; optimal posterior state estimate and its covariance matrix P k|k are denoted as K k = L k + (I - L k C) BH k Through the above derivation analysis, the unknown quantity Kalman filter is used to realize joint tracking of clock frequency deviation and clock phase deviation of the precise time synchronization protocol.

7. An electronic device, comprising: comprising a memory and a processor; the memory, configured to store a computer program; the processor, configured to realize the unknown quantity Kalman filter-based joint tracking method of clock frequency deviation and clock phase deviation according to any one of claims 1-6 when executing the computer program.

8. A computer-readable storage medium, characterized in that, The storage medium has a computer program stored thereon, and the computer program realizes the unknown quantity Kalman filter-based joint tracking method of clock frequency deviation and clock phase deviation according to any one of claims 1-6 when executed by a processor.

9. A computer program product, characterised in that: comprising a computer program, which realizes the unknown quantity Kalman filter-based joint tracking method of clock frequency deviation and clock phase deviation according to any one of claims 1-6 when executed by a processor.