Summary of the invention:
To solve the above-mentioned problems, the present invention provides a kind of indoor orientation method based on RSSI ranging, using a variety of excellent
The cooperation of change form carries out Multiple Optimization to the distance of calculating, it is ensured that measures the accuracy of distance, promotes setting accuracy.
In order to achieve the above objectives, the technical scheme is that a kind of indoor orientation method based on RSSI ranging, including
Following steps:
A, a base-station node is set in localization region, multiple substation nodes and label node, by label node with to
Object binding is positioned, multiple substation nodes are distributed in localization region with square topological structure, and configuration in the server
The actual coordinate value of tiny node;
B, base-station node carries out ZigBee-network networking, and the intercommunication of network implementations phase is added in substation node and label node
News;
C, label node carries out data broadcasting, sends label data packet, is parsed by substation node, recomposition substation data
Base-station node is sent to after packet;
D, base-station node carries out parsing verification to substation data packet, corresponding RSSI value is extracted, according to formula P (d)=P0-
10*n*(lgd-lgd0) calculate the distance between label node and substation node d;Wherein P (d) represents the signal at distance d
Intensity;P0For reference distance d0The signal strength indication that place measures, d0=1m;N is path-loss factor, is a constant;
E, the step d distance calculated is optimized using Kalman filtering, reduces error peak caused by fluctuating error;
F, suboptimization again is carried out to the distance after step e optimization using iterative method, obtains accurate distance value and is uploaded to clothes
Business device;
G, server distance value and the substation node coordinate value prestored based on the received is calculated in conjunction with RSSI location algorithm
The coordinate value of node to be measured out realizes positioning.
Preferably, the location mode of multiple substation nodes includes: that localization region is divided into multiple 20* in the step a
The square standard area of 20m and multiple sizes are less than the non-standard region of 20*20m, each standard area and non-standard area
Place substation node in four vertex in domain.
Preferably, label packet content includes that two byte-identifiers accord in the step c, two byte tag serial numbers,
One byte current data packet serial number and a byte check bit.
Preferably, substation packet content includes that two byte-identifiers accord in the step c, two byte substation serial numbers,
Two byte tag serial numbers, a byte tag packet serial number, a byte RSSI value and a byte check bit.
Preferably, in the step f majorization of iterative method apart from the step of include:
F1, remember that this distance is dis_now, last time distance is dis_last, and last time distance is dis_last_last;
F2, judge whether last time data mutation occurred, if there is be then respectively compared dis_now and dis_last and
Difference between dis_last_last judges the data value that need to be uploaded according to size of the difference, if dis_now and dis_last
The absolute value of difference is less than the absolute value of dis_now and dis_last_last difference, then uploads dis_now, otherwise upload dis_
last_last;
If data mutation does not occur for f3, last time data bit, compare the difference between dis_now and dis_last, such as
Fruit difference is within the set threshold range, then it is assumed that and it is regular dither, uploads dis_now, otherwise it is assumed that this data is mutated,
Upload dis_last;
F4, dis_last_last being updated, the value of dis_last is assigned to dis_last_last by the value of dis_last,
The value of dis_now is assigned to dis_last;
F5, circulation execute step f1-f4.
A kind of beneficial effect, indoor orientation method based on RSSI ranging that the present invention discloses, has the following beneficial effects:
For substation node in distribution using square topological structure, control node distance is less than 20m, so that it is guaranteed that RSSI believes
Number value precision, it is ensured that the accuracy of later period RSSI algorithm;
The distance value obtained for primary Calculation carries out Kalman filtering, emergent error peak is eliminated, thus really
The accuracy for protecting distance value, for mobile label condition or label caused by interfering drifts about situation, using iterative method to away from
Amendment is compared from value, further ensures that the accuracy for being uploaded to the distance value of server, promotes the precision of positioning;
In addition, providing a set of weighted mass center algorithm aiming at the problem that RSSI ranging model is interfered vulnerable to external environment, introduce
One weight ω prevents information from flooding phenomenon, improves positioning accuracy
Specific embodiment:
It is described in detail below in conjunction with embodiment of the attached drawing to technical solution of the present invention.Following embodiment is only used for
Clearly illustrate technical solution of the present invention, therefore be only used as example, and cannot be used as a limitation and limit protection model of the invention
It encloses.
A kind of disclosed indoor orientation method based on RSSI ranging, includes the following steps:
A, a base-station node, multiple substation nodes and label node (as shown in Figure 1) are set in localization region, will be marked
It signs node and object to be positioned is bound, multiple substation nodes are distributed in localization region with square topological structure, and are being serviced
The actual coordinate value of substation node is configured in device;
Node specific location mode in substation includes: that localization region is divided into the square standard regions of multiple 20*20m
Four vertex in the non-standard region of domain and multiple sizes less than 20*20m, each standard area and non-standard region are equal
Place substation node;
B, base-station node carries out ZigBee-network networking, and the intercommunication of network implementations phase is added in substation node and label node
News;
C, label node carries out data broadcasting, sends label data packet, the label data packet content to each substation node
It is accorded with including two byte-identifiers, two byte tag serial numbers, a byte current data packet serial number and a byte check bit;
Substation node carries out parsing verification to label data packet, then organizes packet again after addition substation information and forms substation number
It is sent to base-station node according to packet, the substation packet content includes that two byte-identifiers accord with, two byte substation serial numbers, and two
Byte tag serial number, a byte tag packet serial number, a byte RSSI value and a byte check bit;
D, base-station node carries out parsing verification to substation data packet, corresponding RSSI value is extracted, according to statistical model formula P
(d)=P0-10*n*(lgd-lgd0) calculate the distance between label node and substation node d;Wherein P (d) is represented at distance d
Signal strength;P0For reference distance d0The signal strength indication that place measures, d0=1m;N is path-loss factor, is a constant,
Generally between 2~4;
E, when distance calculates, due to will receive external environmental interference, this external interference makes in calculated result step d
There is fluctuating error range and compare concentration, and has error peak sometimes, so occur suddenly using Kalman filtering reduction
Error peak, and previous secondary data are counted, thus the data development trend that estimation appears in, and then realize distance
The optimization of data, as shown in Fig. 2, specifically including:
E1, creation signal energy distance measuring states model: X (k)=AX (k-1)+BU (k-1)+W (k-1), wherein X (k) is k
The system mode at moment, A are to turn to change transfer matrix, belong to system parameter, X (k-1) is the system mode value for estimating the k-1 moment, B
It is system parameter, U (k-1) is the k-1 moment system mode control amount estimated, and W (k-1) is that the filtering at the k-1 moment estimated is made an uproar
Sound;
E2, using free space model to distance measuring states model analysis, establish observing and nursing equation: Z (k)=HX (k)+V
(k), wherein Z (k) be the k moment measured value, H be measuring system parameter, V (k) is to measure noise figure at the k moment;
E3, it is predicted and is corrected using filtering, in which:
Prediction process is X (k | k-1)=AX (k-1 | k-1)+BU (k), and X in formula (k | k-1) it is to be predicted with laststate
As a result;X (k-1 | k-1) it is the optimal result of laststate;U (k) is the control amount of present status, and system results can be more after updating
New corresponding covariance P (k | k-1)=AP (k-1 | k-1) AT+ Q, P in formula (k | k-1) are the corresponding covariance of X (k | k-1), P
(k-1 | k-1) is the corresponding covariance of X (k-1 | k-1), ATIndicate the transposed matrix of A;Q is that the rectangle of W (k) is poor, now with
The prediction result of current state, then the measured value of present status is regathered, in conjunction with predicted value and measured value, so that it may to current
Measured value is an optimal estimation value X (k | k);
Makeover process isTo estimated value X optimal under state (k | k), H in formulaTTable
Show that the transposed matrix of H, R are that the rectangle of V (k) is poor;
Covariance P (k | k)=[I-K (k) H] P (k | k-1) of X under e4, final updating k-state (k | k), wherein I is 1
Matrix, for single model but measurement I=1.
F, suboptimization again is carried out to the distance after step e optimization using iterative method, obtains accurate distance value and is uploaded to clothes
Business device, as shown in figure 3, specific step includes:
F1, remember that this distance is dis_now, last time distance is dis_last, and last time distance is dis_last_last;
F2, judge whether last time data mutation occurred, if there is be then respectively compared dis_now and dis_last and
Difference between dis_last_last judges the data value that need to be uploaded according to size of the difference, if dis_now and dis_last
The absolute value of difference is less than the absolute value of dis_now and dis_last_last difference, then uploads dis_now, otherwise upload dis_
last_last;
If data mutation does not occur for f3, last time data bit, compare the difference between dis_now and dis_last, such as
Fruit difference is within the set threshold range, then it is assumed that and it is regular dither, uploads dis_now, otherwise it is assumed that this data is mutated,
Upload dis_last;
F4, dis_last_last being updated, the value of dis_last is assigned to dis_last_last by the value of dis_last,
The value of dis_now is assigned to dis_last;
F5, circulation execute step f1-f4;
G, server distance value and the substation node coordinate value prestored based on the received is calculated in conjunction with RSSI location algorithm
The coordinate value of node to be measured out realizes positioning.
The location algorithm specific steps of the step g include:
G1, by the distance value d of label node and each substation node1、d2…dnIt is ranked up according to ascending sequence
It is formed apart from group;
G2, first three distance value d is extracted from the distance group after sequence1、d2、d3, these three distance values expression label node
Distance away from three nearest substation nodes, passes through the coordinate value O of these three substation nodes1(X1, Y1), O2(X2, Y2), O3(X3, Y3)
Calculate the mutual substation spacing L of three sub- tiny nodes12、L13、L23;
G3, the substation spacing L for successively calculating step g212、L13、L23It is compared respectively with preset threshold m, if a certain substation
Spacing is more than that preset threshold then rejects corresponding substation, organizes from distance and extracts the 4th distance value d4, step g2 is repeated, if all not surpassing
Preset threshold is crossed, then exports the coordinate value O of three sub- tiny nodes1(X1, Y1), O2(X2, Y2), O3(X3, Y3) and label node arrive
The distance value d of these three substations1、d2、d3;
G4, with three sub- tiny node coordinate O1(X1, Y1), O2(X2, Y2), O3(X3, Y3) it is origin, corresponding distance value d1、
d2、d3It draws and justifies for radius, establish weighted mass center model, three circles are crossed to form intersection point two-by-two, wherein substation node O2It is saved with substation
Point O3In substation node O1Interior intersection point is A, and coordinate value is A (XA, YA), substation node O1With substation node O3In substation node
O2Interior intersection point is B, and coordinate value is B (XB, YB), substation node O1With substation node O2In substation node O3Interior intersection point is C,
Its coordinate value is C (XC, YC), the coordinate value of three intersection points, the meter are calculated using the coordinate value and radius value of three sub- tiny nodes
Calculation can refer to existing calculation method;
G5, the coordinate (X, Y) of label node is obtained using the coordinate combination weighted mass center algorithm of three intersection points, in which:
In formula: ωAFor the weighted value of intersection point A, andωBFor the weighted value of intersection points B, andωCFor the weighted value of intersection point C, and
Technology contents and technical characteristic of the invention have revealed that as above, however those skilled in the art still may base
Make various replacements and modification without departing substantially from spirit of that invention in announcement of the invention, therefore, the scope of the present invention is answered unlimited
It in the revealed content of embodiment, and should include various without departing substantially from replacement and modification of the invention, and be present patent application right
It is required that being covered.