【问题标题】:Omnet++ / INET : How to get RSSI from 802.11 NIC?Omnet++ / INET:如何从 802.11 NIC 获取 RSSI?
【发布时间】:2017-06-16 13:28:19
【问题描述】:

我正在节点模型中实现无线路由协议,该协议使用类型为 Ieee80211Nic 的网络接口卡,并设置为在 ad-hoc 模式 (Ieee80211MgmtAdhoc) 下工作。我想使用来自 NIC 的 RSSI 值作为路由协议中的指标之一。
如何从 NIC 检索特定邻居节点(由其 MAC 地址标识)的 RSSI 值?

编辑

在 INET 3.6 源代码中进行了一番挖掘后,我发现 ieee80211NIC 组件由以下模块(或层)组成(自上而下):

  • 代理(仅在工作站 STA 的基础架构模式下使用)
  • mgmt(可以是 Ieee80211MgmtAP、Ieee80211MgmtSTA、Ieee80211MgmtAdhoc 类型)
  • mac
  • 收音机

我进一步分析了ieee80211MgmtSTA源码,发现它实现了如下方法,记录接收到的信号强度(bss.setRxPower(ap->rxPower) ):

void Ieee80211MgmtSTA::sendScanConfirm()
{
    EV << "Scanning complete, found " << apList.size() << " APs, sending confirmation to agent\n";

    // copy apList contents into a ScanConfirm primitive and send it back
    int n = apList.size();
    Ieee80211Prim_ScanConfirm *confirm = new Ieee80211Prim_ScanConfirm();
    confirm->setBssListArraySize(n);
    auto it = apList.begin();
    //XXX filter for req'd bssid and ssid
    for (int i = 0; i < n; i++, it++) {
        APInfo *ap = &(*it);
        Ieee80211Prim_BSSDescription& bss = confirm->getBssList(i);
        bss.setChannelNumber(ap->channel);
        bss.setBSSID(ap->address);
        bss.setSSID(ap->ssid.c_str());
        bss.setSupportedRates(ap->supportedRates);
        bss.setBeaconInterval(ap->beaconInterval);
        bss.setRxPower(ap->rxPower);
    }
    sendConfirm(confirm, PRC_SUCCESS);
}

但是,在 Ieee80211MgmtAdhoc 类型的情况下,不会执行通道扫描(由代理模块控制)。因此,无法检索特定节点的 Rx Power。

有没有人设法在 Adhoc 模式下实现带有频道扫描的代理模块?
还是有其他方法可以获取 RSSI 信息?

【问题讨论】:

  • ad-hoc管理模块的实现实际上是相当有限的。我正在考虑进行以下更改以启用 RSSI 的读取: 1. 将信标广播添加到 ieee80211MgmtAdhoc 类; 2. 增加一个表格,用于保存相邻节点的RSSI等级; 3. 修改 SNIRReceiverBase 类(在无线电模块中)中的 computeReceptionIndication() 方法,将 RSSI 读数添加到附加到 MAC 帧的 ReceptionIndication 结构中。 >> 这个想法是从信标帧中读取 RSSI 并将其添加到邻居节点表中

标签: omnet++ inet


【解决方案1】:

那么,你的工作完成了吗?
众所周知,存在一种记录接收信号强度的实现方法bss.setRxPower(ap-&gt;rxPower)
但是在同一个文件中,我们可以发现 ap 的变量在 storeAPInfo(const MACAddress&amp; address, const Ieee80211BeaconFrameBody&amp; body) 的函数处是初始的。
见下文:

void Ieee80211MgmtSTA::storeAPInfo(const MACAddress& address, const Ieee80211BeaconFrameBody& body)
{
    APInfo *ap = lookupAP(address);
    if (ap) {
        EV << "AP address=" << address << ", SSID=" << body.getSSID() << " already in our AP list, refreshing the info\n";
    }
    else {
        EV << "Inserting AP address=" << address << ", SSID=" << body.getSSID() << " into our AP list\n";
        apList.push_back(APInfo());
        ap = &apList.back();
    }

    ap->channel = body.getChannelNumber();
    ap->address = address;
    ap->ssid = body.getSSID();
    ap->supportedRates = body.getSupportedRates();
    ap->beaconInterval = body.getBeaconInterval();
    //XXX where to get this from?
    //ap->rxPower = 。。。
}

我们可以看到,ap->rxPower 没有初始值,这意味着我们在sendScanConfirm() 的函数中得到的值将始终为零。那么,还有其他获取RSSI的方法吗?

【讨论】:

    【解决方案2】:

    深入源码后,发现了一个有趣的函数

     bool computeIsReceptionPossible(const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part) const
    

    在 FlatReceiverBase 文件中,哪个路径可以是“#include”inet/physicallayer/base/packetlevel/FlatReceiverBase”。见下文:

    bool FlatReceiverBase::computeIsReceptionPossible(const IListening *listening, const IReception *reception, IRadioSignal::SignalPart part) const
    {
        if (!NarrowbandReceiverBase::computeIsReceptionPossible(listening, reception, part))
            return false;
        else {
            const FlatReceptionBase *flatReception = check_and_cast<const FlatReceptionBase *>(reception);
            W minReceptionPower = flatReception->computeMinPower(reception->getStartTime(part), reception->getEndTime(part));
            bool isReceptionPossible = minReceptionPower >= sensitivity;
            EV_DEBUG << "Computing whether reception is possible: minimum reception power = " << minReceptionPower << ", sensitivity = " << sensitivity << " -> reception is " << (isReceptionPossible ? "possible" : "impossible") << endl;
            return isReceptionPossible;
        }
    }
    

    所以,我们可以发现,在这个函数中,我们可以通过 minReceptionPower 变量获得接收功率。然后,我们可以使用嵌入式数学算子 mW2dBm 将接收功率转换为 RSSI 值。 注意,如果追根溯源,我们可以发现这个模块是在 ieee80211Radio 模块初始化的。 希望对遇到同样问题的人有所帮助。

    【讨论】:

      猜你喜欢
      • 2019-08-23
      • 1970-01-01
      • 1970-01-01
      • 2017-06-25
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 2012-06-01
      • 1970-01-01
      相关资源
      最近更新 更多