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

[ns] Re:



I think it was a syntax error 
try

set jitter [[expr $delay+1]-$delay

Kun-chan Lan


>Hi
> I am trying to measure jitter between the two node but it gives me
>following error
>ns: dump _o15 1: can't read "jitter": no such variable
>    while executing
>"set $jitter [[expr $delay+1]-$delay]"
>    (procedure "dump" line 11)
>    invoked from within
>"dump _o15 1"
>
>My script is
>
>#set ns [new Simulator]
>set n0 [$ns node]
>set n1 [$ns node]
>$ns duplex-link $n0 $n1 5Mb 2ms DropTail
>## Set up BSD Tahoe TCP connection in opposite directions.
>set src1 [$ns create-connection TCP $n0 TCPSink $n1 1]
>set src2 [$ns create-connection TCP $n1 TCPSink $n0 2]
># Create ftp sources at the each node
>set ftp1 [$src1 attach-app FTP]
>set ftp2 [$src2 attach-app FTP]
># Start up the first ftp at the time 0 and
># the second ftp staggered 1 second later
>#$ns at 0.0 "$ftp1 start"
>$ns at 1.0 "$ftp2 start"
>## Create a trace and arrange for all link
># events to be dumped to "out.tr"
>#set tf [open out.tr w]
>$ns trace-queue $n0 $n1 $tf
>set qmon [$ns monitor-queue $n0 $n1 ""]
>set integ [$qmon get-bytes-integrator]
>## Dump the queueing delay on the n0->n1 link
># to stdout every second of simulation time.
>#proc dump { link interval } {
> global ns integ
> #global ns temp
> $ns at [expr [$ns now] + $interval] "dump $link $interval"
> set delay [expr 8*[$integ set sum_] / [[$link link] set
>bandwidth_]]
> #set $temp delay
> set $jitter [[expr $delay+1]-$delay]
>puts "[$ns now] jitter=$jitter"
>}
>$ns at 0.0 "dump [$ns link $n0 $n1] 1"
>## run the simulation for 20 simulated seconds
>#$ns at 15.0 "$ns halt; exit 0"
>$ns run
>
>Would you please what is  wrong here?
>
>Thank!
>
>KAt
>