topology attached along this mail....
#create a simulator object
set ns [new Simulator]
#Define differentcolors
$ns color 1 Blue
$ns color 2 Red
#open the NAM trace file
set nf [open out.nam w]
$ns namtrace-all $nf
#Define a finish procedure
proc finish {} {
global ns nf
$ns flush-trace
#close the NAM trace file
close $nf
#execute NAM on the trace file
exec nam out nam &
exit 0
}
#create nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
set n6 [$ns node]
set n7 [$ns node]
set n8 [$ns node]
set n9 [$ns node]
set n10 [$ns node]
set n11 [$ns node]
#create link between nodes
$ns duplex-link $n0 $n1 2Mb 10ms Droptail
$ns duplex-link $n1 $n2 2Mb 10ms Droptail
$ns duplex-link $n2 $n3 2Mb 10ms Droptail
$ns duplex-link $n3 $n4 2Mb 10ms Droptail
$ns duplex-link $n1 $n5 2Mb 10ms Droptail
$ns duplex-link $n5 $n6 2Mb 10ms Droptail
$ns duplex-link $n2 $n6 2Mb 10ms Droptail
$ns duplex-link $n6 $n7 2Mb 10ms Droptail
$ns duplex-link $n3 $n7 2Mb 10ms Droptail
$ns duplex-link $n7 $n4 2Mb 10ms Droptail
#Ficitious link so delay taken as 1s
$ns duplex-link $n0 $n0 2Mb 1s Droptail
$ns duplex-link $n1 $n1 2Mb 1s Droptail
$ns duplex-link $n2 $n2 2Mb 1s Droptail
$ns duplex-link $n3 $n3 2Mb 1s Droptail
$ns duplex-link $n4 $n4 2Mb 1s Droptail
#since initially only one link per path is congested
#$ns duplex-link $n5 $n5 2Mb 10ms Droptail
#$ns duplex-link $n6 $n6 2Mb 10ms Droptail
#$ns duplex-link $n7 $n7 2Mb 10ms Droptail
#$ns duplex-link $n8 $n8 2Mb 10ms Droptail
#$ns duplex-link $n9 $n9 2Mb 10ms Droptail
#Node n10 and n11 are considered as initial points TCP agent n UDP agent
$ns duplex-link $n10 $n0 2Mb 10ms Droptail
$ns duplex-link $n11 $n0 2Mb 10ms Droptail
#set queue size of link n10-n0 n n11-n0 to 10
$ns queue-limit $n10 $n0 10
$ns queue-limit $n11 $n0 10
#Give node position
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right
$ns duplex-link-op $n2 $n3 orient right
$ns duplex-link-op $n3 $n4 orient right
$ns duplex-link-op $n1 $n5 orient right-down
$ns duplex-link-op $n2 $n6 orient right-down
$ns duplex-link-op $n3 $n7 orient right-down
$ns duplex-link-op $n5 $n6 orient right
$ns duplex-link-op $n6 $n7 orient right
$ns duplex-link-op $n7 $n4 orient right-up
$ns duplex-link-op $n0 $n8 orient right-up
$ns duplex-link-op $n8 $n9 orient right
$ns duplex-link-op $n9 $n4 orient right-down
$ns duplex-link-op $n11 $n0 orient right-up
$ns duplex-link-op $n10 $n0 orient right-down
#Monitor the queue for link n0-n1,n1-n2,n2-n3,n3-n4 for NAM
$ns duplex-link-op $n0 $n1 queuePos 0.5
$ns duplex-link-op $n1 $n2 queuePos 0.5
$ns duplex-link-op $n2 $n3 queuePos 0.5
$ns duplex-link-op $n3 $n4 queuePos 0.5
#set up a TCP connection
set tcp [new Agent/TCP]
$tcp set class _2
$ns attach-agent $n10 $tcp
set sink [new Agent/TCPSink
$ns attach-agent $n4 $sink
$tcp set fid_1
#set up a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#set a UDP connection
set udp[new Agent/UDP]
$ns attach-agent $n11 $udp
set null [new Agent/Null]
$ns attach-agent $n4 $null
$ns connect $udp $null
$udp set fid_2
#set up a CBR over UDP connection
set cbr[new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1mb
$cbr set random_ false
#schedule events for the CBR & FTP agents
$ns at 0.1 "$cbr start"
$ns at 1.0 "ftp start"
$ns at 4.0 "ftp stop"
$ns at 4.5 "cbr stop"
#Detach tcp & sink agent (not really necessary)
$ns at 4.5 "$ns detach-agent $n0 $tcp;
# call the finish procedure after 5seconds of simulation time
$ns at 5.0 "finish"
#Print CBR packet Size & interval
puts "CBR packet size=[$cbr set packet_ size]"
puts "CBR interval=[$cbr setinterval_]"
#Print FTP packet size & interval
puts "FTP packet size=[$ftp set packet_ size]"
puts "FTP interval=[$ftp setinterval_]"
#Run the simulation
$ns run
If I run this program im getting the following error
invalid command name "Queue/Droptail"
while executing
"Queue/Droptail create _o46 "
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new Queue/$qtype"
("default" arm line 3)
invoked from within
"switch -exact $qtype {
ErrorModule {
if { [llength $args] > 0 } {
set q [eval new $qtype $args]
} else {
set q [new $qtype Fid]
}
}
intserv {
set qtyp..."
(procedure "_o3" line 14)
(Simulator simplex-link line 14)
invoked from within
"_o3 simplex-link _o10 _o13 2Mb 10ms Droptail"
("eval" body line 1)
invoked from within
"eval $self simplex-link $n1 $n2 $bw $delay $type $args"
(procedure "_o3" line 8)
(Simulator duplex-link line 8)
invoked from within
"$ns duplex-link $n0 $n1 2Mb 10ms Droptail"
(file "script.tcl" line 42)
--
Do Whatever Your Heart Desires Xclusively For Yourself.
Priyadharshini Manoharan
-----Inline Attachment Follows-----
--
Do Whatever Your Heart Desires Xclusively For Yourself.
Priyadharshini Manoharan