Research on DV-Hop improved algorithm based on dual communication radius

In order to solve the problem that the traditional DV-Hop location algorithm has a large error in locating unknown nodes, this paper proposes an improved DV-Hop algorithm based on dual communication radius. By adding a communication radius, the algorithm updates the minimum hop number obtained by the unknown node closer to the beacon node to a smaller hop value and keeps the minimum hop number information of unknown nodes farther away. This method reflects the gap between the actual distances in terms of hop number, which solves the problem of the large difference between the actual distances of the same hops to a certain extent. Therefore, it is more advantageous to estimate the more accurate average jump distance and can calculate the more precise distance between them and obtain the more precise coordinates of unknown nodes. MATLAB simulation results show that the improved algorithm based on dual communication radius DV-Hop can effectively reduce the location error and improve the location accuracy and stability compared with the traditional DV-Hop location algorithm.


Introduction
Wireless sensor network (WSN) has many characteristics, such as low power consumption, low cost, self-organization, distribution, and small size, and has broad application prospects [1,2]. The wireless sensor network can determine the location of the event, which is its most basic function. Moreover, its location information is very important for the monitoring activities in the whole wireless sensor network, and the monitoring data without location information is always meaningless [3,4]. Therefore, the fast and accurate location on sensor nodes plays an important role in various applications, and its location technology has become a research hotspot in the field of wireless sensor networks [5,6].
The researches on the location methods for wireless sensor network node mainly focus on the location algorithm based on distance measurement and the location algorithm without distance measurement. Among them, the location algorithm based on distance measurement needs additional hardware to support the distance measurement between nodes [7,8]. Compared with the location algorithm based on distance measurement, the location algorithm without distance measurement does not need external hardware, and the cost of network nodes is low. Only through the known location information of the beacon nodes and the connectivity between nodes in the whole network, the location information of unknown nodes can be estimated. Therefore, the location method without disturbance measurement has been paid more and more attention.
Among them, distance vector hop (DV-Hop) algorithm is a typical node location algorithm without distance measurement, which is simple and widely used [2,9]. At present, the researches of the DV-Hop algorithm are mainly to improve the shortcoming in one aspect to a certain extent, so as to achieve the purpose of improving the location accuracy of nodes. In [10], the concept of the distance correction factor is introduced to modify the estimated hop distance of unknown nodes, so as to reduce the distance error. In [11], an improved algorithm based on the combination of shuffled frog leaping algorithm (SFLA) and particle swarm optimization (PSO) algorithm is proposed, which can effectively improve the positioning accuracy, but it becomes more difficult to use two large-scale optimization algorithms. In [12], the mean of the minimum and maximum average hop distance of all beacon nodes in the network is regarded as the average hop distance of the whole network, and the unknown nodes are finally located by bacterial foraging optimization (BFO) algorithm, which can effectively improve the positioning accuracy when the sensor nodes are irregularly distributed. In [13], a new method for calculating the average hop distance is proposed, and the percentage error is used as the reference of the weighting coefficient to calculate the average hop distance of unknown nodes, which improves the positioning performance.
In order to solve the problem that the traditional DV-Hop location algorithm has a large error in locating unknown nodes, this paper proposes an improved DV-Hop algorithm based on dual communication radius. By adding a communication radius, the algorithm updates the minimum hop number obtained by the unknown node closer to the beacon node to a smaller hop value and keeps the minimum hop number information of unknown nodes farther away. This method reflects the gap between the actual distances in terms of hop number, which solves the problem of the large difference between the actual distances of the same hops to a certain extent. Therefore, it is more advantageous to estimate the more accurate average jump distance and can calculate the more precise distance between them and obtain the more precise coordinates of unknown nodes. The improved algorithm improves the location accuracy and stability compared with the traditional DV-Hop location algorithm.

The Principle of Traditional DV-Hop Location Algorithm
The DV-Hop algorithm is one of a series of distributed location algorithms called Ad Hoc Positioning System (APS) based on distance vector routing [14,15]. The DV-Hop algorithm is the meaning of "distance vector routing". As the name implies, the DV-Hop algorithm is a location mechanism of distance vector hop.
DV-Hop location algorithm can be divided into the following three stages.

