[ns] TCP/Taho have strange result in NS2
qadous@ccse.kfupm.edu.sa
qadous at ccse.kfupm.edu.sa
Wed Apr 5 02:20:30 PDT 2006
Dear ns-users,
I implement the Tahoe in ns2; I got strange values for its throughput.
The throughput in the Error rate =0 is less than the throughput in the Error
rate =0.01.
This is strange and opposite to expectations.
the code is below:
#Create a simulator object
set ns_ [new Simulator]
#Open the NAM trace file
set nf [open out.nam w]
$ns_ namtrace-all $nf
# open the Trace file
set tf [open out.tr w]
$ns_ trace-all $tf
#Define a 'finish' procedure
proc finish {} {
global ns_ nf tf
$ns_ flush-trace
#Close the NAM trace file
close $nf
# close the trace file
close $tf
exit 0
}
#Create Two nodes
set s1 [$ns_ node]
set d1 [$ns_ node]
#Create link between the nodes
$ns_ duplex-link $s1 $d1 1.5Mb 10ms DropTail
#######################Error Model on the link
set loss_module [new ErrorModel]
$loss_module set rate_ 0.0
$loss_module ranvar [new RandomVariable/Uniform]
#$loss_module drop_target [new Agent/Null]
$ns_ lossmodel $loss_module $s1 $d1
#Set Queue Size of link (s2-r1) to 64 pckt
$ns_ queue-limit $s1 $d1 64
#Setup a TCP connection
set tcp1 [new Agent/TCP/Reno]
$ns_ attach-agent $s1 $tcp1
set sink1 [new Agent/TCPSink]
$ns_ attach-agent $d1 $sink1
$ns_ connect $tcp1 $sink1
#Setup a TCP connection(Tahoe)
set tcp2 [new Agent/TCP]
$ns_ attach-agent $s1 $tcp2
set sink2 [new Agent/TCPSink]
$ns_ attach-agent $d1 $sink2
$ns_ connect $tcp2 $sink2
#Setup a TCP connection
set tcp3 [new Agent/TCP/Newreno]
$ns_ attach-agent $s1 $tcp3
set sink3 [new Agent/TCPSink]
$ns_ attach-agent $d1 $sink3
$ns_ connect $tcp3 $sink3
#Setup a TCP connection
set tcp4 [new Agent/TCP/Sack1]
$ns_ attach-agent $s1 $tcp4
set sink4 [new Agent/TCPSink/Sack1]
$ns_ attach-agent $d1 $sink4
$ns_ connect $tcp4 $sink4
#Setup a FTP over TCP connection
set ftp1 [new Application/FTP]
$ftp1 attach-agent $tcp1
$ftp1 set type_ FTP
#Setup a FTP over TCP connection
set ftp2 [new Application/FTP]
$ftp2 attach-agent $tcp2
$ftp2 set type_ FTP
#Setup a FTP over TCP connection
set ftp3 [new Application/FTP]
$ftp3 attach-agent $tcp3
$ftp3 set type_ FTP
#Setup a FTP over TCP connection
set ftp4 [new Application/FTP]
$ftp4 attach-agent $tcp4
$ftp4 set type_ FTP
$tcp1 set packetSize_ 536 byte
$tcp2 set packetSize_ 536 byte
$tcp3 set packetSize_ 536 byte
$tcp4 set packetSize_ 536 byte
$tcp1 set window_ 128
$tcp2 set window_ 128
$tcp3 set window_ 128
$tcp4 set window_ 128
$tcp1 set tcpTick_ 0.5
$tcp2 set tcpTick_ 0.5
$tcp3 set tcpTick_ 0.5
$tcp4 set tcpTick_ 0.5
$ns_ at 0.0 "$ftp1 start";
$ns_ at 0.0 "$ftp2 start";
$ns_ at 0.0 "$ftp3 start";
$ns_ at 0.0 "$ftp4 start";
$ns_ at 49.9998 "$ftp1 stop";
$ns_ at 49.9998 "$ftp2 stop";
$ns_ at 49.9998 "$ftp3 stop";
$ns_ at 49.9998 "$ftp4 stop";
#$ns_ at 49.8013 "$s1 reset";
#$ns_ at 49.8013 "$d1 reset";
##########################################################
proc record {} {
global sink1 sink2 sink3 sink4 sink5 tcp1 tcp2 tcp3 tcp4
# get an instance of the simulater
set ns_ [Simulator instance]
#get the current time
set now [$ns_ now]
set bw1 [$sink1 set bytes_]
set bw2 [$sink2 set bytes_]
set bw3 [$sink3 set bytes_]
set bw4 [$sink4 set bytes_]
puts "compare when the flavors share the bottelneck"
puts "the goodput of Reno = [expr $bw1/$now * 8/1000]"
puts "the goodput of Taho = [expr $bw2/$now * 8/1000]"
puts "the goodput of Newreno = [expr $bw3/$now * 8/1000]"
puts "the goodput of Sack = [expr $bw4/$now * 8/1000]"
}
$ns_ at 49.999999 "record"
#Call the finish procedure after 11 seconds of simulation time
$ns_ at 50.0 "finish"
#Run the simulation
$ns_ run
I look forward to receive from you as soon as possible.
----------------------------------------------------------------
This message was sent using IMP, the Internet Messaging Program.
More information about the Ns-users
mailing list