Research Article | Open Access

Rui Jiang, Xin Wang, Li Zhang, "Localization Algorithm Based on Iterative Centroid Estimation for Wireless Sensor Networks", *Mathematical Problems in Engineering*, vol. 2018, Article ID 5456191, 11 pages, 2018. https://doi.org/10.1155/2018/5456191

# Localization Algorithm Based on Iterative Centroid Estimation for Wireless Sensor Networks

**Academic Editor:**Ivan Giorgio

#### Abstract

According to the application of range-free localization technology for wireless sensor networks (WSNs), an improved localization algorithm based on iterative centroid estimation is proposed in this paper. With this methodology, the centroid coordinate of the space enclosed by connected anchor nodes and the received signal strength indication (RSSI) between the unknown node and the centroid are calculated. Then, the centroid is used as a virtual anchor node. It is proven that there is at least one connected anchor node whose distance from the unknown node must be farther than the virtual anchor node. Hence, in order to reduce the space enclosed by connected anchor nodes and improve the location precision, the anchor node with the weakest RSSI is replaced by this virtual anchor node. By applying this procedure repeatedly, the localization algorithm can achieve a good accuracy. Observing from the simulation results, the proposed algorithm has strong robustness and can achieve an ideal performance of localization precision and coverage.

#### 1. Introduction

Wireless sensor network (WSNs) is comprised of multiple sensor nodes through self-organization. It is considered as an information acquisition system for Internet of Things (IoT). The sensor nodes in WSNs generally fall into two categories: the anchor nodes and the unknown nodes. The anchor node’s location is already known, whereas the unknown node’s location is not. However, the information collected by a sensor is usually nonsense without the sensor’s location information. Hence, an accurate node self-location is one of the fundamental and hot problems in the research of WSNs [1, 2]. A variety of algorithms exist for node self-location. Most of these algorithms can be divided into two categories. One is range-based measurement, which realizes self-location of an unknown node by computing the distance or direction between the unknown node and nearby anchor nodes like the received signal strength indication (RSSI) algorithm [3–5], the time of arrival (TOA) algorithm [6, 7], the time difference of arrival (TDOA) algorithm [8], and so forth [9, 10]. This class shows a very accurate location result but is generally very energy-consuming. Furthermore, the additional hardware is usually required. It also increases the overall cost of WSNs. The other one is range-free measurement, which utilizes the connectivity of WSNs to obtain the location information of an unknown node, such as the centroid localization algorithm [11], the approximate point-in-triangulation test (APIT) algorithm [12, 13], the distance vector-hop (DV-Hop) algorithm [14, 15], and so forth [16]. This class is energy-efficient and does not require any additional hardware. Therefore, the range-free measurement is suitable for WSNs and is widely used in practice for its efficient realization.

The number of connected anchor nodes is one of the key factors affecting the performance of localization algorithm, regardless of whether it is range-based measurement or range-free measurement. More connected anchor nodes allow greater location accuracy. However, the methods to improve the location accuracy by increasing the number of connected anchor nodes in WSNs are not available. In order to overcome such difficulty, an improved localization algorithm based on iterative centroid estimation is presented in this paper. Suppose that any two anchor nodes can only be connected by a straight line; the minimal space that can contain all connected anchor nodes is defined as the space enclosed by connected anchor nodes with this methodology. The centroid of this space is deemed as a virtual anchor node to achieve a more accurate localization. First, the centroid coordinate of the space enclosed by connected anchor nodes and the RSSI between the unknown node and the centroid are calculated. With the strict formula derivation, we prove that there exists at least one anchor node, which is further from the unknown node than the centroid. Then, the connected anchor node with the weakest RSSI is replaced with the centroid in order to reduce the space enclosed by the connected anchor nodes. Applying this procedure repeatedly, the localization algorithm can obtain good accuracy. We employ simulation experiments to verify the performance of our methods in terms of the localization precision, coverage, and robustness on RSSI error disturbance.

#### 2. Localization Algorithm Based on Iterative Centroid Estimation

##### 2.1. Virtual Anchor Nodes

Suppose that there are one unknown node and anchor nodes which are connected with . For an arbitrary anchor node in , it is assumed that the coordinate of is and the coordinate of is . Therefore the distance between and is

We denote by the centroid of the space enclosed by . Assume that the coordinate of is . Then, we haveThe distance between and can be calculated asUsing (2), can be expressed as

With , we haveFrom (5), (4) can be simplified asAccording to (2) and (6), it is clear that the coordinate of and the distance between and can be calculated relying only on the known parameters of connected anchor nodes. Now, the centroid has the common features of all the connected anchor nodes. Hence, it can be considered as a virtual anchor node.

