LinuxQuestions.org
Visit Jeremy's Blog.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Software
User Name
Password
Linux - Software This forum is for Software issues.
Having a problem installing a new program? Want to know which application is best for the job? Post your question in this forum.

Notices

Reply
 
Search this Thread
Old 03-30-2012, 03:20 AM   #1
khedidja
LQ Newbie
 
Registered: Mar 2012
Posts: 7

Rep: Reputation: Disabled
Question how to add a nam file on leach protocol


Hello,

I am working with leach protocol, and I need to visualise the simulation with nam simulator, so I add this code on tcl/ex/wireless.tcl to generate leach.nam:

proc ns-nam { ttype atype node } {
global ns_ namtrace

if { $namtrace == "" } {
return ""
}
set N [new NamSimulator/$ttype $atype]
$N target [$ns_ set nullAgent_]
$N attach $namtrace
$N set src_ [$node id]

$N node $node

return $T
}


set namtrace [open leach.nam w]
$ns_ namtrace-all-wireless $namtrace $opt(x) $opt(y)


puts $namtrace "M 0.0 nn $opt(nn) x $opt(x) y $opt(y) rp $opt(rp)"
puts $namtrace "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
puts $namtrace "M 0.0 prop $opt(prop) ant $opt(ant)"


but, leach.nam contain only :
M 0.0 nn 101 x 1000 y 1000 rp leach
M 0.0 sc mit/uAMPS/sims/scen1000 cp none seed 0.0
M 0.0 prop Propagation/TwoRayGround ant Antenna/OmniAntenna
V -t * -v 1.0a5 -a 0
W -t * -x 1000 -y 1000
A -t * -n 1 -p 0 -o 0xffffffff -c 31 -a 1
A -t * -h 1 -m 2147483647 -s 0




please, help me. I need that
 
Old 07-06-2012, 03:14 AM   #2
shimpisagar
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
Hi khedidja,

are you able to generate Nam file for leach ??? or still not?
 
Old 07-06-2012, 03:20 AM   #3
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655Reputation: 655
Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your question get the exposure it deserves.
 
Old 07-06-2012, 04:47 AM   #4
shimpisagar
LQ Newbie
 
Registered: May 2012
Posts: 2

Rep: Reputation: Disabled
Thanks
 
Old 03-14-2013, 11:00 AM   #5
sweetgrl07
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
how to generate leach.nam

still i am not able to run leach.nam in tcl/wireless.tcl
what should i do for run nam also??
 
Old 03-14-2013, 01:40 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,157

Rep: Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643
There is a "nam section" in this 'tcl/wireless.tcl' from
the additional module "pegasis/leach" > exidus-pegasis_ns-234-leach.tar.gz

wireless.tcl, line 224 :
Code:
# try for setup output nam file
set nam_vystup		[open $opt(rp).nam w]		  
$ns_ namtrace-all-wireless $nam_vystup $opt(x) $opt(y)
# end
Download link https://docs.google.com/file/d/0B7S2...it?usp=sharing

Info, #5 here http://www.linuxquestions.org/questi...-ns2-940394/#5
→ → ""with this extension it is possible to
simulate protocols LEACH, LEACH-C, Stat-Clus, MTE and PEGASIS""

And #289 here http://www.linuxquestions.org/questi...68/page20.html
# 425 http://www.linuxquestions.org/questi...68/page29.html
... And there may be more relevant info in posts between #289 and #425.

-

Last edited by knudfl; 03-14-2013 at 04:53 PM.
 
1 members found this post helpful.
Old 03-15-2013, 01:28 AM   #7
sweetgrl07
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
thanks dear

i am able to generate dsdv.nam file but nam is not open through which i can see my simulation. i want to open nam to see the simulation on graph but its only generated dsdv.nam file. please help me
 
Old 03-15-2013, 03:58 AM   #8
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,157

Rep: Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643
Post # 7.

