cleanup yans-wifi-channel, yans-error-rate-model and nist-error-rate-model
This commit is contained in:
@@ -53,6 +53,7 @@ NistErrorRateModel::GetBpskBer (double snr) const
|
||||
NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::GetQpskBer (double snr) const
|
||||
{
|
||||
@@ -61,6 +62,7 @@ NistErrorRateModel::GetQpskBer (double snr) const
|
||||
NS_LOG_INFO ("qpsk snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::Get16QamBer (double snr) const
|
||||
{
|
||||
@@ -69,6 +71,7 @@ NistErrorRateModel::Get16QamBer (double snr) const
|
||||
NS_LOG_INFO ("16-Qam" << " snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::Get64QamBer (double snr) const
|
||||
{
|
||||
@@ -77,6 +80,7 @@ NistErrorRateModel::Get64QamBer (double snr) const
|
||||
NS_LOG_INFO ("64-Qam" << " snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::GetFecBpskBer (double snr, uint32_t nbits,
|
||||
uint32_t bValue) const
|
||||
@@ -91,6 +95,7 @@ NistErrorRateModel::GetFecBpskBer (double snr, uint32_t nbits,
|
||||
double pms = std::pow (1 - pe, (double)nbits);
|
||||
return pms;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::GetFecQpskBer (double snr, uint32_t nbits,
|
||||
uint32_t bValue) const
|
||||
@@ -105,6 +110,7 @@ NistErrorRateModel::GetFecQpskBer (double snr, uint32_t nbits,
|
||||
double pms = std::pow (1 - pe, (double)nbits);
|
||||
return pms;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
|
||||
{
|
||||
@@ -112,23 +118,22 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
|
||||
double pe = 1.0;
|
||||
if (bValue == 1)
|
||||
{
|
||||
// code rate 1/2, use table 3.1.1
|
||||
pe = 0.5 * ( 36.0 * std::pow (D, 10)
|
||||
+ 211.0 * std::pow (D, 12)
|
||||
+ 1404.0 * std::pow (D, 14)
|
||||
+ 11633.0 * std::pow (D, 16)
|
||||
+ 77433.0 * std::pow (D, 18)
|
||||
+ 502690.0 * std::pow (D, 20)
|
||||
+ 3322763.0 * std::pow (D, 22)
|
||||
+ 21292910.0 * std::pow (D, 24)
|
||||
+ 134365911.0 * std::pow (D, 26)
|
||||
);
|
||||
//code rate 1/2, use table 3.1.1
|
||||
pe = 0.5 * (36.0 * std::pow (D, 10)
|
||||
+ 211.0 * std::pow (D, 12)
|
||||
+ 1404.0 * std::pow (D, 14)
|
||||
+ 11633.0 * std::pow (D, 16)
|
||||
+ 77433.0 * std::pow (D, 18)
|
||||
+ 502690.0 * std::pow (D, 20)
|
||||
+ 3322763.0 * std::pow (D, 22)
|
||||
+ 21292910.0 * std::pow (D, 24)
|
||||
+ 134365911.0 * std::pow (D, 26));
|
||||
}
|
||||
else if (bValue == 2)
|
||||
{
|
||||
// code rate 2/3, use table 3.1.2
|
||||
//code rate 2/3, use table 3.1.2
|
||||
pe = 1.0 / (2.0 * bValue) *
|
||||
( 3.0 * std::pow (D, 6)
|
||||
(3.0 * std::pow (D, 6)
|
||||
+ 70.0 * std::pow (D, 7)
|
||||
+ 285.0 * std::pow (D, 8)
|
||||
+ 1276.0 * std::pow (D, 9)
|
||||
@@ -137,14 +142,13 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
|
||||
+ 117019.0 * std::pow (D, 12)
|
||||
+ 498860.0 * std::pow (D, 13)
|
||||
+ 2103891.0 * std::pow (D, 14)
|
||||
+ 8784123.0 * std::pow (D, 15)
|
||||
);
|
||||
+ 8784123.0 * std::pow (D, 15));
|
||||
}
|
||||
else if (bValue == 3)
|
||||
{
|
||||
// code rate 3/4, use table 3.1.2
|
||||
//code rate 3/4, use table 3.1.2
|
||||
pe = 1.0 / (2.0 * bValue) *
|
||||
( 42.0 * std::pow (D, 5)
|
||||
(42.0 * std::pow (D, 5)
|
||||
+ 201.0 * std::pow (D, 6)
|
||||
+ 1492.0 * std::pow (D, 7)
|
||||
+ 10469.0 * std::pow (D, 8)
|
||||
@@ -153,15 +157,14 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
|
||||
+ 2253373.0 * std::pow (D, 11)
|
||||
+ 13073811.0 * std::pow (D, 12)
|
||||
+ 75152755.0 * std::pow (D, 13)
|
||||
+ 428005675.0 * std::pow (D, 14)
|
||||
);
|
||||
+ 428005675.0 * std::pow (D, 14));
|
||||
}
|
||||
else if (bValue == 5)
|
||||
{
|
||||
// code rate 5/6, use table V from D. Haccoun and G. Begin, "High-Rate Punctured Convolutional Codes
|
||||
// for Viterbi Sequential Decoding", IEEE Transactions on Communications, Vol. 32, Issue 3, pp.315-319.
|
||||
//code rate 5/6, use table V from D. Haccoun and G. Begin, "High-Rate Punctured Convolutional Codes
|
||||
//for Viterbi Sequential Decoding", IEEE Transactions on Communications, Vol. 32, Issue 3, pp.315-319.
|
||||
pe = 1.0 / (2.0 * bValue) *
|
||||
( 92.0 * std::pow (D, 4.0)
|
||||
(92.0 * std::pow (D, 4.0)
|
||||
+ 528.0 * std::pow (D, 5.0)
|
||||
+ 8694.0 * std::pow (D, 6.0)
|
||||
+ 79453.0 * std::pow (D, 7.0)
|
||||
@@ -170,8 +173,7 @@ NistErrorRateModel::CalculatePe (double p, uint32_t bValue) const
|
||||
+ 67884974.0 * std::pow (D, 10.0)
|
||||
+ 610875423.0 * std::pow (D, 11.0)
|
||||
+ 5427275376.0 * std::pow (D, 12.0)
|
||||
+ 47664215639.0 * std::pow (D, 13.0)
|
||||
);
|
||||
+ 47664215639.0 * std::pow (D, 13.0));
|
||||
}
|
||||
else
|
||||
{
|
||||
@@ -194,6 +196,7 @@ NistErrorRateModel::GetFec16QamBer (double snr, uint32_t nbits,
|
||||
double pms = std::pow (1 - pe, static_cast<double> (nbits));
|
||||
return pms;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
|
||||
uint32_t bValue) const
|
||||
@@ -208,11 +211,13 @@ NistErrorRateModel::GetFec64QamBer (double snr, uint32_t nbits,
|
||||
double pms = std::pow (1 - pe, static_cast<double> (nbits));
|
||||
return pms;
|
||||
}
|
||||
|
||||
double
|
||||
NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const
|
||||
{
|
||||
if (mode.GetModulationClass () == WIFI_MOD_CLASS_ERP_OFDM
|
||||
|| mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM|| mode.GetModulationClass()==WIFI_MOD_CLASS_HT)
|
||||
|| mode.GetModulationClass () == WIFI_MOD_CLASS_OFDM
|
||||
|| mode.GetModulationClass ()== WIFI_MOD_CLASS_HT)
|
||||
{
|
||||
if (mode.GetConstellationSize () == 2)
|
||||
{
|
||||
@@ -220,15 +225,13 @@ NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecBpskBer (snr,
|
||||
nbits,
|
||||
1 // b value
|
||||
);
|
||||
1); //b value
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecBpskBer (snr,
|
||||
nbits,
|
||||
3 // b value
|
||||
);
|
||||
3); //b value
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 4)
|
||||
@@ -237,15 +240,13 @@ NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecQpskBer (snr,
|
||||
nbits,
|
||||
1 // b value
|
||||
);
|
||||
1); //b value
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecQpskBer (snr,
|
||||
nbits,
|
||||
3 // b value
|
||||
);
|
||||
3); //b value
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 16)
|
||||
@@ -254,15 +255,13 @@ NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFec16QamBer (snr,
|
||||
nbits,
|
||||
1 // b value
|
||||
);
|
||||
1); //b value
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFec16QamBer (snr,
|
||||
nbits,
|
||||
3 // b value
|
||||
);
|
||||
3); //b value
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 64)
|
||||
@@ -271,23 +270,20 @@ NistErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFec64QamBer (snr,
|
||||
nbits,
|
||||
2 // b value
|
||||
);
|
||||
2); //b value
|
||||
}
|
||||
else if (mode.GetCodeRate () == WIFI_CODE_RATE_5_6)
|
||||
{
|
||||
return GetFec64QamBer (snr,
|
||||
nbits,
|
||||
5 // b value
|
||||
);
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFec64QamBer (snr,
|
||||
nbits,
|
||||
3 // b value
|
||||
);
|
||||
}
|
||||
{
|
||||
return GetFec64QamBer (snr,
|
||||
nbits,
|
||||
5); //b value
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFec64QamBer (snr,
|
||||
nbits,
|
||||
3); //b value
|
||||
}
|
||||
}
|
||||
}
|
||||
else if (mode.GetModulationClass () == WIFI_MOD_CLASS_DSSS)
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Gary Pei <guangyu.pei@boeing.com>
|
||||
*/
|
||||
|
||||
#ifndef NIST_ERROR_RATE_MODEL_H
|
||||
#define NIST_ERROR_RATE_MODEL_H
|
||||
|
||||
@@ -44,12 +45,15 @@ public:
|
||||
|
||||
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
|
||||
|
||||
|
||||
private:
|
||||
|
||||
/**
|
||||
* Return the coded BER for the given p and b.
|
||||
*
|
||||
* \param p
|
||||
* \param bValue
|
||||
*
|
||||
* \return BER
|
||||
*/
|
||||
double CalculatePe (double p, uint32_t bValue) const;
|
||||
@@ -57,6 +61,7 @@ private:
|
||||
* Return BER of BPSK at the given SNR.
|
||||
*
|
||||
* \param snr snr value
|
||||
*
|
||||
* \return BER of BPSK at the given SNR
|
||||
*/
|
||||
double GetBpskBer (double snr) const;
|
||||
@@ -64,6 +69,7 @@ private:
|
||||
* Return BER of QPSK at the given SNR.
|
||||
*
|
||||
* \param snr snr value
|
||||
*
|
||||
* \return BER of QPSK at the given SNR
|
||||
*/
|
||||
double GetQpskBer (double snr) const;
|
||||
@@ -71,6 +77,7 @@ private:
|
||||
* Return BER of QAM16 at the given SNR.
|
||||
*
|
||||
* \param snr snr value
|
||||
*
|
||||
* \return BER of QAM16 at the given SNR
|
||||
*/
|
||||
double Get16QamBer (double snr) const;
|
||||
@@ -78,6 +85,7 @@ private:
|
||||
* Return BER of QAM64 at the given SNR.
|
||||
*
|
||||
* \param snr snr value
|
||||
*
|
||||
* \return BER of QAM64 at the given SNR
|
||||
*/
|
||||
double Get64QamBer (double snr) const;
|
||||
@@ -87,6 +95,7 @@ private:
|
||||
* \param snr snr value
|
||||
* \param nbits the number of bits in the chunk
|
||||
* \param bValue
|
||||
*
|
||||
* \return BER of BPSK at the given SNR after applying FEC
|
||||
*/
|
||||
double GetFecBpskBer (double snr, uint32_t nbits,
|
||||
@@ -97,6 +106,7 @@ private:
|
||||
* \param snr snr value
|
||||
* \param nbits the number of bits in the chunk
|
||||
* \param bValue
|
||||
*
|
||||
* \return BER of QPSK at the given SNR after applying FEC
|
||||
*/
|
||||
double GetFecQpskBer (double snr, uint32_t nbits,
|
||||
@@ -107,6 +117,7 @@ private:
|
||||
* \param snr snr value
|
||||
* \param nbits the number of bits in the chunk
|
||||
* \param bValue
|
||||
*
|
||||
* \return BER of QAM16 at the given SNR after applying FEC
|
||||
*/
|
||||
double GetFec16QamBer (double snr, uint32_t nbits,
|
||||
@@ -117,13 +128,13 @@ private:
|
||||
* \param snr snr value
|
||||
* \param nbits the number of bits in the chunk
|
||||
* \param bValue
|
||||
*
|
||||
* \return BER of QAM64 at the given SNR after applying FEC
|
||||
*/
|
||||
double GetFec64QamBer (double snr, uint32_t nbits,
|
||||
uint32_t bValue) const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* NIST_ERROR_RATE_MODEL_H */
|
||||
|
||||
@@ -15,12 +15,11 @@
|
||||
* along with this program; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
* Authors: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
* Sébastien Deronne <sebastien.deronne@gmail.com>
|
||||
*/
|
||||
|
||||
#include <cmath>
|
||||
|
||||
#include "yans-error-rate-model.h"
|
||||
#include "wifi-phy.h"
|
||||
#include "ns3/log.h"
|
||||
@@ -51,6 +50,7 @@ YansErrorRateModel::Log2 (double val) const
|
||||
{
|
||||
return std::log (val) / std::log (2.0);
|
||||
}
|
||||
|
||||
double
|
||||
YansErrorRateModel::GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const
|
||||
{
|
||||
@@ -60,6 +60,7 @@ YansErrorRateModel::GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyR
|
||||
NS_LOG_INFO ("bpsk snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
double
|
||||
YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const
|
||||
{
|
||||
@@ -71,6 +72,7 @@ YansErrorRateModel::GetQamBer (double snr, unsigned int m, uint32_t signalSpread
|
||||
NS_LOG_INFO ("Qam m=" << m << " rate=" << phyRate << " snr=" << snr << " ber=" << ber);
|
||||
return ber;
|
||||
}
|
||||
|
||||
uint32_t
|
||||
YansErrorRateModel::Factorial (uint32_t k) const
|
||||
{
|
||||
@@ -82,12 +84,14 @@ YansErrorRateModel::Factorial (uint32_t k) const
|
||||
}
|
||||
return fact;
|
||||
}
|
||||
|
||||
double
|
||||
YansErrorRateModel::Binomial (uint32_t k, double p, uint32_t n) const
|
||||
{
|
||||
double retval = Factorial (n) / (Factorial (k) * Factorial (n - k)) * std::pow (p, static_cast<double> (k)) * std::pow (1 - p, static_cast<double> (n - k));
|
||||
return retval;
|
||||
}
|
||||
|
||||
double
|
||||
YansErrorRateModel::CalculatePdOdd (double ber, unsigned int d) const
|
||||
{
|
||||
@@ -102,6 +106,7 @@ YansErrorRateModel::CalculatePdOdd (double ber, unsigned int d) const
|
||||
}
|
||||
return pd;
|
||||
}
|
||||
|
||||
double
|
||||
YansErrorRateModel::CalculatePdEven (double ber, unsigned int d) const
|
||||
{
|
||||
@@ -187,21 +192,19 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecBpskBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
10, // dFree
|
||||
11 // adFree
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
10, //dFree
|
||||
11); //adFree
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecBpskBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
5, // dFree
|
||||
8 // adFree
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
5, //dFree
|
||||
8); //adFree
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 4)
|
||||
@@ -210,25 +213,23 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
4, // m
|
||||
10, // dFree
|
||||
11, // adFree
|
||||
0 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
4, //m
|
||||
10, //dFree
|
||||
11, //adFree
|
||||
0); //adFreePlusOne
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
4, // m
|
||||
5, // dFree
|
||||
8, // adFree
|
||||
31 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
4, //m
|
||||
5, //dFree
|
||||
8, //adFree
|
||||
31); //adFreePlusOne
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 16)
|
||||
@@ -237,25 +238,23 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
16, // m
|
||||
10, // dFree
|
||||
11, // adFree
|
||||
0 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
16, //m
|
||||
10, //dFree
|
||||
11, //adFree
|
||||
0); //adFreePlusOne
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
16, // m
|
||||
5, // dFree
|
||||
8, // adFree
|
||||
31 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
16, //m
|
||||
5, //dFree
|
||||
8, //adFree
|
||||
31); //adFreePlusOne
|
||||
}
|
||||
}
|
||||
else if (mode.GetConstellationSize () == 64)
|
||||
@@ -264,38 +263,35 @@ YansErrorRateModel::GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbi
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
64, // m
|
||||
6, // dFree
|
||||
1, // adFree
|
||||
16 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
64, //m
|
||||
6, //dFree
|
||||
1, //adFree
|
||||
16); //adFreePlusOne
|
||||
}
|
||||
if (mode.GetCodeRate () == WIFI_CODE_RATE_5_6)
|
||||
{
|
||||
//Table B.32 in Pâl Frenger et al., "Multi-rate Convolutional Codes".
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
64, // m
|
||||
4, // dFree
|
||||
14, // adFree
|
||||
69 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
64, //m
|
||||
4, //dFree
|
||||
14, //adFree
|
||||
69); //adFreePlusOne
|
||||
}
|
||||
else
|
||||
{
|
||||
return GetFecQamBer (snr,
|
||||
nbits,
|
||||
mode.GetBandwidth (), // signal spread
|
||||
mode.GetPhyRate (), // phy rate
|
||||
64, // m
|
||||
5, // dFree
|
||||
8, // adFree
|
||||
31 // adFreePlusOne
|
||||
);
|
||||
mode.GetBandwidth (), //signal spread
|
||||
mode.GetPhyRate (), //phy rate
|
||||
64, //m
|
||||
5, //dFree
|
||||
8, //adFree
|
||||
31); //adFreePlusOne
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Mathieu Lacage <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef YANS_ERROR_RATE_MODEL_H
|
||||
#define YANS_ERROR_RATE_MODEL_H
|
||||
|
||||
@@ -61,11 +62,13 @@ public:
|
||||
|
||||
virtual double GetChunkSuccessRate (WifiMode mode, double snr, uint32_t nbits) const;
|
||||
|
||||
|
||||
private:
|
||||
/**
|
||||
* Return the logarithm of the given value to base 2.
|
||||
*
|
||||
* \param val
|
||||
*
|
||||
* \return the logarithm of val to base 2.
|
||||
*/
|
||||
double Log2 (double val) const;
|
||||
@@ -75,6 +78,7 @@ private:
|
||||
* \param snr snr value
|
||||
* \param signalSpread
|
||||
* \param phyRate
|
||||
*
|
||||
* \return BER of BPSK at the given SNR
|
||||
*/
|
||||
double GetBpskBer (double snr, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
@@ -85,6 +89,7 @@ private:
|
||||
* \param m
|
||||
* \param signalSpread
|
||||
* \param phyRate
|
||||
*
|
||||
* \return BER of BPSK at the given SNR
|
||||
*/
|
||||
double GetQamBer (double snr, unsigned int m, uint32_t signalSpread, uint32_t phyRate) const;
|
||||
@@ -92,6 +97,7 @@ private:
|
||||
* Return k!
|
||||
*
|
||||
* \param k
|
||||
*
|
||||
* \return k!
|
||||
*/
|
||||
uint32_t Factorial (uint32_t k) const;
|
||||
@@ -101,24 +107,28 @@ private:
|
||||
* \param k
|
||||
* \param p
|
||||
* \param n
|
||||
*
|
||||
* \return a Binomial distribution
|
||||
*/
|
||||
double Binomial (uint32_t k, double p, uint32_t n) const;
|
||||
/**
|
||||
* \param ber
|
||||
* \param d
|
||||
*
|
||||
* \return double
|
||||
*/
|
||||
double CalculatePdOdd (double ber, unsigned int d) const;
|
||||
/**
|
||||
* \param ber
|
||||
* \param d
|
||||
*
|
||||
* \return double
|
||||
*/
|
||||
double CalculatePdEven (double ber, unsigned int d) const;
|
||||
/**
|
||||
* \param ber
|
||||
* \param d
|
||||
*
|
||||
* \return double
|
||||
*/
|
||||
double CalculatePd (double ber, unsigned int d) const;
|
||||
@@ -129,6 +139,7 @@ private:
|
||||
* \param phyRate
|
||||
* \param dFree
|
||||
* \param adFree
|
||||
*
|
||||
* \return double
|
||||
*/
|
||||
double GetFecBpskBer (double snr, double nbits,
|
||||
@@ -143,6 +154,7 @@ private:
|
||||
* \param dfree
|
||||
* \param adFree
|
||||
* \param adFreePlusOne
|
||||
*
|
||||
* \return double
|
||||
*/
|
||||
double GetFecQamBer (double snr, uint32_t nbits,
|
||||
@@ -152,7 +164,6 @@ private:
|
||||
uint32_t adFree, uint32_t adFreePlusOne) const;
|
||||
};
|
||||
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
#endif /* YANS_ERROR_RATE_MODEL_H */
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#include "ns3/packet.h"
|
||||
#include "ns3/simulator.h"
|
||||
#include "ns3/mobility-model.h"
|
||||
@@ -58,6 +59,7 @@ YansWifiChannel::GetTypeId (void)
|
||||
YansWifiChannel::YansWifiChannel ()
|
||||
{
|
||||
}
|
||||
|
||||
YansWifiChannel::~YansWifiChannel ()
|
||||
{
|
||||
NS_LOG_FUNCTION_NOARGS ();
|
||||
@@ -69,6 +71,7 @@ YansWifiChannel::SetPropagationLossModel (Ptr<PropagationLossModel> loss)
|
||||
{
|
||||
m_loss = loss;
|
||||
}
|
||||
|
||||
void
|
||||
YansWifiChannel::SetPropagationDelayModel (Ptr<PropagationDelayModel> delay)
|
||||
{
|
||||
@@ -86,7 +89,7 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
|
||||
{
|
||||
if (sender != (*i))
|
||||
{
|
||||
// For now don't account for inter channel interference
|
||||
//For now don't account for inter channel interference
|
||||
if ((*i)->GetChannelNumber () != sender->GetChannelNumber ())
|
||||
{
|
||||
continue;
|
||||
@@ -111,8 +114,8 @@ YansWifiChannel::Send (Ptr<YansWifiPhy> sender, Ptr<const Packet> packet, double
|
||||
|
||||
double *atts = new double[3];
|
||||
*atts = rxPowerDbm;
|
||||
*(atts+1)= packetType;
|
||||
*(atts+2)= duration.GetNanoSeconds();
|
||||
*(atts+1) = packetType;
|
||||
*(atts+2) = duration.GetNanoSeconds ();
|
||||
|
||||
Simulator::ScheduleWithContext (dstNode,
|
||||
delay, &YansWifiChannel::Receive, this,
|
||||
@@ -125,7 +128,7 @@ void
|
||||
YansWifiChannel::Receive (uint32_t i, Ptr<Packet> packet, double *atts,
|
||||
WifiTxVector txVector, WifiPreamble preamble) const
|
||||
{
|
||||
m_phyList[i]->StartReceivePreambleAndHeader (packet, *atts, txVector, preamble, *(atts+1), NanoSeconds(*(atts+2)));
|
||||
m_phyList[i]->StartReceivePreambleAndHeader (packet, *atts, txVector, preamble, *(atts+1), NanoSeconds (*(atts+2)));
|
||||
delete[] atts;
|
||||
}
|
||||
|
||||
@@ -134,6 +137,7 @@ YansWifiChannel::GetNDevices (void) const
|
||||
{
|
||||
return m_phyList.size ();
|
||||
}
|
||||
|
||||
Ptr<NetDevice>
|
||||
YansWifiChannel::GetDevice (uint32_t i) const
|
||||
{
|
||||
|
||||
@@ -17,6 +17,7 @@
|
||||
*
|
||||
* Author: Mathieu Lacage, <mathieu.lacage@sophia.inria.fr>
|
||||
*/
|
||||
|
||||
#ifndef YANS_WIFI_CHANNEL_H
|
||||
#define YANS_WIFI_CHANNEL_H
|
||||
|
||||
@@ -56,7 +57,7 @@ public:
|
||||
YansWifiChannel ();
|
||||
virtual ~YansWifiChannel ();
|
||||
|
||||
// inherited from Channel.
|
||||
//inherited from Channel.
|
||||
virtual uint32_t GetNDevices (void) const;
|
||||
virtual Ptr<NetDevice> GetDevice (uint32_t i) const;
|
||||
|
||||
@@ -99,13 +100,13 @@ public:
|
||||
* have been assigned.
|
||||
*
|
||||
* \param stream first stream index to use
|
||||
*
|
||||
* \return the number of stream indices assigned by this model
|
||||
*/
|
||||
int64_t AssignStreams (int64_t stream);
|
||||
|
||||
|
||||
private:
|
||||
//YansWifiChannel& operator = (const YansWifiChannel &);
|
||||
//YansWifiChannel (const YansWifiChannel &);
|
||||
|
||||
/**
|
||||
* A vector of pointers to YansWifiPhy.
|
||||
@@ -126,12 +127,11 @@ private:
|
||||
WifiTxVector txVector, WifiPreamble preamble) const;
|
||||
|
||||
|
||||
PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
|
||||
Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
|
||||
Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
|
||||
PhyList m_phyList; //!< List of YansWifiPhys connected to this YansWifiChannel
|
||||
Ptr<PropagationLossModel> m_loss; //!< Propagation loss model
|
||||
Ptr<PropagationDelayModel> m_delay; //!< Propagation delay model
|
||||
};
|
||||
|
||||
} // namespace ns3
|
||||
|
||||
|
||||
#endif /* YANS_WIFI_CHANNEL_H */
|
||||
|
||||
Reference in New Issue
Block a user