Summary of the invention
The invention provides localization method and device in a kind of WLAN (wireless local area network), be used for improving the precision that WLAN positions according to nearest neighbor algorithm.
For achieving the above object, the invention provides the localization method in a kind of WLAN (wireless local area network), comprising:
For each sampled point in the RSSI mean value tranining database, the weights of the RSSI mean value of each AP that collects from the position of described sampled point correspondence are set;
According to from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of described sampled point correspondence to RSSI mean value and the weights thereof of each AP, obtain the distance between the position corresponding, described position to be determined with described sampled point;
According to the distance between the position corresponding, described position to be determined, determine described position to be determined with each sampled point in the described RSSI mean value tranining database.
Wherein, described for each sampled point in the RSSI mean value tranining database, be provided with from the station acquisition of described sampled point correspondence to the weights of RSSI mean value of each AP comprise:
For described for each sampled point in the RSSI mean value tranining database, obtain from the station acquisition of described sampled point correspondence to RSSI mean value and the RSSI standard deviation of each AP;
According to the default RSSI standard deviation and the corresponding relation of weights, setting from the station acquisition of described sampled point correspondence to the weights of RSSI mean value of each AP.
Wherein, described basis from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of described sampled point correspondence to RSSI mean value and the weights thereof of each AP, the distance of obtaining between the position corresponding with described sampled point, described position to be determined comprises:
For AP
0To AP
n, from station acquisition to be determined to the RSSI mean value of each AP be: Sm=(SS
M0, SS
M1, SS
M2, SS
M3..., SS
Mn);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the RSSI mean value of each AP be: Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the weights of RSSI mean value of each AP be K
M0, K
M1, K
M2, K
M3..., K
Mn
Distance between the position corresponding with described i sampled point, then described position to be determined is: and Euclidean Distance (Sm, Si)=K
M0(SS
M0-SS
I0)
2+ K
M1(SS
M1-SS
I1)
2+ K
M2(SS
M2-SS
I2)
2+ ...+K
Mn(SS
Mn-SS
In)
2
Wherein, when the RSSI standard deviation of RSSI mean value correspondence was big more, the weights of described RSSI mean value were big more.
Wherein, described according to the distance between the position corresponding, described position to be determined with each sampled point in the described RSSI mean value tranining database, determine described position to be determined is comprised:
Obtain the minimum range in the distance between the position corresponding, described position to be determined with each sampled point in the described RSSI mean value tranining database;
With the pairing position of the sampled point that obtains described minimum range as described position to be determined.
The present invention also provides the positioner among a kind of WLAN (wireless local area network) WLAN, comprising:
Weights are provided with the unit, are used for each sampled point for RSSI mean value tranining database, and the weights of the RSSI mean value of each AP that collects from the position of described sampled point correspondence are set;
Distance acquiring unit, be used for according to from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of described sampled point correspondence to each AP RSSI mean value and at described weights the corresponding weights in unit are set, obtain the distance between the position corresponding, described position to be determined with described sampled point;
Positioning unit is used for the distance between the position corresponding with described each sampled point of RSSI mean value tranining database, the position to be determined that obtains according to described distance acquiring unit, determines described position to be determined.
Wherein, described weights are provided with the unit and comprise:
RSSI obtains subelement, is used for each sampled point for described RSSI mean value tranining database, obtain from the station acquisition of described sampled point correspondence to RSSI mean value and the RSSI standard deviation of each AP;
The correspondence setting subelement is used to be provided with the corresponding relation of RSSI standard deviation and weights;
Weights are determined subelement, are used for the RSSI standard deviation and the corresponding relation of weights default according to described correspondence setting subelement, setting from the station acquisition of described sampled point correspondence to the weights of RSSI mean value of each AP.
Wherein, described distance acquiring unit specifically is used for:
For AP
0To AP
n, from station acquisition to be determined to the RSSI mean value of each AP be: Sm=(SS
M0, SS
M1, SS
M2, SS
M3..., SS
Mn);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the RSSI mean value of each AP be: Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the weights of RSSI mean value of each AP be K
M0, K
M1, K
M2, K
M3..., K
Mn
Distance between the position corresponding with described i sampled point, then described position to be determined is: and Euclidean Distance (Sm, Si)=K
M0(SS
M0-SS
I0)
2+ K
M1(SS
M1-SS
I1)
2+ K
M2(SS
M2-SS
I2)
2+ ...+K
Mn(SS
Mn-SS
In)
2
Wherein, when the RSSI standard deviation of RSSI mean value correspondence was big more, the weights of described RSSI mean value were big more.
Wherein, described positioning unit comprises:
Minimum range is obtained subelement, is used for obtaining the minimum range in the distance between the position corresponding with described each sampled point of RSSI mean value tranining database, described position to be determined;
The locator unit is used for described minimum range is obtained the pairing position of sampled point of the described minimum range that subelement obtains as described position to be determined.
Compared with prior art, the present invention has the following advantages:
For each sampled point in the RSSI mean value tranining database, the weights of the RSSI mean value of each AP that setting collects from the position of sampled point correspondence, and calculate distance between the position corresponding, position to be determined with sampled point according to these weights, improved the precision that positions according to nearest neighbor algorithm among the WLAN.
Embodiment
For above-mentioned purpose of the present invention, feature and advantage can be become apparent more, the present invention is further detailed explanation below in conjunction with the drawings and specific embodiments.
The invention provides the localization method among a kind of WLAN (wireless local area network) WLAN, as shown in Figure 1, comprising:
Step s101, for each sampled point in the RSSI mean value tranining database, the weights of the RSSI mean value of each AP that collects from the position of sampled point correspondence are set.
Step s102, according to from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of sampled point correspondence to RSSI mean value and the weights thereof of each AP, obtain the distance between the position corresponding, position to be determined with sampled point.
Step s103, according to the distance between the position corresponding, position to be determined with each sampled point in the RSSI mean value tranining database, determine position to be determined.
Localization method among the above-mentioned WLAN (wireless local area network) WLAN provided by the invention, a kind of localization method that the nearest neighbor algorithm (Nearest Neighbor Methods) that being based on provides in the prior art provides.Below at first nearest neighbor algorithm is introduced.Nearest neighbor algorithm of the prior art generally includes following steps:
1. set up basic RSSI tranining database.
Concrete, the sample data in the RSSI tranining database is preserved according to following structure:
<Position,Sample?ID,AP
0ID,AP
0SS,AP
1ID,AP
1SS,AP
2ID,AP
2SS,AP
3ID,AP
3SS,....AP
n-1ID,AP
n-1SS>
Position represents the physical location of collection point;
Sample ID is illustrated in locational which sample of Position;
AP
0ID represents the sign of the 0th AP, can be MAC (Medium Access Control, medium access control) address, and other are similar.
AP
0When SS is illustrated in this Position, from AP
0On the RSSI of signals that receives, other are similar.
2. calculate RSSI mean value in each sample, set up RSSI mean value tranining database.
Concrete, the sample data in the RSSI mean value tranining database is preserved according to following structure:
<Position,AP
0ID,AP
0Mean?SS,AP
1ID,AP
1Mean?SS,AP
2ID,AP
2MeanSS,AP
3ID,AP
3Mean?SS,....AP
n?ID,AP
n?Mean?SS>
AP
0When Mean SS is illustrated in this Position, for different samples, from AP
0The mean value of each the signal RSSI that receives is noted by abridging and is SS
0, other are similar.Then in the mean value tranining database about the record of i Position, can be expressed as Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In)
3. calculate the mean value of real-time sample, Position ' at this moment is to be determined.
Computational process is similar with the 2nd step to above-mentioned the 1st step, and the sample data of the real-time sample of acquisition is preserved according to following structure:
<Position’,AP
0ID,AP?Mean?SS
m0,AP
1ID,AP?Mean?SS
m1,AP
2ID,AP?MeanSS
m2,AP
3ID,AP?Mean?SS
m3,....AP
n?ID,AP?Mean?SS
mn>
AP
0Mean SS
M0When being illustrated in this Position ', for different samples, from AP
0The mean value of each the signal RSSI that receives is noted by abridging and is SS
M0, other are similar.Then, can be expressed as Sm=(SS for the RSSI record of Position '
M0, SS
M1, SS
M2, SS
M3..., SS
Mn)
4. mean value and every the record of mean value tranining database with real-time sample compares according to Euclideandistance (Euclidean distance) standard.
The account form of Euclidean distance is shown in following formula (1):
Euclidean?Distance(Sm,Si)=(SS
m0-SS
i0)
2+(SS
m1-SS
i1)
2+(SS
m2-SS
i2)
2+...+(SS
mn-SS
in)
2
(1)
Calculate according to Euclidean Distance formula (1), find the record that can access minimum euclidean distance from database, the Position value of this record is exactly the estimation physical location Position ' of Station.In the above-mentioned formula (1), for the SS that from different AP, measures
MjAnd SS
Ij(j=1,2 ..., n), its weights in Euclidean Distance formula (1) are identical, promptly for j arbitrarily (j=1,2 ..., n), (SS
Mj-SS
Ij)
2Weights in Euclidean Distance formula (1) all are 1, and weight shared in the result of calculation to EuclideanDistance formula (1) is identical.
The invention provides the localization method among a kind of WLAN (wireless local area network) WLAN, the nearest neighbor algorithm that provides in the prior art improved, as shown in Figure 2, comprising:
Step s201, for each sampled point in the RSSI mean value tranining database, obtain RSSI mean value and the RSSI standard deviation of each AP that collects from the position of sampled point correspondence.
With the sampling location in the RSSI mean value tranining database is Position
iSampled point be example:
<Position
i,AP
0ID,AP
0Mean?SS,AP
1ID,AP
1Mean?SS,AP
2ID,AP
2MeanSS,AP
3ID,AP
3Mean?SS,....AP
n?ID,AP
n?Mean?SS>
Then for one with position Position
iCorresponding sampling points, the RSSI of signals of each AP that it collects are to calculate according to a plurality of records in the RSSI tranining database, and the span of RSSI is 0~75dbm.For in the mean value tranining database about the record of i Position, can be expressed as Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In) for example for AP
0Mean SS, its implication is: in the RSSI tranining database at Position
iThe different samples that measure are from AP
0The mean value of each the signal RSSI that receives is noted by abridging and is SS
I0
For example in the RSSI tranining database at Position
MThe sample that measures comprises following five samples:
<Position
M,Sample?1,AP
0ID,65dbm,.....>
<Position
M,Sample?2,AP
0ID,62dbm,.....>
<Position
M,Sample?3,AP
0ID,67dbm,.....>
<Position
M,Sample?4,AP
0ID,63dbm,.....>
<Position
M,Sample?5,AP
0ID,60dbm,.....>
With AP
0Be example, then according to above-mentioned 5 samples:
The AP that measures
0The mean value of RSSI be: SS
I0=AP
0Mean SS=63.4dbm
The AP that measures
0The standard deviation of RSSI be: s=2.417dbm
Step s202, for the different range of RSSI standard deviation, the weights of RSSI mean value and the corresponding relation of RSSI standard deviation are set.
In the application scenarios of the present invention, for example under normal circumstances, data to a large amount of rssi measurement results are carried out statistical analysis, the standard deviation s that finds RSSI is generally about 5dbm, i.e. explanation is when when certain Position takes multiple measurements the RSSI of certain AP, if repeatedly the RSSI standard deviation of the RSSI correspondence of measuring is 5dbm, illustrate that then the RSSI mean value that repeatedly measures is more accurate.When being the standard of RSSI standard deviation with 5dbm, the RSSI standard deviation is big more, illustrate that then the RSSI mean value that repeatedly measures is inaccurate more, otherwise the RSSI standard deviation is more little, illustrates that then the RSSI mean value that repeatedly measures is accurate more.
For the nearest neighbor algorithm of using in the prior art, for each sampled point in the RSSI mean value tranining database, do not consider the order of accuarcy of the RSSI mean value of each AP that on the position of sampled point correspondence, collects, for the different RSSI mean value of order of accuarcy, in existing nearest neighbor algorithm, all use identical weight calculation Euclidean Distance according to formula (1).To this, weigh the order of accuarcy of RSSI mean value in the application scenarios of the present invention according to the RSSI standard deviation, for the RSSI mean value of different order of accuarcys, the weights of different RSSI mean value are set.For example, it is as follows the corresponding relation of the weights of RSSI mean value and RSSI standard deviation to be set:
When the RSSI standard deviation
The time, the weights that RSSI mean value is set are K=0.90;
When the RSSI standard deviation
The time, the weights that RSSI mean value is set are K=0.95;
When the RSSI standard deviation
The time, the weights that RSSI mean value is set are K=1.00;
When the RSSI standard deviation
The time, the weights that RSSI mean value is set are K=1.05;
As RSSI standard deviation s? (9dbm, in the time of), the weights that RSSI mean value is set are K=1.10.
According to this corresponding relation, can obtain and Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In) in each SS
Ij(j=1,2 ..., n) Dui Ying weights K
Mj(j=1,2 ..., n): K
M0, K
M1, K
M2, K
M3..., K
Mn
The above-mentioned weights that application scenarios of the present invention provides are provided with in the example, and when the RSSI standard deviation of RSSI mean value correspondence was big more, the weights of RSSI mean value were big more.The weights method to set up of foregoing description only for an instantiation in the application scenarios of the present invention, can be adjusted under different situations, with the needs that tally with the actual situation as required flexibly.No matter based on which kind of method to set up, for each sampled point in the RSSI mean value tranining database, through step s201 and step s202, need get access to RSSI mean value, RSSI standard deviation and the weights of each AP that collects from the position of each sampled point correspondence.
Step s203, according to from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of sampled point correspondence to RSSI mean value and the weights thereof of each AP, obtain the distance between the position corresponding, position to be determined with sampled point.
In the application scenarios of the present invention:
For AP
0To AP
n, from station acquisition to be determined to the RSSI mean value of each AP be: Sm=(SS
M0, SS
M1, SS
M2, SS
M3..., SS
Mn);
For AP
0To AP
n, from i sampled point Position
iCorresponding station acquisition to the RSSI mean value of each AP be: Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the weights of RSSI mean value of each AP be K
M0, K
M1, K
M2, K
M3..., K
Mn
Distance between the position corresponding with i sampled point, then described position to be determined can obtain according to formula (2):
Euclidean?Distance(Sm,Si)=K
m0(SS
m0-SS
i0)
2+K
m1(SS
m1-SS
i1)
2+K
m2(SS
m2-SS
i2)
2+...+K
mn(SS
mn-SS
in)
2
(2)
This Euclidean Distance formula (2) is compared with the formula (1) of nearest neighbor algorithm use in the prior art, for the station acquisition of sampled point correspondence to the RSSI mean value of each AP different weights is set, make the weight difference of RSSI mean value in Euclidean Distance calculates that order of accuarcy is different.In the application scenarios of the present invention, when the RSSI standard deviation of RSSI mean value correspondence is big more, illustrate that the order of accuarcy of RSSI mean value is poor more, the weights of RSSI mean value are big more.
Can find that by analysis the localization method in the application scenarios of the present invention has following characteristics: when the RSSI standard deviation of the RSSI mean value correspondence of each AP of certain sampled point all hour, the RSSI mean value of each AP that this sampled point is described is more accurate, this moment is for multiply by one less than 1 coefficient according to measuring result that RSSI mean value accurately obtains, can be so that the result of calculation of Euclidean Distance diminishes, thus make each AP the RSSI measurement of average value accurately the sampled point probability that becomes position to be determined become big.Otherwise, the all bigger situation of RSSI standard deviation for the RSSI mean value correspondence of each AP of certain sampled point, the RSSI mean value of each AP that this sampled point is described is more inaccurate, this moment is for multiply by one greater than 1 coefficient according to measuring result that RSSI mean value accurately obtains, can be so that the result of calculation of Euclidean Distance becomes big, thus make each AP the RSSI measurement of average value accurately the sampled point probability that becomes position to be determined diminish.Therefore, by above-mentioned for positioning result more accurately sampled point increase certain weight, the more inaccurate sampled point of locating effect reduces the mode of weight, reduced that the inaccurate sampled point of RSSI measurement of average value has improved the accuracy of positioning result for the harmful effect of final positioning result in the RSSI mean value tranining database.
Step s204, find the record that obtains minimum range from RSSI mean value tranining database, the Position value of this record is position to be determined.
In the said method provided by the invention, for each sampled point in the RSSI mean value tranining database, the weights of the RSSI mean value of each AP that setting collects from the position of sampled point correspondence, and calculate distance between the position corresponding, position to be determined with sampled point according to these weights, improved the precision that positions according to nearest neighbor algorithm among the WLAN.
The present invention also provides the positioner among a kind of WLAN (wireless local area network) WLAN, as Fig. 3 and shown in Figure 4, comprising: weights are provided with unit 10, distance acquiring unit 20 and positioning unit 30.Wherein:
Weights are provided with unit 10, are used for each sampled point for RSSI mean value tranining database, and the weights of the RSSI mean value of each AP that collects from the position of sampled point correspondence are set.
These weights are provided with unit 10 and further comprise:
RSSI obtains subelement 11, is used for each sampled point for RSSI mean value tranining database, obtain from the station acquisition of sampled point correspondence to RSSI mean value and the RSSI standard deviation of each AP;
Correspondence setting subelement 12 is used to be provided with the corresponding relation of RSSI standard deviation and weights; When the RSSI standard deviation of RSSI mean value correspondence was big more, the weights of RSSI mean value were big more.
Weights are determined subelement 13, are used for the RSSI standard deviation and the corresponding relation of weights default according to correspondence setting subelement 12, setting from the station acquisition of sampled point correspondence to the weights of RSSI mean value of each AP.
Distance acquiring unit 20, with weights unit 10 being set electrically connects, be used for according to from station acquisition to be determined to each AP RSSI mean value and from the station acquisition of sampled point correspondence to each AP RSSI mean value and at weights the corresponding weights in unit 10 are set, obtain the distance between the position corresponding, position to be determined with sampled point;
This distance acquiring unit 20 specifically is used for:
For AP
0To AP
n, from station acquisition to be determined to the RSSI mean value of each AP be: Sm=(SS
M0, SS
M1, SS
M2, SS
M3..., SS
Mn);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the RSSI mean value of each AP be: Si=(SS
I0, SS
I1, SS
I2, SS
I3..., SS
In);
For AP
0To AP
n, from the station acquisition of i sampled point correspondence to the weights of RSSI mean value of each AP be K
M0, K
M1, K
M2, K
M3..., K
Mn
Distance between the position corresponding with i sampled point, position then to be determined is: and EuclideanDistance (Sm, Si)=K
M0(SS
M0-SS
I0)
2+ K
M1(SS
M1-SS
I1)
2+ K
M2(SS
M2-SS
I2)
2+ ...+K
Mn(SS
Mn-SS
In)
2
Positioning unit 30 electrically connects with distance acquiring unit 20, is used for the distance between the position corresponding with each sampled point of RSSI mean value tranining database, the position to be determined that obtains according to distance acquiring unit 20, and is definite to position to be determined.
This positioning unit 30 further comprises:
Minimum range is obtained subelement 31, is used for obtaining the minimum range in the distance between the position corresponding with each sampled point of RSSI mean value tranining database, position to be determined;
Locator unit 32 is used for minimum range is obtained the pairing position of sampled point of the minimum range that subelement obtains as position to be determined.
The above-mentioned positioner that the application of the invention provides, for each sampled point in the RSSI mean value tranining database, the weights of the RSSI mean value of each AP that setting collects from the position of sampled point correspondence, and calculate distance between the position corresponding, position to be determined with sampled point according to these weights, improved the precision that positions according to nearest neighbor algorithm among the WLAN.
Above-mentioned module can be distributed in a device, also can be distributed in multiple arrangement.Above-mentioned module can be merged into a module, also can further split into a plurality of submodules.
Through the above description of the embodiments, those skilled in the art can be well understood to the present invention and can realize by hardware, also can realize by the mode that software adds necessary general hardware platform.Based on such understanding, technical scheme of the present invention can embody with the form of software product, it (can be CD-ROM that this software product can be stored in a non-volatile memory medium, USB flash disk, portable hard drive etc.) in, comprise some instructions with so that computer equipment (can be personal computer, server, the perhaps network equipment etc.) carry out the described method of each embodiment of the present invention.
It will be appreciated by those skilled in the art that accompanying drawing is the schematic diagram of a preferred embodiment, module in the accompanying drawing or flow process might not be that enforcement the present invention is necessary.
It will be appreciated by those skilled in the art that the module in the device among the embodiment can be distributed in the device of embodiment according to the embodiment description, also can carry out respective change and be arranged in the one or more devices that are different from present embodiment.The module of the foregoing description can be merged into a module, also can further split into a plurality of submodules.
The invention described above embodiment sequence number is not represented the quality of embodiment just to description.
More than disclosed only be several specific embodiment of the present invention, still, the present invention is not limited thereto, any those skilled in the art can think variation all should fall into protection scope of the present invention.