NNT: Nearest Neighbour Trapezoid Algorithm for IoT WLAN Smart Indoor Localization Leveraging RSSI Height Estimation

Indoor localization as a technique for assisting, or replacing outdoor satellite and cell tower localization systems, has taken a toll in the recent Internet of Things (IoT) era. This IoT drive has prompted increased research towards indoor localization, where ﬁ ngerprinting, radio mapping as a cost-e ﬀ ective and e ﬃ cient scheme, is emerging as the best enterprise entrepreneurs choose. However, indoor complex environments comprise of trackable devices (TD) at various heights, such as child trackers, dog tags, TD on the table, TD ’ s in the pockets, and situations such as pedestrians talking on the phone: that is at the height of the ear, amongst others. This paper ﬁ rst investigates and analyses “ experimentally ” the impact of received signal strength indicator (RSSI) ﬁ ngerprinting height to construct radio maps for indoor localization. Secondly, it proposes the novel trapezoid path loss model for RSSI estimation and ﬁ nally the nearest neighbour trapezoid (NNT) algorithm for IoT smart indoor localization leveraging and mitigating the impact of height considered during the o ﬄ ine signal ﬁ ngerprinting. We further propose approximately 1 meter above the ﬂ ooring of the target space as the e ﬀ ective ﬁ ngerprinting height for indoor localization approaches.


Introduction
Realization of Internet of Things (IoT) technology in recent years for smart cities, smart homes, and integrated government infrastructure services have raised the applicability of location-based services (LBS). Localization fingerprinting in complex Wi-Fi indoor environments as a technique to achieve precise indoor positioning has attracted affordable and reliable accuracy ever since the introduction of the RADAR [1,2] and Horus indoor localization systems [3]. Indoor localization usage covers a wide range of aspects, such as emergency response [4], location-based targeted advertising [5,6], indoor robotics navigation [7], and capability that falls short to outdoor satellite navigation systems indoors due to signal fluctuations within complex indoor environments [8]. Indoor positioning technologies such as Bluetooth [9], ultra-wideband [10], radiofrequency technologies [11], microelectromechanical systems [12], wireless local area net-works [13], computer vision [14], magnetic field [15], ultrasonic [16], and infrared signal have been proposed [17].
In this paper, we first experimentally evaluate, test, and analyse the effect of fingerprinting height to indoor localization accuracy using machine learning nearest neighbour in signal space approaches such as nearest neighbour (NN) and k-nearest neighbour (KNN) algorithms with various radio maps constructed at different heights. The KNN algorithms return the location estimate as the average of the coordinates of the k neighbours corresponding to the smallest RSS distances to the query RSSI values [2]. Then, we propose and test the performance of the trapezoid path loss model to estimate the RSSI and the trapezoid nearest neighbour algorithm to accurately estimate the mobile location with minimal distance error. Experimental results show better localization accuracy performance by the proposed trapezoid signal distance model than the Euclidean distance deploying the proposed NNT algorithm than the native NN algorithm.
The contributions of this paper can be summarized as follows: (1) The proposed system deploys the RSSI-based approach, which requires no additional hardware and easily implemented on/off the shelf mobile devices equipped with the 802.11 family chipsets. Other than relaying of the internal inertia sensors, our proposed technique utilizes the received RSSI to estimate the height of the trackable device (2) We propose trapezoid signal distance, instead of the Euclidean distance of the received RSSI signal and the fingerprint, as the evaluation function that proves better positioning accuracy We propose a novel trapezoid model for signal prediction in free space based on proposed trapezoid signal distance other than the log distance model (4) We propose the nearest neighbour trapezoid algorithm (NNT) for indoor complex fingerprinting localization. Furthermore, we state that the proposed model can be used in any other location system. It provided better and robust localization Indoor localization systems are discussed in Section 2. Empirical fingerprint construction is presented in Section 3. In Section 4, we describe our proposed trapezoid construction process, the trapezoid path loss model, and the localization algorithm. Section 5 presents the experimental evaluation. Finally, Section 6 concludes this paper.

