# A GNSS/5G Integrated Three-Dimensional Positioning Scheme Based on D2D Communication
## 2 Methods
### GNSS/5G Integrated Three-Dimensional Positioning Scheme
#### 2.3.2 GNSS/5G Integrated Three-Dimensional Positioning Based on PF
\(k\) is the time when the DBSCAN algorithm based on the joint TOA/RSS method outputs. We assume that at time \(k\), the requesting nodes not only know their own positions from the DBSCAN results, but also the positions of the BSs and the cooperative nodes. In addition, the GNSS and TOA/RSS measurements are available at time \(k\). PF is implemented for each MU in \(\mathcal{NR}\). Here, for MU \(i\), in addition to the BSs that can be used for positioning, denoted as \(\mathcal{M}_{tr}\), the reference nodes based on the TOA and RSS measurements form \(\mathcal{R}_{t,i}\) and \(\mathcal{R}_{r,i}\), respectively. The objective is to find the state of MU \(i\) denoted as \(X_{k}^{i}\), which maximizes the posterior distribution, formulated as follows:  
\[\max\,bel\left(X_{k}^{i}\right)=P\left(X_{k}^{i}\Big{|}\mathcal{I}_{1:k}^{iN^{ 2}}\right)\,\forall i\in\mathcal{NR} \tag{27}\]  
where \(\mathcal{N}^{i^{2}}=\mathcal{R}_{t,i}\cup\mathcal{R}_{r,i}\cup\mathcal{M}_{tr}\cup i\), and we denote \(\mathcal{N}^{i}=\mathcal{R}_{t,i}\cup\mathcal{R}_{r,i}\cup\mathcal{M}_{tr}\). Then, \(i\mathcal{N}^{i^{2}}\) includes \(ii\) and all the \(ij\)s where \(j\in\mathcal{N}^{i}\). \(\mathcal{I}_{1:k}^{iN^{2}}\) represents the collected information before time \(k\). \(\mathcal{I}_{k}^{ii}\) contains \(Z_{D,k}^{tr,iN^{i}}\), the TOA and RSS measurements between MU \(i\) and all the \(j\)s in \(\mathcal{N}^{i}\). \(\mathcal{I}_{k}^{iN^{i}}\) contains the estimated state of all the \(j\)s in \(\mathcal{N}^{i}\) at time \(k-1\), denoted as \(\hat{X}_{k-1}^{j}\). Then, based on the initial position obtained from the DBSCAN output, \(X_{k}^{i}\) in (27) is the integrated position of MU \(i\). Besides, (27) can be further expressed in (28) based on the Bayesian formula:  
\[ \begin{split}& P\bigg{(}X_{k}^{i}\bigg{|}\mathcal{I}_{1:k}^{i\mathcal{ N}^{2}}\bigg{)}=\int P\bigg{(}X_{k}^{i\mathcal{N}^{2}}\bigg{|}\mathcal{I}_{1:k}^{i \mathcal{N}^{2}}\bigg{)}\partial X_{k}^{i\mathcal{N}^{i}}\\ &\propto\int P\bigg{(}Z_{D,k}^{tr,i\mathcal{N}^{2}}\hat{X}_{k-1}^ {i\mathcal{N}^{2}}\bigg{|}X_{k}^{i\mathcal{N}^{2}}\bigg{)}P\bigg{(}X_{k}^{i \mathcal{N}^{2}}\bigg{|}X_{k-1}^{i\mathcal{N}^{2}}\bigg{)}P\bigg{(}X_{k-1}^{i} \bigg{|}\mathcal{I}_{1:k-1}^{i\mathcal{N}^{2}}\bigg{)}\partial X_{k}^{i \mathcal{N}^{i}}\end{split}  \tag{28}\]  
From Equation (28), it is obvious that the first two items are the likelihood function and the prediction function, which represent the weights of the particles and the importance distribution, respectively. Then, the GNSS/5G integrated three-dimensional positioning algorithm based on PF is illustrated in Algorithm 2 as GITPAPF. Firstly, as shown in line 1, we initialize the particles based on the DBSCAN output and the important distribution. After that, in each time slot, we use PF to estimate the state of \(X_{k}^{i}\), as line 2 to 9 indicate. For each requesting node in \(\mathcal{NR}\), GITPAPF is conducted to obtain the integrated position result. Notice that the size of \(\mathcal{N}^{i^{2}}\) determines the size of \(X_{k}^{i\mathcal{N}^{2}}\), and a large number of particles have to be sampled and calculated to obtain the integrated positions of the requesting nodes in \(\mathcal{NR}\). Hence, the edge computing is exploited to overcome the problem of limited computing resources in the MUs, which can also shorten the delay of positioning.