Distance Measurement Model Based on RSSI in WSN

The relationship between RSSI (Received Signal Strength Indication) values and distance is the foundation and the key of ranging and positioning technologies in wireless sensor networks. Log-normal shadowing model (LNSM), as a more general signal propagation model, can better describe the relationship between the RSSI value and distance, but the parameter of variance in LNSM is depended on experiences without self-adaptability. In this paper, it is found that the variance of RSSI value changes along with distance regularly by analyzing a large number of experimental data. Based on the result of analysis, we proposed the relationship function of the variance of RSSI and distance, and established the log-normal shadowing model with dynamic variance (LNSM-DV). At the same time, the method of least squares(LS) was selected to estimate the coefficients in that model, thus LNSM-DV might be adjusted dynamically according to the change of environment and be self-adaptable. The experimental results show that LNSM-DV can further reduce error, and have strong self-adaptability to various environments compared with the LNSM.


Introduction
With the development of ranging and positioning technologies in wireless sensor networks(WSN) , it becomes more and more important to find an mathematical model which can accurately describe the relationship between the RSSI [1] values and distance.This model should be able to adjust parameters according to the change of environment by itself, and also be able to reduce error farthest.
Currently, there are three types of RSSI signal propagation model for wireless sensor network (WSN),free space model [2], 2-ray ground model [3] and log-normal shadowing model (LNSM) [4].The first two models have special requirements for the application environment, while the third model is a more general signal propagation model.This paper, based on the studies of current RSSI propagation models, with the goal of accuracy and selfadaptability of model, we present a log-normal shadowing model with the dynamic variance (LNSM-DV) and establish the function of variance and distance.Using the method of least squares(LS) to estimate parameters in the model makes the parameters be able to be dynamically adjusted according to the change of the environment, and makes the model have self-adaptability.It has been veri-fied by experiments that LNSM-DV can be further eliminate errors and has a strong self-adaptability com-pared with the original model.So LNSM-DV is able to more accurately describe the relationship of the RSSI value and the distance.

RSSI Ranging
RSSI, TOA [5], TDOA [6], and the AOA [7] are ranging technologies commonly used now.Just as the use of RSSI ranging need less communication overhead, lower implementation complexity, and lower cost, so it is very suitable for the nodes in wireless sensor network which have limited power.

Principles of RSSI Ranging
The principle of RSSI ranging describes the relationship between transmitted power and received power of wireless signals and the distance among nodes.This relationship is shown in (1).
is the received power of wireless signals.
is the transmitted power of wireless signal.
is the distance between the sending nodes and receiving nodes.
is the transmission factor whose value depends on the propagation environment.
Take 10 times the logarithm of both sides on (1), then Equation ( 1) is transformed to Equation (2). 10 lg 10 lg -10 lg r P , the transmitted power of nodes, are given.is the expression of the power converted to dBm.Equation (2) can be directly written as Equation (3).
By Equation (3), we can see that the values of parameter A and parameter n determine the relationship between the strength of received signals and the distance of signal transmission.

RSSI-based Ranging Model
Currently, RSSI propagation models in wireless sensor networks include free-space model, ground bidirectional reflectance model and log-normal shadow model.
Free-space model is applicable to the following occasions: 1) the transmission distance is much larger than the antenna size and the carrier wavelength λ; 2) there are no obstacles between the transmitters and the receivers.Suppose the transmission power of wireless signal is , the power of received signals of nodes located in the distance of d can be determined by the following formulas : ( ) 10 log 10 log (4 ) In (4), and are antenna gain, and L is system loss factor which has nothing to do with the transmission.
, and are usually taken.Equation ( 5) is the signal attenuation formula using a logarithmic expression.Received power and the distance are 2-th power attenuation in Equation (5).
Surface bidirectional reflectance model is applicable to the following occasions: 1) transmission distance d is in a few kilometers or so; 2) the height of antenna of transmitter and receiver is more than 50 meters or more.The model is very accurate when it is used in the urban micro-cellular environment.The received power is determined by the following formulas: The parameter in ( 8) is the near-earth reference distance, which depends on the experiential value; the parameter 0 d  is a path loss index, which depends on specific propagation environment, and its value will become larger when there are obstacals; the parameter X  is zero-mean Gaussian random variable.The parameter , 0 d  and  describe the path loss model which has a specific receiving and sending distance.The model can be used for general wireless systems design and analysis.Synthesizing the above three kinds of propagation models, the log-normal shadow model is most suitable for wireless sensor networks applications because of its universal nature and the ablility of being configured according to environments.

