# A Method for Autonomous Generation of High-Precision Time Scales for Navigation Constellations
## 3 Time Scale Algorithm Principle
### KPW Time Scale Algorithm  
The paper time calculated by the time scale algorithm can be regarded as a virtual atomic clock, so it can be assumed that the clock difference between it and the ideal time scale is \(x_{e}(t)\)[5], and the basic time scale equation is:  
\[x_{e}(t)=\sum_{i=1}^{n}\omega_{i}(t)(x_{i}(t)-\hat{x}_{i}(t)) \tag{1}\]  
where \(\omega_{i}(t)\) represents the weight of each atomic clock, \(x_{i}(t)\) represents the clock difference of each atomic clock, \(\hat{x}_{i}(t)\) represents the forecast value of each atomic clock difference; their deterministic trend terms have the same sign. Select an atomic clock with the best stability as a reference clock in the clock group, and its clock difference is \(x_{j}(t)\), and the clock difference between it and the paper time is \(x_{ej}(t)\):  
\[x_{ej}(t)=x_{e}(t)-x_{j}(t) \tag{2}\]  
Substitute Equation (2) into Equation (1) to get:  
\[x_{ej}(t)=\sum_{i=1}^{n}\omega_{i}(t)(x_{ij}(t)-\hat{x}_{ie}(t)) \tag{3}\]  
where \(x_{ij}(t)\) is the observed clock difference between each atomic clock and the reference clock, and \(\hat{x}_{ie}(t)\) is the clock difference prediction value of each atomic clock in the clock group relative to the virtual atomic frequency standard. According to the atomic clock difference model, \(\hat{x}_{ie}(t)\) can be expressed as  
\[\hat{x}_{ie}(t)=x_{ie}(t-\Delta t)+\tau\hat{y}_{ie}(t-\Delta t)+1/2D(t-\Delta t )^{2} \tag{4}\]  
where \(\Delta t\) represents the calculation interval and \(D\) represents the frequency drift of the atomic clock. Combining Equations (3) and (4), the KPW algorithm equation [8] can be obtained as:  
\[x_{ej}(t)=\sum_{i=1}^{n}\omega_{i}(t)(x_{\hat{y}}(t)-(x_{ie}(t-\Delta t)+\Delta t \hat{y}_{ie}(t-\Delta t)+1/2D(t-\Delta t)^{2}) \tag{5}\]  
It can be seen from Equation (5) that the key to the time scale algorithm is the weight \(\omega_{i}\) and the estimated value of the frequency difference \(\hat{y}_{ie}\). The estimated values \(\hat{y}_{ie}\) used in the KPW algorithm are calculated by Kalman filtering. Since the Kalman filter algorithm can effectively remove frequency white noise, frequency random walk noise and frequency random run noise, it can improve the frequency stability of the time scale algorithm output. The five basic equations of the Kalman filtering algorithm [7] are:  
\[\left\{ \begin{array}{ll}\hat{X}_{k,k-1}=AX_{k-1,k-1}&\text{(a)}\\ P_{k,k-1}=AP_{k-1,k-1}A^{\prime}+Q&\text{(b)}\\ K_{k}=P_{k,k-1}H^{\prime}[HP_{k,k-1}H^{\prime}+R]^{-1}&\text{(c)}\\ \hat{X}_{k,k}=\hat{X}_{k,k-1}+K_{k}[Z_{k}-H\hat{X}_{k,k-1}]&\text{(d)}\\ P_{k,k}=(I-K_{k}H)P_{k,k-1}&\text{(e)}\end{array} \right. \tag{6}\]The [PERSON] filtering algorithm is a consensus in related fields, and this article will not introduce the parameters in detail [7]. The following mainly introduces the specific parameter determination method in this paper. The system model of the atomic clock can be represented by a three-dimensional linear discrete system:  
\[\left[ \begin{array}{c}x(t+\Delta t)\\ y(t+\Delta t)\\ z(t+\Delta t)\end{array} \right]= \begin{bmatrix}1&t&\frac{1}{2}t^{2}\\ 0&1&t\\ 0&0&1\end{bmatrix} .\left[ \begin{array}{c}x(t)\\ y(t)\\ z(t)\end{array} \right]+\left[ \begin{array}{c}\Delta x\\ \Delta y\\ \Delta z\end{array} \right] \tag{7}\]  
where \(x(t)\), \(y(t)\), \(z(t)\) represent the three deterministic trend items of clock difference, frequency difference and frequency drift, respectively. \(\Delta x\), \(\Delta y\), \(\Delta z\) represent the errors caused by phase noise and frequency noise independent of the deterministic trend item, respectively. Its noise matrix is:  
\[W=\left[ \begin{array}{c}\Delta x\\ \Delta y\\ \Delta z\end{array} \right] \tag{8}\]  
The process noise covariance \(q\) of the Kalman filter is equal to the covariance matrix \(W\)[7], as shown in Equation (9)  
\[q=E[WW^{\prime}]= \begin{bmatrix}q_{1}t+q_{2}t^{3}/3+q_{3}t^{5}/20&q_{2}t^{2}/2 +q_{3}t^{4}/8&q_{3}t^{3}/6\\ q_{2}t^{2}/2+q_{3}t^{4}/8&q_{2}t+q_{3}t^{3}/3&q_{3}t^{2}/2\\ q_{3}t^{3}/6&q_{3}t^{2}/2&q_{3}t\end{bmatrix}