You could run a script like:
  for parameter1 in 0 1 2 3 4
do
    for  parameter2 in 10.0 15.0
     do
            ns myfile.tcl  -parameter1 $parameter1 -parameter2 $parameter2
    done
done
 Don't forget to add the parameters that you want to be  modified in your .tcl 
file:
 proc getopt {argc argv} {
    gloval val
    lappend optlist parameter1 parameter2
    for {set i 0} {$i < $argc} {incr i}  {
        set arg [lindex $argv  $i]
        if {[string range $arg 0  0] != "-"} continue
        set name  [string range $arg 1 end]
        set  val($name) [lindex $argv [expr $i+1]]     
    }
}
  



molo badji <[EMAIL PROTECTED]> escribió: 
Hello,
   
  Could someone help me in explaining how to create a script which execute many 
simulation of a protocol of ad hoc networj with differents mobility and traffic 
model files. For exemple I have this script and I want to write a TCL script 
which permits to execute this script many times in changing only parameters 
like X, Y, FTrace.tr, Nbnode, FTraf, FMob, FNam.nam, Time, FTest.txt.
   
  Thanks in advance.
   
  Molo.
   
  # =====================================================================
# 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)      CMUPriQueue ;# Queue/DropTail/PriQueue
set opt(ll)       LL
set opt(ant)    Antenna/OmniAntenna
set opt(x)        X   ;# X dimension of the topography
set opt(y)        Y   ;# Y dimension of the topography
set opt(ifqlen)   10          ;# max packet in ifq
set opt(seed)     0.4          
set opt(tr)       FTrace.tr    ;# trace file
set opt(adhocRouting)   DSR
set opt(nn)             Nbnode           ;# how many nodes are simulated
set opt(cp)       "../Scenarios de trafic/CBR/Ftraf" 
set opt(sc)       "../Scenarios de mobilite/FMob" 
set opt(stop)           Time       ;# 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

set namtrace [open FNam.nam w]
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)

# 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)]
# create channel #1 and #2
set chan_1_ [new $opt(chan)]
set chan_2_ [new $opt(chan)]

# 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) \
             -topoInstance $wtopo \
             -agentTrace ON \
                 -routerTrace ON \
                 -macTrace ON \
             -movementTrace OFF \
             -channel $chan_1_

#  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) "stop"
$ns_ at  $opt(stop).000000001 "puts \"NS EXITING...\" ; $ns_ halt"

proc stop {} {
    global ns_ tracefd namtrace
    $ns_ flush-trace
    close $tracefd
    close $namtrace
    
    exec rm -f FText.txt
    exec touch FText.txt
          
    exec awk { 
    {
      if (($1 == "s") || ($1 == "f") || ($1 == "d") || ($1 == "r"))
         {
         if ($41 == "") { print $1,$2, $3, $19, "/", "/", "0" }
         else { print $1, $2, $3, $19, $35, $40, $41 }
       }
     } 
    } FTrace.tr > FText.txt
   
    puts "running nam..."
    exec nam FNam.nam &
    
    exit 0
}

puts "Starting Simulation..."
$ns_ run
 

   
---------------------------------
Découvrez une nouvelle façon d'obtenir des réponses à toutes vos questions ! 
Demandez à ceux qui savent sur Yahoo! Questions/Réponses.


                
---------------------------------

LLama Gratis a cualquier PC del Mundo.
Llamadas a fijos y móviles desde 1 céntimo por minuto.
http://es.voice.yahoo.com

Reply via email to