Bug 768 - Potential bug in yans wifi error rate model
Potential bug in yans wifi error rate model
Status: RESOLVED INVALID
Product: ns-3
Classification: Unclassified
Component: wifi
ns-3-dev
All All
: P5 normal
Assigned To: ns-bugs
:
Depends on:
Blocks:
  Show dependency treegraph
 
Reported: 2009-12-03 22:03 UTC by Trevor Bosaw
Modified: 2009-12-03 22:08 UTC (History)
0 users

See Also:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Trevor Bosaw 2009-12-03 22:03:55 UTC
Hey,

So I was looking around in the yans error rate model, and for the function that gets the QAM BER rate (for certain 802.11a bit rates), there was a line of code that seemed suspicious (this is in yans-error-rate-model.cc):

62 double 
    63 YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const
    64 {
    65   double EbNo = snr * signalSpread / phyRate;
    66   double z = sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0));
    67   double z1 = ((1.0 - 1.0 / sqrt (m)) * erfc (z)) ;
    68   double z2 = 1 - pow ((1-z1), 2.0);
    69   double ber = z2 / Log2 (m);
    70   NS_LOG_INFO ("Qam m="<<m<<" rate=" << phyRate << " snr="<<snr<<" ber="<<ber);
    71   return ber;
    72 }


The suspicious line is 67.  When z1 is resolved, it will always be 0 (the 1.0 - 1.0 part does this), and thus the BER of any QAM modulation will be 1/log2(m).  I'm pretty sure this isn't right, and it seems to me that there's a typo in the z1 line.  I haven't done any tests to verify this, but that single line seems suspicious enough to at least show that z1 isn't being set to what it should.
Comment 1 Trevor Bosaw 2009-12-03 22:08:28 UTC
I take that back, dumb mistake by me.  The code looks fine.  Please disregard this report.