[ns] simulating new protocol under ns2

2007-03-06 Thread leticia bela

Hi,
I am a new user for Ns and i have a same problem like [EMAIL PROTECTED]
I well studied document Implementing a new MANET protocol in ns-2. I wrote
the same code in ns-2. that was compiled without error.  I made all indicated 
changes in ns-2 .
  
After wich i recompile ns-2 by typing make at ns-2.29 directory
it got compiled well. But when i try to use this protocol in my simulation
script, it produces the following errors.

  num_nodes is set 2
  warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
  (_o14 cmd line 1)
  invoked from within
  _o14 cmd addr
  invoked from within
  catch $self cmd $args ret
  invoked from within
  if [catch $self cmd $args ret] {
  set cls [$self info class]
  global errorInfo
  set savedInfo $errorInfo
  error error when calling class $cls: $args $...
  (procedure _o14 line 2)
  (SplitObject unknown line 2)
  invoked from within
  _o14 addr
  (eval body line 1)
  invoked from within
  eval $node addr $args
  (default arm line 2)
  invoked from within
  switch -exact $routingAgent_ {
  DSDV {
  set ragent [$self create-dsdv-agent $node]
  }
  DSR {
  $self at 0.0 $node start-dsr
  }
  AODV {
  set ragent [$self cre...
  (procedure _o3 line 11)
  (Simulator create-wireless-node line 11)
  invoked from within
  _o3 create-wireless-node
  (eval body line 1)
  invoked from within
  eval $self create-wireless-node $args
  (procedure _o3 line 23)
  (Simulator node line 23)
  invoked from  within
  $ns_ node
  (for body line 2)
  invoked from within
  for {set i 0} {$i  $val(nn) } {incr i} {
  set node_($i) [$ns_ node]
  $node_($i) random-motion 1  ;# disable random 
motion
  }
  (file protoname.tcl line 65)
  **
 my script for simulate this protocol is:
 
 # ==
 # 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)Queue/DropTail/PriQueue;# 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) 2 ;# number of mobilenodes
 set val(rp) protoname   ;# routing protocol
 
 
 # ==
 # Main Program
 # ==
 
 
 #
 # Initialize Global Variables
 #
 set ns_[new Simulator]
 set tracefd [open out.tr w]
 $ns_ trace-all $tracefd
 
 # pour avoir la nouvelle trace new trace format
 $ns_ use-newtrace
 
 # set up topography object
 set topo   [new Topography]
 
 $topo load_flatgrid 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) and node(1)
 
 # 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 1;# 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
 
 #
 # Now produce some simple node movements
 # Node_(1) starts to move towards node_(0)
 #
 $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
 
 # Setup traffic flow between nodes
 # TCP connections between node_(0) and node_(1)
 
 set tcp [new Agent/TCP]
 $tcp set fid_ 2 # donne un identifiant au flux
 set sink [new Agent/TCPSink]
 $ns_ attach-agent $node_(0) $tcp
 $ns_ attach-agent $node_(1) $sink
 $ns_ connect $tcp $sink
 set ftp [new Application/FTP]
 $ftp attach-agent $tcp
 $ns_ at 1.0 $ftp start 
 
 
 #Agent/Protoname  set 

Re: [ns] simulating new protocol under ns2

2007-03-06 Thread Francisco J. Ros

Hi,

Please note that the agent's name is case sensitive, so if you wrote 
'Protoname' in ns-lib.tcl (as indicated in 
http://masimum.inf.um.es/nsrt-howto/html/node20.html), you mustn't write 
'protoname' in your TCL simulation script.

Hope this solves the problem.

Regards,
fran

On Tuesday 06 March 2007 10:29, leticia bela wrote:
 Hi,
 I am a new user for Ns and i have a same problem like
 [EMAIL PROTECTED] I well studied document Implementing a new MANET
 protocol in ns-2. I wrote the same code in ns-2. that was compiled without
 error.  I made all indicated changes in ns-2 .

 After wich i recompile ns-2 by typing make at ns-2.29 directory
 it got compiled well. But when i try to use this protocol in my simulation
 script, it produces the following errors.

   num_nodes is set 2
   warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
   (_o14 cmd line 1)
   invoked from within
   _o14 cmd addr
   invoked from within
   catch $self cmd $args ret
   invoked from within
   if [catch $self cmd $args ret] {
   set cls [$self info class]
   global errorInfo
   set savedInfo $errorInfo
   error error when calling class $cls: $args $...
   (procedure _o14 line 2)
   (SplitObject unknown line 2)
   invoked from within
   _o14 addr
   (eval body line 1)
   invoked from within
   eval $node addr $args
   (default arm line 2)
   invoked from within
   switch -exact $routingAgent_ {
   DSDV {
   set ragent [$self create-dsdv-agent $node]
   }
   DSR {
   $self at 0.0 $node start-dsr
   }
   AODV {
   set ragent [$self cre...
   (procedure _o3 line 11)
   (Simulator create-wireless-node line 11)
   invoked from within
   _o3 create-wireless-node
   (eval body line 1)
   invoked from within
   eval $self create-wireless-node $args
   (procedure _o3 line 23)
   (Simulator node line 23)
   invoked from  within
   $ns_ node
   (for body line 2)
   invoked from within
   for {set i 0} {$i  $val(nn) } {incr i} {
   set node_($i) [$ns_ node]
   $node_($i) random-motion 1  ;# disable random
 motion }
   (file protoname.tcl line 65)
   **
  my script for simulate this protocol is:

  # ==
  # 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)Queue/DropTail/PriQueue;# 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) 2 ;# number of mobilenodes
  set val(rp) protoname   ;# routing protocol


  # ==
  # Main Program
  # ==


  #
  # Initialize Global Variables
  #
  set ns_[new Simulator]
  set tracefd [open out.tr w]
  $ns_ trace-all $tracefd

  # pour avoir la nouvelle trace new trace format
  $ns_ use-newtrace

  # set up topography object
  set topo   [new Topography]

  $topo load_flatgrid 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) and node(1)

  # 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 1;# 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

  #
  # Now produce some simple node movements
  # Node_(1) starts to move towards node_(0)
  #
  $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

  #