WIRELESS COMMUNICATION
Presented By
Vinithra .J
10MIT0056
Two approaches for wireless
communication
• Centralized cellular network wherein each
mobile is connected to a base station.
• Decentralized approach for Ad-Hoc network.
• We are going to implement ADHOC Network
Tool Used: Network Simulator-2
Protocols available in ns-2
• DSDV
• TORA
• DSR
• AODV
For implementing other routing protocols
patches will be available ->Download -> Patch
using command . Now protocol is ready to use.
Demonstration of sample wireless tcl
# 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
• 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) DSDV ;# routing protocol
• set val(stop) 50 ;#end of simulation
• set val(x) 500 ;#X dimension of topology
• Set val(y) 500 ;#Y dimension of topology
Initialize the global variables and files
required.
set ns [new Simulator]
set tracefd [open dsdv3node.tr w]
set namfd [open dsdv.nam w]
$ns trace-all $tracefd
$ns namtrace-all $namfd [even you can give the X and Y limit as
$val(x) $val(y)]
#set up topography object
set topo [new Topography]
$topo load_faltgrid $val(x) $val(y) (means Flat topology as explained in
theory)
#create-god file
create-god $val(nn)
Configuration of 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\
Creation of nodes
for {set i 0} {$i < val(nn) } {incr i} {
set node($i) [$ns node]
}
(or)
set node0 [$ns node]
set node1 [$ns node]
set node2 [$ns node]
provide initial location of mobiles
$node0 set X_ 10.0
$node0 set Y_ 10.0
$node0 set Z_ 0.0
[likewise for all nodes]
[yet another method is available called
”setdest” for defining position for more num
of nodes]
Now produce some simple node
movements
$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"
$ns at 25.0 "$node(2) setdest 490.0 480.0 15.0"
Setup traffic flow between nodes
set tcp [new Agent/TCP]
$tcp set class_ 2
set sink [new Agent/TCPSink]
$ns attach-agent $node(0) $tcp
$ns attach-agent $node(2) $sink
$ns connect $tcp $sink
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ns at 5.1 "$ftp start"
Tell nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
$ns at 50.0 "$node($i) reset";
}
$ns at 50.0 "stop"
$ns at 10.01 "puts \"NS EXITING...\" ; $ns halt"
Call the stop method to end the
simulation
proc stop {} {
global ns tracefd
$ns flush-trace
close $tracefd
close $namfd
exec nam dsdv.nam &
exit 0
}
puts "Starting Simulation..."
$ns run
Trace file Format
• Goto 116 of ns manual
Task to be done:
Just change the protocol and take any of the
performance metric (eg:throughput) and draw
the xgraph for DSDV,DSR,AODV protocol.
Thankyou
• Any Queries????