[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[ns] problem running nam from tcl script



Hi there,
I am rookie to ns/nam, and thus far its not been easy to get things going.
I tried running the 1st tutorial from Marc Geis but I get the following
error from nam:

nam: no display name and no $DISPLAY environment variable
Segmentation fault (core dumped)

I have included the code below:

#Create a simulator object
set ns [new Simulator]

#Open the nam trace file
set nf [open out.nam w]
$ns namtrace-all $nf

#Define a 'finish' procedure
proc finish {} {
        global ns nf
        $ns flush-trace
        #Close the trace file
        close $nf
        #Execute nam on the trace file
        exec nam out.nam &
        exit 0
}

#Create two nodes
set n0 [$ns node]
set n1 [$ns node]

#Create a duplex link between the nodes
$ns duplex-link $n0 $n1 1Mb 10ms DropTail

#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"

#Run the simulation
$ns run

-----

Thanks for your help,
ID Uko

Electrical Engineering
Undergraduate Student
McMaster University
_________________________________________________________________________
Get Your Private, Free E-mail from MSN Hotmail at http://www.hotmail.com.