Hi,
I am working in wireless scenario and if i try to run a script for
xgraph it ll shows error. pls check where the error in the following
code and correct it.
THE CODE
========
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagati
set val(netif) Phy/WirelessPhy ;# network interfac
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) 2 ;# number o
set val(rp) DSR ;# routing protocol
set ns_ [new Simulator]
set tracefd [open simple1.tr w]
$ns_ trace-all $tracefd
set topo [new Topography]
$topo load_flatgrid 500 500
set f0 [open out0.tr w]
proc finish {} {
global f0
close $f0
exec xgraph out0.tr -geometry 800x400 &
exit 0
}
proc attach-expoo-traffic { node sink size burst idle rate } {
#Get an instance of the simulator
set ns_ [Simulator instance]
#Create a UDP agent and attach it to the node
set source [new Agent/UDP]
$ns_ attach-agent $node $source
#Create an Expoo traffic agent and set its configuration parameters
set traffic [new Application/Traffic/Exponential]
$traffic set packetSize_ $size
$traffic set burst_time_ $burst
$traffic set idle_time_ $idle
$traffic set rate_ $rate
# Attach traffic source to the traffic generator
$traffic attach-agent $source
#Connect the source and the sink
$ns_ connect $source $sink
return $traffic
}
proc record {} {
global sink0 f0
set ns_ [Simulator instance]
set time 0.5
set bw0 [$sink0 set bytes_]
set now [$ns_ now]
puts $f0 "$now [expr $bw0/$time*8/1000000]"
$sink0 set bytes_ 0
$ns_ at [expr $now+$time] "record"
}
create-god $val(nn)
$ns_ node-config -channel [new $val(chan)] \
-adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-topoInstance $topo \
-propType $val(prop) \
-phyType $val(netif) \
-agentTrace ON \
-routerTrace ON \
-macTrace OFF \
-movementTrace OFF
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) random-motion 0
}
#$ns_ duplex-link $node_(0) $node_(1) 1Mb 100ms DropTail
set sink0 [new Agent/LossMonitor]
$ns_ attach-agent $node_(1) $sink0
$node_(0) set X_ 5.0
$node_(0) set Y_ 2.0
$node_(0) set Z_ 0.0
$node_(1) set X_ 390.0
$node_(1) set Y_ 385.0
$node_(1) set Z_ 0.0
$ns_ at 5.0 "$node_(1) setdest 25.0 20.0 15.0"
$ns_ at 1.0 "$node_(0) setdest 20.0 18.0 1.0"
$ns_ at 10.0 "$node_(1) setdest 490.0 480.0 15.0"
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at 15.0 "$node_($i) reset";
}
set source [attach-expoo-traffic $node_(0) $sink0 200 2s 1s 100k]
#set source [attach-expoo-traffic $node_(0) $node_(1) 200 2s 1s 100k]
$ns_ at 5.0 "$source start"
$ns_ at 10.0 "$source stop"
$ns_ at 0.0 "record"
$ns_ at 10.0 "finish"
$ns_ at 10.0001 "stop"
$ns_ at 10.0002 "puts \"NS EXITING...\" ; $ns_ halt"
proc stop {} {
global ns_ tracefd
$ns_ flush-trace
close $tracefd
}
puts "Starting Simulation..."
$ns_ run
I am very grateful if u send me any sample code for generating xgraph for
wireless simulation.
Thank you,
G.PRabhu
-----------------------------------------
This email was sent using TCEMail Service.
Thiagarajar College of Engineering
Madurai - 625015 (India)