Improvement of triangle centroid localization algorithm based on PIT criterion (ITCL-PIT) for WSNs

One of the most significant study directions is node positioning in wireless sensor networks (WSNs). Because the existing RSSI-based triangle centroid localization technique is susceptible to the surrounding environment, this paper proposes an improved triangle centroid localization algorithm based on point-in-triangulation (PIT) criterion (ITCL-PIT) in terms of positioning accuracy and response speed. When combined with the actual placement situation in conventional triangle centroid localization, the suggested algorithm considers the estimated coordinates of the junction points as extra beacon nodes. As a result of the new beacon nodes, the size of the triangle in the junction region is decreased. Then, using the PIT criteria, keep calculating until the predicted position of the node is outside the triangle. Finally, the unknown node's coordinates are determined using the centroid approach. Based on the guaranteed response time, when the communication distance is 15–30 m, the ITCL-PIT method may enhance localization accuracy by up to five times when compared to the standard triangle centroid localization approach. Furthermore, the proposed technique has higher localization accuracy and faster response speed than the centroid iterative estimation approach, and the response time of the ITCL-PIT algorithm is reduced by around 17%. In addition, the experimental platform is built to ensure that the proposed strategy effectively lowers positioning error.

Since the range-free positioning algorithm does not need to calculate the relative distance or angle as precisely as the range-based positioning algorithm, it requires less hardware and has lower communication costs, making it more feasible for practical applications. The improved triangle centroid localization algorithm based on RSSI is investigated in this paper, which covers two aspects of positioning accuracy and response speed. Because noise, multipath effect, diffraction, temperature, and other factors in surrounding environment can readily impact the wireless signal, the data error acquired by RSSI is high.
The approaches employed at home and abroad to lessen the error generated by the positioning process are mostly based on two aspects. The first approach is to improve the wireless signal's transmission loss model and create a more realistic model; the second way is to improve the positioning algorithm to eliminate mistakes. The current study focuses mostly on refining the positioning algorithm.
The domestic and international literature have investigated traditional RSSI positioning algorithm in order to address the limitations of this method, such as adding the existence probability function [12], measuring error observer [13] or data mapping [14], and using Wi-Fi signal instead of the original anti-interference ability weak signal [15], etc. The improved RSSI positioning algorithm's positioning accuracy has been substantially improved thanks to the approaches described above. In addition, the RSSI positioning algorithm can be integrated with other algorithms to reduce positioning errors, such as iterative calculation [16], weighted centroid algorithms [17,18].
From the perspective of research algorithm optimization, Ding et al. [19] present the maximum and minimum method and the maximum likelihood estimation method to solve the low RSSI positioning accuracy based on the actual distance between the beacon node and the unknown node being within 10 m, and the final positioning error being within 3 m. It can be seen that the above suggested algorithm still has a significant flaw. Shi et al. [20] provide a tri-partition RSSI classification and RSSI filter based on its tracing technique, this method is suitable for improving the RSSI algorithm's stability and decreasing the effect on the surrounding environment.
From the application point of view, it can be applied to the RSSI measurement of smartphones [21]. Furthermore, Bae et al. [22] provide a robust ranging approach based on RSSI which can be applied in robotics and IoT, with the goal of determining the position of mobile nodes. The RSSI algorithm is inextricably linked to indoor environment as well. A sensor fusion framework for indoor positioning by using the smartphone inertial measurement unit (IMU) sensor data is proposed [23], and the suggested framework is more suitable to inside setting. One of the most often utilized algorithms for indoor positioning is fingerprint matching. Poulose et al. [24] compare four fingerprint matching algorithms for Wi-Fi RSSI signals: closest neighbor, k-nearest neighbors, weight k-nearest neighbor, and Bayesian fingerprint matching technique. What's more, Sun et al. [25] provide a novel distance metric to investigate the assiciation between the RSSI distance and the indoor distance. The recurrent neural network is proposed by Hoang et al. [26], and the positioning technique paired with deep learning can locate a succession of positions. This strategy, however, necessitates gathering the RSSI data of a large number of different beacons in various places in preparation. It's possible that the RSSI values for some places aren't in the database.
From the perspective of information theory, Zhou et al. [27] investigate the Cramer-Rao Lower Bound (CRLB). These papers only provide a qualitative analysis of accuracy and do not take response time into account. Futhermore, such an approach as the fingerprint positioning algorithm has a number of prerequisites. More crucially, this work not only examines the method from the Matlab simulation, but also conducts a hardware platform verification experiment. As a result, the response speed must be considered in real systems.
From the perspective of improving accuracy and response time, the improved triangular centroid localization algorithm based on RSSI (ITCL-PIT) is studied in paper. The ITCL-PIT method interprets the calculated intersection coordinates and builds new beacon node to gradually reduce the triangle area in the intersecting region. Then, the PIT criteria is utilized to determine whether the unknown node is located inside triangle area. Finally, the centroid technique is used to determine the coordinates of an unknown node. Compared with the traditional triangle centroid localization algorithm, the ITCL-PIT algorithm delivers a higher level of positioning accuracy based on the guaranteed response time. What's more, the positioning accuracy is also improved compared to the centroid iterative estimation positioning algorithm. The 1. We present an improved triangle centroid localization algorithm based on PIT criterion(ITCL-PIT) in this paper. It was discovered that the ITCL-PIT method, when compared to the triangle centroid localization technique, can improve localization accuracy by up to five times, depending on the promised response time.Futhermore, the ITCL-PIT algorithm outperforms the centroid iterative estimation algorithm in term of positioning accuracy and response speed. As a result, the ITCL-PIT algorithm has a higher overall performance. 2. We also use the ESP07 module to build the hardware experimental platform to test the traditional triangle centroid localization algorithm, centroid iterative estimation algorithm and the suggested algorithm. According to the test result, the positioning errors of the proposed ITCL-PIT algorithm is fewer than the errors of the other two positioning algorithms, with a positioning error of 1.42 cm.
The reminders of the paper are organized as follows: Sect. 2 describes the calculation method of the calculation method and communication model. Section 3 describes the triangular centroid localization algorithm. Section 4 describes the core idea of the ITCL-PIT algorithm. Section 5 evaluates the performance of ITCL-PIT algorithm compared with the existing positioning algorithm. Finally, the conclusion and future directions are drawn in Sect. 6.

