[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
[ns] ErrorModel in multicast
I got a problem with measuring packet lost in
multicasting protocol. Server is n1 and I'm measuring
traffic from n1 to client n3.
# n2
# /
# n0 ---- n1-----n3
#
whenever I inseted ErrorModel between n1 and n3 , all
statistics such as received packets, lost packets and
received bytes dropped to all zero ,even if I set drop
rate to almost zero(0.0001), I'm using state variable
in LossMonitor. My script is
set ns [new Simulator -multicast on]
set f [open out.tr w]
$ns trace-all $f
$ns namtrace-all [open out.nam w]
$ns color 1 red
# prune/graft packets
$ns color 30 purple
$ns color 31 bisque
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
# Use automatic layout
$ns duplex-link $n0 $n1 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n2 1.5Mb 10ms DropTail
$ns duplex-link $n1 $n3 1.5Mb 10ms DropTail
$ns duplex-link-op $n0 $n1 orient right
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n1 $n3 orient right-down
$ns duplex-link-op $n0 $n1 queuePos 0.5
set mproto DM
set mrthandle [$ns mrtproto $mproto {}]
set group0 [Node allocaddr]
set group1 [Node allocaddr]
set udp1 [new Agent/UDP]
$udp1 set dst_addr_ $group1
$udp1 set dst_port_ 0
$udp1 set class_ 1
$ns attach-agent $n1 $udp1
set cbr1 [new Application/Traffic/CBR]
$cbr1 attach-agent $udp1
set rcvr [new Agent/LossMonitor]
$ns attach-agent $n3 $rcvr
$ns at 1.3 "$n3 join-group $rcvr $group1"
#$ns at 1.3 "$n3 join-group $rcvr $group0"
set loss_module [new ErrorModel]
$loss_module set rate 0.001
$loss_module unit pkt
$loss_module ranvar [new RandomVariable/Uniform]
#set target for dropped packets
$loss_module drop-target [new Agent/Null]
[$ns set link_([$n1 id]:[$n3 id])] install-error
loss_module
$ns lossmodel $loss_module $n1 $n3
#$ns at 1.0 "$cbr0 start"
#$ns at 1.001 "$cbr0 stop"
$ns at 1.1 "$cbr1 start"
#$ns at 1.001 "$cbr1 stop"
$ns at 10.0 "finish"
proc finish {} {
global ns rcvr
$ns flush-trace
set time [$ns now]
set bw [$rcvr set bytes_]
puts "received bytes $bw"
puts "received packets [$rcvr set npkts_]"
puts "last packet received [$rcvr set
lastPktTime_]"
puts "lost packets [$rcvr set nlost_]"
puts "[expr $bw/$time*8/1000]Kbits/s "
puts "running nam..."
exec nam out.nam &
exit 0
}
$ns run
Could you anyone help me ? what's wrong with script?
M Liu
__________________________________________________
Do You Yahoo!?
Yahoo! Photos -- now, 100 FREE prints!
http://photos.yahoo.com