An Energy-Efficient Strategy for Accurate Distance Estimation in Wireless Sensor Networks

In line with recent research efforts made to conceive energy saving protocols and algorithms and power sensitive network architectures, in this paper we propose a transmission strategy to minimize the energy consumption in a sensor network when using a localization technique based on the measurement of the strength (RSS) or the time of arrival (TOA) of the received signal. In particular, we find the transmission power and the packet transmission rate that jointly minimize the total consumed energy, while ensuring at the same time a desired accuracy in the RSS or TOA measurements. We also propose some corrections to these theoretical results to take into account the effects of shadowing and packet loss in the propagation channel. The proposed strategy is shown to be effective in realistic scenarios providing energy savings with respect to other transmission strategies, and also guaranteeing a given accuracy in the distance estimations, which will serve to guarantee a desired accuracy in the localization result.


Introduction
Due to environmental concerns and to the limited lifetime of energy resources, an intensive research activity is being carried out in energy-efficient protocols and algorithms for wireless networks, trying to reduce the energy consumption of the different network activities.
One of the activities that should be optimized is the localization of the nodes, as many applications rely on the knowledge of the position of the user or the surrounding objects to provide useful information and services. Furthermore, knowing the position of the nodes can be used to optimize other network aspects, such as routing [1,2] or in-network data compression [3,4], leading to energy savings.
The localization of the nodes in wireless networks is usually based on radio frequency techniques [5], which consist in measuring certain parameters of the radio signal that one node receives from other nodes, for example, the angle of arrival (AOA), the time of arrival (TOA) or the received signal strength (RSS). From these measurements, the position of the wireless nodes can be inferred using a triangulation algorithm [6] or by comparing the measurement with others previously saved in a database [7,8].
The research in localization for wireless sensor and ad hoc networks is very active, and a number of works have considered the energy consumption as a factor in the design of localization techniques and algorithms. This is a critical issue, since wireless devices have limited energy resources (batteries), which should be efficiently managed in order to extend the life of the network as much as possible [9]. Consequently, practical and effective solutions are needed to perform the localization in an energy-efficient way.
Approaches that include the use of dedicated hardware specially designed for this purpose [10] cannot be used with commercial off-the-shelf systems. On the other hand, given that the radio system is the most energy demanding part of a wireless node [11,12], whereas the other elements (processor, memory, etc.) consume significantly less energy, solutions that focus on reducing the computational complexity of the localization algorithms [13,14] will not contribute to significantly reduce the global energy consumption. Therefore, to effectively reduce the amount of energy that is consumed during the localization, the aim should be put on reducing the amount of time that the nodes are communicating. In other words, the transmitted/received signals that are used to measure the parameter in which the localization is based (e.g., RSS, TOA) should be kept to the minimum. However, energy consumption cannot be considered independently. The accuracy of the localization should be also taken into account, as in general, we could probably allow higher energy consumption if more accurate localization result is needed. In contrast to other works that focus on this trade-off by modifying the frequency of the localization to trade higher energy consumption for better localization accuracy (in terms of update rate) [15][16][17][18], we propose to trade the accuracy of the RSS or TOA measurements for energy consumption. Our approach can be applied regardless of the localization update frequency, thus it complements the existing work and further reduces the energy consumption. In particular, we propose and evaluate a strategy that minimizes the total consumed energy during the localization process, while ensuring a certain desired accuracy in distance estimations. Although we illustrate the results of the analysis for a particular channel and communications model, the method is directly extensible to other models. Our work includes an exhaustive analysis based on simulations, which shows that not only the energy consumption is reduced with respect to other techniques (leading to energy savings of around 50% in some cases), but also that the accuracy of the localization is improved and assured to maintain a desired value. The main contributions of this paper are: (1) we propose a strategy to minimize energy consumption during the localization process that assures a given localization accuracy and is based on local information at each node; (2) we include two effective modifications of the above theoretical strategy in order to consider the effects of the signal propagation in real environments.
The structure of the paper is as follows. Section 2 reviews some related work regarding the consumption-accuracy trade-off in localization systems. Section 3 defines the application scenario and the communication models that have been selected for our analysis. Section 4 analyzes the energy consumption of the localization procedure and proposes a transmission strategy, based on local information at each node, which minimizes the total power consumption of the network and at the same time achieves a given accuracy in the distance estimations. Some modifications to this theoretical strategy are also proposed to achieve the desired performance under real propagation conditions. The performance of the proposed strategy is evaluated in Section 5 and compared with other strategies through a set of simulations based on experimental measurements. Finally, Section 6 extracts some conclusions and proposes some future work.

