Number Choosen: Performed Experiment: Wireless Network Practical Exam Aim: Ns2 Script
Number Choosen: Performed Experiment: Wireless Network Practical Exam Aim: Ns2 Script
: 10 XIEEXTC131444
#
==================================================================
====
# Define options
#
==================================================================
====
set val(chan) Channel/WirelessChannel ;# Channel Type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(netif) Phy/WirelessPhy/802_15_4
set val(mac) Mac/802_15_4
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) 2 ;# number of mobilenodes
set val(rp) AODV ;# routing protocol
set val(x) 50
set val(y) 50
Ms.Shubham Gaddam Sr.No.: 10 XIEEXTC131444
if { "$val(nam)" == "2nodes.nam" } {
set namtrace [open ./$val(nam) w]
$ns_ namtrace-all-wireless $namtrace $val(x) $val(y)
}
$ns_ puts-nam-traceall {# nam4wpan #} ;# inform nam that this is a trace file for
wpan (special handling needed)
# configure node
$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) \
-topoInstance $topo \
-agentTrace ON \
-routerTrace OFF \
-macTrace ON \
-movementTrace OFF \
-energyModel "EnergyModel" \
-initialEnergy 10 \
-idlePower 0.00279 \
-rxPower 0.0565 \
-txPower 0.048 \
Ms.Shubham Gaddam Sr.No.: 10 XIEEXTC131444
-sleepPower 0.000030 \
-transitionPower 0.002 \
-transitionTime 0.0002 \
-IncomingErrProc $opt(err) \
-channel $chan_1_
# the following command is for moving the node 1. you can disable it if you dont need it.
#node 1 will start to meet at time 70 towards the cordinate(42,25) at the speed of $speed.
$speed is defined at top.
$ns_ at 70 "$node_(1) setdest 42.00 25 $speed"
proc stop {} {
global ns_ tracefd appTime val env
Ms.Shubham Gaddam Sr.No.: 10 XIEEXTC131444
$ns_ flush-trace
close $tracefd
set hasDISPLAY 0
foreach index [array names env] {
CONCLUSION: In this experiment, we have implemented the WPAN (ZigBee) using NS2
using two nodes and we have also calculated the throughput with running time.
Ms.Shubham Gaddam Sr.No.: 10 XIEEXTC131444