802.11 MAC - Modify CW

72 views
Skip to first unread message

Sampath

unread,
Jul 11, 2017, 9:29:08 PM7/11/17
to ns-3-users
Hi Everyone,

I am trying to change the contention window (CW) size of 802.11 MAC protocol and observe the changes in the throughput. 
My topology is a simple infrastructure Wifi. One AP and several STAs.

I tried the following options

1) Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Mac/$ns3::RegularWifiMac/DcaTxop/MinCw", UintegerValue (7));

2) Ptr<NetDevice> dev1 = wifiApNode.Get (0)->GetDevice (0);
  Ptr<WifiNetDevice> wifi_dev1 = DynamicCast<WifiNetDevice> (dev1);
  Ptr<WifiMac> wifi_mac1 = wifi_dev1->GetMac ();
  PointerValue ptr1;
  wifi_mac1->GetAttribute("DcaTxop", ptr1);
  Ptr<DcaTxop> dca1 = ptr1.Get<DcaTxop>();
  dca1->SetMinCw(7);
  dca1->SetMaxCw(1023);

However none of these worked. Could you please give me some ideas on how to do this?

Thanks in advance.
Sampath

Rediet

unread,
Jul 12, 2017, 3:19:09 AM7/12/17
to ns-3-users
Hello Sampath,

It's odd because if you perform this once the RegularWifiMac objects have been instantiated (i.e. once WifiHelper::Install has been called), you should be able to modify these parameters.
Could you please join a simplified script for the first option?

BR,

Rediet

Sampath

unread,
Jul 12, 2017, 7:12:23 PM7/12/17
to ns-3-users
Hi Rediet,

Thank you for the quick reply. I think I found the problem. 
Both the methods are working.
Problem was in the time resolution. Time resolution was not small enough to reflect the changes in the throughput.
So I increased the number of users. Now I can observe the effects.
Thanks again

Regards,
Sampath
Reply all
Reply to author
Forward
0 new messages