An Enhanced Indoor Positioning Technique Based on a Novel Received Signal Strength Indicator Distance Prediction and Correction Model

Indoor positioning has become a very promising research topic due to the growing demand for accurate node location information for indoor environments. Nonetheless, current positioning algorithms typically present the issue of inaccurate positioning due to communication noise and interferences. In addition, most of the indoor positioning techniques require additional hardware equipment and complex algorithms to achieve high positioning accuracy. This leads to higher energy consumption and communication cost. Therefore, this paper proposes an enhanced indoor positioning technique based on a novel received signal strength indication (RSSI) distance prediction and correction model to improve the positioning accuracy of target nodes in indoor environments, with contributions including a new distance correction formula based on RSSI log-distance model, a correction factor (Beta) with a correction exponent (Sigma) for each distance between unknown node and beacon (anchor nodes) which are driven from the correction formula, and by utilizing the previous factors in the unknown node, enhanced centroid positioning algorithm is applied to calculate the final node positioning coordinates. Moreover, in this study, we used Bluetooth Low Energy (BLE) beacons to meet the principle of low energy consumption. The experimental results of the proposed enhanced centroid positioning algorithm have a significantly lower average localization error (ALE) than the currently existing algorithms. Also, the proposed technique achieves higher positioning stability than conventional methods. The proposed technique was experimentally tested for different received RSSI samples’ number to verify its feasibility in real-time. The proposed technique’s positioning accuracy is promoted by 80.97% and 67.51% at the office room and the corridor, respectively, compared with the conventional RSSI trilateration positioning technique. The proposed technique also improves localization stability by 1.64 and 2.3-fold at the office room and the corridor, respectively, compared to the traditional RSSI localization method. Finally, the proposed correction model is totally possible in real-time when the RSSI sample number is 50 or more.


Introduction
One of the essential elements of contextual information is the position of a user or device in a given space. The widespread use of sensors, smartphones and the mobile internet has allowed precise positioning in real-time, and this approach is being extended slowly to different situations [1]. A secure, user-friendly and precise navigation location information method for mobile applications could open the door to many innovative applications and the weighted centroid algorithm is developed in [28][29][30][31]. In this algorithm, a weighting factor is introduced to compensate for the error in estimated distance from measurements. Nevertheless, the positioning error is still relatively high, especially in modern indoor architectures. In [32], a fingerprint-based positioning algorithm is proposed by collecting RSSI samples in the fingerprint database. In [33], the authors have executed and analyzed several positioning algorithms (centroid localization, proximity localization, weighted centroid localization, weight-compensated weighted centroid localization based on RSSI, fingerprinting, and trilateration localization). The authors also suggested and performed a fuzzy logic-based system to choose the most suitable algorithm depending upon the room's area, the beacon's number available, and the signal strength. They concluded that the fingerprinting positioning algorithm is the most fitting one. In [34], the authors implemented a fingerprinting algorithm with fuzzy logic type-2 suitable for employment as an indoor positioning method with BLE beacons with ALE of 0.43 m, but as fingerprint positioning technology methods need several additional algorithms to support them, thus the computational resource consumption and algorithmic program complexity are comparatively high. Also, this methodology needs a large amount of a priori information support which adds a high-cost issue. Besides, the RF signal may suffer from multipath effects and electromagnetic interference in complex indoor environments.
To address the low positioning accuracy problem, many researchers have introduced the hybrid positioning solutions. A hybrid positioning technique using hybrid metrics including time-of-flight (ToF) and angle-of-arrival (AoA) which are combined with the RSS fingerprinting system is presented in [35]. Another hybrid positioning method based on Bluetooth beacons, geomagnetic field, inertial measurement unit (IMU) sensors, and smartphone cameras is presented in [36]. These methods enhance the localization accuracy, but hybrid positioning techniques require additional hardware equipment which increases the communication cost. For low cost and high positioning accuracy, an iterative centroid positioning algorithm based on an RSSI distance model is presented in [37]. In this algorithm, a distance deviation coefficient was driven to correct the distance iteratively based on the noise impact factor which is considered a better theoretical approach to improving positioning accuracy. Nonetheless, the positioning results based on the assumption that the noise impact factor is the same among all beacons is an impractical assumption as the RSSI has time-varying characteristics.
Aiming at addressing the previously mentioned issues, this paper presents an improved indoor positioning technique based on a new RSSI distance prediction and correction model. The proposed technique' correction factors are based on a novel method for collecting and obtaining the correction factors, which improves both the localization accuracy and stability. Moreover, the proposed technique does not require any additional hardware; hence it can be considered a cost-effective, low energy consumption solution for indoor localization. Our proposed method is experimentally tested and verified in an indoor office environment and a corridor using BLE beacons. In this paper, our contributions may be summarized in the following parts:

•
A new distance prediction and correction formula is introduced. The correction factors are based on RSSI log-distance distribution model. A large number of RSSI samples are collected and each RSSI sample is converted into its equivalent distance based on the logarithmic relationship between received signal strength and distance. The correction factors are driven from the RSSI-distances samples rather than the RSSI samples themselves. We proved that this approach has more measurement stability, which leads to higher positioning stability results with improved accuracy. • A correction factor and a correction exponent for different distances are driven from the correction formula at each beacon. First, the correction factor for a certain distance is determined by calculating the mean and the median of RSSI samples equivalent distances. Then, the correction exponent is driven for each distance from the correction formula. Each beacon has its correction factors for certain distances according to the indoor environment area. • At the unknown terminal, the calculated correction factors for each beacon are stored in a lookup table. By utilizing those factors on the unknown node, an enhanced centroid positioning algorithm is applied by correcting the estimated distance from the real-time RSSI samples and finally calculate the real coordinates of the unknown node. The algorithm does not consume much time to find the position of the unknown terminal. Thus, complexity is relatively lower. The experimental results of our method show improvement in both positioning accuracy and stability compared to other existed algorithms.
The remainder of this paper is organized as follows: Section 2 describes our positioning technique. In Section 3, we illustrate the implementation of our experiment and the software and hardware devices used in experiments. In Section 4, we present our positioning results compared to other algorithms and conventional methods. Finally, Section 5 presents the conclusions of the paper and suggestions for future work.

Methods
This section presents the RSSI log-distance model and the positioning methods used in this work. Section 4 discusses the positioning results of the proposed technique.

RSSI Distance Model
The main concept of RSSI ranging method is to measure the distance between the receiving signal node and the transmitting signal node by measuring the received signal strength as the propagation loss affects the transmitted wireless signal. The Bluetooth signal propagation model follows the log-distance distribution model [38][39][40], which described by: where P L (d) is the RSSI at the receiving node separated from the transmitting source by distance d; P L (d 0 ) is the RSSI at the receiving node separated from the source by a reference distance d 0 ; n is the path-loss propagation exponent which takes different values depending on the surrounding wireless transmission environment; X δ is a Gaussian random variable with zero mean and σ 2 variance. It worth mentioning that the measurement error in RSSI does not regularly produce a Gaussian distribution. However, by using approximation (curve fitting), the RSSI measurement error is treated as a gaussian random variable for simplicity. consequently, the reference distance is usually taken as one meter, and the equation is simplified as follows: where RSSI is the signal strength at a distance d from the transmitting source, and A refers to signal strength at 1 m distance from the signal source. The distance can be expressed from Equation (2) as follows:

RSSI Distance Prediction and Correction Model
The emitted RSS from the BLE beacons is affected by several factors such as multipath effects (reflection, refraction) and absorption from water bodies. Moreover, channel hopping influencing the RSS values since the advertisement packages are sent in three different channels. Therefore, it is challenging to calculate the actual distance using the RSSI log-distance distribution model because severe RSSI fluctuation may occur especially in complex indoor environments. To minimize the localization error introduced by RSSI fluctuation, a new RSSI distance prediction and correction model is proposed in this paper. To predict the real distance, 5000 RSSI samples are collected (95% confidence interval) at Each RSSI sample is converted to its equivalent distance using RSSI log-distance relationship in Equation (3). A series of distance values can be given as follows: RSSI fluctuation is an indispensable concern for wireless signals. Therefore reducing the variance range for measurements is vital for improving the stability and accuracy of the positioning. To achieve this, we calculated the standard deviation of the 5000 collected RSSI samples and their 5000 equivalent distances, as shown in Table 1. As presented in Table 1, the standard deviation of distance samples is smaller than that of RSSI samples. Hence, the correction model is based on the equivalent distances rather than RSSI samples itself as it is considered a more stable measurement value. It is necessary to define a characteristic quantity to represent the overall node distance measurement. The two statistical parameters, the mean value and the median of distance measurements, can be closely used to denote the overall distance measurement. The mean and the median values of the distances are calculated as shown in Equations (6) and (7): where D s is an ordered list of the i distance values in Equation (5), and . and . are the floor and ceiling functions, respectively. After calculating the previous values, the training stage of data is finished. Now we introduce the prediction formula as follows: where D predicted is the predicted distance based on 5000 RSSI samples; β is the correction factor which should have a specific value for 1, 2, 3, 4, 5 and 6 m distances, and its value is defined in Equation (9); σ is the correction exponent of the correction factor which also should have a specific value for the chosen distances. The 5000 RSSI samples are collected for each beacon independently at 1, 2, 3, 4, 5 and 6 m distances, which means 30,000 RSSI samples are collected from each beacon. The experiments are carried out on two experimental sites, and each site has four beacons, which result in a total of 240,000 collected RSSI samples. Based on extensive experimental measurements of 240,000 RSSI samples, the values of D mean and D median are found to be always larger than the real distance value. However, D mean and D median inequality is not certain for all the distances. Figure 1 shows the distribution of RSSI distance samples fitted to the normal density function at 1 m (D mean > D median ) and 2 m (D mean < D median ) distances.
samples are collected from each beacon. The experiments are carried out on two mental sites, and each site has four beacons, which result in a total of 240,000 co RSSI samples. Based on extensive experimental measurements of 240,000 RSSI sa the values of and are found to be always larger than the real d value. However, and inequality is not certain for all the distances. 1 shows the distribution of RSSI distance samples fitted to the normal density func 1 m ( > ) and 2 m ( < ) distances.
(a) (b) Therefore, the smaller value between and is taken as a prima tance to be corrected as mentioned in Equation (8): Therefore, the smaller value between D mean and D median is taken as a primary distance to be corrected as mentioned in Equation (8): , D mean ≤ D median D median D mean , D mean > D median (9) As indicated in Equation (9), the value of the correction factor β is chosen based on the values of D mean and D median to be less than unity to fit the fact that the measured RSSI distance is always larger than the real distance. The distance correction factor β is considered as a deviation factor between D mean and D median , which can be used to correct one of them iteratively as in [37]. However, the iterations criteria require additional RSSI real-time processing and more complexity. Therefore, the correction exponent σ is introduced in Equation (8) to compensate for the number of iterations required to correct D mean and D median . Accordingly, the correction computations are done once for each distance. In order to derive the appropriate value of the correction exponent, D predicted is replaced with the real distance values which are 1, 2, 3, 4, 5 and 6 m, respectively, so Equation (8) can be written as: (13) Equation (13) represents an expression of the correction exponent for different distances. In this work, we found the correction factor and correction exponent at 1, 2, 3, 4, 5 and 6 m distances for each beacon to fit the experimental areas' size. The proposed relationship for the correction factor and correction exponent may be considered as an asymptotic correction formula based on our experiments and measurements that extended to 240,000 RSSI samples. We found that this approximation is some sort of reasonable fitness to the correction of the indoor localization problem. We justify these values based on the proposed relation, and we predict its accuracy in the proposed experimental areas. In addition, the proposed equations are trying to correlate between the expectation of the measured values versus the accumulation of the readings so that we can predict (approximately) the real distance. In other words, by using the proposed relationship, we may approach a good estimation of the concurrent real distance between the unknown node and the beacon in the indoor application and we can claim that this approximation is suited enough for indoor application and localization scenario. Figure 2 summarizes the process of our RSSI distance prediction and correction algorithm.
It is very important to mention that the process of collection of RSSI samples at certain distances per beacon was performed in the same experimental environment where we test our enhanced positioning centroid algorithm. In other words, the effects of electromagnetic interference in the indoor environment are considered when the correction factor and correction exponent are derived. Hence, the positioning process is performed more accurately. It is very important to mention that the process of collection of RSSI samples at certain distances per beacon was performed in the same experimental environment where we test our enhanced positioning centroid algorithm. In other words, the effects of electromagnetic interference in the indoor environment are considered when the correction factor and correction exponent are derived. Hence, the positioning process is performed more accurately.

