[ns] problem with tcl files

Mohammed Fawaz Kamarudin mohammed.fawaz at gmail.com
Thu Mar 9 00:25:26 PST 2006


hi,
when i try running my aodv.tcl files, some problem occur;

[mohammedfawaz at local host tclfiles] $ ns AODV1.tcl
num_nodes is set 50
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Loading connection pattern...
couldn't read file "cbr1": no such file or directory
   while executing
"source.orig cbr1"
   ("uplevel" body line 1)
   invoke from within
"uplevel source.orig [list $fileName]"
   invoke from withn
"if [$instance_is http_url $fileName] {
set buffer [$instance_read url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig [list $fileName]
...
   (procedure "source" line 8)
   invoke from within
"source $opt(cp)"
   (file "AODV1.tcl" line 70)
[mohammedfawaz at local host tclfiles] $


the tcl files;


#====================================================================
# Define options
# ======================================================================
set opt(chan)    Channel/WirelessChannel
set opt(prop)    Propagation/TwoRayGround
set opt(netif)    Phy/WirelessPhy
set opt(mac)    Mac/802_11
set opt(ifq)    Queue/DropTail/PriQueue
set opt(ll)        LL
set opt(ant)        Antenna/OmniAntenna
set opt(x)        1000   ;# X dimension of the topography
set opt(y)        1000  ;# Y dimension of the topography
set opt(ifqlen)    50          ;# max packet in ifq
set opt(seed)    1.0
set opt(tr)        traodv1.tr    ;# trace file
set opt(adhocRouting)   AODV
set opt(nn)             50           ;# how many nodes are simulated
set opt(cp)        "cbr1"
set opt(sc)        "scen1"
set opt(stop)        250.0        ;# simulation time

#======================================================================
# Main Program
# ======================================================================
# Initialize Global Variables
# create simulator instance
set ns_        [new Simulator]

# set wireless channel, radio-model and topography objects
set wtopo    [new Topography]

# create trace object for ns and nam
set tracefd    [open $opt(tr) w]
$ns_ trace-all $tracefd
# use new trace file format
#$ns_ use-newtrace

# define topology
$wtopo load_flatgrid $opt(x) $opt(y)

# Create God
set god_ [create-god $opt(nn)]

# define how node should be created
#global node setting
$ns_ node-config -adhocRouting $opt(adhocRouting) \
         -llType $opt(ll) \
         -macType $opt(mac) \
         -ifqType $opt(ifq) \
         -ifqLen $opt(ifqlen) \
         -antType $opt(ant) \
         -propType $opt(prop) \
         -phyType $opt(netif) \
         -channelType $opt(chan) \
         -topoInstance $wtopo \
         -agentTrace ON \
                 -routerTrace OFF \
                 -macTrace OFF

#  Create the specified number of nodes [$opt(nn)] and "attach" them
#  to the channel.
for {set i 0} {$i < $opt(nn) } {incr i} {
    set node_($i) [$ns_ node]
    $node_($i) random-motion 0        ;# disable random motion
}

# Define node movement model
puts "Loading connection pattern..."
source $opt(cp)

# Define traffic model
puts "Loading scenario file..."
source $opt(sc)

# Define node initial position in nam
for {set i 0} {$i < $opt(nn)} {incr i} {

    # 20 defines the node size in nam, must adjust it according to your
scenario
    # The function must be called after mobility model is defined
   $ns_ initial_node_pos $node_($i) 20
}

# Tell nodes when the simulation ends
for {set i 0} {$i < $opt(nn) } {incr i} {
    $ns_ at $opt(stop).000000001 "$node_($i) reset";
}

# tell nam the simulation stop time
#$ns_ at  $opt(stop)    "$ns_ nam-end-wireless $opt(stop)"
$ns_ at  $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt"
puts "Starting Simulation..."
$ns_ run


please help me..thank you in advance..

--
Mohammed Fawaz Kamarudin


More information about the Ns-users mailing list