Experiment 6: Aim:-Program To Implement Wireless Topology
Experiment 6: Aim:-Program To Implement Wireless Topology
Experiment 6: Aim:-Program To Implement Wireless Topology
# 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 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) 3 ; # number of mobile nodes
set val(rp) DSDV ; # 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
# create a topology object that keeps track of movements of mobilenodes within the
topological boundary.
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
#create god object contains real time positions of all the nodes created so that connectivity
is maintained
create-god $val(nn)
# Create nn mobilenodes [$val(nn)] and attach them to the channel.
# 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
# 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"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
Output:-
Start:-
Midway:-
End:-