Positioning Research for Wireless Sensor Networks Based on PSO Algorithm

Based on the traditional DV-Hop algorithm and in order to overcome its existing drawbacks, an improved DV-Hop algorithm is brought forward in this paper by using the PSO algorithm. Through simulation experiments, it is found that both the average localization error and the localization coverage rate of PSO are better than that of DV-Hop. Moreover, with the increase of the number of nodes, the average localization error of PSO shows a downward trend and is less than that of DV-Hop. DOI: http://dx.doi.org/10.5755/j01.eee.19.9.5522


I. INTRODUCTION
With the development of sensor technology, wireless sensor network (WSN) has been widely used in all walks of life.Currently, WSN is still mainly used for the self-positioning of sensors, so the positioning studies have become a hot topic in WSM.Since traditional localization algorithms have the disadvantages of complexity, large positioning error and high energy cost, the improvement or optimization of traditional localization algorithms has become an important direction for the positioning studies in WSN.Aiming at the disadvantages of traditional DV-Hop algorithms, an improved DV-Hop algorithm is brought forward in this paper by using the PSO algorithm.Through simulation experiments, it is found that the localization algorithm of PSO is better than that of traditional DV-Hop.

II. DV-HOP ALGORITHM
DV-Hop is proposed by D. Niculescu and B. Nath.In the DV-Hop algorithm, beacons, which contain the position information of anchor nodes and a parameter used to represent hop numbers, are broadcast to network through the anchor nodes.These beacons are flooded in the network.When they are transmitted one time, the hop number is correspondingly increased by one.The receiving nodes only reserve the beacons that have the minimum hop number value and discard the beacons that have larger hop number value.Therefore, according to this mechanism, all of nodes in the network will obtain the minimum hop number value of each anchor node.
There are many similarities between the DV-Hop algorithm and the range-based algorithm.They both need obtain the distance from unknown nodes to anchor nodes, but the way of DV-Hop to obtain the distance is through the calculation of information in network topology instead of measuring the distance by using radio signals.
In fact, DV-Hop is composed of two waves of flooding.The first wave of flooding is similar to Sum-dist, and the nodes obtain the position information of anchor nodes and the minimum hop number from it to a certain anchor node.The second wave of flooding converts hop information into range information.According to the hop information and the distance recorded in the first wave of flooding, each anchor node can compute the actual average distance per hop by using Hop is the hop number between the two anchor nodes of i and j (i ≠ j).After computing the average distance per hop, the anchor nodes will transmit the information with TTL (time to live) in packet to the network.The unknown nodes will only record the first average distance per hop which it receives and transfer it to neighbour nodes.This strategy ensures that most of nodes receive the average distance per hop from the nearest anchor node.
The DV-Hop algorithm consists of three phases: in the first phase, each node in the network obtains the hop number from it to a certain anchor node by using the typical distance-vector exchange protocol; in the second phase, after getting the position of other anchor nodes and the interval hop distance, the anchor nodes will compute the average distance per hop in the network; in the third phase, the anchor nodes will regard the average distance per hop as a correction value, and broadcast the value through the network.The controlled flooding is adopted for the transmission of the correction value in the network, which means that each node only receives the first correction value and discards the others.This strategy ensures that most of nodes can receive the correction value from the nearest anchor node.In Fig. 1, the distance and hop number between the anchor nodes of L1, L2 and L3 are shown below.Through calculation, the correction value of L2 is: (40 + 75) / (2 + 5) = 16.42.In this case, if A obtains the correction value from L2, the distances from itself to the three anchor nodes are respectively: L1-3*1.642,L2-2*1.642 and L3-3*16.4.Then after obtaining these distances, trilateral method will be used to localize A.

III. THE DDRAWBACKS OF DV-HOP
Since nodes are randomly distributed in WSN, there are some bad nodes.
There is only Node M near Node N within one hop, and the coordinate of M is known.N only knows the location of M within one hop.Therefore, N can be at any location of N1, N2, …, Nn, as shown in Fig. 2. It can be known that the location of N is not unique.In other words, we cannot determine the location of N, so N is called as a bad node.There are only Node E and Node F near Node N within one hop, and the coordinate of E and F is known.N only knows the coordinate of E and F within one hop.Therefore, N can be also at the location of N1, as shown in Fig. 3.It can be known that the location of N is uncertain.In other words, we cannot determine the specific coordinate of N, so N is called as a bad node.
Bad nodes are a node group.The coordinate of M is known.Supposing the node group can carry out communications only through M and there is no known node in the node group, it can be known that the node group will move around the known node of M. In other words, we cannot determine their specific location, so all of nodes in the group are called as bad nodes.The distance per hop from nodes to be measured to known nodes is represented by the average distance per hop between known nodes.The distance per hop is impossible to be the same, so this method can cause the enlargement of error.
Under the condition that there are not too many known nodes, the area that can be monitored will be also relatively less.The less the area of monitoring coverage is, the lower the localization coverage rate of nodes is.If nodes to be measured want to get in touch with known nodes, they can do this only through intermediate nodes.As there are not too many known nodes, the number of intermediate hops must be increased for the communications between nodes to be measured and known nodes.With the increase of intermediate hops, the distance error will become larger accordingly.
In the above-mentioned localization stage, trilateral method is used to figure out the coordinate of nodes to be measured.The coordinate obtained by this method will have some errors, and the localization accuracy is low.

