# Methodology for Simulating 5G and GNSS High-Accuracy Positioning
## 4 Position Solution
### Tightly Coupled GNSS and cmWave Cellular Positioning  
The general architecture of the tightly coupled hybridisation of GNSS and cmWave observables is shown in Figure 8. First, the network deployment and the mobile locations are used to define the outdoor urban, suburban and rural scenarios. As described in Section 2, the average distance from the mobile to the three closest BSs is used to characterize the network density and the satellite elevation mask. Then, the statistics of the cmWave observables are generated according to the channel models for each environment. The GNSS and cmWave ToA observables are finally simulated by considering the mobile location and by evaluating the distribution of the GNSS and cmWave ranging errors. These ToA observables are used to compute the mobile position with a WLS algorithm. Let us define the \(m\)-th ranging observable as  
\[\hat{\rho}_{m}=c\cdot\hat{\tau}_{m}=\|\mathbf{x}_{m}-\mathbf{x}\|+c\cdot\delta t +e_{m}, \tag{25}\]  
where \(\hat{\tau}_{m}\) is the time-delay estimated from the \(m\)-th transmitter, which can be a GNSS satellite or cmWave BS, \(\mathbf{x}_{m}=[x_{m},y_{m},z_{m}]^{\mathrm{T}}\) and \(\mathbf{x}=[x,y,z]^{\mathrm{T}}\) are the locations of the transmitter and mobile receiver, respectively, \(\delta t\) is the receiver clock offset with respect to the reference GNSS time, and \(e_{m}\) is the ranging error. Given the known location of the transmitters, the unknown parameters are \(\boldsymbol{\theta}=[x,y,z,\delta t]^{\mathrm{T}}\). The WLS classical solution of this trilateration problem is formulated as the nonlinear least squares (NLS) minimization  
\[\hat{\boldsymbol{\theta}}= \begin{bmatrix}\hat{x}\\ \hat{y}\\ \hat{z}\\ \delta t\end{bmatrix} =\arg\min_{\boldsymbol{\theta}}\left\{\|\boldsymbol{ \rho}\left(\boldsymbol{\theta}\right)-\hat{\boldsymbol{\rho}}\|_{\mathbf{W}}^ {2}\right\}, \tag{26}\]  
where \(\boldsymbol{\rho}(\boldsymbol{\theta})=[\rho_{1}(\boldsymbol{\theta}),\rho_{2} (\boldsymbol{\theta}),\cdots,\rho_{M}(\boldsymbol{\theta})]^{\mathrm{T}}\), being \(\rho_{m}(\boldsymbol{\theta})=\|\mathbf{x}_{m}-\mathbf{x}\|+c\cdot\delta t\), and \(\hat{\boldsymbol{\rho}}=[\hat{\rho}_{1},\hat{\rho}_{2},\cdots,\hat{\rho}_{M} ]^{\mathrm{T}}\) for a total number of transmitters \(M\). The \(M\) transmitters used for hybrid positioning is the sum of the number of visible GNSS satellites \(M_{\mathrm{sat}}\) and the number of strongest cmWave BSs \(M_{\mathrm{BS}}\), i.e., \(M=M_{\mathrm{sat}}+M_{\mathrm{BS}}\). Our WLS implementation is based on the well-known iterative Gauss-Newton (GN) method. Then, the GN solution at the \(\ell\)-th iteration is defined as  
\[\hat{\boldsymbol{\theta}}_{\ell}=\hat{\boldsymbol{\theta}}_{\ell-1}+\left( \mathbf{G}^{\mathrm{T}}\mathbf{W}^{-1}\mathbf{G}\right)^{-1}\mathbf{G}^{ \mathrm{T}}\mathbf{W}^{-1}\left(\boldsymbol{\rho}\left(\hat{\boldsymbol{ \theta}}_{\ell-1}\right)-\hat{\boldsymbol{\rho}}\right), \tag{27}\]  
where the Jacobian matrix or geometry matrix of \(\boldsymbol{\rho}(\hat{\boldsymbol{\theta}})\) is a \(M\times 4\) matrix defined as  
Figure 8: Simulation methodology of tightly coupled WLS hybrid GNSS and cmWave positioning. \[\left[\mathbf{G}\right]_{m,1:4}=\left[ \begin{matrix}\frac{x_{m}-x}{\rho_{m}(\mathbf{ \theta})}&\frac{y_{m}-\hat{y}}{\rho_{m}(\mathbf{\theta})}&\frac{z_{m}-z}{\rho_{m}( \mathbf{\theta})}&-1\end{matrix} \right], \tag{28}\]  
and \(\mathbf{W}\) is the diagonal weighting matrix. The weighting coefficients of the GNSS observables are defined with (2) as \(\mathbf{w}_{\text{sat}}=c\cdot\left[\sigma_{\text{sat},1},\sigma_{\text{sat },2},\cdots,\sigma_{\text{sat},\text{sat}}\right]^{\text{T}}\), while the cmWave weighting coefficients are just a unitary vector of \(M_{\text{BS}}\) BSs, i.e., \(\mathbf{w}_{\text{BS}}=\mathbf{1}_{M_{\text{BS}}\times 1}\). Thus, the weighting matrix is written as  
\[\mathbf{W}=\left[