# WiFi Positioning in 3 GPP Indoor Office with Modified Particle Swarm Optimization
## 4 Proposed Indoor Positioning
### WFM Algorithm  
WFM is performed in the online step where the real user is present. Each AP calculates the RSSI value from user equipment (UE) \(k\). The corresponding RSSI value can be expressed as (4).  
\[U_{k}^{RSSI}=\left[h_{k}^{1},\;h_{k}^{2},h_{k}^{3},\;\ldots,h_{k}^{M}\right] \tag{4}\]  
where \(h_{k}^{m}\) represents an RSSI value between AP \(m\) and UE \(k\). The Euclidean distance vector can then be derived after evaluating the correlation between \(H^{RSSI}\) and \(U_{k}^{RSSI}\). For the \(j\)-th AP, the correlation between the RSSI value of the UE \(k\) position in the online step and the RSSI value of the SP \(n\) position in the offline step is given by \(r_{k,\ n}\) and can be expressed as (5).  
\[r_{k,n}=\parallel U_{k}^{RSSI}-H_{n}^{RSSI}\parallel=\sqrt{\sum_{m=1}^{M}\left(h _{k}^{m}-h_{n}^{m}\right)^{2}} \tag{5}\]  
After that, the value of \(r_{k,\ n}\) is normalized based on the min-max normalization formula, and it is defined as \(\rho_{k,\ n}\). \(\rho_{k,\ n}\) can be expressed as (6).  
\[\rho_{k,\ n}=\frac{r_{k,\ n}-r_{min}}{r_{max}-r_{min}} \tag{6}\]  
where \(r_{k,\ n}\) represents the degree of correlation between UE \(k\) and SP \(n\). According to (5), as \(r_{k,\ n}\) has a smaller value, it means that the distance between UE \(k\) and SP \(n\) is smaller, and it is determined that the correlation is high. \(r_{max}\) and \(r_{min}\) represent the maximum and minimum values of all correlations, respectively. The range of defined \(\rho_{k,\ n}\) is \(0\ \leq\ \rho_{k,\ n}\ \leq\ 1\). The Euclidean distance vector can be derived as (7) as the result obtained from the above equation.  
\[\mathrm{d}_{k}=\left(1-\rho_{k,\ n}\right)=\left[\mathrm{d}_{k,1},\ \mathrm{d}_{k,2},\ \ldots\ \mathrm{d}_{k,N}\right] \tag{7}\]  
Thereafter, the four fingerprinting vectors closest to UE \(k\), which is the target for the current location positioning, may be selected. After that, the selected fingerprinting values can be sorted sequentially, starting from nearest. Furthermore, the coordinates of the UE can be calculated as follows.  
\[X_{0} =\sum_{n=1}^{4}\beta_{n}X_{n} \tag{8}\] \[Y_{0} =\sum_{n=1}^{4}\beta_{n}Y_{n}\] (9) \[Z_{0} =\sum_{n=1}^{4}\beta_{n}Z_{n} \tag{10}\]  
where \(\beta_{n}\) is the closeness weighting factor obtained using the four SP coordinate values closest to the UE and the Euclidean distance vector. The larger the value of \(\beta_{n}\), the smaller the distance between the UE and SP \(n\). \(\beta_{n}\) can be defined as (11).  
\[\beta_{n}=\frac{\alpha_{n}}{\alpha_{sum}},\ \ \alpha_{sum}=\sum_{n=1}^{4}\alpha_{n} \tag{11}\]  
where \(\alpha_{n}\) represents the Euclidean distance vector of the four SPs nearest to the location of the user derived in (7). Therefore, it can be expressed as \(\alpha_{n}=\left[\alpha_{1}\,\ \alpha_{2}\,\ \alpha_{3}\,\ \alpha_{4}\right]\), and \(\alpha_{1}\) is the largest Euclidean distance vector value. \(\alpha_{sum}\) represents the sum of the values of the four SP Euclidean distance vectors closest to the UE. Using \(\alpha_{sum}\) and \(\alpha_{n}\), we obtain the closeness weighting factor \(\beta_{n}\) corresponding to the four SPs closest to the UE.  
As above, the user's location can be estimated through WFM. However, in this paper, we propose a method to limit the initial search region of the PSO by using the four SPs nearest the actual user derived through fuzzy matching.