IV. PSO ALGORITHM
The solutions of each optimization problem in PSO are a "bird", here dubbed particles, in the search space.Each particle has a fitness value which is determined by optimization functions and a velocity to determine the direction and distance of their flight.And then, particles will follow the current optimum particles to search in the solution space.In the initialization process of PSO, a set of particles (or solutions) is created at random, and the final optimal solution is obtained through several iterations.At each iteration, each particle can update themselves through two factors (to get a new position by getting a new velocity): particles searches for the optimum solution by themselves, which is called "self-awareness" , and this process usually has much to do with the local search ability; another factor, which is called"swarm intelligence", refers to the optimal solution that is found by the whole group.In the velocity updating process, it can guide the whole group toward the best known positions in the search space.This is expected to move the swarm toward the best solutions under the interaction and cooperation between the individual and the group.Particle's updating behavior can be described as: ( 1) ( ) ( ( )) 11 ( ( )), 22 ( 1) ( ) , where Vid is particle's velocity; Xid is particle's position; C1 and C2 are called learning factors or acceleration coefficients; φ1 and φ2 are random positive numbers between 0 and 1; Plid is individual consciousness (individual optimal solution position); and Pgd is group optimal solution position.
V. AN IMPROVED DV-HOP ALGORITHM OPTIMIZED BY PSO ALGORITHM FOR POSITIONING The positioning error in WSN is primarily due to the error of related ranging technologies, so the error exists necessarily, and the essence of localization problems is to minimize the error.The position of nodes revised by using PSO can substantially convert to the minimization of positioning error.Supposing (x, y) is the coordinate of the unknown node that needs to be located， the distance of di from the unknown node to the ith anchor node can be obtained through (10).Therefore, the positioning error may be defined as 22 ( , ) ( ) ( ) where, dj is the actual measuring distance.
Particles are updated by using ( 2) and ( 3), and ( 5) is considered as a fitness function to evaluate the particle's fitness.The number of iterations is set correspondingly.After the iterations, the optimal solution, which is found currently, is regarded as the final estimated position of the unknown node

VI. ALGORITHM SIMULATION
The MATLAB software is used to carry out our simulation in accordance with the principle and procedure of the algorithm.In the simulation, the communication radius of each node is assumed to be 10 m.The simulation area is in a two-dimensional square of 10 m × 10 m, that is to say, the unknown nodes are within the two-dimensional square of 10 m × 10 m.The evaluation criterion for the localization algorithm in WSN is average p , ll jj xy ) represents the estimated location of the unknown node I, (xj , yj ) is the actual location of the known node and R, the node's communication radius.
The parameters in the PSO algorithm are set: the number of particles = 30; the number of iterations = 100; C1 = C3 =2; the weight of W is designed to decrease linearly from 0.9 to 0.5; Xmax = 100 and Xmin = 0.The simulation results are shown in Fig. 5-Fig.9.
The relational graph of the anchor ratio and the localization coverage rate is shown in Fig. 5.It can be known from Fig. 5 that the improved DV-Hop algorithm optimized by PSO algorithm for the localization coverage rate is obviously better than the traditional DV-Hop algorithm.The localization coverage rate of the two algorithms is compared, as shown in Table I.It can be seen from Table I that when the anchor ratio reaches 10 %, the localization coverage rate of PSO algorithm has reached 100 %, which is higher than 91 % of DV-Hop algorithm.The relational graph of the anchor ratio and the average localization error is shown in Fig. 6.It can be known from Fig. 6 that with the increase of anchor ratio, the average localization error of both PSO and DV-Hop shows a downward trend, but the average localization error of PSO is obviously less than that of DV-Hop, which means the PSO algorithm has higher localization accuracy.The specific numbers are shown in Table II.
It can be known from Fig. 7 that in general, with the increase of the number of nodes, the average localization error of both PSO and DV-Hop shows a downward trend.It can be evidently seen from Fig. 7 that the average localization error of PSO is less than that of DV-Hop, which indicates that the localization algorithm of PSO is better than that of DV-Hop.The convergence graph of PSO algorithm and the change chart of optimum value are respectively shown in Fig. 8 and Fig. 9.It can be seen from Fig. 8 and Fig. 9 that when the number of iterations reaches 20, the optimum value has reached, and with the increase of the number of iterations, it remains about the same, which indicates it has been in convergence state.

VII. CONCLUSIONS
Based on the traditional DV-Hop algorithm and in order to overcome its existing drawbacks, an improved DV-Hop algorithm is brought forward in this paper by using the PSO algorithm.Through simulation experiments, the following conclusions can be drawn: The improved DV-Hop algorithm optimized by PSO algorithm for the localization coverage rate is obviously better than the traditional DV-Hop algorithm; With the increase of anchor ratio, the average localization error of both PSO and DV-Hop shows a downward trend, but the average localization error of PSO is obviously less than that of DV-Hop, which means the PSO algorithm has higher localization accuracy; In general, with the increase of the number of nodes, the average localization error of both PSO and DV-Hop shows a downward trend, and the average localization error of PSO is less than that of DV-Hop.

Fig. 2 .FFig. 3 .
Fig. 2. The diagram of bad nodes in the first category.N

MInternetFig. 4 .
Fig. 4. The diagram of bad nodes in the third category.


is the reciprocal of hop value between the unknown node and the anchor node of i; and n is the number of unknown nodes.

Fig. 6 .
Fig. 6.The relational graph of the anchor ratio and the average localization error.

Fig. 7 .Fig. 8 .Fig. 9 .
Fig.7.The relational graph of the number of nodes and the average localization error.

TABLE II .
THE AVERAGE LOCALIZATION ERROR OF PSO AND DV-HOP.