View | Details | Raw Unified | Return to bug 1276
Collapse All | Expand All

(-)a/src/wifi/model/nist-error-rate-model.cc (-23 / +23 lines)
 Lines 77-83    Link Here 
77
  return ber;
77
  return ber;
78
}
78
}
79
double
79
double
80
NistErrorRateModel::GetFecBpskBer (double snr, double nbits,
80
NistErrorRateModel::GetFecBpskBer (double snr, uint32_t nbits,
81
                                   uint32_t bValue) const
81
                                   uint32_t bValue) const
82
{
82
{
83
  double ber = GetBpskBer (snr);
83
  double ber = GetBpskBer (snr);
 Lines 87-97    Link Here 
87
    }
87
    }
88
  double pe = CalculatePe (ber, bValue);
88
  double pe = CalculatePe (ber, bValue);
89
  pe = std::min (pe, 1.0);
89
  pe = std::min (pe, 1.0);
90
  double pms = std::pow (1 - pe, nbits);
90
  double pms = std::pow (1 - pe, static_cast<double> (nbits));
91
  return pms;
91
  return pms;
92
}
92
}
93
double
93
double
94
NistErrorRateModel::GetFecQpskBer (double snr, double nbits,
94
NistErrorRateModel::GetFecQpskBer (double snr, uint32_t nbits,
95
                                   uint32_t bValue) const
95
                                   uint32_t bValue) const
96
{
96
{
97
  double ber = GetQpskBer (snr);
97
  double ber = GetQpskBer (snr);
 Lines 101-107    Link Here 
101
    }
101
    }
102
  double pe = CalculatePe (ber, bValue);
102
  double pe = CalculatePe (ber, bValue);
103
  pe = std::min (pe, 1.0);
103
  pe = std::min (pe, 1.0);
104
  double pms = std::pow (1 - pe, nbits);
104
  double pms = std::pow (1 - pe, static_cast<double> (nbits));
105
  return pms;
105
  return pms;
106
}
106
}
107
double
107
double
 Lines 112-142    Link Here 
112
  if (bValue == 1)
112
  if (bValue == 1)
113
    {
113
    {
114
      // code rate 1/2, use table 3.1.1
114
      // code rate 1/2, use table 3.1.1
115
      pe = 0.5 * ( 36.0 * std::pow (D, 10.0)
115
      pe = 0.5 * ( 36.0 * std::pow (D, 10)
116
                   + 211.0 * std::pow (D, 12.0)
116
                   + 211.0 * std::pow (D, 12)
117
                   + 1404.0 * std::pow (D, 14.0)
117
                   + 1404.0 * std::pow (D, 14)
118
                   + 11633.0 * std::pow (D, 16.0)
118
                   + 11633.0 * std::pow (D, 16)
119
                   + 77433.0 * std::pow (D, 18.0)
119
                   + 77433.0 * std::pow (D, 18)
120
                   + 502690.0 * std::pow (D, 20.0)
120
                   + 502690.0 * std::pow (D, 20)
121
                   + 3322763.0 * std::pow (D, 22.0)
121
                   + 3322763.0 * std::pow (D, 22)
122
                   + 21292910.0 * std::pow (D, 24.0)
122
                   + 21292910.0 * std::pow (D, 24)
123
                   + 134365911.0 * std::pow (D, 26.0)
123
                   + 134365911.0 * std::pow (D, 26)
124
                   );
124
                   );
125
    }
125
    }
126
  else if (bValue == 2)
126
  else if (bValue == 2)
127
    {
127
    {
128
      // code rate 2/3, use table 3.1.2
128
      // code rate 2/3, use table 3.1.2
129
      pe = 1.0 / (2.0 * bValue) *
129
      pe = 1.0 / (2.0 * bValue) *
130
        ( 3.0 * std::pow (D, 6.0)
130
        ( 3.0 * std::pow (D, 6)
131
          + 70.0 * std::pow (D, 7.0)
131
          + 70.0 * std::pow (D, 7)
132
          + 285.0 * std::pow (D, 8.0)
132
          + 285.0 * std::pow (D, 8)
133
          + 1276.0 * std::pow (D, 9.0)
133
          + 1276.0 * std::pow (D, 9)
134
          + 6160.0 * std::pow (D, 10.0)
134
          + 6160.0 * std::pow (D, 10)
135
          + 27128.0 * std::pow (D, 11.0)
135
          + 27128.0 * std::pow (D, 11)
136
          + 117019.0 * std::pow (D, 12.0)
136
          + 117019.0 * std::pow (D, 12)
137
          + 498860.0 * std::pow (D, 13.0)
137
          + 498860.0 * std::pow (D, 13)
138
          + 2103891.0 * std::pow (D, 14.0)
138
          + 2103891.0 * std::pow (D, 14)
139
          + 8784123.0 * std::pow (D, 15.0)
139
          + 8784123.0 * std::pow (D, 15)
140
        );
140
        );
141
    }
141
    }
142
  else if (bValue == 3)
142
  else if (bValue == 3)
(-)a/src/wifi/model/nist-error-rate-model.h (-2 / +2 lines)
 Lines 89-95    Link Here 
89
   * \param bValue
89
   * \param bValue
90
   * \return BER of BPSK at the given SNR after applying FEC
90
   * \return BER of BPSK at the given SNR after applying FEC
91
   */
91
   */
92
  double GetFecBpskBer (double snr, double nbits,
92
  double GetFecBpskBer (double snr, uint32_t nbits,
93
                        uint32_t bValue) const;
93
                        uint32_t bValue) const;
94
  /**
94
  /**
95
   * Return BER of QPSK at the given SNR after applying FEC.
95
   * Return BER of QPSK at the given SNR after applying FEC.
 Lines 99-105    Link Here 
99
   * \param bValue
99
   * \param bValue
100
   * \return BER of QPSK at the given SNR after applying FEC
100
   * \return BER of QPSK at the given SNR after applying FEC
101
   */
101
   */
102
  double GetFecQpskBer (double snr, double nbits,
102
  double GetFecQpskBer (double snr, uint32_t nbits,
103
                        uint32_t bValue) const;
103
                        uint32_t bValue) const;
104
  /**
104
  /**
105
   * Return BER of QAM16 at the given SNR after applying FEC.
105
   * Return BER of QAM16 at the given SNR after applying FEC.
(-)a/src/wifi/model/yans-error-rate-model.cc (-1 / +1 lines)
 Lines 65-71    Link Here 
65
  double EbNo = snr * signalSpread / phyRate;
65
  double EbNo = snr * signalSpread / phyRate;
66
  double z = std::sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0));
66
  double z = std::sqrt ((1.5 * Log2 (m) * EbNo) / (m - 1.0));
67
  double z1 = ((1.0 - 1.0 / std::sqrt (m)) * erfc (z));
67
  double z1 = ((1.0 - 1.0 / std::sqrt (m)) * erfc (z));
68
  double z2 = 1 - std::pow ((1 - z1), 2.0);
68
  double z2 = 1 - std::pow ((1 - z1), 2);
69
  double ber = z2 / Log2 (m);
69
  double ber = z2 / Log2 (m);
70
  NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber);
70
  NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber);
71
  return ber;
71
  return ber;

Return to bug 1276