flexible spectrum model
This commit is contained in:
@@ -272,7 +272,6 @@ LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
|
||||
n->AddDevice (dev);
|
||||
dlPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy));
|
||||
|
||||
dev->Start ();
|
||||
return dev;
|
||||
}
|
||||
|
||||
@@ -306,8 +305,12 @@ LenaHelper::Attach (Ptr<NetDevice> ueDevice, Ptr<NetDevice> enbDevice)
|
||||
|
||||
// WILD HACK - should be done through PHY SAP, probably passing by RRC
|
||||
uePhy->SetRnti (rnti);
|
||||
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
|
||||
uePhy->DoSetBandwidth (enbDevice->GetObject<LteEnbNetDevice> ()->GetUlBandwidth (),
|
||||
enbDevice->GetObject<LteEnbNetDevice> ()->GetDlBandwidth ());
|
||||
uePhy->DoSetEarfcn (enbDevice->GetObject<LteEnbNetDevice> ()->GetDlEarfcn (),
|
||||
enbDevice->GetObject<LteEnbNetDevice> ()->GetUlEarfcn ());
|
||||
|
||||
ueDevice->Start ();
|
||||
}
|
||||
|
||||
|
||||
@@ -347,7 +350,7 @@ LenaHelper::EnableLogComponents (void)
|
||||
LogComponentEnable ("LtePhy", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteUePhy", LOG_LEVEL_ALL);
|
||||
|
||||
LogComponentEnable ("LteSpectrumValueHelper", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteSpectrumPhy", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteInterference", LOG_LEVEL_ALL);
|
||||
LogComponentEnable ("LteSinrChunkProcessor", LOG_LEVEL_ALL);
|
||||
|
||||
@@ -76,13 +76,13 @@ TypeId LteEnbNetDevice::GetTypeId (void)
|
||||
MakePointerAccessor (&LteEnbNetDevice::m_phy),
|
||||
MakePointerChecker <LteEnbPhy> ())
|
||||
.AddAttribute ("UlBandwidth",
|
||||
"Uplink bandwidth in number of Resource Blocks",
|
||||
"Uplink Transmission Bandwidth Configuration in number of Resource Blocks",
|
||||
UintegerValue (25),
|
||||
MakeUintegerAccessor (&LteEnbNetDevice::SetUlBandwidth,
|
||||
&LteEnbNetDevice::GetUlBandwidth),
|
||||
MakeUintegerChecker<uint8_t> ())
|
||||
.AddAttribute ("DlBandwidth",
|
||||
"Downlink bandwidth in number of Resource Blocks",
|
||||
"Downlink Transmission Bandwidth Configuration in number of Resource Blocks",
|
||||
UintegerValue (25),
|
||||
MakeUintegerAccessor (&LteEnbNetDevice::SetDlBandwidth,
|
||||
&LteEnbNetDevice::GetDlBandwidth),
|
||||
@@ -92,6 +92,18 @@ TypeId LteEnbNetDevice::GetTypeId (void)
|
||||
UintegerValue (0),
|
||||
MakeUintegerAccessor (&LteEnbNetDevice::m_cellId),
|
||||
MakeUintegerChecker<uint16_t> ())
|
||||
.AddAttribute ("DlEarfcn",
|
||||
"Downlink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
|
||||
"as per 3GPP 36.101 Section 5.7.3. ",
|
||||
UintegerValue (100),
|
||||
MakeUintegerAccessor (&LteEnbNetDevice::m_dlEarfcn),
|
||||
MakeUintegerChecker<uint16_t> ())
|
||||
.AddAttribute ("UlEarfcn",
|
||||
"Uplink E-UTRA Absolute Radio Frequency Channel Number (EARFCN) "
|
||||
"as per 3GPP 36.101 Section 5.7.3. ",
|
||||
UintegerValue (18100),
|
||||
MakeUintegerAccessor (&LteEnbNetDevice::m_ulEarfcn),
|
||||
MakeUintegerChecker<uint16_t> ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
@@ -220,11 +232,39 @@ LteEnbNetDevice::SetDlBandwidth (uint8_t bw)
|
||||
}
|
||||
}
|
||||
|
||||
uint16_t
|
||||
LteEnbNetDevice::GetDlEarfcn () const
|
||||
{
|
||||
return m_dlEarfcn;
|
||||
}
|
||||
|
||||
void
|
||||
LteEnbNetDevice::SetDlEarfcn (uint16_t earfcn)
|
||||
{
|
||||
m_dlEarfcn = earfcn;
|
||||
}
|
||||
|
||||
uint16_t
|
||||
LteEnbNetDevice::GetUlEarfcn () const
|
||||
{
|
||||
return m_ulEarfcn;
|
||||
}
|
||||
|
||||
void
|
||||
LteEnbNetDevice::SetUlEarfcn (uint16_t earfcn)
|
||||
{
|
||||
m_ulEarfcn = earfcn;
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteEnbNetDevice::DoStart (void)
|
||||
{
|
||||
m_cellId = ++m_cellIdCounter;
|
||||
UpdateConfig ();
|
||||
UpdateConfig ();
|
||||
m_phy->Start ();
|
||||
m_mac->Start ();
|
||||
m_rrc->Start ();
|
||||
}
|
||||
|
||||
|
||||
@@ -274,8 +314,10 @@ LteEnbNetDevice::UpdateConfig (void)
|
||||
|
||||
m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth);
|
||||
|
||||
// WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC
|
||||
// Configuring directly for now, but ideally we should use the PHY
|
||||
// SAP instead. Probably should handle this through the RRC.
|
||||
m_phy->DoSetBandwidth (m_ulBandwidth, m_dlBandwidth);
|
||||
m_phy->DoSetEarfcn (m_dlEarfcn, m_ulEarfcn);
|
||||
m_phy->DoSetCellId (m_cellId);
|
||||
|
||||
}
|
||||
|
||||
@@ -105,6 +105,26 @@ public:
|
||||
*/
|
||||
void SetDlBandwidth (uint8_t bw);
|
||||
|
||||
/**
|
||||
* \return the downlink carrier frequency (EARFCN)
|
||||
*/
|
||||
uint16_t GetDlEarfcn () const;
|
||||
|
||||
/**
|
||||
* \param bw the downlink carrier frequency (EARFCN)
|
||||
*/
|
||||
void SetDlEarfcn (uint16_t earfcn);
|
||||
|
||||
/**
|
||||
* \return the uplink carrier frequency (EARFCN)
|
||||
*/
|
||||
uint16_t GetUlEarfcn () const;
|
||||
|
||||
/**
|
||||
* \param bw the uplink carrier frequency (EARFCN)
|
||||
*/
|
||||
void SetUlEarfcn (uint16_t earfcn);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
@@ -144,6 +164,9 @@ private:
|
||||
|
||||
uint8_t m_dlBandwidth; /**< downlink bandwidth in RBs */
|
||||
uint8_t m_ulBandwidth; /**< uplink bandwidth in RBs */
|
||||
|
||||
uint16_t m_dlEarfcn; /**< downlink carrier frequency */
|
||||
uint16_t m_ulEarfcn; /**< uplink carrier frequency */
|
||||
|
||||
};
|
||||
|
||||
|
||||
@@ -158,6 +158,16 @@ LteEnbPhy::DoDispose ()
|
||||
LtePhy::DoDispose ();
|
||||
}
|
||||
|
||||
void
|
||||
LteEnbPhy::DoStart ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_noiseFigure);
|
||||
m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
|
||||
LtePhy::DoStart ();
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LteEnbPhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s)
|
||||
{
|
||||
@@ -189,8 +199,6 @@ LteEnbPhy::SetNoiseFigure (double nf)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << nf);
|
||||
m_noiseFigure = nf;
|
||||
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (m_noiseFigure);
|
||||
m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
|
||||
}
|
||||
|
||||
double
|
||||
@@ -268,8 +276,7 @@ LteEnbPhy::CreateTxPowerSpectralDensity ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
LteSpectrumValueHelper psdHelper;
|
||||
Ptr<SpectrumValue> psd = psdHelper.CreateDownlinkTxPowerSpectralDensity (GetTxPower (), GetDownlinkSubChannels ());
|
||||
Ptr<SpectrumValue> psd = LteSpectrumValueHelper::CreateTxPowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_txPower, GetDownlinkSubChannels ());
|
||||
|
||||
return psd;
|
||||
}
|
||||
|
||||
@@ -57,7 +57,9 @@ public:
|
||||
|
||||
virtual ~LteEnbPhy ();
|
||||
|
||||
// inherited from Object
|
||||
static TypeId GetTypeId (void);
|
||||
virtual void DoStart (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
|
||||
|
||||
@@ -207,6 +207,12 @@ LtePhy::DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth)
|
||||
}
|
||||
}
|
||||
|
||||
void
|
||||
LtePhy::DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn)
|
||||
{
|
||||
m_dlEarfcn = dlEarfcn;
|
||||
m_ulEarfcn = ulEarfcn;
|
||||
}
|
||||
|
||||
uint8_t
|
||||
LtePhy::GetRbgSize (void) const
|
||||
|
||||
@@ -159,6 +159,13 @@ public:
|
||||
*/
|
||||
void DoSetBandwidth (uint8_t ulBandwidth, uint8_t dlBandwidth);
|
||||
|
||||
/**
|
||||
*
|
||||
* \param dlEarfcn the carrier frequency (EARFCN) in downlink
|
||||
* \param ulEarfcn the carrier frequency (EARFCN) in downlink
|
||||
*/
|
||||
virtual void DoSetEarfcn (uint16_t dlEarfcn, uint16_t ulEarfcn);
|
||||
|
||||
/**
|
||||
*
|
||||
* \param cellId the Cell Identifier
|
||||
@@ -227,6 +234,9 @@ protected:
|
||||
uint8_t m_ulBandwidth;
|
||||
uint8_t m_dlBandwidth;
|
||||
uint8_t m_rbgSize;
|
||||
|
||||
uint16_t m_dlEarfcn;
|
||||
uint16_t m_ulEarfcn;
|
||||
|
||||
std::vector< Ptr<PacketBurst> > m_packetBurstQueue;
|
||||
std::vector< std::list<Ptr<IdealControlMessage> > > m_controlMessagesQueue;
|
||||
|
||||
@@ -19,10 +19,10 @@
|
||||
* Nicola Baldo <nbaldo@cttc.es>
|
||||
*/
|
||||
|
||||
|
||||
#include <ns3/log.h>
|
||||
#include<map>
|
||||
#include <cmath>
|
||||
|
||||
#include <ns3/log.h>
|
||||
#include "lte-spectrum-value-helper.h"
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LteSpectrumValueHelper");
|
||||
@@ -103,7 +103,7 @@ LteSpectrumValueHelper::GetDownlinkCarrierFrequency (uint16_t nDl)
|
||||
(g_eutraChannelNumbers[i].rangeNdl2 >= nDl))
|
||||
{
|
||||
NS_LOG_LOGIC ("entry " << i << " fDlLow=" << g_eutraChannelNumbers[i].fDlLow);
|
||||
return g_eutraChannelNumbers[i].fDlLow + 0.1 * (nDl - g_eutraChannelNumbers[i].nOffsDl);
|
||||
return 1.0e6 * (g_eutraChannelNumbers[i].fDlLow + 0.1 * (nDl - g_eutraChannelNumbers[i].nOffsDl));
|
||||
}
|
||||
}
|
||||
NS_LOG_ERROR ("invalid EARFCN " << nDl);
|
||||
@@ -120,134 +120,149 @@ LteSpectrumValueHelper::GetUplinkCarrierFrequency (uint16_t nUl)
|
||||
(g_eutraChannelNumbers[i].rangeNul2 >= nUl))
|
||||
{
|
||||
NS_LOG_LOGIC ("entry " << i << " fUlLow=" << g_eutraChannelNumbers[i].fUlLow);
|
||||
return g_eutraChannelNumbers[i].fUlLow + 0.1 * (nUl - g_eutraChannelNumbers[i].nOffsUl);
|
||||
return 1.0e6 * (g_eutraChannelNumbers[i].fUlLow + 0.1 * (nUl - g_eutraChannelNumbers[i].nOffsUl));
|
||||
}
|
||||
}
|
||||
NS_LOG_ERROR ("invalid EARFCN " << nUl);
|
||||
return 0.0;
|
||||
}
|
||||
|
||||
|
||||
|
||||
Ptr<SpectrumModel> LteDownlinkSpectrumModel;
|
||||
Ptr<SpectrumModel> LteUplinkSpectrumModel;
|
||||
|
||||
class static_LteDownlinkSpectrumModel_initializer
|
||||
double
|
||||
LteSpectrumValueHelper::GetChannelBandwidth (uint8_t transmissionBandwidth)
|
||||
{
|
||||
public:
|
||||
static_LteDownlinkSpectrumModel_initializer ()
|
||||
{
|
||||
|
||||
/*
|
||||
* Operating Bands for the UL: 1920 MHz – 1980 MHz
|
||||
* see for details TR.36.101 - Tab 5.5-1
|
||||
*
|
||||
*/
|
||||
|
||||
std::vector<double> freqs;
|
||||
/* WILD HACK
|
||||
* banwidth 25
|
||||
*/
|
||||
for (int i = 0; i < 25; ++i)
|
||||
{
|
||||
|
||||
double centralFrequencyOfPRB = 1.920 + (i * 0.00018);
|
||||
freqs.push_back (centralFrequencyOfPRB * 1e9);
|
||||
}
|
||||
|
||||
LteDownlinkSpectrumModel = Create<SpectrumModel> (freqs);
|
||||
}
|
||||
|
||||
} static_LteDownlinkSpectrumModel_initializer_instance;
|
||||
NS_LOG_FUNCTION ((uint16_t) transmissionBandwidth);
|
||||
switch (transmissionBandwidth)
|
||||
{
|
||||
case 6:
|
||||
return 1.4e6;
|
||||
case 15:
|
||||
return 3.0e6;
|
||||
case 25:
|
||||
return 5.0e6;
|
||||
case 50:
|
||||
return 10.0e6;
|
||||
case 75:
|
||||
return 15.0e6;
|
||||
case 100:
|
||||
return 20.0e6;
|
||||
default:
|
||||
NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) transmissionBandwidth);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
|
||||
class static_LteUplinkSpectrumModel_initializer
|
||||
|
||||
struct LteSpectrumModelId
|
||||
{
|
||||
public:
|
||||
static_LteUplinkSpectrumModel_initializer ()
|
||||
{
|
||||
LteSpectrumModelId (uint16_t f, uint8_t b);
|
||||
uint16_t earfcn;
|
||||
uint8_t bandwidth;
|
||||
};
|
||||
|
||||
/*
|
||||
* Operating Bands for the DL: 2110 MHz – 2170 MHz
|
||||
* see for details TR.36.101 - Tab 5.5-1
|
||||
*
|
||||
*/
|
||||
|
||||
std::vector<double> freqs;
|
||||
/* WILD HACK
|
||||
* banwidth 25
|
||||
*/
|
||||
for (int i = 0; i < 25; ++i)
|
||||
{
|
||||
|
||||
double centralFrequencyOfPRB = 2.110 + (i * 0.00018);
|
||||
freqs.push_back (centralFrequencyOfPRB * 1e9);
|
||||
}
|
||||
|
||||
LteUplinkSpectrumModel = Create<SpectrumModel> (freqs);
|
||||
}
|
||||
|
||||
} static_LteUplinkSpectrumModel_initializer_instance;
|
||||
|
||||
|
||||
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateDownlinkTxPowerSpectralDensity (double powerTx, std::vector<int> channels)
|
||||
LteSpectrumModelId::LteSpectrumModelId (uint16_t f, uint8_t b)
|
||||
: earfcn (f),
|
||||
bandwidth (b)
|
||||
{
|
||||
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (LteDownlinkSpectrumModel);
|
||||
}
|
||||
|
||||
bool
|
||||
operator < (const LteSpectrumModelId& a, const LteSpectrumModelId& b)
|
||||
{
|
||||
return ( (a.earfcn < b.earfcn) || ( (a.earfcn == b.earfcn) && (a.bandwidth < b.bandwidth) ) );
|
||||
}
|
||||
|
||||
|
||||
static std::map<LteSpectrumModelId, Ptr<SpectrumModel> > g_lteSpectrumModelMap;
|
||||
|
||||
|
||||
Ptr<SpectrumModel>
|
||||
LteSpectrumValueHelper::GetSpectrumModel (uint16_t earfcn, uint8_t txBandwidthConfiguration)
|
||||
{
|
||||
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration);
|
||||
Ptr<SpectrumModel> ret;
|
||||
LteSpectrumModelId key (earfcn, txBandwidthConfiguration);
|
||||
std::map<LteSpectrumModelId, Ptr<SpectrumModel> >::iterator it = g_lteSpectrumModelMap.find (key);
|
||||
if (it != g_lteSpectrumModelMap.end ())
|
||||
{
|
||||
ret = it->second;
|
||||
}
|
||||
else
|
||||
{
|
||||
double fc = GetCarrierFrequency (earfcn);
|
||||
NS_ASSERT_MSG (fc != 0, "invalid EARFCN=" << earfcn);
|
||||
|
||||
double f = fc - (txBandwidthConfiguration * 180e3 / 2.0);
|
||||
Bands rbs;
|
||||
for (uint8_t numrb = 0; numrb < txBandwidthConfiguration; ++numrb)
|
||||
{
|
||||
BandInfo rb;
|
||||
rb.fl = f;
|
||||
f += 90e3;
|
||||
rb.fc = f;
|
||||
f += 90e3;
|
||||
rb.fh = f;
|
||||
rbs.push_back (rb);
|
||||
}
|
||||
ret = Create<SpectrumModel> (rbs);
|
||||
g_lteSpectrumModelMap.insert (std::pair<LteSpectrumModelId, Ptr<SpectrumModel> > (key, ret));
|
||||
}
|
||||
NS_LOG_LOGIC ("returning SpectrumModel::GetUid () == " << ret->GetUid ());
|
||||
return ret;
|
||||
}
|
||||
|
||||
// just needed to log a std::vector<int> properly...
|
||||
std::ostream&
|
||||
operator << (std::ostream& os, const std::vector<int>& v)
|
||||
{
|
||||
std::vector<int>::const_iterator it = v.begin ();
|
||||
while (it != v.end ())
|
||||
{
|
||||
os << *it << " " ;
|
||||
++it;
|
||||
}
|
||||
os << std::endl;
|
||||
return os;
|
||||
}
|
||||
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector <int> activeRbs)
|
||||
{
|
||||
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs);
|
||||
|
||||
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
|
||||
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (model);
|
||||
|
||||
// powerTx is expressed in dBm. We must convert it into natural unit.
|
||||
powerTx = pow (10., (powerTx - 30) / 10);
|
||||
double powerTxW = pow (10., (powerTx - 30) / 10);
|
||||
|
||||
double txPowerDensity = (powerTx / channels.size ()) / 180000;
|
||||
double txPowerDensity = (powerTxW / GetChannelBandwidth (txBandwidthConfiguration));
|
||||
|
||||
for (std::vector <int>::iterator it = channels.begin (); it != channels.end (); it++)
|
||||
for (std::vector <int>::iterator it = activeRbs.begin (); it != activeRbs.end (); it++)
|
||||
{
|
||||
int idSubChannel = (*it);
|
||||
(*txPsd)[idSubChannel] = txPowerDensity;
|
||||
int rbId = (*it);
|
||||
(*txPsd)[rbId] = txPowerDensity;
|
||||
}
|
||||
|
||||
NS_LOG_LOGIC (*txPsd);
|
||||
|
||||
return txPsd;
|
||||
}
|
||||
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateUplinkTxPowerSpectralDensity (double powerTx, std::vector<int> channels)
|
||||
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double noiseFigure)
|
||||
{
|
||||
Ptr<SpectrumValue> txPsd = Create <SpectrumValue> (LteUplinkSpectrumModel);
|
||||
|
||||
// powerTx is expressed in dBm. We must convert it into natural unit.
|
||||
powerTx = pow (10., (powerTx - 30) / 10);
|
||||
|
||||
double txPowerDensity = (powerTx / channels.size ()) / 180000;
|
||||
|
||||
for (std::vector <int>::iterator it = channels.begin (); it != channels.end (); it++)
|
||||
{
|
||||
int idSubChannel = (*it);
|
||||
(*txPsd)[idSubChannel] = txPowerDensity;
|
||||
}
|
||||
|
||||
return txPsd;
|
||||
}
|
||||
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (double noiseFigure)
|
||||
{
|
||||
return CreateNoisePowerSpectralDensity (noiseFigure, LteDownlinkSpectrumModel);
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (double noiseFigure)
|
||||
{
|
||||
return CreateNoisePowerSpectralDensity (noiseFigure, LteUplinkSpectrumModel);
|
||||
NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << noiseFigure);
|
||||
Ptr<SpectrumModel> model = GetSpectrumModel (earfcn, txBandwidthConfiguration);
|
||||
return CreateNoisePowerSpectralDensity (noiseFigure, model);
|
||||
}
|
||||
|
||||
Ptr<SpectrumValue>
|
||||
LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, Ptr<SpectrumModel> spectrumModel)
|
||||
{
|
||||
NS_LOG_FUNCTION (noiseFigureDb << spectrumModel);
|
||||
double noiseFigureLinear = pow (10.0, noiseFigureDb / 10.0);
|
||||
static const double BOLTZMANN = 1.3803e-23;
|
||||
static const double ROOM_TEMPERATURE = 290.0;
|
||||
|
||||
@@ -43,7 +43,7 @@ public:
|
||||
*
|
||||
* \param earfcn the EARFCN
|
||||
*
|
||||
* \return the carrier frequency in MHz
|
||||
* \return the carrier frequency in Hz
|
||||
*/
|
||||
static double GetCarrierFrequency (uint16_t earfcn);
|
||||
|
||||
@@ -54,7 +54,7 @@ public:
|
||||
*
|
||||
* \param earfcn the EARFCN
|
||||
*
|
||||
* \return the dowlink carrier frequency in MHz
|
||||
* \return the dowlink carrier frequency in Hz
|
||||
*/
|
||||
static double GetDownlinkCarrierFrequency (uint16_t earfcn);
|
||||
|
||||
@@ -65,44 +65,63 @@ public:
|
||||
*
|
||||
* \param earfcn the EARFCN
|
||||
*
|
||||
* \return the uplink carrier frequency in MHz
|
||||
* \return the uplink carrier frequency in Hz
|
||||
*/
|
||||
static double GetUplinkCarrierFrequency (uint16_t earfcn);
|
||||
|
||||
/**
|
||||
* \brief create spectrum value
|
||||
* \param powerTx the power transmission in dBm
|
||||
* \param channels the list of sub channels where the signal will be sent
|
||||
* \return a Ptr to a newly created SpectrumValue instance
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param txBandwidthConf the tranmission bandwidth
|
||||
* configuration in number of resource blocks
|
||||
*
|
||||
* \return the nominal channel bandwidth in Hz as per 3GPP TS 36.101
|
||||
*/
|
||||
static Ptr<SpectrumValue> CreateDownlinkTxPowerSpectralDensity (double powerTx, std::vector <int> channels);
|
||||
static double GetChannelBandwidth (uint8_t txBandwidthConf);
|
||||
|
||||
/**
|
||||
*
|
||||
* \param earfcn the carrier frequency (EARFCN) at which reception
|
||||
* is made
|
||||
* \param bandwidth the Transmission Bandwidth Configuration in
|
||||
* number of resource blocks
|
||||
*
|
||||
* \return the static SpectrumModel instance corresponding to the
|
||||
* given carrier frequency and transmission bandwidth
|
||||
* configuration. If such SpectrumModel does not exist, it is
|
||||
* created.
|
||||
*/
|
||||
static Ptr<SpectrumModel> GetSpectrumModel (uint16_t earfcn, uint8_t bandwdith);
|
||||
|
||||
|
||||
/**
|
||||
* \brief create spectrum value
|
||||
* \param powerTx the power transmission in dBm
|
||||
* \param channels the list of sub channels where the signal will be sent
|
||||
* create a spectrum value representing the power spectral
|
||||
* density of a signal to be transmitted. See 3GPP TS 36.101 for
|
||||
* a definition of most of the parameters described here.
|
||||
*
|
||||
* \param earfcn the carrier frequency (EARFCN) of the transmission
|
||||
* \param bandwidth the Transmission Bandwidth Configuration in
|
||||
* number of resource blocks
|
||||
* \param txPower the total power in dBm over the whole bandwidth
|
||||
* \param ActiveRbs the list of Active Resource Blocks (PRBs)
|
||||
*
|
||||
* \return a Ptr to a newly created SpectrumValue instance
|
||||
*/
|
||||
static Ptr<SpectrumValue> CreateUplinkTxPowerSpectralDensity (double powerTx, std::vector <int> channels);
|
||||
static Ptr<SpectrumValue> CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t bandwdith, double powerTx, std::vector <int> activeRbs);
|
||||
|
||||
|
||||
/**
|
||||
* create a SpectrumValue that models the power spectral density of AWGN
|
||||
*
|
||||
* \param earfcn the carrier frequency (EARFCN) at which reception
|
||||
* is made
|
||||
* \param bandwidth the Transmission Bandwidth Configuration in
|
||||
* number of resource blocks
|
||||
* \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 (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
|
||||
*
|
||||
* \return a Ptr to a newly created SpectrumValue instance
|
||||
*/
|
||||
static Ptr<SpectrumValue> CreateUplinkNoisePowerSpectralDensity (double noiseFigure);
|
||||
static Ptr<SpectrumValue> CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_t bandwdith, double noiseFigure);
|
||||
|
||||
/**
|
||||
* create a SpectrumValue that models the power spectral density of AWGN
|
||||
|
||||
@@ -144,7 +144,7 @@ LteUeNetDevice::SetTargetEnb (Ptr<LteEnbNetDevice> enb)
|
||||
NS_LOG_FUNCTION (this << enb);
|
||||
m_targetEnb = enb;
|
||||
|
||||
// WILD HACK - should go through RRC and then through PHY SAP
|
||||
// should go through RRC and then through PHY SAP
|
||||
m_phy->DoSetCellId (enb->GetCellId ());
|
||||
}
|
||||
|
||||
@@ -168,6 +168,9 @@ LteUeNetDevice::DoStart (void)
|
||||
{
|
||||
UpdateConfig ();
|
||||
m_imsi = ++m_imsiCounter;
|
||||
m_phy->Start ();
|
||||
m_mac->Start ();
|
||||
m_rrc->Start ();
|
||||
}
|
||||
|
||||
|
||||
|
||||
@@ -153,6 +153,14 @@ LteUePhy::GetTypeId (void)
|
||||
return tid;
|
||||
}
|
||||
|
||||
void
|
||||
LteUePhy::DoStart ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_noiseFigure);
|
||||
m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
|
||||
LtePhy::DoStart ();
|
||||
}
|
||||
|
||||
void
|
||||
LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s)
|
||||
@@ -173,8 +181,6 @@ LteUePhy::SetNoiseFigure (double nf)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << nf);
|
||||
m_noiseFigure = nf;
|
||||
Ptr<SpectrumValue> noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (m_noiseFigure);
|
||||
m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd);
|
||||
}
|
||||
|
||||
double
|
||||
@@ -267,7 +273,7 @@ LteUePhy::CreateTxPowerSpectralDensity ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
LteSpectrumValueHelper psdHelper;
|
||||
Ptr<SpectrumValue> psd = psdHelper.CreateUplinkTxPowerSpectralDensity (GetTxPower (), GetSubChannelsForTransmission ());
|
||||
Ptr<SpectrumValue> psd = psdHelper.CreateTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ());
|
||||
|
||||
return psd;
|
||||
}
|
||||
|
||||
@@ -63,9 +63,10 @@ public:
|
||||
|
||||
virtual ~LteUePhy ();
|
||||
|
||||
virtual void DoDispose ();
|
||||
// inherited from Object
|
||||
static TypeId GetTypeId (void);
|
||||
|
||||
virtual void DoStart (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \brief Get the PHY SAP provider
|
||||
|
||||
@@ -122,32 +122,32 @@ public:
|
||||
static LteEarfcnTestSuite g_lteEarfcnTestSuite;
|
||||
|
||||
LteEarfcnTestSuite::LteEarfcnTestSuite ()
|
||||
: TestSuite ("lte-earfcn", SYSTEM)
|
||||
: TestSuite ("lte-earfcn", UNIT)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=500", 500, 2110+50));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=1000", 1000, 1930+(100-60)));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=1301", 1301, 1805+(130.1-120)));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=500", 500, 2160e6));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=1000", 1000, 1970e6));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=1301", 1301, 1815.1e6));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=7000", 7000, 0.0));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=20000", 20000, 0.0));
|
||||
AddTestCase (new LteEarfcnDlTestCase ("DL EARFCN=50000", 50000, 0.0));
|
||||
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=18100", 18100, 1920 + 1810 - 1800));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=19000", 19000, 1850 + 1900 - 1860));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=19400", 19400, 1710 + 1940 - 1920));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=18100", 18100, 1930e6));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=19000", 19000, 1890e6));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=19400", 19400, 1730e6));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=10", 10, 0.0));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=1000", 1000, 0.0));
|
||||
AddTestCase (new LteEarfcnUlTestCase ("UL EARFCN=50000", 50000, 0.0));
|
||||
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=500", 500, 2110+50));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=1000", 1000, 1930+(100-60)));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=1301", 1301, 1805+(130.1-120)));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=500", 500, 2160e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=1000", 1000, 1970e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=1301", 1301, 1815.1e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=8000", 8000, 0.0));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=18100", 18100, 1920 + 1810 - 1800));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=19000", 19000, 1850 + 1900 - 1860));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=19400", 19400, 1710 + 1940 - 1920));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=18100", 18100, 1930e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=19000", 19000, 1890e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=19400", 19400, 1730e6));
|
||||
AddTestCase (new LteEarfcnTestCase ("EARFCN=50000", 50000, 0.0));
|
||||
}
|
||||
|
||||
|
||||
@@ -57,6 +57,7 @@ def build(bld):
|
||||
'test/lte-test-rr-ff-mac-scheduler.cc',
|
||||
'test/lte-test-pf-ff-mac-scheduler.cc',
|
||||
'test/lte-test-earfcn.cc',
|
||||
'test/lte-test-spectrum-value-helper.cc',
|
||||
]
|
||||
|
||||
headers = bld.new_task_gen('ns3header')
|
||||
|
||||
Reference in New Issue
Block a user