Communication model and calculation method
The RSSI is mainly dependent on the signal loss strength to quantify the distance between transmission and reception. Based on RSSI measurements, the empirical and theoretical signal propagation nodels are widely utilized. The empirical model is based on the establishment of an offline database that compares received signal intensity to real time location to obtain the corresponding coordinates. Since the acquired data may not match the corresponding location in the database, the database requires sufficient data to reduce mistakes. The theoretical models commonly include the following: the free space propagation model, the two-ray ground model and the shadowing model. The free space propagation model is susceptible to obstructions and has an excessively high fading rate. The two-ray ground model is more complicated and unsuitable for short-range signal transmission. Compared with the above two models, the shadowing model has less restricted conditions, is easy to implement and is more realistic. More significantly, this model is adopted in most algorithms. Hence, the shadowing model [5,10,20] is employed in this experiment, which can be expressed as the following formula.
where P L (d) represents received signal strength; P L (d 0 ) represents the signal strength when the transmitting end and the receiving end are separated by 1 m, its value range is generally 45-49; η represents environmental attenuation factor; d represents the calculated distance between the transmitting end and the receiving end; X σ represents zero mean Gaussian random variable. The loss RSSI value can be converted to the distance by the above path loss formula (1).

Triangular centroid localization algorithm
Based on the communication model, it is considered that the calculated received signal strength and the actual situation are vastly different. The coordinates of unknown node D can be correctly obtained by calculating the distance d * a , d * b , d * c between the beacon node A, B, C and the unknown nodes D in an ideal case, which can also be used as the radius of the circle A, B, C , and the resulting three circles have only one point of intersection.
The ideal model is shown in Fig. 1a, the RSSI-based triangle centroid localization algorithm can be represented as follows. Set the coordinates of beacon nodes A, B, C are (x a , y a )(x b , y b )(x c , y c ) , the coordinate of unknown node D is (x d , y d ) . The following The coordinates of unknown node D can be calculated by the Eq. (3). The actual situation is depicted in Fig. 1b, where the RSSI is susceptible to multi-path attenuation and non-line of sight, resulting in a theoretical distance d between the converted beacon node and the unknown node, which is larger than actual distance d * [28], so that three intersection E, F , G of three circles, which constitute the triangle in the overlapping area EFG . The unknown node D's coordinate is determined using the triangle's centroid. Set that the coordinate of intersection point E is (x e , y e ) , the following inequation can be obtained with the coordinates of the known beacon nodes A, B, C.
According to inequation (4), the coordinate of intersection point E (x e , y e ) can be computed. Similarly, the coordinates of the other two intersecting points F , G can be determined, and according to centroid formula, the coordinate of the unknown node D can be represented by ( x e +x f +x g 3 , y e +y f +y g 3 ). (2)

