Documente Academic
Documente Profesional
Documente Cultură
#In the following network, the host named Annie is transmitting data
over an unreliable, connectionless communication to the host named
Peter at a rate of 0.1Mbps in 1000 bytes long packets. The shortest
path algorithm is followed for routing. It has been found that the
queue of the link host3-host4 goes down to zero at 2.5 sec and comes
up to 50 again at 3.0 sec.
#At the same time the host named Robin is transmitting data to the
host named Juliet over an unreliable, connectionless communication at
a rate of 0.01Mbps in 500 bytes long packets. The shortest path
algorithm is followed for routing. It has been found that the queue
of the link host4-host3 goes down to zero at 4.5 sec and comes up to
50 again at 5.0 sec.
#At 1.0 sec start increasing the traffic rate by 0.01Mbps and packet
size by 10 bytes at every second till 10.0. The above-said
transmissions exist totally for 10.0 secs.
#Set the queue size of all links to 100 packets. Orient the nodes as
shown in the figure. Set labels for transmitting nodes as Annie and
Robin and receiving nodes as Peter and Juliet as shown in the figure.
Set label for each link indicating its bandwidth, and delay as shown
in the figure. Set the shape of the transmitting and receiving nodes
to hexagon and box, and color, to red and blue, respectively. Set the
color of the traffic flow from Annie to Peter to red and that from
Robin to Juliet to blue. Set nam and .tr tracings. Analyze the .tr
trace file to get details on dropped packets during this transmission
scenario.
#create new simulator object
set ns [new Simulator]
#set nam and .tr tracings
set nf [open Q66.nam w]
$ns namtrace-all $nf
set tf [open Q66.tr w]
$ns trace-all $tf
#finish procedure
proc finish {} {
global ns nf tf
$ns flush-trace
close $nf
close $tf
exec nam Q66.nam &
exit 0
}
proc chrp {} {
global ns cbr5
set step 1.0
set now [$ns now]
set rate [$cbr5 set rate_]
set pktsize [$cbr5 set packetSize_]
set ratestep 10000
set pktsizestep 10
$cbr5 set rate_ [expr $rate+$ratestep]
$cbr5 set packetSize_ [expr $pktsize+$pktsizestep]
set qlimit [Queue set limit_]
#
Queue set limit_ [expr $qlimit+1]
#
$ns at $now "$ns trace-annotate \"Now traffic rate from Robin
to Juliet is [$cbr5 set rate_]\""
#
$ns at $now "$ns trace-annotate \"Now size of traffic packet
at
at
at
at
0.0
0.0
0.0
0.0
"$n(1)
"$n(3)
"$n(4)
"$n(6)
#add links
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
$ns duplex-link
label
label
label
label
$n(0)
$n(1)
$n(2)
$n(3)
$n(4)
$n(4)
$n(4)
\"host1\""
\"host3\""
\"host4\""
\"host6\""
$n(3)
$n(3)
$n(3)
$n(4)
$n(5)
$n(6)
$n(7)
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
1Mb
100ms
100ms
100ms
100ms
100ms
100ms
100ms
$n(3)
$n(3)
$n(3)
$n(4)
$n(5)
$n(6)
$n(7)
orient
orient
orient
orient
orient
orient
orient
$ns
$ns
$ns
$ns
$ns
$ns
$ns
$n(3)
$n(3)
$n(3)
$n(4)
$n(5)
$n(6)
$n(7)
label
label
label
label
label
label
label
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
duplex-link-op
$n(0)
$n(1)
$n(2)
$n(3)
$n(4)
$n(4)
$n(4)
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
DropTail
right-down
right
right-up
right
right-up
right
right-down
"\
"\
"\
"\
"\
"\
"\
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
1Mb,100ms"
set
$ns
set
$ns
dynamics
queue-limit
queue-limit
queue-limit
queue-limit
$n(3)
$n(3)
$n(4)
$n(4)
$n(4)
$n(4)
$n(3)
$n(3)
0"
100"
0"
100"