- About this Journal ·
- Abstracting and Indexing ·
- Advance Access ·
- Aims and Scope ·
- Annual Issues ·
- Article Processing Charges ·
- Articles in Press ·
- Author Guidelines ·
- Bibliographic Information ·
- Citations to this Journal ·
- Contact Information ·
- Editorial Board ·
- Editorial Workflow ·
- Free eTOC Alerts ·
- Publication Ethics ·
- Reviewers Acknowledgment ·
- Submit a Manuscript ·
- Subscription Information ·
- Table of Contents

International Journal of Distributed Sensor Networks

Volume 2012 (2012), Article ID 260302, 7 pages

http://dx.doi.org/10.1155/2012/260302

## Localization Algorithm Based on Maximum a Posteriori in Wireless Sensor Networks

College of Computer Science and Software Engineering, Shenzhen University, Shenzhen 518060, China

Received 14 July 2011; Revised 19 September 2011; Accepted 19 September 2011

Academic Editor: Yuhang Yang

Copyright © 2012 Kezhong Lu 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.

#### Abstract

Many applications and protocols in wireless sensor networks need to know the locations of sensor nodes. A low-cost method to localize sensor nodes is to use received signal strength indication (RSSI) ranging technique together with the least-squares trilateration. However, the average localization error of this method is large due to the large ranging error of RSSI ranging technique. To reduce the average localization error, we propose a localization algorithm based on maximum a posteriori. This algorithm uses the Baye's formula to deduce the probability density of each sensor node's distribution in the target region from RSSI values. Then, each sensor node takes the point with the maximum probability density as its estimated location. Through simulation studies, we show that this algorithm outperforms the least-squares trilateration with respect to the average localization error.

#### 1. Introduction

The process of determining the physical locations of sensor nodes is known as localization, which is a fundamental problem in wireless sensor networks [1, 2]. The locations of sensor nodes are essential in many applications and protocols. For example, the sensed information about an event without the location where it takes place is often meaningless. Similarly, geographic routing relies on the locations of nodes to forward packets [3].

The locations of sensor nodes can be directly obtained by preconfiguration or global positioning system (GPS). Preconfiguration requires each sensor node being placed at a known location, which is only suitable for the case that sensor nodes are easy to be placed and their number is small. On the other hand, a sensor node equipped with a GPS receiver is costly and does not work indoors. Therefore, both the above two methods are impractical for large-scale low-cost wireless sensor networks. It is desired that the locations of sensor nodes can be induced from their interactions, such as the detections of the distances between neighbors.

Many localization algorithms first use a ranging technique to estimate the Euclidean distances between nodes, and then use the least-squares trilateration to determine the locations of sensor nodes by these estimated distances. Some conventional ranging techniques are received signal strength indication (RSSI), time of arrival (TOA), time difference of arrival (TDOA), angle of arrival (AOA), and so forth [4]. Among them, RSSI ranging technique has the least requirement for hardware, as the radio chip of current sensor node usually has a built-in function of reading RSSI value. But RSSI value is vulnerable to being disturbed by the surrounding environment and the ranging error of RSSI ranging technique may be at most ±50% [5]. Furthermore, the least-squares trilateration is sensitive to ranging errors [2]. If using RSSI ranging technique together with the least-squares trilateration to localize sensor nodes, the average localization error is very large.

To reduce the average localization error, we propose a localization algorithm based on maximum a posteriori. This algorithm uses the probability approach to estimate the location of each sensor node directly from RSSI values. Extensive simulation results have shown that the average localization error of this algorithm is less than that of the least-squares trilateration.

The remainder of this paper is organized as follows. Related work is discussed in Section 2, the network model is defined in Section 3, and our proposed localization algorithm is described in Section 4. Simulation results that illustrate the performance are included in Section 5, and Section 6 is the conclusion.

#### 2. Related Work

Since localization is a fundamental problem in wireless sensor networks, there are many research works focusing on it recently. Localization algorithms can be divided into two categories: anchor-based localization algorithms and nonanchor-based localization algorithms. An anchor is a special node which has a priori knowledge of its location.