The Triangle Centroid Positioning Algorithm
The main concept of the triangle centroid localization algorithm is described as follows: three beacons are placed where their coordinates represent the centers of three circles and the distance between each beacon and the unknown node is treated as a radius

The Triangle Centroid Positioning Algorithm
The main concept of the triangle centroid localization algorithm is described as follows: three beacons are placed where their coordinates represent the centers of three circles and the distance between each beacon and the unknown node is treated as a radius of each circle. The three circles are intersecting in six points where a triangle is formed from the inner intersection points. Then, the unknown node coordinates can be found by calculating the centroid of the triangle. Figure 3 shows a schematic diagram of the triangle centroid localization algorithm.
of each circle. The three circles are intersecting in six points where a triangle is formed from the inner intersection points. Then, the unknown node coordinates can be found by calculating the centroid of the triangle. Figure 3 shows a schematic diagram of the triangle centroid localization algorithm. As depicted in Figure 3, C1, C2, and C3 are defined as the three beacons positions with coordinates of ( , ), ( , ) and ( , ) as centers of circles and their corresponding radiuses are d1, d2, and d3, respectively. The points ( , ), ( , ) and ( , ) are the three inner intersection points of the three circles which are considered as the vertexes of the triangle centroid localization algorithm. The coordinates of the intersection point between the circles C2 and C3 can be obtained by solving Equation (14): By solving the two sets of coordinates in Equation (14), the coordinates of the inner intersection point ( , ) can be obtained. The remaining inner intersection points ( , ) and ( , ) is calculated similarly as the point ( , ).
Finally, the coordinates of the unknown node ( , ) can be calculated using Equation (15):

The Weighted Centroid Positioning Algorithm
As mentioned earlier in this paper, the centroid localization algorithm does not fully consider the node distribution issue, which leads to high positioning errors. By taking the geometric distribution of the beacon nodes into consideration, the weighted centroid localization algorithm is developed in [28][29][30][31]. A new weighting factor is introduced to reflect the impact of each beacon node on the centroid position. In this paper, we used the weighting factors as in [25] where the weighting factor of the inner intersection point As depicted in Figure 3, C 1 , C 2, and C 3 are defined as the three beacons positions with coordinates of (x c1 , y c1 ), (x c2 , y c2 ) and (x c3 , y c3 ) as centers of circles and their corresponding radiuses are d 1 , d 2, and d 3 , respectively. The points I 1 (x 1 , y 1 ), I 2 (x 2 , y 2 ) and I 3 (x 3 , y 3 ) are the three inner intersection points of the three circles which are considered as the vertexes of the triangle centroid localization algorithm.
The coordinates of the intersection point between the circles C 2 and C 3 can be obtained by solving Equation (14): By solving the two sets of coordinates in Equation (14), the coordinates of the inner intersection point I 1 (x 1 , y 1 ) can be obtained. The remaining inner intersection points I 2 (x 2 , y 2 ) and I 3 (x 3 , y 3 ) is calculated similarly as the point I 1 (x 1 , y 1 ).
Finally, the coordinates of the unknown node U(x u , y u ) can be calculated using Equation (15):

