[ns] Help: error when compiling NS format

2007-06-06 Thread khodor abboud


Hello evry body,

When i am running the NS format of BRITE,

set ns [new Simulator]




//set na [open result.tr w]

set nf [open result.nam w]

$ns trace-all $na

$ns namtrace-all $nf


proc create_topology{} {
global ns

#nodes:
set num_node 10
for {set i 0} {$i  $num_node} {incr i} {
   set n($i) [$ns node]
}

   #links:
set qtype DropTail

$ns duplex-link $n(0) $n(7) 10.0Mb 1.7236454605492773ms $qtype
$ns duplex-link $n(0) $n(4) 10.0Mb 2.5564353126456334ms $qtype
$ns duplex-link $n(1) $n(7) 10.0Mb 1.9596429275415095ms $qtype
$ns duplex-link $n(1) $n(6) 10.0Mb 2.0836465083411677ms $qtype
$ns duplex-link $n(2) $n(1) 10.0Mb 0.8198962034098675ms $qtype
$ns duplex-link $n(2) $n(0) 10.0Mb 3.0748983334134015ms $qtype
$ns duplex-link $n(3) $n(2) 10.0Mb 0.6000909853028569ms $qtype
$ns duplex-link $n(3) $n(1) 10.0Mb 0.888971781786488ms $qtype
$ns duplex-link $n(4) $n(2) 10.0Mb 0.9660698044229389ms $qtype
$ns duplex-link $n(4) $n(1) 10.0Mb 1.5722337603014132ms $qtype
$ns duplex-link $n(5) $n(2) 10.0Mb 0.3916502734935236ms $qtype
$ns duplex-link $n(5) $n(3) 10.0Mb 0.9404910499632333ms $qtype
$ns duplex-link $n(6) $n(4) 10.0Mb 0.560635812568718ms $qtype
$ns duplex-link $n(6) $n(3) 10.0Mb 2.105093379697943ms $qtype
$ns duplex-link $n(7) $n(4) 10.0Mb 0.8762329434458621ms $qtype
$ns duplex-link $n(7) $n(3) 10.0Mb 2.2576992000241027ms $qtype
$ns duplex-link $n(8) $n(3) 10.0Mb 0.7707929361579221ms $qtype
$ns duplex-link $n(8) $n(2) 10.0Mb 0.7620023348075393ms $qtype
$ns duplex-link $n(9) $n(1) 10.0Mb 0.5599606345953886ms $qtype
$ns duplex-link $n(9) $n(8) 10.0Mb 1.5000522372102496ms $qtype

} #end function create_topology

#-  extract_leaf_nodes:  array with smallest degree nodes -
proc extract_leaf_nodes{} {

# minimum degree in this graph is: 2.
set leaf(0)  5
set leaf(1)  9

}  #end function extract_leaf_nodes

#--  extract_nonleaf_nodes:  array with nodes which have degree  2  
---
proc extract_nonleaf_nodes{} {
set non_leaf(0) 0   #deg=3
set non_leaf(1) 1   #deg=6
set non_leaf(2) 2   #deg=6
set non_leaf(3) 3   #deg=6
set non_leaf(4) 4   #deg=5
set non_leaf(5) 6   #deg=3
set non_leaf(6) 7   #deg=4
set non_leaf(7) 8   #deg=3

}  #end function extract_nonleaf_nodes


$ns run//


i have this error :

wrong # args: should be proc name args body
while executing
proc create_topology{} {
global ns n num_node

#nodes:
set num_node 10
for {set i 0} {$i  $num_node} {incr i} {
   set n($i) [$ns node]
}

}
(file u1.tcl line 17)


I don't know exactly with args it talks about. if some body now it please 
help me.

Bst regards,

_
Avec Windows Live OneCare éliminez tous les virus de votre PC ! 
http://www.windowslive.fr/liveonecare/default.asp



Re: [ns] Help: error when compiling NS format

2007-06-06 Thread caijie

proc create_topology{} {

proc create_topology {} {


line1 is what you wrote in your tcl, and maybe you'd like to try
line2. See? there's a space between the topology and {


wish you good luck


CaiJie