# An Improved PSO Algorithm and Its Application in GNSS Ambiguity Resolution
## 2 Materials and Methods
### Mathematical Model of GNSS Positioning  
The positioning observations of GNSS mainly include the pseudorange and carrier phase, denoted as \(P_{r}^{s}\) and \(\phi_{r}^{s}\), respectively, in the receiver-satellite pair \(r-s\). The equations of GNSS observations [29; 30] can be formulated as  
\[ \begin{array}{l}P_{r}^{s}=\rho_{r}^{s}+T_{r}^{s}+I_{r}^{s}+c(dt_{r}-dt^{s})+ e_{r}^{s}\\ \phi_{r}^{s}=\rho_{r}^{s}+T_{r}^{s}-I_{r}^{s}+c(dt_{r}-dt^{s})+\lambda N_{r}^{ s}+\varepsilon_{r}^{s}\end{array} , \tag{1}\]where \(\rho_{r}^{s}\) is the satellite-receiver range; \(T_{r}^{s}\) and \(l_{r}^{s}\) are the troposphere delay and ionosphere delay, respectively; \(dt_{r}\) is the receiver clock error, \(dt^{s}\) is the satellite clock error; \(N_{r}^{s}\) is the carrier phase ambiguity; \(c\) is the speed of light; \(e_{r}^{s}\) and \(\varepsilon_{r}^{s}\) are the remaining error terms; and \(\lambda\) is the wavelength of the corresponding carrier phase. Through Equation (1), we find that the pseudorange and carrier phase observation have similar structures. Moreover, the latter contains an ambiguity term. This finding implies that as long as ambiguity is resolved correctly, the carrier phase observation will be transformed into the high-precision receiver-satellite pseudorange. Equation (1) includes two clock bias terms. The classical double differenced (DD) model is usually adopted to eliminate these biases. DD observations are based on simultaneous observations from two receivers and two satellites. These observations can be described as follows:  
\[ \begin{array}{l}p_{qr}^{ls}=\rho_{qr}^{ls}+T_{qr}^{ls}+l_{qr}^{ls}+\rho_{qr }^{ls}\\ \phi_{qr}^{ls}=\rho_{qr}^{ls}+T_{qr}^{ls}-l_{qr}^{ls}+\lambda Nl_{qr}^{ls}+ \epsilon_{qr}^{ls}\end{array} \, \tag{2}\]  
where \(\rho_{qr}^{ls}=\rho_{r}^{s}-\rho_{r}^{l}-(\rho_{q}^{s}-\rho_{q}^{l})\), and other terms are similar with \(\rho_{qr}^{ls}\). \(T_{qr}^{ls}\) and \(l_{qr}^{ls}\) in Equation (2) can be ignored if the baseline length is relatively short (usually less than 10 km) [31; 32]. The satellite-receiver range term (\(\rho_{qr}^{ls}\)) includes the coordinate parameters of satellites and receivers. The former can be obtained from known ephemeris. \(\rho_{qr}^{ls}\) can be linearized with respect to unknown receiver coordinates, represented as the baseline vector in the DD model. The estimated parameters in Equation (2) include three baseline vectors and several ambiguity parameters. The parameter resolution model is an example of a mixed integer-linearized model. The GNSS DD model can be described as follows:  
\[y=Aa+Bb+e,Q_{yy} \tag{3}\]  
where \(y\) denotes the \(m\)-dimensional pseudorange and carrier phase observations; \(b\) denotes the three-dimensional baseline vector; \(a\) denotes \(n\)-dimensional real-valued ambiguity parameters; \(e\) denotes the \(m\)-dimensional residual errors of observations; \(A\) denotes the design matrix that corresponds to \(a\); \(B\) denotes the design matrix that corresponds to \(b\); \(Q_{yy}\) denotes the variance-covariance (VC) matrix that corresponds to the DD pseudorange and carrier phase observation vectors. We can obtain the solutions of \(a\) and \(b\) through the least-squares (LS) estimation method, which mainly consists of three steps. We ignore the integrate property of ambiguity parameters in the first step, and use the standard LS method to obtain the real-valued baseline vector and ambiguity parameters. \[ \begin{array}{l}\left[\begin{array}{c}\hat{a}\\ \hat{b}\end{array}\right]=\left[\begin{array}{cc}\hat{Q}_{\hat{a}\hat{b}}& \hat{Q}_{\hat{a}\hat{b}}\\ \hat{Q}_{\hat{b}\hat{a}}&\hat{Q}_{\hat{b}\hat{b}}\end{array}\right]\left[ \begin{array}{c}A^{T}\\ B^{T}\end{array}\right]Q_{yy}^{-1}y\\ Cov\left[\begin{array}{c}\hat{a}\\ \hat{b}\end{array}\right]=\left[\begin{array}{cc}\hat{Q}_{\hat{a}\hat{b}}& \hat{Q}_{\hat{a}\hat{b}}\\ \hat{Q}_{\hat{b}\hat{a}}&\hat{Q}_{\hat{b}\hat{b}}\end{array}\right]\end{array}