Bug 2843 - Incorrect channel width and center frequency provided for non-HT PPDUs when building SpectralDensity
Incorrect channel width and center frequency provided for non-HT PPDUs when b...
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3.27
All All
: P3 normal
Assigned To: sebastien.deronne
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2018-01-04 11:08 EST by Rediet
Modified: 2018-01-15 04:40 EST (History)
2 users (show)

See Also:


Attachments
Proposed patch (based on 35b461a12b26 of Dec 30 2017) (8.18 KB, patch)
2018-01-04 11:08 EST, Rediet
Details | Diff
Updated patch (still based on 35b461a12b26 of Dec 30 2017) (20.56 KB, patch)
2018-01-09 04:52 EST, Rediet
Details | Diff
2nd update of patch (still based on 35b461a12b26 of Dec 30 2017) (25.65 KB, patch)
2018-01-10 05:43 EST, Rediet
Details | Diff
3rd update of patch (based on 35b461a12b26 of Dec 30 2017) (25.31 KB, patch)
2018-01-10 09:03 EST, Rediet
Details | Diff
New update (based on 35b461a12b26 of Dec 30 2017) (25.47 KB, patch)
2018-01-12 03:59 EST, Rediet
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Rediet 2018-01-04 11:08:17 EST
Created attachment 2988 [details]
Proposed patch (based on 35b461a12b26 of Dec 30 2017)

SpectrumWifiPhy::StartTx calls GetTxPowerSpectralDensity using GetChannelWidth
even for non-HT/VHT/HE OFDM, which returns the total width supported by the
WifiPhy. The same SpectrumModel is reused for HT/VHT and non-HT/VHT OFDM
transmissions (HE is apart since it doesn't use the same intertone spacing).
However, the primary channel ends up being the lowest 20 MHz channel (which is
not always true).
If we substitute txVector.GetChannelWidth (current) for GetChannelWidth
(supported) when calling GetTxPowerSpectralDensity, a problem arises since the
provided center frequency is no longer correct; it still corresponds to the
supported channel width. It should be adapted to the reduced 20 MHz band, and
specifically to the primary channel's (ideally according to the standard's
sophisticated primary/secondary logic).

Also note that this implies using the MultiModelSpectrumChannel (since it supports SpectrumModel conversions whereas SingleModelSpectrumChannel doesn't).

The attached patch enables to generate a PSD of correct size when falling back to vanilla OFDM.
Comment 1 Tom Henderson 2018-01-04 16:06:10 EST
OK, I agree with the patch.  After patching, should we keep open with the issue that the primary channel is not always correct?

We should probably put some regression tests in as well.
Comment 2 Rediet 2018-01-05 06:12:07 EST
Thanks Tom. I also think that it would be good to keep track of it.
I'll try to write a couple of tests on this subject and update the patch.
Comment 3 sebastien.deronne 2018-01-05 07:04:36 EST
I do not really like the idea to post process the tx vector in AdjustChannelWidthToMode. IMO it should be possible to directly return the correct channel width in the wifi manager. Or am I missing something?
Comment 4 Rediet 2018-01-05 07:43:21 EST
You're right, better keep it within WifiRemoteStationManager. At first sight, I thought that it would be easier in MacLow since the former had a lot of DoGetXX methods.
I'll include these modifications in the new patch.
Comment 5 Rediet 2018-01-09 04:52:09 EST
Created attachment 2992 [details]
Updated patch (still based on 35b461a12b26 of Dec 30 2017)

Tom, Sébastien,

Here's the updated patch. As requested, the AdjustChannelWidthToMode is now in the WifiRemoteStationManager and a regression test has been added. I have to admit that it was quite laborious to find the correct traces enabling to test all the modifications of the patch (especially the frequency correction). The only way that I've found went through the addition of a new trace source to MultiModelSpectrumChannel (since defining a child class of the latter within wifi-test wasn't possible due to calls to SpectrumPhy class).

Rediet
Comment 6 sebastien.deronne 2018-01-09 10:25:28 EST
Rediet, thanks for your updated patch.

I was also not thinking to post-processing the tx vector in the manager, I would expect something like (similar to what we have for preamble selection, see GetPreambleForTransmission):

uint8_t GetChannelWidthForTransmission(WifiMode mode, uint8_t maxSupportedChannelWidth);

And then call it this way in the manager:
v.SetChannelWidth (GetChannelWidthForTransmission (mode, m_wifiPhy->GetChannelWidth ()));
Comment 7 Rediet 2018-01-10 05:43:50 EST
Created attachment 2993 [details]
2nd update of patch (still based on 35b461a12b26 of Dec 30 2017)

Sébastien, you'll find a new version of the patch using the signature you've provided. Hope that it corresponds to what you were expecting.
Btw, I didn't have to apply the method to all rate managers since they often assume a channel width of either 20 or 22 MHz.
Comment 8 sebastien.deronne 2018-01-10 06:17:37 EST
Thanks, I think it is almost ready (I only focused on the wifi part, not on the spectrum).

Why do we need traffic for the tests?
I am more in favor or unit testing this.
I know other tests are also broader like yours, but I would like to have wifi tests independent of non-wifi modules. But I can still work on improvements in the future if you do not have time to rework this.
Comment 9 Rediet 2018-01-10 09:03:31 EST
Created attachment 2994 [details]
3rd update of patch (based on 35b461a12b26 of Dec 30 2017)

It was just simple copy-paste from existing code. I've swapped all IP and above mechanics by simple packet burst generation.
Comment 10 sebastien.deronne 2018-01-11 17:21:46 EST
Thanks.
Can you also add a check that we do not use larger channel widths than 20 MHz for legacy OFDM?
Comment 11 Rediet 2018-01-12 03:35:14 EST
In the previously submitted test case there is already a check (line 1337) on the fact that the first tuple (of 20 MHz channel width) only concerns legacy OFDM (beacon, ack, RTS, CTS, and BA, considering the scenario).
Do you want me to add another series of verification on the TxVectors generated by each remote station manager type?
Comment 12 sebastien.deronne 2018-01-12 03:43:03 EST
(In reply to Rediet from comment #11)
> In the previously submitted test case there is already a check (line 1337)
> on the fact that the first tuple (of 20 MHz channel width) only concerns
> legacy OFDM (beacon, ack, RTS, CTS, and BA, considering the scenario).
> Do you want me to add another series of verification on the TxVectors
> generated by each remote station manager type?

OK. Can't you then add a bandwidth check on that tuple?
Comment 13 Rediet 2018-01-12 03:59:16 EST
Created attachment 2998 [details]
New update (based on 35b461a12b26 of Dec 30 2017)

Had already done it in line 1334 (relative check), but rephrased it in this update (passed to absolute check) since it wasn't so obvious, nor easily extensible.
Comment 14 sebastien.deronne 2018-01-12 04:02:18 EST
OK thanks, I think we can push this patch.
Comment 15 sebastien.deronne 2018-01-13 06:18:32 EST
Pushed in changeset 13250:62c458e9789b
Comment 16 Rediet 2018-01-15 04:40:04 EST
(In reply to Tom Henderson from comment #1)
> OK, I agree with the patch.  After patching, should we keep open with the
> issue that the primary channel is not always correct?
> 
> We should probably put some regression tests in as well.

@Tom Just submitted bug #2855 to track this issue.
@Sébastien, thanks for having pushed the patch.