LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to add a nam file on leach protocol (https://www.linuxquestions.org/questions/linux-software-2/how-to-add-a-nam-file-on-leach-protocol-937219/)

khedidja 03-30-2012 02:20 AM

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

shimpisagar 07-06-2012 02:14 AM

Hi khedidja,

are you able to generate Nam file for leach ??? or still not?

jschiwal 07-06-2012 02:20 AM

Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your question get the exposure it deserves.

shimpisagar 07-06-2012 03:47 AM

Thanks

sweetgrl07 03-14-2013 10:00 AM

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??

knudfl 03-14-2013 12:40 PM

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.

-

sweetgrl07 03-15-2013 12:28 AM

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

knudfl 03-15-2013 02:58 AM

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


-

sweetgrl07 03-15-2013 04:24 AM

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

knudfl 03-15-2013 02:24 PM

# 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

-

sweetgrl07 03-17-2013 08:43 AM

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

sweetgrl07 03-17-2013 09:05 AM

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 ----------

D23 03-18-2013 05:03 AM

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..

knudfl 03-18-2013 05:37 AM

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.

-

knudfl 03-18-2013 05:55 AM

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 ).

-

sweetgrl07 03-18-2013 08:01 AM

i am using ubuntu 12.04 version
now i hv to delete all the things and make it reinstall again ??

knudfl 03-18-2013 10:25 AM

# 16 .

If you at some stage used sudo, you will also have to use sudo for deleting:
sudo rm -r ns-allinone-2.34/

Install : Please see post # 10 : No reason to "install ns-2.34",
and then add the pegasis files. Please follow the text :
1) tar xvf ns-allinone-2.34.tar.gz
2) cd ns-allinone-2.34/
3) tar xvf exidus-pegasis-leach-ns234.patch.tar.gz
4) export CC=gcc41 CXX=g++41
5) ./install

Note : The "gcc41 / g++41" packages are mentioned here, post #3 :
http://www.linuxquestions.org/questi...-4175450625/#3
sudo dpkg -i gcc41-compat-4.1.2-ubuntu1210_i386.deb g++41-compat-4.1.2_i386.deb
... Then reboot, and the new compilers can be used.

-

D23 03-18-2013 12:23 PM

thanx a lot its working now.
i want to know how to get correct .nam file for leach
i added following code in WIRELESS.TCL

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

but in leach.nam file i am getting following output and its not working or showing simulation in nam(just empty window)

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 tell how to do correct simulation with correct output in leach.nam file asap.
thanx in advance..

knudfl 03-18-2013 01:17 PM

# 18 .

Quote:

Please tell how to do correct simulation with correct output in leach.nam
May be @deepa_2111 can answer your question ..
http://www.linuxquestions.org/questi...68/page29.html

D23 03-27-2013 12:20 AM

hi... i have installed leach on ns-2.34 on ubuntu 12.10 following all steps and it is not giving any error in leach.err but output in leach.out is incomplete as compared to original leach.out please help me. and can u upload original ns-2.34-leach.tar file without any modification in it so it wil give correct leach.out asap.. Thanx in advance

sweetgrl07 03-27-2013 12:29 AM

hii kundlf after installing and then running i got this error how i can resolve it to run leach
@ubuntu:~/ns-allinone-2.34/ns-2.34/leach/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 255)

D23 03-27-2013 12:41 AM

hi. i have installed leach on ns-2.34 and it is not giving any error in leach.err but output in leach.out is incomplete as compared to original leach.out. pls help me.also upload ns-2.34-leach.tar file as u hv used so it will not give any incomplete leach.out file as it shows no cluster head adv heard msg and there are no nodes in cluster and each node sends data to bs.there are also only one tdma file no init.energy file present in leach_sims.and all output files are incomplete every.pls help me asap.thanx in advance

D23 03-27-2013 03:08 AM

1 Attachment(s)
hi kundlf
my leach.out file is shown as below which gives incomplete output and leach.energy,leach.data are also incomplete Attachment 12144
pls help me and pls upload vali ns-2.34-leach.tar as in case u also have used and which gives all complete files
thanx in advance

knudfl 03-27-2013 05:11 AM

# 23. There is one source package only, ns-234-leach.tar.gz, post #5 here
http://www.linuxquestions.org/questi...34-a-870368/#5

An edited cmu-trace.h, #9
http://www.linuxquestions.org/questi...ra13-907076/#9

There may be other changes to cmu-trace.h, please read all posts :
http://www.linuxquestions.org/questi...2-34-a-870368/

A different and may be more complete leach ? :
exidus-pegasis-leach-ns234.patch.tar.gz, post #10
http://www.linuxquestions.org/questi...col-937219/#10

