WLAN fingerprint positioning method based on RSS linear correlation Yu secondary weighted centroid algorithm
Technical field
The present invention relates to indoor positioning technologies field, be specifically related to one based on RSS linear correlation and secondary weighted barycenter
The WLAN fingerprint positioning method of algorithm.
Background technology
Along with the fast development of the widely available of wireless network He mobile intelligent terminal, location Based service is come by more
The most concerns, at emergency relief, health care, social networks, navigate and the field such as monitoring has obtained and has been widely applied and opens up
Huge market prospect is shown.Due to the high coverage rate of WLAN hot spot service, people are to keeping whenever and wherever possible connecting wireless service
Demand grow with each passing day, this makes many research institutions both domestic and external and company expand about WLAN location fingerprint indoor
The research work of location technology, relevant application is the most at the early-stage, such as: the companies such as Google, Nokia, Baidu all exploitation and
Improve different WLAN indoor locating systems.And the main method of indoor positioning has time of arrival (toa) (TOA), signal to arrive at present
Reach time difference (TDOA), direction of arrival degree (AOA), received signal strength (RSS) etc., but owing to the interior space is narrower
The modes such as little, the circulation way of radio wave is extremely complex, reflection, transmission, scattering make the more difficult reality of most localization method
Existing.The localization method of received signal strength (RSS) refers to that the rule changed with propagation distance change according to signal intensity is come real
Now positioning, it is affected by environment compared to other localization method less, and development cost is low, is therefore that the indoor of current main flow are fixed
Method for position.
It is broadly divided into two stages: off-line fingerprint base establishment stage and tuning on-line based on RSS location fingerprint localization method
Stage.In off-line fingerprint base acquisition phase, in needing to be spaced in area to be targeted according to a certain distance, gather several references
Point, records and sets up wireless fingerprint data base by positional information corresponding for reference point and RSS information.The tuning on-line stage,
RSS data sample according to user's Real-time Collection, estimates user current location in conjunction with location algorithm.But current RSS refers to
The deficiency of stricture of vagina localization method various degrees: (1) owing to indoor environment existing the impact of the reasons such as multipath effect, AP's
RSS value has bigger fluctuation, this bigger undulatory property can affect the stability of location, thus reduces the essence of indoor positioning
Degree;(2), when fingerprint base is set up, the RSS sample data of a lot of acquired original is taken average and serves as sample point fingerprint, the most do not fill
Divide and utilize the RSS sample information gathered, thus affect positioning precision;(3) due to the variability issues of terminal so that collection
Finger print data has obvious difference, thus reduces positioning precision;(4), when determining position location coordinate, most algorithm uses
Similar multiple sample points are averaged or weighted average, but k the similitude finally determined is random distribution mostly, some
Point distance users position deviation is relatively big, uses traditional mode can affect positioning precision.
Summary of the invention
The invention aims to solve existing localization method RSS sample data do not make full use of, different mobile
The problems such as terminal poor robustness, final position location estimation error are bigger, thus keep indoor locating system stability and
Higher positioning precision.
In order to overcome above-mentioned the deficiencies in the prior art, the invention provides one based on RSS linear correlation with secondary weighted
The WLAN fingerprint positioning method of centroid algorithm, specifically includes that
1. Filtering Processing RSS sample
Owing to there is the impact of the reasons such as multipath effect in indoor environment, the RSS value gathering AP has bigger fluctuation, in order to
Improve the precision of location, need to be filtered original RSS value processing.This method takes amplitude limit average filter method, is equivalent to
" limit filtration method "+" recurrence average filter method ";The new data every time sampled first carries out amplitude limiting processing, then data is passed
It is bulldozed equal Filtering Processing.
First 1.1 carry out limit filtration process, the RSS sample data collecting described reference point, first predetermined permission
Maximum deflection difference value ε (empirical value sets according to different local RSS robustness, typically takes between 5 to 10), calculate same AP
The value of delta of adjacent sample data RSSi=| rssi,K,P-rssj,K,P|, i=j+1, if δi> ε, then revise
δiRepresenting adjacent sample RSS difference, i and j represents RSS sample data group number, rssi,K,PRepresent at described sampled point K
The RSS value of P the AP that i & lt is measured;
RSS sample sequence after 1.2 pairs of limit filtration process process carries out recurrence average Filtering Processing again, obtaining continuously
L sampled value regard a queue as, the length of queue is fixed as L, samples one group of new RSS data every time and puts into tail of the queue, and
Throw away one group of RSS data (first in first out) of original head of the queue, L data in queue carried out arithmetic average computing:
Serve as this RSS sample by calculated RSS information, after having processed, obtain the N group RSS by Filtering Processing
Sample sequence { sK:RSSK,1 RSSK,2 … RSSK,N}。
L represents the length of described filtering queue, it is contemplated that the RSS limited sample size that tuning on-line stage terminal receives,
The span of general L is 3 to 5, RSSiRepresent i-th group of RSS sample, RSSK,NRepresent the N group RSS sample of reference point K.
2. the foundation of off-line fingerprint database
2.1 arrange Q reference point in target localizing environment, gather the RSS sample data of different AP in reference point, with ginseng
As a example by examination point K, the RSS sample data collecting reference point K carries out amplitude limit average filter method Filtering Processing, finally gives N group
By the RSS sample sequence { s of Filtering ProcessingK:RSSK,1 RSSK,2 … RSSK,N};
K represents described reference point, and N represents the RSS sample group number collected by reference point K, sKRepresent the RSS sample of reference point K
This sequence, RSSK,NRepresent the N group RSS sample of reference point K.
This sample sequence can be expressed as a matrix:
Wherein K is described reference point, and N is RSS sample group number, and P is AP quantity, rssP,N,KRepresent described reference point K N group
The RSS value of P AP in RSS information.
The RSS robustness of 2.2 calculating reference point K, the RSS variance of each AP of first calculating reference point K, then to required
P variance carries out average value processing, and P refers to the AP quantity collected by described reference point K, utilizes this result of calculation as described reference
The weight w of some KK, the change of this reference point RSS value of the biggest expression of weights is the most violent.The computing formula of weights is as follows:
Wherein, P represents gathered AP number, and N is RSS sample group number, RSSn,kRepresent n-th group in the sample of k-th position
RSS sample, μKRepresent k-th position reference point RSS sample average.
2.3 for the linear dependence of Precise Representation fingerprint base sample Yu online RSS sample, to RSSKThe every a line of matrix
RSS numerical value arranges in descending order, i.e. can get new one group RSS matrix RSS'K:
Matrix RSS'KIn, each row element meets rssi,j,k≥rssi,j+1,k, i=1,2 ... R j=1,2 ... N-1.
RSS'KRepresent the RSS sample matrix processed in described reference point K, rss' through sequenceP,N,KRepresent described reference point K N group
The RSS value of P AP in RSS information.
2.4 by RSS'KIt is divided into M submatrix, often capable the averaging of each submatrix is obtainedByMatrix represents the fingerprint matrices information at described position K.
The RSS matrix dimensionality that the value of described M needs with tuning on-line stage terminal receives is identical, and experiment shows the increasing of M
Contribute to greatly promoting the precision of location, it is contemplated that the real-time of location, the value of M is the most beneficial excessive, and general value is 3 to 6.RSSM
Represent m column RSS information in fingerprint matrices information.
3. calculate based on RSS linearly dependent coefficient
In 3.1 tuning on-line stages, terminal gathers the M group RSS sample sequence by Filtering Processing, is built into a P × M's
RSS calculation matrix, a line every to RSS calculation matrix arranges in descending order, the i.e. available final online RSS matrix RSS needed*:
Wherein M represents RSS sample group number, and P represents AP quantity,Represent the RSS of P AP in M group RSS sample
Value.
3.2 are multiplied by the online terminal of reference point RSS weight computing according to Pearson correlation coefficients formula receives sample and fingerprint
The linearly dependent coefficient r of data base's sampleK:
Wherein rssi,j,KWithIt is illustrated respectively in what k-th reference point fingerprint and online terminal in fingerprint database received
The numerical value of the i-th row jth row of RSS calculation matrix, wkRepresent the weights of reference point, μ in fingerprint baseKRepresent K in fingerprint database
The average of group fingerprint, μuserRepresent the average of online RSS matrix.μKThe formula that is calculated as follows:
3.3, by after good for described Q Calculation of correlation factor, carry out descending sort to it, choose corresponding to front k correlation coefficient
Location point { P1 P2 … Pk, Pk=(xk yk rk)。
PkRepresent the reference point information corresponding to kth correlation coefficient after described Q correlation coefficient descending sort, xk yk
It is the coordinate figure corresponding to kth correlation coefficient respectively, rkRepresenting kth correlation coefficient, in this method, the value of k should be greater than 3.
The most secondary weighted centroid algorithm location matches
4.1 by described PkBecome two arrays VX and VY
VX and VY represents x coordinate array and y-coordinate array, vx in the reference point information corresponding to described k correlation coefficientk
And vykRepresent x coordinate and the y-coordinate information of kth correlation coefficient correspondence reference point.
4.2 pairs of described k nodes of locations utilize centroid algorithm to carry out for the first time and calculate, calculate unknown node I'(x'y');
Centroid algorithm is as follows:
The reference point quantity that k obtains after representing described Q correlation coefficient descending sort, riRepresent that i-th reference point institute is right
The correlation coefficient answered, xi yiRepresenting the location coordinate information that i-th reference point is corresponding respectively, x'y' represents the position tried to achieve respectively
Coordinate information.
4.3 is random distribution due to k linear correlation nodes of locations, and the unknown node coordinate that first centroid algorithm calculates is by mistake
Difference is bigger.In VX array and VY array, deduct the coordinate figure of unknown node with coordinate figure in array respectively and carry out absolute value
Process obtains Φx,k=| xk-x'|,Φy,k=| yk-y'|, obtains α Φ of maximumx,kAnd Φy,k, by corresponding coordinate information
(value of α is relevant with k value, generally k/3) is deleted, available new number after delete processing in VX array with VY array
Group VX' and VY';
VX' and VY' array carries out second time weighted mass center algorithm calculate, obtain final positioning result I (x y).
Compared with prior art, the present invention has the following advantages:
The present invention RSS sample to gathering uses amplitude limit average filter method to be filtered processing, and effectively enhances AP's
RSS Almost Sure Sample Stability;When setting up off-line fingerprint base, by gathering many group RSS sample datas, and to its carry out descending sort and
Being grouped process of averaging, the fingerprint finally given can fully describe the RSS information of this location point;In order to avoid changing violent position
Putting and be a little difficult to mate, the present invention is that each point calculates a description and changes the time the weights of intensity of variation, and applied to fixed
In the algorithm of position;Owing to the present invention uses space similarity to realize location, although different terminals receives the ability of AP signal intensity
Difference, but the curve of cyclical fluctuations of RSS is similar, and i.e. the RSS sample changed curve of different terminals collection is similar, therefore adopts
Different terminals variability issues can be prevented effectively from by the present invention;K the analogous location point owing to finally determining is random mostly
Distribution, some location point distance users current location deviation is relatively big, uses traditional mode can affect positioning precision, therefore this
Bright give secondary weighted centroid algorithm to calculate the final position of user.
The present invention proposes to carry out indoor positioning, by substantial amounts of reality based on RSS linear correlation and secondary weighted centroid algorithm
Demonstrate feasibility and the accuracy of the present invention, precision and the enhancing of indoor positioning can be effectively improved by the present invention
The stability of location.
Accompanying drawing explanation
Fig. 1 is WLAN fingerprint positioning method based on RSS linear correlation Yu secondary weighted centroid algorithm of the present invention
Flow chart;
Fig. 2 be terminal receive a certain AP many groups RSS sample Filtering Processing before and Filtering Processing after schematic diagram;
Fig. 3 be different terminals same position point accept filter process after difference in signal strength opposite sex schematic diagram;
Fig. 4 is schematic diagram based on secondary weighted centroid algorithm location matches.
Detailed description of the invention
In Fig. 1, describe flow process based on RSS linear correlation Yu the WLAN fingerprint positioning method of secondary weighted centroid algorithm
Figure, provides detailed description below in conjunction with Fig. 1.
Step S1, the foundation of off-line fingerprint database
1.1RSS sample collection
In target localizing environment, arrange Q reference point, gather the RSS sample data of different AP in reference point, with reference
As a example by some K, the RSS sample data collecting reference point K carries out amplitude limit average filter method Filtering Processing, finally gives N group and leads to
Cross the RSS sample sequence { s of Filtering ProcessingK:RSSK,1 RSSK,2 … RSSK,N};
K represents described reference point, and N represents the RSS sample group number collected by reference point K, sKRepresent the RSS sample of reference point K
This sequence, RSSK,NRepresent the N group RSS sample of reference point K.
This sample sequence can be expressed as a matrix:
Wherein K is described reference point, and N is RSS sample group number, and P is AP quantity, rssP,N,KRepresent described reference point K N group
The RSS value of P AP in RSS information.
The RSS robustness of 1.2 calculating reference point K
The RSS variance of each AP of first calculating reference point K, then carries out average value processing to P required variance, and P refers to institute
State the AP quantity collected by reference point K, utilize this result of calculation as the weight w of described reference point KK, the biggest expression of weights
The change of this reference point RSS value is the most violent.The computing formula of weights is as follows:
Wherein, P represents gathered AP number, and N is RSS sample group number, RSSn,kRepresent n-th group in the sample of k-th position
RSS sample, μKRepresent k-th position reference point RSS sample average.
1.3RSS sample process builds with fingerprint
For the linear dependence of Precise Representation fingerprint base sample Yu online RSS sample, to RSSKMatrix every a line RSS number
Value arranges in descending order, i.e. can get new one group RSS matrix RSS'K:
Matrix RSS'KIn, each row element meets
rssi,j,k≥rssi,j+1,k, i=1,2 ... R j=1,2 ... N-1
RSS'KRepresent the RSS sample matrix processed in described reference point K, rss' through sequenceP,N,KRepresent described reference point
The RSS value of P AP in K N group RSS information.
By RSS'KIt is divided into M submatrix, often capable the averaging of each submatrix is obtained:
ByMatrix represents the fingerprint matrices information at described position K.
The RSS matrix dimensionality that the value of described M needs with tuning on-line stage terminal receives is identical, and experiment shows the increasing of M
Contribute to greatly promoting the precision of location, it is contemplated that the real-time of location, the value of M is the most beneficial excessive, and general value is 3 to 6.RSSM
Represent m column RSS information in fingerprint matrices information.
Step S2, tuning on-line
2.1 build RSS calculation matrix
Terminal gathers the M group RSS sample sequence by Filtering Processing, is built into the RSS calculation matrix of a P × M, right
The every a line of RSS calculation matrix arranges in descending order, the i.e. available final online RSS matrix RSS needed*:
Wherein M represents RSS sample group number, and P represents AP quantity,Represent the RSS of P AP in M group RSS sample
Value.
2.2 calculate dependency
It is multiplied by the online terminal of reference point RSS weight computing according to Pearson correlation coefficients formula and receives sample and finger print data
The linearly dependent coefficient r of storehouse sampleK:
Wherein rssi,j,KWithIt is illustrated respectively in what k-th reference point fingerprint and online terminal in fingerprint database received
The numerical value of the i-th row jth row of RSS calculation matrix, wkRepresent the weights of reference point, μ in fingerprint baseKRepresent K in fingerprint database
The average of group fingerprint, μuserRepresent the average of online RSS matrix.μKThe formula that is calculated as follows:
After good for described Q Calculation of correlation factor, it is carried out descending sort, choose corresponding to front k correlation coefficient
Location point { P1 P2 … Pk, Pk=(xk yk rk)。
PkRepresent the reference point information corresponding to kth correlation coefficient after described Q correlation coefficient descending sort, xk yk
It is the coordinate figure corresponding to kth correlation coefficient respectively, rkRepresenting kth correlation coefficient, in this method, the value of k should be greater than 3.
2.3 secondary weighted value centroid methods carry out location matches
2.3.1 a centroid algorithm calculates
By described PkBecome two arrays VX and VY
VX and VY represents x coordinate array and y-coordinate array, vx in the reference point information corresponding to described k correlation coefficientk
And vykRepresent x coordinate and the y-coordinate information of kth correlation coefficient correspondence reference point.
Described k nodes of locations utilizes centroid algorithm carry out for the first time calculate, calculate unknown node I'(x'y');Barycenter
Algorithm is as follows:
The reference point quantity that k obtains after representing described Q correlation coefficient descending sort, riRepresent that i-th reference point institute is right
The correlation coefficient answered, xi yiRepresenting the location coordinate information that i-th reference point is corresponding respectively, x'y' represents the position tried to achieve respectively
Coordinate information.
2.3.2 two centroid algorithms calculate
Owing to k linear correlation nodes of locations is random distribution, the unknown node error of coordinate that first centroid algorithm calculates
Bigger.In VX array and VY array, deduct the coordinate figure of unknown node with coordinate figure in array respectively and carry out at absolute value
Reason obtains Φx,k=| xk-x'|,Φy,k=| yk-y'|, obtains α Φ of maximumx,kAnd Φy,k, corresponding coordinate information is existed
VX array deletes (value of α is relevant with k value, generally k/3) with in VY array, available new array after delete processing
VX' and VY';
VX' and VY' array carries out second time weighted mass center algorithm calculate, obtain final positioning result I (x y).
In step sl, as long as the RSS sample gathered is filtered processing, the present invention uses amplitude limit average filter method,
Be equivalent to " limit filtration method "+" recurrence average filter method ";The new data every time sampled first carries out amplitude limiting processing, then by data
Carry out recurrence average Filtering Processing.
Limit filtration processes: the RSS sample data collecting described reference point, the first predetermined maximum deflection difference value allowed
ε (empirical value sets according to different local RSS robustness, typically takes between 5 to 10), calculates same AP adjacent sample data
The value of delta of RSSi=| rssi,K,P-rssj,K,P|, i=j+1, if δi> ε, then revise
δiRepresenting adjacent sample RSS difference, i and j represents RSS sample data group number, rssi,K,PRepresent at described sampled point K
The RSS value of P the AP that i & lt is measured;
Recurrence average Filtering Processing: the RSS sample sequence after processing limit filtration process carries out recurrence average filtering again
Processing, L the sampled value obtained continuously is regarded as a queue, the length of queue is fixed as L, samples one group of new RSS every time
Data put into tail of the queue, and throw away one group of RSS data (first in first out) of original head of the queue, and L data in queue are carried out
Arithmetic average computing:
Serve as this RSS sample by calculated RSS information, after having processed, obtain the N group RSS by Filtering Processing
Sample sequence { sK:RSSK,1 RSSK,2 … RSSK,N}。
L represents the length of described filtering queue, it is contemplated that the RSS limited sample size that tuning on-line stage terminal receives,
The span of general L is 3 to 5, RSSiRepresent i-th group of RSS sample, RSSK,NRepresent the N group RSS sample of reference point K.
Effect after Filtering Processing is as shown in Figure 2.
In step s 2, the present invention proposes secondary weighted centroid algorithm and calculates for final position matching, is used for reducing matter
Center algorithm calculates produced error, and the schematic diagram of secondary weighted centroid algorithm is as shown in Figure 4.It is analyzed Fig. 4 understanding, as
Fruit replaces distance unknown node Q node to be farther out weighted barycenter computing with nearer node, can subtract to a certain extent
The little impact the most first marking node, reduces position error further.Based on this thought, it is first according to standardized centroid algorithm first
Secondary calculating, after trying to achieve barycenter, contrasts each nodes of locations X, Y distance calculating respectively, and removal X and Y is apart from farthest value respectively,
Such that it is able to obtain a new nodes of locations.Calculate it is carried out secondary weighted mass center algorithm, try to achieve final estimation
Location point.
Describe in figure 3 different mobile terminal (MT) same position point accept filter process after the difference in signal strength opposite sex show
It is intended to, observes curve chart and find that the RSS sample changed trend of end the most of the same race reception is roughly the same, say, that they are linear phases
Close.Make a concrete analysis of below:
To concrete AP, MT combination, it is assumed that P (d) and P (d0) represent respectively with AP at a distance of any distance d and apart
Reference distance d0The received signal strength at place.According to Lognormal shadowing model, have:
Wherein, Part I is path loss part (β is path-loss factor), and Part II is then that a normal state is random
VariableAbove formula also can be write as:
Wherein PAPIt it is the transmit power of AP;GAPIt it is the antenna gain of AP;GMTIt it is the antenna gain of mobile terminal MT;L is to be
System fissipation factor;λ is the wavelength of wireless signal.From formula, the RSS obtained at AP distance d depends on the hard of AP and MT
Part parameter.
Two different terminals are as follows to the RSS observation of some AP at same position:
By P (d)1-P(d)2Can obtain:
As can be seen from the above equation, different terminals RSS value is done after the recovery, result and AP configuration the most unrelated, although result is subject to
To factor impacts such as terminal antenna gain G, system loss factor l, path-loss factor β, stochastic variable X, but work as different terminals
Being under the ideal conditions that external condition is identical gathering RSS, these configurations are all to maintain constant, therefore, and the difference of different terminals
Value is to tend to a constant.It follows that in the case of different terminals, the RSS sample value that each terminal is gathered is linear
It is correlated with, as shown in Figure 3.Therefore the calculating during employing linear correlation carries out tuning on-line is to reduce to a certain extent
The impact of different terminals.
From Fig. 3, it is also possible to analyzing when RSS is stronger, this dependency is obvious, when RSS is more weak, dependency
Less obvious, therefore at positioning stage, it should carry out the selection of AP, abandon those more weak AP, be so favorably improved indoor
Setting accuracy.