Assigned 10/11. Due 11/8 in class
This assignment is to program and run a simple ns-2 simulation and analyze its output. You are to create a two-node ns-2 simulation, with your nodes called n0 and n1. The nodes are to be connected by a 1Mb full duplex link, with a 15ms propagation delay, and DropTail queueing. There should be buffer space for 20 packets in each direction on the link.
There are four sources, all of which run from n0 to n1. The first three sources are ftp sources (that run over tcp and have an infinite amount of data to send). The fourth source is a so-called on-off source. An on/off source will generate packets periodically when on, and generate no packets when off.
The following ns code snippet will create an on/off source at attach it to a UDP agent at node 0. The on/off source will generate packets at a rate of 10 1KByte packets per second (80K bits per second) when on. The on/off source stays "on" for an exponentially distributed amount of time, with mean 1 sec; it then stays "off" for an exponentially distributed amount of time, with mean 1 sec.
#Create a UDP agent and attach it to node n0Create an ns simulation program that implements the scenario described above. Run your simulation 10 times. Answer the following questions:
set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
$udp0 set packetSize_ 10000
#create an on/off source, and its paramaters.
# The source will generate 10 1K byte packets per second when on
set onoff0 [new Application/Traffic/Exponential]
$onoff0 set burst_time_ 1.0s
$onoff0 set idle_time_ 1.0s
$onoff0 set packet_size_ 1000
$onoff0 set rate_ 80000
# Attach the on/off source to the udp0 agent
$onoff0 attach-agent $udp0
#Create a Null agent (a traffic sink) and attach it to node n1
set null0 [new Agent/Null]
$NS attach-agent $n1 $null0
#Connect the traffic source with the traffic sink
$NS connect $udp0 $null0
# tell the ns random number generator to pick its own seed. without the statement below
# you will use the same random numbers each time, and hence get the same results for each simulation
#Schedule events for the ONOFF agent - start it and let it run forever
$NS at 0.001 "$onoff0 start"
- What is the transient period for the simulation? How did you arrive at this value?
- What is the average delay seen by a TCP packet from when it is enqueued at n0 to when it is received at n1? What is the 90% confidence interval for your results. Note that will the small number of independent replications, you should use the "Confidence Interval for Small Samples Technique" in "Confidence Intervals" reading.
- What is the average throughput of the n0 to n1 link? What is the 90% confidence interval?
Please hand in the following:
- Your ns code, which should be documented with a comment every few lines explaining what is happening in your code. (You should make sure that your comments are on a line all by themself, i.e., not following an ns statement on the same line). Note that we won't run your code to check it's correctness (we can do that by just looking at it, and your results)
- Your code for computing the confidence interval.
- Your anwers to the questions above.