noise figure attribute

This commit is contained in:
Nicola Baldo
2011-04-26 13:32:27 +02:00
parent 770ef168bc
commit 45591fc72e
9 changed files with 111 additions and 30 deletions

View File

@@ -140,9 +140,6 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
Ptr<LteEnbPhy> phy = CreateObject<LteEnbPhy> (dlPhy, ulPhy);
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity ();
ulPhy->SetNoisePowerSpectralDensity (noisePsd);
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
ulPhy->AddSinrChunkProcessor (p);
@@ -195,9 +192,6 @@ LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
Ptr<LteUePhy> phy = CreateObject<LteUePhy> (dlPhy, ulPhy);
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity ();
dlPhy->SetNoisePowerSpectralDensity (noisePsd);
Ptr<LteCqiSinrChunkProcessor> p = Create<LteCqiSinrChunkProcessor> (phy->GetObject<LtePhy> ());
dlPhy->AddSinrChunkProcessor (p);

View File

@@ -128,6 +128,18 @@ LteEnbPhy::GetTypeId (void)
MakeDoubleAccessor (&LteEnbPhy::SetTxPower,
&LteEnbPhy::GetTxPower),
MakeDoubleChecker<double> ())
.AddAttribute ("NoiseFigure",
"Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
" According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
"\"the difference in decibels (dB) between"
" the noise output of the actual receiver to the noise output of an "
" ideal receiver with the same overall gain and bandwidth when the receivers "
" are connected to sources at the standard noise temperature T0.\" "
"In this model, we consider T0 = 290K.",
DoubleValue (5.0),
MakeDoubleAccessor (&LteEnbPhy::SetNoiseFigure,
&LteEnbPhy::GetNoiseFigure),
MakeDoubleChecker<double> ())
;
return tid;
}
@@ -172,6 +184,22 @@ LteEnbPhy::GetTxPower () const
return m_txPower;
}
void
LteEnbPhy::SetNoiseFigure (double nf)
{
NS_LOG_FUNCTION (this << nf);
m_noiseFigure = nf;
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (m_noiseFigure);
m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
}
double
LteEnbPhy::GetNoiseFigure () const
{
NS_LOG_FUNCTION (this);
return m_noiseFigure;
}
bool
LteEnbPhy::AddUePhy (uint8_t rnti, Ptr<LteUePhy> phy)
{

View File

@@ -83,6 +83,16 @@ public:
*/
double GetTxPower () const;
/**
* \param pw the noise figure in dB
*/
void SetNoiseFigure (double pow);
/**
* \return the noise figure in dB
*/
double GetNoiseFigure () const;
/**
* \brief Queue the MAC PDU to be sent
* \param p the MAC PDU to sent

View File

@@ -42,10 +42,8 @@ LtePhy::LtePhy ()
}
LtePhy::LtePhy (Ptr<LteSpectrumPhy> dlPhy, Ptr<LteSpectrumPhy> ulPhy)
: m_netDevice (0),
m_downlinkSpectrumPhy (dlPhy),
: m_downlinkSpectrumPhy (dlPhy),
m_uplinkSpectrumPhy (ulPhy),
m_txPower (43), // dBm
m_tti (0.001),
m_ulBandwidth (0),
m_dlBandwidth (0),

View File

@@ -221,6 +221,7 @@ protected:
std::vector <int> m_listOfUplinkSubchannel;
double m_txPower;
double m_noiseFigure;
double m_tti;
uint8_t m_ulBandwidth;

View File

@@ -129,30 +129,28 @@ LteSpectrumValueHelper::CreateUplinkTxPowerSpectralDensity (double powerTx, std:
Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (void)
LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (double noiseFigure)
{
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (LteDownlinkSpectrumModel);
double noise_db = 2.5 + (-174) + (10. * log10 (180000)) - 30;
double noisePowerDensity = (pow (10.,noise_db / 10)) / 180000;
(*txPsd) = noisePowerDensity;
return txPsd;
return CreateNoisePowerSpectralDensity (noiseFigure, LteDownlinkSpectrumModel);
}
Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (double noiseFigure)
{
return CreateNoisePowerSpectralDensity (noiseFigure, LteUplinkSpectrumModel);
}
Ptr<SpectrumValue>
LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (void)
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, Ptr<SpectrumModel> spectrumModel)
{
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (LteUplinkSpectrumModel);
double noiseFigureLinear = pow (10.0, noiseFigureDb / 10.0);
static const double BOLTZMANN = 1.3803e-23;
static const double ROOM_TEMPERATURE = 290.0;
double noisePowerSpectralDensity = noiseFigureLinear * BOLTZMANN * ROOM_TEMPERATURE; // W/Hz
double noise_db = 2.5 + (-174) + (10. * log10 (180000)) - 30;
double noisePowerDensity = (pow (10.,noise_db / 10)) / 180000;
(*txPsd) = noisePowerDensity;
return txPsd;
Ptr<SpectrumValue> noisePsd = Create <SpectrumValue> (spectrumModel);
(*noisePsd) = noisePowerSpectralDensity;
return noisePsd;
}
} // namespace ns3

View File

@@ -52,17 +52,32 @@ public:
/**
* \brief create spectrum value for noise
* create a SpectrumValue that models the power spectral density of AWGN
*
* \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
*
* \return a Ptr to a newly created SpectrumValue instance
*/
static Ptr<SpectrumValue> CreateDownlinkNoisePowerSpectralDensity (void);
static Ptr<SpectrumValue> CreateDownlinkNoisePowerSpectralDensity (double noiseFigure);
/**
* \brief create spectrum value for noise
* create a SpectrumValue that models the power spectral density of AWGN
*
* \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
*
* \return a Ptr to a newly created SpectrumValue instance
*/
static Ptr<SpectrumValue> CreateUplinkNoisePowerSpectralDensity (void);
static Ptr<SpectrumValue> CreateUplinkNoisePowerSpectralDensity (double noiseFigure);
/**
* create a SpectrumValue that models the power spectral density of AWGN
*
* \param noiseFigure the noise figure in dB w.r.t. a reference temperature of 290K
* \param spectrumModel the SpectrumModel instance to be used
*
* \return a Ptr to a newly created SpectrumValue instance
*/
static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (double noiseFigure, Ptr<SpectrumModel> spectrumModel);
};

