如何将WiFi信号强度从质量(百分比)转换为RSSI(dBm)?

如何将WiFi信号强度从质量转换为RSSI值(通常为负dBm数字(即-96db))的百分比通常为0%至100%?
Wifi信号强度百分比RSSI dBm

微软将其WLAN_ASSOCIATION_ATTRIBUTES结构中的Wifi信号质量定义如下:

wlanSignalQuality:

A percentage value that represents the signal quality of the network.
WLAN_SIGNAL_QUALITY is of type ULONG. This member contains a value
between 0 and 100. A value of 0 implies an actual RSSI signal strength
of -100 dbm. A value of 100 implies an actual RSSI signal strength of
-50 dbm. You can calculate the RSSI signal strength value for
wlanSignalQuality values between 1 and 99 using linear interpolation.

RSSI(或“无线电(接收)信号强度指示器”)以“dB”(分贝)或类似的“dBm”(dB /毫瓦)(见dB vs. dBm)为单位,其中较小的幅度负数具有最高的信号强度,或质量.

因此,质量(百分比)和dBm之间的转换如下:

quality = 2 * (dBm + 100)  where dBm: [-100 to -50]

    dBm = (quality / 2) - 100  where quality: [0 to 100]

伪代码(带示例钳位):

// dBm to Quality:
    if(dBm <= -100)
        quality = 0;
    else if(dBm >= -50)
        quality = 100;
    else
        quality = 2 * (dBm + 100);

    // Quality to dBm:
    if(quality <= 0)
        dBm = -100;
    else if(quality >= 100)
        dBm = -50;
    else
        dBm = (quality / 2) - 100;

注意:

仔细检查您正在使用的质量定义.还要检查dB(或dBm)的范围.限制可能会有所不同.

例子:

06002

相关文章
相关标签/搜索