# A Two-Stage Kalman Filter-Based Carrier Tracking Loop for Weak GNSS Signals
## 4 KF-Based Two-Stage Carrier Tracking Loop
### KF-Based Coarse-to-Fine Carrier Tracking Algorithm
After successful bit synchronization, the effect of the navigation data bit transition is wiped off; hence, the integration time can be extended to 20 ms. First, read out the correlator outputs of the prompt branch and initialize the KF parameters: The process noise covariance matrix, \(\mathbf{Q}\); the measurement noise covariance matrix, \(\mathbf{R}\); the state vector, \(\mathbf{x}_{k}\); and the state error covariance matrix, \(\mathbf{P}_{0}^{-}\). According to the previous section, the initiation of \(\mathbf{Q}\) depends on (13). The updated period of the KF-based loop, \(T\), can be designed according to the \(C/N_{0}\) estimate. If the estimated \(C/N_{0}\) is low, the updated period, \(T\), can be increased to track weak signals; otherwise, \(T\) cannot be set too long. The initialization of \(\mathbf{R}\) depends on (16). The initialization of \(\mathbf{x}_{k}\) and \(\mathbf{P}_{0}^{-}\) depends on the coarse tracking results. Then, the two-quadrant arctangent discriminator is performed to obtain the phase errors every \(T\)ms, which are used to provide the measurement values, \(\mathbf{z}_{k}\). Finally, use KF recursive equations iteratively to update the carrier phase error and the Doppler frequency. The obtained phase error and Doppler frequency are used to update the carrier NCO. In contrast to the standard KF-based tracking method, the KF initialization in the proposed strategy depends not on the acquired results, but on the coarse tracking results. The coarse tracking results are the FLL-assisted-PLL tracking loop results as shown in Figure 3. The two boxes in Figure 3 that are labeled with z\({}^{-1}\) from left to right represent the acceleration accumulator and the velocity accumulator, respectively. The prior state vector, namely, \(\hat{\mathbf{x}}_{0}=\left[ \begin{array}{cc}\Delta\hat{\varphi}_{0}&\hat{ \omega}_{0}&\hat{\alpha}_{0}\end{array} \right]^{\text{T}}\), can be initialized as follows:  
\[\hat{\mathbf{x}}_{0}=\left[ \begin{array}{c}\Delta\hat{\varphi}_{0}\\ \hat{\omega}_{0}\\ \hat{\alpha}_{0}\end{array} \right]=\left[ \begin{array}{c}0\\ (\delta\varphi\times P_{1}+\delta f\times F_{0}+S_{0})\times T+S_{1}\\ (\delta\varphi\times P_{0}+\delta f\times F_{1})\times T+S_{0}\end{array} \right] \tag{18}\]  
where \(\Delta\hat{\varphi}_{0}\), \(\hat{\omega}_{0}\), and \(\hat{\alpha}_{0}\) are the initial phase error, the initial carrier Doppler frequency, and the carrier Doppler frequency rate, respectively. The other variables are defined as in (8). Because the phase error result of the coarse tracking is less than 1, the initial phase error is set to 0. As shown in Figure 3, \(\hat{\omega}_{0}\) is set to the velocity accumulator result and \(\hat{\alpha}_{0}\) is set to the acceleration accumulator result. The maximum frequency error of the coarse tracking results is substantially less than that of the acquired results. Therefore, the convergence time of the KF-based fine tracking will be reduced. Furthermore, if the initial value of the Doppler frequency is more accurate, the possibility of a false frequency-lock in the KF-based fine tracking loop will be greatly reduced, especially under weak signal conditions.