View File

@@ -137,6 +137,18 @@ LteUePhy::GetTypeId (void)
MakeDoubleAccessor (&LteUePhy::SetTxPower,
&LteUePhy::GetTxPower),
MakeDoubleChecker<double> ())
.AddAttribute ("NoiseFigure",
"Loss (dB) in the Signal-to-Noise-Ratio due to non-idealities in the receiver."
" According to Wikipedia (http://en.wikipedia.org/wiki/Noise_figure), this is "
"\"the difference in decibels (dB) between"
" the noise output of the actual receiver to the noise output of an "
" ideal receiver with the same overall gain and bandwidth when the receivers "
" are connected to sources at the standard noise temperature T0.\" "
"In this model, we consider T0 = 290K.",
DoubleValue (9.0),
MakeDoubleAccessor (&LteUePhy::SetNoiseFigure,
&LteUePhy::GetNoiseFigure),
MakeDoubleChecker<double> ())
;
return tid;
}
@@ -156,6 +168,22 @@ LteUePhy::GetLteUePhySapProvider ()
return (m_uePhySapProvider);
}
void
LteUePhy::SetNoiseFigure (double nf)
{
NS_LOG_FUNCTION (this << nf);
m_noiseFigure = nf;
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (m_noiseFigure);
m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
}
double
LteUePhy::GetNoiseFigure () const
{
NS_LOG_FUNCTION (this);
return m_noiseFigure;
}
void
LteUePhy::SetTxPower (double pow)
{

View File

@@ -89,6 +89,15 @@ public:
* \return the transmission power in dBm
*/
double GetTxPower () const;
/**
* \param pw the noise figure in dB
*/
void SetNoiseFigure (double pow);
/**
* \return the noise figure in dB
*/
double GetNoiseFigure () const;
/**
* \brief Queue the MAC PDU to be sent