LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (http://www.linuxquestions.org/questions/linux-software-2/)
-   -   ns-2.34 problem executing 'nam' on ubuntu 9.10 (http://www.linuxquestions.org/questions/linux-software-2/ns-2-34-problem-executing-nam-on-ubuntu-9-10-a-840509/)

ElijahJ 10-26-2010 08:54 AM

ns-2.34 problem executing 'nam' on ubuntu 9.10
 
I successfully installed and validate ns-allinone-2.34 network simulator on ubuntu-9.10. I then tried to run simple tcl code and ended up on the following error. I couldn't move ahead from there. What should I do to make 'nam(version 1.14)' work on my ubuntu 9.10???? Thanks in advance


ns: finish: couldn't execute "nam": no such file or directory
while executing
"exec nam out.nam &"
(procedure "finish" line 7)
invoked from within
"finish"


Here is the code I tried to run (for reference):

#Create a simulator object
set ns [new Simulator]
#Define different colors for data flows (for NAM)
$ns color 1 Blue
$ns color 2 Red
#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 NAM trace file
close $nf
#Execute NAM on the trace file
exec nam out.nam &
exit 0
}

#Create four nodes
set n0 [$ns node]
set n1 [$ns node]
set n2 [$ns node]
set n3 [$ns node]
#Create links between the nodes
$ns duplex-link $n0 $n2 2Mb 10ms DropTail
$ns duplex-link $n1 $n2 2Mb 10ms DropTail
$ns duplex-link $n2 $n3 1.7Mb 20ms DropTail
#Set Queue Size of link (n2-n3) to 10
$ns queue-limit $n2 $n3 10
#Give node position (for NAM)
$ns duplex-link-op $n0 $n2 orient right-down
$ns duplex-link-op $n1 $n2 orient right-up
$ns duplex-link-op $n2 $n3 orient right
#Monitor the queue for link (n2-n3). (for NAM)
$ns duplex-link-op $n2 $n3 queuePos 0.5
#Setup a TCP connection
set tcp [new Agent/TCP]
$tcp set class_ 2
$ns attach-agent $n0 $tcp
set sink [new Agent/TCPSink]
$ns attach-agent $n3 $sink
$ns connect $tcp $sink
$tcp set fid_ 1
#Setup a FTP over TCP connection
set ftp [new Application/FTP]
$ftp attach-agent $tcp
$ftp set type_ FTP
#Setup a UDP connection
set udp [new Agent/UDP]
$ns attach-agent $n1 $udp
set null [new Agent/Null]
$ns attach-agent $n3 $null
$ns connect $udp $null
$udp set fid_ 2
#Setup a CBR over UDP connection
set cbr [new Application/Traffic/CBR]
$cbr attach-agent $udp
$cbr set type_ CBR
$cbr set packet_size_ 1000
$cbr set rate_ 1mb
$cbr set random_ false
#Schedule events for the CBR and FTP agents
$ns at 0.1 "$cbr start"
$ns at 1.0 "$ftp start"
$ns at 4.0 "$ftp stop"
$ns at 4.5 "$cbr stop"
#Detach tcp and sink agents (not really necessary)
$ns at 4.5 "$ns detach-agent $n0 $tcp ; $ns detach-agent $n3 $sink"
#Call the finish procedure after 5 seconds of simulation time
$ns at 5.0 "finish"
#Print CBR packet size and interval
puts "CBR packet size = [$cbr set packet_size_]"
puts "CBR interval = [$cbr set interval_]"
#Run the simulation
ns run


By the way I googled and got some suggestions like: adding 'nam' directory to environment. I did this as follow but it didn't work:
I added:
export PATH=$PATH:/home/elias/ns-allinone-2.34/nam-1.14
to /etc/profile (>sudo gedit /etc/profile)

knudfl 11-19-2010 02:26 AM

Welcome to LQ.

The most easy way to have a 'nam' in your path is :
cd ns-allinone-2.34/nam-1.14/
sudo make install

Which will do one thing: Copying the executable nam to /usr/local/bin/.
.. Then you have it in a system path.

( The same is valid for ns-allinone-2.34/ns-2.34/ ,
to get /usr/local/bin/ns ).
..

yotta15 04-10-2012 06:32 AM

Error when executing a tcl file in ns-2.29
 
Hello knudfl ,

I installed Ns-2.29 with Nist mobility Package in ubuntu 9.10.
the ./install and ./validate were successful.
But when I want to test an example (ns example1a.tcl) I got the same error like ElijahJ

ns: finish: couldn't execute "nam": no such file or directory
while executing
"exec nam out.nam &"
(procedure "finish" line 7)
invoked from within
"finish"

I tried what you said but it doesn't work !! It seems like nam is not installed or what ?

root@charifa-laptop:~/Bureau/Install2/ns-allinone-2.29/nam-1.11# make install
/usr/bin/install -c -m 555 -o bin -g bin nam /usr/local/bin
/usr/bin/install: impossible d'évaluer «nam»: Aucun fichier ou dossier de ce type
make: *** [install] Erreur 1

Can you help me plz ,
thanks a lot,

knudfl 04-10-2012 06:57 AM

Nam is a separate application : Any nam can be used.
The best version is 1.14 : Please see post #4 here ...
http://www.linuxquestions.org/questi...04-a-842109/#4

Unpack nam-1.14.<arch>.tar.gz, and copy 'nam' to /usr/local/bin/
... Then you have nam in a system PATH.

.

Riaz Khan 04-19-2012 01:44 PM

thanks, nam is working now and xgraph as well.
Now tell me how to patch mobiwan with ns-2.33.

masju 04-20-2012 02:28 AM

Hi Riaz, #5
I don't know whether you have got my invitation mail. Anyway I thing I will be able to say the
steps to install mobiwan patch in ns-2.33.
First keep the patch file in the folder ns-2.33 within ns-allinone-2.33
then go to that folder ie cd ns-allinone-2.33/ns-2.33
write the command: "patch -p1 < ns-233-mobiwan-1.patch"
write the command: ./configure
write the command: make clean
write the command: make

that's all
then run the simple tcl script.

Riaz Khan 04-22-2012 03:49 AM

now when i run any tcl script it givess me an error :

[riaz@riaz new_project]$ ns packetsend.tcl
can't read "EnableHierRt_": no such variable
(Object set line 1)
invoked from within
"Simulator set EnableHierRt_"
(procedure "_o10" line 10)
(Node attach line 10)
invoked from within
"$node attach $agent"
(procedure "_o3" line 2)
(Simulator attach-agent line 2)
invoked from within
"$ns_ attach-agent $n0 $udp0"
(file "packetsend.tcl" line 18)
[riaz@riaz new_project]$


please tell me how to resolve this problem

shama123 05-20-2014 05:08 AM

ns: finish: couldn't execute "nam-1.14": no such file or directory
 
I was installed ns-allinone-2.34. when i try to run tcl script i was got below error message

ns: finish: couldn't execute "nam-1.14": no such file or directory
while executing
"exec nam-1.14 out.nam &"
(procedure "finish" line 5)
invoked from within
"finish"

I was used below sample script,

set ns [new Simulator]

set nf [open out.nam w]
$ns namtrace-all $nf

proc finish {} {
global ns nf
$ns flush-trace
close $nf
exec nam-1.14 out.nam &
exit 0
}

$ns at 5.0 "finish"

$ns run


I have nam-1.14 folder inside my ns-allinone-2.34 folder. But i'm getting this error message. Plz help me anyone :confused:

knudfl 05-20-2014 07:30 AM

Post #8, @shama123 : Welcome to LQ.
Quote:

exec nam-1.14 out.nam &
exit 0
Looks like a home made tcl script.

Just edit "exec nam-1.14 out.nam &" to :
exec nam out.nam &

... and the unknown tcl script may work : If you have a usable 'nam'.

-

shama123 05-21-2014 01:24 AM

Thank you about your reply
 
I was chanced nam-1.14 to nam. But still i'm getting the same error message

ns: finish: couldn't execute "nam": no such file or directory
while executing
"exec nam out.nam &"
(procedure "finish" line 5)
invoked from within
"finish"

knudfl 05-21-2014 04:15 AM

# 10 .

OK. No nam.

There are nam packages for Fedora. Which Fedora ?
Please show the outputs from these commands :
a) uname -m
b) cat /etc/redhat-release

-

shama123 05-21-2014 10:44 AM

My nam is now working
 
Thank you very much for your reply. I was removed my ns-allinone-2.34 folder and re-installed it. Now all are working perfectly. :cool: I think previously my nam is not installed correctly. I given the path of nam wrongly in .bashrc file. Now all are good. Thanx all!!!

shama123 06-02-2014 08:32 AM

Get the Bandwidth of a link in olsr
 
If i need to get the Bandwidth of a link to calculate other values, how can i get in in ns2 using olsr?
There are set of nodes in MANET and need to get the Bandwidth to calculate Connectivity Index. Can someone help me to find this. If you know how to do c++ coding for calculate Connectivity Index that will be helpful to me


All times are GMT -5. The time now is 08:59 PM.