Related Work
The trade-off between the energy consumption and the accuracy of localization algorithms was first addressed in [19], which proposed a localization algorithm in which each node can choose between different methods to measure the distances to their neighbors, each one with different accuracy and different energy consumption. This algorithm enables to know the amount of energy needed to obtain a given accuracy, or the accuracy that is achieved with a given energy consumption. As mentioned in Section 1, in wireless ad hoc and sensor networks distances are usually estimated from some parameter of the radio signal, as the RSS or the TOA. In practice, in a given network, only one of these parameters is used to estimate the distances between the nodes, so in order to reduce energy consumption, it would be valuable to find a transmission strategy that minimizes the energy consumption for a given accuracy and for a given distance estimation technique. This idea is followed by some object-tracking systems, as [15][16][17][18], where the frequency of the localization is modified to trade higher energy consumption for better localization accuracy. Their general mechanisms consist in detecting or predicting the mobility pattern of the tracked target, and then dynamically adjusting the localization frequency. These methods are based on the assumption that the localization accuracy deteriorates with the target's mobility level due to a delay error produced by the movement of the object between the instant in which the RSS or TOA is measured and the instant in which the position is calculated. However, they do not consider that for a given localization frequency, the accuracy of the RSS or TOA measurements can also be traded for energy consumption.
In our previous work [20], we propose a communication scheme for RSS-based localization that minimizes the energy that is consumed during the measurement of the RSS while maintaining a given accuracy in this measurement. In [21] we extend this idea to TOA-based localization. The sensitivity of this strategy to errors in the distance estimation is evaluated in [22]. This paper builds on the strategy proposed in these previous works in order to gain a deeper insight into the energy consumption-localization accuracy trade-off. In particular, w.r.t. our previous work, we now provide a theoretical framework, showing that if all the involved parameters are expressed as a function of the signal to noise ratio, an optimal solution can be found in closed form. The advantages of this new formulation are twofold: (i) we capture the rationale of energy consumption by identifying its fundamental elements and their dependencies, and (ii) we achieve a considerable reduction in the computational complexity, as the closed-form solution avoids using a full search in the space of tunable parameters. Furthermore, we also extend previous work to take into account the effects of real propagation conditions, in order that the final strategy achieves the desired accuracy in the distance estimation even in real environments with shadowing and packet losses.

Problem Statement and Assumptions for the Localization Scheme
We consider here a typical scenario of a wireless multi-hop network composed of both mobile nodes and nodes that are deployed at fixed positions. In this scenario, the position estimation of the mobile nodes should be updated frequently enough so that the nodes can be tracked as they move. Hence, each localization of these nodes should be performed within a given period T 0 , which depends on the mobility pattern of each node. In this work, we assume that T 0 is known. In fact, there are several methods available in the literature (e.g., [15][16][17][18]) to compute it in real time.
As explained in Section 1, the position of a node in a wireless network is usually computed from the measurements of a parameter of the radio signal (RSS, TOA, etc.). The accuracy of the localization will therefore depend on the accuracy of these measurements.
The measured radio parameters are random variables, so their uncertainty can be reduced, in general, by averaging a number of measurements. In particular, both TOA and RSS measurements are usually described as random Gaussian variables [23], so if n measurements are averaged, the standard deviation can be reduced by a factor of √ n , provided the measurements are independent. Let us suppose that a node will average the RSS or TOA of all packets received during a period T 0 , which depends on how often the localization of the node must be performed, with the objective of achieving a given accuracy in the distance estimations. The number of received packets (n) during this localization period will determine the accuracy of the RSS or TOA measurements, and therefore, the accuracy of the distance estimation. Due to the nature of the radio link, the receiver node will not receive all the packets that are transmitted by the transmitter node. The probability of receiving a packet in a certain link, that is, the packet reception probability (P RP ) or packet reception rate, is a function of the signal to noise ratio (SN R), (see Section 3.1). Therefore, in order to receive n packets during a time interval T 0 , packets can be sent either with a high transmission power (so that the SN R at the receiver is high and very few transmitted packets are lost) at a rate of n/T 0 , or with a lower transmission power (some packets will be lost) but at a higher rate (k/T 0 , with k > n being the number of transmitted packets during the time interval T 0 ).
The goal is to optimize the transmission strategy at each node with the aim of obtaining a given accuracy in the RSS or TOA measurements, while minimizing the energy consumption in the global network. As the radio system is the most energy demanding part of a node (see Section 1) we will only take into account the energy consumption of the radio system. The transmission strategy will be defined by two parameters: the transmission power (P T X ) and the time between transmitted packets (T ), that is, the inverse of the packet transmission rate (k/T 0 ).
We will assume that all nodes in the network are synchronized; hence, one-way TOA measurements can be performed in the network. In addition, given that nodes are synchronized, they can turn off their radio when they are not transmitting or expecting to receive a packet from another node, so idle listening is avoided and the energy consumption of the radio system is only due to transmitting and receiving packets.
In order to evaluate the energy consumption during the localization procedure, some assumptions about the receiver and radio channel behavior must be done. In the following, we propose to use simple models of the receiver and the channel.

PRP-SNR Relation
The probability of a successful reception of a packet is the probability of successfully receiving all its bits, assuming that there is no error correction. It is well known that the probability of bit error depends on the encoding and modulation of the radio signal, thus, the packet reception probability will also depend on them. For example, for QPSK and BPSK modulation schemes, the packet reception probability in presence of additive white Gaussian noise and in absence of interferers is given by [24]: where l is the length of the packet (in bytes), BER is the bit error rate, E b /N 0 is the signal to noise ratio per bit, snr is the signal to noise ratio (in natural units), W is the channel bandwidth, v b is the bit rate and the function Q(x) is the tail probability of the standard normal distribution. More complete models have been proposed [25] to take into account complex phenomena such as asymmetry, interference, different quality of receivers and transmitters, correlations between reception rate of links, etc. However, this simpler model has been selected for this work because it enables a closed-form mathematical formulation and also fits quite well to experimental data (see Section 5.1).

