[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
No Subject
Hello ns users, I'm trying to run a simulation with
simple topology having 8 nodes where every node is
connected to every other node. I've made n7 as the
destination node where it receicves packets from n0 to
n6. all the links except n4-n7 are having 1Mb capacity
to send the data. the link n4-n7 is having a capacity
of 2Mb to send the data. I'm breaking the link between
and n2-n7 at a point of time expecting that the
traffic from n2 shud flow via n4 'cos it's having more
capacity comparitively with other links. But the
packets are flowing via n2-n6-n7 and some packets are
getting discarded 'cos the link between n6-n7 is
capable of handling only 1Mb of data. shud I add any
other procedures to make the routers to select the
optimal route? thanx in advance.
Raj.
My code is as follows.
set ns [new Simulator -multicast on]
$ns rtproto DV
$ns color 0 Blue
$ns color 1 Red
$ns color 2 Green
$ns color 3 Orange
$ns color 4 Yellow
$ns color 5 Brown
$ns color 6 Purple
set nf [open out.nam w]
$ns namtrace-all $nf
proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam out.nam &
exit 0
}
set numNode 8
for {set i 0} {$i < $numNode} {incr i} {
set n($i) [$ns node]
}
$ns duplex-link $n(4) $n(7) 2Mb 10ms SFQ
for {set i 0} {$i < 7} {incr i} {
for {set j [expr ($i + 1)]} {$j < $numNode} {incr
j} {
$ns duplex-link $n($i) $n($j) 1Mb 10ms SFQ
}
}
$ns duplex-link $n(4) $n(7) 2Mb 10ms SFQ
for {set i 0} {$i < 7} {incr i} {
set udp($i) [new Agent/UDP]
$ns attach-agent $n($i) $udp($i)
$udp($i) set class_ $i
}
for {set i 0} {$i < 7} {incr i} {
set cbr($i) [new Application/Traffic/CBR]
$cbr($i) set packetSize_ 500b
$cbr($i) set interval_ 0.005
$cbr($i) attach-agent $udp($i)
}
set null0 [new Agent/Null]
$ns attach-agent $n(7) $null0
for {set i 0} {$i < 7} {incr i} {
$ns connect $udp($i) $null0
}
$ns at 0.2 "$cbr(0) start"
$ns at 0.4 "$cbr(1) start"
$ns at 0.6 "$cbr(2) start"
$ns at 0.8 "$cbr(3) start"
$ns at 1.0 "$cbr(4) start"
$ns at 1.2 "$cbr(5) start"
$ns at 1.4 "$cbr(6) start"
$ns at 3.2 "$cbr(0) stop"
$ns at 3.4 "$cbr(1) stop"
$ns at 3.6 "$cbr(2) stop"
$ns at 3.8 "$cbr(3) stop"
$ns at 4.0 "$cbr(4) stop"
$ns at 4.2 "$cbr(5) stop"
$ns at 4.4 "$cbr(6) stop"
$ns rtmodel-at 1.5 down $n(2) $n(7)
$ns rtmodel-at 2.5 up $n(2) $n(7)
$ns at 4.5 "finish"
$ns run
__________________________________________________
Do You Yahoo!?
Make international calls for as low as $.04/minute with Yahoo! Messenger
http://phonecard.yahoo.com/