The Improved Log-Normal Shadow Model
LNSM is a more general propagation model.In practical applications, it is indispensable to adjust 0 ( ) and X  in the model according to specific environment.
In general, the model's parameters are set based on experiences, so it does not have the self-adaptability.The work of this paper is to establish a function of variance  and signal propagation distance d for zero-mean Gaussian random number,and use LS to estimate coefficients of the model to improve the self-adaptability of the model.

Improve Self-Adaptability of Gaussian Gandom Number in LNSM
In an experiment, one hundred groups of signal strength data (d, RSSI ) received by Micaz nodes are collected in each points within the distance from 0 to 6.1 meters, from which 20 groups data are selected for drawing Curves.The curves of RSSI and distance are shown in Figure 1.
As can be seen from Figure 1: in the range of 0 to 3 meters, all curves have a smaller shock, and RSSI values show a relatively strong upward trend with the increment of distance d; from 3 to 5 meters, the curves have a larger shock, but the overall upward trend is still marked; from 5 to 6.1 meters, the shock of the curves tends to be gentle, and the upward trend of the curves becomes slow.From this we can see that the vibration of RSSI shows a certain degree of regularity with the changes of distance.
In order to describe how RSSI shocks with distance, an experiment is made to get the sample variance dx from 100 RSSI values collected at each distance point.The changes of variance with distance are shown as the hollow green boxes in Figure 2.
The trend of the sample variance dx of RSSI changing with distance can be seen from Figure 2. From 0 to 6.1 meters, the sample variance has gone the process from relatively stable to gradually increasing until the maximum, and then gradually down.This is basically the same as the results of the analysis from   The X  in Equation ( 8) is a zero-mean Gaussian random variable which is used to describe the Gaussian interfere-ence to the propagation of RSSI signals.Set x as a stan-dard Gaussian random number.Because X  is the zero-mean Gaussian random variable and  is the population variance, so we can get the equations: has the same distribution as X  .So we can use X  to replace X  in (8).Then (8) becomes as follows: (10) The sample variance of RSSI, such as (9), has been obtained according to the data (d, RSSI ) collected from the experiments.In order to achieve universality, we use symbols to replace the coefficients in (9).The new equation is as follows: The symbols a, b, c and e are undetermined coefficients, the values of which are dynamically adjusted according to different environments.Using s  , the sample variance of RSSI , as the approximation of population variance  , (11) becomes as follows: Taking Equation ( 12) into (10), we get (13) as follows.
  makes LNSM be able to dynamically adjust the error function according to the change of distance, which further improves the ability to eliminate errors of the model.

The Realization of the Adaptability of Coefficients in Log-Normal Shadow Model
The Self-adaptability of LNSM reflects not only in that the variance of Gaussian function in LNSM could be dynamically adjusted according to the changes of distance, but also in that the coefficients 0 ( ) , and could be dynamically adjusted according to different environments.LS in regression analysis is very suitable for estimating the coefficients in functions because of its simplicity and its small amount of computation.The algorithm is derived as follows.

a b c e
For convenience, change (13) to ( 14): The parameter is the near-earth reference distance that has already been known.Change ( 14) to (15): Then according to the principle of minimizing the sum of error squares with LS, (16) is established as follows: Calculate the partial derivative of J to  : 1 0 20 10 log( ) log( ) .Change (17) to (18): In a similar way, calculate the partial derivative of J to f : 1 0 J 2 10 log( ) Thus, ( 18) and (20) constitute the linear simultaneous equations on the coefficients ( f ,  ) in ( 14), by which the coefficients ( f ,  ) can be solved.12) and introduce observational errors  as follow.Then according to the principle of minimizing the sum of error squares with LS, ( 23) is established as follows:

