<html><head><meta http-equiv="Content-Type" content="text/html charset=us-ascii"></head><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space;" class=""><br class=""><div><blockquote type="cite" class=""><div class="">On Apr 5, 2016, at 4:04 AM, Ahmed Sadek <<a href="mailto:don1559@gmail.com" class="">don1559@gmail.com</a>> wrote:</div><br class="Apple-interchange-newline"><div class=""><div dir="ltr" class="">Dear All,<div class=""><br class=""></div><div class="">I wanted to change the BW on link during sim, I found this method in a previous email <a href="http://www.lists.cs.ucla.edu/pipermail/ndnsim/2013-March/000297.html" class="">Here</a></div><div class=""><br class=""></div><div class="">so now I have this method:</div><div class=""><br class=""></div><div class=""><div class="">// Set the Data Rate of a given Device.</div><div class="">void setDataRate(Ptr<NetDevice > nd, std::string DR)</div><div class="">{</div><div class="">  Ptr < Channel > channel = nd->GetChannel();</div><div class="">  Ptr<NetDevice> toDev = channel->GetDevice (1);</div><div class="">  Ptr<NetDevice> fromDev = channel->GetDevice (0);</div><div class=""><br class=""></div><div class="">  toDev->SetAttribute ("DataRate", StringValue (DR));</div><div class="">  fromDev->SetAttribute ("DataRate", StringValue (DR));</div><div class="">}</div></div><div class=""><br class=""></div><div class="">And was wondering, is there a simpler method to take advantage of point to point device method <a href="https://www.nsnam.org/doxygen/classns3_1_1_point_to_point_net_device.html#adc4e5973337c576a2352e261cd844686" class="">Here</a> (</div><pre style="overflow:auto;padding:5px;color:rgb(51,51,51);line-height:15.6px;border-top-width:1px;border-bottom-width:1px;border-style:solid none;border-top-color:rgb(170,204,153);border-bottom-color:rgb(170,204,153);background-color:rgb(238,255,204)" class="">pointToPoint.SetDeviceAttribute ("DataRate", StringValue ("5Mbps"));<br class=""></pre><div class="">), can't we cast <i style="white-space: pre-wrap;" class=""><b class="">netDevice </b></i>to <b class="">PointToPointNetDevice </b>or something similar ?<br class=""></div></div></div></blockquote><div><br class=""></div><div>You can.  It is just "SetAttribute" method takes care of the fact that a specific NetDevice may not be PointToPointNetDevice and also not requires you to include point-to-point-net-device.h header file.   But again, you absolutely can do the dynamic cast, just make sure that the return value is not null (e.g., it is indeed PointToPointNetDevice-derived class).</div><div><br class=""></div><div>---</div><div>Alex</div><div><br class=""></div></div></body></html>