Hi

I am preparing wireless network topology.
I want to add Antnet agent to mobile nodes so that output gives routing
table for each node as per Antnet Algorithm.
Here is the code given bellow.
can anybody help me??

  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) AODV                                   ;#routing protocol

  set val(x) 500                      ;#X dimension of the topography

  set val(y) 500                      ;#Y dimension of the topography

#Define options:adhoc-routing protocol,network stack,channel,etc.

#create simulator

  set ns [new Simulator]

  set tracefd [open example2.tr w]

  $ns trace-all $tracefd

  set namtracefd [open example2.nam w]

  $ns namtrace-all-wireless $namtracefd $val(x) $val(y)

 #ns trace and nam trace are opened,all tracing is

  #enabled, annotates the nam trace with information
  #about the size of the topography(its x and y
  #dimensions)

  proc finish {} {

      global ns tracefd namtracefd

      $ns flush-trace

      close $tracefd

      close $namtracefd

      exec nam example2.nam &

      exit 0

  }

  #create a finish function. the traces are flushed

  #to disk before the simulator is halted,ns trace
  #and nam trace are closed

  set topo [new Topography]

  $topo load_flatgrid $val(x) $val(y)

  #set up topography object. Create a flat topology  in a x m * y m area

  create-god $val(nn)

  # Create a God(General Operations Director) Object
  #A God object must be created.It annotates trace logs with
  #information about the optimal number of hops from a source to a
destination,used for statistics and routing
  #protocol evaluations.

  $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

  #Define how a mobile node is configured
  for {set i 0} {$i < $val(nn) } {incr i} {

      set node_($i) [$ns node]

      $node_($i) random-motion 0

  }

 for {set i 0} {$i < $val(nn)} {incr i} {

        set   node_($i)  [new Agent/Antnet $i]
}
  #Use “for” loop to create two nodes attach it to the channel disable
random motion

  $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

  $ns at 50.0 "$node_(1) setdest 25.0 20.0 15.0"

  $ns at 10.0 "$node_(0) setdest 20.0 18.0 15.0"

  $ns at 100.0 "$node_(1) setdest 490.0 480.0 15.0"

  #Node position defined in a 3-D model

  #However z axis not used to create Node movement

  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 connect $tcp $sink

  set ftp [new Application/FTP]

  $ftp attach-agent $tcp

  $ns at 10.0 "$ftp start“

  #creating a TCP connection from node_(0) to node_(1),setup

  # a FTP traffic flow at time 10.0

  for {set i 0} {$i < $val(nn)} {incr i} {

       $ns at 150.0 "$node_($i) reset";

  }

  #Print routing tables generated by AntNet

  for {set i 0} {$i < $nn} {incr i} {

        $ns at 12.0 "$node_($i) print_rtable"
  }


  # Tell nodes when the simulation ends

  $ns at 150.0 "finish"

  #run the finish function at 150.0

 $ns run                     ;# Start simulation
 





-----

Thanks and Regards,
Manan Shah
09924038427
-- 
View this message in context: 
http://old.nabble.com/Creating-Wireless-Network-Topology-tp27334847p27334847.html
Sent from the ns-users mailing list archive at Nabble.com.


Reply via email to