Set or get Attributes from a derived class

49 views
Skip to first unread message

Christiane Wagner

unread,
Dec 12, 2017, 2:55:04 AM12/12/17
to ns-3-users
Hallo,

I'm trying to stimulate a LTE scheduler without changing the ns3 code for the schedulers, so that I can exchange the scheduling algorithm. (I'm using a "testbench"-skript.)
To get a valid MCS for the Downlink path, there has to be information about CQI and how long the CQI is still valid. The default value for this m_cqiTimerThreshold is set in the function RrFfMacScheduler::GetTypeId (void)
How can I call the function RrFfMacScheduler::GetTypeId (void) so that m_cqiTimerThreshold is initalised and how can I change the default values?
I tryed:

ns3::UintegerValue CqiTimerThreshold = 2000;

sched->SetAttribute("ns3::RrFfMacScheduler::CqiTimerThreshold", CqiTimerThreshold);

and while executing the error message is displayed:

msg="Attribute name=ns3::RrFfMacScheduler::CqiTimerThreshold does not exist for this object: tid=ns3::Object", file=../object-base.cc, line=230

terminate called without an active exception

 
main problem is also, that the scheduler is of the type FfMacScheduler,  but it needs  parameters of the Roundrobin Scheduler:
    ns3::FfMacScheduler *sched = new ns3::RrFfMacScheduler();  // new instance of a scheduler
    ns3::RrFfMacScheduler::GetTypeId();  
// The function I need is called, but sched does not get the attributes
    sched->GetTypeId();
// different function, where other attributes are set

Had anybody the same problem or knows any solution?
Thank you very much!

pdbarnes

unread,
Dec 12, 2017, 12:21:04 PM12/12/17
to ns-3-users
Please revisit the tutorial section on the Object model and Attributes.

Every type derived from Object has default values for its Attributes. These are set statically in the GetTypeId() function. You can change the default values using SetDefault() or from the command line.

Note that the defaults are used only to create new instances of a class, so you have to set the default *before* you create the instance.

Peter

Reply all
Reply to author
Forward
0 new messages