The First stage: the distance vector exchange
Through the step of distance vector exchange, all nodes can get the minimum hop information with respect to beacon nodes. That is to say, at the beginning of positioning, the beacon node transmits the data packets containing its own information to the unknown nodes in the network in the way of flooding. This information includes the ID of the beacon node, the coordinates of the beacon node, and the hop value between the beacon node and the receiving information node.
2.1.2 The second stage: the correction and broadcasting of the estimated average hop distance After the location of the beacon node is known, the average hop distance between the beacon nodes is estimated by using the hop information with respect to other beacon node obtained in the first stage. The average hop distance of beacon node i is shown in Eq. (1): The coordinates of beacon node i are (x i , y i ), the coordinates of beacon node j are (x j , y j ), and h ij is the minimum hop between beacon nodes i and j (i ≠ j). After calculating the average hop distance of the beacon node, it will carry out flood broadcast again in the network. Moreover, the unknown node will only receive the first received data, take the average hop distance as its average hop distance, and no longer use and retain all the subsequent corrections, in order to ensure that the average hop distance is transmitted from the nearest beacon node to the undetermined node.

The third stage: the location calculation on the unknown node
The distance between the unknown node and each beacon node can be estimated by using the hop number received by the unknown node with respect to the nearest beacon node, as well as the calculated correction value of the average per-hop distance of the beacon node [16,17]. Then, the coordinates of the nodes to be determined can be calculated by using the corresponding positioning algorithm.
As shown in Fig. 1, A, B, and C are beacon nodes, and their location coordinates information is known. Then, assume that the actual distance between them is AB = d 1 , BC = d 2 , and AC = d 3 , where d 1 , d 2 , and d 3 are all known. Through the first and second stages of the DV-Hop algorithm, we can obtain the minimum hop information between the unknown node and beacon node and the estimated average hop distance HopSize i of the beacon node. If the minimum hop number between A and B is 2, the minimum hop number between B and C is 5, and the minimum hop number between A and C is 6, then the average hop disturbance HopSize A , HopSize B , and HopSize C of the beacon nodes A, B, and C are respectively shown in Eqs. (2)-(4): The unknown node M takes the average per-hop distance of the nearest beacon node B as its own average per-hop distance value. According to the hop numbers from unknown node M to beacon nodes A, B, and C, as well as the equation d = HopSize × h, the distance between different beacon nodes and unknown nodes can be estimated by Finally, the coordinates of the node m to be determined will be calculated.

Error analysis
Only using the coordinate information of the beacon node and the hop value in information transmission to locate, the error between the real coordinates and the positioning coordinates is very large [18,19]. As shown in Fig. 2, there are three beacon nodes A, B, and C distributed in the network, and others are unknown nodes. The average hop distance of beacon node B is d Hop B ¼ ðd 1 þ d 2 Þ=ð2 þ 6Þ, and the calculated average hop distance of beacon node B is smaller than the actual average hop distance, which means the error is large. Moreover, the length of each hop from beacon node B to beacon nodes A and C is different, and there is an angle (not 180°) between each two hop segments. Therefore, one divides the linear distance by the number of hops to get the average hop distance of the beacon node, which is regarded as the correction value and the error of this correction value is very large. The distance between the unknown node and the beacon node is estimated by multiplying the correction value by the minimum hop value, which results in a large error in the estimated distance and ultimately affects the accuracy of the positioning results. Generally, unknown nodes account for the majority and beacon nodes account for the minority. The distribution density of unknown nodes is much higher than that of beacon nodes. In addition to the random distribution of beacon nodes, the distance between beacon nodes is large or small, which results in the error fluctuates greatly when the average hop distance of beacon nodes is calculated.

