In the practical application of WSN (wireless sensor network), location information of the sensor nodes has become one of the essential information pieces in the whole network. At present, some localization algorithms use intelligent optimization algorithm to optimize the node group directly. Although the overall localization error is reduced, the location deviation of individual unknown nodes will be larger, and the large number of iterations will cause a large energy consumption of nodes. Aiming at the above problems, this paper comes up with a two-stage WSN localization algorithm based on the degree of K-value collinearity (DC-

Localization is to identify the coordinates of something in a geographical environment. The significance of node localization technology in WSN is to deduce the coordinates about the unknown nodes which are located in the network. Due to the continuous development and progress of sensing technology, the use of the WSN (wireless sensor network) is more and more powerful. At present, the application of WSN in transportation, medical and electrical appliance, and other areas of life is wide. WSN deploys a large number of stationary or mobile sensor nodes in the area to be monitored, making these sensor nodes form a network system through radio communication. The purpose is to collaboratively perceive multidimensional information within the monitoring area (such as humidity, temperature, noise, geological characteristics, and life characteristics) and then process and transmit the collected data. When the sensor node is working, firstly, the node sends it, collecting the physical, chemical, biological, and other information to the terminal computer, and then feeds back the information to the user. Finally, the user makes corresponding operations according to the information. In most applications, the information sent back by the node must be combined with the coordinate of the node to make sense. Sometimes, it is even necessary for the node to simply send the location information. In conclusion, sensor node location is the critical technology in sensor networks.

At present, according to whether it is necessary to acquire the angle information or distance information between nodes through physical measurement, sensor node location technology could be divided into two parts that are range-free algorithm and range-based algorithm [

For increasing the location accuracy of range-free location technology, many experts and scholars have studied and improved the DV-hop, which can be divided into two steps. So, the first stage is to estimate the Euclidean distance of beacon nodes to unknown nodes. And the second stage is to infer the coordinates of the unknown nodes from the distance. For raising the accuracy of distance estimation from unknown nodes to beacon nodes, in [

After obtaining the Euclidean distance which is from beacon nodes to unknown node, localization algorithms perform the trilateral measurement or maximum likelihood method to infer the coordinate of unknown sensor nodes. In the process of location estimation, the location topology between beacon sensor nodes and topology shape from beacon nodes to unknown nodes will greatly affect the localization accuracy [

Two beacon nodes in the localization unit are close to each other.

Beacon nodes in localization units are collinear or approximately collinear.

Three beacon nodes in the localization unit are close to each other.

When any two of the three beacon nodes of the localization unit are too close to each other, meanwhile, the unknown sensor node is very far from the two beacon sensor nodes and there will be a large localization error. As is displayed in Figure

When the beacon nodes in the localization unit are collinear or close to collinear, the localization matrix is irreversible, resulting in a large localization error and even leading to the localization failure. From Figure

When the three beacon nodes in the localization unit are very close to each other and the unknown node is very far away from the localization unit, it will cause a large localization error. As shown in Figure

In [

Diagram of DC-

Under this definition, the value range of collinearity is

According to [

Diagram of DC-

In

In a triangle, the value range of the minimum interior angle is

In [

Through the above research, it is not difficult to find that the collinearity localization algorithm based on the minimum height cannot accurately reflect the topological shape of the triangle. When the area of a triangle is also larger, the minimum height of the triangle is larger, but the topological shape may not be closer to an equilateral triangle. As shown in Figure

Schematic diagram of the minimum height contrast of a triangle.

If the topological shape of the three beacon nodes of a localization unit is an equilateral triangle, so, the DC-

At the same time, whether it is DC-

The theory of APIT (approximate point-in-triangulation test) is triangular coverage approximation [

Schematic diagram of APIT algorithm.

Example of APIT algorithm.

In the above error analysis, it is pointed out that although the topological shape of beacon nodes in the localization unit is equilateral triangle or close to equilateral triangle, the Euclidean distance of the three beacon nodes is very close to the unknown sensor node which is very far away from the beacon nodes; it will cause a large localization error. This is a problem that has not been solved in previous research of DC algorithm. In this paper, aiming at the shortcomings and limitations of the existing DC algorithm, we came up with the K-value collinearity based on APIT algorithm; its basic principle is as follows: by executing APIT algorithm, we found the localization unit which could locate the unknown node inside the triangle and meet the K-value condition; then, these beacon nodes are used to locate the unknown node’s coordinate in the localization unit. In this way, the unknown node could be controlled inside the triangle and consists of the three beacon nodes in the localization unit, which not only make full use of the location information of beacon nodes in the WSN, but also avoid the situation described in the error analysis above and make up for the common defects of other DC algorithms.

The calculation method of K-value is as follows:

So, when

Diagram of DC-

Each time the algorithm is executed, an unknown node is located, so the maximum number of the iteration is set as

The steps of wireless sensor node location algorithm based on K-value collinearity are as follows:

Execute the APIT algorithm, enumerate all locating units, and record the localization units in

For the unknown node

At this moment, the unknown node

In

So,

Estimate the Euclidean distance of the unknown node

① Estimate the Euclidean distance of the node

The sensor node

If the estimated distance from

② Preliminary localization of unknown node

Through carrying out the maximum likelihood estimation of (

Transform (

According to the least square method,

Promote node

If the execution time of the localization algorithm is less than

Dealing with boundary nodes, diffuse the beacon nodes in one-hop range of the boundary node by using

The beacon node’s original coordinate is

So far, the localization algorithm of the first stage has been completed.

The Grey Wolf Optimizer (GWO) is a swarm intelligence optimization algorithm. The paper [

The classical DV-hop algorithm uses the least square method to get the solution of (

The coordinates of the unknown sensor nodes in the first stage and the three distances to the beacon nodes of the localization unit constitute such a 5-dimensional vector:

Calculating the fitness function about each individual wolf,

The iterative model is as follows (

After the iteration of step (3) is completed, the five-dimensional solution vector of the

Back to step (2), calculate the fitness value of all individuals again according to (

The experiment was conducted with Windows10 computer operating system, and the simulation experiment was carried out with matlab2016a. Randomly deploy 100 sensor nodes in a 100

Diagram of node distribution.

Under the same communication radius

Average localization error with different beacon node ratio.

As shown in the figure, compared with DV-hop, the localization results accuracy of the other four localization algorithms is higher, especially when the beacon node ratio is more than 20%.

Using the localization method of intelligent optimization algorithm GWO, when beacon sensor node ratio is 10%, the average localization error is more than 50%.

The two-stage GWO algorithm has better localization accuracy than other algorithms and solves the problem that GWO algorithm cannot converge when the beacon node ratio is low. As shown in Figure

Under the same beacon node ratio

Average error with the different communication radius.

As shown in Figure

The DC-

Although GWO algorithm is less affected by the communication radius, the fitness function lacks constraints, resulting in the poor localization accuracy.

With the same beacon node ratio, the two-stage degree of K-value collinearity GWO algorithm integrates the advantages of DC-

In order to increase the localization accuracy of wireless sensor nodes, this paper studies the shortcomings of the existing collinearity algorithm and the disadvantages of intelligent optimization algorithm in WSN localization and proposes a two-stage wireless sensor grey wolf optimization node location algorithm based on K-value collinearity. Based on the APIT algorithm and putting forward the concept of DC-

The DC-

The experimental code used to support the findings of this study is available from the corresponding author upon request.

The authors declare that there are no conflicts of interest regarding the publication of this paper.

This work was supported by the National Natural Science Foundation of China (Grants nos. 61501405 and 61771432) and the Science and Technology Planning Program of Henan Province (no. 202102210398).