Help with Error models

253 views
Skip to first unread message

Anumit Sasidharan

unread,
Jan 21, 2015, 3:59:55 PM1/21/15
to ns-3-...@googlegroups.com
Hi,

I'm rather new to NS3, and was going through examples/tutorial/sixth.cc

In the example sixth.cc, an error rate of 0.00001 is applied:

  Ptr<RateErrorModel> em = CreateObject<RateErrorModel> ();
  em->SetAttribute ("ErrorRate", DoubleValue (0.00001));
  devices.Get (1)->SetAttribute ("ReceiveErrorModel", PointerValue (em));
 

So, what I would like to do is to recreate the same example, but want different error rates for different time-slices. That is, for the first 5 seconds, I want an error rate of 0.00001, the next 5 seconds I want 0.00002, the next 5 - 100% error rate(all packets are dropped), and the last 5 seconds again with 0.00001.

The problem is that the error model is attached to the device itself, so it remains the same throughout the run-time of the application.

Do you have any suggestions on how I can achieve this? Any other classes or modules that I can use? Or if you can point me to any other examples which are doing something similar?

Any help/hints will be really appreciated. Thanks!

Tommaso Pecorella

unread,
Jan 21, 2015, 4:28:54 PM1/21/15
to ns-3-...@googlegroups.com
Simulator::Schedule (Seconds (5), &RateErrorModel::SetRate, em, 0.00002);
Simulator::Schedule (Seconds (10), &RateErrorModel::SetRate, em, 1);
Simulator::Schedule (Seconds (15), &RateErrorModel::SetRate, em, 0.00001);

It's drycoding... I may have done any stupid error or typo.

Cheers,

T.

Anumit Sasidharan

unread,
Jan 21, 2015, 5:24:01 PM1/21/15
to ns-3-...@googlegroups.com
Wow. I hadn't expected it to be this simple. Worked beautifully. Thanks a ton.

Weitao Dong

unread,
Feb 24, 2015, 3:54:57 PM2/24/15
to ns-3-...@googlegroups.com
Hello,

I am curious that Could I add some random packet loss on it, not like his 5 seconds and 10 seconds. All the time are in the random packet loss between for example 5 to 10%. Is it possible? Thank you!

Tommaso Pecorella

unread,
Feb 24, 2015, 4:29:43 PM2/24/15
to ns-3-...@googlegroups.com
The error rate does set the error probability. Packets are not dropped in a deterministic way (well, not in this model).
What is fixed is when (the time) the channel is switching the drop probability.

T.
Reply all
Reply to author
Forward
0 new messages