[ndnSIM] How to simulate link failure at a specific run time?

Alex Afanasyev alexander.afanasyev at ucla.edu
Mon Apr 22 10:29:09 PDT 2013


Hi huyao,

You can always schedule an event (a function) at 10 seconds, where you can "fail" the link.
I'm not sure about DataRate, since technically it is a "static" parameter.  However, you can either set the link down on the nodes associated with the same channel, or change parameters of the error model.  Something along these lines:

void
FailLink (Ptr<NetDevice> nd)
{
    Ptr<RateErrorModel> error = CreateObject<RateErrorModel> ();
    error->SetAttribute ("ErrorRate", DoubleValue (1.0));

    nd->SetAttribute ("ReceiveErrorModel", PointerValue (error));
}

...


Simulator::Schedule (Seconds (10.0), FailLink, device1);
Simulator::Schedule (Seconds (10.0), FailLink, device2);

---
Alex

On Apr 22, 2013, at 7:49 AM, yao hu <huyao0107 at gmail.com> wrote:

> Hi Alex,
> 
> (Sorry for my previous incomplete message..)
> 
> Is it possible to simulate link failure at a specific run time? 
> 
> If It can be the following format
> if(Expression including Seconds(double))
> {
>     link failure;
> }
> 
> Then, 
> (1)How to write the expression meaning the specific run time (like at 10 seconds)?
> (2)To simulate link failure, can I set the attribute DataRate as 0?
> 
> Thank you very much!
> 
> Regards,
> huyao
> 
> 
> 
> 
> 2013/4/22 yao hu <huyao0107 at gmail.com>
> Hi Alex,
> 
> Is it possible to simulate link failure at a specific run time? 
> 
> If It can be the following format
> if(Expression including Seconds(double))
> {
> 
> }
> 
> _______________________________________________
> ndnSIM mailing list
> ndnSIM at lists.cs.ucla.edu
> http://www.lists.cs.ucla.edu/mailman/listinfo/ndnsim

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://www.lists.cs.ucla.edu/pipermail/ndnsim/attachments/20130422/b0d37391/attachment.html>


More information about the ndnSIM mailing list