-
Notifications
You must be signed in to change notification settings - Fork 51
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Cannot understand the meaning of the amplitude. #9
Comments
Hi Colin, Thanks for your issue, I really appreciate any opportunity to see how people want to use this library.
Fully reversing the scaling which occurs on the Intel IWL5300 is possible thanks the the calculations provided in the linked script. The Linux 802.11n CSI Tool data format includes the values used for the AGC in the Intel driver, while the script also includes some constants used by Intel within their code. We don't have quite the same luxuries when it comes to Broadcom CSI data produced by The scaled option on the Let me know if you have any further questions (or corrections!). |
Thanks for your answers, it completely answered my questions. I am using the Raspberry pi to collect CSI for activity detection, so I need to make sure the CSI value correct. My dataset was collected using this branch. As you mentioned
|
Unfortunately that branch is based on the core |
@Gi-z Thanks for your help. I did some experiments, e.g., increasing the distance between two Rasp pi from 1m to 10m, the amplitude of the CSI almost the same due to the compensation of the AGC, even when the distance is fixed, the amplitude value may vary a lot as well. As you mentioned,
Since I would like to keep the distance information between transmitter and receiver, and I hope it wouldn't introduce too much error information to my data. Therefore, I wonder:
Thanks in advance, your help would be valuable for me. |
Hi Colin, I had a brief look into this.
|
Hi Glenn. Thanks for sharing this wonderful paper, I am reading this paper now, it seems valuable to our research, looking forward to hearing from you. Thanks a lot. |
Hi Colin, I've been looking into this quite a bit, definitely having trouble proving that the CRISLoc method does in fact reverse the AGC in any way. Their paper refers to Figure 5 as proof, which isn't something easily reproducible. They do have their data publicly available, however the CSI values aren't in their complex form and I'm having difficulty assessing what they've done with them in the first place. They do supposedly provide Their key assumption relies on "...the sum of CSI squared over all the subcarriers should be consistent with RSS.". This seems like the best place to start in proving this approach. I've had little success so far in actually proving these two metrics are in any way correlated, using data examples from Intel IWL5300 and the Pi 4 (BCM43455c0). However, with the ESP32, I've been able to visualise some form of pattern. I captured CSI on the ESP32 with a packet generator at the other side of the room, and moved towards the generator and back 3 times.
There does indeed seem to be a pattern here, and it's notable that while the sum of the squares of CSI usually remains in some way consistent, it does in fact spike when I move closer to the packet generator. It may be worth moving this discussion to the |
My understanding to this assumption from the paper, is that, the sum of squared of real CSI (before AGC) is consistent with RSS, but with the scaling of the AGC, the amplitude of the sum of squared CSI should remain relatively stable when you move your pi away or close to the transmitter. |
Following the above thread I am trying to visualize the CSI (esp32 data) as you have shown in the visualizations. Could you share the code so I could complete the visualization? |
Hi, yes, I'll provide both code and the data used for this example. from CSIKit.reader import CSVBeamformReader
from CSIKit.util.matlab import db, dbinv
import matplotlib.pyplot as plt
import numpy as np
def scale_csi_frame(csi: np.array, rssi: int) -> np.array:
# This is not a true SNR ratio as is the case for the Intel scaling.
# We do not have agc or noise values so it's just about establishing a scale against RSSI.
# TODO: Find out whether it's RSS or RSSI being supplied with most CSI Frames.
# I thought RSSI wasn't negative?
subcarrier_count = csi.shape[0]
rssi_pwr = dbinv(int(rssi))
csi_sq = np.multiply(csi, np.conj(csi))
csi_pwr = np.sum(csi_sq)
csi_pwr = np.real(csi_pwr)
# This implementation is based on the equation shown in https://doi.org/10.1109/JIOT.2020.3022573.
# scaling_coefficient = sqrt(10^(RSS/10) / sum(CSIi^2))
scale = rssi_pwr / (csi_pwr / subcarrier_count)
return csi * np.sqrt(scale)
reader = CSVBeamformReader()
csi_data = reader.read_file("rss_test.csv")
rssis = [x.rssi for x in csi_data.frames]
sub1_data_unscaled = [db(abs(x.csi_matrix[-1])) for x in csi_data.frames]
sub1_data_scaled = [db(abs(scale_csi_frame(x.csi_matrix, x.rssi)[-1])) for x in csi_data.frames]
plt.title("Sub1 Unscaled")
plt.plot(sub1_data_unscaled)
plt.show()
plt.title("RSS")
plt.plot(rssis)
plt.show()
plt.title("Sub1 Scaled")
plt.plot(sub1_data_scaled)
plt.show() |
There is good reason to believe that AGC process is being reversed with the CRISLoc method, however without a measure of CSI before AGC has been applied there isn't definitive proof. I've got a couple of experiments planned to test this out, however it'll be a little while before I can get the proper equipment. Hoping to have something on this soon. I'll implement CRISLoc scaling as an optional feature in CSIKit shortly. Going to close this issue now, but feel free to re-open and/or let me know if there's anything else I can clear up. |
Thanks for your work, I am using your library to read CSI packets generated from Nexmon CSI, but I have some questions about the data.
scaled
toTrue
,csi_data = my_reader.read_file("DATASET-pi-2\Empty-21.pcap", scaled=True)
. Could you explain how is the scale works?Thanks in advance!!
The text was updated successfully, but these errors were encountered: