WifiPhy: Not changing channel width during runtime

126 views
Skip to first unread message

Michael Rademacher

unread,
Nov 30, 2017, 12:12:21 PM11/30/17
to ns-3-users
Hey everybody, 

I am a little bit confused and would appreciate some help. I am currently using ns.3.27. 

My goal is to change the Wifi channel (and the width!) of two wifiphy during runtime. The expected outcome is that with a 40 MHz channel (compared to 20 MHz channel) the phy-rate should increase. 

Therefore I schedule a function like this in the middle of my simulation. 

Simulator::Schedule(Seconds(simulationTime-5), &ChangeFrequencyLocal, devices, 38);


In particular, I use channel 38 here, to change to a channel/width pair using 40 MHz. (btw. setting frequency and width directly leads to the same results)
The function looks like this:

void ChangeFrequencyLocal (NetDeviceContainer deviceslink, uint8_t channel){
for (uint32_t i = 0; i < deviceslink.GetN (); i++)
 
{
 
Ptr<WifiNetDevice> wifidevice = DynamicCast<WifiNetDevice> (deviceslink.Get(i));
 
Ptr<WifiPhy> phy0 = wifidevice->GetPhy();
 phy0
->SetChannelNumber (channel);
 
//phy0->SetFrequency (5190); Makes no difference
 
//phy0->SetChannelWidth (40); Makes no difference
 std
::cout << "Changed channel on " << deviceslink.Get (i)->GetAddress () << " to: "
 
<< channel << std::endl;
 
}

The log output looks good:

+5.000000000s -1 WifiPhy:DoChannelSwitch(): switching channel 36 -> 38
+5.000000000s -1 WifiPhy:SetChannelNumber(): Setting frequency to 5190; width to 40
Changed channel on 06-06-00:00:00:00:00:02  to:  &
+5.000000000s -1 WifiPhy:DoChannelSwitch(): switching channel 36 -> 38
+5.000000000s -1 WifiPhy:SetChannelNumber(): Setting frequency to 5190; width to 40
Changed channel on 06-06-00:00:00:00:00:01  to:  &

So the WiFiPhy conducted a channel switch!?

But:
- The .pcap log files show that just the channel switched. The width stays the same at 20 MHz. Therefore, the phy-rate does not change. Perhaps just some .pcap issue?
- In a larger project, I am unable to obtain any throughput gain when I change the frequency to a 40 MHz channel during runtime. However, there is a significant throughput gain when I set the interface to 40 MHz before! the simulation starts (not my goal). 
- The same results occur for YansWifiPhy and SpectrumWiFiPhy.

Summary: It looks like the DoChannelSwitch function does change  the channel but not the width?

I attached a minimal example to show this issue. 

I am happy about any comments on this before I dig deep into debugging this issue. 

With kind regards, 
Michael






channel-switch-minimal.cc

Tom Henderson

unread,
Nov 30, 2017, 1:25:26 PM11/30/17
to ns-3-...@googlegroups.com
Thanks for providing an easily reproducible test case.

I think what is going on here is the following.  The local WifiPhy is indeed changing its ChannelWidth configuration.  However, when it is time to send a packet, the WifiRemoteStationManager gets involved in picking the WifiTxVector.  The remote station manager maintains state about what each peer is able to support.

This method gets called:

uint8_t
WifiRemoteStationManager::GetChannelWidth (const WifiRemoteStation *station) const
{
  return station->m_state->m_channelWidth;
}

and it is based on m_state which has not changed and still selects 20 MHz.  So upon this runtime operation, there has to be some flushing of state (to be determined how to do this...) at the higher layers.

I'll open a bug report on this.

- Tom

Michael Rademacher

unread,
Dec 1, 2017, 3:48:13 AM12/1/17
to ns-3-users
Thanks Tom! 

I will monitor the bug report. For future reference, here is the corresponding link:

Reply all
Reply to author
Forward
0 new messages