Path Loss Model
On the other hand, a model of the channel that relates the transmission power to the received power is needed, as it will provide a relation between transmission power P T X and SN R at the receiver for a certain distance between them. Many channel models have been proposed for outdoor and indoor environments [26] (e.g., Nakagami fading model, Rayleigh fading, Ricean fading, etc.) but one of the most popular, due to its simplicity, is the log-normal shadowing path loss model [27], which establishes the following relation between the received power (P RX ) and the distance (d) between transmitter and receiver: where P T X is the transmission power, A is a constant term, η is the path loss exponent, and V ∼ N (0, σ 2 ) is a zero-mean Gaussian random variable with standard deviation σ. The constant term A depends on the transmitter's and receiver's antenna gains and on the power loss for a reference distance d 0 , and has to be experimentally determined. On the other hand, the path loss exponent η typically ranges between 2 and 4 depending on the environment, and it has to be experimentally determined too. The random variable V models the effects of shadowing and considers the randomness across an ensemble of many deployment environments. As the experiments in [28] indicate, if the environment is static and the transmitter and receiver stay at fixed positions, the standard deviation of the measured received power is lower than σ, whereas if a node moves or the environment changes (due to people movement or long lags of time) the standard deviation of the measured received power is σ. For this reason, if a channel model like Equation (2) is used to estimate distances, averaging a number of received signal strength measurements in a static situation does not significantly reduce the estimation errors, whereas averaging measurements taken at slightly different positions or in a changing environment is more effective to reduce estimation errors [29]. As previously said, this channel model provides a relation between the transmitted power (P T X ), the SN R at the receiver and the distance (d) between transmitter and receiver, i.e.,: where SN R, which is a random variable, is the signal to noise ratio at the receiver expressed in decibels and N RX is the noise level at the receiver.

A Transmission Strategy for Minimizing Energy Consumption
As explained in Section 3, our goal is to optimize the transmission strategy for the localization process with the aim of obtaining certain accuracy in the distance estimations while minimizing the energy consumption. In this section, we first include a theoretical analysis of the energy consumption during the localization procedure in terms of the transmission strategy parameters (transmission power and packet transmission rate) and the channel behavior (characterized through the P RP ) in order to obtain general expressions valid for any wireless network. Some results are also presented for the particular models described in Section 3 and a minimum consumption transmission strategy for the localization process that guarantees a given accuracy in the distance estimations is proposed. Then, two modifications to this ideal strategy are introduced in order to make it practical and effective in real applications by counteracting the random effects of radio propagation.

Energy Consumption Analysis
Let us consider a certain link of a network like the one described in Section 3, consisting of a transmitter node, which will periodically send packets, and a receiver node, which will measure the RSS or the TOA of all received packets. The receiver will average all the measurements (n) obtained during the localization period T 0 , so that the standard deviation of the measurements can be reduced by a factor of √ n. Therefore, a desired accuracy in the measurement of the RSS or the TOA imposes a minimum number of received packets n obj .
On the other hand, when k packets are transmitted, the average number of packets that are finally received is: where T is the time interval between consecutive transmitted packets. Consequently, a desired accuracy in the RSS or the TOA imposes a relationship between T and P RP , given T 0 . As shown in Section 3.1, the P RP depends on the snr at the receiver. As a result, a desired accuracy imposes a relationship between snr and T . Among all snr-T pairs that ensure the required number of received packets, we want to find the one with the lowest energy consumption. The consumed energy at transmission during T 0 is given by: where k is the number of transmitted packets during the period T 0 , E p is the consumed energy when transmitting a single packet, p tx is the transmission power (in natural units), T p is the time it takes to send a packet and n is the average number of received packets. Since the localization procedure is periodic with period T 0 , this consumed energy is an appropriate parameter to analyze the energy efficiency.
If we assume that the receiver is awake and listening to possible receptions only at given periods (previously negotiated with the transmitter), the consumed energy at reception during T 0 is given by: where T r is the reception period and C rx is the consumption when the node is in receiving mode. E RX is constant, as C rx is a constant value that depends on the hardware characteristics. Therefore, in order to minimize the total energy consumption, we will only need to minimize the energy consumption during transmission. Using Equations (1) and (3), E T X can be expressed as a function of the signal to noise ratio at the receiver: where n rx and a are N RX and A expressed in natural units, X is a log-normal random variable with parameters µ X = 0 and σ X = σ · ln 10/10, and x is given by: where snr is the mean value of the SN R expressed in natural units. It can be obviously noticed that, for a given distance, the greater the required accuracy (described by n), the more energy will be consumed. On the other hand, as the distance between transmitter and receiver increases, the consumed energy increases as well, for a given desired accuracy. Finally, note that E T X is a random variable composed of a constant multiplied by a log-normal random variable, therefore, it is itself another log-normal random variable, with parameters (1−Q(x)) 8l , σ E = σ X and mean value given by: Deriving Equation (9) with respect to the snr at the receiver, it can be obtained that the value of x (or snr) for which the average energy consumption reaches a minimum (x * ) satisfies the following expression: x In conclusion, if we manage to achieve the snr * corresponding to this x * , the energy consumption will be minimized.
To provide some illustrative results, Figure 1 shows the energy consumption as a function of the SN R for the parameters of our sensor network, which performs a localization once a second, that is, T 0 = 1 s, and uses 8-bytes packets, with T p = 256 µs. The estimated values of the channel parameters are η = 2.5 and A = -80 dBm and the noise level at the receiver is N RX = -87 dBm. The energy consumption was calculated for n = 5 and d = 2 m. We can see in Figure 1 that if the optimum SN R value is not achievable, it would be better to use a higher transmission power, as the increase of power consumption with the SN R is slower for higher values of SN R.  On the other hand, note that the desired accuracy imposed a relationship between snr and T , thus, there is an optimum value of T corresponding to snr * , which can be calculated from Equations (1) and (4): In conclusion, among the pairs snr-T that satisfy a desired accuracy, there is a pair snr * -T * for which the energy consumption is minimum. For that reason, in order to measure the RSS or the TOA with certain accuracy, the strategy that we propose consists in transmitting packets with a packet rate of 1/T * and such a transmission power P T X that the snr at the receiver is equal to snr * . As the snr at the receiver is proportional to the transmission power for a given distance d between transmitter and receiver (see Section 3.2), in order to calculate the optimum value of P T X , an estimate of the distance between transmitter and receiver is needed. In practice, this distance estimation can be obtained from the RSS or TOA measurements of the previous localization period.
Note (from Equation (10)) that the optimum value x * only depends on the packet length, therefore, the optimum value of snr at the receiver to achieve the lowest energy consumption does not depend on the accuracy we want to obtain or on the propagation characteristics, it only depends on the packet length and on the W/v b ratio, i.e., its value is constant for a given network. This is an interesting result from a practical point of view, as it implies that the value of snr * does not need to be calculated in real time, which would be costly from a computational point of view, as it involves solving expression (10) iteratively. Therefore, the proposed strategy only involves very simple operations to calculate the optimum values of T * and P * T X from the known value of snr * and, yet, guarantees the desired accuracy in the measurements while achieving the minimum energy consumption. This results in a very useful and attractive technique for battery-powered wireless devices that are deployed to perform the localization of people or objects. Although we have derived here the particular expressions for the specific case of our channel and receiver models, the strategy is directly extendable to other models.
Let us also remark that the value of the localization period T 0 does not have any influence on the applicability of our strategy as long as it is big enough to send the required number of packets, which is usually the case in practice. Furthermore, the value of T 0 does not need to be constant in time.
In fact, it can be optimized to adapt to the mobility characteristics of the mobile node [15][16][17][18]. The combination of the proposed optimization with the optimization of the localization period may lead to further energy savings.
Note that as we have assumed that there is a synchronization schedule known by all the nodes, the localization messages should be sent within the assigned periods. In principle, this does not affect the localization accuracy or the proposed strategy, as long as the required number of packets can be transmitted.
Finally, we would like to point out that in practice, the synchronization of the network may not be perfect. In this case, the nodes should be listening to possible transmissions also during the idle periods in order not to lose packets, so the energy consumption in reception mode would increase. The proposed strategy is not directly affected, as it optimizes the energy consumption in transmission mode, but the energy savings, relative to the total energy consumption, would not be as high as in the ideal synchronization case. Another effect of an imperfect synchronization is that TOA measurements will not be so accurate, so its standard deviation will increase and the distance estimation errors will be higher. This does not affect the performance of the proposed strategy, as it was formulated in terms of the desired number of packets. But clearly, the desired number of packets to achieve a certain accuracy will increase with respect to the ideal case (see Equation (25) in Appendix A: if σ t increases, n has to increase to achieve the same σ), and the energy consumption will increase accordingly.

