Improved recursive DV-Hop localization algorithm for average hop distance optimization

Aiming at the problem of DV-HOP algorithm with error and energy exhaustion, the average hop distance is used for optimization, and an improved recursion method is used to solve it. The algorithm first squares the distance of anchor nodes, proposes a forgetting factor to optimize the average hop distance between anchor nodes, and secondly uses recursive operations to replace anchor nodes with insufficient energy, so that the localization process of unknown nodes can continue. Experimental results show that compared with the DV-Hop algorithm and the algorithms in related literature, the improved algorithm can reduce the localization error to a certain extent and improve the localization accuracy of unknown nodes.


Introduction
Wireless Sensor Networks (WSN) is composed of a large number of small sensor devices, these devices are called sensor nodes, their role is to collect and transmit information from their environment [1] . In WSN, localization is a key link in which the collected information plays a role. If the real localization information of each sensor node is unknown, the collected data will be meaningless [2][3] . At present, a variety of wireless sensor node localization algorithms [4] can be divided into two categories: range-based and range-free algorithms. The distance-based localization algorithm is based on precise localization and requires expensive equipment to find the distance or angle information between the anchor node and its neighboring nodes to determine the localization accuracy [5] . The localization algorithms in this type of literature mainly include: RSSI, ToA, AoA, TdoA [6] . The non-distance localization algorithm determines the position of the node by approximating the distance between the nodes, and does not require any additional hardware equipment. The non-distance localization algorithms in many documents mainly include: centroid algorithm, DV-Hop algorithm, amorphous, APIT [7] .
DV-Hop algorithm is a localization algorithm that has been widely applied and researched at present. It has the advantages of easy implementation, low communication cost, and small amount of calculation. In view of the shortcomings of DV-Hop algorithm, many scholars at home and abroad have done a lot of research. Literature [8] uses weights based on error and distance, and uses improved genetic algorithm to determine the coordinates of unknown nodes. Literature [9] combines hyperbolic and weighted centroid DV-Hop localization algorithm, and uses the average hop distance of all anchor nodes as the average hop number of unknown nodes.Literature [10] uses genetic particle swarm optimization instead of conventional particle swarm optimization.
Aiming at the error and energy exhaustion of the average hop distance of the DV-Hop algorithm, this paper proposes an improved recursive DV-Hop localization algorithm based on the average hop distance optimization. The square of anchor node distance and forgetting factor are proposed to optimize the average hop distance between anchor nodes and improve recursive DV-Hop algorithm, which can solve the problems caused by the error of average hop distance and insufficient energy, and then perform the localization process of unknown nodes.

DV-Hop algorithm
The traditional DV-Hop algorithm consists of 3 steps. In step 1, each anchor node broadcasts a beacon packet, which mainly contains the positions of other nodes initialized to 1 and their hops.
Each node will receive the minimum hop count of h ij from the neighbor anchor node, and then forward it in the network, and the hop value will increase by 1 every time it is forwarded; Otherwise, this packet will be discarded. In step 2, anchor node i estimates the average distance per hop using the following formula: x y j j are the coordinates of anchor node i and anchor node j, and h ij is the minimum number of hops between anchor node i and anchor node j.
After obtaining the estimated average distance per hop in step 3, the unknown node receives the hop count information from its nearest anchor node, and the formula for calculating the distance between itself and the adjacent anchor node is as follows: where: h uk is the minimum hop value between the unknown node u and the anchor node k.

Average jump distance optimization
The unknown node forwards the received hop size information to its neighboring nodes, and the unknown node uses the hop count information to estimate their position. In this process, the error may exist in the average estimated distance between the anchor node and the anchor node when calculating the number of hops, which makes an error in the estimated distance between the anchor node and the unknown node, which will cause a large error to accumulate in the unknown node localization stage. To this end, this article improves the second and third steps of the DV-Hop algorithm localization, and proposes the functional relationship between distance and hops, use the square of the anchor node estimated distance to minimize the localization error, and use the polynomial proposed in this article to approximate the estimated distance between anchor nodes: where: 1 β and 2 β are the coefficients of the polynomial, and the number of hops between anchor nodes i and j is represented by h ij . The following forms can be obtained: In order to solve equation (4), use the following least square method to approximate expression: The unknown node calculates the nearest anchor node using polynomial approximation of Equation (3).Let the coordinates of the unknown node be ( , ) x y and the coordinates of the anchor node be ( , ) is the coordinate number of the anchor node. The estimated distance between the unknown node and anchor node i is expressed by the following formula, and multiple anchor nodes are involved in the localization process: This paper introduces a forgetting factor in equation (3) as a correction factor for the distance estimation between anchor nodes. In equation (3), polynomial coefficients 1 β and 2 β can be used to calculate the position of anchor nodes, and the following equation can be obtained: . Consider equations (6) to give the following equation: , which has the following form: Then, use the least square method to solve the equation (7):

Improved recursive localization algorithm
Sensor nodes are limited by power and their life cycle is limited. Therefore, after some sensor nodes in the network run out of energy, they will brake and gradually deconstruct the network and disrupt the localization process of unknown nodes. Therefore, this paper proposes a localization algorithm that uses a recursive form to deal with changes in the number of anchor nodes as an improvement to the traditional DV-Hop algorithm. When a new set of anchor nodes are added to the network, the proposed algorithm provides a continuous localization process.
The localization algorithm proposed in this paper is an improvement of the traditional DV-Hop localization algorithm, and the solution of the recursive least square method is updated. This paper proposes an improved recursive DV-Hop localization algorithm to improve the problem of sensor node energy exhaustion. This method is based on a set of reference nodes selected from pre-defined anchor nodes, and a recursive method is used for the localization process to select and establish a set of anchor nodes from the nodes in the network. Let X k be the estimate of the localized X of the unknown node at recursion k, where X k is defined as: In each iteration, a group of nodes are randomly selected as candidate anchor nodes. For position estimation of unknown nodes, recursive formula +1 X k is used, recursive index k=k+1, and multipoint localization method is adopted.
Consider a new group of anchor nodes in the network,The main thing is to export +1 X k , which is used as an update of X k .Use recursive least squares estimation to solve this problem.
Set the initial position as X=0. The least squares method is at recursive index k: This results in the recurrence formula +1 X k : where: 1 1 X X W k k k k θ = + + + , 1 W k + means scale factor ; k θ represents the difference between the actual and estimated coordinates of n anchor points using the recursive index k. The matrix P is called the covariance matrix because it is proportional to the estimated covariance matrix. The processing process of the improved recursive DV-Hop localization algorithm is as follows: The algorithm randomly selects a group of nodes from the created overall anchor nodes as candidate anchor nodes to use it as an estimation reference for the localization process. Then, the average hop distance optimization proposed in this paper is used for position estimation. The main problem in the practical application of wireless sensor networks is that some anchor nodes may not be able to continuously perform the localization process of unknown nodes.And because of many reasons, such as maintenance, lifetime, failure, etc., this paper considers to use a group of new anchor nodes as candidates for the anchor nodes in the position estimation process, and randomly and iteratively selects them according to their mismatches in the overall anchor nodes. Finally, the algorithm uses equation (11) to update the recursive formula used to calculate the estimated position.