##### 2.2. The Convergence Performance of Iterative Centroid Estimation

We denote the distance between and as

Then, (4) can be further simplified by rewriting (6) as

In general, it is assumed that . It is easy to show that

From (8)-(9), we can draw the conclusion that . Obviously, there exists at least one connected anchor node whose distance from must be farther than . Therefore, the space enclosed by and must be smaller than the original space enclosed by . In the proposed algorithm, the centroid is deemed as a virtual anchor node. The farthest anchor node would be replaced by the virtual anchor node in order to reduce the enclosed space and improve the location precision. The algorithm can achieve a more accurate localization by repeating the described replacement procedure.

##### 2.3. The Energy Consumption in Localization Algorithm

Based on the fact that each node in WSNs has only limited energy, it is crucial to control energy consumption in localization algorithm to extend the WSNs lifetime. However, the calculation of will greatly increase the node energy consumption. To solve this problem, RSSI is used directly to represent distance information in proposed localization algorithm. Based on the propagation theory, the relationship between distance and RSSI is mentioned in [17]:

Here, refers to RSSI between and . is a factor of distance attenuation. The value of is determined according to the working environment of WSNs. A large amount of experimental data evidences that the optimal range of the empirical attenuation factor is 3.24~4.5. In practical application, the value of can be further determined by the RSSI and the distance between anchor nodes. Let ; (10) can be rewritten after taking logarithm:where

The parameter represents the RSSI when the distance to the node is one meter. As well as parameter , the value of is determined according to the working environment of WSNs. After parameter is determined, the value of can also be further calculated by the RSSI and the distance between anchor nodes. In some practical application such as ZigBee, the optimum is given empirically from 45 to 49. From (8) and (11), we can derive that RSSI between the virtual anchor node and is

The weaker RSSI is, the farther the distance will be. Using (13), the energy consumption in proposed localization algorithm can be reduced effectively via avoiding the procedure of distance calculation. To improve the location precision, the centroid is used as a virtual anchor node to replace the connected anchor node with the weakest RSSI. Besides, it is noteworthy that the two-dimensional node localization can be viewed as special three-dimensional node localization with the same height across all the nodes. Hence, the proposed algorithm can also be applied to two-dimensional node localization.

##### 2.4. The Stopping Criterion of the Localization Algorithm

During the th iteration, suppose that the connected anchor nodes are . The distance between the centroid and the unknown node can be determined according to (8), which satisfieswhere is the distance between anchor node and unknown node defined in (1). is the distance between anchor node and defined in (7). In general, it is assumed that . Similarly, the distance between the centroid and the unknown node during the iteration should satisfy the following equation:where is the distance between anchor node and the centroid derived from the th iteration. From (8) and (11), we havehere,

According to (9), we can easily get the conclusion that . When the coordinate of is , can be expressed aswhere

Then, can be further simplified as

Similarly,

From (20)-(21), can be simplified ashere, is the distance between anchor node and the centroid derived from the th iteration. With (16)–(22), we have

Obviously, we cannot guarantee the location accuracy of the iteration to be higher than that of the th iteration. Take two-dimensional node localization as an example; we assume the simplest situation, that is, when the number of connected anchor nodes to give a more intuitive description of this problem. The relationship of the position between and original anchor nodes is shown in Figure 1.

**(a)**

**(b)**

**(c)**

In Figure 1, is an equilateral triangle whose centroid is . Based on the algorithm we propose, we replace with to create a new enclosed area because is the farthest node away from the unknown node in the figure. In Figures 1(a) and 1(b), is inside of the area enclosed by the original anchor nodes . We suppose that lies on the line segment . In Figure 1(a), lies on the upper middle of , which means that it is closer to the centroid . Clearly the location result in the second iteration has higher accuracy than in the first iteration. On the contrary, in Figure 1(b), lies on the lower middle of , which means that it is closer to the centroid . It means that the location accuracy of is even worse than . The analysis agrees well with the conclusion of (23). Under this circumstance, the iteration should be stopped when the distance between and the current centroid is smaller than a certain threshold. Using (13), the stopping criterion of the localization algorithm can be expressed aswhere is the threshold. However, is outside of the area enclosed by the original anchor nodes in Figure 1(c). The estimated centroid cannot be infinitely close to with the increasing of iterations. In this situation, the stopping criterion of (24) will make the algorithm fall in an endless loop. Hence, the iteration should be stopped when the variation of the location accuracy is smaller than a certain threshold. We have another stopping criterion of the localization algorithm ashere, is the threshold.

