Bug 2784 - Wrong calculation of noisefloor, snr and bandwidth
Wrong calculation of noisefloor, snr and bandwidth
Status: RESOLVED DUPLICATE of bug 2783
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3.26
All All
: P3 major
Assigned To: sebastien.deronne
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2017-09-21 11:08 EDT by Izydor Sokoler
Modified: 2017-09-26 02:43 EDT (History)
2 users (show)

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Izydor Sokoler 2017-09-21 11:08:25 EDT
I found several mistakes in relation to the spectrumwifi:

The test example :wifi-spectrum-per-example.cc has been the basis for this investigation:


a) I set the channel Number (to 36 or 38) in order to switch between 20 Mhz and 40 Mhz bandwidth. The way it is done in the test doesn't work.


b) There are mistakes in the way the noisefloor is calculates in the modules:

spectrum-wifi-phy.cc  and yans-wifi-phy.cc 

the following code:
signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) - GetRxNoiseFigure () + 30  

is incorrect and should be changed to:
 
signalNoise.noise = RatioToDb (event->GetRxPowerW () / snrPer.snr) + 30;

Therefore the result reported back fra the MonitorSniffRx is incorrect and independant of the RXNoise figure. With the fix it works.

c) In the spectrum-wifi-phy.cc , in line 411 the (WifiPhyTag tag;) will reset the txVector to the intial values (via the contructor in the Objectbase), and therefore the SNR calculations will be done at 20Mhz bandwidth independently of the setting to channel 38 for the SpectrumWifyPhy case.


best regards
Izydor
Comment 1 sebastien.deronne 2017-09-21 11:12:11 EDT
Is this not a duplicate of 2783?
Comment 2 sebastien.deronne 2017-09-21 11:13:57 EDT
(In reply to sebastien.deronne from comment #1)
> Is this not a duplicate of 2783?

b is for sure duplicate of 2783.
If other bugs, please create one thread per issue.
Comment 3 Izydor Sokoler 2017-09-21 11:38:17 EDT
Yes this is partly a duplicate of the 2783. However, I had not enlisted to Bugzilla at that point in time (so Tom H. filed it for me), and there are other bugs reported here.
But I will of course follow your guideline and report each bug separately in the future.
Thanks
Comment 4 sebastien.deronne 2017-09-21 12:44:25 EDT
Can you please decouple this bug already, so that I can start looking at each piece?
Comment 5 Tom Henderson 2017-09-21 13:06:27 EDT
(In reply to Izydor Sokoler from comment #0)

> 
> c) In the spectrum-wifi-phy.cc , in line 411 the (WifiPhyTag tag;) will
> reset the txVector to the intial values (via the contructor in the
> Objectbase), and therefore the SNR calculations will be done at 20Mhz
> bandwidth independently of the setting to channel 38 for the SpectrumWifyPhy
> case.


Regarding this, the reference is to ns-3.26 code (the current ns-3-dev location of this code is wifi-phy.cc:2381).

  WifiPhyTag tag;
  bool found = packet->PeekPacketTag (tag);
  if (!found)
    {
      NS_FATAL_ERROR ("Received Wi-Fi Spectrum Signal with no WifiPhyTag");
      return;
    }

  WifiTxVector txVector = tag.GetWifiTxVector ();

I think this bug report may be invalid because the PeekPacketTag uses 'tag' as an output, not input parameter.  See:

  bool PeekPacketTag (Tag &tag) const;

and the initial values are never used since a fatal error will occur if the tag is not found and overwritten.  Suggest to disregard this portion of the bug report unless there is some data to suggest it is not working.
Comment 6 Tom Henderson 2017-09-21 14:02:36 EDT
(In reply to Izydor Sokoler from comment #0)
> I found several mistakes in relation to the spectrumwifi:
> 
> The test example :wifi-spectrum-per-example.cc has been the basis for this
> investigation:
> 
> 
> a) I set the channel Number (to 36 or 38) in order to switch between 20 Mhz
> and 40 Mhz bandwidth. The way it is done in the test doesn't work.
> 

Regarding this point, I can confirm that the following do not have an effect on program output.

$ ./waf --run 'wifi-spectrum-per-example --ns3::WifiPhy::ChannelWidth=40'

or 

$ ./waf --run 'wifi-spectrum-per-example --ns3::WifiPhy::ChannelNumber=38'

however, this is because the program overrides default values.  If 40 MHz is instead selected via:

$ ./waf --run 'wifi-spectrum-per-example --index=16'

the output is changed to:

wifiType: ns3::SpectrumWifiPhy distance: 50m; sent: 1000 TxPower: 1 dBm (1.3 mW)
index   MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm)  SNR (dB)
   16     0      13.5     11.9579   15378    -79.6633    -90.9557     11.2924

