scheduler and propagation model configurable through ConfigStore
This commit is contained in:
@@ -90,9 +90,8 @@ int main (int argc, char *argv[])
|
||||
<< "_numUes" << std::setw(3) << std::setfill('0') << numUes
|
||||
<< "_rngRun" << std::setw(3) << std::setfill('0') << runValue.Get () ;
|
||||
|
||||
|
||||
LenaHelper lena;
|
||||
|
||||
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
NodeContainer ueNodes1, ueNodes2;
|
||||
@@ -133,19 +132,19 @@ int main (int argc, char *argv[])
|
||||
NetDeviceContainer enbDevs;
|
||||
NetDeviceContainer ueDevs1;
|
||||
NetDeviceContainer ueDevs2;
|
||||
enbDevs = lena.InstallEnbDevice (enbNodes);
|
||||
ueDevs1 = lena.InstallUeDevice (ueNodes1);
|
||||
ueDevs2 = lena.InstallUeDevice (ueNodes2);
|
||||
enbDevs = lena->InstallEnbDevice (enbNodes);
|
||||
ueDevs1 = lena->InstallUeDevice (ueNodes1);
|
||||
ueDevs2 = lena->InstallUeDevice (ueNodes2);
|
||||
|
||||
// Attach UEs to a eNB
|
||||
lena.Attach (ueDevs1, enbDevs.Get (0));
|
||||
lena.Attach (ueDevs2, enbDevs.Get (1));
|
||||
lena->Attach (ueDevs1, enbDevs.Get (0));
|
||||
lena->Attach (ueDevs2, enbDevs.Get (1));
|
||||
|
||||
// Activate an EPS bearer on all UEs
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q);
|
||||
lena.ActivateEpsBearer (ueDevs1, bearer);
|
||||
lena.ActivateEpsBearer (ueDevs2, bearer);
|
||||
lena->ActivateEpsBearer (ueDevs1, bearer);
|
||||
lena->ActivateEpsBearer (ueDevs2, bearer);
|
||||
|
||||
Simulator::Stop (Seconds (10));
|
||||
|
||||
|
||||
@@ -44,9 +44,9 @@ int main (int argc, char *argv[])
|
||||
// parse again so you can override default values from the command line
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
LenaHelper lena;
|
||||
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
|
||||
|
||||
lena.EnableLogComponents ();
|
||||
//lena->EnableLogComponents ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
@@ -64,18 +64,18 @@ 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);
|
||||
//lena->SetSchedulerType ("ns3::RrFfMacScheduler");
|
||||
lena->SetSchedulerType ("ns3::PfFfMacScheduler");
|
||||
enbDevs = lena->InstallEnbDevice (enbNodes);
|
||||
ueDevs = lena->InstallUeDevice (ueNodes);
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lena.Attach (ueDevs, enbDevs.Get (0));
|
||||
lena->Attach (ueDevs, enbDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q);
|
||||
lena.ActivateEpsBearer (ueDevs, bearer);
|
||||
lena->ActivateEpsBearer (ueDevs, bearer);
|
||||
|
||||
|
||||
Simulator::Stop (Seconds (0.005));
|
||||
|
||||
@@ -55,8 +55,6 @@ void DlRxPduCallback(Ptr<RlcStatsCalculator> rlcStats, std::string path,
|
||||
|
||||
int main (int argc, char *argv[])
|
||||
{
|
||||
LenaHelper lena;
|
||||
|
||||
// Command line arguments
|
||||
CommandLine cmd;
|
||||
cmd.Parse (argc, argv);
|
||||
@@ -67,8 +65,10 @@ int main (int argc, char *argv[])
|
||||
// parse again so you can override default values from the command line
|
||||
cmd.Parse (argc, argv);
|
||||
|
||||
Ptr<LenaHelper> lena = CreateObject<LenaHelper> ();
|
||||
|
||||
// Enable LTE log components
|
||||
//lena.EnableLogComponents ();
|
||||
//lena->EnableLogComponents ();
|
||||
|
||||
// Create Nodes: eNodeB and UE
|
||||
NodeContainer enbNodes;
|
||||
@@ -86,16 +86,16 @@ int main (int argc, char *argv[])
|
||||
// Create Devices and install them in the Nodes (eNB and UE)
|
||||
NetDeviceContainer enbDevs;
|
||||
NetDeviceContainer ueDevs;
|
||||
enbDevs = lena.InstallEnbDevice (enbNodes);
|
||||
ueDevs = lena.InstallUeDevice (ueNodes);
|
||||
enbDevs = lena->InstallEnbDevice (enbNodes);
|
||||
ueDevs = lena->InstallUeDevice (ueNodes);
|
||||
|
||||
// Attach a UE to a eNB
|
||||
lena.Attach (ueDevs, enbDevs.Get (0));
|
||||
lena->Attach (ueDevs, enbDevs.Get (0));
|
||||
|
||||
// Activate an EPS bearer
|
||||
enum EpsBearer::Qci q = EpsBearer::GBR_CONV_VOICE;
|
||||
EpsBearer bearer (q);
|
||||
lena.ActivateEpsBearer (ueDevs, bearer);
|
||||
lena->ActivateEpsBearer (ueDevs, bearer);
|
||||
|
||||
Simulator::Stop (Seconds (4));
|
||||
|
||||
|
||||
@@ -22,6 +22,9 @@
|
||||
|
||||
#include "lena-helper.h"
|
||||
|
||||
#include <ns3/string.h>
|
||||
#include <ns3/log.h>
|
||||
|
||||
#include <ns3/lte-enb-rrc.h>
|
||||
#include <ns3/lte-ue-rrc.h>
|
||||
#include <ns3/lte-ue-mac.h>
|
||||
@@ -37,66 +40,105 @@
|
||||
#include <ns3/lte-enb-net-device.h>
|
||||
#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>
|
||||
#include <ns3/ff-mac-scheduler.h>
|
||||
|
||||
NS_LOG_COMPONENT_DEFINE ("LenaHelper");
|
||||
|
||||
namespace ns3 {
|
||||
|
||||
NS_OBJECT_ENSURE_REGISTERED (LenaHelper);
|
||||
|
||||
LenaHelper::LenaHelper (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
void
|
||||
LenaHelper::DoStart (void)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkChannel = CreateObject<SingleModelSpectrumChannel> ();
|
||||
m_uplinkChannel = CreateObject<SingleModelSpectrumChannel> ();
|
||||
Ptr<SpectrumPropagationLossModel> dlPropagationModel = CreateObject<FriisSpectrumPropagationLossModel> ();
|
||||
Ptr<SpectrumPropagationLossModel> ulPropagationModel = CreateObject<FriisSpectrumPropagationLossModel> ();
|
||||
Ptr<SpectrumPropagationLossModel> dlPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
|
||||
Ptr<SpectrumPropagationLossModel> ulPropagationModel = m_propagationModelFactory.Create<SpectrumPropagationLossModel> ();
|
||||
m_downlinkChannel->AddSpectrumPropagationLossModel (dlPropagationModel);
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
|
||||
|
||||
SetScheduler ("RrFfMacScheduler"); // default scheduler
|
||||
m_uplinkChannel->AddSpectrumPropagationLossModel (ulPropagationModel);
|
||||
Object::DoStart ();
|
||||
}
|
||||
|
||||
LenaHelper::~LenaHelper (void)
|
||||
{
|
||||
m_downlinkChannel = 0;
|
||||
m_uplinkChannel = 0;
|
||||
NS_LOG_FUNCTION (this);
|
||||
}
|
||||
|
||||
|
||||
void
|
||||
LenaHelper::DoDispose ()
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
m_downlinkChannel = 0;
|
||||
m_uplinkChannel = 0;
|
||||
Object::DoDispose ();
|
||||
}
|
||||
|
||||
TypeId LenaHelper::GetTypeId (void)
|
||||
{
|
||||
static TypeId
|
||||
tid =
|
||||
TypeId ("ns3::LenaHelper")
|
||||
.SetParent<Object> ()
|
||||
.AddConstructor<LenaHelper> ()
|
||||
.AddAttribute ("Scheduler",
|
||||
"The type of scheduler to be used for eNBs",
|
||||
StringValue ("ns3::RrFfMacScheduler"),
|
||||
MakeStringAccessor (&LenaHelper::SetSchedulerType),
|
||||
MakeStringChecker ())
|
||||
.AddAttribute ("PropagationModel",
|
||||
"The type of propagation model to be used",
|
||||
StringValue ("ns3::FriisSpectrumPropagationLossModel"),
|
||||
MakeStringAccessor (&LenaHelper::SetPropagationModelType),
|
||||
MakeStringChecker ())
|
||||
;
|
||||
return tid;
|
||||
}
|
||||
|
||||
void
|
||||
LenaHelper::SetSchedulerType (std::string type)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
m_schedulerFactory = ObjectFactory ();
|
||||
m_schedulerFactory.SetTypeId (type);
|
||||
}
|
||||
|
||||
void
|
||||
LenaHelper::SetSchedulerAttribute (std::string n, const AttributeValue &v)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << n);
|
||||
m_schedulerFactory.Set (n, v);
|
||||
}
|
||||
|
||||
|
||||
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)
|
||||
LenaHelper::SetPropagationModelType (std::string type)
|
||||
{
|
||||
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);
|
||||
NS_LOG_FUNCTION (this << type);
|
||||
m_propagationModelFactory = ObjectFactory ();
|
||||
m_propagationModelFactory.SetTypeId (type);
|
||||
}
|
||||
|
||||
void
|
||||
LenaHelper::SetPropagationModelAttribute (std::string n, const AttributeValue &v)
|
||||
{
|
||||
NS_LOG_FUNCTION (this << n);
|
||||
m_propagationModelFactory.Set (n, v);
|
||||
}
|
||||
|
||||
|
||||
NetDeviceContainer
|
||||
LenaHelper::InstallEnbDevice (NodeContainer c)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
Start (); // will run DoStart () if necessary
|
||||
NetDeviceContainer devices;
|
||||
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
|
||||
{
|
||||
@@ -110,6 +152,7 @@ LenaHelper::InstallEnbDevice (NodeContainer c)
|
||||
NetDeviceContainer
|
||||
LenaHelper::InstallUeDevice (NodeContainer c)
|
||||
{
|
||||
NS_LOG_FUNCTION (this);
|
||||
NetDeviceContainer devices;
|
||||
for (NodeContainer::Iterator i = c.Begin (); i != c.End (); ++i)
|
||||
{
|
||||
@@ -124,13 +167,15 @@ LenaHelper::InstallUeDevice (NodeContainer c)
|
||||
void
|
||||
LenaHelper::SetEnbDeviceAttribute (std::string name, const AttributeValue &value)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_FATAL_ERROR ("not implemented yet");
|
||||
}
|
||||
|
||||
void
|
||||
LenaHelper::SetUeDeviceAttribute (std::string name, const AttributeValue &value)
|
||||
{
|
||||
|
||||
NS_LOG_FUNCTION (this);
|
||||
NS_FATAL_ERROR ("not implemented yet");
|
||||
}
|
||||
|
||||
|
||||
@@ -156,7 +201,7 @@ LenaHelper::InstallSingleEnbDevice (Ptr<Node> n)
|
||||
m_uplinkChannel->AddRx (ulPhy);
|
||||
|
||||
Ptr<LteEnbMac> mac = CreateObject<LteEnbMac> ();
|
||||
Ptr<FfMacScheduler> sched = m_scheduler.Create<FfMacScheduler> ();
|
||||
Ptr<FfMacScheduler> sched = m_schedulerFactory.Create<FfMacScheduler> ();
|
||||
Ptr<LteEnbRrc> rrc = CreateObject<LteEnbRrc> ();
|
||||
|
||||
|
||||
|
||||
@@ -43,12 +43,14 @@ class SpectrumChannel;
|
||||
* Creation and configuration of LTE entities
|
||||
*
|
||||
*/
|
||||
class LenaHelper
|
||||
class LenaHelper : public Object
|
||||
{
|
||||
public:
|
||||
LenaHelper (void);
|
||||
~LenaHelper (void);
|
||||
virtual ~LenaHelper (void);
|
||||
|
||||
static TypeId GetTypeId (void);
|
||||
virtual void DoDispose (void);
|
||||
|
||||
/**
|
||||
* \todo to be implemented
|
||||
@@ -117,41 +119,30 @@ public:
|
||||
*/
|
||||
void ActivateEpsBearer (Ptr<NetDevice> ueDevice, EpsBearer bearer);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param type the type of scheduler to be used for the eNBs
|
||||
*/
|
||||
void SetSchedulerType (std::string type);
|
||||
|
||||
/**
|
||||
* \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 ());
|
||||
|
||||
|
||||
* set an attribute for the scheduler to be created
|
||||
*/
|
||||
void SetSchedulerAttribute (std::string n, const AttributeValue &v);
|
||||
|
||||
/**
|
||||
*
|
||||
*
|
||||
* \param type the type of propagation model to be used for the eNBs
|
||||
*/
|
||||
void SetPropagationModelType (std::string type);
|
||||
|
||||
/**
|
||||
* set an attribute for the propagation model to be created
|
||||
*/
|
||||
void SetPropagationModelAttribute (std::string n, const AttributeValue &v);
|
||||
|
||||
|
||||
/**
|
||||
* Enables logging for all components of the LENA architecture
|
||||
@@ -159,14 +150,22 @@ public:
|
||||
*/
|
||||
void EnableLogComponents (void);
|
||||
|
||||
|
||||
protected:
|
||||
|
||||
// inherited from Object
|
||||
virtual void DoStart (void);
|
||||
|
||||
private:
|
||||
|
||||
Ptr<NetDevice> InstallSingleEnbDevice (Ptr<Node> n);
|
||||
Ptr<NetDevice> InstallSingleUeDevice (Ptr<Node> n);
|
||||
|
||||
Ptr<SpectrumChannel> m_downlinkChannel;
|
||||
Ptr<SpectrumChannel> m_uplinkChannel;
|
||||
|
||||
ObjectFactory m_scheduler;
|
||||
ObjectFactory m_schedulerFactory;
|
||||
ObjectFactory m_propagationModelFactory;
|
||||
};
|
||||
|
||||
|
||||
|
||||
@@ -233,7 +233,7 @@ PfFfMacScheduler::DoDispose ()
|
||||
TypeId
|
||||
PfFfMacScheduler::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("PfFfMacScheduler")
|
||||
static TypeId tid = TypeId ("ns3::PfFfMacScheduler")
|
||||
.SetParent<FfMacScheduler> ()
|
||||
.AddConstructor<PfFfMacScheduler> ();
|
||||
return tid;
|
||||
|
||||
@@ -230,7 +230,7 @@ RrFfMacScheduler::DoDispose ()
|
||||
TypeId
|
||||
RrFfMacScheduler::GetTypeId (void)
|
||||
{
|
||||
static TypeId tid = TypeId ("RrFfMacScheduler")
|
||||
static TypeId tid = TypeId ("ns3::RrFfMacScheduler")
|
||||
.SetParent<FfMacScheduler> ()
|
||||
.AddConstructor<RrFfMacScheduler> ();
|
||||
return tid;
|
||||
|
||||
Reference in New Issue
Block a user