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

Execute problems



Hi ns-users,
i have a problem, i installed ns-2 on sun workstation, runned validate
no problem.
Now i'm finding to use ns2, but fondamental problem is that after i
write code into prova1.tcl file :

set ns [new Simulator]

set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]

$ns duplex-link $n0 $n2 5Mb 2ms DropTail
$ns duplex-link $n1 $n2 5Mb 2ms DropTail
$ns duplex-link $n2 $n3 1.5Mb 10ms DropTail

set udp0 [new Agent/UDP]
$ns attach-agent $n0 $udp0
set cbr0 [new Application/Traffic/CBR]
$cbr0 attach-agent $udp0
$udp0 set class_ 0

set null0 [new Agent/Null]
$ns attach-agent $n3 $null0

$ns connect $udp0 $null0
$ns at 1.0 "$cbr0 start"

puts [$cbr0 set packetSize_]
puts [$cbr0 set interval_]

set tcp [new Agent/TCP]
$tcp set class_ 1
$ns attach-agent $n1 $tcp

set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink

set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 1.2 "$ftp start"

$ns connect $tcp $sink
$ns at 1.35 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
$ns at 3.0 "finish" proc finish {} {
               global ns f nf
               $ns flush-trace
               close $f
               close $nf

               puts "running nam..."
               exec nam out.nam &
               exit 0
}

$ns run

After i execute ns :

rogent:~/ns-allinone-2.1b5/ns-2.1b5> ns ./proyecto/prova1.tcl
can't read "packetSize_": no such variable
    while executing
"subst $[subst $var]"
    (procedure "_o56" line 5)
    (Object next line 5)
    invoked from within
"_o56 next packetSize_"
    ("eval" body line 1)
    invoked from within
"eval $self next $args"
    (procedure "_o56" line 13)
    (Application/Traffic/CBR set line 13)
    invoked from within
"$cbr0 set packetSize_"
    (file "./proyecto/prova1.tcl" line 25)
rogent:~/ns-allinone-2.1b5/ns-2.1b5>

I don't know reasons about this problem.