Practical Considerations
In a real environment, the random nature of the propagation channel will have some effects on the proposed strategy that should be overcome. In particular, both the transmission power and the packet transmission rate need to be modified in order to maintain the desired accuracy when real propagation conditions are considered. In the rest of this section, we explain how and why these two parameters of the transmission strategy have to be corrected.
On one hand, the proposed strategy relies on the calculation of the transmission power that is necessary to reach the receiver with the optimum snr. As commented previously, an estimation of the distance between the nodes is necessary for this calculation. In real deployments, the distance estimations calculated from TOA or RSS measurements are affected by errors (see Appendix A and B), so the transmission power that is used to reach the receiver with the desired snr may be different from the optimum (see Section 4.3 for an analysis of how this fact affects the consumed energy). For example, in the case of RSS-based localization, in which distances are estimated from the received signal strength of the received packets, distances are usually underestimated. The reason is that the packets with low snr suffer from a higher loss probability and, thus, it is more probable to estimate the distance from higher-power packets, which will yield shorter distance estimations. If the transmission power corresponding to this underestimated distances is used, the packets will arrive at the receiver with a snr lower than snr * , and consequently, there will be more packet losses than desired. In order to avoid this effect, the transmission power has to be corrected.
According to Equation (3), the SN R (in decibels) of the packets that arrive at the receiver follows a normal distribution with mean SN R = P T X + A − 10η log d/d 0 − N RX and standard deviation σ. Therefore, in natural units, the snr of these packets will be a log-normal random variable with parameters µ snr = SN R · ln 10/10 = ln 10 SN R/10 and σ snr = σ · ln 10/10. Among all the packets that reach the receiver, some are successfully received but some are not and the probability of a successful reception depends on the value of the snr, according to Equation (1). Thus, the probability density function of the snr given that the packet has been received can be expressed by: If one of the received packets is used to estimate the distance, the difference between the transmission power necessary to reach the receiver with the desired snr * calculated from it (P T X ) and the optimum transmission power (given by the true distance) (P * T X ) can be expressed as: where SN R refers here to the SN R of the successfully received packet, whose probability density function can be calculated from Equation (12), knowing that SN R = 10 · log snr: As a consequence, the estimated transmission power has to be corrected by adding a margin equal to the mean value of Equation (13). In other words, this margin must be calculated as the difference between the mean value of the SN R of the successfully received packets (which can be calculated numerically using Equation (14)) and SN R * . Figure 2 shows the value of this margin as a function of the standard deviation of the shadowing for different packet lengths. This margin was seen to be independent of the value of W/v b , and nearly independent of the packet length, as it can be seen in the figure. On the other hand, even when the optimum transmission power is used, the final snr at the receiver may not be the desired one, as the propagation is again affected by random shadowing. In fact, the snr at the receiver will be a log-normal random variable and, therefore, the P RP and n will also be random variables and their probability density functions can be calculated easily according to Equations (1) and (4). In particular, the probability density function of the P RP can be calculated as: where µ snr = ln 10 SN R/10 = ln snr * , σ snr = σ · ln 10/10, Thus, knowing that n = k · P RP , the probability density function of n can be calculated as: where n obj is the desired number of received packets and P RP * is the value of the packet reception probability corresponding to the optimum snr: . The mean value of n can be then calculated numerically, resulting that this value is lower than the desired one n obj . The difference between the two depends on l and W/v b : the mean value of n is lower when the packet is longer or when W/v b is higher. Figure 3 shows the relation between these two values for different values of l and W/v b for the case of RSS-based localization as a function of the standard deviation of the SN R distribution. This factor must be used to correct the number of transmitted packets, in order to counteract the effects of the propagation in real deployments. Thus, the estimated value of T * calculated from Equation (11) must be divided by this factor. Although the energy consumption will increase when these two corrections are included in the transmission strategy, they are necessary to achieve the desired number of received packets in real environments and, therefore, to achieve the desired accuracy; otherwise, the accuracy would not be guaranteed. Nevertheless, the final energy consumption is very small and still entails significant savings with respect to other transmission strategies.

