Paper—An Enhanced Hybrid 3D Localization Algorithm Based on APIT and DV-Hop An Enhanced Hybrid 3D Localization Algorithm Based on APIT and DV-Hop

Wireless sensor networks (WSN), as a new method of information collection and processing, has a wide range of applications. Since the acquired data must be bound with the location information of sensor nodes, the sensor localization is one of the supporting technologies of wireless sensor networks. However, the common localization algorithms, such as APIT algorithm and DV-Hop algorithm, have the following problems: 1) the low localization accuracy of beacon nodes; 2) the low coverage rate in sparse environment. In this paper, we combine APIT algorithm and DV-Hop algorithm to design an enhanced hybrid 3D localization algorithm, which can improve the localization accuracy with a high coverage rate. The proposed hybrid algorithm can reduce the triangles in the triangle interior point test (PIT) and select good triangles to improve the localization accuracy of the beacon nodes in dense environments in dense environments. In addition, the algorithm can combine the advantages of APIT algorithm and DV-Hop algorithm localization algorithm to calculate the unknown node coordinates, and the location coverage of the beacon nodes in sparse environment can also be improved. Simulation results show that the proposed hybrid algorithm can effectively improve the localization accuracy of beacon nodes in the dense environment and the location coverage of beacon nodes in sparse environment. Keywords—Hybrid 3D location algorithm, APIT algorithm, DV-Hop algorithm


Introduction
more and more attention to environmental supervision issues. Thus wireless sensor network technology plays an important role to solve some problems in environmental monitoring [3]. Generally, the wireless sensor nodes are randomly deployed in the environment monitoring area, and the nodes need to obtain information about the monitoring area, so the location of the nodes is critical. It is not practical to manually deploy or install a GPS receiver for all sensor nodes, which are limited by the cost, power consumption and scalability. Most of the sensor nodes do not have the location information, but the location information of the nodes has a crucial effect on the whole wireless sensor network monitoring application [4]. Therefore, it is very important to apply the localization technology in wireless sensor networks. The nodes in the wireless sensor network forward the collected data information to the monitor in the form of multi-hop routing. In the monitoring area, the nodes are randomly deployed and the wireless communication network is self-organized, which means each of the sensor nodes can dynamically find the neighbor nodes, their own localization, and network communication connection [5]. The nodes in the network are stronger than the common nodes in hardware configuration and function. They are connected with the external network to collect the monitoring data of ordinary nodes and then process and organize them. Then these data are sent to the base station in multi-hop forwarding mode. Thus the monitored data information is then sent by the base station to the end user using a satellite channel or a wired network [6]. In the wireless sensor network, nodes are usually divided into two kinds, one for the unknown node (Unknown Node) and the other for the beacon node (Beacon Node). The general node of the location information is unknown, while the beacon node location information is known, because the beacon node can obtain their own location coordinates through its own GPS localization device [7]. In addition, the deployment density of beacon nodes is much smaller than that of the general nodes. Unknown nodes can communicate within the radius of the neighbor nodes, and they can use the beacon node to calculate the location information by using the localization algorithms.
The main localization algorithms can be divided into two kinds: 1) distance-based localization algorithm, which are: RSSI, TOA, TDOA and AOA and so on [8][9][10][11][12]; 2) Distance-free (range-free) localization algorithm, which are: approximate triangle point test (approximate point in triangle test, APIT) algorithm, DV-Hop (distance vector-hop) algorithm, Amorphous algorithm and MAP algorithm and so on. The localization algorithm based on distance measurement needs to measure the actual distance or azimuth between adjacent nodes to calculate the position of unknown nodes. Using such algorithm can obtain more accurate distance, but the hardware requirement of node is higher and the energy consumption is relatively higher [13]. And susceptible to temperature, obstacles and other environmental factors, the localization algorithm based on distance measurement has brought difficulties to the specific application. The distance-free localization algorithm does not need additional hardware support and has lower communication cost. Because existing localization algorithms without the need of distance measurement have a lower localization accuracy, it is necessary to develop the distance-free localization algorithm to improve the localization accuracy. In addition, the coarse-precision localization of the sensor net-work is sufficient. So the distance-independent localization technology is increasingly concerned by the researchers.
The most common distance-independent localization algorithms are APIT algorithm and DV-Hop algorithm [14]: 1) APIT localization algorithm has many advantages, such as widely suitable environment, low complexity, low cost and easy implementation. In order to improve the localization accuracy of APIT algorithm, authors [7] proposed the use of angle summing to reduce the misjudgment of whether an unknown node is in the triangle; In order to improve the APIT algorithm in the beacon node sparse environment localization coverage, authors [9] proposed a hybrid algorithm based on RSSI and APIT to reduce the localization error and improve the localization coverage. 2) The DV-Hop algorithm is a typical localization algorithm without distance measurement technology, which has a good distribution and scalability with the use of distance vector routing and GPS localization. The accuracy of the DV-Hop algorithm mainly depends on the estimated accuracy of the average distance per hop, which is related to the actual distance between the nodes, and the topology of the network also has a certain influence on the localization accuracy [15]. The DV-Hop algorithm is generally only applicable to the isotropic dense network. In the three-dimensional network environment, the three beacon nodes, which are used for localization collinear or close to the collinear, will lead to a larger position error and may lead to the maximum error of up to 200%. In this paper, the concept of collinearity is introduced in the three-dimensional space to constrain the topological relations between the beacon nodes and the unknown nodes [16]. The computational complexity is greatly reduced and the nodes are more energy efficient. For the actual environment, the requirement is that the nodes should be distributed in three-dimensional network space, so that the classic two-dimensional localization algorithm is no longer applicable. Therefore, several three-dimensional localization algorithms have been proposed to improve the localization accuracy in the literature [17][18]. The authors [17] combined the DV-Hop with cube shell intersection method, in which the DV-Hop was used to get the unknown node's initial positions and the cube radius scale was used to obtain the final position. In addition, the authors [18] extended the rangefree algorithm Time of Arrival based DV-Hop (TOADV-Hop) to 3-D space for improving the aspects of traffic and positioning error. These DV-Hop based 3-D localization algorithms have been proposed to improve the localization accuracy. In this paper, we will combine both the 3-D DV-Hop algorithm and APIT algorithm to obtain a better localization performance. In conclusion, there are some problems in the localization of APIT algorithm and DV-Hop algorithm, and they have the problem of low coverage in sparse environment.