Improved DV-Hop algorithm
In the distance vector exchanging stage for the traditional DV-Hop algorithm, as long as the distance between the beacon node and the unknown node is less than the communication radius R, the hop number is recorded as 1. This means that there may be a large actual distance difference between two groups of unknown nodes with the hop number of 1 and beacon nodes. As shown in Fig. 3, there are some unknown nodes B and C around beacon node A, and the hop value of the unknown node and beacon node is also 1, but the actual distance between the two unknown nodes and beacon node is very different. Generally taking the hop value between them and the beacon node as 1 will reduce the positioning accuracy of the DV-Hop positioning algorithm and the stability of the algorithm.
In order to deal with this situation better, this paper proposes an improved DV-Hop algorithm based on dual communication, which requires beacon nodes to broadcast with communication radius R at the first time, and then broadcast with communication radius 0.5R at the second time, as shown in Fig. 4.
As shown in Fig. 4, when the beacon node broadcasts in the network with a communication radius of 0.5R, the hop value between the unknown node C and beacon node A is 0.5, instead of the previous 1, so that the optimization on the hop value can better reflect the location of the unknown node and beacon node. Furthermore, the hop value of beacon node A and unknown node C is closer to the real hop value. Therefore, the estimated distance is closer to the real value, which improves the positioning accuracy and the stability of the algorithm.
The specific process of the DV-Hop algorithm based on dual communication radius is expressed as follows. In the stage of distance vector exchange, the beacon node first broadcasts with the communication radius R, the hop number between the unknown node and the beacon node within its communication radius is recorded as 1, and the unknown node group 1 is generated. Then, when the beacon node broadcasts with the communication radius r ⋅ R(0 < r < 1), the hop number between the unknown node and the beacon node within its communication radius is recorded as r and unknown node group 2 is generated. Because of the communication radius R > r ⋅ R, unknown node group 2 is a subset of unknown node group 1. The minimum hop values of the same unknown nodes in unknown node group 1 and unknown node group 2 are recorded as r, while the minimum hop values of other unknown nodes are still kept as 1. In this process, only beacon nodes broadcast twice, and the unknown nodes broadcast with communication radius R after obtaining the minimum hop information between beacon nodes. Obviously, the hop value obtained by the improved DV-Hop algorithm based on double communication radius is not an integer, but is an integer plus R. Compared with single communication radius R, the minimum hop between nodes is more accurate. The improved DV-Hop algorithm based on double communication radius proposed in this paper updates the minimum hop number obtained by the unknown node which is closer to the beacon node to a smaller hop number by adding a communication radius and keeps the minimum hop number information of the unknown node which is far away from the beacon node at the same time. It shows the difference of the actual distance in terms of the hop number, which solves the problem of the large difference between the actual distances of the same hops to a certain extent, and then is helpful to estimate the more accurate average jump distance.

Analysis of simulation and results
In order to study the performance of improved algorithm based on dual communication radius, this paper simulates on the traditional DV-Hop algorithm and improved the DV-Hop algorithm by using MATLAB platform and compares the performance of the two algorithms under different communication radius and different beacon proportion. During the simulation experiment, the experimental environment and parameters are set as follows: (1) The nodes of the WSN are randomly deployed in a square area of 100 m × 100 m. It is assumed that all nodes can communicate freely within the communication radius, and all nodes have the same communication ability. Moreover, the nodes have a symmetrical communication ability.
(2) Suppose that the number of nodes distributed in the plane area is 100, and all the unknown nodes are randomly distributed.
(3) Under the same network condition, according to the experimental results, the location relative error is analyzed and compared with the traditional DV-Hop algorithm.
The relative location error is shown as the following equation: where q denotes the distance difference between the estimated location (x i ,y i ) calculated by the location algorithm and the actual location (x r , y r ), R is the communication radius, and U n is the total number of unknown nodes. The smaller the location error, the higher the location accuracy is. Figures 5, 6, and 7 show the relationship between the relative positioning error and beacon node number when communication radius is 20 m, 30 m, and 40 m, respectively.
It can be seen from Figs. 5, 6, and 7 that compared with the traditional DV-Hop algorithm, the relative positioning error of the improved DV-Hop algorithm based on the dual communication radius is smaller and the positioning accuracy is higher. When the  In addition, it can be seen from Fig. 5 that when the communication radius is 20 m, the relative positioning errors of the two algorithms fluctuate with the increase of beacon nodes. Therefore, the communication radius should be greater than 20 m in practical application.

Conclusions
From the simulation results, it can be seen that compared with the traditional DV-Hop algorithm and the improved DV-Hop algorithm based on the dual communication radius, the relative positioning error of the dual communication radius algorithm is smaller and the positioning accuracy is higher. When the total number of nodes and the communication radius of the two algorithms remain unchanged, the relative positioning error increases with the increase of the beacon nodes, and the relative positioning error decreases accordingly. Furthermore, when the communication radius is 20 m, 30 m, and 40 m, respectively, the relative error of the DV-Hop algorithm based on dual communication radius can be approximately reduced by 9~25% compared with traditional DV-Hop algorithm.