Related Works
Indoor localization research has seen a great deal of interest over the decade cutting across various architectures. Several solutions have been proposed by multinational industries and researchers, some requiring dedicated infrastructures such as infrared [18], ultrasound [19], and radiofrequency identification (RFID) [20,21], thus increasing the cost of deployment. However, RFID emerging techniques to resolve collision detections, such as the enhanced collision detection (ECD) [22], can improve identification rate, time, and slot efficiencies at low cost, whereas some solutions leverage already existing sensor infrastructures, such as Bluetooth [9,23], frequency modulation (FM) [24], GSM cellular [25], and wireless fidelity (Wi-Fi) signal strengths [2,3,26,27]. They deploy techniques such as the angle-of-arrival (AoA) leveraging the angle of incidence of the received signal vectors [28], time-difference-of-arrival (TDOA), the time-offlight (TOF) [29] leveraging the arrival time sequence to measure the delay of the signal, and signal strength fingerprinting. Fingerprint techniques map indoor propagated signals to a specific reference point, without the need to know the transceiver's location and transmit power, as opposed to techniques that rely on building signal propagation models for localization. WLAN indoor localization system based on fingerprinting comprises of basic two stages. The first stage is radio map construction during the offline surveying stage: During this stage, site survey calibration is carried out to obtain specific reference points at which RSSI sample vectors are sampled at a predetermined height and then saved in the localization server. The second stage is the localization query stage: During this stage, sensor device queried fingerprint vectors at unknown locations are compared to fingerprints in the radio map database in the localization server and then returns the corresponding location estimate that minimizes the mean errors in accordance to the localization algorithms' criterion. Indoor complex environments comprise devices tractable at different heights, such as child trackers, dog tags, mobile devices on the table or in pockets, and pedestrians on phone talking, amongst other height orientations. These diverse height orientations would have an impact on RSSI signal fluctuations; thus, different localization accuracy estimation results during online localization; this is because in most cases offline fingerprints are sampled and constructed at a specific height. This paper, therefore, presents an indepth experimental evaluation to validate this height effect, proposes a novel trapezoid path loss model, and finally proposes novel trapezoid nearest neighbour localization approach.

Fingerprint Localization
The fingerprint-based localization process consists of offline data collection, radio map construction phase, and online localization estimation phase. Offline construction of the radio map is initialized by the site survey, with grid formation calibrating of the target indoor environment. At each calibrated reference point (RP), we use a prerequisite Wi-Fi enabled tractable device (TD) to scan and sample the received signal strength indicator (RSSI) value from hearable transmitter access points (APs) in a predefined time stamp. When a discoverable number of APs are less than 3, the fingerprint signature at that specific RP point is not viable for complex indoor localization environments; thus, the fingerprint surveyor should take note of the AP population within the target environment signal coverage.
Let N be the number of RPs and L be the total number of APs deployed in the signal coverage target floor. We denote the RSSI value form AP l at RP i as f l i (dBm). We sample multiple random fingerprint signals at each predefined RP and then averaged the signal values to find the mean RSSI f l i at each RP i from AP l denoted as where f l i ðsÞ is the s th RSSI sample (in dBm) at RP i from AP l, and S l i is the total number of RSSI samples collected within the predefined time stamp. Then, the fingerprint at RP i is defined as

Journal of Sensors
Forming an interactive radio map matrix as Secondly, for each predefined time stamp, we calculate the mean and standard deviation of the RSSI per AP to store in a radio map at the back end of the server. Let σ l n (dBm) be the corresponding standard deviation of S l n collected RSSIs. Similarly, given the online query target measured RSSI R l from AP l, the RSSI vector at the target, denoted as ϑ, can be defined as During the data processing, to differentiate the RSSI values within indoor environment, mW, instead of dBm, is used when we consider the random signal level mean, i.e., which transforms RSSIs from smartphones to values for better signal differentiation. Correspondingly, we also transform RSSI values t l′ s in ϑ from dBm into mW.