The Weighted Centroid Positioning Algorithm
As mentioned earlier in this paper, the centroid localization algorithm does not fully consider the node distribution issue, which leads to high positioning errors. By taking the geometric distribution of the beacon nodes into consideration, the weighted centroid localization algorithm is developed in [28][29][30][31]. A new weighting factor is introduced to reflect the impact of each beacon node on the centroid position. In this paper, we used the weighting factors as in [25] where the weighting factor of the inner intersection point equals the reciprocal of the radiuses of the intersecting circles at that point. Referring to Figure 3, the weighting factors can be expressed as follows: where w 1 , w 2 and w 3 are the weighting factors of the three inner intersection points I 1 (x 1 , y 1 ), I 2 (x 2 , y 2 ) and I 3 (x 3 , y 3 ), respectively. The final coordinates of the unknown node U(x u , y u ) can be obtained using Equation (17):

The Iterative Centroid Positioning Algorithm
The iterative centroid localization algorithm is presented in [37] and it is based on RSSI log-distance distribution model. As we use the iterative centroid algorithm in the comparison between our enhanced centroid algorithm and the other localization algorithms, we will briefly summarize the main principle of it in the following steps:

1.
After receiving RSSI samples from the beacons, The blind (unknown node) chooses the highest three RSSI values and calculate their distances from log-distance model using Equation (3), recall them d p1,2,3 ; where d p1 is the calculated distance between the unknown node and one of the closest beacons to it using the log-distance distribution model.

2.
The distances between the three beacons and the unknown node are used in the triangle centroid positioning algorithm to calculate the initial coordinates of the unknown node. Then the calculated coordinates of the unknown node are used to find the distance between it and the three beacon nodes, recall them d c1,2,3 ; where d c1 is the calculated distance between the unknown node and one of the closest beacons to it using the triangle centroid positioning algorithm.

3.
To measure the deviation between the RSSI log-distance model calculated distances and the triangle centroid localization algorithm calculated distances, a distance deviation coefficient is introduced using Equation (18); 4.
The distance deviation coefficients are sorted to find the median value of them, recall it C m−dev ; where C m−dev is the median distance deviation coefficient, which is used to correct the log-distance model calculated distances. 5.
The corrected distances can be obtained by using Equation (19): 6.
The corrected distances are inserted into the triangle centroid localization algorithm iteratively starting from step 2 until a termination condition is satisfied. Since the iteration error no longer varies after 10 iterations, we set the number of iterations to be 10 in our comparative analysis.

The Proposed Enhanced Centroid Positioning Algorithm
In this subsection, we present our enhanced centroid positioning algorithm based on the proposed RSSI distance correction and prediction method. Depending on the correction factor, the correction exponent and the mean distance of the selected distances in each beacon node, the enhanced centroid positioning algorithm is capable of correcting the real-time RSSI based distances and using those corrected distances as an input to the centroid localization algorithm to calculate the final coordinates of the unknown node. Since each beacon node has a universally unique identifier (UUID), the enhanced centroid localization algorithm can identify the stored correction factors and the mean distances of each beacon uniquely.
The process of the enhanced centroid localization algorithm is described as follows: the unknown terminal collects RSSI samples from each beacon node. The RSSI samples are converted to equivalent distances using the RSSI log-distance distribution relationship expressed in Equation (3). The mean value of the equivalent distances is obtained from Equation (6) and the smallest three mean distance values are chosen to represent the nearest three beacons to the unknown node. As the source of the three mean distance values is identified by a unique UUID for each beacon, the correction factor and the correction exponent is found by approximating each mean distance value of the three values to the nearest D mean value in the corresponding correction table. The prediction and correction formula used in the unknown node is expressed in Equation (20): where D mean is the mean value of the equivalent distances from each beacon node; β σ is the correction factor with its correction exponent based on the approximation of the mean distance value to the nearest D mean value in the corresponding correction table for each beacon UUID; D corrected is the corrected distance between each beacon and the unknown node. Finally, the corrected three distances are treated as an input to the centroid positioning algorithm, where the final unknown node coordinates are obtained. Figure 4 depicts the proposed positioning technique.

