Hi all,
I'm a novice user of ns and I'm trying to monitor the throughput of TCP for two
access links, one of 10Mbps and the other of 20Mbps. The simulation is part of
my diploma project so it's kind of important...The problem is that whenever I
sent data through both of the links the bytes_ variable is constant 0 for
both of the links. Here is my simulation script::
set ns [new Simulator]
set tr_f [open out.tr w]
set nam_f [open out.nam w]
set record_f [open out.data w]
$ns trace-all $tr_f
$ns namtrace-all $nam_f
### Finish proc
proc finish {} {
global ns tr_f record_f nam_f
$ns
flush-trace
close $tr_f
close $record_f
close $nam_f
exec awk { { print $1, $2 } } out.data > temp1b0.bytes
exec awk { { print $1, $3 } } out.data > temp1b1.bytes
exec xgraph temp1b0.bytes -m -x timp -y Mbps -geometry 600x600 &
exec xgraph temp1b1.bytes -m -x timp -y Mbps -geometry 600x600 &
exit 0
}
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
set n4 [$ns node]
set n5 [$ns node]
# object from to bandwith delay queue
$ns duplex-link $n0 $n1 10Mb 5ms DropTail
$ns duplex-link
$n2 $n3 10Mb 5ms DropTail
$ns duplex-link $n1 $n2 15Mb 40ms DropTail
$ns duplex-link $n4 $n1 20Mb 5ms DropTail
$ns duplex-link $n2 $n5 20Mb 5ms DropTail
#$ns queue-limit $n1 $n2 700
#$ns duplex-link-op $n1 $n2 queuePos 0.5
#### TCP AGENT
set tcp [new Agent/TCP]
$tcp set fid_ 1
$tcp set tau_ 1.0
$tcp set filter_type_ 3
$tcp set window_ 60000
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set packetsize_ 14000
#### TCP AGENT 1
set tcp1 [new Agent/TCP]
$tcp1 set fid_ 1
$tcp1 set tau_ 1.0
$tcp1 set
filter_type_ 3
$tcp1 set window_ 60000
$ns attach-agent $n4 $tcp1
set sink1 [new Agent/TCPSink]
$ns attach-agent $n5 $sink1
$ns connect $tcp1 $sink1
$ftp attach-agent $tcp1
### Record proc
proc record {} {
global ns tcp sink tcp1 sink1 record_f
set now [$ns now]
set time 0.20
set b0 [$sink set bytes_]
set b1 [$sink1 set bytes_]
puts $record_f "$now [expr $b0/$time*8/1000000] [expr $b1/$time*8/1000000]"
$sink set bytes_ 0
$sink1 set bytes_ 0
$ns at [expr $now+$time] "record "
}
$ns at 0.0 "record"
$ns at 0.0 "$ftp start"
$ns at 100.0 "finish"
$ns run
If I use only a TCP connection the bytes file it's ok (I obtain realistic
values in temp.bytes
file). When both TCP connection work, temp1b0.bytes and temp1b1.bytes contain
only 0 values... Can you please have a look and let me know what it is I'm
doing wrong? I'm mentioning I've looked for answeres in na nam website but I
couldn't get a solution to my problem.
Thank you in advance for all your help!!!
Get your own web address.
Have a HUGE year through Yahoo! Small Business.
____________________________________________________________________________________Be
a better Heartthrob. Get better relationship answers from someone who knows.
Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545433