From b372eab5e72961a3dfb7d90d62a95632bf60f903 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Thu, 24 Mar 2011 10:20:18 +0100 Subject: [PATCH 1/8] MAC, RRC and Scheduler created by LenaHelper --- src/lte/examples/lena-first-sim.cc | 2 +- src/lte/helper/lena-helper.cc | 54 +++++++++++++++++++++++----- src/lte/helper/lena-helper.h | 38 ++++++++++++++++++++ src/lte/model/lte-enb-net-device.cc | 29 ++++++++------- src/lte/model/lte-enb-net-device.h | 7 ++-- src/lte/model/lte-phy.cc | 4 +-- src/lte/model/lte-ue-net-device.cc | 23 ++++++------ src/lte/model/lte-ue-net-device.h | 2 +- src/lte/model/rr-ff-mac-scheduler.cc | 4 +-- 9 files changed, 123 insertions(+), 40 deletions(-) diff --git a/src/lte/examples/lena-first-sim.cc b/src/lte/examples/lena-first-sim.cc index 8db46b984..fbc1a28ee 100644 --- a/src/lte/examples/lena-first-sim.cc +++ b/src/lte/examples/lena-first-sim.cc @@ -30,7 +30,7 @@ int main (int argc, char *argv[]) { LenaHelper lena; - //lena.EnableLogComponents (); + lena.EnableLogComponents (); // Create Nodes: eNodeB and UE NodeContainer enbNodes; diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 77e911494..20be1f1e5 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -38,6 +38,11 @@ #include #include +#include +#include +#include +#include +#include namespace ns3 { @@ -49,6 +54,8 @@ LenaHelper::LenaHelper (void) { Ptr model = CreateObject (); m_downlinkChannel->AddSpectrumPropagationLossModel (model); + + //SetScheduler ("PfFfMacScheduler"); // default scheduler } LenaHelper::~LenaHelper (void) @@ -59,6 +66,32 @@ LenaHelper::~LenaHelper (void) +/* +void +LenaHelper::SetScheduler (std::string type, + std::string n0, const AttributeValue &v0, + std::string n1, const AttributeValue &v1, + std::string n2, const AttributeValue &v2, + std::string n3, const AttributeValue &v3, + std::string n4, const AttributeValue &v4, + std::string n5, const AttributeValue &v5, + std::string n6, const AttributeValue &v6, + std::string n7, const AttributeValue &v7) +{ + m_scheduler = ObjectFactory (); + m_scheduler.SetTypeId (type); + m_scheduler.Set (n0, v0); + m_scheduler.Set (n1, v1); + m_scheduler.Set (n2, v2); + m_scheduler.Set (n3, v3); + m_scheduler.Set (n4, v4); + m_scheduler.Set (n5, v5); + m_scheduler.Set (n6, v6); + m_scheduler.Set (n7, v7); +} +*/ + + NetDeviceContainer LenaHelper::InstallEnbDevice (NodeContainer c) { @@ -122,14 +155,17 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) ulPhy->SetMobility (mm); m_uplinkChannel->AddRx (ulPhy); - - Ptr dev = CreateObject (n, phy); + Ptr mac = CreateObject (); + //Ptr sched = m_scheduler.Create (); + Ptr sched = Create (); + Ptr rrc = Create (); + Ptr dev = CreateObject (n, phy, mac, sched, rrc); phy->SetDevice (dev); dlPhy->SetDevice (dev); ulPhy->SetDevice (dev); n->AddDevice (dev); - Ptr mac = dev->GetMac (); + //Ptr mac = dev->GetMac (); ulPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy)); dev->Start (); @@ -162,14 +198,16 @@ LenaHelper::InstallSingleUeDevice (Ptr n) ulPhy->SetMobility (mm); m_downlinkChannel->AddRx (dlPhy); - - Ptr dev = CreateObject (n, phy); + + Ptr mac = CreateObject (); + Ptr rrc = Create (); + Ptr dev = CreateObject (n, phy, mac, rrc); phy->SetDevice (dev); dlPhy->SetDevice (dev); ulPhy->SetDevice (dev); n->AddDevice (dev); - Ptr mac = dev->GetMac (); + //Ptr mac = dev->GetMac (); dlPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy)); dev->Start (); @@ -237,8 +275,8 @@ LenaHelper::EnableLogComponents (void) LogComponentEnable ("LteEnbMac", LOG_LEVEL_ALL); LogComponentEnable ("LteUeMac", LOG_LEVEL_ALL); LogComponentEnable ("LteRlc", LOG_LEVEL_ALL); - LogComponentEnable ("RrPacketScheduler", LOG_LEVEL_ALL); - LogComponentEnable ("PfPacketScheduler", LOG_LEVEL_ALL); + LogComponentEnable ("RrFfMacScheduler", LOG_LEVEL_ALL); + LogComponentEnable ("PfFfMacScheduler", LOG_LEVEL_ALL); LogComponentEnable ("LtePhy", LOG_LEVEL_ALL); LogComponentEnable ("LteEnbPhy", LOG_LEVEL_ALL); diff --git a/src/lte/helper/lena-helper.h b/src/lte/helper/lena-helper.h index 57c434d52..2976992cc 100644 --- a/src/lte/helper/lena-helper.h +++ b/src/lte/helper/lena-helper.h @@ -116,6 +116,42 @@ public: * \param bearer the characteristics of the bearer to be activated */ void ActivateEpsBearer (Ptr ueDevice, EpsBearer bearer); + + + /** + * \param type the type of ns3::WifiRemoteStationManager to create. + * \param n0 the name of the attribute to set + * \param v0 the value of the attribute to set + * \param n1 the name of the attribute to set + * \param v1 the value of the attribute to set + * \param n2 the name of the attribute to set + * \param v2 the value of the attribute to set + * \param n3 the name of the attribute to set + * \param v3 the value of the attribute to set + * \param n4 the name of the attribute to set + * \param v4 the value of the attribute to set + * \param n5 the name of the attribute to set + * \param v5 the value of the attribute to set + * \param n6 the name of the attribute to set + * \param v6 the value of the attribute to set + * \param n7 the name of the attribute to set + * \param v7 the value of the attribute to set + * + * All the attributes specified in this method should exist + * in the requested scheduler. + */ + void SetScheduler (std::string type, + std::string n0 = "", const AttributeValue &v0 = EmptyAttributeValue (), + std::string n1 = "", const AttributeValue &v1 = EmptyAttributeValue (), + std::string n2 = "", const AttributeValue &v2 = EmptyAttributeValue (), + std::string n3 = "", const AttributeValue &v3 = EmptyAttributeValue (), + std::string n4 = "", const AttributeValue &v4 = EmptyAttributeValue (), + std::string n5 = "", const AttributeValue &v5 = EmptyAttributeValue (), + std::string n6 = "", const AttributeValue &v6 = EmptyAttributeValue (), + std::string n7 = "", const AttributeValue &v7 = EmptyAttributeValue ()); + + + /** * Enables logging for all components of the LENA architecture @@ -129,6 +165,8 @@ private: Ptr m_downlinkChannel; Ptr m_uplinkChannel; + + //ObjectFactory m_scheduler; }; diff --git a/src/lte/model/lte-enb-net-device.cc b/src/lte/model/lte-enb-net-device.cc index 859fcccb9..cef75fe48 100644 --- a/src/lte/model/lte-enb-net-device.cc +++ b/src/lte/model/lte-enb-net-device.cc @@ -73,10 +73,13 @@ LteEnbNetDevice::LteEnbNetDevice (void) InitLteEnbNetDevice (); } -LteEnbNetDevice::LteEnbNetDevice (Ptr node, Ptr phy) - : m_phy (phy) +LteEnbNetDevice::LteEnbNetDevice (Ptr node, Ptr phy, Ptr mac, Ptr sched, Ptr rrc) { NS_LOG_FUNCTION (this); + m_phy = phy; + m_mac = mac; + m_scheduler = sched; + m_rrc = rrc; InitLteEnbNetDevice (); SetNode (node); } @@ -91,14 +94,14 @@ LteEnbNetDevice::DoDispose () { NS_LOG_FUNCTION (this); - m_mac->Dispose (); - m_mac = 0; - - m_rrc->Dispose (); - m_rrc = 0; - - m_phy->Dispose (); - m_phy = 0; +// m_mac->Dispose (); +// m_mac = 0; +// +// m_rrc->Dispose (); +// m_rrc = 0; +// +// m_phy->Dispose (); +// m_phy = 0; LteNetDevice::DoDispose (); } @@ -109,7 +112,7 @@ LteEnbNetDevice::InitLteEnbNetDevice (void) { NS_LOG_FUNCTION (this); - m_mac = CreateObject (); + //m_mac = CreateObject (); // m_mac->SetDevice (this->GetObject ()); SetNode (0); if (GetPhy () == 0) @@ -120,13 +123,13 @@ LteEnbNetDevice::InitLteEnbNetDevice (void) { NS_LOG_DEBUG (this << "PHY ! NULL"); } - m_rrc = CreateObject (); + //m_rrc = Create (); m_rrc->SetLteEnbCmacSapProvider (m_mac->GetLteEnbCmacSapProvider ()); m_mac->SetLteEnbCmacSapUser (m_rrc->GetLteEnbCmacSapUser ()); m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ()); //m_scheduler = Create (); - m_scheduler = Create (); + //m_scheduler = Create (); m_mac->SetFfMacSchedSapProvider (m_scheduler->GetFfMacSchedSapProvider ()); m_mac->SetFfMacCschedSapProvider (m_scheduler->GetFfMacCschedSapProvider ()); diff --git a/src/lte/model/lte-enb-net-device.h b/src/lte/model/lte-enb-net-device.h index 1a5b13f19..f7fc5185f 100644 --- a/src/lte/model/lte-enb-net-device.h +++ b/src/lte/model/lte-enb-net-device.h @@ -55,9 +55,12 @@ public: /** * \brief Create eNB net device * \param node the network node - * \param phy the physical object attache dto it + * \param phy the physical object attached to it + * \param mac the mac layer object attached to it + * \param sched the scheduler object attached to it + * \param rrc the rrc entity object attached to it */ - LteEnbNetDevice (Ptr node, Ptr phy); + LteEnbNetDevice (Ptr node, Ptr phy, Ptr mac, Ptr sched, Ptr rrc); virtual ~LteEnbNetDevice (void); virtual void DoDispose (void); diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index 177f94148..f428368fe 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -84,8 +84,8 @@ LtePhy::DoDispose () m_netDevice = 0; for (int i = 0; i < m_macChTtiDelay; i++) { - m_packetBurstQueue.erase (m_packetBurstQueue.begin ()); - m_controlMessagesQueue.erase (m_controlMessagesQueue.begin ()); + m_packetBurstQueue.erase (m_packetBurstQueue.begin (), m_packetBurstQueue.end ()); + m_controlMessagesQueue.erase (m_controlMessagesQueue.begin (), m_controlMessagesQueue.end ()); } } diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index 1a4ac238b..c87b94af9 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -66,13 +66,14 @@ LteUeNetDevice::LteUeNetDevice (void) } -LteUeNetDevice::LteUeNetDevice (Ptr node, Ptr phy) - : m_phy (phy) +LteUeNetDevice::LteUeNetDevice (Ptr node, Ptr phy, Ptr mac, Ptr rrc) { NS_LOG_FUNCTION (this); + m_phy = phy; + m_mac = mac; + m_rrc = rrc; InitLteUeNetDevice (); SetNode (node); - /** * WILD HACK * to be translated to PHY-SAP primitive @@ -90,12 +91,12 @@ LteUeNetDevice::DoDispose (void) { NS_LOG_FUNCTION (this); m_targetEnb = 0; - m_mac->Dispose (); - m_mac = 0; - m_rrc->Dispose (); - m_rrc = 0; - m_phy->Dispose (); - m_phy = 0; +// m_mac->Dispose (); +// m_mac = 0; +// m_rrc->Dispose (); +// m_rrc = 0; +// m_phy->Dispose (); +// m_phy = 0; LteNetDevice::DoDispose (); } @@ -105,8 +106,8 @@ LteUeNetDevice::InitLteUeNetDevice (void) NS_LOG_FUNCTION (this); m_targetEnb = 0; SetNode (0); - m_mac = CreateObject (); - m_rrc = CreateObject (); + //m_mac = CreateObject (); + //m_rrc = Create (); m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ()); m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ()); m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ()); diff --git a/src/lte/model/lte-ue-net-device.h b/src/lte/model/lte-ue-net-device.h index 6b0bf46e7..4f81bce85 100644 --- a/src/lte/model/lte-ue-net-device.h +++ b/src/lte/model/lte-ue-net-device.h @@ -57,7 +57,7 @@ public: * \param node * \param phy */ - LteUeNetDevice (Ptr node, Ptr phy); + LteUeNetDevice (Ptr node, Ptr phy, Ptr mac, Ptr rrc); virtual ~LteUeNetDevice (void); virtual void DoDispose (); diff --git a/src/lte/model/rr-ff-mac-scheduler.cc b/src/lte/model/rr-ff-mac-scheduler.cc index 60822a604..e4d64456e 100644 --- a/src/lte/model/rr-ff-mac-scheduler.cc +++ b/src/lte/model/rr-ff-mac-scheduler.cc @@ -24,7 +24,7 @@ #include "lte-amc.h" #include "rr-ff-mac-scheduler.h" -NS_LOG_COMPONENT_DEFINE ("RrPacketScheduler"); +NS_LOG_COMPONENT_DEFINE ("RrFfMacScheduler"); namespace ns3 { @@ -36,7 +36,7 @@ int Type0AllocationRbg[4] = { }; // see table 7.1.6.1-1 of 36.213 -// NS_OBJECT_ENSURE_REGISTERED (RrPacketScheduler); +NS_OBJECT_ENSURE_REGISTERED (RrFfMacScheduler); class RrSchedulerMemberCschedSapProvider : public FfMacCschedSapProvider From affdaeb261d85c4bfc7d56fa8f6c224a0a6f26cd Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Thu, 24 Mar 2011 10:24:08 +0100 Subject: [PATCH 2/8] polishment of comments --- src/lte/helper/lena-helper.cc | 3 --- src/lte/model/lte-enb-net-device.cc | 6 +----- src/lte/model/lte-ue-net-device.cc | 2 -- 3 files changed, 1 insertion(+), 10 deletions(-) diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 20be1f1e5..02067c397 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -156,7 +156,6 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) m_uplinkChannel->AddRx (ulPhy); Ptr mac = CreateObject (); - //Ptr sched = m_scheduler.Create (); Ptr sched = Create (); Ptr rrc = Create (); Ptr dev = CreateObject (n, phy, mac, sched, rrc); @@ -165,7 +164,6 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) ulPhy->SetDevice (dev); n->AddDevice (dev); - //Ptr mac = dev->GetMac (); ulPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy)); dev->Start (); @@ -207,7 +205,6 @@ LenaHelper::InstallSingleUeDevice (Ptr n) ulPhy->SetDevice (dev); n->AddDevice (dev); - //Ptr mac = dev->GetMac (); dlPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteUePhy::PhyPduReceived, phy)); dev->Start (); diff --git a/src/lte/model/lte-enb-net-device.cc b/src/lte/model/lte-enb-net-device.cc index cef75fe48..3437eab3a 100644 --- a/src/lte/model/lte-enb-net-device.cc +++ b/src/lte/model/lte-enb-net-device.cc @@ -112,8 +112,6 @@ LteEnbNetDevice::InitLteEnbNetDevice (void) { NS_LOG_FUNCTION (this); - //m_mac = CreateObject (); - // m_mac->SetDevice (this->GetObject ()); SetNode (0); if (GetPhy () == 0) { @@ -123,13 +121,11 @@ LteEnbNetDevice::InitLteEnbNetDevice (void) { NS_LOG_DEBUG (this << "PHY ! NULL"); } - //m_rrc = Create (); + m_rrc->SetLteEnbCmacSapProvider (m_mac->GetLteEnbCmacSapProvider ()); m_mac->SetLteEnbCmacSapUser (m_rrc->GetLteEnbCmacSapUser ()); m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ()); - //m_scheduler = Create (); - //m_scheduler = Create (); m_mac->SetFfMacSchedSapProvider (m_scheduler->GetFfMacSchedSapProvider ()); m_mac->SetFfMacCschedSapProvider (m_scheduler->GetFfMacCschedSapProvider ()); diff --git a/src/lte/model/lte-ue-net-device.cc b/src/lte/model/lte-ue-net-device.cc index c87b94af9..aed4424c9 100644 --- a/src/lte/model/lte-ue-net-device.cc +++ b/src/lte/model/lte-ue-net-device.cc @@ -106,8 +106,6 @@ LteUeNetDevice::InitLteUeNetDevice (void) NS_LOG_FUNCTION (this); m_targetEnb = 0; SetNode (0); - //m_mac = CreateObject (); - //m_rrc = Create (); m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ()); m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ()); m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ()); From 2b46a5a2669b039ec34d5638cdfb018a12b601d7 Mon Sep 17 00:00:00 2001 From: Marco Miozzo Date: Thu, 24 Mar 2011 11:09:47 +0100 Subject: [PATCH 3/8] LENA 56: Scheduler type configurable by the user --- src/lte/examples/lena-first-sim.cc | 2 ++ src/lte/helper/lena-helper.cc | 9 +++++---- src/lte/helper/lena-helper.h | 2 +- 3 files changed, 8 insertions(+), 5 deletions(-) diff --git a/src/lte/examples/lena-first-sim.cc b/src/lte/examples/lena-first-sim.cc index fbc1a28ee..585fa6ed0 100644 --- a/src/lte/examples/lena-first-sim.cc +++ b/src/lte/examples/lena-first-sim.cc @@ -48,6 +48,8 @@ int main (int argc, char *argv[]) // Create Devices and install them in the Nodes (eNB and UE) NetDeviceContainer enbDevs; NetDeviceContainer ueDevs; + //lena.SetScheduler ("RrFfMacScheduler"); + lena.SetScheduler ("PfFfMacScheduler"); enbDevs = lena.InstallEnbDevice (enbNodes); ueDevs = lena.InstallUeDevice (ueNodes); diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 02067c397..8879ae639 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -55,7 +55,7 @@ LenaHelper::LenaHelper (void) Ptr model = CreateObject (); m_downlinkChannel->AddSpectrumPropagationLossModel (model); - //SetScheduler ("PfFfMacScheduler"); // default scheduler + SetScheduler ("RrFfMacScheduler"); // default scheduler } LenaHelper::~LenaHelper (void) @@ -66,7 +66,7 @@ LenaHelper::~LenaHelper (void) -/* + void LenaHelper::SetScheduler (std::string type, std::string n0, const AttributeValue &v0, @@ -89,7 +89,7 @@ LenaHelper::SetScheduler (std::string type, m_scheduler.Set (n6, v6); m_scheduler.Set (n7, v7); } -*/ + NetDeviceContainer @@ -156,7 +156,8 @@ LenaHelper::InstallSingleEnbDevice (Ptr n) m_uplinkChannel->AddRx (ulPhy); Ptr mac = CreateObject (); - Ptr sched = Create (); + Ptr sched = m_scheduler.Create (); + //Ptr sched = Create (); Ptr rrc = Create (); Ptr dev = CreateObject (n, phy, mac, sched, rrc); phy->SetDevice (dev); diff --git a/src/lte/helper/lena-helper.h b/src/lte/helper/lena-helper.h index 2976992cc..b5f15511b 100644 --- a/src/lte/helper/lena-helper.h +++ b/src/lte/helper/lena-helper.h @@ -166,7 +166,7 @@ private: Ptr m_downlinkChannel; Ptr m_uplinkChannel; - //ObjectFactory m_scheduler; + ObjectFactory m_scheduler; }; From 5681257d46f64db665bba79c8ade4f6d825199e2 Mon Sep 17 00:00:00 2001 From: mmiozzo Date: Tue, 29 Mar 2011 15:24:42 +0200 Subject: [PATCH 4/8] Updates for MACOS compilation (virtual destructors and variable types) --- src/lte/examples/lena-first-sim.cc | 6 ++-- src/lte/examples/lena-rlc-calculator.cc | 2 +- src/lte/model/lte-enb-cmac-sap.cc | 36 +++++++++++++++++++++++ src/lte/model/lte-enb-cmac-sap.h | 2 ++ src/lte/model/lte-mac-sap.cc | 4 +++ src/lte/model/lte-mac-sap.h | 1 + src/lte/model/lte-sinr-chunk-processor.cc | 12 ++++++++ src/lte/model/lte-sinr-chunk-processor.h | 2 ++ src/lte/model/lte-ue-cmac-sap.cc | 36 +++++++++++++++++++++++ src/lte/model/lte-ue-cmac-sap.h | 2 ++ src/lte/model/pf-ff-mac-scheduler.cc | 2 +- src/lte/wscript | 2 ++ 12 files changed, 102 insertions(+), 5 deletions(-) create mode 100644 src/lte/model/lte-enb-cmac-sap.cc create mode 100644 src/lte/model/lte-ue-cmac-sap.cc diff --git a/src/lte/examples/lena-first-sim.cc b/src/lte/examples/lena-first-sim.cc index 585fa6ed0..75659c330 100644 --- a/src/lte/examples/lena-first-sim.cc +++ b/src/lte/examples/lena-first-sim.cc @@ -23,7 +23,7 @@ #include "ns3/network-module.h" #include "ns3/mobility-module.h" #include "ns3/lte-module.h" -#include "ns3/gtk-config-store.h" +//#include "ns3/gtk-config-store.h" using namespace ns3; int main (int argc, char *argv[]) @@ -66,8 +66,8 @@ int main (int argc, char *argv[]) Simulator::Run (); - GtkConfigStore config; - config.ConfigureAttributes (); + //GtkConfigStore config; + //config.ConfigureAttributes (); Simulator::Destroy (); return 0; diff --git a/src/lte/examples/lena-rlc-calculator.cc b/src/lte/examples/lena-rlc-calculator.cc index 5d8312522..5a5321a89 100644 --- a/src/lte/examples/lena-rlc-calculator.cc +++ b/src/lte/examples/lena-rlc-calculator.cc @@ -26,7 +26,7 @@ #include "ns3/rlc-stats-calculator.h" -#include "ns3/gtk-config-store.h" +//#include "ns3/gtk-config-store.h" using namespace ns3; diff --git a/src/lte/model/lte-enb-cmac-sap.cc b/src/lte/model/lte-enb-cmac-sap.cc new file mode 100644 index 000000000..3497c6965 --- /dev/null +++ b/src/lte/model/lte-enb-cmac-sap.cc @@ -0,0 +1,36 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + */ + + +#include "lte-enb-cmac-sap.h" + + +namespace ns3 { + + +LteEnbCmacSapProvider::~LteEnbCmacSapProvider () +{ +} + +LteEnbCmacSapUser::~LteEnbCmacSapUser () +{ +} + +} // namespace ns3 diff --git a/src/lte/model/lte-enb-cmac-sap.h b/src/lte/model/lte-enb-cmac-sap.h index 45c7c16c0..0e4f479a7 100644 --- a/src/lte/model/lte-enb-cmac-sap.h +++ b/src/lte/model/lte-enb-cmac-sap.h @@ -39,6 +39,7 @@ class LteMacSapUser; class LteEnbCmacSapProvider { public: + virtual ~LteEnbCmacSapProvider (); /** * * @@ -108,6 +109,7 @@ public: class LteEnbCmacSapUser { public: + virtual ~LteEnbCmacSapUser (); /** * notify the result of the last LC config operation * diff --git a/src/lte/model/lte-mac-sap.cc b/src/lte/model/lte-mac-sap.cc index 545d0ab4c..c095eeb65 100644 --- a/src/lte/model/lte-mac-sap.cc +++ b/src/lte/model/lte-mac-sap.cc @@ -29,4 +29,8 @@ LteMacSapProvider::~LteMacSapProvider () { } +LteMacSapUser::~LteMacSapUser () +{ +} + } // namespace ns3 diff --git a/src/lte/model/lte-mac-sap.h b/src/lte/model/lte-mac-sap.h index bd4331f24..519071af3 100644 --- a/src/lte/model/lte-mac-sap.h +++ b/src/lte/model/lte-mac-sap.h @@ -92,6 +92,7 @@ public: class LteMacSapUser { public: + virtual ~LteMacSapUser (); /** * Called by the MAC to notify the RLC that the scheduler granted a * transmission opportunity to this RLC instance. diff --git a/src/lte/model/lte-sinr-chunk-processor.cc b/src/lte/model/lte-sinr-chunk-processor.cc index 5d89eb436..fb058571b 100644 --- a/src/lte/model/lte-sinr-chunk-processor.cc +++ b/src/lte/model/lte-sinr-chunk-processor.cc @@ -27,6 +27,11 @@ NS_LOG_COMPONENT_DEFINE ("LteSinrChunkProcessor"); namespace ns3 { +LteSinrChunkProcessor::~LteSinrChunkProcessor () +{ + NS_LOG_FUNCTION (this); +} + LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor (Ptr p) : m_phy (p) @@ -35,6 +40,13 @@ LteCqiSinrChunkProcessor::LteCqiSinrChunkProcessor (Ptr p) NS_ASSERT (m_phy); } + +LteCqiSinrChunkProcessor::~LteCqiSinrChunkProcessor () +{ + NS_LOG_FUNCTION (this); +} + + void LteCqiSinrChunkProcessor::Start () { diff --git a/src/lte/model/lte-sinr-chunk-processor.h b/src/lte/model/lte-sinr-chunk-processor.h index 04c7f1344..1e4e34bca 100644 --- a/src/lte/model/lte-sinr-chunk-processor.h +++ b/src/lte/model/lte-sinr-chunk-processor.h @@ -42,6 +42,7 @@ namespace ns3 { class LteSinrChunkProcessor : public SimpleRefCount { public: + virtual ~LteSinrChunkProcessor (); virtual void Start () = 0; virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration) = 0; virtual void End () = 0; @@ -57,6 +58,7 @@ public: class LteCqiSinrChunkProcessor : public LteSinrChunkProcessor { public: + virtual ~LteCqiSinrChunkProcessor (); LteCqiSinrChunkProcessor (Ptr p); virtual void Start (); virtual void EvaluateSinrChunk (const SpectrumValue& sinr, Time duration); diff --git a/src/lte/model/lte-ue-cmac-sap.cc b/src/lte/model/lte-ue-cmac-sap.cc new file mode 100644 index 000000000..a8922585b --- /dev/null +++ b/src/lte/model/lte-ue-cmac-sap.cc @@ -0,0 +1,36 @@ +/* -*- Mode: C++; c-file-style: "gnu"; indent-tabs-mode:nil; -*- */ +/* + * Copyright (c) 2011 Centre Tecnologic de Telecomunicacions de Catalunya (CTTC) + * + * This program is free software; you can redistribute it and/or modify + * it under the terms of the GNU General Public License version 2 as + * published by the Free Software Foundation; + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + * + * Author: Marco Miozzo + */ + + +#include "lte-ue-cmac-sap.h" + + +namespace ns3 { + + +LteUeCmacSapProvider::~LteUeCmacSapProvider () +{ +} + +LteUeCmacSapUser::~LteUeCmacSapUser () +{ +} + +} // namespace ns3 \ No newline at end of file diff --git a/src/lte/model/lte-ue-cmac-sap.h b/src/lte/model/lte-ue-cmac-sap.h index f020a6063..f563ff329 100644 --- a/src/lte/model/lte-ue-cmac-sap.h +++ b/src/lte/model/lte-ue-cmac-sap.h @@ -39,6 +39,7 @@ class LteMacSapUser; class LteUeCmacSapProvider { public: + virtual ~LteUeCmacSapProvider (); /** * called by the RRC after going to RRC connected * @@ -62,6 +63,7 @@ public: class LteUeCmacSapUser { public: + virtual ~LteUeCmacSapUser (); virtual void LcConfigCompleted () = 0; }; diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index eb8060181..49330225d 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -289,7 +289,7 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch NS_LOG_FUNCTION (this << " New LC, rnti: " << params.m_rnti); std::map ::iterator it; - for (uint i = 0; i < params.m_logicalChannelConfigList.size (); i++) + for (uint16_t i = 0; i < params.m_logicalChannelConfigList.size (); i++) { pfsFlowId_t flow; flow.m_rnti = params.m_rnti; diff --git a/src/lte/wscript b/src/lte/wscript index f6ad506e9..66e73d2be 100644 --- a/src/lte/wscript +++ b/src/lte/wscript @@ -32,6 +32,8 @@ def build(bld): 'model/ff-mac-sched-sap.cc', 'model/lte-mac-sap.cc', 'model/ff-mac-scheduler.cc', + 'model/lte-enb-cmac-sap.cc', + 'model/lte-ue-cmac-sap.cc', 'model/rr-ff-mac-scheduler.cc', 'model/lte-enb-mac.cc', 'model/lte-ue-mac.cc', From 533cedb9df85225d29fdbd895f7cf66ad8fb6212 Mon Sep 17 00:00:00 2001 From: mmiozzo Date: Tue, 29 Mar 2011 17:20:57 +0200 Subject: [PATCH 5/8] PUSCH based UL-CQI generation at eNB PHY side --- src/lte/model/lte-enb-mac.cc | 20 ++++++++++++++++++++ src/lte/model/lte-enb-mac.h | 6 ++++++ src/lte/model/lte-enb-phy.cc | 26 ++++++++++++++++++++++++++ src/lte/model/lte-enb-phy.h | 7 +++++++ 4 files changed, 59 insertions(+) diff --git a/src/lte/model/lte-enb-mac.cc b/src/lte/model/lte-enb-mac.cc index a0871738b..0f5dd3c90 100644 --- a/src/lte/model/lte-enb-mac.cc +++ b/src/lte/model/lte-enb-mac.cc @@ -471,6 +471,11 @@ LteEnbMac::DoReceiveIdealControlMessage (Ptr msg) Ptr dlcqi = DynamicCast (msg); ReceiveDlCqiIdealControlMessage (dlcqi); } + else if (msg->GetMessageType () == IdealControlMessage::UL_CQI) + { + Ptr ulcqi = DynamicCast (msg); + ReceiveUlCqiIdealControlMessage (ulcqi); + } else if (msg->GetMessageType () == IdealControlMessage::BSR) { Ptr bsr = DynamicCast (msg); @@ -495,6 +500,21 @@ LteEnbMac::ReceiveDlCqiIdealControlMessage (Ptr msg) } +void +LteEnbMac::ReceiveUlCqiIdealControlMessage (Ptr msg) +{ + NS_LOG_FUNCTION (this << msg); + + UlCqi_s ulcqi = msg->GetUlCqi (); + if (ulcqi.m_type == UlCqi_s::PUSCH) + { + NS_LOG_DEBUG(this << " eNB rxed an PUSCH UL-CQI"); + } + // TODO store UL-CQI to send them to scheduler + //m_dlCqiReceived.push_back (dlcqi); + +} + void LteEnbMac::ReceiveBsrMessage (MacCeListElement_s bsr) { diff --git a/src/lte/model/lte-enb-mac.h b/src/lte/model/lte-enb-mac.h index 4124d2f64..8f06d6bb3 100644 --- a/src/lte/model/lte-enb-mac.h +++ b/src/lte/model/lte-enb-mac.h @@ -34,6 +34,7 @@ namespace ns3 { class DlCqiIdealControlMessage; +class UlCqiIdealControlMessage; class PdcchMapIdealControlMessage; @@ -128,6 +129,11 @@ public: * \param msg the DL CQI message */ void ReceiveDlCqiIdealControlMessage (Ptr msg); + /** + * \brief Receive a UL CQI ideal control message + * \param msg the UL CQI message + */ + void ReceiveUlCqiIdealControlMessage (Ptr msg); void DoReceiveIdealControlMessage (Ptr msg); /** diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 8e472baa1..3b24b7c11 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -370,6 +370,32 @@ void LteEnbPhy::GenerateCqiFeedback (const SpectrumValue& sinr) { NS_LOG_FUNCTION (this << sinr); + Ptr thisDevice = GetDevice ()->GetObject (); + Ptr msg = CreateUlCqiFeedbackMessage (sinr); + m_enbPhySapUser->ReceiveIdealControlMessage (msg); + + +} + + +Ptr +LteEnbPhy::CreateUlCqiFeedbackMessage (const SpectrumValue& sinr) +{ + NS_LOG_FUNCTION (this << sinr); + Values::const_iterator it; + UlCqi_s ulcqi; + ulcqi.m_type = UlCqi_s::PUSCH; + int i = 0; + for (it = sinr.ConstValuesBegin (); it != sinr.ConstValuesEnd (); it++) + { + ulcqi.m_sinr.push_back ((*it)); + NS_LOG_DEBUG(this << " RB " << i << " SINR " << (*it)); + i++; + } + Ptr msg = Create (); + msg->SetUlCqi (ulcqi); + return (msg); + } }; diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 0f860ede2..36ee37435 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -98,6 +98,13 @@ public: * \param msg the received message */ virtual void ReceiveIdealControlMessage (Ptr msg); + + /** + * \brief Create the UL CQI feedback from SINR values perceived at + * the physical layer with the signal received from eNB + * \param sinr SINR values vector + */ + Ptr CreateUlCqiFeedbackMessage (const SpectrumValue& sinr); void DoSendIdealControlMessage (Ptr msg); From d8b452dceff6287b8583edde1de0c95e0918511e Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Tue, 29 Mar 2011 17:33:07 +0200 Subject: [PATCH 6/8] removed useless getters --- src/lte/model/lte-phy.cc | 18 ------------------ src/lte/model/lte-phy.h | 12 ------------ src/lte/model/lte-spectrum-phy.cc | 22 +++++++++------------- src/lte/model/lte-spectrum-phy.h | 8 +------- 4 files changed, 10 insertions(+), 50 deletions(-) diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index f428368fe..faaadd0a5 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -144,15 +144,6 @@ LtePhy::SetDownlinkChannel (Ptr c) m_downlinkSpectrumPhy->SetChannel (c); } - -Ptr -LtePhy::GetDownlinkChannel () -{ - NS_LOG_FUNCTION (this); - return m_downlinkSpectrumPhy->GetChannel (); -} - - void LtePhy::SetUplinkChannel (Ptr c) { @@ -160,15 +151,6 @@ LtePhy::SetUplinkChannel (Ptr c) m_uplinkSpectrumPhy->SetChannel (c); } - -Ptr -LtePhy::GetUplinkChannel () -{ - NS_LOG_FUNCTION (this); - return m_uplinkSpectrumPhy->GetChannel (); -} - - void LtePhy::SetDownlinkSubChannels (std::vector mask ) { diff --git a/src/lte/model/lte-phy.h b/src/lte/model/lte-phy.h index 6e24114f1..af457faf4 100644 --- a/src/lte/model/lte-phy.h +++ b/src/lte/model/lte-phy.h @@ -100,24 +100,12 @@ public: */ void SetDownlinkChannel (Ptr c); - /** - * Get the downlink channel - * \return a Ptr to the downlink SpectrumChannel - */ - Ptr GetDownlinkChannel (); - /** * Set the uplink channel * \param c the uplink channel */ void SetUplinkChannel (Ptr c); - /** - * Get the uplink channel - * \return a Ptr to the uplink SpectrumChannel - */ - Ptr GetUplinkChannel (); - /** * \brief set a list of sub channel to use in the downlink. * A sub channel is composed by a couple of resource bloks (180KHz x 1 ms) diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index 08e49dceb..63258f6a8 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -39,11 +39,7 @@ namespace ns3 { NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy); LteSpectrumPhy::LteSpectrumPhy () - : m_mobility (0), - m_device (0), - m_channel (0), - m_txPsd (0), - m_state (IDLE) + : m_state (IDLE) { } @@ -52,6 +48,14 @@ LteSpectrumPhy::~LteSpectrumPhy () { } +void LteSpectrumPhy::DoDispose () +{ + m_channel->Dispose (); + m_channel = 0; + m_mobility = 0; + m_device = 0; +} + std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s) { switch (s) @@ -141,14 +145,6 @@ LteSpectrumPhy::SetChannel (Ptr c) m_channel = c; } - -Ptr -LteSpectrumPhy::GetChannel (void) -{ - return m_channel; -} - - Ptr LteSpectrumPhy::GetRxSpectrumModel () const { diff --git a/src/lte/model/lte-spectrum-phy.h b/src/lte/model/lte-spectrum-phy.h index abe314180..4ebe519c8 100644 --- a/src/lte/model/lte-spectrum-phy.h +++ b/src/lte/model/lte-spectrum-phy.h @@ -61,6 +61,7 @@ public: // inherited from Object static TypeId GetTypeId (void); + virtual void DoDispose (); // inherited from SpectrumPhy void SetChannel (Ptr c); @@ -72,13 +73,6 @@ public: void StartRx (Ptr pb, Ptr rxPsd, SpectrumType st, Time duration); - /** - * \brief Get the channel where the physical layer is attached - * \return a pointer to the channel - */ - Ptr GetChannel (void); - - /** * Get the SpectrumType used by this PHY * From 44829ee98695e2d25aae4522142b3cad1633a7ac Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Tue, 29 Mar 2011 17:55:59 +0200 Subject: [PATCH 7/8] fixed valgrind error in pf-ff-mac-scheduler --- src/lte/model/pf-ff-mac-scheduler.cc | 3 +++ 1 file changed, 3 insertions(+) diff --git a/src/lte/model/pf-ff-mac-scheduler.cc b/src/lte/model/pf-ff-mac-scheduler.cc index 49330225d..3758f75fd 100644 --- a/src/lte/model/pf-ff-mac-scheduler.cc +++ b/src/lte/model/pf-ff-mac-scheduler.cc @@ -304,6 +304,9 @@ PfFfMacScheduler::DoCschedLcConfigReq (const struct FfMacCschedSapProvider::Csch flowStats.totalBytesTransmitted = 0; flowStats.lastTtiBytesTrasmitted = 0; flowStats.lastAveragedThroughput = 0.0; + flowStats.rlcBufferReq.m_rlcTransmissionQueueSize = 0; + flowStats.rlcBufferReq.m_rlcRetransmissionQueueSize = 0; + flowStats.rlcBufferReq.m_rlcStatusPduSize = 0; m_flowStats.insert (std::pair (flow, flowStats)); } else From e320d42a37f2cfb36ce7444dea8cc18ac824f649 Mon Sep 17 00:00:00 2001 From: Nicola Baldo Date: Tue, 29 Mar 2011 18:28:55 +0200 Subject: [PATCH 8/8] added DoDispose to lte-phy and lte-spectrum-phy --- src/lte/model/lte-enb-phy.cc | 7 +++++++ src/lte/model/lte-enb-phy.h | 1 + src/lte/model/lte-phy.cc | 1 + src/lte/model/lte-spectrum-phy.cc | 4 +++- src/lte/model/lte-ue-phy.cc | 4 ++++ 5 files changed, 16 insertions(+), 1 deletion(-) diff --git a/src/lte/model/lte-enb-phy.cc b/src/lte/model/lte-enb-phy.cc index 8e472baa1..5a76c93e3 100644 --- a/src/lte/model/lte-enb-phy.cc +++ b/src/lte/model/lte-enb-phy.cc @@ -120,6 +120,13 @@ LteEnbPhy::~LteEnbPhy () { } +void +LteEnbPhy::DoDispose () +{ + NS_LOG_FUNCTION (this); + LtePhy::DoDispose (); +} + void LteEnbPhy::SetLteEnbPhySapUser (LteEnbPhySapUser* s) { diff --git a/src/lte/model/lte-enb-phy.h b/src/lte/model/lte-enb-phy.h index 0f860ede2..37d8f2b17 100644 --- a/src/lte/model/lte-enb-phy.h +++ b/src/lte/model/lte-enb-phy.h @@ -52,6 +52,7 @@ public: virtual ~LteEnbPhy (); static TypeId GetTypeId (void); + virtual void DoDispose (void); /** diff --git a/src/lte/model/lte-phy.cc b/src/lte/model/lte-phy.cc index faaadd0a5..3069b4ba3 100644 --- a/src/lte/model/lte-phy.cc +++ b/src/lte/model/lte-phy.cc @@ -87,6 +87,7 @@ LtePhy::DoDispose () m_packetBurstQueue.erase (m_packetBurstQueue.begin (), m_packetBurstQueue.end ()); m_controlMessagesQueue.erase (m_controlMessagesQueue.begin (), m_controlMessagesQueue.end ()); } + Object::DoDispose (); } void diff --git a/src/lte/model/lte-spectrum-phy.cc b/src/lte/model/lte-spectrum-phy.cc index 63258f6a8..c9b3683ee 100644 --- a/src/lte/model/lte-spectrum-phy.cc +++ b/src/lte/model/lte-spectrum-phy.cc @@ -41,6 +41,7 @@ NS_OBJECT_ENSURE_REGISTERED (LteSpectrumPhy); LteSpectrumPhy::LteSpectrumPhy () : m_state (IDLE) { + NS_LOG_FUNCTION (this); } @@ -50,10 +51,11 @@ LteSpectrumPhy::~LteSpectrumPhy () void LteSpectrumPhy::DoDispose () { - m_channel->Dispose (); + NS_LOG_FUNCTION (this); m_channel = 0; m_mobility = 0; m_device = 0; + SpectrumPhy::DoDispose (); } std::ostream& operator<< (std::ostream& os, LteSpectrumPhy::State s) diff --git a/src/lte/model/lte-ue-phy.cc b/src/lte/model/lte-ue-phy.cc index 49729431c..41de2de85 100644 --- a/src/lte/model/lte-ue-phy.cc +++ b/src/lte/model/lte-ue-phy.cc @@ -111,6 +111,8 @@ LteUePhy::~LteUePhy () void LteUePhy::DoDispose () { + NS_LOG_FUNCTION (this); + LtePhy::DoDispose (); } @@ -129,12 +131,14 @@ LteUePhy::GetTypeId (void) void LteUePhy::SetLteUePhySapUser (LteUePhySapUser* s) { + NS_LOG_FUNCTION (this); m_uePhySapUser = s; } LteUePhySapProvider* LteUePhy::GetLteUePhySapProvider () { + NS_LOG_FUNCTION (this); return (m_uePhySapProvider); }