The Proposed Enhanced Centroid Positioning Algorithm
In this subsection, we present our enhanced centroid positioning algorithm based on the proposed RSSI distance correction and prediction method. Depending on the correction factor, the correction exponent and the mean distance of the selected distances in each beacon node, the enhanced centroid positioning algorithm is capable of correcting the real-time RSSI based distances and using those corrected distances as an input to the centroid localization algorithm to calculate the final coordinates of the unknown node. Since each beacon node has a universally unique identifier (UUID), the enhanced centroid localization algorithm can identify the stored correction factors and the mean distances of each beacon uniquely.
The process of the enhanced centroid localization algorithm is described as follows: the unknown terminal collects RSSI samples from each beacon node. The RSSI samples are converted to equivalent distances using the RSSI log-distance distribution relationship expressed in Equation (3). The mean value of the equivalent distances is obtained from Equation (6) and the smallest three mean distance values are chosen to represent the nearest three beacons to the unknown node. As the source of the three mean distance values is identified by a unique UUID for each beacon, the correction factor and the correction exponent is found by approximating each mean distance value of the three values to the nearest value in the corresponding correction table. The prediction and correction formula used in the unknown node is expressed in Equation (20): where is the mean value of the equivalent distances from each beacon node; is the correction factor with its correction exponent based on the approximation of the mean distance value to the nearest value in the corresponding correction table for each beacon UUID; is the corrected distance between each beacon and the unknown node. Finally, the corrected three distances are treated as an input to the centroid positioning algorithm, where the final unknown node coordinates are obtained. Figure 4 depicts the proposed positioning technique. By implementing the previous procedures, the positioning error caused by randomness in RSSI values can be dramatically minimized. Besides, the errors caused by complex indoor environment geometric distribution are minified since the correction factors are driven in the same indoor environment to be positioned. The process of the enhanced centroid positioning algorithm from the perspective of an unknown node is summarized in Figure 5.
By implementing the previous procedures, the positioning error caused by randomness in RSSI values can be dramatically minimized. Besides, the errors caused by complex indoor environment geometric distribution are minified since the correction factors are driven in the same indoor environment to be positioned. The process of the enhanced centroid positioning algorithm from the perspective of an unknown node is summarized in Figure 5.

Experiments
In this section, we will display our experiment implementation, including the used software, hardware devices, and the experimental site details.

Device and Software
Our experiment is constructed using five Android terminals, one of them is treated as the unknown node and the other four terminals are acting as BLE iBeacons. Using Beacon Simulator software [41], the Android terminal can be transformed into a virtual BLE beacon transmitter and advertiser. This software offers different beacon configurations to emulate a physical beacon. In this experiment, we used iBeacon platform in all Android terminals to broadcast and advertise iBeacon frames. Figure 6 illustrates the application user interface and the iBeacon configuration used in the experiment. The RSSI is continuously measured for one minute at a distance of 1 m from each beacon, and the mean value of the measured RSSI is taken as the value of A in Equation (3). The path loss exponent value was approximated to 3 as a typical value in office indoor environments at 2.4 GHz operating frequency [42]. As can be seen from Figure 6, frequency mode is set to 10 Hz which means that the transmission interval is 0.1 s and hence facilitate our 5000 RSSI samples collection process for the selected distances on each beacon node.

Experiments
In this section, we will display our experiment implementation, including the used software, hardware devices, and the experimental site details.

Device and Software
Our experiment is constructed using five Android terminals, one of them is treated as the unknown node and the other four terminals are acting as BLE iBeacons. Using Beacon Simulator software [41], the Android terminal can be transformed into a virtual BLE beacon transmitter and advertiser. This software offers different beacon configurations to emulate a physical beacon. In this experiment, we used iBeacon platform in all Android terminals to broadcast and advertise iBeacon frames. Figure 6 illustrates the application user interface and the iBeacon configuration used in the experiment. The RSSI is continuously measured for one minute at a distance of 1 m from each beacon, and the mean value of the measured RSSI is taken as the value of A in expression (3). The path loss exponent value was approximated to 3 as a typical value in office indoor environments at 2.4 GHz operating frequency [42]. As can be seen from Figure 6, frequency mode is set to 10 Hz which means that the transmission interval is 0.1 s and hence facilitate our 5000 RSSI samples collection process for the selected distances on each beacon node.

Experimental Sites
We carried out our experiment in an 7 m 7m office room with multiple desks and chairs, and a 6.5 m 1.5 m corridor with a printer and a single chair. The BLE beacons are placed at the four corners of the office room with coordinates (0,0), (0,7), (7,0) and (7,7) as illustrated in Figure 7a, and with coordinates (0,0), (6.5,0), (0,1.5) and (6.5,1.5) for the corridor as depicted in Figure 7b. At the data training stage, 5,000 RSSI samples are collected and recorded at 1, 2, 3, 4, 5 and 6 m distances from each beacon node. The RSSI values collection takes place at the experimental sites themselves to consider the multipath and geometric distribution effects on the signal intensity when the correction factors per distance are driven.

Experimental Sites
We carried out our experiment in an 7 m × 7 m office room with multiple desks and chairs, and a 6.5 m × 1.5 m corridor with a printer and a single chair. The BLE beacons are placed at the four corners of the office room with coordinates B 1 (0, 0), B 2 (0, 7), B 3 (7, 0) and B 4 (7, 7) as illustrated in Figure 7a, and with coordinates B 1 (0, 0), B 2 (6.5, 0), B 3 (0, 1.5) and B 4 (6.5, 1.5) for the corridor as depicted in Figure 7b. At the data training stage, 5000 RSSI samples are collected and recorded at 1, 2, 3, 4, 5 and 6 m distances from each beacon node. The RSSI values collection takes place at the experimental sites themselves to consider the multipath and geometric distribution effects on the signal intensity when the correction factors per distance are driven.
The 1, 2, 3, 4 5 and 6 m distances are taken at a 45-degree angle from each corner beacon node. All beacon nodes are placed at the same height at 1.3 m above the ground. Moreover, some people walk randomly during the data training stage and the positioning stage to emulate a real case scenario. The 1, 2, 3, 4 5 and 6 m distances are taken at a 45-degree angle from each corner beacon node. All beacon nodes are placed at the same height at 1.3 m above the ground. Moreover, some people walk randomly during the data training stage and the positioning stage to emulate a real case scenario.