In anchor-based localization algorithms, the location of each sensor node is determined only by its distances from anchors. Priyantha et al. developed the cricket location support system which provides localization services for indoor mobile node [6]. Bulusu et al. proposed a GPS-less localization algorithm in which each mobile node localizes itself to the centroid of its adjacent connecting anchors [7]. Niculescu and Nath proposed a family of distributed localization algorithms “adhoc positioning system” (APS) [8, 9]. In these algorithms, each node measures its distances from anchors by performing multihop propagation of distances to anchors throughout the network. Kumar et al. used RSSI-based weighted centroid to improve the localization algorithm proposed by Bulusu et al. [10]. Li and Liu proposed the rendered path (REP) protocol for locating nodes in anisotropic sensor networks with holes [11]. Lederer et al. also studied the problem of localizing a large sensor network having a complex shape, possibly with holes [12].

In nonanchor-based localization algorithms, the location of each sensor node is determined also by the distances between sensor nodes. Doherty et al. proposed a constraint-based localization scheme using semidefinite programming (SDP) to find a solution to the localization problem [13]. Shang et al. proposed an algorithm using classical multidimensional scaling (MDS) technique to calculate the locations of nodes given a set of distances [14]. Kwon et al. proposed a localization algorithm based on least square scaling (LSS) which is a variant of multidimensional scaling technique [15]. Khan et al. proposed a distributed iterative localization algorithm in -dimensional Euclidean space with a minimal number of anchors [16]. Ding et al. viewed localization as a (nearest) Euclidean distance matrix (EDM) completion problem and thus gave an EDM approach [17]. Zhu et al. used stress normal property to localize sensor nodes with enough perturbation data [18].

Many of the above-mentioned algorithms [12, 14, 15, 17] have a similar optimization objective as the least-squares trilateration, that is, minimizing the (weighted) sum of all squared differences between each estimated distance and the corresponding distance calculated by the estimated locations of nodes. But when the distances are estimated by RSSI ranging technique, this optimization objective is likely subject to a large average localization error. In this paper, we present another optimization objective with which sensor nodes can be localized more accurately.

#### 3. Network Model

Before describing our proposed localization algorithm, we first assume the model of wireless sensor network as follows.(1)A wireless sensor network is deployed in a planar region . Suppose that is a rectangle, whose length is and width is . But later we will see that the proposed algorithm is not dependent on the shape of . Without loss of generality, we assume that the lower left corner of is the origin and the coordinate of the upper-right corner of is .(2)All sensor nodes are uniformly distributed in . Anchors have a larger transmission range than sensor nodes. Each sensor node and anchor is denoted by a point in . Let denote the total number of anchors, denote the th anchor, and () denote the coordinate of .(3)Initially each anchor broadcasts a beacon containing its location information. Then, each sensor node collects the RSSI values of all its neighbor anchors through these beacons. The RSSI value read by a sensor node obeys the wide log-normal shadowing radio signal propagation model [19]:

In (1), denotes the RSSI value when the distance between the receiver and the transmitter is ; is the power of the transmitter; is a known reference power value at a reference distance from the transmitter; is the path loss exponent that measures the rate at which the RSSI value decreases with distance; is a zero mean Gaussian distributed random variable with standard deviation and it accounts for the random effect of shadowing, that is, .

Given these known RSSI values, the locations of sensor nodes can be estimated by a localization algorithm. The major measurement of a localization algorithm is the average localization error, defined as the average distance between the actual location and the estimated location of each sensor node [5]. Because wireless sensor networks often work in unfriendly environments, some anchors may be faulty, which means they have incorrect information about their own locations. Therefore, fault tolerance is also important to a localization algorithm. In this paper, we define it as the ability to maintain a good localization result even if some anchors are faulty. Besides, execution time is also a common measurement of a localization algorithm.

#### 4. Algorithm Description

In this section, we will describe our proposed localization algorithm based on maximum a posteriori. Consider a sensor node . Let () denote the coordinate of and denote the random variable of the RSSI value of read by , where . Assume that the values of in a test are , respectively. The basic idea of our proposed localization algorithm is as follows. First, the target region is divided into small grids of the same size. Next, the probability of being in each grid is calculated from . Then, the center of the grid with the largest probability is taken as the estimated value of (). Let denote the side length of each grid. Without loss of generality, assume that the target region has exact grids in the horizontal direction and grids in the vertical direction. Let denote the grid locating at the th row and the th column, where , .

Let denote the event of being in , whose probability is denoted by . Let the conditional probability denote the probability that for all under the condition of being in . Now we have the condition that for all and want to compute the conditional probability . That is, to compute the a posteriori probability from priori probability. By the Bayes formula, we obtain as follows:

