Hi,

I also have that problem, infact in my case when running nam for a similar
scenario, it shows me node 0,1,2 and 3 a not defined until they actually
start the movement.

Another think which I need to ask you is that why have you attached the
same tcp to node 0 2 and 4 and sink to node 1 and 3. Can you use the same
agent on different nodes? Is that a requirement for the channel to work
properly or your just testing to see it works

Please let me know

regards

Qasim Iqbal

>
> hi ,
>  i don't know exactly, why it worked by making single change. But i made
> the change  by guessing it as hidden terminal problem.
>
>  Exact reason is most welcome.
>
>  The modified line is highlighted  with yellow and i have changed 20.0 to
> 10.0 in that line which is highlighted with blue.
>
>  # ======================================================================
>  # Define options
>  # ======================================================================
>  set val(chan)           Channel/WirelessChannel    ;# channel type
>  set val(prop)           Propagation/TwoRayGround   ;# radio-propagation
> model
>  set val(netif)          Phy/WirelessPhy            ;# network interface
> type
>  set val(mac)            Mac/802_11                 ;# MAC type
>  set val(ifq)            CMUPriQueue    ;# interface queue type
>  set val(ll)             LL                         ;# link layer type
>  set val(ant)            Antenna/OmniAntenna        ;# antenna model
>  set val(ifqlen)         50                         ;# max packet in ifq
>  set val(nn)             5                          ;# number of mobile
> nodes
>  set val(rp)             DSR                       ;# routing protocol
>
>  # ======================================================================
>  # Main Program
>  # ======================================================================
>
>  #-----------
>  # Initialize Global Variables
>  #-----------
>  set ns_         [new Simulator]
>  $ns_ use-newtrace
>  set tracefd     [open simTest.tr w]
>  set namtrace    [open simple-wireless.nam w]
>  $ns_ trace-all $tracefd
>
>  # set up topography object
>  set topo       [new Topography]
>
>  $topo load_flatgrid 500 500
>  $ns_ namtrace-all-wireless $namtrace 500 500
>
>  #--------------
>  # Create God
>  #--------------
>  create-god $val(nn)
>
>  #--------------
>  #  Create the specified number of mobilenodes [$val(nn)] and "attach"
> them
>  #  to the channel.
>  #  Here two nodes are created : node(0), node(1), node(2), node(3),
> node(4)
>
>  # configure node
>
>          $ns_ node-config -adhocRouting $val(rp) \
>                           -llType $val(ll) \
>                           -macType $val(mac) \
>                           -ifqType $val(ifq) \
>                           -ifqLen $val(ifqlen) \
>                           -antType $val(ant) \
>                           -propType $val(prop) \
>                           -phyType $val(netif) \
>                           -channelType $val(chan) \
>                           -topoInstance $topo \
>                           -agentTrace ON \
>                           -routerTrace ON \
>                           -macTrace OFF \
>                           -movementTrace OFF
>
>          for {set i 0} {$i < $val(nn) } {incr i} {
>                  set node_($i) [$ns_ node]
>                  $node_($i) random-motion 0              ;# disable random
> motion
>          }
>
>  #-----------
>  # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
>  #-----------
>  $node_(0) set X_ 5.0
>  $node_(0) set Y_ 2.0
>  $node_(0) set Z_ 0.0
>
>  $node_(1) set X_ 390.0
>  $node_(1) set Y_ 385.0
>  $node_(1) set Z_ 0.0
>
>  $node_(2) set X_ 132.0
>  $node_(2) set Y_ 423.0
>  $node_(2) set Z_ 0.0
>
>  $node_(3) set X_ 245.0
>  $node_(3) set Y_ 150.0
>  $node_(3) set Z_ 0.0
>
>  $node_(4) set X_ 350.0
>  $node_(4) set Y_ 85.0
>  $node_(4) set Z_ 0.0
>
>  #-------------
>  # Now produce some simple node movements
>  #-------------
>  $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
>  $ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0"
>
>  $ns_ at 60.0 "$node_(2) setdest 10.0 18.0 1.0"
>
>  $ns_ at 10.0 "$node_(3) setdest 30.0 28.0 10.0"
>
>  $ns_ at 10.0 "$node_(4) setdest 25.0 38.0 1.0"
>
>  # Node_(1) then starts to move away from node_(0)
>  $ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
>
>  # Setup traffic flow between nodes
>  # TCP connections between node_(0) and node_(1)
>
>  set tcp [new Agent/TCP]
>  $tcp set class_ 2
>
>  set sink [new Agent/TCPSink]
>  $ns_ attach-agent $node_(0) $tcp
>  $ns_ attach-agent $node_(1) $sink
>  $ns_ attach-agent $node_(2) $tcp
>  $ns_ attach-agent $node_(3) $sink
>  $ns_ attach-agent $node_(4) $tcp
>  $ns_ connect $tcp $sink
>
>  set ftp [new Application/FTP]
>  $ftp attach-agent $tcp
>  $ns_ at 10.0 "$ftp start"
>
>  #----------
>  # Tell nodes when the simulation ends
>  #----------
>  for {set i 0} {$i < $val(nn) } {incr i} {
>      $ns_ at 150.0 "$node_($i) reset";
>  }
>
>  $ns_ at 150.0001 "stop"
>  $ns_ at 150.0002 "puts \"NS EXITING...\" ; $ns_ halt"
>  proc stop {} {
>      global ns_ tracefd
>      $ns_ flush-trace
>      close $tracefd
>
>      exec nam simple-wireless.nam  &
>      exit 0
>  }
>
>
>  puts "Starting Simulation..."
>  $ns_ run
>
>  bye,
>  Y.Jaya Lakshmi.
>
>  Azri Abdul Majid <[EMAIL PROTECTED]> wrote:
> Hi guys,
>
> I need your help. I successfully run this code. But I keep on receiving
> message "node 3 is not define". However, I can run NAM. What's wrong with
> this code guys?
>
>
> #begin of code
> # simple-wireless.tcl
> # A simple example for wireless simulation (five nodes)
>
> # ======================================================================
> # Define options
> # ======================================================================
> set val(chan)           Channel/WirelessChannel    ;# channel type
> set val(prop)           Propagation/TwoRayGround   ;# radio-propagation
> model
> set val(netif)          Phy/WirelessPhy            ;# network interface
> type
> set val(mac)            Mac/802_11                 ;# MAC type
> set val(ifq)            CMUPriQueue    ;# interface queue type
> set val(ll)             LL                         ;# link layer type
> set val(ant)            Antenna/OmniAntenna        ;# antenna model
> set val(ifqlen)         50                         ;# max packet in ifq
> set val(nn)             5                          ;# number of mobile
> nodes
> set val(rp)             DSR                       ;# routing protocol
>
> # ======================================================================
> # Main Program
> # ======================================================================
>
> #-----------
> # Initialize Global Variables
> #-----------
> set ns_  [new Simulator]
> $ns_ use-newtrace
> set tracefd     [open simTest.tr w]
> set namtrace [open simple-wireless.nam w]
> $ns_ trace-all $tracefd
>
> # set up topography object
> set topo       [new Topography]
>
> $topo load_flatgrid 500 500
> $ns_ namtrace-all-wireless $namtrace 500 500
>
> #--------------
> # Create God
> #--------------
> create-god $val(nn)
>
> #--------------
> #  Create the specified number of mobilenodes [$val(nn)] and "attach" them
> #  to the channel.
> #  Here two nodes are created : node(0), node(1), node(2), node(3),
> node(4)
>
> # configure node
>
>         $ns_ node-config -adhocRouting $val(rp) \
>     -llType $val(ll) \
>     -macType $val(mac) \
>     -ifqType $val(ifq) \
>     -ifqLen $val(ifqlen) \
>     -antType $val(ant) \
>     -propType $val(prop) \
>     -phyType $val(netif) \
>     -channelType $val(chan) \
>     -topoInstance $topo \
>     -agentTrace ON \
>     -routerTrace ON \
>     -macTrace OFF \
>     -movementTrace OFF
>
>  for {set i 0} {$i < $val(nn) } {incr i} {
>   set node_($i) [$ns_ node]
>   $node_($i) random-motion 0  ;# disable random motion
>  }
>
> #-----------
> # Provide initial (X,Y, for now Z=0) co-ordinates for mobilenodes
> #-----------
> $node_(0) set X_ 5.0
> $node_(0) set Y_ 2.0
> $node_(0) set Z_ 0.0
>
> $node_(1) set X_ 390.0
> $node_(1) set Y_ 385.0
> $node_(1) set Z_ 0.0
>
> $node_(2) set X_ 132.0
> $node_(2) set Y_ 423.0
> $node_(2) set Z_ 0.0
>
> $node_(3) set X_ 245.0
> $node_(3) set Y_ 150.0
> $node_(3) set Z_ 0.0
>
> $node_(4) set X_ 350.0
> $node_(4) set Y_ 85.0
> $node_(4) set Z_ 0.0
>
> #-------------
> # Now produce some simple node movements
> #-------------
> $ns_ at 50.0 "$node_(1) setdest 25.0 20.0 15.0"
> $ns_ at 10.0 "$node_(0) setdest 20.0 18.0 1.0"
>
> $ns_ at 60.0 "$node_(2) setdest 10.0 18.0 1.0"
> $ns_ at 20.0 "$node_(3) setdest 30.0 28.0 10.0"
> $ns_ at 10.0 "$node_(4) setdest 25.0 38.0 1.0"
>
> # Node_(1) then starts to move away from node_(0)
> $ns_ at 100.0 "$node_(1) setdest 490.0 480.0 15.0"
>
> # Setup traffic flow between nodes
> # TCP connections between node_(0) and node_(1)
>
> set tcp [new Agent/TCP]
> $tcp set class_ 2
>
> set sink [new Agent/TCPSink]
> $ns_ attach-agent $node_(0) $tcp
> $ns_ attach-agent $node_(1) $sink
> $ns_ attach-agent $node_(2) $tcp
> $ns_ attach-agent $node_(3) $sink
> $ns_ attach-agent $node_(4) $tcp
> $ns_ connect $tcp $sink
>
> set ftp [new Application/FTP]
> $ftp attach-agent $tcp
> $ns_ at 10.0 "$ftp start"
>
> #----------
> # Tell nodes when the simulation ends
> #----------
> for {set i 0} {$i < $val(nn) } {incr i} {
>     $ns_ at 150.0 "$node_($i) reset";
> }
>
> $ns_ at 150.0001 "stop"
> $ns_ at 150.0002 "puts \"NS EXITING...\" ; $ns_ halt"
> proc stop {} {
>     global ns_ tracefd
>     $ns_ flush-trace
>     close $tracefd
>
>     exec nam simple-wireless.nam  &
>     exit 0
> }
>
>
> puts "Starting Simulation..."
> $ns_ run
> #end of code
>
> - azri abdul majid
>
>
> --
> _______________________________________________
>
> Search for businesses by name, location, or phone number.  -Lycos Yellow
> Pages
>
> http://r.lycos.com/r/yp_emailfooter/http://yellowpages.lycos.com/default.asp?SRC=lycos10
>
>
>
>
>
> ---------------------------------
> Yahoo! for Good - Make a difference this year.
>


Reply via email to