2
Design of Hybrid 3D Localization Algorithm

APIT algorithm
Basic Principles of APIT Algorithm. The localization process of the APIT algorithm can be expressed as follows: The target node can get the set of beacon nodes which can communicate with it through the information transmission with the surrounding beacon nodes. Assuming that there are n elements in the set and any three nodes are chosen to form a triangle, a total of 3 C n triangles can be formed. It is judged that the position of the unknown node is inside the triangle or outside the triangle, and then the other three nodes are selected to determine the position of the unknown node until all triangles are exhausted [19]. Then, the overlapping area of all triangles can be calculated and further the area where the unknown node is located can be gradually reduced. Finally the centroid of the overlapping area can be obtained as the estimated coordinates of the unknown node. As shown in Figure 1, the overlapping portion of all available triangles is the approximate position where the unknown node is located, and the centroid of the overlapping portion represented by point M is the position where the unknown node is located.
The most important part of the APIT algorithm is to determine whether the unknown node is inside or outside the triangle. In this regard, the best-point-in-triangle-! (PIT) test algorithm can be used to determine whether the unknown node is inside the triangle. Figure 2 shows the specific PIT algorithm principle.  http://www.i-joe.org A, B, and C are the three vertices of the triangle, and M is the unknown node that needs to be confirmed. Let the M point moves in any direction. When the M point is in the movement process and there is a point with the move to the M point, distances from the M point to A, B, C are increased or decreased at the same time, thus the point M is located outside the triangle; otherwise, M is located inside the triangle, which follows the PIT principle.
Enhanced APIT algorithm. In the edge of the entire wireless sensor network, the number of unknown nodes and beacon nodes is relatively small, so the number of triangles will be reduced [20]. In the PIT algorithm for localization, the deviation of the actual location and the localization position will be too large due to the excessive overlap of triangles.
In order to improve the localization accuracy of wireless sensor networks, an improved APIT algorithm is proposed. The improved APIT algorithm is implemented on the basis of changes in the signal strength of the unknown node received by the beacon node. As shown in Figure 3, when the target node moves in the direction of 1, the signal strength of the three beacon nodes have different with different changes of length. The signal strength of the A beacon node will be increased, while the signal strength of C target node will be smaller [21]. The improved APIT algorithm is to narrow the area of the unknown node M within the triangle and improve the localization accuracy of the node. The concrete realization is to divide the triangle, thus the triangle can be divided into several small intervals, and then the triangle will be further divided into several small intervals. From the vertical division of the triangle, we can see that the acute angle triangle is divided into six small regions, while the right triangle and the obtuse angle triangle are divided into four small areas. Perpendicular segmentation of three kinds of triangles, such as acute triangles, right-angled triangles and obtuse angles, is shown in Figure 4  It can be seen from Figure 3, the triangle is divided into triangular, quadrilateral, pentagonal three small interval after the split. By comparing the signal strength of the unknown node with three beacon nodes A, B, and C, we can determine which interval of the unknown node is located. In Figure 3 (a), the signal intensity of the position node M is compared with the three points of A, B, and C in the acute angle triangle. If the signal intensity received at point A is greater than the point B and point C, and the received signal strength at point B is greater than the signal strength received at point C, then the unknown node is located in the small area 6 of the divided small area 1, 2, 3, 4, 5, 6, which is available small area. If the signal strength received at point A is greater than the signal strength received by B and C, the signal strength received at point B is equal to the signal strength received at point C. Then, the unknown node is located on the vertical line of B and C. In the case, a common area of 1 and 6 cells can be selected as a usable small area. For all available triangles, the larger the number of available triangles is, the larger the number of small areas is. Firstly, we find the overlapping parts of all available small areas, and then find the center of the mass position of the overlapping area. Finally we obtain the centroid position as the estimated position of the unknown node: 1. The improved APIT algorithm is similar to the APIT algorithm. First, we need to know the information of all the beacon nodes around the target node, which includes the position of the beacon node and the signal strength of the beacon node receiving the target node. 2. All beacon nodes that can communicate with the target node form a beacon node set. We arbitrarily select three beacon nodes to form a triangle to determine whether the target node is inside or outside the triangle. It is known that the three beacon nodes receive the signal strength of the target. When there is a point, the signal strength of the three beacon nodes received by the point is greater than or less than the signal strength received by the target node, then the target node is outside the triangle; otherwise, the target node is inside the triangle. 3. Select all the triangles that contain the target node, and divide the triangle into four or six parts with vertical lines. If the triangle is acute triangle, it can be divided into six small intervals. And if the triangle is a rectangular triangle or obtuse angle triangle, it can be divided into four small intervals. By comparing the signal strength by the target node received by the three beacon nodes, it can determine which subrange the target node is located. 4. Find the overlapping area of all the cells, and find the center of mass position of the overlapping area, and the center position can be seen as the target node position.

