Inter-node cooperative positioning method in wireless sensor network
Technical Field
The invention belongs to the technical field of wireless sensor networks, and particularly relates to a cooperative positioning method.
Background
With the gradual development of the internet of things, the demands of people for location services in life are increasing, such as logistics management, path searching, advertisement delivery, intelligent home and the like. And the combination of the internet of things and the sensor network (Wireless Sensor Network, WSN) is expected to realize the interconnection of everything and the intercommunication of everything. Among the currently popular WSN positioning systems are bluetooth positioning systems, cellular positioning systems, radio frequency identification positioning systems, and wireless local area network (Wireless Location Area Network, WLAN) positioning systems. The existing WSN positioning technology can meet the requirement of users on positioning in partial scenes, but with the increase of the networking scale and networking density of WSN nodes, the WSN positioning has great challenges on the residual energy and computing power of the WSN nodes. Aiming at the problem, the invention utilizes the residual energy of the nodes in the target area and the geometric relation between the nodes and the nodes with known positions to cluster the WSN nodes, and provides a cooperative positioning method among the nodes in the WSN based on multidimensional scaling (Multidimensional Scaling, MDS), which reduces the energy loss and the calculation cost of the system and ensures the positioning precision.
Disclosure of Invention
The invention aims to provide a cooperative positioning method among nodes in a wireless sensor network, which clusters the unknown nodes by calculating the attribution degree of the unknown nodes about the known nodes at each position, and realizes the acquisition of global coordinates of the unknown nodes at the positions based on the distance between the nodes and the known node positions in the clusters.
The invention relates to a cooperative positioning method between nodes in a wireless sensor network, which comprises the following steps:
step one, in the target area (the side length is L 1 Randomly placing WSN nodes (namely anchor nodes) with known positions of M (M is more than or equal to 1, M is an integer) and WSN nodes (namely nodes to be positioned) with unknown positions of N (N is more than or equal to 1, N is an integer) in the square area of the frame;
step two, recording the residual energy E in the node battery to be positioned i (1 is more than or equal to i is more than or equal to N, i is an integer);
step three, defining each anchor node as a temporary cluster head, which is formed byThe temporary cluster head sends out a broadcast signal, and the received signal strength (Received Signal Strength, RSS) from the jth temporary cluster head (j is an integer which is more than or equal to 1 and less than or equal to M) at the ith node to be positioned is recorded as RSS ji ;
Fourth, utilize the logarithmic propagation model formula RSS ji =RSS 0 -10βlog 10 (d ji d 0 ) Estimating a distance d between an ith node to be located and a jth temporary cluster head ji I.e. wherein ,RSS0 For reference distance d 0 RSS, β is the path attenuation index (in the present invention, let β=2);
step five, calculating the attribution degree P of the ith node to be positioned belonging to the jth cluster ji I.e. wherein ,/>For the remaining energy mean of all nodes to be located, +.>The average value of the estimated distances between the node i to be positioned and all temporary cluster heads is obtained;
step six, clustering the nodes to be positioned according to the attribution degree, and classifying the nodes to be positioned into clusters with the highest attribution degree;
step seven, setting a threshold d c When the mutual distance between two or more temporary cluster heads is smaller than d c When the temporary cluster heads and the nodes to be positioned in the corresponding clusters are classified into the same cluster, and the temporary cluster head with the minimum intra-cluster mean square distance is selected as the cluster head of the cluster; otherwise, there is no mutual distance between two or more temporary cluster heads smaller than d c And when the cluster structure is not changed, selecting the temporary cluster head at the moment as the cluster head of each cluster. The method specifically comprises the following steps:
step seven (one), nodeThe energy consumed in transmitting a message of data length l is expressed as wherein ,ET Loss energy for transmitting unit message, E R Loss energy, epsilon, for receiving unit messages fs Epsilon is the free space loss coefficient mp Is the multipath loss coefficient, d t Is a switching threshold between multipath fading and free space fading (in the present invention, < +.>) D is the transmission distance;
step seven (two), setting a threshold d c When P (P is more than or equal to 2 and P is an integer) is present, the mutual distance between the temporary cluster heads is smaller than d c When the temporary cluster heads and the corresponding P nodes to be positioned in total Q (Q is more than or equal to 1 and Q is an integer) are classified into the same cluster, and the temporary cluster heads b are calculated 1 (1≤b 1 P) and each node a to be positioned 1 (1≤a 1 Euclidean distance d between +.Q) ba The method comprises the steps of carrying out a first treatment on the surface of the Otherwise, there is no mutual distance between two or more temporary cluster heads smaller than d c When the cluster structure is not changed, the temporary cluster heads at the moment are selected as the cluster heads of all clusters;
step seven (three), when two or more temporary cluster heads exist, the mutual distance between the two or more temporary cluster heads is smaller than d c In the time, E is the same as the message length l T and ER Is constant and d is less than or equal to L 1 If d t <L 1 Then d > d t Thereby E (E) l =l(E T +E R )+l×ε mp ×d 4 Can obtain E l Proportional to d 4 And thereby calculate the intra-cluster mean square distance asIf d t ≥L 1 D < d t Thereby E (E) l =l(E T +E R )+l×ε fs ×d 2 Can obtain E l Proportional to d 2 And thus calculate clustersThe inner mean square distance is->Based on the method, a temporary cluster head with the minimum intra-cluster mean square distance is selected as the cluster head of the cluster;
step eight, calculating m by using a logarithmic propagation model formula c (m c ≥1,m c Integer) euclidean distance e between different nodes within a single cluster of nodes ij Obtaining an Euclidean distance matrix E, wherein elements of an ith row and a jth column in the E are E ij ;
Step nine, calculating relative coordinates A of all nodes in a single cluster based on MDS, wherein the relative coordinates of the anchor nodes are P A The relative coordinates of the node to be positioned are G A . The method specifically comprises the following steps:
step nine (one), calculating and />
Step nine (two), constructing an inner product matrix M, wherein the elements of the ith row and the jth column are M ij, wherein ,
step nine (three), decomposing the characteristic value of M to make the maximum two characteristic values be u and v, and their correspondent characteristic vectors are p and q respectively, constructing diagonal matrixEigenvector matrix v= [ p q ]];
Step nine (four), calculate matrix a = { (vΛ) after dimension reduction 1/2 } T Each column in A represents the relative position coordinates of a node, wherein the relative coordinates of the anchor node are P A The relative coordinates of the node to be positioned are G A ;
Step ten, according to the anchorRelative coordinates P of nodes A And global coordinates P B And calculating conversion relations R and T between the relative coordinates of the anchor nodes and the global coordinates. The method specifically comprises the following steps:
step ten (one), making the relative coordinates and global coordinates of the anchor node be respectivelyAndcalculate the centroid of it> and />Wherein r is more than or equal to 1 and less than or equal to b;
step ten (two), calculating covariance matrix
Performing singular value decomposition on H to obtain H=US N, wherein U and N are feature vector matrixes, and S is a singular value matrix;
step ten (four), calculating a rotation relation matrix r=nu between the relative coordinates and the global coordinates T ;
Step ten (five), calculating a translation relation matrix T= -RC between the relative coordinates and the global coordinates A +C B ;
Step eleven, according to R and T, using G A Calculating global coordinates G of nodes to be positioned B G, i.e B =RG A +T。
Advantageous effects
Starting from the residual energy and the position geometric relation of the node to be positioned, firstly, clustering all WSN nodes according to the residual energy of the node to be positioned and the distance from the anchor node; then, estimating the distance between nodes based on RSS in a single cluster, and obtaining the relative coordinates of the nodes by using MDS; and finally, deducing a conversion relation of a coordinate system based on the global coordinates and the relative coordinates of the anchor nodes, and calculating the global coordinates of the nodes to be positioned by using the conversion relation. The invention reduces the complexity of positioning in large-scale WSN networking, and ensures the positioning precision while reducing the energy loss and the calculation cost of the system.
Drawings
FIG. 1 is a flow chart of the present invention;
fig. 2 is a schematic clustering diagram of all WSN nodes in a target area;
FIG. 3 is a graph of the position of real node coordinates versus estimated global coordinates for a 20% range error rate;
fig. 4 is a graph of estimated global coordinate average error versus range error rate.
Detailed description of the preferred embodiments
The invention is further described below with reference to the accompanying drawings:
the method for cooperative positioning between nodes in a wireless sensor network shown in fig. 1 specifically comprises the following steps:
step one, in the target area (the side length is L 1 Randomly placing WSN nodes (namely anchor nodes) with known positions of M (M is more than or equal to 1, M is an integer) and WSN nodes (namely nodes to be positioned) with unknown positions of N (N is more than or equal to 1, N is an integer) in the square area of the frame;
step two, recording the residual energy E in the node battery to be positioned i (1 is more than or equal to i is more than or equal to N, i is an integer);
step three, defining each anchor node as a temporary cluster head, sending a broadcast signal by the temporary cluster head, and recording the RSS from the jth temporary cluster head (j is more than or equal to 1 and less than or equal to M and is an integer) at the ith node to be positioned as the RSS ji ;
Fourth, utilize the logarithmic propagation model formula RSS ji =RSS 0 -10βlog 10 (d ji d 0 ) Estimating a distance d between an ith node to be located and a jth temporary cluster head ji I.e. wherein ,RSS0 For reference distance d 0 RSS, β is the path attenuation index (in the present invention, let β=2);
step five, calculating the attribution degree P of the ith node to be positioned belonging to the jth cluster ji I.e. wherein ,/>For the remaining energy mean of all nodes to be located, +.>The average value of the estimated distances between the node i to be positioned and all temporary cluster heads is obtained;
step six, clustering the nodes to be positioned according to the attribution degree, classifying the nodes to be positioned into clusters with the highest attribution degree, and fig. 2 is a clustering schematic diagram of a target area;
step seven, setting a threshold d c When the mutual distance between two or more temporary cluster heads is smaller than d c When the temporary cluster heads and the nodes to be positioned in the corresponding clusters are classified into the same cluster, and the temporary cluster head with the minimum intra-cluster mean square distance is selected as the cluster head of the cluster; otherwise, there is no mutual distance between two or more temporary cluster heads smaller than d c And when the cluster structure is not changed, selecting the temporary cluster head at the moment as the cluster head of each cluster. The method specifically comprises the following steps:
step seven (one), the energy consumed when the node transmits the message with the data length of l is expressed as wherein ,ET Loss energy for transmitting unit message, E R Loss energy, epsilon, for receiving unit messages fs Epsilon is the free space loss coefficient mp Is the multipath loss coefficient, d t Is a switching threshold between multipath fading and free space fading (in the present invention, < +.>) D is the transmission distance;
step seven (two), setting a threshold d c When P (P is more than or equal to 2 and P is an integer) is present, the mutual distance between the temporary cluster heads is smaller than d c When the temporary cluster heads and the corresponding P nodes to be positioned in total Q (Q is more than or equal to 1 and Q is an integer) are classified into the same cluster, and the temporary cluster heads b are calculated 1 (1≤b 1 P) and each node a to be positioned 1 (1≤a 1 Euclidean distance d between +.Q) ba The method comprises the steps of carrying out a first treatment on the surface of the Otherwise, there is no mutual distance between two or more temporary cluster heads smaller than d c When the cluster structure is not changed, the temporary cluster heads at the moment are selected as the cluster heads of all clusters;
step seven (three), when two or more temporary cluster heads exist, the mutual distance between the two or more temporary cluster heads is smaller than d c In the time, E is the same as the message length l T and ER Is constant and d is less than or equal to L 1 If d t <L 1 Then d > d t Thereby E (E) l =l(E T +E R )+l×ε mp ×d 4 Can obtain E l Proportional to d 4 And thereby calculate the intra-cluster mean square distance asIf d t ≥L 1 D < d t Thereby E (E) l =l(E T +E R )+l×ε fs ×d 2 Can obtain E l Proportional to d 2 And thereby calculates the intra-cluster mean square distance as +.>
Step seven (four), when two or more temporary cluster heads exist, the mutual distance between the two or more temporary cluster heads is smaller than d c When the cluster head is in the same cluster, the temporary cluster head with the minimum intra-cluster mean square distance is selected as the cluster head of the cluster; otherwise, selecting the temporary cluster head at the moment as the cluster head of each cluster;
step eight, utilizing a logarithmic propagation model formula,calculating the content m c (m c ≥1,m c Integer) euclidean distance e between different nodes within a single cluster of nodes ij Obtaining an Euclidean distance matrix E, wherein elements of an ith row and a jth column in the E are E ij ;
Step nine, calculating relative coordinates A of all nodes in a single cluster based on MDS, wherein the relative coordinates of the anchor nodes are P A The relative coordinates of the node to be positioned are G A . The method specifically comprises the following steps:
step nine (one), calculating and />
Step nine (two), constructing an inner product matrix M, wherein the elements of the ith row and the jth column are M ij, wherein ,
step nine (three), decomposing the characteristic value of M to make the maximum two characteristic values be u and v, and their correspondent characteristic vectors are p and q respectively, constructing diagonal matrixEigenvector matrix v= [ pq ]];
Step nine (four), calculate matrix a = { (vΛ) after dimension reduction 1/2 } T Each column in A represents the relative position coordinates of a node, wherein the relative coordinates of the anchor node are P A The relative coordinates of the node to be positioned are G A ;
Tenth, in a single cluster, global position coordinates P based on anchor nodes A And relative position coordinates P B Deriving relative coordinatesTo global coordinates->Coordinate conversion relation of (a). The method specifically comprises the following steps:
step ten (one), making the relative coordinates and global coordinates of the anchor node be respectivelyAndcalculate its correspondence +.> and />Wherein r is more than or equal to 1 and less than or equal to b;
step ten (two), calculating covariance matrix
Performing singular value decomposition on H to obtain H=US N, wherein U and N are feature vector matrixes, and S is a singular value matrix;
step ten (four), calculating a rotation relation matrix r=nu between the relative coordinates and the global coordinates T ;
Step ten (five), calculating a translation relation matrix T= -RC between the relative coordinates and the global coordinates A +C B The simulation results are shown in fig. 3 and 4;
step eleven, according to R and T, using G A Calculating global coordinates G of nodes to be positioned B G, i.e B =RG A +T。