Bug 1775 - lr-wpan spectrum-value-helper Create TxPsd function
lr-wpan spectrum-value-helper Create TxPsd function
Status: RESOLVED FIXED
Product: ns-3
Classification: Unclassified
Component: lr-wpan
pre-release
All All
: P5 enhancement
Assigned To: Tom Henderson
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2013-10-17 12:18 UTC by Liang Huo
Modified: 2014-03-29 12:36 UTC (History)
3 users (show)

See Also:


Attachments
patch to fix the PSD (2.82 KB, patch)
2013-12-03 09:37 UTC, Tom Henderson
Details | Diff
sample program (1.67 KB, text/x-c++src)
2013-12-03 09:38 UTC, Tom Henderson
Details
patch to fix TX and noise PSD (3.81 KB, patch)
2013-12-18 07:33 UTC, Sascha Jopen
Details | Diff

Note You need to log in before you can comment on or make changes to this bug.
Description Liang Huo 2013-10-17 12:18:18 UTC
Note that in LrWpanSpectrumValueHelper::CreateTxPowerSpectralDensity

double txPowerDensity = txPower / 2.0e6;

(*txPsd)[2405 + 5 * (channel - 11) - 2400 - 5] = txPowerDensity * 0.01; // -20 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 - 4] = txPowerDensity * 0.01; // -20 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 - 3] = txPowerDensity * 0.1; // -10 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 - 2] = txPowerDensity * 0.1; // -10 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 - 1] = txPowerDensity * 0.5; // -3 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400] = txPowerDensity; // center
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 1 ] = txPowerDensity * 0.5; // -3 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2 ] = txPowerDensity * 0.1; // -10 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 3 ] = txPowerDensity * 0.1; // -10 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 4 ] = txPowerDensity * 0.01; // -20 dB
(*txPsd)[2405 + 5 * (channel - 11) - 2400 + 5 ] = txPowerDensity * 0.01; // -20 dB

The weight of txPowerDensity is not normalized to 1. It is currently 1.22

http://code.nsnam.org/tomh/ns-3-lr-wpan/file/60fda85f5921/src/lr-wpan/test/lr-wpan-spectrum-value-helper-test.cc#l60
says if the error is less than 25%, the it is accpeted. Why? Where is this 25% threshold defined in 802.15.4? Like shown above, due to not being normalized to 1, the current error is 22%.(1.22-1=0.22)
Comment 1 Tom Henderson 2013-11-25 00:52:44 UTC
(In reply to Liang Huo from comment #0)
> Note that in LrWpanSpectrumValueHelper::CreateTxPowerSpectralDensity
> 
> double txPowerDensity = txPower / 2.0e6;
> 
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 5] = txPowerDensity * 0.01; //
> -20 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 4] = txPowerDensity * 0.01; //
> -20 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 3] = txPowerDensity * 0.1; //
> -10 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 2] = txPowerDensity * 0.1; //
> -10 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 - 1] = txPowerDensity * 0.5; // -3
> dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400] = txPowerDensity; // center
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 1 ] = txPowerDensity * 0.5; //
> -3 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 2 ] = txPowerDensity * 0.1; //
> -10 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 3 ] = txPowerDensity * 0.1; //
> -10 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 4 ] = txPowerDensity * 0.01; //
> -20 dB
> (*txPsd)[2405 + 5 * (channel - 11) - 2400 + 5 ] = txPowerDensity * 0.01; //
> -20 dB
> 
> The weight of txPowerDensity is not normalized to 1. It is currently 1.22

I agree that this needs to be normalized as you suggest.

> 
> http://code.nsnam.org/tomh/ns-3-lr-wpan/file/60fda85f5921/src/lr-wpan/test/
> lr-wpan-spectrum-value-helper-test.cc#l60
> says if the error is less than 25%, the it is accpeted. Why? Where is this
> 25% threshold defined in 802.15.4? Like shown above, due to not being
> normalized to 1, the current error is 22%.(1.22-1=0.22)

I don't recall the reason for that error margin; however, upon reviewing it again tonight, I think it should be changed.  I will look into either a more meaningful test or else putting an assert check in the code itself to ensure that a correct PSD is generated.
Comment 2 Tom Henderson 2013-12-03 09:37:40 UTC
Created attachment 1729 [details]
patch to fix the PSD

This attachment generates a normalized PSD.
Comment 3 Tom Henderson 2013-12-03 09:38:16 UTC
Created attachment 1730 [details]
sample program

This program can be used to verify the normalized PSD; it will be turned into a test.
Comment 4 Tom Henderson 2013-12-03 09:38:55 UTC
I believe that the attached patch (as verified by the sample program) will fix the reported issue.
Comment 5 Sascha Jopen 2013-12-18 07:33:15 UTC
Created attachment 1738 [details]
patch to fix TX and noise PSD

I think the proposed patch fixed the problem. However, i think the noise PSD should then also make use of five subbands only. I changed this and corrected a comment in the original patch.

The patch states that a 2 MHz channel is modelled. However, the channel is actually modelled with 3 MHz. Each subband is 1 MHz wide, so there are +- 1.5 MHz around the center frequency. This could be changed by using an even number of subbands, instead of an odd number centered on the center frequency.
Comment 6 Tom Henderson 2014-01-07 09:16:51 UTC
(In reply to Sascha Jopen from comment #5)
> Created attachment 1738 [details]
> patch to fix TX and noise PSD
> 
> I think the proposed patch fixed the problem. However, i think the noise PSD
> should then also make use of five subbands only. I changed this and
> corrected a comment in the original patch.
> 
> The patch states that a 2 MHz channel is modelled. However, the channel is
> actually modelled with 3 MHz. Each subband is 1 MHz wide, so there are +-
> 1.5 MHz around the center frequency. This could be changed by using an even
> number of subbands, instead of an odd number centered on the center
> frequency.

I agree with your improvements and can change the comment to state "3 MHz width with 5 MHz spacing".  

If no other comments, I will generate a test case and commit at some point in the near future.
Comment 7 Tommaso Pecorella 2014-03-29 12:36:21 UTC
It's fixed in http://code.nsnam.org/lr-wpan/ns-3-lr-wpan/