Results and Discussion
This section presents our experimental results of the proposed positioning technique compared to other positioning algorithms from the localization accuracy and positioning stability point of view. Moreover, the proposed enhanced centroid algorithm performance is evaluated when a different number of RSSI samples are collected in real-time to ensure the proposed technique's feasibility.

The Correction Factors of the Proposed RSSI Distance Prediction and Correction Model
We used a Bluetooth scanner application, namely Beacon Scanner [43], with no delay between each scan, and the logging frequency is adjusted to be every scan. Then a logging endpoint is recording the received RSSI values for the correction factors' derivation. We collect the RSSI Values for each distance independently at each beacon, and the values are recorded and sent to a weblogger (logging endpoint). The process of receiving and collecting the RSSI Values takes around 12 min average time at each distance. It worth noting that at 10 Hz mode, two consecutive readings would have precisely the same RSSI values as they could come from the same sensor readings. This means the 5000 samples could come from a much lower quantity of sensor readings (Beacons). This duplication in RSSI

Results and Discussion
This section presents our experimental results of the proposed positioning technique compared to other positioning algorithms from the localization accuracy and positioning stability point of view. Moreover, the proposed enhanced centroid algorithm performance is evaluated when a different number of RSSI samples are collected in real-time to ensure the proposed technique's feasibility.

The Correction Factors of the Proposed RSSI Distance Prediction and Correction Model
We used a Bluetooth scanner application, namely Beacon Scanner [43], with no delay between each scan, and the logging frequency is adjusted to be every scan. Then a logging endpoint is recording the received RSSI values for the correction factors' derivation. We collect the RSSI Values for each distance independently at each beacon, and the values are recorded and sent to a weblogger (logging endpoint). The process of receiving and collecting the RSSI Values takes around 12 min average time at each distance. It worth noting that at 10 Hz mode, two consecutive readings would have precisely the same RSSI values as they could come from the same sensor readings. This means the 5000 samples could come from a much lower quantity of sensor readings (Beacons). This duplication in RSSI values does not affect the proposed technique correction factors' accuracy as the number of RSSI samples is relatively large. The outcomes of our proposed RSSI distance prediction and correction method at the two experimental sites are shown in Tables 2 and 3. As can be seen from Tables 2 and 3, the mean distance, correction factor, and correction exponent are calculated and driven at 1, 2, 3, 4, 5 and 6 m distances using Equations (6), (7), (9) and (13), respectively. Each beacon is used to calculate its correction factors based on the previously mentioned technique. Those tables are saved on the unknown terminal as it is used later in the enhanced centroid positioning algorithm to correct the real-time RSSI equivalent distances.

Predicted Distances Accuracy
Our proposed RSSI distance prediction and correction model improves the accuracy of the RSSI estimated distances. To verify this, the unknown node is placed at predefined distances from each BLE beacon to test the correction formula and the correction factors. The unknown Android terminal uses the Android Beacon Library [44] to interact with beacons. This library uses RSSI average values to calculate the unknown distances. Therefore, the average RSSI filter is used as a conventional method to calculate the distance between the unknown node and other beacons before applying the positioning algorithm and hence used in our comparison. Figure 8 shows the error in the measured distances using the RSSI averaging method and the predicted distances using the correction factor and the correction exponent based on Equation (20). We took 18 different distances from each beacon to test the proposed correction formula compared with the mean RSSI filter estimated distances. In addition, the root-mean-square error (RMSE) of the measured distances is calculated to compare the proposed prediction method and the conventional average method.
As shown in Figure 8, using the correction factors and correction exponents to correct the measured distance based on our RSSI distance prediction model decreases the error significantly.

Localization Accuracy
Next, a quantitative analysis of the positioning errors of different positioning algorithms is constructed. We compared our enhanced centroid positioning algorithm based on the proposed RSSI distance prediction and correction model with other positioning algorithms, namely, the triangle centroid algorithm, the weighted triangle centroid algorithm, and the iterative centroid positioning algorithm which were previously discussed.
In the positioning stage, the unknown node (Android terminal) was placed in 30 different locations inside the office room and 15 different locations in the corridor to calculate