-

zafarbit 04-08-2013 09:36 PM

where to add this path

export CC=gcc41 CXX=g++41

knudfl 04-09-2013 04:00 AM

# 25, @zafarbit.

That's not a path. 'export' is a command.
Just follow the text in post #17.
I.e. type the commands in a terminal.
Like : export CC=gcc41 CXX=g++41 <Enter>

Note : You will of course have to install gcc/g++ version 4.1.2
for the command to work. See answer #2 to @zafarbit here ..
http://www.linuxquestions.org/questi...-4175457165/#2

-

littleroot 04-14-2013 10:20 AM

need your help guys, i have downloaded package exidus-pegasis-leach-ns234.patch.tar.gz by mr knudfl, can you guys teach me how to make it works? step by step?
i've installed ns-allinone-2.34 on ubuntu 10.04 already...what i must do after that? how i can run the pegasis simulation? thank you so much..still newbee here..thank you..email me please..thx

i've installed ns 2.34 in directory :kevin@kevin-laptop:~/ns-allinone-2.34 and i've extracted "exidus-pegasis-leach-ns234.patch.tar.gz" in directory :kevin@kevin-laptop:~/ns-allinone-2.34/ns-2.34, so how can i run the pegasis simulation?

kingrulez 07-17-2013 01:42 AM

Hi,

Thanks for your valuable suggestions or comments.

I have read all the suggestions regarding the above issue, somehow i managed to clear the errors, still i am getting this, i don't know where was the mistake, unfortunately i could not able to figured it out. Could you please help me to find it out. Please take a look at the below errors.

Error 1: on Ubuntu terminal
@ubuntu:~/ns-allinone-2.34/ns-2.34$ ./leach_test
Usage: tcl/ex/wireless.tcl
mandatory arguments:
[-x MAXX] [-y MAXY]
optional arguments:
[-cp conn pattern] [-sc scenario] [-nn nodes]
[-seed seed] [-stop sec] [-tr tracefile]

Error 2: on leach.err file
./leach_test: line 38: -sc: command not found

Best Regards,
KSR.

shegxyboy 02-15-2014 06:17 AM

unable to run leach.nam
 
Please i have installed leach.patch for ns2.34 after running it, i got leach.out but am unable to run the leach.nam to see the animation, please if there is a way to do it, please help me, am stuck here.....

knudfl 02-15-2014 06:23 AM

Post # 29, @shegxyboy : Welcome to LQ.

Please read http://www.linuxquestions.org/questions/tags/leach/
And http://www.linuxquestions.org/questions/tags/pegasis/
... And particularly the above post # 19 → @deepa_2111


-

shegxyboy 02-16-2014 02:01 PM

@knudfl, I've gone through all those threads before i was unable to find a solution to the issue of inability to generate NAM, infact i installed exidus-pegasis-leach-ns234.patch.tar.gz, but the leach.nam that was generated couldn't run, please if there is something am missing or a tutorial i need to go through, kindly help me with it........Please you help will be deeply appreciated, i've been struggling with this months.......please...

knudfl 02-17-2014 03:35 AM

# 31 .

Never seen it done. May not be possible.

That's why you should read post #19 ,,, that says : " .. ask @deepa_2111 "

shahidz 04-11-2014 11:52 AM

sir i am installing ns-allinone-2.34,if after ./install we execute make clean and then make for GPRS the error is like this
make[1]: Entering directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/cmu-scen-gen/setdest'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/cmu-scen-gen/setdest'
make[1]: Entering directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/dec'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/dec'
make[1]: Entering directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/epa'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/epa'
make[1]: Entering directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/nlanr'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/nlanr'
make[1]: Entering directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/ucb'
make[1]: Nothing to be done for `all'.
make[1]: Leaving directory `/home/user/ns2/ns-allinone-2.33/ns-2.33/indep-utils/webtrace-conv/ucb'
sir please help.....
sir i also need the patch of exidus pegasis.

knudfl 04-11-2014 01:13 PM

Post # 33, @shahidz.

Please do not ask GPRS questions in a leach thread.
" Nothing to be done for `all'." : Not an error. Means "Everything is OK".
`ns-2.33/indep-utils/' was compiled first time you did 'make' as part of ./install.
The second time you use 'make' : Nothing to do.


Pegasis : http://www.linuxquestions.org/questions/tags/pegasis/
Build example, post #24 here ...
http://www.linuxquestions.org/questi...656/page2.html
More info, and the leach+pegasis files "exidus-pegasis-leach-ns234-patch.2.tar.gz",
post #14 here http://www.linuxquestions.org/questi...4175488656/#14

-


All times are GMT -5. The time now is 09:33 AM.