The establishment of New Beacon node
According to the above traditional RSSI-based triangle centroid localization algorithm, the ITCL-PIT algorithm is proposed in this paper. As can be seen from Fig. 1b, E, F , G are the intersection coordinates of three circles obtained by taking the beacon node A, B, C as the center and d a , d b , d c as the radius into account. As shown in Fig. 2, the intersection coordinates E, F , G (denoted by red dots) are regraded as the new beacon node whose radius is the distance between the intersection coordinates E, F , G and the unknown node D(calculated using the path loss formula (1)), allowing the intersection coordinates E, F , G (represented by blue dots) to be retrieved using the formula (5).
Set the coordinate of intersection point E ′ is (x e1 , y e1 ),which can be calculated by formula (5). Similarly, the coordinates of the intersection point F ′ , G ′ can also be derived. According to above repeated computation procedure, the coordinates of three intersection points E (n) , F (n) , G (n) generated by the nth iteration can be obtained.

Centroid calculation iteration criterion
According to the improved triangle centroid localization algorithm, it can be known that the size of the intersecting region triangle shrinks as new beacon nodes are established. The basis for establishing the new beacon node is that unknown node D needs be located within the triangle. Most of the current centroid algorithm termination criterion set the threshold until the condition is fullfilled to tackle this problem, although applying this type of criterion will result in less precise optimization. In this paper, based on the complexity and positioning error, the PIT criterion in the APIT algorithm can be used as the iterative exit criterion [11]. Compared with other criteria, the PIT criterion is simple, and the positioning accuracy is relatively high, with Fig. 3 The schematic diagram of the PIT criterion. This figure shows how to judge whether the node is located within the triangle a low test error rate. Moreover, the movement of unknown nodes in the PIT criteria can be mimicked by exchanging information with adjacent nodes. As a result, when a new triangle is generated, the judgment is based on the fact that a new beacon node is no longer established when the unknown node D is not within the triangle. The detailed description of the PIT criterion is shown in Fig. 3. It is assumed that there are beacon nodes A, B, C and unknown node D . When the unknown node D has no neighbor nodes close to or far away from the beacon nodes A, B, C at the same time, it can be found that the unknown node D locates within the triangle. Futher, if a neighbor node is close to or away from beacon node A, B, C simultaneously, it is judged that the unknown node is outside the triangle. Hence, it can be combined with  Fig. 2 to determine whether the unknown node D is within the triangle. Moreover, due to the irregular placement of neighbor nodes, it may lead to judgment errors. The probability of arising of this situation is extremely low which is verified through experiments, and thus is ignored in this experiment.