Localization Accuracy
Next, a quantitative analysis of the positioning errors of different positioning algorithms is constructed. We compared our enhanced centroid positioning algorithm based on the proposed RSSI distance prediction and correction model with other positioning algorithms, namely, the triangle centroid algorithm, the weighted triangle centroid algorithm, and the iterative centroid positioning algorithm which were previously discussed.
In the positioning stage, the unknown node (Android terminal) was placed in 30 different locations inside the office room and 15 different locations in the corridor to calculate its final positioning coordinates. Figure 9 shows the positioning errors in meters and the cumulative distribution function (CDF) of the positioning error as recommended by the ISO18305:2016 standard for real-time locating systems [45] for the 30 locations (office room) and the 15 locations (corridor) using different localization algorithms, including our enhanced centroid algorithm.
its final positioning coordinates. Figure 9 shows the positioning errors in meters and the cumulative distribution function (CDF) of the positioning error as recommended by the ISO18305:2016 standard for real-time locating systems [45] for the 30 locations (office room) and the 15 locations (corridor) using different localization algorithms, including our enhanced centroid algorithm. It is evident from the figure that almost all the errors obtained by using the enhanced centroid positioning algorithm based on the proposed RSSI distance correction model were less than the other positioning algorithms. It is important to mention that the other positioning algorithms use the measured distances between the unknown terminal and other beacon nodes based on averaging the received RSSI samples at the Android terminal.
In Figure 10, the average localization error (ALE) and the percentage of accuracy are shown with respect to total unknown locations ranging from 5 to 30 unknown location (office) and from 3 to 15 unknown location (corridor). It is evident from the figure that almost all the errors obtained by using the enhanced centroid positioning algorithm based on the proposed RSSI distance correction model were less than the other positioning algorithms. It is important to mention that the other positioning algorithms use the measured distances between the unknown terminal and other beacon nodes based on averaging the received RSSI samples at the Android terminal.
In Figure 10, the average localization error (ALE) and the percentage of accuracy are shown with respect to total unknown locations ranging from 5 to 30 unknown location (office) and from 3 to 15 unknown location (corridor).
As shown on the left in Figure 10a,b, the average localization error values of the proposed enhanced centroid algorithm at both the office room and the corridor are considerably less than the centroid, weighted centroid, and iterative centroid algorithms. The average localization error is obtained at the office room for 5, 10, 15, 20, 25, and 30 unknown nodes and the corridor for 3, 6, 9, 12, and 15 unknown nodes. As also can be seen in Figure 10a,b on the right, the accuracy percentage of the proposed enhanced centroid algorithm at the office room ranges from 94.19% to 95.707%, while its range changes from 77.465% to 81.358%, 81.042% to 83.74%, and 87.859% to 89.14% for the centroid, weighted centroid and iterative centroid algorithms, respectively. The accuracy percentage of the proposed enhanced centroid algorithm at the corridor ranges from 94.57% to 95.776%, while its range changes from 82.7% to 87.15%, 85.95% to 92.44%, and 90.367% to 93.777% for the centroid, weighted centroid and iterative centroid algorithms, respectively. As shown on the left in Figure 10a,b, the average localization error values of the pr posed enhanced centroid algorithm at both the office room and the corridor are consid ably less than the centroid, weighted centroid, and iterative centroid algorithms. The a erage localization error is obtained at the office room for 5, 10, 15, 20, 25, and 30 unknow nodes and the corridor for 3, 6, 9, 12, and 15 unknown nodes. As also can be seen in Figu  10a,b on the right, the accuracy percentage of the proposed enhanced centroid algorith at the office room ranges from 94.19% to 95.707%, while its range changes from 77.465 to 81.358%, 81.042% to 83.74%, and 87.859% to 89.14% for the centroid, weighted centro and iterative centroid algorithms, respectively. The accuracy percentage of the propos enhanced centroid algorithm at the corridor ranges from 94.57% to 95.776%, while range changes from 82.7% to 87.15%, 85.95% to 92.44%, and 90.367% to 93.777% for t centroid, weighted centroid and iterative centroid algorithms, respectively. Table 4 summarizes the localization accuracy of the four positioning algorithms the two experimental sites. Hence the enhanced centroid algorithm based on the propos RSSI distance prediction and correction model outperforms the other positioning alg rithms in terms of localization accuracy.   Table 4 summarizes the localization accuracy of the four positioning algorithms at the two experimental sites. Hence the enhanced centroid algorithm based on the proposed RSSI distance prediction and correction model outperforms the other positioning algorithms in terms of localization accuracy. The positioning error parameters of the proposed enhanced centroid algorithm and the other positioning algorithms, including the average localization error (ALE), maximum error, minimum error, and the RSME at both experimental sites, are presented in Figure 11. The positioning error parameters of the proposed enhanced centroid algorithm and the other positioning algorithms, including the average localization error (ALE), maximum error, minimum error, and the RSME at both experimental sites, are presented in Figure 11. As depicted in Figure 11a, the RMSE, maximum error, and minimum error values of the positioning results obtained by the enhanced centroid positioning algorithm based on the proposed RSSI distance prediction and correction model at the office room are lower than the other positioning algorithms. Moreover, the average localization errors of the four algorithms are 0.3, 0.76, 1.327 and 1.577 m, respectively, and the localization accuracy of the proposed enhanced centroid algorithm is improved by 80.97%, 77.39% and 60.526% compared with the centroid algorithm, the weighted centroid algorithm and the iterative centroid algorithm, respectively. As depicted in Figure 11b, the four algorithms' average localization errors at the corridor are 0.278, 0.404, 0.491 and 0.855 m, respectively.