Thus, how to set the stopping criterion of algorithm should depend on the relative position of the unknown node and the area enclosed by the connected anchor nodes. In order to use fewer iterations to achieve better accuracy and avoid the algorithm falling into an endless loop at the same time, the two sets of stopping criterion are both used simultaneously. The iteration should be stopped when any stopping criterion is satisfied.

##### 2.5. Description of the Localization Algorithm

In this section, we will present a detailed description of the algorithm. All the quantities that should be computed to implement the algorithm will be listed in the right order. The concrete implementation steps of the novel localization algorithm are explained as follows:(1)Set the stopping criterion by (24)-(25).(2)In practical application, the connected anchor nodes must be confirmed firstly. Then, the RSSI is measured and the distance is calculated by (7) between any two connected anchor nodes.(3)Based on above data in step , the empirical factors and could be determined by (10)–(12).(4)Since the coordinates of anchor nodes are known, the centroid coordinate of the space enclosed by connected anchor nodes can be calculated by (2).(5)After the RSSI between the unknown node and the connected anchor node is measured, the RSSI between the unknown node and the current centroid could be calculated by (13).(6)If satisfies the stopping criterion in step , the current centroid is the estimated position of the unknown node in the proposed algorithm; otherwise, the current centroid is deemed as a virtual anchor node. Then, the connected anchor node with the weakest RSSI is replaced with the virtual anchor node. The distance between the virtual anchor node and the remaining connected anchor nodes is calculated by (7) and the process returns to step .

The flowchart of the proposed localization algorithm is shown in Figure 2.

#### 3. Experimental Results and Discussion

The performance of the proposed algorithm is evaluated by simulation experiments. Suppose that one thousand nodes are randomly distributed in three-dimensional space with a size of 100 × 100 × 100 , and of them are unknown nodes. It is assumed that the empirical factors and . The plane of the three-dimensional space at height is used as the two-dimensional space in simulation experiments. The performance of localization algorithm is evaluated by relative localization error, which is defined bywhereis the localization error and refers to the communication radius. is the true coordinate of the th unknown node and is the estimation result. It is worth noting that is equal to for two-dimensional node localization. We set the stopping criterion in simulation experiments ashere, represents the RSSI when the distance to the node is one meter. With , can be calculated from (12).

First of all, the effect of connected anchor nodes on localization precision is investigated in Figure 3 by changing anchor ratio and communication radius. The anchor ratio represents the proportion of anchor nodes in the total nodes and the communication radius means the maximum distance between two nodes that can be connected. Note that the larger anchor ratio and the greater communication radius, the more connected anchor nodes. The performance of the proposed algorithm for three-dimensional and two-dimensional node localization is shown in Figures 3(a) and 3(b), respectively. As can be seen, the number of connected anchor nodes determines the location precision in both three-dimensional space and two-dimensional space. The relative localization error decreases with the increasing of connected anchor nodes in general, regardless of differing application characteristics.

**(a)**

**(b)**

In addition to high precise positioning, good robustness of localization algorithm is also particularly important. The RSSI measurement error is an important factor that influences robustness of the algorithm. The impact of RSSI measurement error in the proposed algorithm for three-dimensional and two-dimensional node localization is depicted in Figures 4(a) and 4(b), respectively. Different anchor ratios and communication radii are chosen so as to make a comprehensive analysis of the effect of measurement error. The RSSI measurement consists of the actual RSSI value and a shadowing term as commonly assumed [18]. The relationship between the two terms is determined by the signal-to-noise ratio (SNR). SNR is given bywhere and refer to the signal and noise energy, respectively. Obviously, the RSSI measurement error increases with the decreasing of SNR.

**(a)**

**(b)**

In the proposed algorithm, the RSSI measurement is used to find the connected anchor node with the weakest RSSI, which should be replaced by the virtual anchor node. The measurement error results in the connected anchor node with the weakest RSSI being remained. This mistake makes the convergence speed of this method reduced, but it has less influence on the ultimate localization precision. Therefore, as we can see in Figure 4, with the decreasing of SNR, namely, the increasing of RSSI measurement error, there is almost no effect on localization precision.

As one of the most important indexes for localization algorithms, localization coverage of the proposed algorithm is analyzed. The localization coverage is defined by

Here, refers to the number of the unknown nodes that are localizable. is the total number of unknown nodes defined in (26).

