why DSR is not working in FANET in NS2 using z=10.0

66 views Asked by At

I am trying to implement Fanet for 24 nodes where source will be sending packets to destination node. Here Source and destination nodes will be mobile and other nodes will be stationary and act as neighbouring nodes. nodes will be connected with TCP and CBR.

here is the following code of DSR implementation in TCL

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)             24                          ;# number of mobilenodes 
set val(rp)             DSR                       ;# routing protocol 
set val(x)              500                ;# X dimension of topography 
set val(y)              400                ;# Y dimension of topography   
set val(stop)       150            ;# time of simulation end 



set ns_       [new Simulator]

set tracefd       [open dsr.tr w] 
set namtrace      [open dsr.nam w] 

$ns_ trace-all $tracefd 
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y) 


set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)


# configure the nodes 
$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 ON
                   
                   
###  Creating The WIRELESS NODES
                  
      set Server1 [$ns_ node]
      set Server2 [$ns_ node]
      
    for {set i 2} {$i < $val(nn) } { incr i } {
    set n($i) [$ns_ node]
    $n($i) set X_ [ expr 10+round(rand()*150) ]
    $n($i) set Y_ [ expr 10+round(rand()*240) ]
    $n($i) set Z_ 0.0
    $ns_ at 0.0 "$n($i) label node$i"
    }
    
      
      
###  Setting The Initial Positions of Nodes

      $Server1 set X_ 5.0
      $Server1 set Y_ 5.0
      $Server1 set Z_ 0.0
      
      $Server2 set X_ 490.0
      $Server2 set Y_ 285.0
      $Server2 set Z_ 0.0
      
## Giving Mobility to Nodes
$ns_ at 10.0 " $Server1 setdest 250.0 250.0 3.0"
$ns_ at 15.0 " $Server2 setdest 45.0 280.0 5.0"
$ns_ at 110.0 "$Server1 setdest 480.0 300.0 5.0" 



      
## Setting The Node Size
                              
      $ns_ initial_node_pos $Server1 30
      $ns_ initial_node_pos $Server2 30
      
      

      #### Setting The Labels For Nodes
      
      $ns_ at 0.0 "$Server1 label Server1"
      $ns_ at 0.0 "$Server2 label Server2"
      
      

      
# Set a TCP connection between server 1 and server 2
set tcp [new Agent/TCP/Reno]
$tcp set class_ 2
set sink [new Agent/TCPSink]
#set cbr [new Application/Traffic/CBR]
$ns_ attach-agent $Server1 $tcp 
$ns_ attach-agent $Server2 $sink 
$ns_ connect $tcp $sink
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $tcp
$cbr set packetSize_ 1000    
$cbr set interopt_ .07
$ns_ at 10.0 "$cbr start"

# Define node initial position in nam 
for {set i 2} {$i <$val(nn)} { incr i } { 
# 30 defines the node size for nam 
$ns_ initial_node_pos $n($i) 30 
} 
 
# Telling nodes when the simulation ends 
for {set i 2} {$i < $val(nn) } { incr i } { 
    $ns_ at $val(stop) "$n($i) reset"; 
}

      
# ending nam and the simulation  
$ns_ at $val(stop) "$ns_ nam-end-wireless $val(stop)" 
$ns_ at $val(stop) "stop" 
$ns_ at 150.01 "puts \"end simulation\" ; $ns_ halt" 
proc stop {} { 
    global ns_ tracefd namtrace 
    $ns_ flush-trace 
    close $tracefd 
    close $namtrace 
    #Execute nam on the trace file 
    exec nam dsr.nam & 
    exit 0 
} 
puts "Starting Simulation........"
$ns_ run    

When i try to make z=10.0, in the nam file simulation, node and destination are connecting directly. they are not using neighbouring nodes. As per definition DSR would work via neighbour node hops if it is nearby.

i want to implement DSR in FANET where z=10.0 is necessary. Why it is happening? is DSR doesn't work with FANET or z=10.0?

please let me know where i am doing wrong or my concept of implementation is wrong?

0

There are 0 answers