3D DV-Hop Localization Algorithm Based on Multicollinearity
3D DV-Hop localization algorithm. The DV-Hop localization algorithm as a distance-independent localization algorithm, is proposed by Dragos Niculescu from University of Lotto, USA [22]. The optimal principle is that the unknown node first calculates the minimum hop count of the beacon node, then estimates the average distance per hop, and then multiplies the average hop ratio by the minimum number of hops, finally obtains the estimated distance between the unknown node and the beacon node [23]. The measurement method or the maximum likelihood estimation method can be used to calculate the coordinates of the unknown node.
Similar to the conventional DV-HOP algorithm, the 3D DV-Hop algorithm is also composed of three phases [24][25][26]. Firstly, the typical distance vector exchange protocol is used to obtain all the nodes in the network to get the number of hops from the beacon nodes. In the second stage, after receiving the other beacon node position and the separated jump distance, the beacon node calculates the network average distance per hop, which is broadcast as a correction value to the network. And the correction value (average hop distance) i HopSize of the beacon node ( ) , , The above equations can be transformed into AX B = ,  x y y z z d d When T A A is reversible, the equation can be obtained by ordinary least squares (OLS).
( ) From the 3D DV-Hop algorithm described above, it can be seen that T A A must be reversible when using OLS to solve the position of the node. When 0 T A A = or 0 T A A ! , the matrix appears multiple collinearity, that is, the exact linear relationship or approximation linear relationship are appeared in matrix A . Multicollinearity consists of two types: complete multicollinearity and incomplete multiple collinearity. Its presence will have undesirable consequences for the final localization accuracy, and when there is a full multicollinearity, the variable measure will even fail. In the case of incomplete multi-collinearity, they are unstable and the variance of the parameter estimate becomes larger although the estimated values of the positions can be obtained. Then the degree of enlargement depends on the severity of the multiple collinearity. This paper will describe how to prevent this from happening in details, in the following sections. Three-dimensional topological analysis. The sensor nodes are often randomly distributed in practical applications, with considering other error caused by factors such as ranging and interference, so that the four beacon nodes are coplanar or approximately coplanar, i.e., 0 T A A = or 0 T A A ! , which leads to the failure of the multilateral ranging method. When the four beacon nodes are fully coplanar, there are two intersections of the four spheres, which makes it difficult to estimate the correct position of the node. As shown in Figure 4, the four beacon nodes are coplanar in the three-dimensional space, and when the polygraph method is used, the position of the unknown node A may be A or A'.

