void BandwidthTrace(PointToPointHelper &p2p, NodeContainer &nc, NetDeviceContainer &ndc)
{
double t;
string s;
t = Simulator::Now ().GetSeconds ();
Simulator::Schedule (MilliSeconds(100) , &BandwidthTrace, p2p, nc, ndc);
if ( t <= 100) {
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("3Mbps"));\
ndc = p2p.Install (nc);
}
else {
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("8Mbps"));
ndc = p2p.Install (nc);
}
}
NodeContainer c;
c.Create (4);
...
NodeContainer n3n2 = NodeContainer (c.Get (3), c.Get (2));;
NetDeviceContainer d3d2;
...
BandwidthTrace ( p2p, n3n2, d3d2);
ndc = p2p.Install (nc);
void BandwidthTrace(PointToPointHelper &p2p)
{
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("8Mbps"));
}
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("3Mbps"));
d3d2= p2p.Install (n3n2);
Simulator::Schedule (Seconds(100) , &BandwidthTrace, p2p); // but as i read from point-to-point-helper.cc, we have to use point-to-point-helper::Install after set these attributes.
void BandwidthTrace()
{
Config::Set("/NodeList/1/DeviceList/1/$ns3::PointToPointNetDevice/DataRate", StringValue("3Mbps") );
}
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("8Mbps"));\
ndc = p2p.Install (nc);
Simulator::Schedule (Seconds(100) , &BandwidthTrace);
void BandwidthTrace()
{
Config::Set("/NodeList/2/DeviceList/2/$ns3::PointToPointNetDevice/DataRate", StringValue("3Mbps") );
}
p2p.SetChannelAttribute ("Delay", StringValue ("30ms"));
p2p.SetDeviceAttribute ("DataRate", StringValue ("8Mbps"));\
ndc = p2p.Install (nc);
Simulator::Schedule (Seconds(100) , &BandwidthTrace); (*)
Config::Set("/NodeList/2/DeviceList/2/$ns3::PointToPointNetDevice/DataRate", StringValue("3Mbps") );
Thank you so much Mr. Konstantinos and Mr. Tommaso for your help !
Finnally, my project is ran. Although this is just the first step, but this is very important.
It is certainly that I still need your help in the future. So I hope that you can still help more people as possible.
Thank you again and hope you healthy and happy !
BR.
Quang
--
Posting to this group should follow these guidelines https://www.nsnam.org/wiki/Ns-3-users-guidelines-for-posting
---
You received this message because you are subscribed to a topic in the Google Groups "ns-3-users" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/ns-3-users/rJaWMVixcmY/unsubscribe.
To unsubscribe from this group and all its topics, send an email to ns-3-users+...@googlegroups.com.
To post to this group, send email to ns-3-...@googlegroups.com.
Visit this group at https://groups.google.com/group/ns-3-users.
For more options, visit https://groups.google.com/d/optout.
Config::Set ("/NodeList/2/DeviceList/2/$ns3::PointToPointNetDevice/DataRate",StringValue (bandwidth));