An improved range-free location algorithm for industrial wireless sensor networks

In the traditional DV-Hop location algorithm, the number of hops within the communication radius is counted as one hop. However, in the case of uneven distribution of nodes, this method will bring a large error to the calculation of hop distance. In order to solve the above problems, an improved DV-Hop location algorithm with multiple communication radius is proposed in this paper. Based on the multi-communication radius location algorithm, the method uses the cosine theorem to correct the hop number and estimated the average hop distance, and optimizes the estimated distance of the unknown node. The algorithm uses multiple communication radius to broadcast the position to obtain the minimum number of hops between the unknown node and the beacon node and adjusts the estimated hop distance by using the cosine theorem after estimating the good hop distance, and finally uses the trilateration method, or the maximum likelihood estimation method estimates the position coordinates. The experimental results show that compared with the traditional DV-Hop algorithm and DDV-Hop algorithm, the improved DV-Hop algorithm improves the positioning accuracy and reduces the average positioning error of the unknown nodes.


Introduction
Wireless Sensor Network (WSN) has the advantages of rapid deployment, good concealment, strong self-organization, and low price, so it is very suitable for target tracking, recognition, positioning, and other applications [1][2][3][4]. Node positioning is an important part of these applications, and also the premise and basis. WSN can transmit information more accurately only by determining its position coordinates [5][6][7].
At present, there are two commonly used positioning algorithms. One is based on distance, such as received signal strength indicator (RSSI), angle of arrival (AOA), and time difference of arrival (TDOA). The characteristic of these algorithms is that the positioning accuracy is very high, but the peripheral equipment needs to be provided, and the cost is high [8][9][10][11][12]. Another is the range-free location algorithm, such as DV-Hop, centroid location algorithm. These algorithms have low cost and low power consumption, especially DV-Hop localization algorithm, which is easy to implement, requires a low proportion of

Related works
In recent years, many scholars have conducted in-depth research on the DV-Hop algorithm and proposed different improved methods for the shortcomings of the algorithm, all of which have improved the positioning accuracy and performance of the algorithm. The existing DV-Hop algorithm is mainly improved from the following four aspects: optimizing the average hop distance or minimum hop number, selecting the optimal beacon node, and optimizing the location calculation method [17][18][19][20][21][22][23][24]. In literature [25], the teaching-learning-based optimization (TLBO) algorithm was adopted to improve the DV-Hop. To obtain better positioning coverage, the hierarchical division from the target node to auxiliary beacon node was adopted to upgrade the target node to the virtual beacon node in the next round of positioning, to improve positioning accuracy. In the second section of the DV-Hop algorithm, [26] used the shuffled frog leaping algorithm (SFLA) to optimize the hop distance, which reduced the influence of hop distance on the positioning error and improved the positioning accuracy. However, the relation between the distance of beacon nodes and the adaptive value was not considered [27]. uses the average hop distance of the nearest beacon node to calculate the unknown node. The algorithm introduces threshold M, which uses the weighted average hop distance of beacon nodes within M hop to calculate the average hop distance of unknown nodes. The improved algorithm reduces the positioning error, but there are significant differences in the positioning error when different threshold M is used. In literature [28], the idea of combining a weighted DV-Hop with a weighted hyperbolic localization algorithm was proposed to improve the accuracy of algorithm positioning, but its computational complexity was higher. Based on the realization of the double communication radius, the DV-Hop algorithm based on a triple communication radius and multiple communication radius is proposed in the literature [29]. Experimental results show that the more communication radius, the smaller the positioning error, but the network overhead also increases.
Most of the existing DV-Hop algorithms assume that the path of the minimum number of hops between nodes is a straight line. However, the connections between nodes are mostly the curves in practice. Therefore, the error occurs and accumulates in the distances estimated by the number of hops and the average hop distance, that is, the error increases with the number of hops.
In order to reduce the error of estimated distance between nodes and improve the accuracy of location algorithm, this paper presents an improved DV-Hop location algorithm based on multiple communication radius. Based on the multi-communication radius location algorithm, the method uses the cosine theorem to correct the hop number and estimated average hop distance, and optimizes the estimated distance of the unknown node. The algorithm uses multiple communication radius to broadcast the position to obtain the minimum number of hops between the unknown node and the beacon node, and adjusts the estimated hop distance by using the cosine theorem after estimating the good hop distance, and finally uses the trilateration method or the maximum likelihood estimation method estimates the position coordinates.