Because each sensor node is uniformly distributed in , has the same probability in each grid, that is, for all and , is equal. So (2) can be simplified as follows:

Moreover, because is also uniformly distributed in , is equal to the average probability that for all , under the condition of being at each point in . Then, we obtain the following equation:

When is at a certain point in , the RSSI value of each anchor read by is not interfered with the RSSI values of other anchors. Therefore, under the condition that and , the events are independent. Then, we obtain *⋯*. Combine it with (3) and (4), and we obtain the following equation:

According to (5), we need to calculate , . However, it can be seen from (1) that is a continuous random variable, so we cannot directly obtain through (5). But we can compute the probability of being in the interval under the condition of being at a point , which is denoted by . So we can obtain the following equation:

Let denotes the distance between the point and , that is, . Let , . According to (1), if is in the interval , then is in the interval , whose probability is as follows:

Combine (6) and (7), and we obtain the following equation:

We have and substitute it into (8). Then, we obtain the following equation:

It can been seen from (9) that if has the largest value of among all grids, then has the largest probability in among all grids. If the size of grid is small enough, we have . Therefore, we can select the point with the smallest value of in the target region as the estimated location of . We define the function as follows:

That is for the variable whose domain is the target region , to find a point ) with the minimum value of . However, the function is relatively complicated, so we cannot obtain the analytic expression of ) by the partial differential method. Alternatively, we adopt an approximation method described as follows. First, the target region is divided into small grids and the value of at the center of each grid is computed. Then, the center of the grid with the minimum value of is taken as the approximation of ). If the size of grid is , then the total number of grids is and the time complexity of localizing a node is . Obviously, when the target region is fixed, the execution time will become longer as the size of grid become smaller. For large wireless sensor networks, we can use the multi-grid method to reduce the execution time. First, the target region is divided into larger grids and the value of at each grid point is computed. Next, those grids with relatively larger value of are discarded. Then, the remaining grids are repeatedly divided into smaller grids until the size of grid reaches the required accuracy.

Furthermore, we analyze (10). Let denote the estimated distance between and only estimated from . It is easy to known that should be equal to in (1) when is 0:

Combine (10) and (11), and we obtain the following equation:

Equation (12) illuminates that the optimum estimated location of should be the point with the minimum value of in the target region .

#### 5. Performance Evaluation

##### 5.1. Simulation Environment

To evaluate the performance of our proposed localization algorithm based on maximum a posteriori (MAP), we developed a simulation program realizing MAP algorithm. We compare MAP algorithm with the least-squares trilateration (LST) in which the point with the minimum value of in the target region is taken as the estimated location of a node.

In the simulation, the target region is a square region of 1000 m × 1000 m. The transmission range of anchors is 1500 m. Sensor nodes and anchors are randomly and uniformly distributed in . The RSSI value read by a sensor node is simulated according to (1). The value of each parameter is taken from a typical wireless sensor network [19]: is set to , is set to 1 m, () is set to 55 dB, is set to 4, and the range of is set to [2, 14]. The Gaussian distributed random number is generated by the Box-Muller method. The platform has Intel Dual Core 2.80 GHz CPU and 1 GB memory. To make simulation results more accurate, for each simulation we perform 100 times and take the average result.

##### 5.2. Grid Size

In MAP algorithm, the target area is divided into small grids to approximately obtain the point with the maximum probability density. The smaller the grid is, the closer the approximate solution is to the accurate solution, but the larger the amount of calculation is. Therefore, we first need to select the appropriate grid size. In the simulation, is set to 5, the number of anchors is set to 20, the number of sensor nodes is set to 100, and the side length of grid varies from 5 m to 100 m. Figure 1 shows the average localization errors of MAP algorithm. It can be seen that when the grid size is relatively large, the average localization error is significantly impacted by the grid size. But when the grid size of grid is small to a certain extent, this impact is almost negligible. In the following, we will take the grid size as 10 m × 10 m.

##### 5.3. Localization Error

Figure 2 shows a localization result of MAP algorithm and LST algorithm. Both algorithms have the same inputs: is set to 5, the number of anchors is set to 20, and the number of sensor nodes is set to 100. It can be seen that the estimated location of most sensor nodes computed by MAP algorithm are closer to their actual locations. Accordingly, MAP algorithm has a smaller average localization error than LST algorithm.

