From 1fa3d8d1aa9c71901d69ee85f85e231029b06fb8 Mon Sep 17 00:00:00 2001 From: mmiozzo Date: Fri, 21 Oct 2011 14:04:32 +0200 Subject: [PATCH] Update LenaHelper for managing fading module --- src/lte/helper/lena-helper.cc | 36 +++++++++++++++++++++++++++++++++++ src/lte/helper/lena-helper.h | 17 +++++++++++++++++ 2 files changed, 53 insertions(+) diff --git a/src/lte/helper/lena-helper.cc b/src/lte/helper/lena-helper.cc index 695d60a57..d41edc57a 100644 --- a/src/lte/helper/lena-helper.cc +++ b/src/lte/helper/lena-helper.cc @@ -92,6 +92,12 @@ LenaHelper::DoStart (void) { NS_LOG_ERROR ("Unknown propagation model"); } + if (m_fadingModelFactory.GetTypeId ().GetName ().compare ( "ns3::TraceFadingLossModel") == 0) + { + m_fadingModule = CreateObject (); + m_downlinkChannel->AddSpectrumPropagationLossModel (m_fadingModule); + m_uplinkChannel->AddSpectrumPropagationLossModel (m_fadingModule); + } m_macStats = CreateObject (); m_rlcStats = CreateObject (); Object::DoStart (); @@ -129,6 +135,11 @@ TypeId LenaHelper::GetTypeId (void) StringValue ("ns3::BuildingsPropagationLossModel"), MakeStringAccessor (&LenaHelper::SetPropagationModelType), MakeStringChecker ()) + .AddAttribute ("FadingModel", + "The type of fading model to be used", + StringValue ("ns3::FriisSpectrumPropagationLossModel"), // fake module -> no fading + MakeStringAccessor (&LenaHelper::SetFadingModel), + MakeStringChecker ()) ; return tid; } @@ -168,6 +179,22 @@ LenaHelper::SetPropagationModelAttribute (std::string n, const AttributeValue &v } +void +LenaHelper::SetFadingModel (std::string type) +{ + NS_LOG_FUNCTION (this << type); + m_fadingModelFactory = ObjectFactory (); + m_fadingModelFactory.SetTypeId (type); +} + +void +LenaHelper::SetFadingModelAttribute (std::string n, const AttributeValue &v) +{ + NS_LOG_FUNCTION (this << n); + m_fadingModelFactory.Set (n, v); +} + + NetDeviceContainer LenaHelper::InstallEnbDevice (NodeContainer c) { @@ -346,6 +373,15 @@ LenaHelper::Attach (Ptr ueDevice, Ptr enbDevice) Ptr enbPhy = enbDevice->GetObject ()->GetPhy (); Ptr uePhy = ueDevice->GetObject ()->GetPhy (); enbPhy->AddUePhy (rnti, uePhy); + + if (m_fadingModelFactory.GetTypeId ().GetName ().compare ( "ns3::TraceFadingLossModel") == 0) + { + Ptr mm_enb = enbDevice->GetObject (); + Ptr mm_ue = ueDevice->GetObject (); + m_fadingModule->CreateFadingChannelRealization (mm_enb, mm_ue); //downlink + m_fadingModule->CreateFadingChannelRealization (mm_ue, mm_enb); //uplink + + } // WILD HACK - should be done through PHY SAP, probably passing by RRC uePhy->SetRnti (rnti); diff --git a/src/lte/helper/lena-helper.h b/src/lte/helper/lena-helper.h index b1df021d6..e0201b83f 100644 --- a/src/lte/helper/lena-helper.h +++ b/src/lte/helper/lena-helper.h @@ -32,6 +32,7 @@ #include #include #include +#include namespace ns3 { @@ -146,6 +147,18 @@ public: * set an attribute for the propagation model to be created */ void SetPropagationModelAttribute (std::string n, const AttributeValue &v); + + /** + * + * + * \param type the fading modul to be used + */ + void SetFadingModel (std::string model); + + /** + * set an attribute of the fading model + */ + void SetFadingModelAttribute (std::string n, const AttributeValue &v); /** @@ -208,6 +221,10 @@ private: ObjectFactory m_dlPropagationModelFactory; ObjectFactory m_ulPropagationModelFactory; + ObjectFactory m_fadingModelFactory; + + Ptr m_fadingModule; + Ptr m_macStats; Ptr m_rlcStats;