[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] Please,help me!!!!!



Hi everybody, 
I am a green hand of ns and i am using ns-2.1b6 on Redhat Linux 6.0. 
I am using TCP/Reno in my simulation and i have a problem. 
Could someone please explain to me how obtain RTO in xgraph. 
Which is it the variable that i owe set to measure the timeout ? 
This is a part my script: 


if {$argc==1} { 
set tick [lindex $argv 0] 
} else { 
puts " Usage : ns $argv0 TCPTick_in_seconds (real) " 
exit 1 
} 
#Create the 'Simulator Object' 
set ns [new Simulator] 
#Open a file for writing the nam trace data 
set trace_nam [open out.nam w] 
set trace_rtt [open out.rtt w] 
set trace_srtt [open out.srtt w] 
set trace_timeout [open out.rto w] 
$ns namtrace-all $trace_nam 
#Record procedure 
proc record { } { 
global ns ttcp0 trace_rtt trace_srtt trace_timeout 
set interval 0.1 
#Get the variables of interest 
set curr_rtt [expr [$ttcp0 set rtt_] * [$ttcp0 set tcpTick_]] 
set curr_timeout [expr [$ttcp0 set timeout_]] 
set curr_srtt [expr ([$ttcp0 set srtt_] >> [$ttcp0 set T_SRTT_BITS])*[$ttcp0 set tcpTick_]] 
#Get the current time 
set now [$ns now] 
#Write the variables of interest vs.time 
puts $trace_rtt "$now $curr_rtt" 
puts $trace_srtt "$now $curr_srtt" 
puts $trace_timeout "$now $curr_timeout" 
#Re-schedule the procedure 
$ns at [expr $now+$interval] "record" 
} 
#Add a 'finish' procedure that closes the trace and starts nam 
proc finish { } { 
global ns trace_nam trace_rtt trace_srtt trace_timeout trace_all 
$ns flush-trace 
close $trace_nam 
close $trace_rtt 
close $trace_srtt 
close $trace_timeout 
exec xgraph out.rtt out.rto out.srtt -geometry 600x400 & 
exec nam out.nam & 
exit 0 
........................... 
...................................... 
....... 
$ns run 
This is the error message 
ns: record: can't read "timeout_" :no such variable 
while executing 
"subst $[subst $var]" 
(procedure "_o480" line 5) 
(Object next line 5) 
invoked from within 
"o480 next timeout_" 
("eval" body line 1) 
invoked from within 
"eval $self next $args" 
(procedure "_o480" line 18) 
(Agent set line 18) 
invoked from within 
"$ttcp0 set timeout_" 
(procedure "record" line 9) 
invoked from within 
"record" 


I would greatly appreciate any help and advice, thanks a lot 
                   PROCACCI GAETANO