a problem about setting the channel width of a wifi phy

464 views
Skip to first unread message

松鼠找不到松果

unread,
Dec 19, 2021, 9:25:53 AM12/19/21
to ns-3-users
    hello everyone, I'm trying to change the channel width of my wireless channel but I have some problems now.I read the "ns3 model library" and I find the way to change the channel width as follow:1.png
and then I try to do it just as following:
2.png
but there will be problems after the code runs:
3.png
I am a beginner in ns3,I just want to change the band width of my wireless channel but I dont konw how to do it.It puzzled me for a long time. If you do know how to do it,please reply to me.
Thank you!

Durgesh Kshirsagar

unread,
Dec 20, 2021, 3:17:12 AM12/20/21
to ns-3-users
Config::Set ("/NodeList/*/DeviceList/*/$ns3::WifiNetDevice/Phy/ChannelWidth", UintegerValue (channelWidth));

Set this line after you install the devices to the nodes.

松鼠找不到松果

unread,
Dec 20, 2021, 3:45:39 AM12/20/21
to ns-3-users
Thank you for your reply!
I tried it but it doesn't works...The code can build successfully,but after running, "msg = The channel width does not uniquely identify an operating channel" will return in the terminal. I dont konw what that means and how to correct the code.4.png

Adil Alsuhaim

unread,
Dec 22, 2021, 9:55:02 PM12/22/21
to ns-3-users
The documentation for ChannelWidth attribute says: "Do not set this attribute when the standard and band of this object have "
been already configured, because it cannot uniquely identify a channel in the band being used."

So Config::Set is happening after you have configured the channel. 

What you should do is use YansWifiPhyHelper to set the channel width. So you should do it with the method in your first post. I don't know what message are you getting when you do it using the YansWifiPhyHelper. You may consider specifying the standard with WifiHelper because maybe the default one doesn't support 40 MHz channels. You may try something like this

WifiHelper wifi;
wifi.SetStandard (WIFI_STANDARD_80211ac);

for example

松鼠找不到松果

unread,
Dec 23, 2021, 2:31:07 AM12/23/21
to ns-3-users
Thanks for your reply!
I tried it but unfortunately it doesn't work.I read the ns3-model-library and learned that 802.11ac/ax PHY layer can use either 20, 40, 80 (default) or 160 MHz channel width.So I set 802.11ac as standard,and then I used the function "Set()" of class YansWifiPyhHelper to set the channel width through arrtibute "ChannelWidth".The corresponding code is as follows:

  WifiHelper wifi;
  wifi.SetStandard(WIFI_STANDARD_80211ac);

  YansWifiChannelHelper channel = YansWifiChannelHelper::Default ();
  Ptr<YansWifiChannel> p_channel = channel.Create();
  YansWifiPhyHelper phy;
  phy.Set("ChannelWidth",UintegerValue(40));
  phy.SetChannel(p_channel);
  WifiMacHelper wifiMac;
  wifiMac.SetType("ns3::AdhocWifiMac");
 
  NetDeviceContainer devices = wifi.Install(phy,wifiMac,wifinodes);

My code can build successfully but return the message as follows:
msg="WifiRemoteStationManager selected does not support HT rates", +0.000000000s 0 file=../src/wifi/model/rate-control/arf-wifi-manager.cc, line=92
terminate called without an active exception

(Haha,actually I m not not very clear about how  YansWifiPhyHelper works. It is so complicated.)

Reply all
Reply to author
Forward
0 new messages