hello,

finally, my mobile ipv6 patch worked. i was able to run the simple-mipv6.tcl 
script that came with the patch. however, my own tcl script doesnt run at all. 
it comes up with 0 byte output tracefile and 0 byte nam output file.what could 
be wrong? below is my tcl script and attached is the scenario i m trying to 
achieve.

# Basic Mobile IPv6 example without using ns-topoman
# Needs proc defined in file proc-mipv6-config.tcl

Agent/MIPv6/MN set bs_forwarding_     0       
################################################################
proc log-mn-movement_no_topo { } {
  global logtimer ns
  Class LogTimer -superclass Timer
  LogTimer instproc timeout {} {
     global mobile_
        $mobile_ log-movement 
        $self sched 1 
  }
  set logtimer [new LogTimer]
  $logtimer sched 1  
}

################################################################
# Create Topology
################################################################
set opt(chan)   Channel/WirelessChannel        ;# channel type
set opt(prop)   Propagation/TwoRayGround       ;# radio-propagation model
set opt(netif)  Phy/WirelessPhy                ;# network interface type
set opt(mac)    Mac/802_11                     ;# MAC type
set opt(ifq)    Queue/DropTail/PriQueue         ;# interface queue type
set opt(ll)     LL                             ;# link layer type
set opt(ant)    Antenna/OmniAntenna            ;# antenna model
set opt(ifqlen)         50                     ;# max packet in ifq
set opt(nn)             1                      ;# number of mobilenodes
set opt(adhocRouting)   DSDV                   ;# routing protocol

set opt(cp)     ""                             ;# cp file not used
set opt(sc)     ""                             ;# node movement file. 

set opt(x)      1500                            ;# x coordinate of topology
set opt(y)      1500                            ;# y coordinate of topology
set opt(seed)   0.0                            ;# random seed
set opt(stop)   130                          ;# time to stop simulation

set opt(ftp1-start)      10.0

set num_wired_nodes      4
#set num_bs_nodes       4  ; this is not really used here.

proc create-my-topo {} {
  global ns opt topo mobile_ cn_ mnn_nodes_

  # Create and define topography
  set topo        [new Topography]
  #   set prop        [new $opt(prop)]
  #   $prop topography $topo
$topo load_flatgrid $opt(x) $opt(y) 
  

  # god is a necessary object when wireless is used
  # set to a value equal to the number of mobile nodes
  create-god 5 

  # Call node-config
  $ns node-config \
     -mipv6 ON \
    -mipagent BS \
    -mobileIP ON \
    -wiredRouting ON \
    -adhocRouting DSDV \
    -llType LL \
    -macType Mac/802_11 \
    -ifqType Queue/DropTail/PriQueue \
    -ifqLen 50 \
    -antType Antenna/OmniAntenna \
    -propType Propagation/TwoRayGround \
    -phyType Phy/WirelessPhy \
    -channelType Channel/WirelessChannel \
    -topoInstance $topo \
    -agentTrace ON \
    -routerTrace ON



  # Set NS Addressing
  $ns node-config -addressType hierarchical 
  AddrParams set domain_num_ 5 
  AddrParams set cluster_num_ {4 1 1 1 1}
  AddrParams set nodes_num_ {1 1 1 1 2 1 1 1 }

  # Create Nodes
  set cn_ [create-router 0.0.0]
  set router1_ [create-router 1.0.0]
  set router2_ [create-router 2.0.0]
  set router3_ [create-router 3.0.0]
  set bs1_ [create-base-station 1.1.0 1.0.0 200 200 0]
  set bs2_ [create-base-station 1.2.0 1.0.0 200 600 0]
  set bs3_ [create-base-station 1.3.0 1.0.0 600 200 0]
  set bs4_ [create-base-station 1.4.0 1.0.0 600 600 0]
  set mobile_ [create-mobile 1.1.1 1.1.0 190 190 0 1 0.01]
  $bs1_ random-motion 0
  $bs2_ random-motion 0
  $bs3_ random-motion 0
  $bs4_ random-motion 0

  # Position (fixed) for base-station nodes (HA & FA).
  $bs1_ set X_ 250.000000000000
  $bs1_ set Y_ 1050.000000000000
  $bs1_ set Z_ 0.000000000000

  $bs2_ set X_ 950.000000000000
  $bs2_ set Y_ 1050.000000000000
  $bs2_ set Z_ 0.000000000000

  $bs3_ set X_ 950.000000000000
  $bs3_ set Y_ 300.000000000000
  $bs3_ set Z_ 0.000000000000

  $bs4_ set X_ 250.000000000000
  $bs4_ set Y_ 300.000000000000
  $bs4_ set Z_ 0.000000000000




  # Create Links
  $ns duplex-link $cn_ $router1_ 100Mb 2ms DropTail
  $ns duplex-link $router1_ $router2_ 100Mb 2ms DropTail
  $ns duplex-link $router1_ $router3_ 100Mb 2ms DropTail
  $ns duplex-link $router2_ $bs1_ 100Mb 2ms DropTail
  $ns duplex-link $router2_ $bs2_ 100Mb 2ms DropTail
  $ns duplex-link $router3_ $bs3_ 100Mb 2ms DropTail
  $ns duplex-link $router3_ $bs4_ 100Mb 2ms DropTail

  $ns duplex-link-op $cn_ $router1_ orient down
  $ns duplex-link-op $router1_ $router2_ orient left-down
  $ns duplex-link-op $router1_ $router3_ orient right-down
  $ns duplex-link-op $router2_ $bs1_ orient left-down
  $ns duplex-link-op $router2_ $bs2_ orient right-down
  $ns duplex-link-op $router3_ $bs3_ orient down
  $ns duplex-link-op $router3_ $bs4_ orient right-down

  # movement of the MH
  $mobile_ set Z_ 0.000000000000
  $mobile_ set Y_ 1000.000000000000
  $mobile_ set X_ 250.000000000000

  # MH starts to move towards FA1
  $ns at 10.000000000000 "$mobile_ setdest 950.000000000000 
1000.000000000000 20.000000000000"
  # MH move from FA1 towards FA2
  $ns at 50.000000000000 "$mobile_ setdest 950.000000000000 
350.000000000000 20.000000000000"
  # MH move from FA2 towards FA3
  $ns at 85.000000000000 "$mobile_ setdest 250.000000000000 
350.000000000000 20.000000000000"
 

  display_ns_addr_domain
}

