Caution :
If you try to use SWARM routing under highly mobile and try to send much data which will consume much bandwidth, then the performance of the SWARM routing will become very worst. Some of the papers that you see in literature may try to hide this fact.
Further, this evaluation is an elementary evaluation that considered only “time vs performance” as a metric. So any serious research on this routing protocol will need a lot of iterative simulations and more advanced analysis.
Important Sections of the Simulation Script
Some of the important parameters
set val(chan) Channel/WirelessChannel ;# channel type set val(prop) Propagation/TwoRayGround ;# radio-propagation model set val(ant) Antenna/OmniAntenna ;# Antenna type set val(ll) LL ;# Link layer type set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type set val(ifqlen) 50 ;# max packet in ifq set val(netif) Phy/WirelessPhy ;# network interface type set val(mac) Mac/802_11 ;# MAC type set val(rp) [lindex $argv 0] ;# Change it as SWARM or AODV or DSR set val(TotalNodes) 10 set val(xdim) 1000 set val(ydim) 500 set val(speed) 20 ;# Change it as SWARM or AODV or DSR set val(StartTime) 0.00 set val(SimTime) 50.00 # unity gain, omni-directional antennas # set up the antennas to be centered in the node and 1.5 meters above it Antenna/OmniAntenna set X_ 0 Antenna/OmniAntenna set Y_ 0 Antenna/OmniAntenna set Z_ 1.5 Antenna/OmniAntenna set Gt_ 1.0 Antenna/OmniAntenna set Gr_ 1.0 # Initialize the SharedMedia interface with parameters to make # it work like the 914MHz Lucent WaveLAN DSSS radio interface Phy/WirelessPhy set CPThresh_ 10.0 Phy/WirelessPhy set CSThresh_ 1.559e-11 Phy/WirelessPhy set RXThresh_ 3.652e-10 Phy/WirelessPhy set Rb_ 2*1e6 #inital transmission power of all the nodes Phy/WirelessPhy set Pt_ 0.2819;# Change it if required Phy/WirelessPhy set freq_ 914e+6 Phy/WirelessPhy set L_ 1.0
Setting Node Configuration
$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 ON \ -movementTrace OFF \ -channel $chan_1
Creating Nodes and Setting up Some mobility
for {set i 0} {$i < [expr $val(TotalNodes) ] } {incr i} { set node($i) [$ns node ] $node($i) random-motion 1 ;# disable random motion set tx [$rng integer [expr $val(xdim)-100]] set ty [$rng integer [expr $val(ydim)-100]] set tx [expr $tx + 50 ] set ty [expr $ty + 50 ] $node($i) set X_ $tx $node($i) set Y_ $ty $node($i) set Z_ 0.0 $node($i) color "black" $ns initial_node_pos $node($i) 10 } # set the position of the sender and reciever at two extreme ends set x 100 set y [expr $val(ydim) - 100 ] $node(0) set X_ $x $node(0) set Y_ $y $node(0) set Z_ 0.0 $ns initial_node_pos $node(0) 20 $ns at 0.0 "$node(0) setdest $x $y 20000.0" $ns at 0.0 "$node(0) label Sender" $ns at 0.0 "$node(0) color blue" set x [expr $val(xdim) - 100 ] set y 100 set n [expr $val(TotalNodes) -1 ] $node($n) set X_ $x $node($n) set Y_ $y $node($n) set Z_ 0.0 $ns initial_node_pos $node($n) 20 $ns at 0.0 "$node($n) setdest $x $y 20000.0" $ns at 0.0 "$node($n) label Reciever" $ns at 0.0 "$node($n) color blue" if {$val(speed) > 0 } { for {set i 0} {$i < [expr $val(TotalNodes) ]} {incr i} { set tx [$rng integer [expr $val(xdim)-100]] set ty [$rng integer [expr $val(ydim)-100]] set tx [expr $tx + 50 ] set ty [expr $ty + 50 ] $node($i) random-motion 1 $ns at 0.0 "$node($i) setdest $tx $ty $val(speed)" } }
Setting up some traffic
# Setup traffic flow between nodes # CBR connections between node(0) and node(1) set udp [new Agent/UDP] $udp set class_ 2 set sink [new Agent/LossMonitor] $ns attach-agent $node(0) $udp $ns attach-agent $node([expr $val(TotalNodes) -1 ]) $sink $ns connect $udp $sink set cbr [new Application/Traffic/CBR] $cbr set class_ 2 $cbr set packetSize_ 1024 $cbr set interval_ 0.05 $cbr attach-agent $udp $ns at 0.002 "$cbr start" $ns at $val(StartTime) "$cbr stop" $ns at $val(SimTime).01 "stop"
Record Some Events for Performance Analysis
proc record {} { global sink fpRecieved fpDropped fdTput fdLrate #Get An Instance Of The Simulator set ns [Simulator instance] #Set The Time After Which The Procedure Should Be Called Again set time 2.0 #How Many Bytes Have Been Received By The Traffic Sinks? set npkts [$sink set npkts_] set nbytes [$sink set bytes_] set nlost [$sink set nlost_] #Get The Current Time set now [$ns now] #Save Data To The Files puts $fpRecieved "$now [expr $nbytes]" puts $fdTput "$now [expr $nbytes/$time*8/1000000]" if {$npkts> 0.0 } { set lossrate1 [expr $nlost / $npkts ] puts $fdLrate "$now $lossrate1" } else { puts $fdLrate "$now 0" } $sink set bytes_ 0 #Re-Schedule The Procedure $ns at [expr $now+$time] "record" }
The Nam Outputs
Overall Results without Mobility
Average Received Packets over time
Average Loss Rate Over Time
Average Throughput Over Time
Without mobility, SWARM routing gave very good throughput
The loss rate is very very low in the case of SWARM and AODV while comparing it with DSR
Without mobility, the received bytes is high. The Graph is almost similar to the throughput graph, but the x-axis is showing the total received bytes.
Overall results with Mobility 20m/sec
Average Received Packets over time
Average Received Packets over time
Average Throughput Over Time
With mobility, the received bytes are almost equal in all the three protocols
With mobility, the Packet loss rate is low in the case of SWARM and AODV
Conclusion :
Without mobility and a low rate of traffic (as in this experiment), SWARM routing performed well. But, with mobility, all three protocols gave almost equal throughput. As I mentioned in the very first paragraph, if you try to use SWARM routing under highly mobile and try to send much data which will consume much bandwidth, then the performance of the SWARM routing will become very worst. Some of the papers that you see in literature may try to hide this fact.
So, if we use SWAM in a network without mobility (such as sensor network) and with suitably less traffic condition, then SWAM may compete with some of the existing MANET routing protocols