In three-dimensional space, an unknown node with no fewer than four connected anchor nodes of different plane is localizable. And an unknown node requires at least three nonlinear connected anchor nodes to realize localization in two-dimensional space. Figures 5(a) and 5(b) show the effect of connected anchor nodes on localization coverage in three-dimensional space and two-dimensional space, respectively. The good performance of localization coverage with large number of connected anchor nodes can be clearly identified in Figure 5. Nevertheless, note that the localization coverage with short communication radius and small anchor ratio is unsatisfactory, especially for three-dimensional node localization. When the communication radius is 20 and the anchor ratio is , the results in Figure 5(a) show that only about 30% of unknown nodes in three-dimensional space are localizable.

**(a)**

**(b)**

Since the proposed algorithm is robust against RSSI measurement error, the early positioned nodes can be upgraded to be new anchor nodes with some positional error. The remaining unknown nodes can be positioned with more anchor nodes in later localization process. Figure 6 illustrates the effect of iterative processing on localization coverage. It is favorable to see that the localization coverage can be improved dramatically through multiple iterations. Even with the condition of fewer connected anchor nodes, such as when the communication radius is 20 and the anchor ratio is , the localization coverage can reach almost after four iterations in three-dimensional space, while only two iterations are needed to realize localization coverage in two-dimensional space, which are presented in Figures 6(a) and 6(b), respectively.

**(a)**

**(b)**

Finally, the performance of the proposed algorithm will be compared to existing competitors. Considering that the centroid coordinate and the RSSI between the unknown node and the centroid are calculated, we compare the algorithmic performance of the centroid localization algorithm [11], the RSSI algorithm [3], and the presented algorithm to show the advantages of the proposed algorithm. With the communication radius of , Figures 7 and 8 depict the algorithmic performance of the three algorithms in three-dimensional space and two-dimensional space, respectively.

**(a)**

**(b)**

**(c)**

**(a)**

**(b)**

**(c)**

With different SNR, a comprehensive comparison of the three algorithms is given. As one of the range-free measurements, there is no effect of SNR change on localization precision of the centroid localization algorithm. On the contrary, the performance of the RSSI algorithm, which is one of the range-based measurements, sharply drops with SNR decreasing. As can be seen, the RSSI algorithm has the best performance of all in condition of high SNR. However, in condition of low SNR such as SNR = −10 dB, it is even worse than the centroid localization algorithm.

The proposed algorithm has similar performance to different SNR. The simulation results also proved that the novel method has robust characteristics. In addition, the presented algorithm achieves better performance than the RSSI algorithm at low SNR in Figures 7(a) and 8(a) but is inferior to the RSSI algorithm at high SNR in Figures 7(c) and 8(c). Nevertheless, it is always superior to the centroid localization algorithm because the centroid coordinate is calculated multiple times in the proposed algorithm, each time producing more accurate estimates before the stopping criterion is satisfied.

#### 4. Conclusion

An improved localization algorithm based on iterative centroid estimation is proposed in this paper. In this algorithm, the centroid of the space enclosed by connected anchor nodes is considered as a virtual anchor node. It can be proven that there is at least one connected anchor node whose distance from the unknown node must be farther than the centroid. Hence, the connected anchor node with the weakest RSSI will be replaced by the centroid. Good positioning results can be achieved by repeating the replacement procedure. The simulation results prove the effectiveness and robustness of the proposed algorithm for both three-dimensional and two-dimensional node localization.

#### Conflicts of Interest

The authors declare that they have no conflicts of interest.

#### Acknowledgments

This work was supported by grants from the National Natural Science Foundation of China (Contracts nos. 61601243 and 61701253), the National Key Research and Development Program of China (Contract no. 2016YFE0200200), and the Natural Science Foundation of Jiangsu Province (Contracts nos. BK20160915 and BK20170934).

#### References

