wifi: Fix double precision issues in DsssErrorRateModel
This commit is contained in:
@@ -65,7 +65,7 @@ DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr, uint64_t nbits)
|
||||
//symbol error probability
|
||||
double EbN0 = sinr * 22000000.0 / 1375000.0 / 4.0;
|
||||
double sep = SymbolErrorProb16Cck (4.0 * EbN0 / 2.0);
|
||||
return std::pow (1.0 - sep, nbits / 4.0);
|
||||
return std::min (1.0, std::pow (1.0 - sep, nbits / 4.0));
|
||||
#else
|
||||
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
|
||||
//The matlab model
|
||||
@@ -87,7 +87,7 @@ DsssErrorRateModel::GetDsssDqpskCck5_5SuccessRate (double sinr, uint64_t nbits)
|
||||
double a4 = 1.0288981434358866e+000;
|
||||
ber = a1 * std::exp (-std::pow ((sinr - a2) / a3, a4));
|
||||
}
|
||||
return std::pow ((1.0 - ber), static_cast<double> (nbits));
|
||||
return std::min (1.0, std::pow ((1.0 - ber), static_cast<double> (nbits)));
|
||||
#endif
|
||||
}
|
||||
|
||||
@@ -100,7 +100,7 @@ DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr, uint64_t nbits)
|
||||
//symbol error probability
|
||||
double EbN0 = sinr * 22000000.0 / 1375000.0 / 8.0;
|
||||
double sep = SymbolErrorProb256Cck (8.0 * EbN0 / 2.0);
|
||||
return std::pow (1.0 - sep, nbits / 8.0);
|
||||
return std::min (1.0, std::pow (1.0 - sep, nbits / 8.0));
|
||||
#else
|
||||
NS_LOG_WARN ("Running a 802.11b CCK Matlab model less accurate than GSL model");
|
||||
//The matlab model
|
||||
@@ -124,7 +124,7 @@ DsssErrorRateModel::GetDsssDqpskCck11SuccessRate (double sinr, uint64_t nbits)
|
||||
double a6 = 2.2032715128698435e+000;
|
||||
ber = (a1 * sinr * sinr + a2 * sinr + a3) / (sinr * sinr * sinr + a4 * sinr * sinr + a5 * sinr + a6);
|
||||
}
|
||||
return std::pow ((1.0 - ber), static_cast<double> (nbits));
|
||||
return std::min (1.0, std::pow ((1.0 - ber), static_cast<double> (nbits)));
|
||||
#endif
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user