# Defining Optionsset rp AODV;# routing protocolset llLL;# link layer typeset macMac/802_11;# MAC typeset ifqQueue/DropTail/PriQueue;# interface queue typeset ifqlen50;# max packet in ifqset antAntenna/OmniAntenna;# antenna model
set propPropagation/TwoRayGround; # radio-propagation model
set netifPhy/WirelessPhy; # network interface type
set chanChannel/WirelessChannel; # channel type
set val(x)1000; # X dimension of topography
set val(y)1000; # Y dimension of topography
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
set ns [new Simulator] ; # Simulator instance
# Creating nodes with this Configuration
$ns node-config -adhocRouting $rp \
-llType $ll \
-macType $mac \
-ifqType $ifq \
-ifqLen $ifqlen \
-antType $ant \
-propType $prop \
-phyType $netif \
-channelType $chan \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON
set totalNodes 50 ;#Total Number of nodes in the network
for {set i 0} {$i < $totalNodes } { incr i } {
set node_($i) [$ns node]
}