NNT Algorithm
As IoT indoor environments are comprised of localization of persons of interest and transceivers at diverse heights, we propose a novel approach to solve the disparity of the pairwise cluster of the fingerprint RSSI and receiver RSSI by the trapezoidal area between the fingerprint perpendicular heights. Assuming a transceiver Tx at height H1 on ðx0, y0 Þ coordinate location in the equal space calibrated indoor space, fingerprint Fp at height H2 on ðx1, y1Þ coordinate and receiver Rx at a height H3 on ðx2, y2Þ coordinate, as shown in Figure 1 and the two-dimensional distance relationship in Figure 2.
In order to measure the degree of neighbour's closeness at varying heights, we propose minimizing the proposed trapezoidal distance, which is further achieved by several other minimizations such as the hypotenuse signal distance, the floor distance between the fingerprint and the location device, the differential height between the two. From Figure 1, where 4.1. RSSI Distance Model. Natively, during the offline calibration stage, the average RSSI at various fingerprint reference points at different distances C1 from the Tx transceiver antenna can be associated with the RSSI distance model as in where A l is the average RSSI at a 1 m distance from Tx. Assuming a close neighborhood from the Tx antenna nodes in the wireless fidelity network, the transmission indoor space-dependent parameter n remains the same. Thus, n can be determined by During online, the target received RSSI R l of the surrounding transceivers are compared to the fingerprint database RSSI values. Similarly obeying the anticipated RSSI distance model as in The distance at which the receiver is anticipated is obtained as Further, we derive the height estimate at which the RSSI is estimated to be recorded as 4.2. Trapezoid Path Loss Model. In this section, we propose and define our trapezoid path loss model for indoor radio propagation. Existing models have approximately predicted the RSSI fingerprints, though extremely challenging due to multipath effect and environmental site-specific parameters. From Figure 2, we can derive the following relationship:

Journal of Sensors
From Equation (16), The trapezoid nearest neighbour area A is defined as The proposed trapezoid path loss model that leverages the trapezoid distance can be defined as where averaged Rx l is the estimated received RSSI, C2 is the estimated distance between the transceiver and receiver, f l i is the fingerprint RSSI, and h2 is the proposed trapezoid factor to signal distance that affects the signal between the transceiver and the receiver.
where the proposed trapezoid signal distance as in Equation (20) between the reference fingerprint and the observed test fingerprint is calculated as

Experimental Evaluation
Raw data fingerprinting experiment was carried out on the office floor of our faculty administration building of Chongqing Posts and Telecommunications University (CQUPT), a test bed of about 66 m wide by 17.1 m long, whose schematic experimental test floor plan is shown in Figure 3. Several stages include the experimental setup and data acquisition steps in Section 5.1, the initial experiment to determine the effect of height on radio fingerprinting, the proposed trapezoid path loss model, and the proposed trapezoid localization algorithm based on accuracy results and cost of construction.

Setup and Data Acquisition.
In the test bed setup, initial prescans discover various RSSI readings that could be resulting from tethered devices in various offices, which in turn could increase the preprocessing computational cost of the collected data due to increased discoverable TD's. To minimize the processing, we filter out and simplify the process by setting up 5 D-Link APs (DAP 2310) operating at 2.4 GHz IEEE 802.11b/g/n Wi-Fi standard as baseline testing   Journal of Sensors transceivers. Installed at a height of 1.68 m on the adjustable Fidck SPs-502 speaker stands, whereas the sampling TDs are at respective heights as described in Figure 4. During the one-time offline training phase, we calibrate RPs on the floor at respective scaling intervals of 0.8 m forming a grid. At each grid RP, we sample 120 RSSI values (in dBm) as fingerprints within a 1-second time interval using our developed android application facing the northing direction, installed it on a prerequisite Samsung Galaxy GT-S7568, and averaged and stored as fingerprints in the localization server, at different heights of 1.51 m, 0.97 m, 0.34 m, respectively, as illustrated in Figure 4, as well as Figure 5 showing the real image of the various height setups in the test bed. Meanwhile, we further calibrate test RP's, at which respective 120 RSSI values are sampled, averaged, and stored for online unknown locality testing.
Considering the amount of time for the surveyor to interact with the developed APP, our developed android platform sampling APP is simpler and user friendly than in [30], requiring only the reference point name, the interval at which we sample the RSSI. On scan initialization for a predefined time stamp, it records the interval, the RSSI value followed by MAC address of the source transceiver AP. Saving the sampled data into a text file (.txt) format in the security digital (SD) card, from which we later extract RSSI values using MATLAB R2015b running on 64-bit Windows 7 Ultimate desktop equipped with i3 4160 CPU@3.60 GHz processor and 4 GB RAM to form an interactive matrix, thus empirical RSS database.

