# 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  
The KF-based tracking loop uses the estimated phase and frequency to predict the estimated values at the next epoch. If the navigation bit sign is flipped, the 180-degree phase ambiguity will occur. In this situation, the KF-based tracking loop will estimate the results incorrectly during the iteration, and the KF-based tracking loop may eventually lose lock. Accordingly, the KF-based tracking method should be used after the data bit signs are known. As demonstrated above, the coarse tracking algorithm can achieve bit synchronization. If bit synchronization is not successful, fine tracking will not be performed. In this way, bit signs in the fine tracking have been well estimated already. Figure 4 depicts the block diagram of the KF-based coarse-to-fine carrier tracking architecture. The in-phase and quadrature integration results of the prompt branch are sent to the coarse tracking loop. The coarse tracking stage reduces the frequency error to achieve bit synchronization. The main function of the frequency pulling algorithm is to reduce the acquired frequency error to the working range of the FLL-assisted-PLL tracking loop, as shown in Figure 2. The FLL-assisted-PLL tracking loop obtains a rough estimate of the carrier Doppler frequency and phase to achieve bit synchronization. Then, if bit synchronization is successfully achieved, the fine tracking stage will employ the KF algorithm to accurately estimate the phase and Doppler frequency. Finally, the output of the KF-based fine tracking is used to update the frequency and phase of the carrier NCO. The steps of the algorithm are detailed as follows:  
1. Initialization. Initialize the bandwidths and coefficients of the PLL and FLL for the coarse tracking stage. Set \(B_{nPLL}\), \(B_{nFLL}\), and the coefficients of the second-order FLL and third-order PLL for the FLL-assisted-PLL tracking loop. 2. The first step of the coarse tracking: Frequency pulling. First, set the integration time, \(T_{\text{pull}}=1\) ms, to ensure fast convergence to the steady state and read out the correlator outputs of the prompt branch. Then, calculate the phase error, \(\delta\varphi\), from the four-quadrant arctangent discriminator every 1 ms. To eliminate the outliers of the frequency error, \(\delta f_{i}\), save 20 frequency errors and use the maximum likelihood estimator in (7) to obtain the frequency residual, \(\delta f_{out}\). Finally, use the frequency error to update the carrier NCO. Figure 4: Block diagram of the KF-based coarse-to-fine carrier tracking strategy. (KF: Kalman filter). 3. The second step of the coarse tracking: The FLL-assisted-PLL tracking loop. When the frequency pulling algorithm has finished, the tracking stage switches to the FLL-assisted-PLL tracking loop. First, in the second-order FLL, the integration time, \(T\), is set to \(T_{\text{FFLL}}\). Next, the cross-product discriminator is used to obtain the frequency error, \(\delta f\), every \(2\cdot T_{\text{FFLL}}\)ms. Then, in the third-order PLL, the two-quadrant arctangent discriminator is utilized to obtain the phase error, \(\delta\varphi\), every \(T_{\text{FFLL}}\)ms. Finally, update the tracking loop via (8). 4. Bit synchronization. If \(t>1000\) ms, bit synchronization is employed. \(t\) denotes the number of times that the tracking procedure enters the coarse tracking stage and this typically occurs every 1 ms. 1000 ms represents that 1 bit navigation data has entered the coarse tracking stage. Only when \(t>1000\) ms can the bit synchronization be employed. Once bit synchronization succeeds, the KF-based fine tracking will be implemented; otherwise, coarse tracking will continue. 5. KF-based fine tracking.