Disclosure of Invention
Aiming at the problems in the prior art, the invention provides an indoor positioning method based on WiFi signal strength and generation countermeasure network, which solves the problem that a large number of APs need to be deployed or hardware needs to be modified, and can obtain an accurate positioning result under the condition that only a single WiFi access point is used and the hardware is not changed.
In order to achieve the purpose, the invention adopts the following technical scheme to solve the problem:
a positioning method based on WiFi signal strength and generation countermeasure network specifically comprises the following steps:
step 1, arranging a receiving end and a transmitting end, wherein the receiving equipment is 4 antennae and 8 antennae, the transmitting equipment is 1 antenna, and the distances between the 4 antennae and the 8 antennae and the transmitting equipment are the same;
step 2, respectively collecting 4-antenna CSI data and 8-antenna CSI data; meanwhile, the received signal strength data of 4 antennas with the transmitting and receiving end distances of d1 and d2 are collected respectively to obtain RSSI1 and RSSI 2;
step 3, preprocessing the 4-antenna CSI data and the 8-antenna CSI data;
step 4, inputting the preprocessed 4-antenna CSI data as original data and 8-antenna CSI data as real data into a generated confrontation network model for training to obtain a trained generated confrontation network model;
step 5, calculating a path loss model by using the RSSI data of the 4 antennas collected in the step 2 to obtain parameters of the path loss model, namely an expression of the distance d of the transmitting and receiving ends;
step 6, collecting data to be tested, specifically collecting 4-antenna CSI data and RSSI data, and preprocessing the 4-antenna CSI data;
and 7, using the data to be tested for the generation countermeasure network model in the step 4 and the path loss model obtained in the step 5, calculating to obtain AOA and RSSI, and combining the AOA and RSSI to obtain the target position.
Further, in step 1, the receiving device and the transmitting device transmit signals by using an OFDM scheme, and the CSI data is formatted as Tx × Rx × Sub, where Tx is the number of transmit antennas, Rx is the number of receive antennas, and Sub is the number of available subcarriers.
Further, the preprocessing in step 3 refers to performing data calibration and performing a 0 value interpolation operation on the 4-antenna CSI data after the data calibration.
Further, the generation countermeasure network is a pix2pix model.
Further, the path loss model in step 5 adopts a Shadowing model shown in formula (3):
in the formula, R and t are RSSI and path loss factor at the reference distance, respectively, and are calculated by formulas (5) and (4), respectively:
R=abs(RSSI1)-10nlgd1 (5)
wherein, RSSI1 and RSSI2 are the RSSI data of 4 antennas under the transceiving end distances d1 and d2 obtained in step 2, respectively.
Further, the preprocessing in step 6 is data calibration and 0 value insertion operation.
Further, the step 7 specifically includes the following sub-steps:
step 71, substituting the 4-antenna CSI data in the data to be tested obtained in the step 6 into the trained generation countermeasure network model obtained in the step 4 to obtain processed data, and performing AOA estimation on the processed data to obtain an AOA value;
step 72, screening the 4-antenna RSSI data obtained in the step 6 to obtain the 4-antenna RSSI data after screening;
step 73, substituting the screened 4-antenna RSSI data obtained in the step 72 into the parameter-determined path loss model obtained in the step 5 to obtain a value of the distance d;
step 74, selecting one AOA value with stable distribution from the AOA values obtained in the step 71;
and step 75, combining the value of the distance d obtained in the step 73 with the AOA value obtained in the step 74 to obtain the position of the target source, and ending the positioning.
Further, in step 71, the Music algorithm is used to perform AOA estimation on the processed data.
Further, in the step 72, the 4-antenna RSSI data obtained in the step 6 is screened by using a least square method shown in formula (6); the least squares formula is as follows:
wherein, P and θ respectively represent RSSI data of 4 antennas obtained in step 6 and AOA values obtained in step 7;
and
respectively, the interference-free RSSI and AOA measured by the AP when the environment is clean.
Compared with the prior art, the invention has the following technical effects:
1. the method of the invention jointly estimates the target position by using the AOA and the RSSI, thus the target positioning can be completed only by one access point without deploying a plurality of access points or modifying hardware. Therefore, the method of the invention has simple equipment and convenient deployment.
2. By using the trained generation countermeasure network model, when the actual AP is 4 antennas, CSI data which exceeds the aperture resolution of 4 antenna arrays and is close to the aperture resolution of 8 antenna arrays can be generated through the trained generation countermeasure network model; compared with the original 4-antenna data which is not processed by the model, the aperture of the antenna array is improved, the interference of the data is reduced, and therefore the estimation precision of the AOA is improved.
3. The least square method is used for reducing the influence of the environment on the positioning accuracy, and when data are collected, RSSI can be continuously collected, but the RSSI is easily interfered by the outside world, for example, by other signals, the distance estimation error can be caused, so that the least square method is used, the RSSI with the minimum interference is selected by combining the least square method with the AOA, the distance is calculated, and the positioning accuracy of a decimeter level is achieved.
Detailed Description
The technical solutions in the embodiments of the present invention are clearly and completely described below with reference to the specific contents of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments of the present invention without making any creative effort, shall fall within the protection scope of the present invention. Details which are not described in detail in the embodiments of the invention belong to the prior art which is known to the person skilled in the art.
Referring to fig. 1 and fig. 2, the positioning method based on WiFi signal strength and generation of a countermeasure network of the present invention specifically includes the following steps:
step 1, arranging a receiving end and a transmitting end. The receiving device is 4 antennas and 8 antennas, the transmitting device is 1 antenna, and the distances between the 4 antennas and the 8 antennas and the transmitting device are the same.
Step 2, channel state information (CSI data) under 4-antenna AP and 8-antenna AP are collected respectively, namely 4-antenna CSI data and 8-antenna CSI data; and respectively collecting the received signal strength data under the transmitting and receiving end distances d1 and d2 of the 4 antennas to obtain RSSI1 and RSSI 2.
When the 8-antenna CSI data are collected, the environment is as simple as possible, so that the influence of the complex environment on the CSI data is reduced, and the robustness of the 8-antenna CSI data on different practical application scenes is improved.
The RSSI data (i.e., received signal strength data) for the 4 antennas is used in subsequent steps as reference data in generating the path loss model.
In this embodiment, the receiving device and the transmitting device transmit signals by using the OFDM scheme, and have 48 available subcarriers, so the format of the CSI data is Tx Rx Sub, where Tx is the number of transmitting antennas, Rx is the number of receiving antennas, and Sub is the number of available subcarriers. The CSI is 1 × 4 × 48 when the AP is 4 antennas, and 1 × 8 × 48 when the AP is 8 antennas.
And step 3, preprocessing the 4-antenna CSI data and the 8-antenna CSI data collected in the step 2, specifically, performing data calibration to eliminate phase offset generated by sampling time offset and sampling frequency offset. In addition, in order to match the dimensions of the 4-antenna CSI data with the dimensions of the 8-antenna CSI data when training the network, a 0 value interpolation operation is performed on the 4-antenna CSI data after data calibration.
And 4, inputting the 4-antenna CSI data preprocessed in the step 3 as original data and 8-antenna CSI data as real data into a generated countermeasure network model for training to obtain a trained generated countermeasure network model.
Preferably, the generation of the countermeasure network in this embodiment employs a pix2pix model.
By using the trained generation countermeasure network model, when the actual AP is 4 antennas, CSI data which exceeds the aperture resolution of 4 antenna arrays and is close to the aperture resolution of 8 antenna arrays can be generated through the trained generation countermeasure network model; compared with the original 4-antenna data (namely, the 4-antenna CSI data obtained in the step 2) which is not subjected to model processing, the data generated by the trained model improves the aperture of the antenna array, reduces the interference of the data, and improves the estimation accuracy of the AOA.
And 5, calculating a path loss model by using the RSSI data of the 4 antennas collected in the step 2 to obtain parameters of the path loss model, namely an expression of the distance d of the transmitting and receiving ends.
Preferably, in this embodiment, the path loss model is a Shadowing model shown in formula (3).
In the formula, R and t are RSSI and path loss factor at the reference distance, respectively, and are calculated by formulas (5) and (4), respectively.
R=abs(RSSI1)-10nlgd1 (5)
Wherein, RSSI1 and RSSI2 are the RSSI data of 4 antennas under the transceiving end distances d1 and d2 obtained in step 2, respectively.
And 6, collecting data to be tested. Specifically, 4-antenna CSI data and RSSI data are collected. Preprocessing the CSI data of the 4 antennas, wherein the preprocessing is data calibration and 0 value insertion operation to obtain preprocessed CSI data of the 4 antennas;
and 7, using the data to be tested obtained in the step 6 for generating a confrontation network model in the step 4 and a path loss model obtained in the step 5, calculating to obtain AOA and RSSI, and combining the AOA and RSSI to obtain the target position.
Step 71, substituting the 4-antenna CSI data in the data to be tested obtained in the step 6 into the trained generation countermeasure network model obtained in the step 4 to obtain processed data, and performing AOA estimation on the processed data to obtain an AOA value;
preferably, in this embodiment, the Music algorithm is adopted to perform AOA estimation on the processed data.
Step 72, using the least square method shown in formula 6 to screen the 4-antenna RSSI data obtained in step 6, and obtaining the 4-antenna RSSI data after screening (i.e. the RSSI with the smallest difference between AOA and RSSI);
the least squares formulation is as follows:
wherein, P and θ respectively represent RSSI data of 4 antennas obtained in step 6 and AOA values obtained in step 7;
and
respectively, the interference-free RSSI and AOA measured by the AP when the environment is clean.
In this step, by calculating a deviation value between the AOA and the RSSI, when the deviation is minimum, the RSSI is finally determined, and optimization of the positioning result is achieved.
And 73, substituting the screened 4-antenna RSSI data obtained in the step 72 into the parameter-determined path loss model obtained in the step 5 to obtain a value of the distance d.
Step 74, selecting one AOA value with smooth distribution from the AOA values obtained in step 71.
And step 75, combining the value of the distance d obtained in the step 73 with the AOA value obtained in the step 74 to obtain the position of the target source, and ending the positioning.
In the invention, the direction of the target source can only be obtained by singly measuring the AOA, the specific position cannot be obtained, and the positioning cannot be carried out when only one access point is used, so the target position is jointly estimated by using the AOA and the RSSI. Since the RSSI is easily affected by the environment, the position of the target source is obtained from the AOA and the RSSI by using the least square estimation, taking the value when the deviation between the AOA and the RSSI is the minimum as the parameter of the position estimation and using the path loss model.
Example (b):
to verify the feasibility and effectiveness of the method of the invention, the invention was tested as follows:
and (3) experimental setting: the number of transmitting end antennas is 1, the number of receiving end equipment antennas is 4 and 8 respectively, the 4 antenna receiving end is responsible for collecting original data, and the 8 antenna receiving end is responsible for collecting real data, namely target data.
Step 1, data are collected. At the receiving end 4, the data is collected every 10 degrees between-60 degrees and 60 degrees, and 3000 data packets are collected each time. This data is used as the original data when training the network; at the receiving end 8, the real data is collected. Between-60 ° and 60 °, data was collected every 10 degrees, 3000 packets at a time, and this data was used as the real target data in training the network.
At 4 antennas, data at the transmitting and receiving ends with distances of 1 meter and 1.5 meters are collected again, and the collection is to obtain a path loss model.
Step 2, preprocessing the data and correcting the phase error of the data; then, the operation of inserting 0 value is performed on the 4-antenna raw data to make the dimension of the raw data match the dimension of the target real data, i.e. the raw data 4 x 48 is interpolated to 8 x 48.
And 3, inputting the data preprocessed in the step 2, and training the generation countermeasure network.
And 4, substituting the RSSI of 1 meter and the RSSI of 1.5 meters according to the formulas (3), (4) and (5) to obtain a path loss model, and solving the values of the parameters R and t.
And step 5, collecting the CSI data and the RSSI data of the antenna to be measured 4 as the data to be measured, and collecting 3000 data packets in total, wherein each data packet comprises the CSI data and the RSSI data. Preprocessing the CSI data of the 4 antennas, wherein the preprocessing is data calibration and 0 value insertion operation to obtain preprocessed CSI data of the 4 antennas;
and 6, testing the trained model by using the 4-antenna CSI data preprocessed in the step 5, inputting the data into a generation countermeasure network to obtain super-resolution output data, performing AOA estimation on the output data by using a Music algorithm to obtain an AOA value, and selecting one AOA value with stable distribution from the AOA values. And (5) screening out an RSSI value meeting the requirement by using a least square method for the RSSI value obtained in the step (5). This RSSI value is input into the path loss model to obtain the distance. And obtaining the position of the target by combining the AOA value and the RSSI.
As can be seen from fig. 3, at 30 °, the mean square error obtained using the method of the present invention (the line at the lower part of the graph) is smaller than the mean square error of the original data localization result (the line at the upper part of the graph).
It will be understood by those skilled in the art that the foregoing is only a preferred embodiment of the present invention, and is not intended to limit the invention, and that any modification, equivalent replacement, or improvement made within the spirit and principle of the present invention should be included in the scope of the present invention.