Fig. 4. Coplanar of beacon nodes in three-dimensional space
When 0 T A A ! , although the estimated value of ! X can be obtained, but the estimate is very unstable. The estimated position of the unknown node can be obtained with using the optimization method, which is at the cost of a higher computational complexity.The degree of multiple collinearity in the two-dimensional space is critical to the final overall localization accuracy of the nodes, and the degree of multiple collinearity in the three-dimensional space is also extremely important [27]. In the twodimensional space, the evaluation of the degree of multiple collinearity can been seen as the quality of the triangle constituted of the three beacon nodes. And the method has a variety of ways, such as the size of the triangle angle, the triangle three high school minimum, triangular inscribed circle radius and the ratio of the circumcircle radius. The degree of multiple collinearity of the four beacon nodes in the threedimensional space can be evaluated by the mesh quality of the tetrahedron. The tetrahedron can be considered as a triangular extension in space. The criteria for measuring tetrahedral mesh quality are different from judging triangular mesh quality standards, which has several metrics to determine the quality of triangles. A reasonable metric for tetrahedral mesh quality should meet the following principles: The translation, rotation, reflection, reflection, uniform scaling of the element should not change its metric; if and only if the tetrahedron is a tetrahedron, the value is maximum; when the tetrahedral volume tends to zero, the measure is close to zero. People have put forward a variety of judgments and criteria to evaluate the quality of tetrahedron, respectively, as defined below, In the formula, , r R are the radius of the tangent circle and the circumcircle in the tetrahedron, respectively. The formula for calculating the radius of the tangential sphere and the radius of the outer circle r and R are expressed as follows, Where the value range is 1#"> 0, when " $ 0 when the tetrahedron of the four fixed-point coplanarity, when " = 1 tetrahedron is into a tetrahedron.