The principle of traditional DV-Hop location algorithm
The DV-Hop algorithm is a range-free location algorithm proposed by Niculescu et al., Rutgers University, based on the distance-vector routing principle. It is also called a distance vector-hop location algorithm [30].
The process of DV-Hop localization algorithm is divided into three steps: (1.) Distance vector interchange >All sensor nodes are deployed in the monitoring area using random seeding to form the actual network topology. At the same time, each beacon node broadcasts packets to the network, including beacon node location information and hop value (initial value is 0). Each receiving node maintains the minimum hop value. Specific beacon nodes with higher hop values are defined as useless information and ignored. The hop value is incremented by 1 at each intermediate hop. Through this process, all nodes get the minimum number of hops.
As shown in Fig. 1, the number of hops between two adjacent nodes is 1, and the number represents the hop value between the unknown node and the beacon node. The circular area represents the wireless communication range of the beacon node.

(2.) Correction calculation and broadcasting
By using Eq. (1), the average distance per hop of each beacon node can be obtained and broadcast continuously in the whole network as the correction value.
where d Hop i is the average hop distance between beacon node i and other beacon nodes.
h ij is the minimum hop value between beacon nodes i and j. The coordinates of beacon nodes i and j are (x i , y i ) and (x j ,y j ), respectively. After receiving the average hop distance value of the neighbor beacon node, the unknown node multiplies the average hop distance value by the hop number to obtain the estimated physical distance as follows: d mk is the estimated distance from unknown node m to beacon node k; d Hop m is the correction value of hop distance of unknown node m; and h mk is the minimum hops value of unknown node m to beacon node k.

(3.) Positioning calculation
According to the average hop distance estimated in the second step and the minimum hop received in the first stage, the two results are multiplied to obtain the estimated distance between the unknown node and each beacon node, also known as hop distance. When three or more hop distance values are obtained, a matching positioning method (such as the least square method or trilateration method) is used to calculate position coordinates of the unknown node.

Problems with DV-Hop algorithm
Through the analysis of the DV-Hop algorithm, it can be seen that the DV-Hop algorithm uses the method of calculating the average distance of beacon nodes, so a large error may occur in the positioning process. Figure 2 shows a network with an uneven distribution of the nodes. The distance between unknown node U 1 and unknown node U 2 is much smaller than that between unknown node U 2 and beacon node B 1 , and the distance between beacon node B 2 and unknown node U 3 is much smaller than that between unknown node U 1 and unknown node U 3 . In the DV-Hop algorithm, the distance between unknown node U 3 and beacon node B 2 and between unknown node U 1 and unknown node U 2 is calculated as one hop, so there is a big error between the calculated average hop distance and the real average hop distance. If the average hop distance of beacon node B 2 is used to calculate the distance from the unknown node to beacon node B 2 , then there is a large error between the calculated value and the real value.

The proposed algorithm
In order to solve the problem of large positioning error in the case of uneven distribution of network nodes, an improved DV-Hop algorithm is proposed in this paper. Firstly, the algorithm uses the multi-communication radius to broadcast the location and records the location, hop number of other beacon nodes. Then, the distance between the unknown node and the corresponding beacon node is estimated. The estimated hop distance is adjusted by using the cosine theorem. Finally, the coordinates are calculated by using the trilateration method after obtaining the location information of three or more beacon nodes. The localization process of the proposed algorithm is shown in Fig. 3.

Determining the minimum number of hops
In this paper, four communication radius are selected, namely R, 0.75R, 0.5R, and 0.25R, as shown in Fig. 4. The communication radius R is divided into four regions A, B, C, and D. A region refers to the range of information broadcast by the beacon node at the communication radius of 0.25R; B region refers to the range of information broadcast by the beacon node at the communication radius of 0.5R; C region refers to the range of information broadcast by the beacon node at the communication radius of 0.75R; D region refers to the range of information broadcast by the beacon node at the communication radius of R.
When the beacon nodes broadcast information, the minimum hop from the node of region A to the node i is set as 0.25; the minimum hop from the node of region B to the node O is set as 0. 5; the minimum hop from the node of region C to the node O is set as 0.75; the minimum hop from the node of region D to the node O is set as 1. When the adjacent node receives the information sent by the node with communication radius R, it is forwarded. After the information broadcast is completed, the minimum hop value is obtained between each node. The recorded minimum hop number may not be an integer, which refines the hop number between nodes, making the minimum hop number more accurate and the hop distance calculation more accurate.

Correct average hops distance
Note: J t is the time of hops between two beacon nodes; J n is the number of hops between two beacon nodes; and J t = J n /4.

