## 2 Algorithm Principle
### INS + LEO2 Alternate Switching + Altimeter Integrated Navigation Algorithm
#### 2.4.2 Algorithm Processing Flow  
According to Figure 3, at time \(T_{1}\), let LEO-1 use the real ranging value \(\rho_{1 LEO}\) and LEO-2 use the virtual ranging value \(\hat{\rho}_{2}\). At this time, we can obtain:  
\[\left\{\begin{array}{l}\rho_{1 LEO}=\sqrt{\left(x_{1}-x_{c}\right)^{2}+\left( y_{1}-y_{c}\right)^{2}+\left(z_{1}-z_{c}\right)^{2}}\\ \hat{\rho}_{2}=\sqrt{\left(x_{2}-\hat{x}_{c}\right)^{2}+\left(y_{2}-\hat{y}_{c }\right)^{2}+\left(z_{2}-\hat{z}_{c}\right)^{2}}\\ \rho_{1 INS}=\sqrt{\left(x_{1}-x_{INS}\right)^{2}+\left(y_{1}-y_{INS}\right)^{2 }+\left(z_{1}-z_{INS}\right)^{2}}\\ \rho_{2 INS}=\sqrt{\left(x_{2}-x_{INS}\right)^{2}+\left(y_{2}-y_{INS}\right)^{2 }+\left(z_{2}-z_{INS}\right)^{2}}\\ \frac{x_{c}^{2}}{\rho_{0-INS}^{2}+\frac{y_{c}^{2}}{\rho_{0-INS}^{2}}+\frac{z_{ 2}^{2}}{\rho_{0-INS}^{2}}=1}\\ \frac{x_{c}^{2}}{\rho_{0-Re}^{2}+\frac{y_{c}^{2}}{\rho_{0-Re}^{2}}+\frac{z_{ 2}^{2}}{\rho_{0-Re}^{2}}=1}\\ \end{array}\right.. \tag{36}\]  
Figure 3: INS + LEO2 alternate switching + altimeter integrated navigation algorithm principle diagram.  
Similar to the processing of Formula (17), we use the following difference of Formula (19) as the filtering observation of the system algorithm.  
\[\left\{\begin{array}{l}\hat{\rho}_{1-INS}=\rho_{1\text{LEO}}-\rho_{1 INS}\\ \hat{\rho}_{2-INS}=\hat{\rho}_{2}-\rho_{2 INS}\\ \rho_{0}=(\frac{1}{\rho_{0-R_{c}}^{2}}-\frac{1}{\rho_{0-IN}^{2}})/(\frac{1}{ \rho_{\text{P-R_{c}}}^{2}}-\frac{1}{\rho_{\text{P-IN}}^{2}})\end{array}\right.. \tag{37}\]  
At time \(T_{2}=T_{1}+\Delta T\), let LEO-1 use the virtual ranging value \(\hat{\rho}_{1}\) and let LEO-2 use the real ranging value \(\rho_{2\text{LEO}}\). At this time, we can obtain:  
\[\left\{\begin{array}{l}\check{\rho}_{1}=\sqrt{\left(x_{1}-\bar{x}_{c}\right) ^{2}+\left(y_{1}-\bar{y}_{c}\right)^{2}+\left(z_{1}-\bar{z}_{c}\right)^{2}} \\ \rho_{2 LEO}=\sqrt{\left(x_{2}-x_{c}\right)^{2}+\left(y_{2}-y_{c}\right)^{2}+ \left(z_{2}-z_{c}\right)^{2}}\\ \rho_{1 INS}=\sqrt{\left(x_{1}-x_{INS}\right)^{2}+\left(y_{1}-y_{INS}\right)^{ 2}+\left(z_{1}-z_{INS}\right)^{2}}\\ \rho_{2 INS}=\sqrt{\left(x_{2}-x_{INS}\right)^{2}+\left(y_{2}-y_{INS}\right)^{ 2}+\left(z_{2}-z_{INS}\right)^{2}}\\ \frac{x_{c}^{2}}{\hat{\rho}_{0-IN}^{2}}+\frac{y_{c}^{2}}{\hat{\rho}_{0-IN}^{2} }+\frac{z_{c}^{2}}{\hat{\rho}_{\text{P-IN}}^{2}}=1\\ \frac{x_{c}^{2}}{\hat{\rho}_{0-R_{c}}^{2}}+\frac{y_{c}^{2}}{\hat{\rho}_{0-R_{c} }^{2}}+\frac{z_{c}^{2}}{\hat{\rho}_{\text{P-R_{c}}}^{2}}=1\end{array}\right.. \tag{38}\]  
In the same way, we use the following difference in Equation (21) as the filtering observation of the system algorithm.  
\[\left\{\begin{array}{l}\hat{\rho}_{1-INS}=\check{\rho}_{1}-\rho_{1 INS}\\ \check{\rho}_{2-INS}=\rho_{2 LEO}-\rho_{2 INS}\\ \rho_{0}=(\frac{1}{\rho_{0-R_{c}}^{2}}-\frac{1}{\rho_{0-IN}^{2}})/(\frac{1}{ \rho_{\text{P-R_{c}}}^{2}}-\frac{1}{\rho_{\text{P-IN}}^{2}})\end{array}\right.. \tag{39}\]  
From now on, this alternate switching process will be repeated, that is, every \(\Delta T\) time, the real and virtual ranging value of LEO-1 and LEO-2 are switched, until the end of the whole flight test time of the moving carrier.