Coefficient
Considering the above approximation of several metric criteria and taking into account the simplicity of the calculation, the radius ratio method is used to measure the degree of multiple collinearity of the four beacon nodes in the three-dimensional space. The multi-collinearity is measured with using a radius ratio, which is defined as follows, In the second stage of the DV-Hop algorithm, the beacon node calculates the average per-hop distance after obtaining the distance and hops information from the adjacent beacon points. In this paper, because the sum distance of the jumps replaces the actual distance, it may include the far nodes in the calculation of the average distance of each hop. Therefore, the error increases as the number of jumps increases. The distance between the unknown node and the beacon node unit is farther away from the third stage of the algorithm, and the smaller the localization effect is due to the multiple collinearity constraints, the greater the localization error is. Therefore, based on the 3D DV-Hop algorithm, two thresholds (multi-collinearity threshold thre_mc, hop threshold thre_hops) are added, and a three-dimensional DV-Hop localization algorithm based on multiple collinearities is proposed. The setting threshold of the hops limits the reception of packets greater than the threshold hops threshold, which ensures that all sensor nodes exchange information only with nodes in the threshold range during the localization process. Because the threshold of the hops can be preset, the data traffic can be reduced and the more energy can be saved, thus the service life of the nodes is prolonged. Therefore, the localization accuracy is improved. The multi-collinearity threshold ensures that only the best beacon nodes of the topology are selected in the localization algorithm.
The proposed 3D DV-Hop localization algorithm is based on multi-collinearity. The core idea is the same as the ordinary DV-Hop algorithm, using the number of hops and the average distance as the distance between the nodes, and then use the multi-range ranging method to estimate the location of unknown nodes. Multidimensional ranging method is the most basic target location method and is the basis of a variety of sensor network location algorithms. The distance between multiple points and the target point can be used in the method to estimate the position of the target node. The 3D DV-Hop localization algorithm incorporates the constraints of the hop count and multiple collinearity thresholds in the general DV-Hop localization algorithm. The addition of the threshold improves the localization accuracy of the algorithm and reduces the computational complexity of the localization algorithm. The specific process of the algorithm is expressed in details as follows, 1. Calculate the minimum number of hops for the unknown node and the beacon node within the defined hop count. The unknown node records the minimum number of hops received by the beacon node, while ignoring the larger number of hops from the same beacon node. When the unknown node receives the hop count value less than the threshold thre_hops, the node increases the hop value by l and forwards it to the neighbor node. Otherwise, the packet is discarded. 2. Calculate the distance between the unknown node and the beacon node within the defined hop count. Each beacon node uses the DV-Hop method to estimate the actual distance per hop based on the location information and the number of hops of the other beacon nodes. The unknown node records only the average distance per hop for the first average distance or the number of jumps per hop, so that the unknown node can receive the average distance per hop from the nearest beacon and calculate the hop count based on the number of beacon nodes within the hop distance 3. Use the node location method mentioned in the basic principle of node location to calculate its own position. First, the unknown node will calculate all its beacon nodes in four groups according to the set of MC, according to the set thre_mc excluded MC by discarding less than the reference point combinations with less than thre_mc, and then according to the multilateral measurement method to calculate the node coordinates, and finally take the average of all the results as the final position coordinates of the unknown node.

Blending of APIT and DV-Hop localization algorithms
Aiming at the above problems, the APIT algorithm is improved by combining with the DV-Hop algorithm. A hybrid localization algorithm based on APIT and DV-Hop is proposed. The flow chart of the algorithm is shown in Figure 5. When the PIT is used to determine whether the unknown node is inside the triangular region composed of any three beacon nodes, the judgment condition is added under the original APIT algorithm condition. The beacon nodes A, B, C and the unknown node M are obtained by the RSSI method, and then use the triangular cosine theorem to find the angle. If !AMC + !AMB + !BMC = 360 °, M is in the triangle; otherwise, it is judged that the M is outside the triangle. In the selection of fine triangles, remove the signal strength of the weak triangle, the selection principle is that: in the beacon node intensive, set a threshold P, and P is for the unknown node in the PIT point of all triangles 3 nodes of the signal strength and the average (The number of triangles is K), the left side of the inequality represents the sum of the signal intensities of the three nodes of the current triangle, that is, the constraint condition is expressed as follows,  (16) In the sparse environment of the beacon node, and the neighbor beacon node is not less than 3, the DV-Hop algorithm is used to locate. Because it calculates the minimum hop count of the unknown node and the beacon node by the distance vector routing method and then calculates the average distance of each hop. The product of the average distance between each hop and the minimum hop count is used as the estimated distance between the unknown node and the beacon node. When there are three beacon nodes, the coordinates of the unknown node are calculated using the trilateral method or the maximum likelihood estimation method. With only two neighbors of beacon nodes, the two-point localization method should be applied for node localization. The two-point localization method can measure the distance of unknown nodes and two beacon nodes according to RSSI, and then the coordinates of the unknown node can be obtained according to the coordinates of these two beacons.