Height
Effect on Localization Accuracy. We experimentally evaluate the localization accuracy of various Wi-Fi fingerprints constructed at different heights for indoors localization to enable use for determining the extent to which the height factor impacts our fingerprint. We use nearest neighbour algorithms of NN and KNN, where NN is a special case of the KNN algorithm when the number of neighbours in the localization formulation is equal to one (k = 1).
H1 vs. T1 represents radio map fingerprints at height 1 (H1 = 0:34 m) versus testing fingerprints at height 1 (T1 = 0:34 m); this notation is adopted for all the possible height combinations used in the testing (Figure 6), summarized in Table 1. We can see a radio map constructed with fingerprints at heights H2, and test fingerprints at height T 3, that is "H2 vs. T3" performing better than other comparison fingerprint height combinations. This confirms that when a localization device is at the height of 1.51 m, location fingerprints constructed at H2 result in reduced localization mean error greatly than H1, and H3 fingerprints, respectively, with the same online query test fingerprints at height T3. We further observe that, under different values of the well-known parameter k used by the KNN, the attained localization accuracy differs greatly, with k = 3 resulting in better performance with combinations of H2 vs. T3. When the number of neighbour's used during the localization algorithm is equal to 1 (k = 1), resulting results are attributed to the NN algorithm. From this point, we select and proposed H2 as our fingerprinting height for the analysis of the proposed trapezoid path loss model and finally the proposed localization technique.

Trapezoid Pass Loss Model
Analysis. Efficient, applicable RSSI signal prediction is a key to indoor localization in the era of IoT, however, due to the diversity of the height of location-based devices, accurate signal modelling at different receiver heights on the same location possesses a challenge due to multipath effect, refraction, diffraction, and reflection of the signal by the complex indoor environments. Considering the lobby area (Area 3), we perform a comparison to the choices of minimization factors from the following enabling features such as the proposed trapezoid signal distance (blue colour), the signal distance (red colour), the floor distance (green colour), and the trapezoid area (black colour). From 5 Journal of Sensors the comparison, we observe overall superior localization accuracy performance of the proposed prediction path loss model leveraging height estimation than peers, as seen in Figure 7. Furthermore, analysing the localization accuracy by the NNT algorithm that leverages trapezoid path loss model at each TP location in Area 3, as seen in Figure 8. We observe robustness with NNT localization mean errors of range 0 meters (floor) such as TP location 6, TP location       Journal of Sensors 16 and 9 meters (ceiling), with a median of 2 meters compared to NN range of 2 meters (floor) to 15 meters (ceiling) with all RSSI test RP's.

Localization Accuracy Analysis.
We evaluate the accuracy of the proposed NNT localization algorithm by computation of the mean error with the well-known NN algorithm in different environments, as seen from the Figure 9, below for each areas subsection, and the general total floor, we observe the NNT algorithm (blue) outperforming the native NN algorithm (red), both in room base localization and total floor base localization Figure 10.

Conclusions
As the demand increases for indoor LBSs in the IoT era, Wi-Fi-based fingerprinting as a key low-cost approach to precise indoor navigation and positioning keeps increasing. This paper firstly presents an extensive experimental analysis on the effect of the height, chosen by the offline site surveyor for sampling RSSI data in one-sided heading, as a minimum measure during the fingerprint radio map construction. We further note that pedestrians and traceable valuables indoors can be found at diverse heights; thus, the same could    Journal of Sensors reversibly affect the localization radio map, directly impacting the localization accuracy. From this evaluation, we observe the effect of AP's installation heights versus the localization height in complex environments and further propose that radiofrequency-based indoor fingerprinting to be sampled at approximately 1 m above the floor of localization interest. Secondly, we propose a novel trapezoid path loss model to better estimate indoor RSSI fingerprint characteristics due to changing height. On the same basis, we finally propose a novel trapezoid-based nearest neighbour indoor localization scheme that leverages online RSSI to dynamically predict and update the RSSI in real time. Comparing with the classic nearest neighbour algorithm for localization accuracy performance, the experimental findings clearly show that the proposed algorithms can better predict RSSI with dynamic indoor coverage and improve the positioning accuracy.

Data Availability
The data is available on request.

Conflicts of Interest
The authors declare that there is no conflict of interest regarding the publication of this paper.