# Positioning-Based Uplink Synchronization Method for NB-IoT in LEO Satellite Networks
## 3 Position-Aided Uplink Synchronization Method
### Error Analysis  
This paper adopts the Root Mean Squared Error (RMSE) of the positioning error to evaluate performance. The position of the NB-IoT terminal is represented by \(\mathbf{q}\), and the positioning error can be denoted as \(RMSE=\sqrt{E[(\mathbf{\hat{q}}-\mathbf{q})(\mathbf{\hat{q}}-\mathbf{q})^{T}]}\). The following derivation presents the CRLB of the positioning error under the proposed NPSS detection algorithm. To simplify the analysis, it is assumed that the observations are independent and follow a Gaussian distribution. Define three satellites \(s_{1},s_{2},s_{3}\) with coordinates \((x_{1},y_{1},z_{1})\), \((x_{2},y_{2},z_{2})\), \((x_{3},y_{3},z_{3})\). The distances between the three satellites and the unknown position \(\mathbf{q}\) with coordinates \((x,y,z)\) is denoted as \(r_{1},r_{2},r_{3}\), respec  
Figure 10: Single-satellite visibility scenario diagram. tively. Let \(\Delta t_{1},\Delta t_{2}\) represent the time differences of arrival between signals transmitted by \(s_{1},s_{2}\) and satellites \(s_{1},s_{3}\). The corresponding observation model can be expressed as:  
\[ \begin{array}{l}\Delta t_{1}=\frac{r_{2}-r_{1}}{c}+\lambda_{1}\\ \Delta t_{2}=\frac{r_{2}-r_{1}}{c}+\lambda_{2}\end{array}  \tag{29}\]  
where \(c\) denotes the speed of light, and \(\lambda_{1},\lambda_{2}\) represent observational errors assumed to follow a Gaussian distribution. \(r_{1},r_{2},r_{3}\) can be expressed as:  
\[\left\{ \begin{array}{l}r_{1}=\left|s_{1}-n\right|=\sqrt{\left(x_{1}-x\right) ^{2}+\left(y_{1}-y\right)^{2}+\left(z_{1}-z\right)^{2}}\\ r_{2}=\left|s_{2}-n\right|=\sqrt{\left(x_{2}-x\right)^{2}+\left(y_{2}-y\right) ^{2}+\left(z_{2}-z\right)^{2}}\\ r_{3}=\left|s_{3}-n\right|=\sqrt{\left(x_{3}-x\right)^{2}+\left(y_{3}-y\right) ^{2}+\left(z_{3}-z\right)^{2}}\end{array} \right. \tag{30}\]
```
0: Satellite positions, NPSS detection time within 10 ms, detection interval time \(T\). 0: Terminal location. 1: Initialize
2: Detect the number of NPSSs \(K\) within 10 ms, record the arrival time \(L_{i}\)
3: While\(K=3\), do
4: Calculate \(\Delta t_{1},\Delta t_{2}\) using Formula (19) and Obtain \(\hat{\mathbf{q}}=G_{1}^{-1}h\) using Formula (23);
5: While\(K=2\), do
6: Record the arrival time \(L_{1},L_{2}\), enter PSM mode for \(T\) time then update \(K\);
7: Jump to step 3 if \(K=3\), record the first arrival time \(L_{3}\);
8: Calculate \(\Delta t_{1},\Delta t_{2}\) using Formula (25) and obtain \(\hat{\mathbf{q}}\) using Formula (23);
9: While\(K=1\), do
10: Record the arrival time \(L_{1}\), enter PSM mode for \(T\) time, then update \(K\);
11: Jump to step 3 if \(K=3\), calculate \(\Delta t_{1},\Delta t_{2}\) using Formula (27), and obtain \(\hat{\mathbf{q}}\) using Formula (25) if \(K=2\);
12: Record the arrival time \(L_{2}\), enter PSM mode for \(T\) time then update \(K\);
13: Jump to step 3 if \(K=3\), record the arrival time \(L_{3}\), calculate \(\Delta t_{1},\Delta t_{2}\) using Formula (28), and obtain \(\hat{\mathbf{q}}\) using Formula (23);
14: End
```  
**Algorithm 2**TDOA Localization Algorithm  
Define the parameter vector \(\theta=[x,y,z]\). Since \(\mathbf{q}\) is subject to the surface constraint, it satisfies \(z=\sqrt{R^{2}-x^{2}-y^{2}}\). Accordingly, the parameter vector can be redefined as \(\theta=[x,y]\). The observation vector is denoted by \(\mu=[\mu_{1},\mu_{2}]\), and the measurement equation is given by \(\mu=g(\theta)+\lambda\), where  
\[ \begin{array}{l}g(\theta)=\begin{array}{l}\left[\sqrt{\left(x_{2}-x\right)^ {2}+\left(y_{2}-y\right)^{2}+\left(z_{2}-z\right)^{2}}-\sqrt{\left(x_{1}-x \right)^{2}+\left(y_{1}-y\right)^{2}+\left(z_{1}-z\right)^{2}},\\ \sqrt{\left(x_{3}-x\right)^{2}+\left(y_{3}-y\right)^{2}+\left(z_{3}-z\right)^{ 2}}-\sqrt{\left(x_{1}-x\right)^{2}+\left(y_{1}-y\right)^{2}+\left(z_{1}-z \right)^{2}}\right]/c\end{array}\end{array}  \tag{31}\]  
Next, we compute the Jacobian matrix \(J\), where the element in the \(i\) row and \(j\) column is denoted as \(\frac{\partial\xi_{i}}{\partial\theta_{j}}\). The Jacobian matrix can then be expressed as:  
\[J=