LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   ns2 nam console empty with no nodes (https://www.linuxquestions.org/questions/programming-9/ns2-nam-console-empty-with-no-nodes-4175552946/)

um3 09-08-2015 02:05 PM

ns2 nam console empty with no nodes
 
Hello ns2 experts,

What may be possibly wrong with this program?? I am getting empty nam console without any nodes seen. Also while running the program, I am getting "node is not defined" for a million times on my unix console.
Trace and NAM trace files seems to be fine

Please look.

I am using NS2.35 on ubuntu 14.04, 64 bit OS

THank You


Code:

Mac/802_11 set RTSThreshold_ 3000
Mac/802_11 set dataRate_ 2.0e6

set ns_ [new Simulator]
set nt [open impatientns2.tr w]
set nm [open impatientns2.nam w]
$ns_ trace-all $nt
$ns_ namtrace-all-wireless $nm 100 100

proc finish {} {
        global ns_ nt nm
        $ns_ flush-trace
        close $nt
        close $nm
        exec nam impatientns2.nam
        exit 0
}


set topo [new Topography]
$topo load_flatgrid 100 100

$ns_ node-config        -adhocRouting DumbAgent \
                        -llType LL \
                        -macType Mac/802_11 \
                        -ifqType Queue/DropTail/PriQueue \
                        -ifqLen 50 \
                        -antType Antenna/OmniAntenna \
                        -propType Propagation/FreeSpace \
                        -phyType Phy/WirelessPhy \
                        -channelType Channel/WirelessChannel \
                        -topoInstance $topo \
                        -agentTrace ON \
                        -routerTrace ON \
                        -macTrace ON \
                        -movementTrace ON

create-god 2


set WT(1) [$ns_ node]
set WT(2) [$ns_ node]

$WT(1) set X_ 10.0
$WT(1) set Y_ 10.0
$WT(1) set Z_ 0.0

$WT(2) set X_ 20.0
$WT(2) set Y_ 20.0
$WT(2) set Z_ 0.0

set udp(1) [new Agent/UDP]
$ns_ attach-agent $WT(1) $udp(1)
set sink(1) [new Agent/Null]
$ns_ attach-agent $WT(2) $sink(1)
$ns_ connect $udp(1) $sink(1)

set cbr(1) [new Application/Traffic/CBR]
$cbr(1) set packetSize_ 1000
$cbr(1) set interval_ 0.005
$cbr(1) attach-agent $udp(1)
$ns_ at 2 "$cbr(1) start"
$ns_ at 5 "$cbr(1) stop"


$ns_ at 5.1 "finish"
$ns_ run


um3 09-08-2015 09:51 PM

I someone fixed the issue.. I need to set
$ns_ initial_node_pos $WT(1) 30
$ns_ initial_node_pos $WT(2) 30


All times are GMT -5. The time now is 03:21 AM.