- I. F. Akyildiz, W. Su, Y. Sankarasubramaniam, and E. Cayirci, “A survey on sensor networks,”
*IEEE Communications Magazine*, vol. 40, no. 8, pp. 102–105, 2002. View at: Publisher Site | Google Scholar - S. Bhowmik, R. Kar, and C. Giri, “Fuzzy node localization in wireless sensor network,” in
*Proceedings of the 2016 IEEE International Conference on Wireless Communications, Signal Processing and Networking, WiSPNET 2016*, pp. 1112–1116, India, March 2016. View at: Publisher Site | Google Scholar - F. Yaghoubi, A.-A. Abbasfar, and B. Maham, “Energy-efficient RSSI-based localization for wireless sensor networks,”
*IEEE Communications Letters*, vol. 18, no. 6, pp. 973–976, 2014. View at: Publisher Site | Google Scholar - P. K. Sahu, E. H.-K. Wu, and J. Sahoo, “DuRT: dual RSSI trend based localization for wireless sensor networks,”
*IEEE Sensors Journal*, vol. 13, no. 8, pp. 3115–3123, 2013. View at: Publisher Site | Google Scholar - S. Tomic, M. Beko, and R. Dinis, “RSS-based localization in wireless sensor networks using convex relaxation: noncooperative and cooperative schemes,”
*IEEE Transactions on Vehicular Technology*, vol. 64, no. 5, pp. 2037–2050, 2015. View at: Publisher Site | Google Scholar - E. Xu, Z. Ding, and S. Dasgupta, “Source localization in wireless sensor networks from signal time-of-arrival measurements,”
*IEEE Transactions on Signal Processing*, vol. 59, no. 6, pp. 2887–2897, 2011. View at: Publisher Site | Google Scholar | MathSciNet - K. Yu, Y. J. Guo, and M. Hedley, “TOA-based distributed localisation with unknown internal delays and clock frequency offsets in wireless sensor networks,”
*IET Signal Processing*, vol. 3, no. 2, pp. 106–118, 2009. View at: Publisher Site | Google Scholar - F. Bandiera, A. Coluccia, G. Ricci, F. Ricciato, and D. Spano, “TDOA localization in asynchronous WSNs,” in
*Proceedings of the 12th IEEE International Conference on Embedded and Ubiquitous Computing (EUC'14)*, pp. 193–196, Italy, 2014. View at: Publisher Site | Google Scholar - N. Bulusu, J. Heidemann, and D. Estrin, “GPS-less low-cost outdoor localization for very small devices,”
*IEEE Personal Communications*, vol. 7, no. 5, pp. 28–34, 2000. View at: Publisher Site | Google Scholar - F. Yu, Q. Wang, and C. Li, “A localization algorithm for WSN based on characteristics of power attenuation [C],” in
*Proceedings of the 4th International Conference on Wireless Communications*, pp. 1–5, 2008, http://ieeexplore.ieee.org/search/searchresult.jsp. View at: Google Scholar - X. J. Li, “An analytical method for centroid computing and its application in wireless localization,” in
*Proceedings of the 2013 19th IEEE International Conference on Networks (ICON'13)*, Singapore, 2013. View at: Publisher Site | Google Scholar - Y. Zhou, X. Ao, and S. Xia, “An improved APIT node self-localization algorithm in WSN,” in
*Proceedings of the 7th World Congress on Intelligent Control and Automation (WCICA'08)*, pp. 7576–7581, China, 2008. View at: Publisher Site | Google Scholar - J. Wang and H. Jin, “Improvement on APIT localization algorithms for wireless sensor networks,” in
*Proceedings of the International Conference on Networks Security, Wireless Communications and Trusted Computing (NSWCTC '09)*, pp. 719–723, April 2009. View at: Publisher Site | Google Scholar - A. Hadir, K. Zine-Dine, M. Bakhouya, and J. El Kafi, “An optimized DV-hop localization algorithm using average hop weighted mean in WSNs,” in
*Proceedings of the 5th Workshop on Codes, Cryptography and Communication Systems, WCCCS 2014*, pp. 25–29, Morocco, November 2014. View at: Publisher Site | Google Scholar - J. Xiang and W. W. Tan, “An improved DV-hop algorithm based on iterative computation for wireless sensor network localization,” in
*Proceedings of the 2013 IEEE International Workshop on Electromagnetics: Applications and Student Innovation Competition, IEEE iWEM 2013*, pp. 171–174, hkg, August 2013. View at: Publisher Site | Google Scholar - L. Doherty, L. El Ghaoui, and K. S. J. Pister, “Convex position estimation in wireless sensor networks,” in
*Proceedings of the 20th Annual Joint Conference of the IEEE Computer and Communications Societies*, vol. 3, pp. 1655–1663, IEEE, Anchorage, Alaska, USA, April 2001. View at: Publisher Site | Google Scholar - A. Maddumabandara, H. Leung, and M. Liu, “Experimental evaluation of indoor localization using wireless sensor networks,”
*IEEE Sensors Journal*, vol. 15, no. 9, pp. 5228–5237, 2015. View at: Publisher Site | Google Scholar - F. Bandiera, A. Coluccia, and G. Ricci, “A cognitive algorithm for received signal strength based localization,”
*IEEE Transactions on Signal Processing*, vol. 63, no. 7, pp. 1726–1736, 2015. View at: Publisher Site | Google Scholar | MathSciNet

#### Copyright

Copyright © 2018 Rui Jiang et al. This is an open access article distributed under the Creative Commons Attribution License, which permits unrestricted use, distribution, and reproduction in any medium, provided the original work is properly cited.