Sensitivity Analysis
It is interesting to analyze how much energy will be consumed if the best transmission strategy is not perfectly achieved, due to an error in the estimated transmission power. As it has been mentioned above, the error in the estimated transmission power is due to an error in the distance estimation, which depends itself on the RSS or TOA measurement errors and on the number of packets that are averaged at the receiver. In this section, we first evaluate how the energy consumption is affected by the errors in the estimated transmission power and then we study how the distance estimation errors propagate to errors in the estimated transmission power, and therefore affect the energy consumption.
Let us suppose a transmitter node X that has to send packets to another node Y, so that Y receives in average n obj packets during the period T 0 . As the optimum snr at receiver node Y is known, node X can calculate the optimum value of T (T * ) that satisfies the desired accuracy using Equation (11). On the other hand, the optimum transmission power P * T X can be obtained from Equation (3), assuming that the distance between transmitter node X and receiver node Y is known. An error in the distance estimation will produce an error in the estimated optimum transmission power, which will lead to the use of a transmission power P T X different from the optimum P * T X . If the estimated transmission power is greater than P * T X , the energy consumption will increase with respect to the minimum E min and the number of received packets will increase as well with respect to n obj , although it is not necessary. If the estimated transmission power is lower than P * T X , the energy consumption will diminish, but the number of received packets will not be sufficient. Figure 4 shows how the errors in the transmission power affect the consumed energy and the number of received packets. In particular, Figure 4(a) represents the ratio between the energy consumption E corresponding to the estimated transmission power P T X and E min (corresponding to the optimum transmission power P * T X ) as a function of the error in the transmission power (P T X -P * T X ). This relation is valid for any value of n obj , for any W/v b ratio for any packet length l and for any distance between transmitter and receiver. On the other hand, Figure 4(b) shows the relation between the number of received packets n corresponding to the estimated transmission power P T X and the desired number of received packets n obj (corresponding to the optimum transmission power P * T X ) as a function of the error in the transmission power. This relation is valid for any value of n obj , for any W/v b ratio and for any distance between transmitter and receiver, but depends on the packet length l. As shown in Figure 4(a), the consumed energy E will be greater than the minimum value (E min ) if the transmission power is overestimated. Furthermore, the relation between the error in the transmission power (P T X − P * T X ) and the corresponding energy consumption is exponential. For example, if the transmission power is overestimated in 1 dB the energy consumption will be a 26% higher than E min , if it is overestimated in 2 dB the energy consumption will be a 59% higher than E min , and if it is overestimated in 3 dB the energy consumption will be doubled with respect to E min . On the other hand, as shown in Figure 4(b), the number of received packets n will be lower than the desired n obj if the transmission power is underestimated. Notice that the behavior is quite sharp, especially for longer packets. For example, for 40-bytes packets, if the transmission power is underestimated in only 1.4 dB, the number of received packets will be halved with respect to the objective n obj , and if the transmission power is underestimated in more than 4 dB, the number of received packets will be practically zero.
The behavior shown in these figures is valid for both TOA-based and RSS-based localization schemes, but as the probability distribution of the distance estimation is different for the two localization schemes (see Appendix A and B), the probability distribution ofP T X − P * T X will also be different. Therefore, the frequency of underestimations and overestimations of the transmission power will depend on the distance estimation method, and this will affect the probability distribution of the energy consumption and the number of received packets, as we will see next.
This error in the transmission power can be calculated as: whered is the estimated distance. Appendix A and B derive the expressions ofd for TOA-based and RSS-based localization respectively. In a TOA-based localization scheme the distance estimation is given by Equation (24), therefore the difference between calculated and optimum transmission power will be given by: where σ = c · σ t / √ n or σ = c · σ t /2 √ n , as explained in Appendix A. On the other hand, in a RSS-based localization scheme the distance estimation is given by Equation (28), thus the difference between calculated and optimum transmission power will be given by: with σ = σ RSS / √ n. Figure 5 shows the probability density function of the relative energy consumption (E /E min ) for the cases of TOA-based and RSS-based localization. The different curves correspond to different values of σ/d and σ respectively. Notice that in the TOA case the individual values of σ and d do not have any influence, as long as the relation σ/d remains the same. This can be easily understand from Equation (18). In both cases, the probability of consuming more energy increases with σ. Furthermore, the mean value of E /E min also increases when the standard deviation increases. Figure 6 shows the probability density function of the relative number of received packets (n/n obj ) for TOA-based and RSS-based localization. The different curves correspond to different values of σ/d and σ respectively, and were calculated for a packet length of l = 5 bytes (different packet lengths produce similar results, but a little more sharper as the packet length increases). In both cases, when the standard deviation is bigger, the probability of not receiving the desired number of packets is higher. It can be also seen that if the standard deviation is over a certain threshold, the pdf begins to be bimodal. This is because the margin of SN R for which the P RP takes intermediate values is small, so if the standard deviation is big enough, the probability of receiving packets with a very low or very high SN R (enough to make P RP = 0 or P RP = 1 respectively) is significant.  In conclusion, for both TOA and RSS-based localization methods, a greater variance in the measurements will produce a greater variance in the optimum transmission power estimation and thus, more energy consumption and a higher probability of losing packets.