Simulation results and analysis
In order to verify the performance of the algorithm in this paper, use matlabR2018a to simulate and analyze the improved algorithm in this paper, the DV-Hop localization algorithm and the algorithm in literature [11] and literature [12]. The simulation environment is: sensor nodes are randomly distributed in a square area of 100 m×100 m. In order to obtain better simulation results, perform 100 simulations and calculate the average of all experimental results.
The localization error is mainly studied by the average localization error after the normalization of the node communication radius: where: ( , ) e e x y i i is the estimated coordinate of the unknown node i, ( , ) x y i i is the real coordinate of the unknown node i. R is the communication radius of nodes in the network, and n is the total number of unknown nodes.
It can be seen from equation (12) that the localization error depends on the number of unknown nodes, the number of anchor nodes and the communication radius of the nodes. Therefore, the simulation results in this paper are compared based on these three parameters. In all experiments, the nodes are randomly distributed, and the same sensor network topology is maintained, mainly for localization accuracy with the DV-Hop algorithm, literature [11] and the algorithm in literature [12] Compare. Fig. 6 shows the average localization error relation diagram of DV-Hop algorithm, literature [11], literature [12] and the improved algorithm in this paper when the total number of nodes changes. The total number of nodes is between 200 and 500, the number of anchor nodes is 10% of the total number of nodes, and the communication radius is 15 m. It can be seen from the figure that with the increase of the total number of nodes, the localization errors of each algorithm are decreasing, which is because with the increase of the number of unknown nodes, the node density in the network increases, and the average number of neighboring nodes of each node increases, which makes the network have good connectivity. When the total number of nodes is 500, the average localization error of the proposed algorithm is 15.5%. Compared with DV-Hop algorithm, the improved DV-Hop algorithm in literature [11] and literature [12], the average localization error of the proposed algorithm is reduced by about 20%, 6% and 2% respectively.   7 shows the relationship between the average localization error of DV-Hop algorithm, literature [11] algorithm, literature [12] algorithm and the improved algorithm in this paper when the percentage of anchor nodes changes. The total number of network nodes is 300, the communication radius is 15 m, and the percentage of randomly distributed anchor nodes increases from 5% to 30% of the total number of nodes. It can be seen from the figure that with the increase of the proportion of anchor nodes, the localization error of the algorithm proposed in this paper is decreasing compared with the algorithm in the literature. The number of hops between unknown nodes and their nearest anchor nodes is reduced, so that these unknown nodes can receive information from more anchor nodes, and the estimated distance between unknown nodes and anchor nodes is closer to the real distance. Therefore, the localization error of the algorithm decreases with the increase of the proportion of anchor nodes. When the proportion of anchor points is 30%, the average localization error of this algorithm is 16%. Compared with DV-Hop algorithm, improved DV-Hop algorithm in reference [11] and reference [12], the average localization error of this algorithm is reduced by about 20%, 4% and 0.5% respectively. 5 10  Fig .7. The relationship between average localization error and anchor node ratio. Fig. 8 shows the average localization error relation diagram of DV-Hop algorithm, literature [11] algorithm, literature [12] algorithm and the improved algorithm in this paper under the condition of changing communication radius. The total number of network nodes is 300, and the proportion of anchor nodes is 10%. It can be observed from the figure that the average localization error of the algorithm proposed in this paper decreases with the increase of communication radius compared with the algorithm proposed in the literature. Because with the increase of communication radius, the communication range of anchor nodes becomes larger, and the number of unknown nodes in this communication range will increase correspondingly, thus making the localization accuracy more accurate.When the communication radius is 40 m, the average localization error of the proposed algorithm is 14%. Compared with DV-Hop algorithm, the improved DV-Hop algorithm in literature [11] and literature [12], the average localization error of the proposed algorithm is reduced by about 14%, 5% and 3% respectively.

Conclusion
In view of the error and energy exhaustion of the average hop in the localization process in WSN, this paper proposes an improved recursive DV-Hop localization algorithm based on average hop optimization, which is an improvement on the traditional DV-Hop localization algorithm. The improved algorithm optimizes the average hop distance between anchor nodes through the square of the anchor node distance and the forgetting factor, and uses polynomial approximation to optimize; The recursive algorithm replaces the anchor nodes with insufficient energy with the anchor nodes with sufficient surrounding energy. The simulation results show that the algorithm in this paper can achieve lower localization error and is better than traditional DV-Hop algorithm and related localization algorithms in localization accuracy. How to further reduce the error caused by the accumulation of average hop distance and insufficient node energy will be the subsequent research work to improve the localization accuracy of the node.