DV-hop positioning method and system based on dynamic average hop distance and RANSAC optimization
By using a DV-Hop localization method optimized with dynamic average hop distance and RANSAC, the most similar path is selected to calculate the average hop distance and a reliable anchor node is chosen. This solves the problem of low localization accuracy of unknown nodes in the traditional DV-Hop localization algorithm and achieves high-precision localization in complex topology networks.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2022-12-12
- Publication Date
- 2026-04-07
AI Technical Summary
In the traditional DV-Hop positioning algorithm, the distance calculation error between the unknown node and all anchor nodes is relatively large, resulting in low positioning accuracy of the unknown node, especially in complex topology structures.
A dynamic average hop distance and RANSAC optimization method is adopted. Anchor node information is obtained through flooding strategy, the average hop distance is calculated by selecting the most similar path using Hamming distance, and the RANSAC algorithm is used to select reliable anchor nodes for coordinate estimation, thereby optimizing the localization of unknown nodes.
Without adding extra hardware, it improves the positioning accuracy of unknown nodes in complex topology networks, reduces the average hop distance error, and improves positioning accuracy.
Smart Images

Figure CN116095824B_ABST
Abstract
Description
Technical Field
[0001] This invention relates to the field of wireless sensor network positioning technology, specifically to a DV-Hop positioning method and system based on dynamic average hop distance and RANSAC optimization. Background Technology
[0002] Wireless sensor networks (WSNs) are distributed communication transmission networks composed of a large number of nodes that self-organize and multi-hop. (See reference: Tian Xin, Wei Guoliang, Wang Gannan. A review of wireless sensor network localization [J]. Information and Control, 2022, 51(01):69-87.) Nodes collaborate to transmit information and perceive the environment. The main function of sensor nodes is to collect data from the surrounding environment. Typically, if the location of a sensor node is unknown, the monitored data becomes meaningless. Furthermore, in some hazardous working environments, inspectors need real-time and accurate location data for communication and to prevent safety accidents. With the increasing research and development in application scenarios such as target tracking, environmental monitoring, and trajectory prediction, obtaining the location of sensor nodes has become increasingly important. (See reference: Tian Xin, Wei Guoliang, Wang Gannan. A review of wireless sensor network localization [J]. Information and Control, 2022, 51(01):69-87.) T, FB, Ebrahimpour N, et al. An optimal anchor placement method for localization in large-scale wireless sensor networks[J]. Intelligent Automation & Soft Computing, 2022, 31(2): 1197-1222. Currently, wireless sensor network localization technology, besides using GPS technology, mainly estimates the position of unknown nodes (UN) by using anchor nodes (AN) with known locations in a small number of locations in the network. Accordingly, depending on whether additional hardware or equipment is needed to assist in the localization process, localization can be divided into range-based (see reference: Chuku N, Nasipuri A. RSSI-Based localization schemes for wireless sensor networks using outlier detection[J]. Journal of Sensor and Actuator) Networks, 2021, 10(1): 10、Shan Haomin, Chen Caixue. Artificial bee colony positioning algorithm based on RSSI Gaussian filtering [J]. Journal of Sensor Technology, 2021, 34(07): 979-983、Zhan Huwei, Wang Liangyuan, Chen Si, Shi Shuie. Underground personnel positioning system based on RSSI quad-range [J]. Journal of Henan Normal University (Natural Science Edition), 2021, 49(04): 53-59) and ranging independent (see reference: Zhang Yue, Liang Jianguo, Zhang Hao, Hua Rong, Feng Lubin. Research on centroid and DV-Hop hybrid positioning algorithm of wireless sensor network [J]. Instrumentation Technology and Sensors, 2021(04): 122-126、Li Na, Jia Wei. Research on positioning of cuckoo algorithm in wireless sensor network [J]. Data Acquisition and Processing, 2020, 35(02): 315-321、Lee K, Kim S, You K. Iterative regression based hybrid localization for wireless sensor networks[J]. Sensors, 2021, 21(1):257) Two types of localization technologies. Range-independent localization algorithms collect necessary information through multi-hop communication between nodes. This type of method has no special requirements for node hardware. Compared with range-based schemes, it is less affected by environmental factors and has significant advantages in terms of cost and power consumption.
[0003] The DV-Hop localization algorithm is widely welcomed by scholars and enterprises due to its simple implementation, strong robustness, and applicability to both large and small networks. (See reference: Zhou Kai, Zhou Peizhao, Fu Wenhan, Wei Shengfei. Research on Improved DV-hop Localization Algorithm for Wireless Sensor Networks [J]. Journal of Northeast Normal University (Natural Science Edition), 2021, 53(04):137-143.) Due to the uneven distribution of nodes and the irregular shape of regions, sensor networks generally exhibit complex topologies. Traditional DV-Hop suffers from low localization accuracy and instability in various complex network structures. The localization error of traditional DV-Hop mainly stems from the average hop distance estimation method and the least squares method. It is difficult to obtain the true hop distance, especially when the network is anisotropic, the calculated distance from the unknown node to the anchor node will produce a large error. The least squares method is very sensitive to distance errors when estimating coordinates. To address the above shortcomings of DV-Hop, existing literature has proposed many improvement measures to obtain more accurate localization. Reference: Yin Lei, Gu De, Liu Fei. DV-Hop localization algorithm based on improved sparrow search algorithm [J]. Journal of Sensor Technology, 2021, 34(05):670-675. The algorithm optimizes the number of hops using dual communication radii, optimizes the average hop distance using weighting factors, and finally estimates the position of unknown nodes using an improved sparrow search algorithm. For example, the existing invention patent document CN113709862A, entitled "A DV-Hop Node Positioning Method Based on Spring Model and Reliable Anchor Nodes," outlines the following steps: calculating the correction coefficient from the target anchor node to the reference anchor node; calculating the angle formed by the reference anchor node, the target anchor node, and the unknown node; analyzing the influence of the correction coefficient from the target anchor node to the reference anchor node on the target path from the perspective of the spring model in physics, selecting a function of the angle as a weight to perform a weighted summation of the correction coefficient of the reference path to obtain the correction coefficient from the unknown node to the target anchor node; correcting the distance between the unknown node and the target anchor node; extracting reliable anchor nodes using the RANSAC algorithm, performing coordinate fitting on the reliable anchor nodes using the least squares method, and selecting the estimated coordinates with the smallest error as the coordinates of the unknown node. For example, the existing invention patent application document CN106332279A, entitled "A DV-Hop Localization Method Based on Inter-Node Connectivity Differences and Particle Swarm Optimization," describes an algorithm that selects the optimal three anchor nodes in the trilateration method to estimate the position of unknown nodes, calibrates the estimated position based on the nearest anchor node, and finally selects the position with the smallest connectivity difference as the estimated position. To further improve localization accuracy, an adaptive particle swarm optimization (PSO)-based DV-Hop algorithm is introduced. This involves improving the velocity and position update formulas in the PSO algorithm, changing the fitness function, and then sorting the particles. Finally, the ICDA DV-Hop algorithm and the MPSO DV-Hop algorithm are combined.The optimization strategies in the aforementioned existing schemes all use weighting factors to reduce the error of the average hop distance. However, during localization, the average hop distance of unknown nodes in the algorithm is replaced by the average hop distance of the nearest anchor node. Since the network characteristics of unknown nodes are not the same as those of the nearest anchor node, the method of using the characteristics of the nearest anchor node to replace unknown nodes has certain limitations. In addition, in some existing technologies that adopt similar localization strategies, there is no clear mathematical model between localization error, hop count, and weights, and this weighting strategy does not have a significant effect on optimizing the average hop distance.
[0004] References: Wu Zhizhou, Zhang Linghua. DV-Hop positioning algorithm based on weighted and RSSI ranging [J]. Data Acquisition and Processing, 2021, 36(06): 1217-1225. In this paper, the jump distance is optimized by using weighted normalization and RSSI technology. Finally, the weighted least squares method is used to estimate the node coordinates. RSSI technology can measure the distance more accurately, but it is easily affected by the environment. References: Wang Lei, Liu Jingjing, Qi Junyan, He Junyi. DV-HOP positioning algorithm based on ranging correction and improved whale optimization [J]. Instrumentation Technology and Sensors, 2022(02): 116-121+126. In this paper, the error between the actual distance and the estimated distance between anchor nodes is used to define the correction factor. The average jump distance is corrected by introducing weights based on the jump number information. Finally, the improved whale algorithm is used to estimate the node coordinates. However, the uneven distribution of nodes and the environment of anisotropic networks are not considered. Reference: Wu Jianfeng, Xu Zhenyu, Jiang Zhen. Research on Improved Particle Swarm Optimization DV-Hop Algorithm in Wireless Sensor Networks [J]. Journal of Sensor Technology, 2022, 35(06): 825-830. In this paper, a threshold is set to divide the region and limit the maximum number of hops. The maximum number of hops is then used to correct the distance. Finally, tabu search is used to improve the particle swarm optimization algorithm to estimate the node position. Although this improves the positioning accuracy in irregular areas, the use of tabu search and particle swarm optimization algorithms greatly increases the algorithm complexity. In the above improvement strategy, when calculating the distance between unknown nodes and anchor nodes in the network, the average hop distance of the unknown node is static. However, the characteristics of anchor nodes in the network are usually not the same, and using a static average hop distance has certain limitations.
[0005] Meanwhile, when calculating the minimum hop count, the traditional algorithm stipulates that the distance between two nodes should not exceed the communication radius R, so the hop value between the two nodes is set to 1. However, the actual distance between two nodes with a hop value of 1 may be any value in the interval (0, R). When calculating the average hop distance and distance, the communication path of the node under test is different from that of the nearest anchor node, which leads to a large error when the node under test uses the average hop distance of the nearest anchor node to calculate the distance to all anchor nodes. When estimating node coordinates, the error accumulates as the number of nodes increases when using the least squares method to estimate the position of unknown nodes, which leads to a decrease in the positioning accuracy of unknown nodes.
[0006] In summary, in the existing technology, the distance calculation error between the node to be measured and all anchor nodes is relatively large, and there is a technical problem of low positioning accuracy of unknown nodes. Summary of the Invention
[0007] The technical problem to be solved by this invention is how to solve the problems of large distance calculation errors between unknown nodes and all anchor nodes and low positioning accuracy of unknown nodes.
[0008] This invention solves the above-mentioned technical problems by employing the following technical solution: A DV-Hop localization method based on dynamic average hop distance and RANSAC optimization includes:
[0009] S1. Set network parameters and RANSAC parameters;
[0010] S2. Using sensor nodes, obtain the position of each anchor node, the minimum number of hops from the node to each anchor node, and the minimum multi-hop path set from the node to each anchor node through a flooding strategy. Calculate the similarity between the anchor node-anchor node path and the path between the node to be tested and the anchor node based on the Hamming distance. Select the average hop distance of the anchor node-anchor node path with the highest similarity as the average hop distance of the node to be tested, and calculate the distance from the node to be tested to each anchor node.
[0011] S3. Calculate the minimum number of samples and set the path offset threshold to T, where the path offset threshold T is the communication radius R.
[0012] S4. Randomly select no less than 3 anchor nodes from all anchor nodes, and estimate the estimated coordinates of the node to be measured using the trilateration method based on the sampled anchor nodes.
[0013] S5. Calculate the distance offset from the estimated coordinates of the node to be tested to the anchor node, and determine whether the distance offset is less than the path offset threshold T, so as to determine and obtain a reliable anchor node from the anchor nodes.
[0014] S6. When the number of reliable anchor nodes is less than the preset number of anchor nodes, record the selected reliable anchor nodes and repeat steps S4 and S5 until the number of reliable anchor nodes is not less than the preset number of anchor nodes, then execute the following step S7.
[0015] S7. Select a reliable anchor node and re-estimate the coordinates of the unknown node;
[0016] S8. Complete all sampling operations, compare the quality of the estimated coordinates of the unknown nodes, and select the coordinates with the smallest error value as the final coordinates of the node to be measured.
[0017] This invention addresses the inaccuracy of traditional DV-Hop's average hop distance estimation for unknown nodes. It proposes a method that utilizes path similarity to select the optimal path for estimating the average hop distance of unknown nodes. The unknown node's distance to different anchor nodes is calculated using dynamic average hop distance, and the RANSAC algorithm is used to select reliable anchor nodes to estimate and optimize the unknown node's coordinates. The improved algorithm, without requiring additional hardware, maintains good positioning accuracy in various complex network topologies.
[0018] In a more specific technical solution, in step S1, the sensor node uses a flooding strategy to transmit data packets to nodes in the pre-set network.
[0019] In a more specific technical solution, the data packet includes: the anchor node's own coordinates and the number of hops between it and other nodes.
[0020] Unlike traditional algorithms, the data packets transmitted in this invention, in addition to the anchor node's own location information, node number, and hop count initialized to zero, also include a shortest path vector (composed of node sequence numbers) in the transmitted data packets. After information flooding, this invention ensures that every node in the network receives the anchor node's data packet.
[0021] In a more specific technical solution, step S2 includes:
[0022] S21. Through the flooding strategy, each sensor node records the minimum number of hops and the shortest multi-hop path set accumulated from the number of nodes passed sequentially from each anchor node.
[0023] S22. Represent the shortest multi-hop path from the node to be tested to the target anchor node as set A, and represent the set of nodes passed through by the shortest multi-hop path from the target anchor node to any other anchor node as set B.
[0024] S23. Determine the length of set A and set B to obtain the smaller set, and pad the smaller set with 0 elements so that set A and set B have the same length.
[0025] S24. Calculate the similarity between set A and set B, where the similarity is determined based on Hamming distance;
[0026] S25. Based on similarity, select the anchor node-target anchor node path with the highest similarity between the unknown node and the target anchor node path, and replace the average jump distance of the unknown node-target anchor node path with its average jump distance.
[0027] S26. The distance from the node to be tested to the anchor node is obtained by processing the average jump distance and the minimum jump value.
[0028] The improved algorithm of this invention selects the anchor node-anchor node path that is most similar to the anchor node-unknown node path when calculating the average hop distance of the node to be tested. The estimated average hop distance of the unknown node changes with the anchor node. Compared with the average hop distance obtained by using the nearest anchor node in the traditional algorithm, it is closer to the average hop distance of the real path and reduces the error of the average hop distance.
[0029] In a more specific technical solution, in step S22, the elements of set A represent the nodes that are passed through in sequence along the path.
[0030] In a more specific technical solution, in step S24, the similarity between set A and set B is calculated using the following logic:
[0031]
[0032] Where hamming(A,B) represents the Hamming distance between set A and set B after processing in step S23, and max{length(A),length(B)} is the total number of nodes in the longest path.
[0033] In a more specific technical solution, step S4 includes:
[0034] S41. Calculate the minimum number of samples;
[0035] S42. During each sampling process in the sampling phase, a preset number of anchor nodes are randomly selected from all anchor nodes to calculate the distance from the node to be tested to the selected anchor nodes, and the coordinates of the unknown node are estimated using the trilateration method.
[0036] In a more specific technical solution, in step S5, the path offset value from the estimated position of the node to be tested to each anchor node is calculated using the following logic, and a reliable anchor node is selected:
[0037]
[0038]
[0039] Where α is the path offset from anchor node i to unknown node u, (x u * y u * ) represents the coordinates of the unknown node estimated in step S42, hop iu HopSize is the minimum number of hops between node i and node u. iu best Let d be the optimal average jump distance from anchor node i to the unknown node u. iu * Let be the distance from anchor node i to the estimated unknown node u.
[0040] In a more specific technical solution, step S8 involves calculating the advantages and disadvantages of estimating the coordinates of the unknown nodes:
[0041]
[0042] Where Na is the number of anchor nodes, and αerror represents the average error between the unknown node and each anchor node.
[0043] This invention uses the RANSAC algorithm to select the anchor node with the least impact on the path deviation value caused by Euclidean distance instead of polyline distance when calculating the distance between the unknown node and the anchor node. At the same time, it uses the deviation value between the unknown node and the anchor node to judge the accuracy of the estimated coordinates, thereby improving the positioning accuracy of the unknown node.
[0044] In more specific technical solutions, DV-Hop positioning systems based on dynamic average hop distance and RANSAC optimization include:
[0045] The parameter setting module is used to set network parameters and RANSAC parameters;
[0046] The unknown node to anchor node distance processing module is used to obtain the position of each anchor node, the minimum number of hops from the node to each anchor node, and the minimum multi-hop path set from the node to each anchor node through a flooding strategy using sensor nodes. It calculates the similarity between the anchor node-anchor node path and the path between the node to be tested and the anchor node based on Hamming distance, selects the average hop distance of the anchor node-anchor node path with the highest similarity as the average hop distance of the node to be tested, and calculates the distance from the node to be tested to each anchor node. The unknown node to anchor node distance processing module is connected to the parameter setting module.
[0047] The sampling count calculation and offset threshold setting module is used to calculate the minimum sampling count and set the path offset threshold to T, where the path offset threshold T is the communication radius R. The sampling count calculation and offset threshold setting module is connected to the unknown node to anchor node distance processing module.
[0048] The unknown node target estimation module is used to randomly select no less than 3 anchor nodes from all anchor nodes, and estimate the estimated coordinates of the node to be measured using the trilateration method based on the sampled anchor nodes. The unknown node target estimation module is connected to the sampling number calculation and offset threshold setting module.
[0049] The reliable anchor node determination and acquisition module is used to calculate the distance offset value from the estimated coordinates of the node to be tested to the anchor node, and determine whether the distance offset value is less than the path offset threshold T, so as to determine and obtain reliable anchor nodes from the anchor nodes. The reliable anchor node determination and acquisition module is connected to the unknown node target estimation module.
[0050] The reliable anchor node cyclic acquisition module is used to record the selected reliable anchor node when the number of reliable anchor nodes is less than the preset number of anchor nodes, and to cyclically acquire reliable anchor nodes until the number of reliable anchor nodes is not less than the preset number of anchor nodes. The reliable anchor node cyclic acquisition module is connected to the reliable anchor node determination and acquisition module.
[0051] The re-estimation module is used to select reliable anchor nodes to re-estimate the coordinates of unknown nodes. The re-estimation module is connected to the reliable anchor node cyclic acquisition module.
[0052] The final coordinate acquisition module is used to complete all sampling operations, compare the quality of the estimated coordinates of unknown nodes, and select the coordinates with the smallest error value as the final coordinates of the node to be measured. The final coordinate acquisition module is connected to the re-estimation module.
[0053] Compared with existing technologies, this invention has the following advantages: Addressing the inaccuracy of average hop distance estimation for unknown nodes in traditional DV-Hop, this invention proposes using path similarity principles to select the optimal path for estimating the average hop distance of unknown nodes. The unknown node uses dynamic average hop distance calculation to determine its distance from different anchor nodes, and the RANSAC algorithm is used to select reliable anchor nodes to estimate and optimize the unknown node's coordinates. The improved algorithm, without adding extra hardware, maintains good positioning accuracy in various complex network topologies.
[0054] Unlike traditional algorithms, this invention, in addition to the anchor node's own location information, node number, and hop count initialized to zero, also incorporates a shortest path vector (composed of node sequence numbers) into the transmitted information packet. After information flooding, each node in the network receives the anchor node's information packet.
[0055] The improved algorithm of this invention selects the anchor node-anchor node path that is most similar to the anchor node-unknown node path when calculating the average hop distance of the node to be tested. The estimated average hop distance of the unknown node changes with the anchor node. Compared with the average hop distance obtained by using the nearest anchor node in the traditional algorithm, it is closer to the average hop distance of the real path and reduces the error of the average hop distance.
[0056] This invention uses the RANSAC algorithm to select a set of reliable anchor nodes with small distance deviations from the unknown node to calculate the coordinates of the unknown node. Simultaneously, it utilizes the distance deviation between the unknown node and the anchor nodes to determine the accuracy of the estimated coordinates, thereby improving the positioning accuracy of the unknown node. This invention solves the technical problems of large distance calculation errors between the unknown node and all anchor nodes and low positioning accuracy of the unknown node in existing technologies. Attached Figure Description
[0057] Figure 1This is a schematic diagram of the steps for calculating the distance from unknown nodes to each anchor node in the DV-Hop positioning method based on dynamic average hop distance and RANSAC optimization in Embodiment 1 of the present invention.
[0058] Figure 2 This is a schematic diagram of similar path selection in Embodiment 1 of the present invention;
[0059] Figure 3 This is a schematic diagram illustrating the steps of estimating the coordinates of unknown nodes using the RANSAC algorithm in Embodiment 1 of the present invention;
[0060] Figure 4 This is a schematic diagram of the distance deviation value in Embodiment 1 of the present invention.
[0061] Figure 5 This is a schematic diagram of the improved algorithm steps in Embodiment 1 of the present invention;
[0062] Figure 6 This is a flowchart of the HRDV-Hop algorithm in Embodiment 1 of the present invention;
[0063] Figure 7a This is a schematic diagram of the O-type node topology in Embodiment 2 of the present invention;
[0064] Figure 7b This is a schematic diagram of the C-type node topology in Embodiment 2 of the present invention;
[0065] Figure 7c This is a schematic diagram of the X-type node topology in Embodiment 2 of the present invention;
[0066] Figure 8a This is a schematic diagram illustrating the distance error analysis from the unknown node to the anchor node in the O-type topology structure of Embodiment 2 of the present invention;
[0067] Figure 8b This is a schematic diagram of the distance error analysis from the unknown node to the anchor node in the C-type topology structure of Embodiment 2 of the present invention;
[0068] Figure 8c This is a schematic diagram illustrating the distance error analysis from the unknown node to the anchor node in the X-shaped topology structure of Embodiment 2 of the present invention;
[0069] Figure 9a This is a diagram showing the positioning error analysis of the unknown node in the O-type topology structure of Embodiment 2 of the present invention;
[0070] Figure 9b This is a diagram showing the positioning error analysis of the unknown node in the C-type topology structure of Embodiment 2 of the present invention;
[0071] Figure 9c This is a diagram showing the positioning error analysis of the unknown node in the X-shaped topology structure of Embodiment 2 of the present invention;
[0072] Figure 10a This is a comparison chart of the average node positioning error under different communication radii in the O-type topology of Embodiment 2 of the present invention;
[0073] Figure 10b This is a comparison chart of the average node positioning error under different communication radii in the C-type topology of Embodiment 2 of the present invention;
[0074] Figure 10c This is a comparison chart of the average node positioning error under different communication radii in the X-shaped topology of Embodiment 2 of the present invention;
[0075] Figure 11a This is a comparison chart of the average node positioning error under different anchor node ratios in the O-type topology structure of Embodiment 2 of the present invention;
[0076] Figure 11b This is a comparison chart of the average node positioning error under different anchor node ratios in the C-type topology structure of Embodiment 2 of the present invention;
[0077] Figure 11c This is a comparison chart of the average node positioning error under different anchor node ratios in the X-shaped topology structure of Embodiment 2 of the present invention;
[0078] Figure 12a This is a comparison chart of the average node positioning error under different total number of nodes in the O-type topology structure of Embodiment 2 of the present invention;
[0079] Figure 12b This is a comparison chart of the average node positioning error under different total number of nodes in the C-type topology structure of Embodiment 2 of the present invention;
[0080] Figure 12c This is a comparison chart of the average node positioning error under different total number of nodes in the X-shaped topology structure of Embodiment 2 of the present invention. Detailed Implementation
[0081] To make the objectives, technical solutions, and advantages of the embodiments of the present invention clearer, the technical solutions of the embodiments of the present invention will be clearly and completely described below in conjunction with the embodiments of the present invention. Obviously, the described embodiments are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of the present invention.
[0082] Example 1
[0083] 1. Relevant Theories
[0084] 1.1 DV-Hop Positioning Algorithm
[0085] The execution process of the traditional DV-Hop localization algorithm can be divided into the following three stages, please refer to the literature: Mehrabi M, Taheri H, Taghdiri P. An improved DV-Hop localization algorithm based onevolutionary algorithms[J]:
[0086] The first phase involves obtaining the minimum hop count through flooding. In this phase, the anchor node sends data packets to the network using a flooding strategy. These packets contain the anchor node's coordinates and the hop count (initialized to 0) between it and other nodes. Neighboring nodes, upon receiving packets from the anchor node, check if they already have the anchor node's information stored. If not, they add the anchor node's information to their own table, increment the hop count by 1, and forward the packet. Otherwise, they compare the hop count in their table with the hop count in the data packet, update their table with the smaller hop count, increment the hop count by 1, and forward the packet. Flooding ensures that all nodes in the network record the anchor node's information and the minimum hop count between it and other nodes in their tables.
[0087] The second stage involves calculating the average jump distance and the total distance. Using an unbiased estimation method, the average jump distance of an anchor node is calculated from the Euclidean distance between the anchor node and other anchor nodes, along with the number of jumps between them, as shown in the following formula:
[0088]
[0089] Where ||·|| represents the Euclidean distance between two nodes, S ANi and S ANj Let hop be the coordinates of anchor nodes i and j. ij This represents the minimum number of hops between anchor nodes.
[0090] Next, the anchor node broadcasts its average hop distance to the other nodes. To ensure that the average hop distance of an unknown node is the same as that of the nearest anchor node, the unknown node uses the average hop distance of the first anchor node it receives as its own average hop distance. The distance between nodes is estimated by multiplying the average hop distance of the unknown node and the minimum hop distance to the anchor node. The distance calculation formula is as follows:
[0091] d ui =HopSize u ·hop ui (2)
[0092] Among them, HopSize u hop represents the average hop distance of the unknown node u. ui d represents the minimum number of hops between the unknown node u and the anchor node i. ui This represents the distance between the unknown node u and the anchor node i.
[0093] The third stage involves estimating the location of the unknown node. The distance from the unknown node to the anchor node is obtained through steps 1 and 2, and the coordinates of the unknown node are estimated using the least squares method.
[0094] 1.2 DV-Hop Positioning Error Analysis
[0095] The positioning error of DV-Hop mainly has three aspects:
[0096] (1) When calculating the minimum number of hops, the traditional algorithm stipulates that the distance between two nodes is no greater than the communication radius R, so the hop value between the two nodes is set to 1. However, the actual distance between two nodes with a hop value of 1 may be any value in the interval (0, R).
[0097] (2) When calculating the average jump distance and distance, the communication path of the node under test is different from that of the nearest anchor node, which causes a large error when the node under test uses the average jump distance of the nearest anchor node to calculate the distance to all anchor nodes.
[0098] (3) When estimating node coordinates, the error accumulates as the number of nodes increases when using the least squares method to estimate the position of unknown nodes, which leads to a decrease in the positioning accuracy of unknown nodes.
[0099] 1.3 RANSAC Algorithm
[0100] The Random Sampling Consensus (RANSAC) algorithm is an iterative method for estimating mathematical model parameters from a set of observation data containing outliers. Please refer to the literature: Chen TF, Hou SX, and Sun L J. An Enhanced DV-HopPositioning Scheme Based on Spring Model and Reliable Beacon Node Set[J]. Computer Networks, 2022, 209:108926. Therefore, the RANSAC algorithm can effectively distinguish some anchor nodes with large distance errors, which is beneficial to improving positioning accuracy. The specific steps are as follows: First, estimate the model parameters by randomly selecting data from the dataset. Then, fit the estimated model using other data in the dataset. If the error is less than the threshold, it is recorded as normal data; otherwise, it is outlier data. Repeat the above process until the minimum number of samples is reached and the iteration stops. The minimum number of samples is obtained by formula (3). And select the model with the most normal data as the model for the entire dataset.
[0101]
[0102] Where p is the confidence level, w is the data anomaly rate, m is the minimum sample set, and k is the minimum number of samples.
[0103] 2. Improved Algorithm of the Invention
[0104] 2.1 Calculation of distance using dynamic average jump distance
[0105] The prerequisite for calculating the distance between the node to be tested and the anchor node is to determine the average hop distance of the node to be tested, and then estimate the distance using the average hop distance and the number of hops between nodes. The improved algorithm, when calculating the average hop distance of the node to be tested, selects the anchor node-anchor node path most similar to the anchor node-unknown node path for estimating the average hop distance. The estimated average hop distance of the unknown node changes with the anchor node, which is closer to the average hop distance of the actual path than the traditional algorithm that uses the nearest anchor node, greatly reducing the error of the average hop distance. This invention uses Hamming distance to estimate the similarity between paths; the number of different bit values between two codewords is called the Hamming distance. The smaller the Hamming distance, the more similar the two sets are.
[0106] like Figure 1 As shown, in this embodiment, the specific steps for calculating the distance from the unknown node to each anchor node include:
[0107] S1. Through the flooding strategy, each node records the minimum number of hops and the shortest multi-hop path set accumulated from the number of nodes passed sequentially from each anchor node.
[0108] S2. Represent the shortest multi-hop path from the unknown node to the target anchor node as a set A, whose elements are the nodes passed through in sequence along the path. Represent the set of nodes passed through in the shortest multi-hop path from the target anchor node to any of the other anchor nodes as set B.
[0109] S3. Determine the length of set A and set B, and pad the shorter set with zero elements so that set A and set B have the same length.
[0110] S4. Calculate the similarity between set A and set B. The similarity between paths is determined by Hamming distance.
[0111] In this embodiment, the path similarity sim is calculated as shown in equation (4):
[0112]
[0113] Where hamming(A,B) represents the Hamming distance between the unknown node-target anchor node path (set A) and the target anchor node-other anchor node path (set B) after processing in step S3. max{length(A),length(B)} is the total number of nodes in the longest path.
[0114] S5. Based on the similarity of each path obtained in step S4, select the anchor node-target anchor node path with the highest similarity to the unknown node-target anchor node and replace the average jump distance of the unknown node-target anchor node path with its average jump distance.
[0115] S6. Calculate the distance from the unknown node to the anchor node based on the average jump distance and the minimum jump value.
[0116] To better illustrate the process of estimating the average jump distance between unknown nodes and anchor nodes using Hamming distance, a specific calculation example is given below.
[0117] In this embodiment, as Figure 2 The diagram shows a multi-hop path segment between an unknown node and an anchor node. A1 to A5 are anchor nodes, and u1 to u7 are unknown nodes. The average hop distance from the unknown node u1 to the anchor node A1 is calculated using the steps outlined above. First, the shortest path from A1 to u1 is recorded as a set Vu = {A1 u7 u6 A2 u3 u2 u1}. The shortest path from A1 to A2 is represented as V1 = {A1 u7 u6 A2}, the shortest path from A1 to A3 as V2 = {A1 u7 u6 A2 u3 u4 u5 A3}, the shortest path from A1 to A4 as V3 = {A1 u7 u6 A2 u3 u2 A4}, and the shortest path from A1 to A5 as V4 = {A1 u7 u6 A2 u3 u2 u1 A5}.
[0118] Based on the path similarity calculation steps, the Hamming distance between path sets Vu and V1 is 3, and the similarity is 0.571; the Hamming distance between path sets Vu and V2 is 3, and the similarity is 0.625; the Hamming distance between path sets Vu and V3 is 1, and the similarity is 0.857; and the Hamming distance between path sets Vu and V4 is 1, and the similarity is 0.875.
[0119] Calculations show that the paths Vu and V4 have the highest similarity. Therefore, the average hop distance calculated from anchor node A1 to anchor node A5 is chosen as the average hop distance from unknown node u1 to anchor node A1. Then, the distance from u1 to A1 is calculated based on the number of hops from u1 to A1. Similarly, the distances from unknown nodes to each anchor node can be calculated.
[0120] 2.2 RANSAC Algorithm for Estimating Unknown Node Locations
[0121] The distance between anchor nodes, calculated using coordinates, is Euclidean distance. However, in the traditional DV-Hop algorithm, the distance between nodes is a broken line distance obtained by multiplying the hop count and the average hop distance. Therefore, the distance estimated by the algorithm between unknown nodes and anchor nodes usually deviates from the true distance between nodes. If anchor nodes with large deviations participate in node localization, it will increase the localization error of unknown nodes. Therefore, selecting reliable anchor nodes with small relative distance deviations from unknown nodes for localization, rather than using all anchor nodes, is crucial. The RANSAC algorithm can select better data for model parameter estimation based on a threshold and has a certain tolerance for noise. Therefore, using the RANSAC algorithm to select anchor nodes with the smallest path deviation impact for unknown node localization, while using the distance deviation between unknown nodes and anchor nodes to judge the accuracy of estimated coordinates, can improve the localization accuracy of unknown nodes.
[0122] like Figure 3 As shown, in this embodiment, the specific steps for estimating the coordinates of unknown nodes using the RANSAC algorithm are as follows:
[0123] S1' Calculate the minimum number of samples. In this embodiment, during the initialization phase, the values of confidence level, data anomaly rate, and minimum sample set are set, and the minimum number of samples is calculated according to equation (3).
[0124] S2', Sampling Stage. In this embodiment, during each sampling, three anchor nodes are randomly selected from all anchor nodes. The distance from the node to be measured to the selected anchor nodes is calculated according to Section 2.2, and the coordinates of the unknown node are estimated using the trilateration method.
[0125] S3' Select a reliable anchor node. In this embodiment, since the true coordinates of the node to be tested cannot be obtained, the distance from the estimated coordinates of the node to be tested to the target anchor node is compared with the path distance of the node to be tested calculated from the number of hops and the average hop distance. The deviation of the distance is approximately regarded as the deviation between the estimated coordinates of the node to be tested and the true coordinates. The distance deviation from the estimated position of the unknown node to each anchor node is calculated by equation (6).
[0126]
[0127]
[0128] Where α is the distance deviation from anchor node i to unknown node u, (x u * y u * ) represents the coordinates of the unknown node estimated in step 2, hop iu HopSize is the minimum number of hops between node i and node u. iubest Let d be the optimal average jump distance from anchor node i to the unknown node u. iu * Let be the distance from anchor node i to the estimated unknown node u.
[0129] like Figure 4 As shown, in this embodiment, u8 is the unknown node to be measured, A8 is the target anchor node, and A6 and A7 are anchor nodes. The path A8-A6 is found to be most similar to the path A8-u8 through path similarity calculation. However, using the average jump distance of paths A6 and A8 to calculate the distance from u8 to A8 will result in a large error. The distance deviation value is the error between the distance from the estimated coordinates of the node to the anchor node and the distance between the nodes calculated using formula (6). The path offset threshold is set to T. When the difference in distance deviation values is greater than the threshold, it indicates that this anchor node will cause a large positioning error when participating in the estimation of the coordinates of the node to be measured. Therefore, it is considered an invalid anchor node and does not participate in the estimation of the position of the node to be measured; otherwise, it is considered a reliable anchor node.
[0130] S4' Calculate the number of reliable anchor nodes. In this embodiment, it is determined whether the number of valid anchor nodes collected in step 3 is less than 3. If it is less, the reliable anchor nodes are recorded, and the process returns to step 2 to sample again among the remaining anchor nodes to find reliable anchor nodes, until the accumulated number of reliable anchor nodes is not less than 3.
[0131] S5', Unknown Node Location Stage. In this embodiment, the coordinates of the unknown node are determined only by the reliable anchor nodes selected in step 4, rather than all anchor nodes participating in the location. Then, the quality of the estimated coordinates of the unknown node is calculated using equation (7). The larger the αerror, the greater the error in the path from the estimated unknown node coordinates to each anchor node.
[0132]
[0133] Where Na is the number of anchor nodes, and αerror represents the average error between the unknown node and each anchor node.
[0134] S6' Determine the final position of the unknown node. In this embodiment, after all sampling is completed, the quality of the unknown node coordinates obtained from each sampling is compared, and the coordinates with the smallest error are selected as the final coordinates of the unknown node.
[0135] 2.4 HRDV-Hop Algorithm Flow
[0136] This invention proposes a similar path retrieval algorithm to reduce the distance deviation between unknown nodes and anchor nodes. The RANSAC algorithm can be used to further select reliable anchor nodes with higher distance accuracy. In some complex network topologies, the HRDV-Hop algorithm significantly improves positioning accuracy compared to the traditional DV-hop algorithm.
[0137] like Figure 5 As shown, the improved algorithm steps in the DV-Hop localization method based on dynamic average hop distance and RANSAC optimization provided by this invention include:
[0138] S101. Set network parameters and RANSAC parameters. All sensor nodes obtain the location of each anchor node, the minimum number of hops from each node to each anchor node, and the minimum multi-hop path set from each node to each anchor node through the flooding strategy.
[0139] S102. Calculate the similarity between the anchor node-anchor node path and the node to be tested-anchor node path based on the Hamming distance. Select the average hop distance of the most similar anchor node-anchor node path as the average hop distance of the node to be tested, and calculate the distance from the node to be tested to each anchor node.
[0140] S103. Calculate the minimum number of samplings according to formula (4) and set the path offset threshold to T, where T is the communication radius R.
[0141] S104. Randomly select 3 anchor nodes from all anchor nodes, and estimate the coordinates of the node to be measured based on the sampled 3 anchor nodes and the trilateration method.
[0142] S105. Calculate the offset value from the estimated coordinates of the node to be tested to the anchor node according to formula (6), and determine whether the offset value is less than the threshold T. If it is less than the threshold T, it is located as a reliable anchor node; otherwise, it is not.
[0143] S106. If the number of reliable anchor nodes is less than 3, record the selected reliable anchor nodes and repeat steps S104 to S105 until the number of reliable anchor nodes is not less than 3 and then proceed to the next step.
[0144] S107. Re-estimate the coordinates of the unknown node using reliable anchor nodes.
[0145] S108. After all sampling is completed, compare the quality of the estimated coordinates of the node to be tested according to formula (7), and select the coordinate with the smallest error value as the final coordinate of the node to be tested.
[0146] like Figure 6 As shown, the HRDV-Hop algorithm process includes the following specific steps:
[0147] S101', anchor node broadcast information, calculate the hop distance and path set between nodes;
[0148] S102' Optimize the average jump distance by calculating the similarity between node paths using Hamming distance;
[0149] S103' Calculate the minimum number of samplings k using equation (3) and set the path offset threshold R;
[0150] S104' Determine whether the minimum number of samples k has been reached;
[0151] S105', if so, then compare the quality of the estimated coordinates after each sampling according to formula (7);
[0152] S106' Select the optimal estimated coordinates as the coordinates of the unknown node;
[0153] S107' If not, then randomly select three anchor nodes to estimate the coordinates of the unknown node;
[0154] S108', Calculate the estimated offset value from the anchor node using equation (6);
[0155] S109' Determine if the offset value is greater than the threshold T;
[0156] S110' If so, then the anchor node is set to a useless anchor;
[0157] S111' If not, set the anchor node as a reliable anchor node;
[0158] S112' Calculate the number of reliable anchor nodes;
[0159] S113' Determine if the number of anchor nodes is less than 3;
[0160] S114' If yes, then record the reliable anchor node and resample, then proceed to step S107'.
[0161] S115' If not, then re-estimate the node coordinates using reliable anchor nodes;
[0162] S116', Increment the sampling count by 1, then proceed to step S104'.
[0163] Example 2
[0164] 3. Experimental Simulation and Analysis
[0165] 3.1 Experimental Parameters and Environment
[0166] To verify the performance of the proposed improved algorithm, simulation experiments were conducted on MATLAB R2021a. Anchor nodes and unknown nodes were randomly distributed in the network, and the communication distances of the sensor nodes were the same. The network parameters and relevant parameters of the RANSAC algorithm are shown in Table 1. All experimental results are based on the average of 100 simulation experiments, and the parameters remain unchanged in each repeated experiment. Compared with ordinary network topologies, complex network topologies contain some special regions where sensor node deployment is not allowed.
[0167] like Figure 7a , Figure 7b and Figure 7c As shown, this embodiment studies three typical network topologies (O-type, C-type, and X-type). Red represents anchor nodes, black represents unknown nodes, the total number of nodes is 100, the node communication radius is fixed at 30m, and the anchor node ratio is 20%. To comprehensively evaluate the positioning capability of the proposed algorithm, this invention tests five aspects: the accuracy of optimizing the distance from unknown nodes to anchor nodes using Hamming distance under O-type, C-type, and X-type topologies; the accuracy of optimizing the coordinate estimation of unknown nodes using the RANSAC algorithm; and the positioning accuracy of unknown nodes under O-type, C-type, and X-type topologies with different communication radii, anchor node ratios, and total number of nodes. The distance error from unknown nodes to anchor nodes and the positioning error of unknown nodes are calculated as follows.
[0168] (1) The distance error from the unknown node to each anchor node is calculated by equation (8).
[0169]
[0170] Among them, HopSize iu best d is the optimal average jump distance of the path between anchor node i and unknown node u. ui Let hop be the true distance from unknown node u to anchor node i. iu Let d be the hop count between the unknown node u and the anchor node, Na be the number of anchor nodes in the network, and d be the hop count between the unknown node u and the anchor node. iu _error represents the distance error between the unknown node u and the anchor node i.
[0171] (2) The unknown node positioning error is calculated by equation (10).
[0172]
[0173]
[0174] Among them, error u The positioning error of unknown node u, where ALE represents the average positioning error of unknown node u, ||·|| represents the Euclidean distance between the two nodes, and UN represents the positioning error of unknown node u. u * UN represents the estimated coordinates of the unknown node u. u Represents the true coordinates of the unknown node u, R is the node communication radius, and Nu is the number of unknown nodes.
[0175] Table 1 Experimental parameters
[0176]
[0177]
[0178] 3.2 Distance Error Analysis from Unknown Nodes to Anchor Nodes
[0179] To verify the accuracy of the improved algorithm in using Hamming distance to select the anchor node-target anchor node path most similar to the unknown node-target anchor node path for calculating the average hop distance of the unknown node, comparative experiments were conducted in O-type, C-type, and X-type topologies, with a total of 100 nodes, 20 anchor nodes, and a communication radius of 30m. The proposed scheme of this invention was compared with the traditional DV-Hop algorithm, the improved DV-Hop positioning algorithm based on the improved sparrow search algorithm [J]. Journal of Sensor Technology, 2021, 34(05):670-675, and the improved DV-Hop algorithm proposed in the literature
[10] . For ease of description, the improved algorithm proposed in the literature
[10] is represented as ISSADV, and the improved algorithm proposed in the literature
[10] is represented as WOADV. WOADV constructs a distance error cost function and uses unbiased estimation to correct the hop distance, but does not optimize the number of hops; ISSADV optimizes the number of hops using dual communication radii, and optimizes the average hop distance by using the minimum mean square error criterion and assigning different weights to the normalized weighting factors according to the size of the hop values between nodes. Figure 5 It is the distance error distribution from the unknown node to the anchor node obtained by various positioning algorithms under 100 independent simulations. The error calculation formula is shown in Equation (8).
[0180] like Figure 8a , Figure 8b and Figure 8c As shown, in this embodiment, WOADV and ISSADV are slightly better than traditional DV-Hop. The weighted method can improve the accuracy of the average jump distance to a certain extent. However, the average jump distance of the unknown node is constant. Due to the differences in the paths, errors are caused when calculating the distance between the unknown node and different anchor nodes, which affects the positioning accuracy of the unknown node.
[0181] from Figure 8a , Figure 8b and Figure 8cIt can be seen that the improved algorithm proposed in this invention outperforms the other three algorithms in both minimum error and average error. Table 2 shows that HRDV-Hop reduces the distance error from the unknown node to the anchor node by 19.85%, 13.62%, and 9.47% compared to DV-Hop, WOADV, and ISSADV, respectively, under an O-type topology; by 20.00%, 13.13%, and 10.65% under a C-type topology; and by 21.20%, 14.10%, and 10.91% under an X-type topology.
[0182] Table 2 Distance errors from unknown nodes to each anchor node
[0183]
[0184]
[0185] 3.2 Positioning Error Analysis of Unknown Nodes
[0186] To verify the accuracy of the improved algorithm in selecting reliable anchor nodes to calculate the coordinates of unknown nodes using the RANSAC algorithm, we denote the method of estimating the coordinates of unknown nodes using only the third step of the RANSAC algorithm as RANSAC-DV, and compare it with the traditional DV-Hop to verify the performance of the improved algorithm. Using the RANSAC algorithm can effectively distinguish anchor nodes with large distance errors due to inaccurate hop counts and average hop distances between nodes. Finally, by comparing the coordinates of the unknown nodes estimated in each sampling, the optimal coordinates are selected as the final coordinates of the unknown nodes, which helps improve positioning accuracy.
[0187] like Figure 9a , Figure 9b and Figure 9c As shown, in this embodiment, the DV-Hop optimized using the RANSAC algorithm reduces the unknown node localization error by 21.89%, 23.23%, and 20.31% respectively compared to the traditional DV-Hop in O-type, C-type, and X-type network topologies.
[0188] 3.3 Location error of unknown nodes under different communication radii
[0189] To test the positioning accuracy of unknown nodes under different communication radii, the total number of nodes was fixed at 100, the anchor node ratio was fixed at 20%, but the node communication radius was varied from 20m to 50m.
[0190] like Figure 10a , Figure 10b and Figure 10cAs shown in this embodiment, the proposed improved algorithm exhibits significantly lower positioning errors under different topologies compared to other algorithms, and its positioning performance improves significantly with increasing communication radius. Since the distance between nodes and hop count no longer have a linear relationship in complex network topologies, and the error of using Euclidean distance instead of broken-line distance also increases, this error is mitigated to some extent with increasing communication radius. When using Hamming distance to select anchor node pairs similar to the path of the unknown node, as the communication radius increases to a certain extent, the number of nodes along the path decreases, leading to a reduction in the number of paths participating in path similarity calculation, thus affecting the positioning accuracy of the unknown node. Experimental results show that the proposed HRDV-Hop algorithm reduces node localization errors by 32.98%, 18.92%, and 11.92% respectively on O-type topology; by 33.93%, 19.97%, and 13.60% respectively on C-type topology; and by 32.89%, 22.31%, and 12.92% respectively on X-type topology.
[0191] 3.4 Unknown node positioning error under different anchor node proportions
[0192] To test the positioning accuracy of unknown nodes under different anchor node ratios, the total number of nodes was fixed at 100, the node communication radius was fixed at 20m, but the anchor node ratio varied from 10% to 40%.
[0193] like Figure 11a , Figure 11b and Figure 11cAs shown in this embodiment, the positioning error of each algorithm gradually decreases with the increase of the anchor node ratio under three different network topologies. This is because as the anchor node ratio increases, the number of anchor nodes near the unknown node increases, the number of hops from the anchor node to the unknown node decreases, and the estimated distance between the anchor node and the unknown node decreases accordingly due to the accumulation of errors from multiple hops. With the increase of the number of anchor nodes, the HRDV-Hop algorithm has more paths between anchor node pairs, making it easier to find anchor node pairs with high similarity to the path from the unknown node to the anchor node, and the calculated average hop distance is closer to the true average hop distance. The proposed algorithm has lower positioning errors than the other three algorithms under different topologies. The improved algorithm is less affected by network topology and can still achieve high positioning accuracy in complex networks. Experimental results show that the proposed HRDV-Hop algorithm reduces node localization errors by 34.87%, 19.69%, and 10.45% respectively on O-type topology; by 35.12%, 18.91%, and 8.87% respectively on C-type topology; and by 37.53%, 22.68%, and 12.17% respectively on X-type topology.
[0194] 3.5 Location error of unknown nodes under different total number of nodes
[0195] To test the positioning accuracy of unknown nodes under different total number of nodes, the node communication radius was fixed at 20m, the anchor node ratio was fixed at 20%, but the total number of nodes changed from 100 to 300.
[0196] Simulation results are as follows Figure 12a , Figure 12b and Figure 12c As shown, under three different network topologies, the proposed HRDV-Hop localization algorithm achieves higher localization accuracy than the other three algorithms. With the increase in the number of nodes and network density, the similarity between the paths of the searched anchor nodes and the paths of unknown nodes and anchor nodes increases. This results in unknown nodes having more accurate average hop distances, more accurate distance estimation from unknown nodes to anchor nodes, and thus smaller errors in the estimated coordinates of unknown nodes.
[0197] 3.6 Complexity Analysis of Localization Algorithms
[0198] Node energy consumption is one of the essential indicators in WSN, and it is closely related to the complexity of the localization algorithm. Assuming that the total number of nodes in the network is n, the number of unknown nodes is m, the number of iterations of the improved algorithm and the comparison algorithm is G, and the population size is N, low-order terms are omitted. The improved DV-Hop algorithm proposed in the literature Mehrabi M, Taheri H, Taghdiri P. An improved DV-Hop localization algorithm based on evolutionary algorithms[J]. Telecommunication Systems, 2017, 64(4):639-647 is denoted as CPDV-Hop. Table 3 shows the time complexity of different algorithms in each stage. The time complexity of the text improvement algorithm in the second stage using path similarity to estimate the average hop distance is O(n) + n*O(f), where O(f) represents the time complexity of comparing the path similarity between a pair of nodes, making the time complexity slightly higher than DV-Hop and ISSADV, but not much different from the time complexity of optimizing the second stage using the hop number weighting factor and the square cost function. The algorithm's time complexity for estimating node coordinates in the third stage is O(m*G), which is better than the time complexity of using the intelligent optimization algorithm. Overall, the improved algorithm of this invention achieves higher positioning accuracy than other improved algorithms while maintaining a similar time complexity.
[0199] Table 3 Time Complexity of Different Algorithms
[0200]
[0201] The improved method proposed in this invention does not require additional hardware; it significantly improves the positioning accuracy of traditional DV-Hop in complex topology networks by only increasing the storage space for data packets sent by some nodes. First, Hamming distance is used to find the anchor node pair path most similar to the path from the unknown node to the anchor node to calculate the average hop distance of the unknown node. Compared to the traditional DV-Hop algorithm, the average hop distance of the unknown node changes from static to dynamic. Then, the RANSAC algorithm is used to select reliable anchor node pairs to estimate the coordinates of the unknown node. Finally, the coordinates of the unknown node estimated after each sampling are compared to select the coordinates of the unknown node with the smallest error. Simulation results demonstrate that the improved algorithm has strong positioning accuracy for O-type, C-type, and X-type networks.
[0202] This invention addresses the inaccuracy of traditional DV-Hop's average hop distance estimation for unknown nodes. It proposes a method that utilizes path similarity to select the optimal path for estimating the average hop distance of unknown nodes. The unknown node's distance to different anchor nodes is calculated using dynamic average hop distance, and the RANSAC algorithm is used to select reliable anchor nodes to estimate and optimize the unknown node's coordinates. The improved algorithm, without requiring additional hardware, maintains good positioning accuracy in various complex network topologies.
[0203] Unlike traditional algorithms, this invention, in addition to the anchor node's own location information, node number, and hop count initialized to zero, also incorporates a shortest path vector (composed of node sequence numbers) into the transmitted information packet. After information flooding, each node in the network receives the anchor node's information packet.
[0204] The improved algorithm of this invention selects the anchor node-anchor node path that is most similar to the anchor node-unknown node path when calculating the average hop distance of the node to be tested. The estimated average hop distance of the unknown node changes with the anchor node. Compared with the average hop distance obtained by using the nearest anchor node in the traditional algorithm, it is closer to the average hop distance of the real path and reduces the error of the average hop distance.
[0205] This invention uses the RANSAC algorithm to select a set of reliable anchor nodes with small distance deviations from the unknown node to calculate the coordinates of the unknown node. Simultaneously, it utilizes the distance deviation between the unknown node and the anchor nodes to determine the accuracy of the estimated coordinates, thereby improving the positioning accuracy of the unknown node. This invention solves the technical problems of large distance calculation errors between the unknown node and all anchor nodes and reduced positioning accuracy of the unknown node in existing technologies.
Claims
1. A DV-Hop localization method based on dynamic average hop distance and RANSAC optimization, characterized in that, The method includes: S1. Set network parameters and RANSAC parameters; S2. Using sensor nodes, a flooding strategy is used to obtain the position of each anchor node, the minimum number of hops from the node to each anchor node, and the minimum multi-hop path set from the node to each anchor node. The similarity between the anchor node-anchor node path and the node-anchor node path to be tested is calculated based on the Hamming distance. The average hop distance of the anchor node-anchor node path with the highest similarity is selected as the average hop distance of the node to be tested, and the distance from the node to be tested to each anchor node is calculated. S3. Calculate the minimum number of samplings and set the path offset threshold to T, where the path offset threshold T is the communication radius R; S4. Randomly select no less than 3 anchor nodes from all the anchor nodes, and estimate the estimated coordinates of the node to be measured using the trilateration method based on the sampled anchor nodes. S5. Calculate the distance offset value from the estimated coordinates of the node to be tested to the anchor node, and determine whether the distance offset value is less than the path offset threshold T, so as to determine and obtain a reliable anchor node from the anchor nodes; In S5, the path offset from the estimated position of the node to be tested to each anchor node is calculated using the following logic, and a reliable anchor node is selected: in, α For anchor nodes i To the node to be tested u The path offset value, ( x u , y u ) represents the coordinates of the node to be measured estimated in step S4, hop iu HopSize is the minimum number of hops between node i and node u. iu best For anchor nodes i To be tested node u The optimal average jump distance. d iu For anchor nodes i To the estimated node to be tested u The distance; S6. When the number of reliable anchor nodes is less than the preset number of anchor nodes, the selected reliable anchor node is recorded, and steps S4 and S5 are executed repeatedly until the number of reliable anchor nodes is not less than the preset number of anchor nodes, then step S7 is executed. S7. Select the reliable anchor node and re-estimate the coordinates of the node to be measured; S8. Complete all sampling operations, compare the quality of the estimated coordinates of the node to be tested, and select the coordinate with the smallest error value as the final coordinate of the node to be tested.
2. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 1, characterized in that, In step S1, the sensor node uses the flooding strategy to transmit data packets to nodes in the preset network.
3. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 2, characterized in that, The data packet includes: the anchor node's own coordinates and the number of hops between it and other nodes.
4. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 1, characterized in that, Step S2 includes: S21. Through the flooding strategy, each node records the minimum number of hops to other anchor nodes, wherein the node includes: the node to be tested and the anchor node; S22. The shortest multi-hop path from the node to be tested to the target anchor node is represented as set A, and the set of nodes traversed by the shortest multi-hop path from the target anchor node to any other anchor node is represented as set B. S23. Determine the length of set A and set B to obtain the smaller set, and pad the smaller set with 0 elements so that set A and set B have the same length; S24. Calculate the similarity between set A and set B, wherein the similarity is determined based on the Hamming distance; S25. Based on the similarity, select the anchor node-target anchor node path with the highest similarity between the node to be tested and the target anchor node path, and replace the average jump distance of the node to be tested-target anchor node path with its average jump distance. S26. The distance from the node to be tested to the anchor node is obtained by processing the average jump distance and the minimum jump value.
5. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 4, characterized in that, In step S22, the elements of set A represent the nodes that are passed through in sequence along the path.
6. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 4, characterized in that, In step S24, the similarity between set A and set B is calculated using the following logic: Where hamming(A,B) represents the Hamming distance between set A and set B after processing in step S23, and max{length(A),length(B)} is the total number of nodes in the longest path.
7. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 1, characterized in that, Step S4 includes: S41. Calculate the minimum number of samples; S42. During each sampling process in the sampling phase, a preset number of anchor nodes are randomly selected from all the anchor nodes to calculate the distance from the node to be tested to the selected anchor nodes, and the coordinates of the node to be tested are estimated using the trilateration method.
8. The DV-Hop localization method based on dynamic average hop distance and RANSAC optimization according to claim 1, characterized in that, In step S8, the quality of the estimated coordinates of the node to be tested is calculated: in, Na Let α be the number of anchor nodes, and let αerror be the mean error between the node to be tested and each anchor node.
9. A DV-Hop positioning system based on dynamic average hop distance and RANSAC optimization, used to execute the DV-Hop positioning method based on dynamic average hop distance and RANSAC optimization as described in any one of claims 1 to 8, characterized in that, The system includes: The parameter setting module is used to set network parameters and RANSAC parameters; The distance processing module from the node to the anchor node is used to obtain the position of each anchor node, the minimum number of hops from the node to each anchor node, and the minimum multi-hop path set from the node to each anchor node through a flooding strategy using sensor nodes. It calculates the similarity between the anchor node-anchor node path and the node to the anchor node path based on Hamming distance, selects the average hop distance of the anchor node-anchor node path with the highest similarity as the average hop distance of the node to the anchor node, and calculates the distance from the node to the anchor node to each anchor node. The distance processing module from the node to the anchor node is connected to the parameter setting module. The sampling count calculation and offset threshold setting module is used to calculate the minimum sampling count and set the path offset threshold to T, wherein the path offset threshold T is the communication radius R, and the sampling count calculation and offset threshold setting module is connected to the distance processing module from the node to the anchor node. The target estimation module for the node to be tested is used to randomly select no less than 3 anchor nodes from all the anchor nodes, and estimate the estimated coordinates of the node to be tested using the trilateration method based on the sampled anchor nodes. The target estimation module for the node to be tested is connected to the sampling number calculation and offset threshold setting module. A reliable anchor node determination and acquisition module is used to calculate the distance offset value from the estimated coordinates of the node to be tested to the anchor node, and determine whether the distance offset value is less than the path offset threshold T, so as to determine and acquire reliable anchor nodes from the anchor nodes. The reliable anchor node determination and acquisition module is connected to the target estimation module of the node to be tested. A reliable anchor node cyclic acquisition module is used to record the selected reliable anchor node when the number of reliable anchor nodes is less than the preset number of anchor nodes, and to cyclically acquire the reliable anchor nodes until the number of reliable anchor nodes is not less than the preset number of anchor nodes. The reliable anchor node cyclic acquisition module is connected to the reliable anchor node determination acquisition module. A re-estimation module is used to select the reliable anchor node to re-estimate the coordinates of the node to be measured. The re-estimation module is connected to the reliable anchor node cyclic acquisition module. The final coordinate acquisition module is used to complete all sampling operations, compare the quality of the estimated coordinates of the node under test, and select the coordinate with the smallest error value as the final coordinate of the node under test. The final coordinate acquisition module is connected to the re-estimation module.
Citation Information
Patent Citations
DV-Hop positioning method based on connectivity difference and particle swarm optimization
CN106332279A
DV-Hop node positioning method based on spring model and reliable anchor nodes
CN113709862A