(1) Selection of intermediate nodes
As shown in Fig. 5, if J t is odd, the intermediate node of the path is just the intermediate node; if J t is even, the two hops in the middle of the path are the intermediate nodes. The angle formed by the connection between the intermediate node and the beacon node is 90°≤ α ≤ 180°.
(2) Proving the angle range Figure 6 is the schematic diagram of the angle and transmission path. There are two routes between A and B, namely AC-CB and AD-DB. Obviously, β > α, and AC + CB is closer to AB than AD + DB. Therefore, when the angle is greater, the distance of the transmission path is closer to the linear distance between two points. When the angle approaches 180°, the hop distance will be closer to the true value. Therefore, the angle range (90°≤ α ≤ 180°) is the most ideal.
(3) Solving the correction value using cosine theorem There are two choices of intermediate nodes, so the calculation is divided into two cases, J t is odd or even.
When J t is odd As shown in figure (1) in Fig. 5, | B 2 B 3 | is the distance from B 2 to B 3 , | B 2 M | is the distance from B 2 to M, | B 3 M | is the distance from B 3 to M, and | B 3 M | is unknown. According to the cosine theorem, these are the following expressions: Since the node M is the middle node of the route, and | B 2 M | = | B 3 M | = d BM , | B 2 B 3 | = d 2 . The following expressions can be obtained: After simplification, we can get, The value of d BM is, Then the average hop distance h ad is, Substitute Eq. (6) into Eq. (7) to get: When J et is even As shown in figure (2) in Fig. 5, d pmo is the midpoint distance from B 2 to B 3 ; d BM1 is the distance from B 2 to M 1 , and it is also the distance from B 3 to M 1 ; d BM2 is the distance from B 2 to M 2 , and it also the distance from B 3 to M 2 . According to the cosine theorem, the expression for midpoint distance d BM is as follows: In Eq. (9), Substitute Eqs. (10) and (11) into Eq. (9) to obtain: Then the average hop distance h ad is, Substitute Eq. (12) into Eq. (13) to obtain: Finally, the corrected value C v can be obtained from the average hop distance, actual hop distance, and the number of hops: Using Eq. (15), the estimated average hop distance is corrected by the correction value C v .

Experimental results and analysis
In the Matlab environment, the improved location algorithm is simulated experimentally, and the simulation results are analyzed and compared with the traditional DV-Hop algorithm and DDV-Hop in [31]. The monitoring area is a square area of 100 × 100 meters. The number of the nodes is N = 100 (30 beacon nodes). The communication radius is 30 m.
The following equation is the average positioning error: N is the number of nodes, n is the number of beacon nodes, R is the communication radius, T i is the actual coordinates, and E i is the estimated coordinates.
And the unknown nodes are distributed randomly and evenly. Figure 7 shows the distribution of the nodes.
The density of beacon nodes will affect the location accuracy of unknown nodes. When the number of beacon nodes in the simulation region changes from 10 to 40, the traditional DV-Hop algorithm, DDV-Hop algorithm, and improved DV-Hop algorithm proposed in this paper are compared in simulation. Figure 8 shows the influence diagram of beacon node number changes on positioning accuracy. It can be seen that the positioning error of the improved DV-Hop algorithm is significantly lower than that of the traditional DV-Hop algorithm, and the DDV-Hop algorithm when the number of beacon nodes is 10, which effectively reduces the positioning error, and the curve tends to be stable with the increase of beacon nodes. The curve is stable but the positioning error is smaller than the traditional DV-Hop algorithm and the DDV-Hop algorithm. The improved DV-Hop algorithm proposed in this paper can use a few beacon nodes to reduce the cost. The size of the communication radius determines the number of beacon nodes that can be obtained by the unknown node. When the unknown node obtains more beacon node locations, the positioning result becomes more accurate. When the communication radius varies between 20 and 50 m, the traditional DV-Hop algorithm, DDV-Hop algorithm, and improved DV-Hop algorithm proposed in this paper are compared in simulation. Figure 9 shows the influence of communication radius change on positioning accuracy. With the increase of the communication range, the average positioning error tends to decrease in all algorithms. Compared to the traditional DV-Hop algorithm, the DDV-Hop algorithm has higher position accuracy in the simulation, but the improved DV-Hop algorithm proposed in this paper has about 50% smaller localization error in average.

Conclusion
In this paper, the improved DV-Hop algorithm adopts the multi-communication radius to refine the number of hops and uses cosine theorem to correct the distance between nodes. Under the same environment parameters, the traditional DV-Hop algorithm, DDV-Hop algorithm, and improved DV-Hop algorithm proposed in this paper are compared in simulation. The influence of two algorithms on the positioning error of unknown nodes is compared under different beacon node density and communication radius. The experimental results show that compared with the traditional DV-Hop algorithm and DDV-Hop algorithm, the improved DV-Hop algorithm improves the positioning accuracy and reduces the average positioning error of the unknown nodes.