Experiments and analysis
This experiment is implemented in Matlab simulation platform, and the characteristics of the experimental model and its parameters are as follows: 1. Wireless sensor network coverage: 1000m % 1000m two-dimensional plane. 2. The network layout of 200 sensor nodes, beacon nodes and unknown nodes are based on the experimental parameters, and each node is randomly distributed. Communication radius is 200m, and all nodes have the same communication, perception, storage capacity. 3. This environment is the ideal virtual environment without considering the external environment on the wireless signal in the propagation process without interference, and the wireless signal will only appear energy loss due to the transmission.
According to localization precision comparison between APIT, enhanced APIT and DV-Hop algorithms , as shown in Figure 6, when the beacon node is sparse, the enhanced APIT algorithm has improved the localization accuracy of the APIT algorithm (ie, the triangulation of the PIT is reduced and the triangles are selected) (Below 3%). With the increase of beacon nodes, the localization accuracy improved obviously (about 4% ~ 8%). Overall, the enhanced APIT algorithm has improved the localization accuracy. In addition, the enhanced APIT algorithm can outperform all other algorithms, such as the APIT algorithm and the DV-Hop algorithm. According to localization precision comparison between enhanced APIT, DV-Hop and hybrid 3D localization algorithms, as shown in Figure 7, when the beacon node is sparse, the localization accuracy is affected by the increase in the coverage of the hybrid algorithm. However, with the increase of the proportion of the beacon nodes, the localization accuracy of the hybrid 3D localization algorithm based on APIT and DV-Hop will increase in the beacon node dense environment. This is because the proposed enhanced hybrid 3D localization algorithm can improve the localization accuracy in the beacon node intensive environment with the specified structure. And with combining both the APIT and DV-Hop algorithms, the enhanced hybrid 3D localization algorithm is more robust to positioning the location of unknown nodes with high accuracy. Localization coverage comparisons between improved APIT, DV-Hop and hybrid 3D localization algorithms is shown in Figure 8. We can find that the localization coverage of the hybrid algorithm is significantly higher than that of the APIT algorithm and the DV-Hop algorithm under the condition of the proportional dilution of the beacon node. This is because the enhanced hybrid 3D localization algorithm combines the enhanced APIT algorithm and the 3D DV-Hop algorithm, which are carefully designed to cope with the sparse problem. For different situations, the corresponding localization algorithms, such as the APIT algorithm and the DV-Hop, are selected to suit the specific situation. Therefore, this hybrid algorithm greatly improves the beacon node sparse environment localization coverage. In total, the proposed enhanced hybrid 3D localization algorithm can improves the localization accuracy of the beacon node in a dense environment by reducing the triangular miscarriage of the triangular interior point test (PIT) and selecting the excellent triangles. In addition, combining with the DV-Hop algorithm and the two-In sparse environment, the advantages of unknown node coordinates can be calculated, and then the localization coverage of beacon nodes under sparse environment is also improved.

Conclusions
In this paper, we propose an enhanced 3-D localization algorithm to solve the two problems in the common localization algorithms, which is the low localization accuracy of beacon nodes and the low coverage rate in sparse environment. Firstly, an enhanced APIT algorithm and a 3D DV-Hop algorithm are designed to improve the robustness of each algorithm in different situations. Then, a hybrid 3D localization algorithm is designed with combining the advantages of APIT algorithm and DV-Hop algorithm, which can further improve the localization accuracy of the beacon nodes in dense environments by reducing the triangles in the triangle interior point test (PIT) and selecting good triangles. In addition, the algorithm can combine the advantages of APIT algorithm and DV-Hop algorithm localization algorithm to calculate the unknown node coordinates, and also improve the location coverage of the beacon nodes in sparse environment. Simulation results show that the proposed hybrid algorithm can effectively improve the localization accuracy of beacon nodes in the dense environment and the location coverage of beacon nodes in sparse environment.