Hi All, Our website moved to a new URL. Please bookmark the new link: https://ns2bloggers.blogspot.com/

Thursday, 29 May 2014

MODIFYING AODV PROTOCOL

Many people doing project on AODV modification, but most of them have trouble in doing the same. The best way to modify aodv is to study aodv.cc and aodv.h well before starting your work. So here we are going to provide some help to modify AODV protocol.
First of all you have to study the function of each timer in aodv.cc; for that put a printf message inside each function of aodv.cc separately and then you can see how many times each function calls while executing a simple aodv program.

Step 1: open /ns-allinone-2.35/ns-2.35/aodv directory
Step 2: open aodv.cc file and add the commands which is shown in yellow outline.

void
HelloTimer::handle(Event*) {
 

// Begin ns2blogger.blogspot.in
printf("DEBUG TEST TEST \n");
// End ns2blogger.blogspot.in

   agent->sendHello();
   double interval = MinHelloInterval +
                 ((MaxHelloInterval - MinHelloInterval) * Random::uniform());
   assert(interval >= 0);
   Scheduler::instance().schedule(this, &intr, interval);
}


Step 3: Save the aodv.cc file and open the terminal and execute these commands.
            make clean
            make
            sudo make install
Step 4: Change directory and run any aodv program. You can see how many times the function 'HellowTimer::handle(Event*)' was called in this program.


For more details on aodv, click here to download pdf.

14 comments :

  1. Is there any such pdf of aomdv in ns2

    ReplyDelete
    Replies
    1. sorry...we didnt get you... wat u need??

      Delete
  2. I would like to know whether there is some material to learn AOMDV implementation because
    I need the idea of multiple path data transmission...
    Thank You

    ReplyDelete
  3. Thanks to this administrative on this blogger. I have project on find the shortest-path between the source and destination. and i'm now deal with wireless network and used AODV routing protocol. Plz how can i find the shortest-path and i know in advance AODV is normally give us the shortest-path regardless of the algorithm for no. of minimum-hops or minimum-path delay, but i must insert new algorithm give me results that is more efficient than the algorithm used here in AODV. if i can do this, can i must modify on AODV files (AODV.h/cc) or there is another solution to do this and find the shortest-path

    THANKS IN ADVANCE

    ReplyDelete
    Replies
    1. yes..u can calculate distance between two nodes from tcl itself...

      Delete
  4. How Can I do this because I'm beginner on ns2 and is this new route will achieve a high performance than the previous route?

    THANKS FOR REPLY

    ReplyDelete
  5. implementation of genetic algorithm in ns2 for AODV protocol. Any reference material to begin with.

    ReplyDelete
  6. 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) 3 ;# number of mobilenodes
    set opt(rp) DSR ;# routing protocol
    set opt(x) 500 ;# X dimension of topography
    set opt(y) 400 ;# Y dimension of topography
    set opt(stop) 150 ;
    set ns [new Simulator]
    #Creating trace file and nam file
    set tracefd [open Dsr.tr w]

    set namtrace [open dsr.nam w]

    $ns trace-all $tracefd
    $ns namtrace-all-wireless $namtrace $opt(x) $opt(y)

    # set up topography object
    set topo [new Topography]

    $topo load_flatgrid $opt(x) $opt(y)

    create-god $opt(nn)

    # configure the nodes
    $ns node-config -adhocRouting $opt(rp) \
    -llType $opt(ll) \
    -macType $opt(mac) \
    -ifqType $opt(ifq) \
    -ifqLen $opt(ifqlen) \
    -antType $opt(ant) \
    -propType $opt(prop) \
    -phyType $opt(netif) \
    -channelType $opt(chan) \
    -topoInstance $topo \
    -agentTrace ON \
    -routerTrace ON \
    -macTrace OFF \
    -movementTrace ON

    for {set i 0} {$i < $opt(nn) } { incr i } {
    set node_($i) [$ns node]
    }

    # Provide initial location of mobilenodes
    $node_(0) set X_ 5.0
    $node_(0) set Y_ 5.0
    $node_(0) set Z_ 0.0

    $node_(1) set X_ 490.0
    $node_(1) set Y_ 285.0
    $node_(1) set Z_ 0.0

    $node_(2) set X_ 150.0
    $node_(2) set Y_ 240.0
    $node_(2) set Z_ 0.0

    # Generation of movements
    $ns at 10.0 "$node_(0) setdest 250.0 250.0 3.0"
    $ns at 15.0 "$node_(1) setdest 45.0 285.0 5.0"
    $ns at 110.0 "$node_(0) setdest 480.0 300.0 5.0"

    # Set a TCP connection between node_(0) and node_(1)
    set tcp [new Agent/TCP/Newreno]
    $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"



    # Define node initial position in nam
    for {set i 0} {$i < $opt(nn)} { incr i } {
    # 30 defines the node size for nam
    $ns initial_node_pos $node_($i) 30
    }

    # Telling nodes when the simulation ends
    for {set i 0} {$i < $opt(nn) } { incr i } {
    $ns at $opt(stop) "$node_($i) reset";
    }

    # ending nam and the simulation
    $ns at $opt(stop) "$ns nam-end-wireless $opt(stop)"
    $ns at $opt(stop) "stop"
    $ns at 150.01 "puts \"end simulation\" ; $ns halt"
    proc stop {} {
    global ns tracefd namtrace
    $ns flush-trace
    close $tracefd
    close $namtrace
    exec nam dsr.nam &
    exit 0
    }

    $ns run

    ReplyDelete
  7. Replies
    1. use CMUPriQueue INSTEAD OF Queue/DropTail/PriQueue

      Delete
  8. hello admin. I want to implement multiple channel support in AODV (each node has multiple channel to sense at different point of time). I am not able to figure out that I should change TCL code of AODV.CC (please suggest if u can)

    ReplyDelete
  9. hi admin ,i want to modified aodv protocol in ns2.35 (aodv.cc) to implement R-aodv randomized approach of AODV protocol. can help me .thanks so much

    ReplyDelete
  10. hello, I want to select the nearest path to destination can someone help me pleaseee?!!!!!

    ReplyDelete