Application to Real Hardware
The proposed strategy has been derived from the assumption that the power consumption of the transmitter is equal to the transmitted power. However, for real devices, this assumption may not be true due to the inefficiencies of the hardware. In this case, the theoretical strategy previously proposed has to be slightly modified, by substituting the transmission power p tx in Equation (5) by the power consumption at transmission p T , which in general may depend on the transmission power in a non-linear way. Therefore, the real energy consumption is related to the ideal one, given by Equation (5), by the following expression: where g(p tx ) = p T /p tx is a nonlinear function of p tx that will be different for each type of hardware.
Similarly to the ideal case, we can minimize this energy consumption with respect to the snr by setting the derivative equal to zero (and working with the mean values of the random variables). After some algebraic calculations, we finally obtain the following expression: The value of x (and therefore, the value of snr) for which this expression is equal to 0 gives the minimum average energy consumption. Clearly, the result will depend on the hardware characteristics.
As an illustration, we next apply this method for two common radio chips used in wireless sensor networks devices: the ChipCon chips CC1000 and CC2420. Clearly, real devices also include other components apart from the radio chip, which will also affect the energy consumption. However, this example illustrates how to proceed in a general case where there is a nonlinear relationship between transmission power and consumption. Several values of p T as a function of p tx can be obtained from the datasheets of the two chips [30,31]. In order to have an approximate expression of g(p tx ) and its derivative, we approximated these sets of points by an analytical expression of the form g(p tx ) = U · p V tx . Table 1 shows the values of U and V for the two chips and the correlation coefficient of the fitting. As it can be seen, there is a high correlation in both cases, which means that the considered expression fits well to the data. Table 1. Fitting of U · p V tx to the real values of g(p tx ) = p T /p tx for the CC1000 and CC2420 radio chips. Introducing this expression and its derivative in Equation (21), and after some algebraic manipulation, we finally obtain that the value of x for which the average energy consumption reaches a minimum (x * ) satisfies the following expression: Thus, if we manage to achieve at the receiver the corresponding value of signal to noise ratio snr * (using Equation (8)), the real energy consumption will be minimized. Similarly to the ideal case, the optimum value of the snr at the receiver to achieve the lowest energy consumption does not depend on the accuracy we want to obtain or on the propagation characteristics, it only depends on the packet length l and on the W/v b ratio, i.e., its value is constant for a given network and does not need to be calculated in real time. Again, as in the ideal case, there is an optimum value of T corresponding to snr * , which can be calculated from Equation (11). Finally, the corrections for the transmission power and the packet transmission rate can be calculated similarly to the ideal case.
In conclusion, the general receipt to apply the proposed method for a specific device is: 1. Characterize the energy consumption of the device as a function of the transmission power 2. Approximate this behavior with an analytical expression for g(p tx ) = p T /p tx 3. Introduce this expression in Equation (21) and solve for x 4. Calculate the corresponding values of snr * (using Equation (8)) and T * (using Equation (11)) 5. Calculate correction factors numerically as explained in Section 4.2

Performance Evaluation
In this section, we first describe a set of experiments that were carried out to characterize a real propagation environment in order to obtain realistic models to simulate the performance of the proposed strategy. Next, we include a numerical evaluation of the proposed transmission strategy that compares its performance with the performance of other transmission strategies in several scenarios.

Experimental Characterization of the Environment
In order to simulate a realistic situation, we carried out some experiments to characterize the propagation environment of our laboratory using Memsic's MICAz motes [32]. The objective was to check that the models proposed in Section 3 approximately reflect the behavior of our wireless network and, at the same time, to extract the values of some of the model parameters that we need for the simulations.
The first set of experiments were carried out to determine the P RP as a function of the snr. These experiments were made with Memsic's MICAz motes. The MICAz is a 2.4 GHz mote with direct sequence spread spectrum radio, which uses an O-QPSK modulation scheme. Two motes were used for the experiments, one as transmitter and one as receiver. The experiments were carried out in a laboratory environment in which there were obstacles and people sitting or walking and interfering signals from other motes and other wireless systems working at the same frequency (WiFi). In each experiment, the transmitter node transmitted a packet of 8 bytes every second and the receiver node measured the RSS of the received packets, from which we obtained the snr at the receiver. The experiment was repeated for different distances between transmitter and receiver and for different transmission powers in order to have different values of snr at the receiver. The experimental results are shown in Figure 7, together with the theoretical model given by Equation (1). As it can be noticed in Figure 7, the experimental data adjust quite well to the model, with the exception of some outliers. From this experiment we obtained a value of N RX = −87 dBm for the noise level at the receiver. We also made some experiments to characterize our radio channel, that is, to establish a relation between transmission and received power in terms of the distance. In these experiments, two MICAz motes were used again, with the same configuration as in the P RP experiments, and the tests were carried out in different rooms. The RSS of the received packets was measured for different distances between transmitter and receiver. At each position, several measurements of RSS were obtained, in order to average their values. In these experiments the transmitter used P T X = 0 dBm. The results from one of the experiments are shown in Figure 8. The curve in Figure 8 represents the fitting of the mean of Equation (2) to these experimental data and was calculated using the Levenberg-Marquardt algorithm, taking d 0 = 1 m, P T X = 0 dBm and η and A as free parameters. From this experiment we obtained a value for the path loss exponent and the constant A (η = 2 and A = −64 dB). For other experiments, the estimated values of A were between −60 dB and −70 dB and the estimated values of η were between 2 and 3.

