## 3 Positioning Algorithm of Smartphone  
### Regional Ionospheric Correction Model  
How to accurately extract the TEC value is the basis for inverting the ionospheric correction model using regional CORS observations. In this article, the carrier-smoothing pseudorange method is used to extract TEC. This method not only has high accuracy but also meets the real-time requirements of smartphones. The TEC value can be expressed as:  
\[TEC=\frac{f_{1}^{2}f_{2}^{2}}{40.28\big{(}f_{1}^{2}-f_{2}^{2}\big{)}}\big{(} \overline{P_{d}}+B^{s}+B_{r}\big{)} \tag{1}\]  
where \(B^{s}\) is the hardware delay on the satellite, \(B_{r}\) is the hardware delay on the receiver, \(f_{1},f_{2}\) is the first frequency and second frequency of a dual-frequency signal, \(\overline{P}_{d}\) is the smoothed dual-frequency pseudorange observations, \(\overline{P}_{d}=P_{2}-P_{1}\), \(P_{1},P_{2}\) is the first frequency and second frequency of the pseudorange observations. The smoothing formula is as follows:  
\[\overline{P}_{k}=a_{k}P_{k}+(1-a_{k})\big{(}\overline{P}_{k-1}+L_{k}-L_{k-1} \big{)} \tag{2}\]  
where the subscript \(k\) is observation epoch, \(L\) is the dual-frequency carrier observation; \(a\) is smoothing weight, the initial value of it is 1 and it decreases as the epoch increases. After being smaller than a certain threshold, it remains unchanged. Through GNSS observations, only the TEC on the signal propagation path can be extracted. In practical applications, the known points and the measured points are often far away. Therefore, it is necessary to extend the discrete data to the entire measurement area through a mathematical model. In this article, the spherical harmonics (SH) model is used to simulate the ionospheric distribution. The SH function can be expressed as:  
\[VTEC=\sum_{n=0}^{n_{\text{max}}}\sum_{m=0}^{n}\widetilde{C}_{nm}\big{(}\sin \varphi_{IPP}^{\prime}\big{)}\big{(}A_{nm}\cos m\theta+B_{nm}\sin m\theta \big{)} \tag{3}\]  
where \(VTEC\) is TEC in the vertical direction, \(n_{\text{max}}\) is the highest order of expansion, \(m\) is the number of expansions, \(\widetilde{C}_{nm}\) is the fully normalized Legendre function, \(\varphi_{IPP}^{\prime}\) is the geocentric latitude of the pierce point, \(\theta\) is the daily fixation accuracy of pierce point, and \(A_{nm},B_{nm}\) is the function model parameters. At present, the commonly used ionospheric file uses the 15-order spherical harmonic function model with a time interval of 2 h and 256 parameters to be estimated. For a small area, the parameters to be estimated can be reduced to 6, and the simplified equation can be expressed as:  
\[\begin{array}{c}VTEC=C_{0,0}(\sin\varphi_{IPP}^{\prime})A_{0,0}+C_{1,0}(\sin \varphi_{IPP}^{\prime})A_{1,0}\\ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \ \  
In this article, the Kalman filter is used to estimate real-time ionospheric model parameters. Assuming that the number of single-epoch CORS stations is \(n\), the number of observable satellites is \(m\), the state vector \(X\) and the observation vector \(Z\) are expressed as:  
\[ \begin{array}{l}X=\left[a_{1},\cdots,a_{6},B_{1},\cdots,B_{n},B^{1},\cdots,B^{ m}\right]^{T}\\ Z=\left[\overline{P}_{1},\cdots,\overline{P}_{mn}\right]^{T}\end{array}  \tag{6}\]  
where \([a_{1},\cdots,a_{6}]\) are the model parameters, \([B_{1},\cdots,B_{n}]\) are the hardware delay of CORS station, \(\left[B^{1},\cdots,B^{m}\right]\) are the hardware delay of the satellite. The hardware delays of satellites and receivers are linearly correlated, leading to a rank defect in the design matrix. The zero-mean benchmark is usually added for constraint. It is assumed that the sum of the hardware delays of the satellites in each system is 0. Since only part of the satellites can be observed by regional CORS, this paper adds the zero-mean constraint of receiver hardware delay, which can be expressed as \(\sum\limits_{i=1}^{n}B_{i}=0\).