Next, we test how the localization error is impacted by the number of anchors. In the simulation, is set to 5, the number of sensor nodes is set to 100, and the number of anchors varies from 5 to 25. It can be seen from Figure 3 that with the number of anchors increasing, the average localization errors of both algorithms are reduced. But MAP algorithm can achieve a smaller average localization error, which is reduced by nearly 34.8% compared with the least-squares trilateration.

Then, we test how the location error is impacted by the layout of anchor nodes. In the simulation, is set to 5, the number of sensor node is set to 100, the number of anchors varies among 4, 9, 16, 25, 36, and 49, and anchors are placed by the random layout and the grid layout, respectively. Figure 4 shows the average location errors of MAP algorithm under these two layouts. The average location error under the grid layout is nearly 87.8% of that under the random layout. Therefore, anchor nodes should be placed by the grid layout in practice.

The ranging error is a primary cause of the localization error, which depends on : the larger is, the larger the ranging error is. In the simulation, the number of anchors is set to 20, the number of sensor nodes is set to 100, and varies from 2 to 14. Figure 5 shows the average localization errors of MAP algorithm and LST algorithm. It can be seen that the average localization errors of both algorithms are approximately proportional to .

##### 5.4. Fault Tolerance

In MAP algorithm, the location of each sensor node is determined by all its neighbor anchors. If only a small number of anchors are faulty, the estimated location of each sensor node cannot have a big change. In the simulation, is set to 5, the number of anchors is set to 20, the number of sensor nodes is set to 100, and the number of faulty anchors varies from 0 to 10. Figure 6 shows the average location errors of MAP algorithm and LST algorithm. It can be seen that when less than 25% of anchors are faulty, the average localization error of MAP algorithm increase less than 85%.

##### 5.5. Execution Time

Finally, we analyze the average execution time of MAP algorithm by simulation. In the simulation, the number of sensor nodes is set to 100. Figure 7 shows the average execution times of the two algorithms under different numbers of anchor nodes when the size of grid is 10 m × 10 m. Figure 8 shows the average execution times of the two algorithms under different grid sizes when the number of anchors is 20. It can be seen that the execution times of both algorithms are approximately proportional to the number of anchor nodes and are approximately inversely proportional to the acreage of grid. This result is consistent with the analysis in Section 4. In a general case, MAP algorithm can localize a sensor node in a short time. Since MAP algorithm has a more complicated calculation than LST algorithm, the execution time of MAP algorithm is longer.

#### 6. Conclusion

RSSI ranging-based localization is regarded as a cost-effective solution for sensor node localization. But RSSI ranging technique has a large ranging error, which will bring a large average localization error to the general least-squares trilateration. In this paper, we propose a localization algorithm based on maximum a posteriori probability (MAP). In this algorithm, the point with the maximum probability density in the target region is taken as the estimated location of a sensor node. Extensive simulation results demonstrate the effectiveness of MAP algorithm. This algorithm reduces the average localization error by nearly 34.8% compared with the least-squares trilateration. Even if the number of anchors is small, this algorithm can also achieve a relatively small average localization error. In addition, the execution time of this algorithm is very short.

As a future work, we are currently studying when anchors are absent, how to determine the probability density of the distribution of a sensor node only by the RSSI values of sensor nodes. Moreover, we plan to conduct some practical experiments to confirm the effectiveness of our proposed algorithm.

#### Acknowledgments

The authors would like to thank the anonymous reviewers for their helpful comments which have significantly improved the quality of the paper. This paper was supported by the National Natural Science Foundation of China (Grant no. 61003272, no. 61033009, no. 61170076, and no. 61103001), the Guangdong Natural Science Foundation (Grant no. 10351806001000000), and the Shenzhen Science and Technology Foundation (Grant no. JC201005280408A and JC2009D3120046A).

#### References