Simulation Results
We have run a set of simulations to evaluate the energy consumption of the proposed strategy in several scenarios. In these simulations, the performance of the proposed strategy is also compared with other two strategies: (1) sending n packets with the highest transmission power available by hardware and (2) sending n packets with a transmission power that depends on the estimated inter-node distance: P T X (dBm) = −A + 10η logd/d 0 + N RX (dBm), which is the most common strategy when power adaptation is used (note that this is equivalent to using a transmission power such that the SN R at the receiver is 0 dB).
In these simulations, we considered networks composed of reference nodes and mobile nodes. In order to estimate the position of the mobile nodes, each reference node transmits packets to them. These nodes measure the RSS of the received packets and calculate their distance to each of the reference nodes. With these range estimations and the known positions of the reference nodes, the mobile nodes are able to calculate their own positions. As soon as they have an estimated value of their physical position, they can send packets to other nodes with the information about their estimated position and act themselves as reference nodes. Consequently, every node of the network will transmit packets to and receive packets from every other node within its communications range. Considering the transmission strategy proposed in the previous section for a single link, we applied it to the whole network by finding at each node the optimum transmission strategy (P * T X and T * ) for its furthest neighbor (closer neighbors will be guaranteed to receive at least the same average number of packets). The transmission power P T X is adaptively modified, by estimating from Equation (3) the value necessary to achieve the desired SN R * at the furthest neighbor. As an estimate of the distance between the transmitter and its furthest neighbor is needed, the method is refined iteratively: first, the transmission power is set to an initial (high) value and a preliminary distance estimation is obtained; then, the transmission power is modified according to the distance estimation.
First, we simulated a network composed of four reference nodes deployed randomly in a 15 × 15 m 2 room and one mobile node that stays in the center of the room during 20 seconds. The localization is done every second (T 0 = 1 s) and the desired accuracy is such that n = 5. The communication channel was simulated using the log-normal model in Equation (2) with A = −65 dB, η = 2.5, d 0 = 1 m and σ = 0 dB (ideal channel without shadowing). Packet reception was modeled with Equation (1), using W = 2 Mhz and v b = 250 kbps. The average energy consumption of 5000 simulations (50 different node placements, 100 simulations for each placement), which stays constant after the first localization interval, is shown in Table 2 for different values of the packet length. On the other hand, in this ideal simulation environment, the three strategies guarantee that the average number of received packets is n = 5 at the furthest node during the whole simulation. It can be seen that the proposed strategy gives the lowest energy consumption (about 47% the energy consumption of strategy #2 for l = 4) and, at the same time, guarantees that the average number of received packets is n = 5 at the furthest node. The length of the localization packets also has an influence in the energy consumption: the gain of the proposed method with respect to the other two is higher for lower values of l. Next, to simulate a more realistic scenario, we added shadowing with σ = 2 dB and node movement to the previous simulation. We simulated a 7m-radius circular trajectory centered in the simulated area. The influence of the shadowing is twofold, as explained in Section 4.2. On one hand, the distances are usually underestimated, so the transmission power calculated from them to reach the receiver with the desired snr has to be corrected with the correction margin given at Figure 2. On the other hand, even when the optimum transmission power is used, the final snr at the receiver may not be the desired one due to the effects of shadowing. To counteract this effect, we have corrected the number of transmitted packets with the factor given at Figure 3. The average results of 5000 simulations are shown in Figure 9. Figure 9(a) shows the average energy consumption of the three strategies for each localization interval and Figure 9(b) shows the average number of received packets at the furthest node. It can be seen that the proposed strategy gives the lowest energy consumption (about 54% the energy consumption of strategy #2) and, at the same time, guarantees that, at least, the average number of received packets at the furthest node is n = 5. These results were obtained for localization packets of length l = 4 bytes. Table 3 shows the energy consumption of the proposed strategy for other values of l and Table 4 shows the average number of received packets at the furthest neighbor. It can be seen that the length of the localization packets has an effect on the performance of the proposed strategy: the longer the packet is, the lower is the gain in energy consumption with respect to other strategies. This is because when l increases, the optimum snr increases as well and gets closer to 1 (SN R = 0 dB), so the difference in energy consumption with respect to strategy #2 decreases. In any case, the proposed strategy always assures a given number of received packets, in contrast to strategy #2 and, moreover, entails energy savings with respect to other strategies.  Table 3. Energy consumption of the proposed strategy expressed in % with respect to strategy #2. l = 4 l = 10 l = 20 l = 40 54% 73% 92% 110% As explained before, the number of received packets at the furthest neighbor determines the accuracy of the distance estimation at these nodes. The accuracy of the distance estimations in closer neighbors will be at least as good as the one at the furthest neighbor. In order to better understand the behavior of the proposed transmission strategy, we have represented in Figures 10 and 11 the relation between the average energy consumption and the accuracy of the distance estimations for TOA and RSS measurements respectively, obtained from the previous realistic simulations for different values of n. The x-axis represents the average energy consumption of the whole network at each localization interval, which was calculated by summing up the energy consumption of all the nodes at each localization interval, and averaging the result over time (excluding the first localization intervals, in order to eliminate the initialization effects) and over the 5000 simulations. The y-axis represents the distance estimation accuracy at the furthest neighbor, which was calculated from the average number of received packets at the furthest neighbors. This value was obtained by taking, at each localization interval, the furthest neighbor for each node of the network, and averaging the number of packets received by these nodes. Then the results were averaged over time (excluding the first localization intervals) and over the 5000 simulations. From the number of received packets, the accuracy of the distance estimation was calculated according to the expressions of the TOA-based and RSS-based distance estimations which are derived in Appendix A and B. In the TOA case, the estimated distance is a Gaussian random variable given by Equation (24) with mean equal to the real distance and standard deviation given by Equation (25) for one-way TOA measurements or by Equation (26) for two-way TOA measurements. Figure 10 represents the accuracy as the ratio between the standard deviation of the distance estimation (σ) and the factor c · σ t , which is the standard deviation corresponding to one one-way TOA measurement. Therefore, the accuracy in this figure should be read as relative to the accuracy of one TOA measurement. In the RSS case, the estimated distance is a log-normal random variable with variance given by Equation (32). Figure 11 represents the accuracy as the ratio between the standard deviation of the distance estimation (∆d) and the real distance d, where the distance estimation variance was calculated for a channel with σ RSS = 2 dB (for other values of σ RSS the particular values of the relative accuracy change: they get bigger for bigger values of σ RSS , but the relation between the three strategies remains the same). Therefore, the accuracy in this figure should be read as a relative error in the distance (a percentage of the real distance). From these figures, it can be clearly noticed that the proposed method has a better performance regarding both the energy consumption and the accuracy of the distance estimations. The gain with respect to the other strategies is especially noticeable for short localization packets, which is the usual situation, as these packets do not carry any data information.
Finally, we have evaluated the performance of the proposed strategy for a case in which the power consumption is not equal to the transmitted power (which is usually the case for real devices). To this end, we repeated the previous simulation experiments considering the energy model for the CC2420 radio chip described in Section 4.4 and following the steps described in that section to adjust the proposed strategy. Figure 12 shows the results for n = 5 and l = 4 bytes.  It can be seen in Figure 12(b) that the proposed strategy is again the only one that guarantees the desired accuracy (n = 5), but in this case its energy consumption (Figure 12(a)) is a little bit higher than for strategy #2 (which does not guarantee the desired accuracy). To better understand this behavior, we show in Figure 13 the relation between the average energy consumption and the accuracy of the distance estimations for the different strategies.  As it can be noticed, for a given energy consumption, the proposed strategy achieves better accuracy than strategy #2, and for a given accuracy, the proposed strategy has lower energy consumption. Our proposed method shows still a gain, but of lower entity with respect to the ideal case shown in Figures 10  and 11. The reason is that for this particular hardware, the optimum value of the SN R is closer to 0 dBm, thus, there is not a big margin for improvements, as strategy #2 is practically a strategy that tries to achieve a SN R = 0 dBm at the receiver.
To sum up, the proposed strategy always guarantees a desired accuracy in the distance estimation and, at the same time, yields energy savings, especially when the optimum value of the SN R is low. As this optimum value depends on the particular energy consumption characteristics of the wireless device, bigger savings are expected for devices with more similar characteristics to that of the ideal case.

Conclusions and Further Work
In this paper, we have presented an analysis of the energy consumption during the localization process of a wireless sensor network. We have optimized the transmission strategy (in terms of transmission power and packet transmission rate) at each node with the aim of obtaining certain accuracy in the RSS or TOA measurements (expressed by the number of packets that the receiver node should average) while minimizing the energy consumption in the network. We have shown that the optimum transmission strategy consists in sending packets with such a transmission power P * T X that the snr at the receiver is the optimum and a packet rate of 1/T * , where T * depends on the desired accuracy and the optimum value of the snr. However, we have also seen that the value of P * T X depends on the distance between nodes, which is not known in advance, as it is the parameter that is estimated during localization. In order to apply the results above, the transmission power has to be estimated iteratively.
We have also proposed some modifications to the theoretical optimal strategy in order to correct the effects of the propagation channel when applying this strategy in a real scenario. In particular, we have proposed how to correct these effects in the case of RSS-based localization, by adding a correction margin to the estimated transmission power and correcting the number of transmitted packets by a factor that depends on the packet length and the value of W/v b . The proposed strategy with its corrections was proved to guarantee a desired number of received packets at the receiver (necessary to obtain a given accuracy in the distance estimations) while having at the same time lower energy consumption than other strategies.
In further work we are planning to evaluate the performance of the proposed strategy using real-field deployments. In particular, we are implementing the embedded versions of the strategy in MICAz motes (under TinyOS 2.1), to experimentally measure and evaluate the energy consumption during the localization when the proposed strategy is executed in these resource-constrained devices.
Future work on studying the effects that the accuracy of the radio measurement has on the distance estimation for TOA-based and RSS-based localization techniques will allow extracting some guidelines for the calculation of the required average number of received packets, depending on the localization accuracy requirements and on the geometric configuration of the network. Further work would also include the analysis of other channel and receiver models and the evaluation of variant channels. Furthermore, the value of the localization period T 0 , which we have considered as constant, may change in order to adapt to the mobility characteristics of the mobile node. The combination of the proposed optimization with the optimization of the localization period may lead to further energy savings and could be a promising line of future work.