# Positioning-Based Uplink Synchronization Method for NB-IoT in LEO Satellite Networks
## 3 Position-Aided Uplink Synchronization Method
### NPSS Detection
#### 3.2.1 Scenario 1: Three Satellites Visible  
In the scenario shown in Figure 7, the ground terminal \(q=(x,y,z)\) can observe three satellites: \(S_{1}\), \(S_{2}\), and \(S_{3}\). When there is a need for data upload, the terminal begins by utilizing the MSA algorithm from the previous section to detect the downlink NPSS. Once the first NPSS is detected, the terminal then detects two additional NPSSs within 10 ms, confirming that the scenario involves three visible satellites. The terminal records the arrival times of the three NPSSs and the satellite ephemeris to formulate the TDOA equations. The NB-IoT terminal must be equipped with an elevation sensor to incorporate surface constraints. The distances from the three low earth orbit satellites \(S_{1}\), \(S_{2}\), and \(S_{3}\) to the ground terminal are denoted as \(r_{1},r_{2},r_{3}\):  
\[\left\{ \begin{array}{l}r_{1}=\left|\mathbf{s_{1}-q}\right|=\sqrt{\left(x_{1 }-x\right)^{2}+\left(y_{1}-y\right)^{2}+\left(z_{1}-z\right)^{2}}\\ r_{2}=\left|\mathbf{s_{2}-q}\right|=\sqrt{\left(x_{2}-x\right)^{2}+\left(y_{2 }-y\right)^{2}+\left(z_{2}-z\right)^{2}}\\ r_{3}=\left|\mathbf{s_{3}-q}\right|=\sqrt{\left(x_{3}-x\right)^{2}+\left(y_{3 }-y\right)^{2}+\left(z_{3}-z\right)^{2}}\end{array} \right. \tag{17}\]  
Here, \(\left(x_{i},y_{i},z_{i}\right)\) represents the coordinate values of satellite \(S_{i}\). Let \(\Delta t_{1},\Delta t_{2}\) represent the time differences between the arrival times of the second and third NPSSs detected by the NB-IoT terminal, relative to the first NPSS's arrival time. Let \(\Delta r_{2},\Delta r_{3}\) represent the distance differences at the time of signal transmission between the second and third satellites and the first satellite to the ground terminal, respectively. The distance difference equations can be written as:  
\[\Delta r_{i}=r_{i}-r_{1}=c\cdot\Delta t_{i},i=2,3 \tag{18}\]  
Figure 7: Three-satellite visible scenario diagram. where \(c\) is the speed of electromagnetic wave propagation. Assuming a spherical Earth model, the radius of the Earth and the altitude of the NB-IoT terminal are denoted by \(R\) and \(h_{\pi}\). Figure 8 illustrates the receiver timeline, where \(L_{1},L_{2},L_{3}\) represent the arrival times of the three NPSSs. \(\Delta t_{1}\) denote the time difference of arrival between the signals transmitted from satellite \(S_{1}\) and satellite \(S_{2}\), \(\Delta t_{2}\) denote the time difference of arrival between the signals transmitted from satellite \(S_{1}\) and satellite \(S_{3}\). They are respectively denoted as:  
\[\Delta t_{1}=L_{2}-L_{1}\Delta t_{2}=L_{3}-L_{1} \tag{19}\]  
Thus, the following TDOA equations can be derived, including the surface constraints which the terminal coordinates satisfy and the spherical equation of the earth:  
\[\left\{ \begin{array}{l}r_{2}-r_{1}=c\Delta t_{1}\\ r_{3}-r_{1}=c\Delta t_{2}\\ x^{2}+y^{2}+z^{2}=\left(R+h_{n}\right)^{2}\end{array} \right. \tag{20}\]  
Substituting Equations (17) and (18) and squaring both sides yields:  
\[\Delta r_{i}^{2}+2\Delta r_{i}r_{1}+r_{1}^{2}=\left(R+h_{n}\right)^{2}+\mathbf{ s_{i}^{T}s_{i}}-2\mathbf{s_{i}^{T}q},i=2,3 \tag{21}\]  
From the first equation in the system of equations, we obtain:  
\[r_{1}^{2}=\left(R+h_{n}\right)^{2}+\mathbf{s_{1}^{T}s_{1}}-2\mathbf{s_{1}^{T}q}\]  
\[\Delta r_{i}^{2}+2\Delta r_{i}r_{1}=\mathbf{s_{i}^{T}s_{i}}-\mathbf{s_{1}^{T}s _{1}}-2(\mathbf{s_{i}-s_{1}})^{T}\mathbf{q},i=2,3 \tag{22}\]  
During the solving process, it is necessary to first express \(\mathbf{q}\) in terms of a linear expression of \(r_{1}\) and then use Equation (22) to solve for \(r_{1}\). Ultimately, the solution for \(\mathbf{q}\) in terms of \(r_{1}\) is obtained as:  
\[\mathbf{\hat{q}}=G_{1}^{-1}G_{2} \tag{23}\]  
where  
\[G_{1}=-2\left[ \begin{array}{c}\mathbf{s_{1}^{T}}\\ \mathbf{s_{2}^{T}-s_{1}^{T}}\\ \mathbf{s_{3}^{T}-s_{1}^{T}}\end{array} \right],G_{2}=\left(