Theoretical analysis of positioning error
In the experiment, the positioning error is defined as Localization_error. If the coordinates of the unknown node is (x est , y est ) , and the true coordinate is (x true , y true ) , the distance is represented as follow. Since all nodes are randomly distributed in simulation when other factors such as the communication radius are the same, the following two situations may generally be considered: there is no positioning error in the beacon node itself and a slight error in the beacon node itself. Figure 4a shows the case where an unknown node is located when there is no positioning error in the beacon node. When the inaccuracy of the specified beacon node is 2 m, Fig. 4b displays the position of an unknown node. Additionally, as the error increases, the positioning error becomes more obvious, and this mistake is usually only reflected when the node is deployed in a hilly terrain or where the signal is poor. All in all, the positioning error of the beacon node itself is not considered in this simulation.
Considering that the communication radius of the beacon node is 20 m, Fig. 5a indicates that the unknown nodes which have been located are regarded as the beacon node of other unknown nodes. Figure 5b shows beacon nodes are employed for positioning when beacon nodes exist around the unknown node. If no beacon node is present, the previously located unknown node is utilized to assist positioning. As the unknown nodes calculated may include errors, the existing beacon nodes around can be used to mitigate the inaccuracies as much as feasible. Overall, when the unknown node contains the neighbor beacon nodes, the neighbor beacon nodes are considered in this experiment. Otherwise, the located unknown node is used to assist the positioning.

Algorithm steps
1. The nodes are randomly distributed in a certain region. After receiving the information (ID of beacon nodes), the unknown node averages the RSSI of the same beacon node; 2. After the unknown node collects the information, the beacon nodes are filtered according to the strength of their RSSI, and the three beacon nodes with the largest RSSI value are selected as the calculation foundation; 3. For the set of beacon nodes, the coordinates of three intersection points are calculated in turn; 4. The PIT algorithm is used to determine whether the unknown node is within the triangle of the intersecting region. If the unknown node is within the triangle, the three intersection coordinates are taken as the new beacon nodes. The area of the triangle is decreased, and then it is judged whether the unknown node is within the smaller triangle's region. The calculation is paused until the unknown node is not within the triangle of the intersecting region; 5. When the unknown node repeatedly judges that it is not in the intersecting region, the coordinates of the three intersection points are forced to halt computation, and the coordinate of the unknown node is obtained by the centroid algorithm.

Software simulation
The ITCL-PIT algorithm is optimized using MATLAB simulation software in experiment. During the simulation process, the distance estimation to each beacon (P L (d)) was derived from the regular model. The simulation parameters are listed in Table 2. The simulation results are depicted in Fig. 6. Due to the random distribution of all nodes, there may be no neighbor beacon nodes surrounding a few unknown nodes. Therefore, a small number of unknown nodes cannot be located through the beacon node or assisted by the already-discovered unknown node.
From the aspects of positioning error and response speed, traditional triangle centroid localization algorithm, centroid iterative estimation localization algorithm [14] and ITCL-PIT algorithm are compared and analyzed in Fig. 7. Figure 7a demonstrates that as the communication distance grows, so do the positioning errors of the three positioning algorithms. The positioning errors of the ITCL-PIT technique and centroid iterative estimate localization algorithm, however, are much lower when compared to the standard triangular centroid localization algorithm. When the communication distance is 0-15 m, the positioning accuracy of the centroid iterative estimation localization algorithm is slightly higher than the ITCL-PIT algorithm, and the accuracy of its improvement is basically unchanged. When the communication distance is 15-30 m, the ITCL-PIT algorithm has higher positioning accuracy than the centroid iterative estimation localization algorithm, and the accuracy is increased by about 50%. It is indicated that the centroid iterative estimation localization algorithm will reduce the positioning accuracy when there are more beacon nodes, and the ITCL-PIT algorithm maintains a relatively gentle error growth rate.
As shown in Fig. 7b, the response time differences between the conventional triangular centroid localization algorithm, the centroid iterative estimation localization algorithm and the ITCL-PIT algorithm are also considered. The response time of the three algorithms increases with the increase of communication distance, and the conventional triangular centroid localization algorithm has the fastest response speed, because this algorithm only applys a few iterations. In addition, considering the response time of the centroid iterative estimation localization algorithm and the ITCL-PIT algorithm, since the number of beacon nodes is large, the centroid iterative estimation algorithm requires more time to select an appropriate beacon node. Therefore, the response time is substantially longer than the ITCL-PIT algorithm in larger communication range, and the response time of the ITCL-PIT algorithm is roughly reduced by 17%. Based on Fig. 7a, b, it can be known that the positioning accuracy of the ITCL-PIT algorithm is greatly improved by increasing the response time, and the algorithm has certain feasibility and practicability.