- I. F. Akyildiz and M. C. Vuran,
*Wireless Sensor Networks*, John Wiley & Sons, 2010. - G. Mao, B. Fidan, and B. D. O. Anderson, “Wireless sensor network localization techniques,”
*Computer Networks*, vol. 51, no. 10, pp. 2529–2553, 2007. View at Publisher · View at Google Scholar · View at Scopus - J. You, Q. Han, D. Lieckfeldt, J. Salzmann, and D. Timmermann, “Virtual position based geographic routing for wireless sensor networks,”
*Computer Communications*, vol. 33, no. 11, pp. 1255–1265, 2010. View at Publisher · View at Google Scholar · View at Scopus - J. Wang, R. K. Ghosh, and S. K. Das, “A survey on sensor localization,”
*Journal of Control Theory and Applications*, vol. 8, no. 1, pp. 2–11, 2010. View at Publisher · View at Google Scholar · View at Scopus - G. Zanca, F. Zorzi, A. Zanella, and M. Zorzi, “Experimental comparison of RSSI-based localization algorithms for indoor wireless sensor networks,” in
*Proceedings of the 3rd Workshop on Real-World Wireless Sensor Networks (REALWSN '08)*, pp. 1–5, April 2008. View at Publisher · View at Google Scholar · View at Scopus - N. B. Priyantha, A. Chakraborty, and H. Balakrishnan, “Cricket location-support system,” in
*Proceedings of the 6th Annual International Conference on Mobile Computing and Networking (MOBICOM '00)*, pp. 32–43, August 2000. View at Scopus - 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 · View at Google Scholar · View at Scopus - D. Niculescu and B. Nath, “DV based positioning in Ad Hoc networks,”
*Telecommunication Systems*, vol. 22, no. 1–4, pp. 267–280, 2003. View at Publisher · View at Google Scholar · View at Scopus - D. Niculescu and B. Nath, “Ad hoc positioning system (APS) using AOA,” in
*Proceedings of the 22nd Annual Joint Conference on the IEEE Computer and Communications Societies (InfoCom '03)*, pp. 1734–1743, April 2003. View at Scopus - A. Kumar, V. Kumar, and V. Kapoor, “Range free localization schemes for wireless sensor networks,” in
*Proceedings of the 10th WSEAS International Conference on Software Engineering*, pp. 101–106, 2011. - M. Li and Y. Liu, “Rendered path: range-free localization in anisotropic sensor networks with holes,”
*IEEE/ACM Transactions on Networking*, vol. 18, no. 1, pp. 320–332, 2010. View at Publisher · View at Google Scholar · View at Scopus - S. Lederer, Y. Wang, and J. Gao, “Connectivity-based localization of large-scale sensor networks with complex shape,”
*ACM Transactions on Sensor Networks*, vol. 5, no. 4, article 31, 2009. View at Publisher · View at Google Scholar · View at Scopus - L. Doherty, K. S. J. Pister, and L. El Ghaoui, “Convex position estimation in wireless sensor networks,” in
*Proceedings of the 20th Annual Joint Conference of the IEEE Computer and Communications Societies (InfoCom '01)*, pp. 1655–1663, April 2001. View at Scopus - Y. Shang, W. Ruml, Y. Zhang, and M. Fromherz, “Localization from connectivity in sensor networks,”
*IEEE Transactions on Parallel and Distributed Systems*, vol. 15, no. 11, pp. 961–974, 2004. View at Publisher · View at Google Scholar · View at Scopus - Y. Kwon, K. Mechitov, S. Sundresh, W. Kim, and G. Agha, “Resilient localization for sensor networks in outdoor environments,” in
*Proceedings of the 25th IEEE International Conference on Distributed Computing Systems (ICDCS '05)*, pp. 643–652, June 2005. View at Scopus - U. A. Khan, S. Kar, and J. M. F. Moura, “Distributed sensor localization in random environments using minimal number of anchor nodes,”
*IEEE Transactions on Signal Processing*, vol. 57, no. 5, pp. 2000–2016, 2009. View at Publisher · View at Google Scholar · View at Scopus - Y. Ding, N. Krislock, J. Qian, and H. Wolkowicz, “Sensor network localization, Euclidean distance matrix completions, and graph realization,” in
*Proceedings of the 1st ACM International Workshop on Mobile Entity Localization and Tracking in GPS-Less Environments (MELT '08)*, pp. 129–134, 2008. - Y. Zhu, S. J. Gortler, and D. Thurston, “Sensor network localization using sensor perturbation,”
*ACM Transactions on Sensor Networks*, vol. 7, no. 4, p. 36, 2011. - K. Yedavalli, B. Krishnamachari, S. Ravulat, and B. Srinivasan, “Ecolocation: a sequence based technique for RF localization in wireless sensor networks,” in
*Proceedings of the 4th International Symposium on Information Processing in Sensor Networks (IPSN '05)*, pp. 285–292, April 2005. View at Publisher · View at Google Scholar · View at Scopus