What has dsdv to do with the thread subject "LEACH" ?
And you cannot get "dsdv.nam" from nothing ?
Some more information, please. File names, commands etc. (dsdv.tcl ?)
http://www.linuxquestions.org/linux/...Ask_a_Question
http://linuxsilo.net/docs/smart-questions_en.html


-

Last edited by knudfl; 03-15-2013 at 04:02 AM.
 
1 members found this post helpful.
Old 03-15-2013, 05:24 AM   #9
sweetgrl07
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
thanks knudfl

dsdv.nam is generated because in set properties i use dsdv algorithm now i m change with leach and this error occurs

@ubuntu:~/ns-allinone-2.35/ns-2.35/exidus_ns-234-leach/tcl/ex$ ns wireless.tcl
num_nodes is set 51
invalid command name "leach-create-mobile-node"
while executing
"leach-create-mobile-node $i"
invoked from within
"if { [string compare $opt(rp) "dsr"] == 0} {
for {set i 0} {$i < $opt(nn) } {incr i} {
dsr-create-mobile-node $i
}
} elseif { [string compare $op..."
(file "wireless.tcl" line 254)
@ubuntu:~/ns-allinone-2.35/ns-2.35/exidus_ns-234-leach/tcl/ex$

this error was occuring while executing the leach.
and dsdv.nam is generated because in set properties i use dsdv algorithm now i m change with leach and this error occurs

Last edited by sweetgrl07; 03-15-2013 at 05:25 AM.
 
Old 03-15-2013, 03:24 PM   #10
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,157

Rep: Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643
# 9 .

The idea with the 'Pegasis--leach' is (like other additional protocols)
to compile the .cc files into the executable 'ns'.

I have repacked the 'exidus-pegasis--leach' to be easier to use.
The new package name is exidus-pegasis-leach-ns234.patch.tar.gz .
Link https://docs.google.com/file/d/0B7S2...it?usp=sharing

Install : tar xvf ns-allinone-2.34.tar.gz
cd ns-allinone-2.34/
tar xvf exidus-pegasis-leach-ns234.patch.tar.gz
export CC=gcc41 CXX=g++41
./install

Note 1: The files do not work in ns-2.35 .
Note 2: The new 'wireless.tcl' can be be run like :
$ ./ns wireless.tcl -x 20 -y 20

-

Last edited by knudfl; 03-15-2013 at 03:52 PM.
 
Old 03-17-2013, 09:43 AM   #11
sweetgrl07
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
hello sir
i have installed ns2.34 and thn run your peagisis pakcage but still this error occur

~/ns-allinone-2.34/ns-2.34/leach-ns234/tcl/ex$ ns wireless.tcl -x 20 -y 20
num_nodes is set 51
invalid command name "leach-create-mobile-node"
while executing
"leach-create-mobile-node $i"
invoked from within
"if { [string compare $opt(rp) "dsr"] == 0} {
for {set i 0} {$i < $opt(nn) } {incr i} {
dsr-create-mobile-node $i
}
} elseif { [string compare $op..."
(file "wireless.tcl" line 254)

and still i am not able to open nam please help me sir

Last edited by sweetgrl07; 03-17-2013 at 09:45 AM.
 
Old 03-17-2013, 10:05 AM   #12
sweetgrl07
LQ Newbie
 
Registered: Feb 2013
Posts: 9

Rep: Reputation: Disabled
first i install ns2.34
then add your exidus-pegasis-leach-ns234.patch.tar.gz then run its gives above error
then i again try to give command of ./install
then in installation it gives this error ehat should i doo??

Warning: tclStubInit.c may be out of date.
Developers may want to run "make genstubs" to regenerate.
This warning can be safely ignored, do not report as a bug!
Installing libtcl8.4.a to /home/sweetgrl07/ns-allinone-2.34/lib/
cp: cannot create regular file `/home/sweetgrl07/ns-allinone-2.34/lib/#inst.24467#': Permission denied
rm: cannot remove `/home/sweetgrl07/ns-allinone-2.34/lib/libtcl8.4.a': Permission denied
mv: cannot stat `/home/sweetgrl07/ns-allinone-2.34/lib/#inst.24467#': No such file or directory
ranlib: could not create temporary file whilst writing archive: No more archived files
make: *** [install-binaries] Error 1
tcl8.4.18 installation failed.
Tcl is not part of the ns project. Please see www.Scriptics.com
to see if they have a fix for your platform.
---------- Post added 03-17-13 at 07:36 PM ----------

Last edited by sweetgrl07; 03-17-2013 at 11:05 AM.
 
Old 03-18-2013, 06:03 AM   #13
D23
LQ Newbie
 
Registered: Mar 2013
Posts: 6

Rep: Reputation: Disabled
i installed leach on ns2.34 and ./test working fine and output is also coming right in leach.out but when i tried to run wireless.tcl file then i got following

pratibha@ubuntu:~/ns2/ns-allinone-2.34/ns-2.34/tcl/ex$ ns wireless.tcl
couldn't read file "tcl/lib/ns-mobilenode.tcl": no such file or directory
while executing
"source.orig tcl/lib/ns-mobilenode.tcl"
("uplevel" body line 1)
invoked from within
"uplevel source.orig[list $fileName]"
invoked from within
"if [$instance_ is_http_url $fileName] {
set buffer [$instance_ read_url $fileName]
uplevel eval $buffer
} else {
uplevel source.orig[list $fileName]
..."
(procedure "source" line 8)
invoked from within
"source tcl/lib/ns-mobilenode.tcl"
(file "wireless.tcl" line 184)
i changed path of ns-mobilenode by giving full path but after that ./test gives error no such file or directory..
please help me asap...
thanx in advance..
 
Old 03-18-2013, 06:37 AM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,157

Rep: Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643
Post # 13, @D23 : Welcome to LQ.

"wireless.tcl" can be run with './test' in ns-allinone-2.34/ns-2.34/.

If you want to run 'ns wireless.tcl' in ns-2.34/tcl/ex/ :
cd ns-2.34/tcl/ex/
mkdir tcl
cd tcl/
ln -s ../../mobility/
ln -s ../../lib/
cd ../
Then you can do : ns wireless.tcl -x 1000 -y 1000
.. or / and whatever options you want to use.

Please see 'leach_test' (line 37) to know the options used when ./test is run.

-

Last edited by knudfl; 03-18-2013 at 06:40 AM.
 
Old 03-18-2013, 06:55 AM   #15
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014.08, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 14,157

Rep: Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643Reputation: 2643
Post # 13, @sweetgrl07 : Which Ubuntu version are you using ? ?

About your errors : If you ever use 'sudo' with any ns2 command,
( like sudo tar xvf ns-allinone-* ) :
You will have no access to all files as unprivileged user,
i.e. the message "Permission denied" will appear.
And you will have to delete everything and start from scratch.


The install command is not really plain ./install, but :
export CC=gcc-4.1 CXX=g++-4.1 && ./install
( The gcc / g++ naming will vary with Ubuntu version :
Ubuntu 10.04 : like the above. Ubuntu 12.04 example : gcc41/g++41 ).

-
 
  


Reply

Tags
leach, ns2, pegasis


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Leach Protocol for ns2.34 pushpita Linux - Software 36 07-08-2013 05:06 AM
SPIN and LEACH protocol in NS-2 shanky Linux - General 17 05-26-2012 01:03 PM
Leach protocol anitha.r.u Linux - Newbie 16 04-02-2012 05:37 AM
energy in leach protocol !! shanky Linux - Software 1 03-19-2012 07:30 AM
protocol leach ezzati Linux - Newbie 5 05-03-2011 09:42 PM


All times are GMT -5. The time now is 04:50 PM.

Main Menu
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration