Disclosure of Invention
The invention provides a three-dimensional cooperative positioning method of an RSSI (received signal strength indicator) wireless sensor network, aiming at overcoming the defect of insufficient indoor positioning precision in the prior art.
The method comprises the following steps:
s1: carrying out coarse positioning on the unknown node by adopting a WSN coarse positioning algorithm based on a LightGBM model to obtain the coordinates (x, y, z) of the position of the unknown node;
s2: averaging the received signal strength RSSI from different anchor nodes, wherein the calculation formula is as follows:
wherein n is the number of neighbor anchor nodes and RSSIiIs the received signal strength with the ith anchor node;
s2: determining RSSI threshold values in different environmentsthers(ii) a Determining RSSIav≥RSSIthresIf yes, go to S3; if not, go to S7;
s3: judging whether the number of the neighbor anchor nodes is more than or equal to 4, if so, performing S4, and if not, performing S7;
s4: selecting 5 neighbor anchor nodes with the maximum RSSI value of an unknown node to establish a subset (5,4), wherein the subset (5,4) represents a set which takes any 4 anchor nodes in the 5 anchor nodes with the maximum received signal strength as a group;
s5: and (3) positioning the RSSI values from 4 anchor nodes in each set of subset (5,4) by using a quadrilateral centroid positioning algorithm, finally obtaining 5 position estimation values of unknown nodes, and taking the minimum value of the errors among the 5 positions:
wherein, i and j are subset sequence numbers; c. Ci: position estimation obtained from the ith subset; dis (c)i,cj): an error distance between the ith subset position estimate and the jth subset position estimate;
judging whether the E is equal to or less than theta, if so, taking the node meeting the condition as a secondary selection cooperative backbone node; if not, go to S7;
wherein θ is a preset error threshold;
s6: screening secondary selection cooperative backbone nodes according to an anchor node replacement principle, and taking all screened secondary selection cooperative backbone nodes meeting conditions as preferred cooperative backbone nodes;
s7: and determining the final position of the unknown node according to a quadrilateral centroid positioning algorithm.
The technical scheme of the invention is divided into three stages, and the implementation steps are as follows:
(1) and a coarse positioning stage based on a LightGBM model: and (3) carrying out data preprocessing and feature extraction after the RSSI of the received signal strength is acquired by the unknown node to be positioned, and respectively predicting X, Y, Z axis coordinates by using a LightGBM model to obtain a coarse positioning result.
(2) And a cooperative node screening stage based on the precision optimization strategy: setting an RSSI threshold value according to the relation between the signal strength and the ranging error, and quickly selecting a node with higher positioning precision from a large number of unknown nodes; using subset judgment on the selected nodes, and eliminating unstable nodes influenced by the environment to obtain secondary selection cooperative nodes; and finally, screening out nodes meeting the precision requirement as preferred cooperative nodes by using an anchor node replacement principle.
(3) And (3) a cooperative correction stage based on an improved reduced quadrilateral centroid positioning algorithm: and drawing a circle by taking the distance between every two nodes as a radius of the nodes screened according to the precision optimization strategy, wherein a quadrilateral area is formed by the inside coordinates of the intersection point of two adjacent circles, the coordinates of the quadrilateral area are obtained according to the principle of a rotation matrix, and finally, the mass center of the quadrilateral area is calculated and is used as the coordinates of an unknown node as a final corrected positioning result.
Preferably, S1 includes the steps of:
s1.1: deploying a series of beacons S within a Wireless Sensor Network (WSN) location areai(i 1.. k), wherein k is a positive integer, collecting points at different positions in a wireless sensor network positioning area, and measuring the points to each beacon node SiThe RSSI signal intensity of the position point is recorded at the same time to obtain data [ id ]j,RSSI1,...,RSSIk,xj,yj,zj]Where j represents the sample point at the j-th position of the acquisition, j is 1jId serial number of the jth position;
s1.2: after collecting multiple groups of data at each position, processing the data by using a Gaussian filter model, wherein the mean value and variance calculation formula of the Gaussian filter model is as follows:
wherein n is the data volume collected, RSSIiFor the ith RSSI signal value,
s1.3: in order to eliminate the influence of the abnormal point on the model, the filtered data is processed by adopting a local outlier factor detection algorithm, one point of the points at different positions in the wireless sensor network positioning area collected in S1.1 is taken as q, and the local outlier factor of the point q is expressed as follows:
wherein, LOFk(q) is a local outlier factor of the point q, and the larger the LOF value is, the higher the outlier degree of the sample point is, and the more possible the outlier is; n is a radical ofk(q) is the kth distance neighborhood of point q, lrdk(o) is the local achievable density of point o;
s1.4: constructing a feature project based on a data mining method, extracting signal-distance cross features and weighted RSSI signal value features, wherein a point o is a point in a k-th distance neighborhood of a point q;
s1.5: forming three training data sets by using data (dataframe) with 4k + 5-dimensional features and m rows of samples and X, Y, Z-axis label values respectively, and training an X coordinate prediction model X-LightGBM, a Y coordinate prediction model Y-LightGBM and a Z coordinate prediction model Z-LightGBM on the three data sets respectively;
the training is performed by adjusting a series of model parameters such as: the learning rate, the basic parameters of the decision tree, the regularization parameters and the like are adapted to the data, so that the prediction error is continuously reduced.
And traversing different discrete values of each characteristic to calculate splitting gain, finding an optimal splitting point, and splitting by adopting a leaf-wise mode, namely finding a leaf node with the maximum splitting gain from all current leaf nodes every time to split. The split gain is calculated as:
Al={xi∈A:xij≤d},Ar={xi∈A:xij>d},Bl={xi∈B:xij≤d},Br={xi∈B:xij>d}
wherein x
ijIs a sample, d is a split point,
the number of samples reserved for the left sub-node,
number of samples reserved for right child node, B
lSet of small gradient samples reserved for left subnode, B
rSet of small gradient samples, g, reserved for the right child node
iIs a negative gradient; a is a large gradient data sampling ratio, and b is a small gradient data sampling ratio;
s1.6: and (4) processing the information of the unknown node according to the steps S1.2-1.4, and inputting the processed information into the trained X-LightGBM, Y-LightGBM and Z-LightGBM models to obtain the position coordinate (X, Y, Z) of the unknown node.
Preferably, S1.4 comprises:
s1.4.1: extracting relevant statistical characteristics according to the RSSI signal value to comprehensively reflect the trend and the volatility in the data set;
s1.4.2: converting the RSSI signal value into a distance value by using a logarithmic normal distribution signal propagation model, and calculating a corresponding weight value for each beacon node, wherein the calculation formula is as follows:
wherein d isiI-th beacon distance value, d, representing unknown nodemaxThe maximum distance value in all beacon nodes representing unknown nodes;
s1.4.3: and multiplying the RSSI signal value by the distance value and multiplying the RSSI signal value by the weight value to extract a signal-distance cross characteristic and a weighted RSSI signal value characteristic.
Preferably, S6 includes the steps of:
s6.1: let the estimated coordinate of the unknown node N be (x)N,yN,zN) The four beacon nodes participating in positioning are respectively A (x)A,yA,zA)、B(xB,yB,zB)、C(xC,yC,zC)、D(xD,yD,zD);
S6.2: the unknown node N is regarded as a beacon node with a known position and the coordinate is (x)N,yN,zN) Referred to as a translation beacon node; selecting one of the beacons A, B, C, D, and selecting one of the beacon bs as an unknown node;
s6.3: positioning B by using beacon node A, C, D and unknown node N and adopting quadrilateral centroid positioning algorithm to obtain estimated coordinate B' (x)B′,yB′,zB′) And comparing the position with the actual position of the B to calculate an estimation error, wherein the calculation formula is as follows:
s6.4: judging whether epsilon is larger than or equal to delta, if yes, determining that the precision of the unknown node N meets the requirement, and taking the unknown node N as a cooperative node; according to the anchor node replacement principle, all screened unknown nodes meeting the conditions are used as optimal cooperative backbone nodes; if not, the point is not taken as the preferred cooperative backbone node.
The anchor node replacement principle of the invention is that epsilon is less than or equal to delta, which is used for judging whether an unknown node can become an optimal cooperative backbone node, if the condition is met, the optimal backbone node is obtained, and if the condition is not met, the optimal backbone node is still obtained. And then, the cooperative nodes which finally participate in correction are selected from the preferable cooperative backbone nodes, and if the preferable cooperative backbone nodes are not enough, the cooperative nodes are selected from the secondary selected cooperative backbone nodes.
Preferably, S7 is specifically:
s7.1: drawing a circle by taking the distance between every two nodes as a radius of the cooperative nodes screened out from S1-S6, assuming that for an unknown node N, the nodes participating in cooperative correction are A, B, C, D, and the 4 intersection points of the inner circle are respectively E (x)E,yE)、F(xF,yF)、G(xG,yG)、H(xH,yH);
Wherein, the intersection point of the inner circles of A and B is H, the intersection point of the inner circles of B and C is E, the intersection point of the inner circles of C and D is F, and the intersection point of the inner circles of D and A is G;
the coordinate calculation formula of the node N is as follows:
the E, F, G, H coordinate can be obtained by the principle of two-dimensional rotation matrix;
according to the trigonometric function, the following can be known:
(Vector)
after rotating by theta angle to obtain
At this time:
therefore, the coordinates of the G point can be obtained:
s7.2: randomly selecting coordinates of two anchor nodes, determining a straight line from two points to obtain a straight line equation F (x) -kx + b, and substituting the coordinates of the other two anchor nodes into the straight line equation to judge whether the other two cooperative anchor nodes are on the same side or different sides;
s7.3: judging which anchor nodes are adjacent pairwise;
s7.4: and calculating the specific position of the unknown node.
The general steps of the correction stage of the invention are that every two adjacent points in the ABCD are judged firstly, then the coordinates of EFGH are calculated respectively by using the two adjacent points, and finally the coordinates of the unknown node are determined by using the formula.
Preferably, the coordinates of two anchor nodes are randomly selected in S7.2, a straight line is determined by two points, and 3 cases are encountered when determining which anchor nodes are adjacent to each other in S7.3:
1) the coordinates of the other two anchor nodes are positioned on the opposite side of the straight line; the connecting line of the two anchor nodes is the diagonal line of the quadrangle formed by the 4 anchor nodes, and then the other two anchor nodes are also the diagonal lines of the quadrangle, and the anchor nodes which are adjacent in pairs can be obtained through one judgment;
2) if the first judgment is the same side, the judgment needs to be carried out again, one coordinate of the two anchor nodes randomly selected in the front is kept, the other coordinate is selected for judgment, if the results of the two judgments are the same side, the 3 anchor nodes are just two sides of the formed quadrangle, which anchor nodes are diagonals of the formed quadrangle can be obtained, and the result of the first condition can also be obtained;
3) if the second time is an opposite side, then the two anchor nodes are one edge and one diagonal that make up the quadrilateral, the result of the first case is also obtained.
Compared with the prior art, the technical scheme of the invention has the beneficial effects that:
(1) the invention can better adapt to the problem of larger positioning error of the edge area caused by the distribution of the beacon nodes and the form of the sensor network, so that the positioning error in the whole network area is more uniform.
(2) Compared with algorithms such as SVM and the like, the method can effectively reduce the influence of sparse data on positioning accuracy caused by the characteristics of RSSI signals.
(3) The cooperative node screening strategy based on precision optimization can ensure that the precision of nodes participating in cooperation is relatively high, so that the accumulated error in the cooperation process is reduced to the minimum.
(4) The improved reduced quadrilateral centroid positioning algorithm further improves the correction effect and optimizes the final positioning result.
Detailed Description
The drawings are for illustrative purposes only and are not to be construed as limiting the patent;
for the purpose of better illustrating the embodiments, certain features of the drawings may be omitted, enlarged or reduced, and do not represent the size of an actual product;
it will be understood by those skilled in the art that certain well-known structures in the drawings and descriptions thereof may be omitted.
The technical solution of the present invention is further described below with reference to the accompanying drawings and examples.
Example 1
The embodiment provides a three-dimensional cooperative positioning method for an RSSI wireless sensor network, as shown in fig. 1, the method includes the following steps:
s1: carrying out coarse positioning on the unknown node by adopting a WSN coarse positioning algorithm based on a LightGBM model to obtain the coordinates (x, y, z) of the position of the unknown node;
s2: averaging the received signal strength RSSI from different anchor nodes, wherein the calculation formula is as follows:
wherein n is the number of neighbor anchor nodes and RSSIiIs the received signal strength with the ith anchor node;
s2: determining RSSI threshold values in different environmentsthers(ii) a Determining RSSIav≥RSSIthresIf yes, go to S3; if not, go to S7;
s3: judging whether the number of the neighbor anchor nodes is more than or equal to 4, if so, performing S4, and if not, performing S7;
s4: selecting 5 neighbor anchor nodes with the maximum RSSI value of an unknown node to establish a subset (5,4), wherein the subset (5,4) represents a set which takes any 4 anchor nodes in the 5 anchor nodes with the maximum received signal strength as a group;
s5: and (3) positioning the RSSI values from 4 anchor nodes in each set of subset (5,4) by using a quadrilateral centroid positioning algorithm, finally obtaining 5 position estimation values of unknown nodes, and taking the minimum value of the errors among the 5 positions:
wherein, i and j are subset sequence numbers; c. Ci: position estimation obtained from the ith subset; dis (c)i,cj): an error distance between the ith subset position estimate and the jth subset position estimate;
judging whether the E is equal to or less than theta, if so, taking the node meeting the condition as a secondary selection cooperative backbone node; if not, go to S7;
wherein θ is a preset error threshold, and is 0.5 in this embodiment;
s6: screening secondary selection cooperative backbone nodes according to an anchor node replacement principle, and taking all screened secondary selection cooperative backbone nodes meeting conditions as preferred cooperative backbone nodes;
s7: and determining the final position of the unknown node according to a quadrilateral centroid positioning algorithm.
The method of this example is described in detail below:
RSSI dynamic signal propagation model
Research and analysis of the RSSI signal propagation model can know that the path loss exponent n is an important parameter for converting the signal strength RSSI into the distance. By utilizing the known position information and mutual communication of the anchor nodes in the positioning area and combining the signal propagation model, the path loss index can be dynamically acquired in real time, the dynamic signal propagation model is established, and the influence of the environment on distance measurement is reduced. According to the dynamic signal propagation model, the measured distance is preprocessed in the distance measurement stage, so that the positioning precision in the positioning stage can be effectively improved.
In the positioning based on the signal strength indicator RSSI, a proper wireless signal transmission model is adopted according to the strength of a radio frequency signal received by a node, the radio frequency signal is converted into a distance, and finally the position of the node is calculated by utilizing a trilateration method. Practice shows that when a radio frequency signal is propagated, the attenuation characteristic of the radio frequency signal gradually attenuates along with the distance, the attenuation characteristic of the radio frequency signal follows lognormal distribution, a common lognormal distribution model is used as a conversion relation between signal intensity and propagation distance, and the expression is as follows:
in the formula: p (d) represents distanceThe distance of the transmitting node is the received signal power at the position d, and the unit is dBm; p (d)0) Represents the received signal power in dBm at d0 from the transmitting node; d0For reference distance, generally 1 m; lambda is a path loss index, and the value of lambda is influenced by the environment and is generally between 2 and 4; xδIs a zero mean gaussian random variable. The receiving node can calculate the distance between the receiving node and the transmitting node by using the formula (1) according to the received signal strength.
The RSSI signal is easily affected by the environment, and there is an error when converting into a distance, and in order to reduce the distance measurement error, a certain measure needs to be taken. According to the signal propagation model, the path loss index lambda is an important parameter for converting the signal strength RSSI into the distance, and the path loss index can be dynamically acquired in real time by utilizing the known position information of the anchor nodes in the positioning area and the communication among the anchor nodes and combining the signal propagation model, so that the influence of the environment on the distance measurement is reduced.
The embodiment dynamically acquires the path loss exponent by combining the anchor nodes with known position information. The unknown node periodically detects the neighbor anchor nodes of the unknown node, three neighbor anchor nodes with the maximum received signal strength are selected, and the path loss index of the positioning area where the unknown node is located can be obtained in real time by combining a signal propagation model according to the received signal strength among the anchor nodes.
Let A, B, C be three neighboring anchor nodes of unknown node N, and RSSI between two anchor nodes A and B, C be P (d)B)、P(dC) Substituting the formula (1) to obtain:
anchor node A, B, C having a known location, dAB、dACCan be calculated by letting P (d) be calculated according to equation (2)B)-P(dC) The value of the path loss exponent λ can be found. Substituting the path loss index lambda into the signal propagation model, and calculating the signal strength between the unknown node and the anchor node according to the received signal strength between the unknown node N and the anchor node A, B, CAnd the distance can effectively reduce the influence of the environment on the ranging error.
2. LightGBM based coarse positioning method.
The traditional wireless sensor network positioning method based on machine learning converts the positioning problem into a multi-classification problem, and then predicts the classification of the position of an unknown node by utilizing models such as SVM, KNN and the like. However, the positioning of unknown node coordinates is not a classification problem, and the method has the problem that absolute errors cannot be eliminated. When many nodes are located at the corners of the cell, the accumulated positioning error is large. As shown in FIG. 2, the actual position of the unknown node is located at the cell c, but is located at the centroid O of the cell, where the error is maximum
Wherein D is the size of the sensing network area, and M is the number of categories.
Secondly, many positioning algorithm errors are mainly concentrated in the edge area of the sensor network at present. As shown in fig. 3, the distribution of the beacons is relatively uniform, but there still occurs a case where the error of the central area of the sensor network is small, and the error of the boundary area is large. This is related to whether the beacons are randomly distributed, how many, the sensor network morphology is different, and the positioning algorithm itself.
Meanwhile, due to uncertainty and nonlinearity of the RSSI signal, the RSSI signal is easily affected by multipath fading and non-line-of-sight blocking, so that the actual training data may have a missing value or a situation that the signal value received outside the node communication radius is almost 0, and sparse data may occur. The SVM is sensitive to missing data, and incomplete feature vectors directly influence the classification effect. LightGBM is a more lightweight efficient implementation of GBDT, and an EFB algorithm proposed for sparse data problems can adapt well to the RSSI signal value missing situation. Moreover, most of the current positioning algorithms based on machine learning only consider two-dimensional planes, and three-dimensional space positioning is not studied yet. Therefore, in order to solve the above problems, the present embodiment provides a LightGBM model-based wireless sensor network coarse positioning algorithm, which uses LightGBM to fit the relationship between the signal feature space and the location coordinate, and predicts the three-dimensional coordinate value of the unknown node to realize positioning. Meanwhile, the error of the coarse positioning stage is controlled within a certain range, so that the precision of the cooperation stage is ensured.
The algorithm flow of the coarse positioning stage is shown in fig. 4, and mainly includes the following steps:
(1) in the off-line training stage, a series of beacon nodes S are deployed in a Wireless Sensor Network (WSN) positioning areai(i 1.. k.) this point is acquired at a different location to each of the beacons SiThe RSSI signal intensity of the position point is recorded at the same time to obtain data [ id ]j,RSSI1,...,RSSIk,xj,yj,zj]Where j represents the sample point at the j-th position of the acquisition, j is 1jId serial number of the jth position; .
(2) In order to reduce errors caused by small-probability large-interference numerical values, a Gaussian filter model is used for processing after a plurality of groups of data are collected at each position, and the mean value and the variance of the model are calculated as formula (4):
wherein n is the data volume collected, RSSIiFor the ith RSSI signal value,
(3) due to RSSI signal instability, it is susceptible to environmental and other signal interference, and therefore anomalous data is typically collected. In order to eliminate the influence of the abnormal point on the model, the filtered data is processed by adopting a local outlier factor detection algorithm, one point of the points at different positions in the wireless sensor network positioning area collected in S1.1 is taken as q, and the local outlier factor of the point q is expressed as follows:
wherein, LOFk(q) is a local outlier factor of the point q, and the larger LOF value indicates that the sample point is more outlier and is more likely to be outlierA constant point; n is a radical ofk(q) is the kth distance neighborhood of point q, lrdk(o) is the local achievable density of point o, which is a point in the kth distance neighborhood of point q.
(4) And constructing a feature project based on a data mining method. Data features affect model performance, so we mine more useful information from raw data through feature engineering to allow the model to be better trained and learned. First, relevant statistical features, such as variance, maximum, minimum, mean, and range, are extracted from the RSSI signal values to comprehensively reflect trends and fluctuations in the data set. Secondly, the RSSI signal value is converted into a distance value by using a shadowing signal propagation model. Since the shorter the distance, the less environmental interference and attenuation the signal propagates, the closer the beacon is to the unknown node, the smaller the error introduced by the beacon, and should be given a higher weight. In this embodiment, a weight function is designed, as shown in equation 6, and a corresponding weight value can be calculated for each beacon node.
Wherein d isiI-th beacon distance value, d, representing unknown nodemaxThe maximum value of the distances among all beacons representing unknown nodes. And finally, combining the RSSI signal values, the distances and the weights to extract signal-distance cross characteristics and weighted RSSI signal value characteristics.
(5) Data (dataframe) with 4k +5 dimensional features and m rows of samples and X, Y, Z axis label values form three training data sets on which an X coordinate prediction model X-LightGBM, a Y coordinate prediction model Y-LightGBM and a Z coordinate prediction model Z-LightGBM are trained, respectively. The training process of the LightGBM model mainly adopts a GOSS algorithm for processing the number of samples, and provides an EFB algorithm for processing sparse features.
As shown in fig. 5, we take part of samples and feature data as an example, here, it is assumed that the samples have been iterated to the nth round, the samples have been sampled by the GOSS algorithm, two columns of features RSSI _1 and RSSI _3 in table (a) are mutually exclusive features (a small amount of collisions are allowed), and the two columns of features are bound into one feature, but in order to ensure that the value of the original feature can be identified from the bound feature value, an offset 95 is added to RSSI _3, and finally, the feature RSSI _1&3 in table (b) is obtained.
At this time, the value of the characteristic RSSI _1&3 is discretized into m integers, where it is assumed that m is 3, such as [ -100, -90) - >1, [ -90, -80) - >2, [0,10) - >3, a histogram with a width of m can be constructed, as shown in fig. 6.
And (3) calculating the division gain by substituting the formula (7) with different discrete values according to the traversal of the histogram, finding the optimal division point, and splitting by adopting a leaf-wise mode, namely finding the leaf node with the maximum division gain from all the current leaf nodes each time for splitting.
Al={xi∈A:xij≤d},Ar={xi∈A:xij>d},Bl={xi∈B:xij≤d},Br={xi∈B:xij>d}
Wherein x
ijIs a sample, d is a split point,
the number of samples reserved for the left sub-node,
number of samples reserved for right child node, B
lSet of small gradient samples reserved for left subnode, B
rSet of small gradient samples, g, reserved for the right child node
iIs a negative gradient; a is the large gradient data sampling ratio and b is the small gradient data sampling ratio.
(6) And in the on-line positioning stage, the information of the unknown node is processed according to the steps 2-4 and then is input into the trained X-LightGBM, Y-LightGBM and Z-LightGBM models, and the position coordinate (X, Y, Z) of the unknown node can be obtained.
3. Cooperative node screening stage based on precision optimization strategy
The traditional cooperative positioning algorithm only simply selects a plurality of unknown nodes closest to each other as cooperative nodes to carry out correction, and the influence of errors of the cooperative nodes on correction precision is ignored. The error correction can utilize information between positioned unknown nodes, but the unknown nodes have certain positioning errors, and the positioning errors of some nodes are relatively large, so that in order to reduce the accumulated errors in the cooperation process to the minimum, a certain strategy is adopted to ensure that the accuracy of the nodes participating in the cooperation is relatively high. In order to solve the above problems, the present embodiment provides a cooperative node screening algorithm based on precision optimization, and effectively screens out a node with higher RSSI coarse positioning precision according to an RSSI threshold, a subset judgment method, and an anchor node replacement principle. Firstly, by using the RSSI threshold value, nodes with relatively high precision can be quickly screened out from a large number of unknown nodes, and the calculation time is reduced. The subset judgment method and the anchor node replacement principle are complex in calculation due to the fact that positioning operation is conducted again, and therefore in the nodes screened out by the RSSI threshold, the subset judgment method and the anchor node replacement principle are used, so that the nodes affected by the environment can be eliminated, the nodes with high precision are screened out, meanwhile, the calculation time can be greatly reduced, and energy is saved. And finally, taking the screened nodes as cooperative nodes to participate in position error correction.
3.3.1 RSSI threshold screening node
The RSSI value is greatly influenced by the multipath effect, and under the same condition, the larger the RSSI value is, the smaller the distance measurement error is, and the higher the node positioning accuracy is. RSSI threshold values under different environments are determined through experiments, and unknown nodes with high coarse positioning accuracy can be quickly screened out from a large number of unknown nodes according to the RSSI threshold values. In the experiment, each variable of the signal propagation model takes the following value as the reference distance d0Is 1 m; node received signal strength P (d) at reference distance0) Is-40 dBm; xσIs a normal distribution with zero mean and variance of 2. In the simulation environment, the obtained relationship between the ranging error and the received signal strength is shown in table 1.
TABLE 1 ranging error vs. Signal Strength
From the experimental results in table 1, it can be seen that under certain external conditions, when the path loss indexes are the same, the distance measurement errors corresponding to different node distances are greatly different; when the distance between nodes is the same, the distance measurement errors corresponding to different path loss indexes have larger difference. In order to improve the node positioning precision, the distance measurement error should be made smaller as much as possible. According to table 1, the reference value of the ranging error is 1.5m, and the node with lower positioning accuracy is preliminarily screened out. The RSSI threshold derived from the ranging error is as follows: when the path loss index n is 2-2.5, taking the RSSI threshold value as RSSIthres-65 dBm; when the path loss index n is 2.5-3, taking the RSSI threshold value as RSSIthres-80 dBm; when the path loss index n is 3-3.5, taking the RSSI threshold value as RSSIthres-90 dBm; and when the path loss exponent n is 3.5-4, the RSSI threshold value is RSSIthres-100 dBm.
As can be known from the signal propagation model, the RSSI value decreases as the transceiving distance between the nodes increases. Experiments show that the greater the RSSI value of the received signal strength is, the closer the measured value obtained by calculation according to a signal propagation model is to the true value; the smaller the RSSI value, the larger the error between the measured value and the true value. RSSI threshold value obtained according to table 1 as RSSI from average value of signal strength of anchor nodeav>RSSIthresAnd the time shows that the distance measurement of the node is more accurate at the moment and the positioning precision is higher.
The unknown node N possibly receives N RSSI values at the same position, and the RSSI values are processed by using a Gaussian model, so that the influence of small-probability and large-interference events is reduced. Finally, averaging the received signal strengths RSSI from different anchor nodes:
wherein, n: number of neighbor anchor nodes, RSSIi: and the received signal strength with the i-th anchor node. Combining circuitThe relationship between the path loss index and the RSSI threshold is judged if
RSSIav≥RSSIthres (9)
The coarse positioning accuracy of the node is preliminarily considered to be relatively high. Therefore, the RSSI threshold value is simple to calculate, and the nodes with relatively high positioning accuracy can be quickly and preliminarily screened out from a large number of unknown nodes.
3.3.2 subset decision method
The RSSI threshold is greatly affected by the environment and has instability. To further eliminate the influence of the environment, a subset decision method is proposed herein. As can be seen from table 1, under the same condition, the larger the RSSI value is, the smaller the node ranging error is, and the positioning accuracy is correspondingly higher. And taking 5 anchor nodes with the maximum RSSI value from the neighbor reference nodes of the unknown node, taking any 4 anchor nodes in the 5 anchor nodes as a group, and positioning by using a quadrilateral centroid positioning algorithm to obtain 5 estimated positions of the unknown node. Accordingly, the error between these 5 estimated positions should be the smallest when using the quadrilateral centroid location algorithm to locate in the combination of all neighboring anchor nodes of the unknown node. Normally, the 5 estimated positions of the unknown node at the same position should be very close, and if the error between the 5 estimated positions is large and exceeds a certain threshold k, it indicates that the node is greatly influenced by the environment and the position estimation is unstable. Based on the method, 5 neighbor anchor nodes with the maximum RSSI value of the unknown node are selected to establish a subset (5,4), wherein the subset (5,4) represents a set formed by any 4 anchor nodes in the 5 anchor nodes with the maximum received signal strength. And (3) positioning the RSSI values from 4 anchor nodes in each set of subset (5,4) by using a quadrilateral centroid positioning algorithm, finally obtaining 5 position estimation values of unknown nodes, and taking the minimum value of the errors among the 5 positions:
i and j are subset sequence numbers; c. CiA position estimate obtained for the ith subset; dis (c)i,cj) Is the error distance between the ith subset position estimate and the jth subset position estimate. When the position error satisfies:
E≤θ (11)
and the time shows that the node estimation position is stable, the environment interference is small, and the precision is higher. In the experiment, θ is 0.5, and the node satisfying the condition (11) is used as the secondary selection cooperative backbone node.
The RSSI threshold screening node is simple to compute, but is susceptible to environmental influences, causing instability in the RSSI threshold. By using subset (5,4) subset judgment conditions, nodes greatly influenced by the environment can be further removed from the nodes screened by the RSSI threshold value, and the precision and the stability of the screened nodes are ensured.
3.3.3 Anchor node replacement principles
Because the precision of the nodes participating in the cooperation is higher, the error correction effect on the unknown nodes is more obvious, and the cooperation efficiency can be effectively improved. In order to ensure the high precision requirement of the cooperative node, certain measures are required to be taken to re-extract the node, so that the precision of the screened node is higher as much as possible. An anchor node replacement principle is proposed, and the nodes screened primarily are reprocessed: let the estimated coordinate of the unknown node N be (x)N,yN,zN) The four beacon nodes participating in positioning are respectively A (x)A,yA,zA)、B(xB,yB,zB)、C(xC,yC,zC)、D(xD,yD,zD). The unknown node N is now considered to be a beacon with a known location, with coordinates (x)N,yN,zN) Referred to as a translation beacon. One of the nodes is optionally selected at the beacon A, B, C, D, where the beacon B is selected to be considered an unknown node. And finally, positioning B by using a quadrilateral centroid positioning algorithm by using the beacon node A, C, D and the unknown node N, and estimating the coordinate to be B' (x)B′,yB′,zB′) And finally comparing the position with the actual position of B, and calculating an estimation error:
the final error is determined by δ. The smaller the delta, the smaller the node positioning error, and the delta is taken to be 0.2m in the experiment. If the estimation error of the beacon node B satisfies equation (12), it can be considered that the accuracy of the unknown node N satisfies the requirement, and therefore the unknown node N is taken as a cooperative node. And according to the anchor node replacement principle, all screened unknown nodes meeting the conditions are used as the preferred cooperative backbone nodes.
4. Collaborative correction phase based on quadrilateral centroid positioning algorithm
Since the number of beacons is generally small and not necessarily uniformly distributed, it is difficult to ensure good coverage of the entire positioning network area. For a large-scale wireless sensor network, most of the unknown nodes which are closer to each unknown node are other unknown nodes, the unknown nodes can communicate with each other, and the positioned unknown nodes are used as beacon nodes to perform cooperative correction on the nodes nearby, so that the positioning accuracy can be effectively improved. However, in the correction stage, the principle of cooperatively reducing the positioning area is adopted to obtain that the correction accuracy of the positioning area is not enough, so that an improved reduced quadrilateral centroid positioning algorithm is provided for cooperative correction. The nodes screened out according to the precision optimization strategy are rounded by taking the distance between every two nodes as a radius, as shown in fig. 7. The quadrilateral area is composed of the inside coordinates of the intersection point of two adjacent circles, and the centroid of the area is calculated by a reduced area quadrilateral centroid positioning algorithm and is used as the coordinates of an unknown node.
Suppose for unknown node N, the node participating in cooperative correction is A, B, C, D, and the 4 intersections of the inside circles are E (x), respectivelyE,yE)、F(xF,yF)、G(xG,yG)、H(xH,yH) Then, the coordinate calculation formula of the node N is as follows:
the E, F, G, H coordinate can be obtained by the principle of two-dimensional rotation matrix:
as shown in fig. 8, according to the trigonometric function:
wherein R is the distance between every two nodes;
(Vector)
after rotating by theta angle to obtain
At this time:
the coordinates of the G point can be obtained by the following two formulas:
the quadrilateral centroid location algorithm is not similar in the selection of the inner intersection points to the triangular centroid algorithm, and the nearest 4 cooperative anchor nodes A, B, C, D select the inner intersection points of two adjacent circles when calculating the inner coordinates, for example, two circles with centers a and C as the centers are not adjacent, and neither intersection point belongs to the inner side. The core idea is to judge which anchor nodes are adjacent pairwise (i.e. judge the anchor nodes counterclockwise or clockwise). Assuming that we do not know the order of selecting 4 anchor nodes in advance, the coordinates of two anchor nodes B and C are randomly selected, a straight line is determined from two points to obtain the equation of the straight line f (x) kx + B, and the coordinates (x) of the other two anchor nodes a and D are determinedA,yA) And (x)D,yD) Substituting the linear equation and judging whether the other two cooperative anchor nodes are on the same side or on different sides through the formula (15).
It is determined which points to use for calculation by judging that two are adjacent. For example, the coordinates of the point G are determined by two adjacent points a and D in the figure, rather than the points a and C.
There are 3 cases encountered when determining which anchor nodes are two-by-two adjacent: 1) the coordinates of the other two anchor nodes are located on opposite sides of the straight line. Then the connecting line of the two anchor nodes is the diagonal line of the quadrangle formed by the 4 anchor nodes, and then the other two anchor nodes are also the diagonal lines of the quadrangle, and the anchor nodes which are adjacent to each other can be obtained through one judgment, as shown in fig. 9 (a); 2) if the first judgment is the same side, the judgment needs to be performed again, one coordinate of the two anchor nodes randomly selected in the front is kept, the other coordinate is selected for judgment, if the results of the two judgments are the same side, the 3 anchor nodes are just two sides of the formed quadrangle, which anchor nodes are diagonals of the formed quadrangle can be obtained, and the result of the first condition can also be obtained, as shown in fig. 9 (b); 3) if the second time is an opposite side, then the two anchor nodes are one edge and one diagonal that make up the quadrilateral, the result of the first case is also obtained. As shown in fig. 9 (c).
The terms describing positional relationships in the drawings are for illustrative purposes only and are not to be construed as limiting the patent;
it should be understood that the above-described embodiments of the present invention are merely examples for clearly illustrating the present invention, and are not intended to limit the embodiments of the present invention. Other variations and modifications will be apparent to persons skilled in the art in light of the above description. And are neither required nor exhaustive of all embodiments. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the claims of the present invention.