From 29cf063110c699c1fd446f3e734a93dc1a7b1426 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 6 Apr 2011 16:21:55 +0200 Subject: [PATCH 1/3] restored input file functionality removed by changeset 6950:7a7b4ad007b0 --- src/lte/examples/lena-first-sim.cc | 16 +++++++++++++++- 1 file changed, 15 insertions(+), 1 deletion(-) diff --git a/src/lte/examples/lena-first-sim.cc b/src/lte/examples/lena-first-sim.cc index a0149bb6d..54f5b27c1 100644 --- a/src/lte/examples/lena-first-sim.cc +++ b/src/lte/examples/lena-first-sim.cc @@ -23,11 +23,25 @@ #include "ns3/network-module.h" #include "ns3/mobility-module.h" #include "ns3/lte-module.h" +#include "ns3/config-store.h" //#include "ns3/gtk-config-store.h" using namespace ns3; int main (int argc, char *argv[]) -{ +{ + CommandLine cmd; + cmd.Parse (argc, argv); + + // to save a template default attribute file run it like this: + // ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Save --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-first-sim + // + // to load a previously created default attribute file + // ./waf --command-template="%s --ns3::ConfigStore::Filename=input-defaults.txt --ns3::ConfigStore::Mode=Load --ns3::ConfigStore::FileFormat=RawText" --run src/lte/examples/lena-first-sim + // note that the latter will override any of the defaults set via command-line arguments + // + ConfigStore inputConfig; + inputConfig.ConfigureDefaults (); + LenaHelper lena; lena.EnableLogComponents (); From 6d7081db168e60f1ff6d154106236613d70a2c98 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Wed, 6 Apr 2011 17:04:48 +0200 Subject: [PATCH 2/3] attributes for ul & dl bandwidth at the eNB --- src/lte/helper/lena-helper.cc | 12 ++- src/lte/model/lte-enb-net-device.cc | 133 +++++++++++++++++++++------- src/lte/model/lte-enb-net-device.h | 52 ++++++++--- src/lte/model/lte-ue-net-device.cc | 5 -- 4 files changed, 149 insertions(+), 53 deletions(-) diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 8c29e7675..a6187cca2 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -258,15 +258,19 @@ LenaHelper::Attach (Ptr ueDevice, Ptr enbDevice) Ptr ueRrc = ueDevice->GetObject ()->GetRrc (); ueRrc->ConfigureUe (rnti); - // attach UE PHY to eNB + // attach UE to eNB ueDevice->GetObject ()->SetTargetEnb (enbDevice->GetObject ()); - // WILD HACK - should be done through PHY SAP, probably passing by RRC - Ptr uePhy = ueDevice->GetObject ()->GetPhy (); - uePhy->SetRnti (rnti); + // connect at the PHY layer Ptr enbPhy = enbDevice->GetObject ()->GetPhy (); + Ptr uePhy = ueDevice->GetObject ()->GetPhy (); enbPhy->AddUePhy (rnti, uePhy); + + // WILD HACK - should be done through PHY SAP, probably passing by RRC + uePhy->SetRnti (rnti); + uePhy->DoSetBandwidth (enbDevice->GetObject ()->GetUlBandwidth (), + enbDevice->GetObject ()->GetDlBandwidth ()); } diff --git a/src/lte/model/lte-enb-net-device.cc b/src/lte/model/lte-enb-net-device.cc index f8de717a5..3c48fe38b 100644 --- a/src/lte/model/lte-enb-net-device.cc +++ b/src/lte/model/lte-enb-net-device.cc @@ -60,6 +60,34 @@ TypeId LteEnbNetDevice::GetTypeId (void) PointerValue (), MakePointerAccessor (&LteEnbNetDevice::m_rrc), MakePointerChecker ()) + .AddAttribute ("LteEnbMac", + "The MAC associated to this EnbNetDevice", + PointerValue (), + MakePointerAccessor (&LteEnbNetDevice::m_mac), + MakePointerChecker ()) + .AddAttribute ("FfMacScheduler", + "The scheduler associated to this EnbNetDevice", + PointerValue (), + MakePointerAccessor (&LteEnbNetDevice::m_scheduler), + MakePointerChecker ()) + .AddAttribute ("LteEnbPhy", + "The PHY associated to this EnbNetDevice", + PointerValue (), + MakePointerAccessor (&LteEnbNetDevice::m_phy), + MakePointerChecker ()) + .AddAttribute ("UlBandwidth", + "Uplink bandwidth in number of Resource Blocks", + UintegerValue (25), + MakeUintegerAccessor (&LteEnbNetDevice::SetUlBandwidth, + &LteEnbNetDevice::GetUlBandwidth), + MakeUintegerChecker ()) + .AddAttribute ("DlBandwidth", + "Downlink bandwidth in number of Resource Blocks", + UintegerValue (25), + MakeUintegerAccessor (&LteEnbNetDevice::SetDlBandwidth, + &LteEnbNetDevice::GetDlBandwidth), + MakeUintegerChecker ()) + ; return tid; } @@ -109,22 +137,9 @@ LteEnbNetDevice::DoDispose () } -void -LteEnbNetDevice::UpdateConfig (void) -{ - NS_LOG_FUNCTION (this); - - m_rrc->ConfigureCell (25, 25); - - // WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC - m_phy->DoSetBandwidth (25,25); - m_phy->DoSetCellId (m_cellId); - -} - Ptr -LteEnbNetDevice::GetMac (void) +LteEnbNetDevice::GetMac (void) const { NS_LOG_FUNCTION (this); return m_mac; @@ -139,6 +154,71 @@ LteEnbNetDevice::GetPhy (void) const } +Ptr +LteEnbNetDevice::GetRrc () const +{ + return m_rrc; +} + +uint16_t +LteEnbNetDevice::GetCellId () const +{ + return m_cellId; +} + +uint8_t +LteEnbNetDevice::GetUlBandwidth () const +{ + return m_ulBandwidth; +} + +void +LteEnbNetDevice::SetUlBandwidth (uint8_t bw) +{ + switch (bw) + { + case 6: + case 15: + case 25: + case 50: + case 75: + case 100: + m_ulBandwidth = bw; + break; + + default: + NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); + break; + } +} + +uint8_t +LteEnbNetDevice::GetDlBandwidth () const +{ + return m_dlBandwidth; +} + +void +LteEnbNetDevice::SetDlBandwidth (uint8_t bw) +{ + switch (bw) + { + case 6: + case 15: + case 25: + case 50: + case 75: + case 100: + m_dlBandwidth = bw; + break; + + default: + NS_FATAL_ERROR ("invalid bandwidth value " << (uint16_t) bw); + break; + } +} + + bool LteEnbNetDevice::DoSend (Ptr packet, const Mac48Address& source, const Mac48Address& dest, uint16_t protocolNumber) @@ -178,26 +258,17 @@ LteEnbNetDevice::DoReceive (Ptr p) void -LteEnbNetDevice::SendIdealPdcchMessage (void) +LteEnbNetDevice::UpdateConfig (void) { NS_LOG_FUNCTION (this); - /* - * Get both PDCCH ideal message for UL and DL and - * set assigned resources to UEs using - * SendAssignedDLResources and SendAssignedULResources - */ + + m_rrc->ConfigureCell (m_ulBandwidth, m_dlBandwidth); + + // WILD HACK - should use the PHY SAP instead. Probably should handle this through the RRC + m_phy->DoSetBandwidth (m_ulBandwidth, m_dlBandwidth); + m_phy->DoSetCellId (m_cellId); + } -Ptr -LteEnbNetDevice::GetRrc () -{ - return m_rrc; -} - -uint16_t -LteEnbNetDevice::GetCellId () -{ - return m_cellId; -} } // namespace ns3 diff --git a/src/lte/model/lte-enb-net-device.h b/src/lte/model/lte-enb-net-device.h index 01a49ca04..36f2bea29 100644 --- a/src/lte/model/lte-enb-net-device.h +++ b/src/lte/model/lte-enb-net-device.h @@ -68,29 +68,43 @@ public: /** * \return a pointer to the MAC */ - Ptr GetMac (void); + Ptr GetMac (void) const; /** * \return a pointer to the physical layer. */ Ptr GetPhy (void) const; - - - - Ptr GetRrc (); - - /** - * \brief Send the PDCCH ideal mesages under an - * ideal control channel + + /** + * \return a pointer to the Radio Resource Control instance of the eNB */ - void SendIdealPdcchMessage (void); - + Ptr GetRrc () const; /** - * * \return the Cell Identifier of this eNB */ - uint16_t GetCellId (); + uint16_t GetCellId () const; + + /** + * \return the uplink bandwidth in RBs + */ + uint8_t GetUlBandwidth () const; + + /** + * \param bw the uplink bandwidth in RBs + */ + void SetUlBandwidth (uint8_t bw); + + /** + * \return the downlink bandwidth in RBs + */ + uint8_t GetDlBandwidth () const; + + /** + * \param bw the downlink bandwidth in RBs + */ + void SetDlBandwidth (uint8_t bw); + private: bool DoSend (Ptr packet, @@ -100,6 +114,14 @@ private: void DoReceive (Ptr p); + /** + * Several attributes (e.g., the bandwidth) are exported as + * attributes of the LteEnbNetDevice from a user perspective, but + * are actually used also in other modules as well (the RRC, the + * PHY, the scheduler...). This methods takes care of updating the + * configuration of all modules so that their copy of the attribute + * values is in sync with the one in the LteEnbNetDevice. + */ void UpdateConfig (void); Ptr m_mac; @@ -113,6 +135,10 @@ private: uint16_t m_cellId; /**< Cell Identifer. Part of the CGI, see TS 29.274, section 8.21.1 */ static uint16_t m_cellIdCounter; + + uint8_t m_dlBandwidth; /**< downlink bandwidth in RBs */ + uint8_t m_ulBandwidth; /**< uplink bandwidth in RBs */ + }; } // namespace ns3 diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index 865c6c93b..6cd8f29ff 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -98,11 +98,6 @@ void LteUeNetDevice::UpdateConfig (void) { NS_LOG_FUNCTION (this); - /** - * WILD HACK - * to be translated to PHY-SAP primitive, or maybe to be set through RRC - */ - m_phy->DoSetBandwidth (25,25); } From 8a30691da39439351cdb77af43f2128420558d78 Mon Sep 17 00:00:00 2001 From: mmiozzo Date: Mon, 11 Apr 2011 06:24:50 -0700 Subject: [PATCH 3/3] PfFfMacScheduler updated for multiples rlcPdu --- src/lte/model/lte-enb-mac.cc | 2 +- src/lte/model/lte-enb-phy.cc | 3 ++- src/lte/model/lte-interference.cc | 6 ++++++ src/lte/model/pf-ff-mac-scheduler.cc | 15 +++++++-------- src/lte/model/rr-ff-mac-scheduler.cc | 19 ++++++++++--------- 5 files changed, 26 insertions(+), 19 deletions(-) diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index b9a2f837e..d2b8e624d 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -515,7 +515,7 @@ LteEnbMac::ReceiveDlCqiIdealControlMessage (Ptr msg) // NS_LOG_FUNCTION (this << msg->GetSourceDevice () << msg->GetDestinationDevice ()); CqiListElement_s dlcqi = msg->GetDlCqi (); - NS_LOG_FUNCTION(this << "Enb Received DCI rnti" << dlcqi.m_rnti); + NS_LOG_FUNCTION(this << "Enb Received DL-CQI rnti" << dlcqi.m_rnti); m_dlCqiReceived.push_back (dlcqi); } diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 587fee350..2eab86457 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -418,13 +418,14 @@ LteEnbPhy::CreateUlCqiReport (const SpectrumValue& sinr) UlCqi_s ulcqi; ulcqi.m_type = UlCqi_s::PUSCH; int i = 0; + NS_LOG_DEBUG (this << "EVALUATING UL-CQI"); for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++) { double sinrdb = 10*log10 ((*it)); // convert from double to fixed point notation Sxxxxxxxxxxx.xxx int16_t sinrFp = LteFfConverter::double2fpS11dot3 (sinrdb); ulcqi.m_sinr.push_back (sinrFp); - //NS_LOG_DEBUG(this << " RB " << i << " SINR FP " << sinrFp << " orig " << sinrdb); + NS_LOG_DEBUG(this << " RB " << i << " SINR FP " << sinrFp << " orig " << sinrdb); i++; } return (ulcqi); diff --git a/src/lte/model/lte-interference.cc b/src/lte/model/lte-interference.cc index 91191cb3a..5a6c4bd35 100644 --- a/src/lte/model/lte-interference.cc +++ b/src/lte/model/lte-interference.cc @@ -141,6 +141,8 @@ void LteInterference::ConditionallyEvaluateChunk () { NS_LOG_FUNCTION (this); + if (m_receiving) NS_LOG_DEBUG (this << " Receiving"); + NS_LOG_DEBUG (this << " now " << Now () << " last " << m_lastChangeTime); if (m_receiving && (Now () > m_lastChangeTime)) { SpectrumValue sinr = (*m_rxSignal) / ((*m_allSignals) - (*m_rxSignal) + (*m_noise)); @@ -150,6 +152,10 @@ LteInterference::ConditionallyEvaluateChunk () (*it)->EvaluateSinrChunk (sinr, duration); } } + else + { + NS_LOG_DEBUG (this << " NO EV"); + } } void diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index dab2fe161..360d646cb 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -490,6 +490,7 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << rbgPerFlow); // create the DlDciListElement_s DlDciListElement_s newDci; + std::vector newRlcPduLe; newDci.m_rnti = (*flowIt).m_rnti; newDci.m_resAlloc = 0; newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) @@ -525,18 +526,16 @@ PfFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched //NS_LOG_DEBUG (this << " nPRB " << nPRB << " tbSize " << newDci.m_tbsSize.at (0)); rlcPduSize += newDci.m_tbsSize.at (i); + RlcPduListElement_s newRlcEl; + newRlcEl.m_logicalChannelIdentity = (*flowIt).m_lcId; + // NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity); + newRlcEl.m_size = newDci.m_tbsSize.at (i); + + newRlcPduLe.push_back (newRlcEl); } newEl.m_dci = newDci; // ...more parameters -> ingored in this version - RlcPduListElement_s newRlcEl; - newRlcEl.m_logicalChannelIdentity = (*flowIt).m_lcId; - // NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity); - newRlcEl.m_size = rlcPduSize; // TBD (max length of RLC-PDU in bytes) - - std::vector newRlcPduLe; - newRlcPduLe.push_back (newRlcEl); - newEl.m_rlcPduList.push_back (newRlcPduLe); ret.m_buildDataList.push_back (newEl); diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 987c0f18e..db489fcb9 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -408,6 +408,7 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched // NS_LOG_DEBUG (this << "Allocate user " << newEl.m_rnti << " rbg " << rbgPerFlow); // create the DlDciListElement_s DlDciListElement_s newDci; + std::vector newRlcPduLe; newDci.m_rnti = (*it).m_rnti; newDci.m_resAlloc = 0; newDci.m_rbBitmap = 0; // TBD (32 bit bitmap see 7.1.6 of 36.213) @@ -424,14 +425,14 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched int rlcPduSize = 0; for (int i = 0; i < nbOfTbsInNewDci; i++) { - std::map ::iterator it = m_p10CqiRxed.find (newDci.m_rnti); - if (it == m_p10CqiRxed.end ()) + std::map ::iterator itCqi = m_p10CqiRxed.find (newDci.m_rnti); + if (itCqi == m_p10CqiRxed.end ()) { newDci.m_mcs.push_back (1); // no info on this user -> lowest MCS } else { - newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*it).second) ); + newDci.m_mcs.push_back ( LteAmc::GetMcsFromCqi ((*itCqi).second) ); } int nPRB = rbgSize * rbgPerFlow; newDci.m_tbsSize.push_back ( (LteAmc::GetTbSizeFromMcs (newDci.m_mcs.at (i), nPRB) / 8) ); // (size of TB in bytes according to table 7.1.7.2.1-1 of 36.213) @@ -439,17 +440,17 @@ RrFfMacScheduler::DoSchedDlTriggerReq (const struct FfMacSchedSapProvider::Sched newDci.m_rv.push_back (0); // TBD (redundancy version) rlcPduSize += newDci.m_tbsSize.at (i); + RlcPduListElement_s newRlcEl; + newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity; + // NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity); + newRlcEl.m_size = newDci.m_tbsSize.at (i); + newRlcPduLe.push_back (newRlcEl); } newEl.m_dci = newDci; // ...more parameters -> ignored in this version - RlcPduListElement_s newRlcEl; - newRlcEl.m_logicalChannelIdentity = (*it).m_logicalChannelIdentity; - // NS_LOG_DEBUG (this << "LCID " << (uint32_t) newRlcEl.m_logicalChannelIdentity); - newRlcEl.m_size = rlcPduSize; // TBD (max length of RLC-PDU in bytes) - std::vector newRlcPduLe; - newRlcPduLe.push_back (newRlcEl); + newEl.m_rlcPduList.push_back (newRlcPduLe); ret.m_buildDataList.push_back (newEl);