Complexity analysis
Figure 7b further demonstrates that the conventional triangle centroid localization algorithm has the fastest response time due to the few iterations. As a result, it can roughly obtain the tradtional triangle centroid localization algorithm has the lowest complexity compared with the other two algorithms.
First, the three different positioning algorithms need to calculate the position of the new beacon node at the first stage, and the computational complexity is O(n^3). In the second stage, the traditional triangle centroid localization algorithm needs to use the PIT criteria to obtain the location of the unknown node, and the corresponding computational complexity is O(mlogn). On the other hand, the centroid iterative estimate localization algorithm and the ITCL-PIT algorithm both need to experience multiple iteration to compute the position of the unknown node using the PIT criteria, with the corresponding computational complexity is O(mlogn) Additionaly, it is should be noted that the convergence speed of the centroid iterative estimation algorithm will slow down when the communication range between node grow, resulting in a bigger variance at centroid prediction point. Because it is connected to the shrinking area, the convergence speed of the PIT criteria has been growing slowly with the rise in communication range. All in all, the analysis results of the complexity are roughly consistent with the simulation results obtained in Fig. 7b.

Hardware simulation
The above simulation results of the positioning accuracy and response time are analyzed in detail. In addition, an experimental platform was built to verify the advantages of the ITCL-PIT algorithm in actual scenario when compared with other algorithms. The schematic diagram of the test location is shown in Fig. 8. In this experimental platform, four ESP07 modules are selected as sensor nodes, three of which were utilized as beacon nodes, and the remaining one was employed as an unknown node. The ESP07 modules are used to evaluate three different algorithms with five distinct pieces of data. The origin of the measuring area is (0,0), and the results are depicted in Table 3.
The positioning errors are measured in the experimental platform under the three algorithms: the triangle centroid algorithm, the centroid iterative estimation algorithm and the ITCL-PIT algorithm respectively. According to results in Table 3, the traditional triangle centroid positioning algorithm has the biggest positioning error when compared to the other two algorithms, with an inaccuracy of 3.86 cm. Futhermore, the tested statistics indicates that the ITCL-PIT algorithm has the smallest positioning error, which is only 1.5 cm. Due to the lack of condition and equipment, only positioning error was tested in the experimental platform, and the response time of various algorithms was not tested on the paper.

Conclusion and future work
Considering the two aspects of positioning accuracy and response speed, an improved triangle centroid localization algorithm based on PIT criterion (ITCL-PIT) is proposed in paper. The ITCL-PIT algorithm reduces the area of overlap region by generating new beacon nodes and applies the PIT criterion of the APIT algorithm as the foundation for the judging unknown nodes. At last, the coordinate of the unknown node is calculated by the centroid algorithm. The simulation results demonstrate that the ITCL-PIT algorithm improves the positioning accuracy by 6 times on the basis of double response time compared with the traditional triangular centroid localization algorithm. Additionally, the ITCL-PIT algorithm outperforms the centroid iterative estimation algorithm in terms of localization accuracy and response speed. Moreover, the model is closer to the actual positioning situation by analyzing the error of the beacon node itself and the judgment of the neighbor beacon node. Since the ESP07 module is used in the experimental test platform which its price is low, and the positioning function can be accomplished, and the difference in response time between algorithms may be negligible, but it still needs to be verified in kind. However, when the algorithm selects the new beacon nodes, the error of the new beacon nodes are ignored. The following stage is to think about how to lessen the error. Furthermore, the time complexity and the space complexity can also be used as the research object of the following topic. At the same time, in addition to the research of algorithms on a two-dimensional plane, it can be considered whether the algorithm also has an efficient positioning function in the three-dimensional space [29]. In the future, the visble light positioning is a promising the research direction [30].