diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 7f79028b0..a687bf816 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -272,7 +272,6 @@ LenaHelper::InstallSingleUeDevice (Ptr n) n->AddDevice (dev); dlPhy->SetGenericPhyRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy)); - dev->Start (); return dev; } @@ -306,8 +305,12 @@ LenaHelper::Attach (Ptr ueDevice, Ptr enbDevice) // WILD HACK - should be done through PHY SAP, probably passing by RRC uePhy->SetRnti (rnti); - uePhy->DoSetBandwidth (enbDevice->GetObject ()->GetUlBandwidth (), + uePhy->DoSetBandwidth (enbDevice->GetObject ()->GetUlBandwidth (), enbDevice->GetObject ()->GetDlBandwidth ()); + uePhy->DoSetEarfcn (enbDevice->GetObject ()->GetDlEarfcn (), + enbDevice->GetObject ()->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); diff --git a/src/lte/model/lte-enb-net-device.cc b/src/lte/model/lte-enb-net-device.cc index 0f2f2d993..df8b996f4 100644 --- a/src/lte/model/lte-enb-net-device.cc +++ b/src/lte/model/lte-enb-net-device.cc @@ -76,13 +76,13 @@ TypeId LteEnbNetDevice::GetTypeId (void) MakePointerAccessor (&LteEnbNetDevice::m_phy), MakePointerChecker ()) .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 ()) .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 ()) + .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 ()) + .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 ()) ; 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); } diff --git a/src/lte/model/lte-enb-net-device.h b/src/lte/model/lte-enb-net-device.h index 684fc5199..33774ff88 100644 --- a/src/lte/model/lte-enb-net-device.h +++ b/src/lte/model/lte-enb-net-device.h @@ -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 */ }; diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 9707fefc4..929eea7ef 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -158,6 +158,16 @@ LteEnbPhy::DoDispose () LtePhy::DoDispose (); } +void +LteEnbPhy::DoStart () +{ + NS_LOG_FUNCTION (this); + Ptr 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 noisePsd = LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (m_noiseFigure); - m_uplinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd); } double @@ -268,8 +276,7 @@ LteEnbPhy::CreateTxPowerSpectralDensity () { NS_LOG_FUNCTION (this); - LteSpectrumValueHelper psdHelper; - Ptr psd = psdHelper.CreateDownlinkTxPowerSpectralDensity (GetTxPower (), GetDownlinkSubChannels ()); + Ptr psd = LteSpectrumValueHelper::CreateTxPowerSpectralDensity (m_dlEarfcn, m_dlBandwidth, m_txPower, GetDownlinkSubChannels ()); return psd; } diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 8b0f1af70..e83be1e22 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -57,7 +57,9 @@ public: virtual ~LteEnbPhy (); + // inherited from Object static TypeId GetTypeId (void); + virtual void DoStart (void); virtual void DoDispose (void); diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index de3952e91..25d18cb5b 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -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 diff --git a/src/lte/model/lte-phy.h b/src/lte/model/lte-phy.h index 9b3f1dc81..184070e99 100644 --- a/src/lte/model/lte-phy.h +++ b/src/lte/model/lte-phy.h @@ -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 > m_packetBurstQueue; std::vector< std::list > > m_controlMessagesQueue; diff --git a/src/lte/model/lte-spectrum-value-helper.cc b/src/lte/model/lte-spectrum-value-helper.cc index 83fbb9df3..8d834c3bb 100644 --- a/src/lte/model/lte-spectrum-value-helper.cc +++ b/src/lte/model/lte-spectrum-value-helper.cc @@ -19,10 +19,10 @@ * Nicola Baldo */ - -#include +#include #include +#include #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 LteDownlinkSpectrumModel; -Ptr 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 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 (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 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 (freqs); - } - -} static_LteUplinkSpectrumModel_initializer_instance; - - - - -Ptr -LteSpectrumValueHelper::CreateDownlinkTxPowerSpectralDensity (double powerTx, std::vector channels) +LteSpectrumModelId::LteSpectrumModelId (uint16_t f, uint8_t b) + : earfcn (f), + bandwidth (b) { - Ptr txPsd = Create (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 > g_lteSpectrumModelMap; + + +Ptr +LteSpectrumValueHelper::GetSpectrumModel (uint16_t earfcn, uint8_t txBandwidthConfiguration) +{ + NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration); + Ptr ret; + LteSpectrumModelId key (earfcn, txBandwidthConfiguration); + std::map >::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 (rbs); + g_lteSpectrumModelMap.insert (std::pair > (key, ret)); + } + NS_LOG_LOGIC ("returning SpectrumModel::GetUid () == " << ret->GetUid ()); + return ret; +} + +// just needed to log a std::vector properly... +std::ostream& +operator << (std::ostream& os, const std::vector& v) +{ + std::vector::const_iterator it = v.begin (); + while (it != v.end ()) + { + os << *it << " " ; + ++it; + } + os << std::endl; + return os; +} + + +Ptr +LteSpectrumValueHelper::CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double powerTx, std::vector activeRbs) +{ + NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << powerTx << activeRbs); + + Ptr model = GetSpectrumModel (earfcn, txBandwidthConfiguration); + Ptr txPsd = Create (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 ::iterator it = channels.begin (); it != channels.end (); it++) + for (std::vector ::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 -LteSpectrumValueHelper::CreateUplinkTxPowerSpectralDensity (double powerTx, std::vector channels) +LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_t txBandwidthConfiguration, double noiseFigure) { - Ptr txPsd = Create (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 ::iterator it = channels.begin (); it != channels.end (); it++) - { - int idSubChannel = (*it); - (*txPsd)[idSubChannel] = txPowerDensity; - } - - return txPsd; -} - - -Ptr -LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (double noiseFigure) -{ - return CreateNoisePowerSpectralDensity (noiseFigure, LteDownlinkSpectrumModel); -} - -Ptr -LteSpectrumValueHelper::CreateUplinkNoisePowerSpectralDensity (double noiseFigure) -{ - return CreateNoisePowerSpectralDensity (noiseFigure, LteUplinkSpectrumModel); + NS_LOG_FUNCTION (earfcn << (uint16_t) txBandwidthConfiguration << noiseFigure); + Ptr model = GetSpectrumModel (earfcn, txBandwidthConfiguration); + return CreateNoisePowerSpectralDensity (noiseFigure, model); } Ptr LteSpectrumValueHelper::CreateNoisePowerSpectralDensity (double noiseFigureDb, Ptr 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; diff --git a/src/lte/model/lte-spectrum-value-helper.h b/src/lte/model/lte-spectrum-value-helper.h index 9083dc923..70ce046a9 100644 --- a/src/lte/model/lte-spectrum-value-helper.h +++ b/src/lte/model/lte-spectrum-value-helper.h @@ -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 CreateDownlinkTxPowerSpectralDensity (double powerTx, std::vector 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 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 CreateUplinkTxPowerSpectralDensity (double powerTx, std::vector channels); + static Ptr CreateTxPowerSpectralDensity (uint16_t earfcn, uint8_t bandwdith, double powerTx, std::vector 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 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 CreateUplinkNoisePowerSpectralDensity (double noiseFigure); + static Ptr CreateNoisePowerSpectralDensity (uint16_t earfcn, uint8_t bandwdith, double noiseFigure); /** * create a SpectrumValue that models the power spectral density of AWGN diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index aceaf3c0c..b7fda8daf 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -144,7 +144,7 @@ LteUeNetDevice::SetTargetEnb (Ptr 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 (); } diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index a98736cf3..40708d7eb 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -153,6 +153,14 @@ LteUePhy::GetTypeId (void) return tid; } +void +LteUePhy::DoStart () +{ + NS_LOG_FUNCTION (this); + Ptr 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 noisePsd = LteSpectrumValueHelper::CreateDownlinkNoisePowerSpectralDensity (m_noiseFigure); - m_downlinkSpectrumPhy->SetNoisePowerSpectralDensity (noisePsd); } double @@ -267,7 +273,7 @@ LteUePhy::CreateTxPowerSpectralDensity () { NS_LOG_FUNCTION (this); LteSpectrumValueHelper psdHelper; - Ptr psd = psdHelper.CreateUplinkTxPowerSpectralDensity (GetTxPower (), GetSubChannelsForTransmission ()); + Ptr psd = psdHelper.CreateTxPowerSpectralDensity (m_ulEarfcn, m_ulBandwidth, m_txPower, GetSubChannelsForTransmission ()); return psd; } diff --git a/src/lte/model/lte-ue-phy.h b/src/lte/model/lte-ue-phy.h index 376ca45d5..574ed083e 100644 --- a/src/lte/model/lte-ue-phy.h +++ b/src/lte/model/lte-ue-phy.h @@ -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 diff --git a/src/lte/test/lte-test-earfcn.cc b/src/lte/test/lte-test-earfcn.cc index 755afdfc1..857d29abe 100644 --- a/src/lte/test/lte-test-earfcn.cc +++ b/src/lte/test/lte-test-earfcn.cc @@ -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)); } diff --git a/src/lte/wscript b/src/lte/wscript index af8bc8d98..cae9dada4 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -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')