Bug 768

Summary: Potential bug in yans wifi error rate model
Product: ns-3 Reporter: Trevor Bosaw <bosawt>
Component: wifiAssignee: ns-bugs <ns-bugs>
Status: RESOLVED INVALID    
Severity: normal    
Priority: P5    
Version: ns-3-dev   
Hardware: All   
OS: All   

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.