compared to when MCS 0 20 MHz is used:

wifiType: ns3::SpectrumWifiPhy distance: 50m; sent: 1000 TxPower: 1 dBm (1.3 mW)
index   MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm)  SNR (dB)
    0     0       6.5     5.76513    7414    -79.6633     -93.966     14.3027


So I don't think there is a bug here; I think it is the way the program is designed to work.  From the comments:

// By default, the program will step through 32 index values, corresponding
// to the following MCS, channel width, and guard interval combinations:
//   index 0-7:    MCS 0-7, long guard interval, 20 MHz channel
//   index 8-15:   MCS 0-7, short guard interval, 20 MHz channel
//   index 16-23:  MCS 0-7, long guard interval, 40 MHz channel
//   index 24-31:  MCS 0-7, short guard interval, 40 MHz channel
// and send 1000 UDP packets using each MCS, using the SpectrumWifiPhy and the
// NistErrorRateModel, at a distance of 50 meters.
Comment 7 Izydor Sokoler 2017-09-21 15:43:11 EDT
Hi again

This is strange because when I run exactly the same command as you do, I get the following results:


./waf --run 'wifi-spectrum-per-example --index=0'

index   MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm)  SNR (dB)
    0     0       6.5      0.7776    1000    -77.6633     -93.966     16.3027


./waf --run 'wifi-spectrum-per-example --index=16'  :


 index   MCS Rate (Mb/s) Tput (Mb/s) Received Signal (dBm) Noise (dBm)  SNR (dB)
   16     0      13.5      0.7776    1000    -77.6633     -93.966     16.3027


As you can see, I don't get any effect on the noise floor as you do.
Your results look correct.

I have downloaded the version 3.26, but I wonder if you have another version of the testfile (wifi-spectrum-per-example.cc than I do) ?


regards
Izydor
Comment 8 Tom Henderson 2017-09-21 15:56:26 EDT
(In reply to Izydor Sokoler from comment #7)
> Hi again
> 
> This is strange because when I run exactly the same command as you do, I get
> the following results:

Can you retry with ns-3-dev and the patch to bug 2783 included?  Sorry, I should have clarified that.
Comment 9 Izydor Sokoler 2017-09-21 16:14:02 EDT
Hi again

I am quite new to ns3, so I am not sure how I can download the ns-3-dev version ?

This is how I get the tar file right now:
wget http://www.nsnam.org/release/ns-allinone-3.26.tar.bz2


regards
Izydor
Comment 10 Izydor Sokoler 2017-09-21 17:37:02 EDT
Hi again

I succeeded in downloading the ns-3-dev version, and I can confirm that it works now, when I include the 2783 bug solution - great !!

Thanks
Izydor
Comment 11 Tom Henderson 2017-09-25 18:58:58 EDT
I believe that this can be closed (duplicate of 2783) if no other comments.
Comment 12 Izydor Sokoler 2017-09-26 02:07:35 EDT
Hi again
Yes - this can be closed now - thanks.
Izydor
Comment 13 sebastien.deronne 2017-09-26 02:43:02 EDT

*** This bug has been marked as a duplicate of bug 2783 ***