CSE 330 - Advanced Computer Networks
Fall 2006

Homework 2
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 n0
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

ns-random 0

#Schedule events for the ONOFF agent - start it and let it run forever
$NS at 0.001 "$onoff0 start"
 
 

Create an ns simulation program that implements the scenario described above.  Run your simulation 10 times.  Answer the following questions:
Please hand in the following: