Bug 679 - channel switching causes error
channel switching causes error
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: devices
ns-3-dev
All All
: P3 major
Assigned To: Mathieu Lacage
: bug
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-09-18 13:25 EDT by Michael Nowatkowski
Modified: 2010-02-11 23:52 EST (History)
4 users (show)

See Also:


Attachments
Can't reproduce (475 bytes, application/octet-stream)
2010-01-11 09:09 EST, Pavel Boyko
Details

Note You need to log in before you can comment on or make changes to this bug.
Description Michael Nowatkowski 2009-09-18 13:25:18 EDT
I am using the latest dev version of ns-3. 

I added the following lines into third.cc to see if I can figure out 
how to use ChannelNumber: 
insert at line 86 (above the phy.SetChannel (channel.Create ()); line: 
YansWifiPhy testCN; 
testCN.SetChannelNumber (1000); 


When I do this I get an error: 
"assert failed. file=../src/devices/wifi/wifi-phy-state-helper.cc, 
line=379, cond="IsStateSwitching()" 
line 379 is NS_ASSERT(IsStateSwitching()); 


I checked in yans-wifi-phy.cc for the same assert, and on line 311 it 
is NS_ASSERT(!IsStateSwitching()); 


When I added the ! to line 379 of wifi-phy-state-helper.cc so that it 
would be the same as line 311 of yans-wifi-phy.cc, the error went 
away. 


I'm not sure if I did something wrong with my attempt at using 
ChannelNumber, or if the ! got lost.
Comment 1 Pavel Boyko 2010-01-11 09:09:12 EST
  Sorry, can't reproduce on current ns-3-dev. Patch according to your description attached below. Please check that bug still exist.  

(In reply to comment #0)
> I am using the latest dev version of ns-3. 
> 
> I added the following lines into third.cc to see if I can figure out 
> how to use ChannelNumber: 
> insert at line 86 (above the phy.SetChannel (channel.Create ()); line: 
> YansWifiPhy testCN; 
> testCN.SetChannelNumber (1000); 
> 
> 
> When I do this I get an error: 
> "assert failed. file=../src/devices/wifi/wifi-phy-state-helper.cc, 
> line=379, cond="IsStateSwitching()" 
> line 379 is NS_ASSERT(IsStateSwitching()); 
> 
> 
> I checked in yans-wifi-phy.cc for the same assert, and on line 311 it 
> is NS_ASSERT(!IsStateSwitching()); 
> 
> 
> When I added the ! to line 379 of wifi-phy-state-helper.cc so that it 
> would be the same as line 311 of yans-wifi-phy.cc, the error went 
> away. 
> 
> 
> I'm not sure if I did something wrong with my attempt at using 
> ChannelNumber, or if the ! got lost.
Comment 2 Pavel Boyko 2010-01-11 09:09:50 EST
Created attachment 716 [details]
Can't reproduce
Comment 3 Michael Nowatkowski 2010-01-13 13:26:05 EST
I think this may have been a case of trying to change channels when the sender was sending.  As far as I can tell, that will still cause an assert error in the code.  I'm not sure if there is a way to allow channel switching to be scheduled even when a node is sending, even if you let the node finish sending and then switch the channel.

Michael
Comment 4 Josh Pelkey 2010-02-11 15:44:46 EST
(In reply to comment #3)
> I think this may have been a case of trying to change channels when the sender
> was sending.  As far as I can tell, that will still cause an assert error in
> the code.  I'm not sure if there is a way to allow channel switching to be
> scheduled even when a node is sending, even if you let the node finish sending
> and then switch the channel.
> 
> Michael

Michael,

Can you verify that this is still a problem?  Based on your first post, I can't reproduce the assert either.  After looking at the code (again), it seems like the asserts are correct.  In wifi-phy-state-helper, the assert is making sure that we are in the switching state, since that is the task of the method. In yans-wifi-phy, the assert is making sure that we *aren't* in the switching state as we are trying to switch now (and trying to switch in the middle of switching, I guess isn't a good idea).
Comment 5 Michael Nowatkowski 2010-02-11 22:52:08 EST
I'm not sure what caused the original problem, I can't reproduce it either.  I was getting the assert in another situation, but there was an error in my program.  I was trying to change to two channels at the same time.

Michael