here is the file centroid_802_11.tcl
# Generated by Topology Generator for Network Simulator (c) CENTROID
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) 9 ;# number of mobilenodes
set val(rp) CENTROID ;# protocol type
set val(x) 1000 ;# X dimension of topography
set val(y) 1000 ;# Y dimension of topography
set val(stop) 100 ;# simulation period
set ns [new Simulator]
$ns use-scheduler Heap
set tracefd [open centroid-802-11.tr w]
set namtrace [open centroid-802-11.nam w]
$ns trace-all $tracefd
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
# set up topography object
set topo [new Topography]
$topo load_flatgrid $val(x) $val(y)
create-god $val(nn)
# 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) \
-channel [new $val(chan)] \
-topoInstance $topo \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF \
for {set i 0} {$i < $val(nn) } { incr i } {
set mnode_($i) [$ns node]
$mnode_($i) random-motion 0
}
# Position of Anchor 1
$mnode_(0) set X_ 150.00
$mnode_(0) set Y_ 200.00
$mnode_(0) set Z_ 0.0
$mnode_(0) label "Anchor1"
# Position of Anchor 2
$mnode_(1) set X_ 480.00
$mnode_(1) set Y_ 500.00
$mnode_(1) set Z_ 0.0
$mnode_(1) label "Anchor2"
# Position of Anchor 3
$mnode_(2) set X_ 980.00
$mnode_(2) set Y_ 150.00
$mnode_(2) set Z_ 0.0
$mnode_(2) label "Anchor3"
# Position of Node 1
$mnode_(3) set X_ 300.00
$mnode_(3) set Y_ 350.00
$mnode_(3) set Z_ 0.0
# Position of Node 2
$mnode_(4) set X_ 400.00
$mnode_(4) set Y_ 250.00
$mnode_(4) set Z_ 0.0
# Position of Node 3
$mnode_(5) set X_ 520.00
$mnode_(5) set Y_ 300.00
$mnode_(5) set Z_ 0.0
# Position of Node 4
$mnode_(6) set X_ 620.00
$mnode_(6) set Y_ 180.00
$mnode_(6) set Z_ 0.0
# Position of Node 5
$mnode_(7) set X_ 720.00
$mnode_(7) set Y_ 210.00
$mnode_(7) set Z_ 0.0
# Position of Node 6
$mnode_(8) set X_ 920.00
$mnode_(8) set Y_ 230.00
$mnode_(8) set Z_ 0.0
#start sending beacon message
$ns at 0.0 "[$mnode_(0) set ragent_] anchor"
#start sending beacon message
$ns at 0.0 "[$mnode_(1) set ragent_] anchor"
#start sending beacon message
$ns at 0.0 "[$mnode_(2) set ragent_] anchor"
for {set i 0} {$i < $val(nn)} { incr i } {
$ns initial_node_pos $mnode_($i) 5
}
# Telling nodes when the simulation ends
for {set i 0} {$i < $val(nn) } { incr i } {
$ns at $val(stop) "$mnode_($i) reset;"
}
# ending nam and the simulation
$ns at $val(stop) "$ns nam-end-wireless $val(stop)"
$ns at $val(stop) "stop"
$ns at [expr $val(stop) + 0.01] "puts "end simulation"; $ns halt"
proc stop {} {
global ns tracefd namtrace
$ns flush-trace
close $tracefd
close $namtrace
#exec nam dvhop-802-11.nam &
}
$ns run
|