MAC, RRC and Scheduler created by LenaHelper

This commit is contained in:
Marco Miozzo
2011-03-24 10:20:18 +01:00
parent a807dada80
commit b372eab5e7
9 changed files with 123 additions and 40 deletions

View File

@@ -30,7 +30,7 @@ int main (int argc, char *argv[])
{
LenaHelper lena;
//lena.EnableLogComponents ();
lena.EnableLogComponents ();
// Create Nodes: eNodeB and UE
NodeContainer enbNodes;

View File

@@ -38,6 +38,11 @@
#include <ns3/lte-ue-net-device.h>
#include <ns3/lte-spectrum-value-helper.h>
#include <ns3/lte-enb-mac.h>
#include <ns3/pf-ff-mac-scheduler.h>
#include <ns3/lte-enb-rrc.h>
#include <ns3/lte-ue-mac.h>
#include <ns3/lte-ue-rrc.h>
namespace ns3 {
@@ -49,6 +54,8 @@ LenaHelper::LenaHelper (void)
{
Ptr<SpectrumPropagationLossModel> model = CreateObject<FriisSpectrumPropagationLossModel> ();
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<Node> n)
ulPhy->SetMobility (mm);
m_uplinkChannel->AddRx (ulPhy);
Ptr<LteEnbNetDevice> dev = CreateObject<LteEnbNetDevice> (n, phy);
Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
//Ptr<FfMacScheduler> sched = m_scheduler.Create<FfMacScheduler> ();
Ptr<FfMacScheduler> sched = Create<PfFfMacScheduler> ();
Ptr<LteEnbRrc> rrc = Create<LteEnbRrc> ();
Ptr<LteEnbNetDevice> dev = CreateObject<LteEnbNetDevice> (n, phy, mac, sched, rrc);
phy->SetDevice (dev);
dlPhy->SetDevice (dev);
ulPhy->SetDevice (dev);
n->AddDevice (dev);
Ptr<LteEnbMac> mac = dev->GetMac ();
//Ptr<LteEnbMac> mac = dev->GetMac ();
ulPhy->SetPhyMacRxEndOkCallback (MakeCallback (&LteEnbPhy::PhyPduReceived, phy));
dev->Start ();
@@ -162,14 +198,16 @@ LenaHelper::InstallSingleUeDevice (Ptr<Node> n)
ulPhy->SetMobility (mm);
m_downlinkChannel->AddRx (dlPhy);
Ptr<LteUeNetDevice> dev = CreateObject<LteUeNetDevice> (n, phy);
Ptr<LteUeMac> mac = CreateObject<LteUeMac> ();
Ptr<LteUeRrc> rrc = Create<LteUeRrc> ();
Ptr<LteUeNetDevice> dev = CreateObject<LteUeNetDevice> (n, phy, mac, rrc);
phy->SetDevice (dev);
dlPhy->SetDevice (dev);
ulPhy->SetDevice (dev);
n->AddDevice (dev);
Ptr<LteUeMac> mac = dev->GetMac ();
//Ptr<LteUeMac> 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);

View File

@@ -116,6 +116,42 @@ public:
* \param bearer the characteristics of the bearer to be activated
*/
void ActivateEpsBearer (Ptr<NetDevice> 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<SpectrumChannel> m_downlinkChannel;
Ptr<SpectrumChannel> m_uplinkChannel;
//ObjectFactory m_scheduler;
};

View File

@@ -73,10 +73,13 @@ LteEnbNetDevice::LteEnbNetDevice (void)
InitLteEnbNetDevice ();
}
LteEnbNetDevice::LteEnbNetDevice (Ptr<Node> node, Ptr<LteEnbPhy> phy)
: m_phy (phy)
LteEnbNetDevice::LteEnbNetDevice (Ptr<Node> node, Ptr<LteEnbPhy> phy, Ptr<LteEnbMac> mac, Ptr<FfMacScheduler> sched, Ptr<LteEnbRrc> 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<LteEnbMac> ();
//m_mac = CreateObject<LteEnbMac> ();
// m_mac->SetDevice (this->GetObject<LteNetDevice> ());
SetNode (0);
if (GetPhy () == 0)
@@ -120,13 +123,13 @@ LteEnbNetDevice::InitLteEnbNetDevice (void)
{
NS_LOG_DEBUG (this << "PHY ! NULL");
}
m_rrc = CreateObject<LteEnbRrc> ();
//m_rrc = Create<LteEnbRrc> ();
m_rrc->SetLteEnbCmacSapProvider (m_mac->GetLteEnbCmacSapProvider ());
m_mac->SetLteEnbCmacSapUser (m_rrc->GetLteEnbCmacSapUser ());
m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());
//m_scheduler = Create<RrFfMacScheduler> ();
m_scheduler = Create<PfFfMacScheduler> ();
//m_scheduler = Create<PfFfMacScheduler> ();
m_mac->SetFfMacSchedSapProvider (m_scheduler->GetFfMacSchedSapProvider ());
m_mac->SetFfMacCschedSapProvider (m_scheduler->GetFfMacCschedSapProvider ());

View File

@@ -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> node, Ptr<LteEnbPhy> phy);
LteEnbNetDevice (Ptr<Node> node, Ptr<LteEnbPhy> phy, Ptr<LteEnbMac> mac, Ptr<FfMacScheduler> sched, Ptr<LteEnbRrc> rrc);
virtual ~LteEnbNetDevice (void);
virtual void DoDispose (void);

View File

@@ -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 ());
}
}

View File

@@ -66,13 +66,14 @@ LteUeNetDevice::LteUeNetDevice (void)
}
LteUeNetDevice::LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy)
: m_phy (phy)
LteUeNetDevice::LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy, Ptr<LteUeMac> mac, Ptr<LteUeRrc> 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<LteUeMac> ();
m_rrc = CreateObject<LteUeRrc> ();
//m_mac = CreateObject<LteUeMac> ();
//m_rrc = Create<LteUeRrc> ();
m_rrc->SetLteUeCmacSapProvider (m_mac->GetLteUeCmacSapProvider ());
m_mac->SetLteUeCmacSapUser (m_rrc->GetLteUeCmacSapUser ());
m_rrc->SetLteMacSapProvider (m_mac->GetLteMacSapProvider ());

View File

@@ -57,7 +57,7 @@ public:
* \param node
* \param phy
*/
LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy);
LteUeNetDevice (Ptr<Node> node, Ptr<LteUePhy> phy, Ptr<LteUeMac> mac, Ptr<LteUeRrc> rrc);
virtual ~LteUeNetDevice (void);
virtual void DoDispose ();

View File

@@ -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