### 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.

#### 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):

$$ {\mathrm{HopSize}}_i=\frac{\sum \limits_{i\ne j}\sqrt{{\left({x}_i-{x}_j\right)}^2+{\left({y}_i-{y}_j\right)}^2}}{\sum \limits_{i\ne j}{h}_{ij}} $$

(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):

$$ {\mathrm{HopSize}}_A=\frac{d_1+{d}_3}{2+6} $$

(2)

$$ {\mathrm{HopSize}}_B=\frac{d_1+{d}_2}{2+5} $$

(3)

$$ {\mathrm{HopSize}}_C=\frac{d_2+{d}_3}{5+6} $$

(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 *d*_{AM} = 3HopSize_{B}, *d*_{BM} = 2HopSize_{B}, and *d*_{CM} = 3HopSize_{B}.

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}_{{\mathrm{Hop}}_B}=\left({d}_1+{d}_2\right)/\left(2+6\right) \), 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.