Wifi link quality estimation using NS3

276 views
Skip to first unread message

Kiran Mathews

unread,
Nov 7, 2017, 5:44:06 AM11/7/17
to ns-3-users
Hai everyone,

I am new to ns3 simulation. I have some questions regarding wireless module (I already posted a question which was more specific, here im explaining my target in details). Here is what im trying to do:

What i required ?


I need to measure the link quality of wireless links. To achieve this, I need to setup the topology. I.e the location of each nodes. Then, each node broadcasts frames at a fixed transmission power. On the receiver, the nodes will check the RSS and determine the link quality.

What I have done

I setup the topology and sending the frames with a fixed transmission power. Here is the main code part:

        YansWifiChannelHelper wchanHelp = YansWifiChannelHelper::Default();
        wchanHelp.SetPropagationDelay ("ns3::ConstantSpeedPropagationDelayModel");
        wchanHelp.AddPropagationLoss ("ns3::LogDistancePropagationLossModel",
                                      "Exponent", DoubleValue (3.0));
           Ptr<YansWifiChannel> wifiChannel = wchanHelp.Create();
        // setup of channel finished !

        // 4: Physical layer [WifiPhy] statehelper class for WiFiphy
        // select physical layer and connect to channel
        YansWifiPhyHelper phyHelper = YansWifiPhyHelper::Default();
        // all phydevices created by phyHelper should use this wifi channel to communicate -> bonding
        phyHelper.SetChannel(wifiChannel);
        phyHelper.Set ("ChannelNumber", UintegerValue (3));
        phyHelper.Set ("TxPowerStart", DoubleValue (1)); // dBm (1.26 mW)
        phyHelper.Set ("TxPowerEnd", DoubleValue (1)); // dBm (1.26 mW)

        // PCAP using radio tap headers
        phyHelper.SetPcapDataLinkType(YansWifiPhyHelper::DLT_IEEE802_11_RADIO);



        // 2 : Higher MAC [WifiMac]
        // Set it to adhoc mode configure High Mac Layer, and disable rate control (i.e. ConstantRateWifiManager)
        // ns3::AdhocWifiMAC, does not generate beacons or send probs
        NqosWifiMacHelper wifiMacHelper = NqosWifiMacHelper::Default ();
        wifiMacHelper.SetType ("ns3::AdhocWifiMac");


        WifiHelper wifiHelper;
        wifiHelper.SetStandard (WIFI_PHY_STANDARD_80211b);
        wifiHelper.SetRemoteStationManager ("ns3::IdealWifiManager", "DefaultTxPowerLevel", UintegerValue (10));
        std::string speed = "11Mbps";
        std::string phyMode ("DsssRate"+ speed);
        wifiHelper.SetRemoteStationManager ("ns3::ConstantRateWifiManager",
                                            "DataMode",StringValue (phyMode),
                                            "ControlMode",StringValue (phyMode));



What I need


I need to get the RSS at each node depending on the position. I was using radiotap header information to get this data. But the structure changed in from ns3 3.20 and I am unable to fetch any tag... So my question is, how can i get the RSS and other information of a packet received?? Below is the old working code inside receiveFrame callback function :

       // extract information from radiotap header
    auto it = packet->GetPacketTagIterator();
    while(it.HasNext()){
        NS_LOG_DEBUG("THERE IS TAG");
        auto t = packet->GetByteTagIterator().Next();
        if(t.GetTypeId() == RadiotapHeaderTag::GetTypeId()){
            NS_LOG_DEBUG("Radiotap-Header tag found .... extracting");
            RadiotapHeaderTag tag;;
            t.GetTag(tag);
            extractRadiotapHeaderTag(tag); // Just a function to copy rt headers
            break;
        }
    }


Tommaso Pecorella

unread,
Nov 11, 2017, 6:28:59 PM11/11/17
to ns-3-users
Hi,

the MonitorSnifferRx trace reports also the signal to noise ratio. Mind that it is a promiscuous rx, i.e., you'll need to filter by yourself the packets that are belonging to you.

T.

kiran mathews

unread,
Nov 13, 2017, 5:49:05 AM11/13/17
to ns-3-users
Hallo Tommaso,

Thanks for the information. Meanwhile I posted a different question regarding WifiPhy class and I got similar answer. It would be nice if you look into that post.

https://groups.google.com/forum/#!topic/ns-3-users/Qxxzk22qv_w

By the way, I like to know why there is no radiotap header tag ? when I check for tag inside the ReceiveCallback,  packet->GetPacketTagIterator() can't find any tag from version 3.20.

Thanks

Tommaso Pecorella

unread,
Nov 14, 2017, 6:57:42 AM11/14/17
to ns-3-users
RadioTap was removed a while ago, if I remember right.

T.
Reply all
Reply to author
Forward
Message has been deleted
0 new messages