nam file is empty
i create a simple wireless scenerio in ns2
simulator version ns2.35
ubuntu 12.04
i m new to ns2, trying to create a simple tcl script but nam dosnt even shows nodes
here is my tcl script
set val(chan) Channel/WirelessChannel ;# channel type
set val(prop) Propagation/TwoRayGround ;# radio-propagation model
set val(ant) Antenna/OmniAntenna ;# Antenna type
set val(ll) LL ;# Link layer type
set val(ifq) Queue/DropTail/PriQueue ;# Interface queue type
set val(ifqlen) 50 ;# max packet in ifq
set val(netif) Phy/WirelessPhy ;# network interface type
set val(mac) Mac/802_11 ;# MAC type
set val(nn) 5 ;# number of mobilenodes
set val(rp) DSR ;# routing protocol
set val(x) 800
set val(y) 800
set ns [new Simulator]
set f [open wsn1.tr w]
$ns trace-all $f
set namtrace [open 5nodes.nam w]
$ns namtrace-all-wireless $namtrace $val(x) $val(y)
set topo [new Topography]
$topo load_flatgrid 800 800
create-god $val(nn)
set chan_1 [new $val(chan)]
$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 OFF \
-routerTrace ON \
-macTrace ON \
-movementTrace OFF \
-channel $chan_1
proc finish {} {
global ns f namtrace
$ns flush-trace
close $namtrace
exec nam 5nodes.nam &
exit 0
}
#for {set i 0} {$i < $val(nn) } { incr i } {
# set n($i) [$ns node]
#}
set n0 [ns node]
$n0 set X_ 76.998
$n0 set Y_ 417.21
$n0 set Z_ 0.0
set n1 [ns node]
$n1 set X_ 73.375
$n1 set Y_ 563.431
$n1 set Z_ 0.0
set n2 [ns node]
$n2 set X_ 69.6029
$n2 set Y_ 431.775
$n2 set Z_ 0.0
set n3 [ns node]
$n3 set X_ 62.2278
$n3 set Y_ 313.445
$n3 set Z_ 0.0
set n4 [ns node]
$n4 set X_ -81.7832
$n4 set Y_ 294.637
$n4 set Z_ 0.0
#for {set i 0} {$i < $val(nn)} { incr i } {
# $ns initial_node_pos $n($i) 35
#}
set tcp0 [new Agent/TCP]
$ns attach-agent $n0 $tcp0
set tcp1 [new Agent/TCP]
$ns attach-agent $n1 $tcp1
set tcp2 [new Agent/TCP]
$ns attach-agent $n2 $tcp2
set tcp3 [new Agent/TCP]
$ns attach-agent $n3 $tcp3
set tcp4 [new Agent/TCP]
$ns attach-agent $n4 $tcp4
set cbr0 [new Application/Traffic/CBR]
$cbr0 set packetSize_ 500
$cbr0 set interval_ 0.05
$cbr0 attach-agent $tcp0
#$udp0 set class_ 1
set cbr1 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.05
$cbr1 attach-agent $tcp1
#$udp1 set class_ 2
set cbr2 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.05
$cbr1 attach-agent $tcp2
set cbr3 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.05
$cbr1 attach-agent $tcp3
set cbr4 [new Application/Traffic/CBR]
$cbr1 set packetSize_ 500
$cbr1 set interval_ 0.05
$cbr1 attach-agent $tcp4
set sink0 [new Agent/LossMonitor]
set sink1 [new Agent/LossMonitor]
set sink2 [new Agent/LossMonitor]
set sink3 [new Agent/LossMonitor]
set sink4 [new Agent/LossMonitor]
$ns attach-agent $n0 $sink0
$ns attach-agent $n1 $sink1
$ns attach-agent $n2 $sink2
$ns attach-agent $n3 $sink3
$ns attach-agent $n4 $sink4
$ns connect $tcp0 $sink0
$ns connect $tcp1 $sink1
$ns connect $tcp2 $sink2
$ns connect $tcp3 $sink3
$ns connect $tcp4 $sink4
$ns at 0.5 "$cbr0 start"
$ns at 1.0 "$cbr1 start"
$ns at 4.0 "$cbr0 stop"
$ns at 4.5 "$cbr1 stop"
$ns at 5.0 "finish"
$ns run
please help
|