Use to replace y
Respectively calculate the partial derivative of J to , , and and make them to 0, namely: . Thus, the linear simultaneous equations on the coefficients ( a ､ ､ ､ ) are established as follows.
b c e Then the coefficients (a, b, c and e) can be solved by (24).
In practice, when the experiment environments change, the coefficients in (12) and (13) can be solved by (24) and the linear simultaneous equations constituted by ( 18) and (20).So LNSM-DV can be applied in different environments.

Experiment Environment
Micaz nodes are used as the experimental hardware platform, which are wireless sensor nodes produced by Crossbow firm.Their communication module CC2420 has powerful communication capability.The core of the node is Atmega128 that is a low-power, high-speed and full-featured processor.The embedded operating system MANTIS is adopted as the experimental software platform.MANTIS based on multi-threading technology could support the point to point communication well.MANTIS is an open-source system which is programmed by the C language.The experiment program is also developed with C language based on MANTIS [9].

Setting Parameters
Set the near-earth reference distance = 0.2 m.For LNSM, set coefficients of the model as   1.Then the curves of RSSI on the distance d can be drawn as Figure 4 according to the group data (d, ( ) RSSI dB ) collected from outdoor environment as well as the other two sets of data calculated by LNSM-DV and LNSM.
As can be seen from Figure 3 and Figure 4: the curve drawn through LNSM-DV can dynamically change with the change of the indoor and outdoor environments, and the shock of it is basically consistent with the curve drawn through the data collected; however, the curve drawn through LNSM can not dynamically changes with different environments, and the shock of it largely deviates from the curve drawn through the data collected.This is because the coefficients and the variance  of Gaussian random numbers in LNSM base on experience as well as they are fixed, but the variance  of Gaussian random numbers in LNSM-DV can dynamically change with distance, which is in line with the change of the RSSI values in different environments; furthermore, RSSI dB ) collected above and use (24) to get a = -0.0493,b = 0.3938, c = -0.5599,e = 0.4745 according to the group data (d,  ) collected above.Thus, we have gotten all the coefficients in LNSM-DV.The coefficients in LNSM are set according to the Table 1.
Then the curves of RSSI on the distance can be drawn as the LS is used to estimate the coefficients in LNSM-DV, which makes the coefficients being dynamically adjusted according to different environments so that LNSM-DV has a self-adaptability.Therefore, LNSM-DV, compared to LNSM, can better describe the relationship between the distance and RSSI value of signals received by Micaz nodes and also has a strong self-adaptability.The establishment of LNSM-DV has great practical significance for improving the accuracy of ranging, the accuracy of positioning and the self-adaptability of ranging models in wireless sensor networks.

Conclusions
In this paper, we proposed a log-normal shadowing model with the dynamic variance for wireless sensor networks, and adopted the LS to estimate the coefficients in the model so that the coefficients in the model could be dynamically adjusted according to the changes of environments, which make the model self-adaptable.With experimental verification, the LNSM model have been largely improved in accuracy and self-adaptability by applying LNSM-DV and LS, which lays the foundation for the further positioning research in wireless sensor networks.Using LS to estimate the coefficients in LNSM-DV needs to collect a large number of the sample data, and to ensure that the data are various, which should be considered with the research on the layout of nodes.

Figure 2 .
Figure 2.The X  in Equation (8) is a zero-mean Gaussian random variable which is used to describe the Gaussian interfere-ence to the propagation of RSSI signals.Set x as a stan-dard Gaussian random number.Because X  13) Copyright © 2010 SciRes.WSN Equations (12) and (13) are the improved log-normal shadow model.The establishment of the function   d 

Table 1
according to the experience.

. Experiment Process and Analysis Two
beacon nodes and one base station node are used in the experiment.These nodes are 0 meter away from the ground.Choose a location for 30 meters of length and 10 meters of width outdoor open space and another location for 15 meters of length and 10 meters of width indoor hall.Collect data by sending and receiving signals among the nodes.Beacon node 1 is responsible for sending signals; beacon node 2 is responsible for receiving signals from beacon node 1, as the same time obtains the values of the received signals, then sends the values to base station node; base station node is connected to the computer and is responsible for data reception and processing.Beacon node 2 collects 100 values of signals respectively at each point which is far away from the direction of beacon node 1 and sends the values to the base station node.The base station node converts the signal values to a form expressed as s