0
votes

I'm new to NS3 and looking at the first.cc tutorial. https://www.nsnam.org/doxygen/first_8cc_source.html

In the tutorial two nodes are setup using a point to point link. I'm interested in changing the datarate of the device/channel during simulation run() and analyzing the delay. E.g, i would like to modify the datarate to 3Mbps around 3 seconds into the simulation.

I found the following link to be the same question I'm asking but there doesn't seem to be an answer. How to change the data rate between two nodes during the simulation in NS-3?

1
You can use Simulator::Schedule to accomplish that. I also recommend asking the NS-3 Google Groups, where the maintainers arethenewjames

1 Answers

0
votes

I think thenewjames' comment is correct. I haven't run this script, but here is an example to get you started.

static void
DecreaseDataRate(PointToPointNetDevice *dev) {
    dev->SetDeviceAttribute ("DataRate", StringValue ("3Mbps"));
}

int
main(int argv, char* arg[]) {
// setup simulation ...
PointToPointHelper pointToPoint;
// rest of setup

Simulator::Schedule(Seconds(3), &DecreaseDataRate, &pointToPoint);
Simulation::Start();
}