Localization Accuracy Percentage Range
The proposed enhanced centroid algorithm's localization accuracy is improved by 67.51%, 43.42%, and 31.3% compared with the centroid algorithm, the weighted centroid algorithm, and the iterative centroid algorithm, respectively. Finally, Figure 12 presents a comparison between the actual test points position and the predicted position using the proposed enhanced centroid algorithm at the two experimental sites. compared with the centroid algorithm, the weighted centroid algorithm and the iterative centroid algorithm, respectively. As depicted in Figure 11b, the four algorithms' average localization errors at the corridor are 0.278, 0.404, 0.491 and 0.855 m, respectively. The proposed enhanced centroid algorithm's localization accuracy is improved by 67.51%, 43.42%, and 31.3% compared with the centroid algorithm, the weighted centroid algorithm, and the iterative centroid algorithm, respectively. Finally, Figure 12 presents a comparison between the actual test points position and the predicted position using the proposed enhanced centroid algorithm at the two experimental sites. Thus, it can be clarified that the enhanced centroid localization algorithm based on the proposed RSSI distance prediction and correction method dramatically improves the positioning accuracy in indoor environments. Our proposed method can be used in small and medium indoor environments, especially at room level. However, the limitation of the proposed method enlarges in wide indoor environments since more beacon nodes are required to cover the localized area; accordingly, more pre-trained distances are needed to obtain correction factors at the expense of time factor. Thus, it can be clarified that the enhanced centroid localization algorithm based on the proposed RSSI distance prediction and correction method dramatically improves the positioning accuracy in indoor environments. Our proposed method can be used in small and medium indoor environments, especially at room level. However, the limitation of the proposed method enlarges in wide indoor environments since more beacon nodes are required to cover the localized area; accordingly, more pre-trained distances are needed to obtain correction factors at the expense of time factor. Figure 13 presents the calculated positioning errors in sequence. The positioning error is calculated 10 times at random five test points in both the office and the corridor. Based on each test point's accuracy fluctuations, the proposed positioning technique's errors vary little, while the errors by the other positioning algorithms using average RSSI filter change significantly. Fortunately, the proposed technique also almost gains the best accuracy in every positioning trial's overall improvement. The overall positioning stability is measured using the sample standard devia (SSD); the SSD can be obtained using the following formula:

Positioning Stability
is the p tioning error for 10 times at each test-point. Tables 5 and 6 show that the proposed positioning technique achieves smaller sam The overall positioning stability is measured using the sample standard deviation (SSD); the SSD can be obtained using the following formula: where STD(_) is the standard deviation, MEAN(_) is the average value; E is the positioning error for 10 times at each test-point. Tables 5 and 6 show that the proposed positioning technique achieves smaller sample variance and closer average positions for each test point than the other positioning algorithms deploying average filter. The office room's overall positioning stability is 1.64, 2.077, and 2.14-fold better for the proposed enhanced centroid than the centroid, weighted centroid, and iterative centroid, respectively. The corridor's overall positioning stability is 2.3, 1.94, and 1.29-fold better for the proposed enhanced centroid than the centroid, weighted centroid, and iterative centroid, respectively. Thus, we can claim that our enhanced centroid algorithm based on the proposed RSSI distance correction model improves indoor environments' overall positioning stability. The reason for that is due to the low deviation characteristics of proposed RSSI distance correction measurements as early discussed in Section 2.2 in Table 1.

The Effect of Different RSSI Samples' Number on the Localization Accuracy
In this experiment, the proposed enhanced centroid algorithm was performed at 5 random test points in both experimental sites. The proposed enhanced centroid algorithm was performed at each point when a different number of RSSI samples is collected. The proposed algorithm was conducted 100 times for each number of collected RSSI samples, and the average error of the 100 trials was computed. Tables 7 and 8 presents the proposed technique's localization error at the office room and the corridor when a different number of RSSI samples is collected.
The proposed enhanced centroid algorithms' overall average localization error at the five test points varies from 0.313 to 0.337 m and from 0.326 to 0.354 m at the office room and corridor, respectively, when the number of received RSSI samples varies from 100 to 50 RSSI sample. It can be inferred that the received RSSI samples' number has no great impact on the localization accuracy of the proposed technique. However, if the RSSI samples' number becomes lower than the 50 RSSI sample, 40 RSSI samples, such as or below, the proposed enhanced centroid algorithm sometimes becomes infeasible. That is it, the RSSI samples' number is not enough to correctly calculate the proposed model correction factors, and the corrected estimated distance becomes smaller than the real distance. Therefore, it is recommended to collect at least 50 RSSI samples or more at the unknown node to ensure the feasibility of the proposed correction model.

Conclusions
Due to the rapid development of wireless communication technology, the position information of nodes has become a critical feature in different applications. Indoor localization techniques face common issues, including poor localization accuracy, expensive communication costs and high energy consumption. A new cost-effective and high accuracy and stability localization solution is presented in this paper to overcome these problems. The proposed RSSI distance prediction and correction model introduced new correction factors to accurately predict the real distance between the unknown terminal and the anchor (beacon) nodes. Importantly, our practical results provide evidence for the correctness of the estimated distances based on the proposed RSSI distance correction model. Moreover, the experimental results of the enhanced centroid localization algorithm based on the proposed RSSI distance prediction and correction model shows a significant improvement in the positioning accuracy of the unknown nodes. The proposed enhanced centroid algorithm's localization accuracy is improved by 80.97% and 67.51% in an office room and a corridor, respectively, compared with the traditional RSSI positioning algorithm. The proposed technique also promotes positioning stability by 1.64 and 2.3-fold at the office room and the corridor, respectively, compared to the conventional RSSI positioning method. The proposed correction model is entirely feasible in real-time when the RSSI sample number is 50 or more. However, if the received RSSI samples are less than 50, the proposed technique is partially feasible. Finally, the proposed technique is intended for small to medium indoor environments, especially at the room level. In the future, we can utilize the proposed method in trajectory planning and navigation of objects moving at high speed in larger indoor environments.