################################################################
# End of Simulation
################################################################
proc finish { } {
  global tracef ns namf opt mobile_ cn_
  
  puts "Simulation finished" 
  # Dump the Binding Update List of MN and Binding Cache of HA
  [[$mobile_ set ha_] set regagent_] dump
  [$cn_ set regagent_] dump
  [$mobile_ set regagent_] dump

  $ns flush-trace
  flush $tracef
  close $tracef
  close $namf
  #puts "running nam with $opt(namfile) ... "
  #exec nam $opt(namfile) &
  exit 0
}


################################################################
# Main 
################################################################
proc main { } {
   global opt ns TOPOM namf n tracef mobile_ cn_ 
   # Source Files
   # source set-def-options.tcl 
   # set BASEDIR to your own correct path
   source  
/home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mipv6-config.tcl
   source  /home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/proc-tools.tcl
   source  /home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/proc-topo.tcl
   source  /home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/ns-topoman.tcl
   source  
/home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-global.tcl
   source  
/home/Administrator/ns-allinone-2.33/ns-2.33/tcl/lib/proc-mobi-config.tcl
   source  /home/Administrator/ns-allinone-2.33/ns-2.33/tcl/mobility/timer.tcl



   set NAMF out.nam
   set TRACEF out.tr
   set INFOF out.info

   set opt(mactrace) ON
   set opt(NAM) 1 
   set opt(namfile) $NAMF
   set opt(stop) 130
   set opt(tracefile) $TRACEF
   
   #>--------------- Extract options from command line ---------------<
   #Getopt    ; # Get option from the command line    
   #DisplayCommandLine
   
   #>---------------------- Simulator Settings ----------------------<
   set ns [new Simulator]
        
   #>------------------------ Open trace files ----------------------<
   exec rm -f $opt(tracefile)
   set tracef [open $opt(tracefile) w]
   #... dump the file
   $ns trace-all $tracef
    
   set namf [open $opt(namfile) w]
   $ns namtrace-all $namf

   #>------------- Protocol and Topology Settings -------------------<
   create-my-topo
   log-mn-movement_no_topo
   
   set-cbr
   # set-ping-int 0.1 $cn_ $mobile_ 10 $opt(stop)
   
   



   #>----------------------- Run Simulation -------------------------<
   $ns at $opt(stop) "finish"
   $ns run

   $ns dump-topology $namf
   close $namf
   #puts "running nam with $opt(namfile) ... "
   #exec nam $opt(namfile) &
}

proc set-cbr { } {
   global ns cn_ mobile_
   set tcp1 [new Agent/TCP]
   $ns attach-agent $cn_ $tcp1
   
   set dst [new Agent/TCPSink]
   $ns attach-agent $mobile_ $dst
   $ns connect $tcp1 $dst

   set ftp1 [new Application/FTP]
   $ftp1 set packetSize_ 1040
   $ftp1 set rate_ 100k
   $ftp1 set interval_ 0.05
   $ftp1 attach-agent $tcp1
    $ns at 10.0 "$ftp1 start"
} 








      

Reply via email to