Hi Guys, Good Morning

I am trying to visualize cwnd plot in gnuplot in obuntu 10.04. I want to see 
the sawtooth display in time(x-axis) and packet (y-axis) but instead I am 
getting a different waveform. Can some body modify it according to sawtooth 
waveform. I shall be grateful. Below is my code:
set ns [new Simulator]

$ns color 1 Green

set tracefile1 [open out.tr w]
set  winfile [open WinFile w]
$ns trace-all $tracefile1 

set gio [open out.nam w]
$ns namtrace-all $gio
 
 
 proc finish {} {
 global ns  tracefile1 gio
 $ns flush-trace
 close $tracefile1
 close $gio
 exec nam out.nam &
 exit 0
 
 }
 
 set n0 [$ns node]
 set n1 [$ns node]
 $ns duplex-link $n0 $n1 0.2Mb 500ms DropTail
 $ns duplex-link-op $n0 $n1 orient right

 set tcp [new Agent/TCP/Reno]
 $ns attach-agent $n0 $tcp
 $tcp set fid_ 1

 set tcpsink [new Agent/TCPSink]
 $ns attach-agent $n1 $tcpsink
 $ns connect $tcp $tcpsink
 
 set ftp [new Application/FTP]
 $ftp attach-agent $tcp

  proc plotWindow {tcpsource file } {
 
 global ns
 set now [$ns now]
 set time 0.01
 set cwnd [$tcpsource set cwnd_]
 puts $file "$now $cwnd"
 $ns at [expr $now+$time] "plotWindow $tcpsource $file"
 
 }
 
 $ns at 0.01 "plotWindow $tcp $winfile"
 
 $ns at 0.0 "$ftp start"
 $ns at 5.0 "$ftp stop"
 $ns at 5.5 "finish"
 $ns run

Reply via email to