LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to integrate the "Resource/Energy" leach class into NS-2.34? (https://www.linuxquestions.org/questions/linux-software-2/how-to-integrate-the-resource-energy-leach-class-into-ns-2-34-a-870368/)

shahidz 05-01-2014 12:46 AM

sir i changed the file name according to exidus thread #289 but the result of leach-c is not the right one ,leach work well,problem with leach-c
we changed "alg" in leach_test;
#This is the algorithm that we are going to run. Type leach, leach-c, stat-clus or pegasis
alg=leach-c
and
leach-c.err file has mac/chanel.cc: INITIALIZE THE LIST xListHead
and my leach-c.tr file is emty..
Thanks

knudfl 05-01-2014 07:58 AM

# 856 .

The right entry is : alg=leach-c
( Not leach_c ! ).

Are you sure that you have used the right patching,
like exidus-pegasis-leach-ns234-patch.1.tar.bz2
https://drive.google.com/file/d/0B7S...it?usp=sharing

And that you have edited all path's in ns-2.34/tcl/mobility/{files}, etc.
from /home/tomas/* to your specific full path ?
( cd ns-2.34/ && grep -Rn tomas * ).

Some example leach-c outputs from →
$ export RCA_LIBRARY=/home/knudfl/9tmp/ns-allinone-2.34/ns-2.34/mit/rca && export uAMPS_LIBRARY=/home/knudfl/9tmp/ns-allinone-2.34/ns-2.34/mit/uAMPS && ./test
.... are available in "leach-c__output-example.tar.bz2"
https://drive.google.com/file/d/0B7S...it?usp=sharing

-

shahidz 05-02-2014 05:27 AM

sir we apply the changes, and we are trying to get leach-c.tr,leach-c.out file has the below data while the .tr is empty, i make the chages according to post # 289 but
the leach-c.err file has mac/chanel.cc: INITIALIZE THE LIST xListHead
and
leach-c.out has;
Creating sensor nodes... - uAMPS.tcl
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (100 == BS) - uAMPS.tcl
*** NOTE: no connection pattern specified. - wireless.tcl
Loading scenario file... - wireless.tcl
Node 0: (67.837825076579037,0.95365322239401429)
Node 1: (5.6106347616811441,59.567387057266842)
Node 2: (12.847064953691822,12.473798362758847)
.................
..................
..................
Node 98: (22.725265204312869,74.533321277486777)
Node 99: (98.747841361327033,38.908460754392884)
Max Distance for this Simulation is 138.0
Load complete... - wireless.tcl
Starting Simulation... - wireless.tcl
num_nodes is set 101

knudfl 05-02-2014 07:01 AM

# 858 .
Quote:

I make the changes according to post # 289
Don't do that. "The patch package" exidus-pegasis-leach-ns234-patch.1.tar.bz2
is supplying the right files.
It's simply this :
( Read the pegasis posts ! http://www.linuxquestions.org/questions/tags/pegasis/ )
$ cd ns-allinone-2.34/ && tar xvf exidus-pegasis-leach-ns234-patch.1.tar.bz2
$ export CC=gcc<?> CXX=g++<?> && ./install

-

e1mo 05-07-2014 04:51 PM

Hi
I have successfully installed LEACH, no problems, no errors, etc. Though I have two questions.

1. I have to compare the efficiency of LEACH, LEACH-C, MTE, DSDV and DSR routing protocols. When i simulate LEACH or MTE, (I just set the variable "alg" in leach_test file) simulation is going fine, i have results in .out files and no errors in .err files. But when i try to simulate DSDV or DSR (i set the variable "alg" accordingly), I got errors in .err files.
Example - dsr.err:

Quote:

INITIALIZE THE LIST xListHead
can't read "opt(nn_)": no such element in array
while executing
"set num_nodes $opt(nn_)"
(file "/home/wsn/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/nodescen" line 4)
invoked from within
"source.orig /home/wsn/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/nodescen"
("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 $opt(sc)"
invoked from within
"if { $opt(sc) == "" } {
puts "*** NOTE: no scenario file specified."
set opt(sc) "none"
} else {
puts "Loading scenario file..."
source $op..."
(file "/home/wsn/Pulpit/LEACH/wireless.tcl" line 294)
2. Do I need to specify the connection patternin LEACH, or MTE simulations?
Message in leach.out file
Quote:

*** NOTE: no connection pattern specified.

vishakha singhal 05-16-2014 02:16 AM

hii..m also working on leach protocol on ns2.34..m having ubuntu 12.04 with gcc 4.6...when i run make command i got the error in sragent file..as multiple declaration at same time..plz help.urgent

shahidz 05-30-2014 05:12 AM

sir i follow the steps there is no errors but leach results iResults is lik this in leach.out file;
Creating sensor nodes... - uAMPS.tcl
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (100 == BS) - uAMPS.tcl
* NOTE: no connection pattern specified. - wireless.tcl
Loading scenario file... - wireless.tcl
Node 0: (67.837825076579037,0.95365322239401429)
Node 1: (5.6106347616811441,59.567387057266842)
Node 2: (12.847064953691822,12.473798362758847)
Node 3: (51.243302110230225,83.015594297561606)
Node 4: (76.816643763713842,16.092541495381173)
Node 5: (88.698179828328165,94.414985316998795)
Node 6: (49.698749394015756,71.163323927281112)
Node 7: (18.752563846648002,37.040607369058115)
Node 8: (66.948251550527402,58.999779009725792)
...................................
..................................
98: ***************************************** - ns-leach.tcl
THRESH = 0.050000000000000003 - ns-leach.tcl
99: ***************************************** - ns-leach.tcl
Cluster Head 50 broadcasting ADV at time 5.7404830743281555e-06 - ns-leach.tcl
Cluster Head 56 broadcasting ADV at time 4.8870923780310403e-05 - ns-leach.tcl
Cluster Head 16 broadcasting ADV at time 0.00016140597944772149 - ns-leach.tcl
0: Warning!!! No Cluster Head ADVs were heard! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 0 sending {{0 , 0.0048719999999999996}} to BS at time 0.013465274531230925 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
1: Warning!!! No Cluster Head ADVs were heard! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 1 sending {{1 , 0.0048719999999999996}} to BS at time 0.012239155448238902 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
2: Warning!!! No Cluster Head ADVs were heard! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 2 sending {{2 , 0.0048719999999999996}} to BS at time 0.012945966055211595 - ns-leach.tcl
...........................67 rcvd ADV_CH from 16 at 0.33364361777913587 - ns-leach.tcl
31 rcvd ADV_CH from 16 at 0.33364361788491947 - ns-leach.tcl
11 rcvd ADV_CH from 16 at 0.3336436179188581 - ns-leach.tcl
9 rcvd ADV_CH from 16 at 0.33364362299438544 - ns-leach.tcl
51 rcvd ADV_CH from 16 at 0.33364362462953173 - ns-leach.tcl
87 rcvd ADV_CH from 16 at 0.33364362688108407 - ns-leach.tcl
18 rcvd ADV_CH from 16 at 0.33364362735704434 - ns-leach.tcl
24 rcvd ADV_CH from 16 at 0.33364363429386978 - ns-leach.tcl
32 rcvd ADV_CH from 16 at 0.33364363613921899 - ns-leach.tcl
92 rcvd ADV_CH from 16 at 0.33364363891190763 - ns-leach.tcl
71 rcvd ADV_CH from 16 at 0.33364364084311054 - ns-leach.tcl
91 rcvd ADV_CH from 16 at 0.33364364201171126 - ns-leach.tcl
3 rcvd ADV_CH from 16 at 0.33364364223858051 - ns-leach.tcl
89 rcvd ADV_CH from 16 at 0.33364364625598525 - ns-leach.tcl
38 rcvd ADV_CH from 16 at 0.3336436463900514 - ns-leach.tcl
69 rcvd ADV_CH from 16 at 0.33364364734956253 - ns-leach.tcl
47 rcvd ADV_CH from 16 at 0.33364364801128948 - ns-leach.tcl.......
...................................

20 rcvd ADV_CH from 16 at 0.33364364824451009 - ns-leach.tcl
54 rcvd ADV_CH from 16 at 0.33364365300295423 - ns-leach.tcl
14 rcvd ADV_CH from 16 at 0.33364365537481516 - ns-leach.tcl
44 rcvd ADV_CH from 16 at 0.33364366051695843 - ns-leach.tcl
53 rcvd ADV_CH from 16 at 0.33364366092919312 - ns-leach.tcl
84 rcvd ADV_CH from 16 at 0.33364366210324747 - ns-leach.tcl
59 rcvd ADV_CH from 16 at 0.33364366286144348 - ns-leach.tcl
33 rcvd ADV_CH from 16 at 0.33364366297826886 - ns-leach.tcl
88 rcvd ADV_CH from 16 at 0.33364366342678803 - ns-leach.tcl
66 rcvd ADV_CH from 16 at 0.33364366417508545 - ns-leach.tcl
22 rcvd ADV_CH from 16 at 0.33364366726669897 - ns-leach.tcl
78 rcvd ADV_CH from 16 at 0.33364366750468966 - ns-leach.tcl
39 rcvd ADV_CH from 16 at 0.33364367266601147 - ns-leach.tcl
58 rcvd ADV_CH from 16 at 0.333643673745808 - ns-leach.tcl
99 rcvd ADV_CH from 16 at 0.33364367849856996 - ns-leach.tcl
13 rcvd ADV_CH from 16 at 0.33364368430653335 - ns-leach.tcl
42 rcvd ADV_CH from 16 at 0.33364368438965203 - ns-leach.tcl
12 rcvd ADV_CH from 16 at 0.33364369708120972 - ns-leach.tcl
23 rcvd ADV_CH from 16 at 0.33364370812057337 - ns-leach.tcl
55 rcvd ADV_CH from 16 at 0.33364372172901358 - ns-leach.tcl
62 rcvd ADV_CH from 16 at 0.33364373402705838 - ns-leach.tcl
85 rcvd ADV_CH from 16 at 0.33364373545352966 - ns-leach.tcl
5 rcvd ADV_CH from 16 at 0.33364374581619727 - ns-leach.tcl
Warning! There are no nodes in this cluster (16)! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 16 sending {{16 , 1.004872}} to BS at time 1.0075435984161345 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
Warning! There are no nodes in this cluster (50)! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 50 sending {{50 , 1.004872}} to BS at time 1.0127675275974681 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
Warning! There are no nodes in this cluster (56)! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 56 sending {{56 , 1.004872}} to BS at time 1.0067879248526748 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
Node 0 is DEAD!!!! - ns-leach.tcl
Node 1 is DEAD!!!! - ns-Node 3 is DEAD!!!! - ns-leach.tcl
Node 4 is DEAD!!!! - ns-leach.tcl
Node 5 is DEAD!!!! - ns-leach.tcl
Node 6 is DEAD!!!! - ns-leach.tcl
Node 7 is DEAD!!!! - ns-leach.tcl
Node 8 is DEAD!!!! - ns-leach.tcl
Node 9 is DEAD!!!! - ns-leach.tclleach.tcl
Node 2 is DEAD!!!! - ns-leach.tcl

...............................
.............................

Node 94 is DEAD!!!! - ns-leach.tcl
Node 95 is DEAD!!!! - ns-leach.tcl

At 1.0999999999999999: - mit/uAMPS/stats.tcl
Total Energy = 2.7531270577825055
Total Data = 0
Total Alive = 4

Simulation complete. - mit/uAMPS/stats.tcl

num_nodes is set 101
mac/channel.cc: sendUp - Calc highestAntennaZ_ and distCST_
mac/channel.cc: highestAntennaZ_ = 1.5, distCST_ = 221.2

Manjunath G 07-11-2014 12:03 AM

Hi,

I'm installing LEACH patch file(#5) in NS_2.35-RC7 version in cygwin on windows7 OS.
i have done changes till the thread(#58)(gcc version 4.3.4).
Now i'm getting new error as below in leach.err fle:

invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/Noureddine/ns-allinone-2.35-RC7/ns-2.35/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/Noureddine/ns-allinone-2.35-RC7/ns-2.35/mit/rca/resources/ns-energy-resource.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 /home/Noureddine/ns-allinone-2.35-RC7/ns-2.35/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 18)
invoked from within
"source.orig mit/uAMPS/sims/uamps.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]


Can anybody help me to solve above error.

Thank you!!

pon 08-25-2014 06:34 AM

Hi knudfl,

i followed steps in the below link to install leach in ns-2.34

http://www.linuxquestions.org/questi...2-34-a-870368/
(post #5).

i got error like:
Quote:

MPS -o tools/random.o tools/random.cc
make: g++-4.3: Command not found
make: *** [tools/random.o] Error 127
then i followed procedure to install gcc-4.3 as per post #43 in this thread.
but it shows the following error , pls help me to resolve this problem.
Quote:

chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34$ sudo apt-get install g++ g++-4.3 autoconf automake libtool\libx11-dev libxmu-headers libxt-dev
Reading package lists... Done
Building dependency tree
Reading state information... Done
E: Unable to locate package g++-4.3
E: Couldn't find any package by regex 'g++-4.3'
E: Unable to locate package libtoollibx11-dev

Thanks
Pon

knudfl 08-25-2014 07:06 AM

#864, @pon.

The 2011 instructions in post #5 were valid for a short time
... in year 2011 ! "gcc-4.3" was updated, and no more usable for ns2.
http://www.linuxquestions.org/questi...-4175504301/#2

If g++-4.4 doesn't work, please use gcc41 + g++41. Examples, Ubuntu :
12.04, 32bits : http://www.linuxquestions.org/questi...022/page2.html #18
12.10 - 14.04, 32bits http://www.linuxquestions.org/questi...-4175450625/#3


Latest LEACH = leach+pegasis-ns234-files-2.tar.gz
http://www.linuxquestions.org/questi...-4175504301/#2

-

pon 08-26-2014 10:23 AM

hi knudfl,

i followed the procedure in foolowing site post #2.

http://www.linuxquestions.org/questi...-4175504301/#2


Quote:

chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34$ ./test
num_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
NS EXITING...
chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34$ sh test
num_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
NS EXITING...
chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34$
and i changed the path file in uAMPS.tcl as mentioned in following link post #56.
http://www.linuxquestions.org/questi...ml#post4357683

when i run ./test in terminal i am seeing error in pegasis.err file and no ouputs in pegasis.out and also i am not seeing any leach.err and leach.out file

Quote:

couldn't read file "/home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.tcl": no such file or directory
while executing
"source.orig /home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.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 /home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.tcl"
(file "tcl/mobility/pegasis.tcl" line 11)
invoked from within
"source.orig tcl/mobility/pegasis.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/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

pon 08-26-2014 11:56 PM

Hi knudfl,
when i tried to execute uamps.tcl , it is showing following error,

will u please , help me !!!
Quote:

chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims$ ns uamps.tcl
invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/home/chase/ns234/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/chase/ns234/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.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 /home/chase/ns234/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "uamps.tcl" line 39)
chase@chase-desktop:~/ns234/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims$

pon 08-27-2014 03:00 AM

Hi deepa and helyos ,

where this wireless-phy.cc file is located,

could u tell me the list of files in which we need to change our path files.



Thanks

pon 08-27-2014 04:44 AM

when i run ./test i am getting following err file in pegasis.err, pegasis.out is being a empty file and i am not seeing any leach.err and leach.out

Quote:

couldn't read file "/home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.tcl": no such file or directory
while executing
"source.orig /home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.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 /home/tomas/ns-allinone-2.34/ns-2.34/mit/uAMPS/ns-pegasis.tcl"
(file "tcl/mobility/pegasis.tcl" line 11)
invoked from within
"source.orig tcl/mobility/pegasis.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/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)

knudfl 08-27-2014 12:18 PM

# 868 .
Quote:

could you tell me the list of files in which we need to change our path files.
No files.cc or files.h are to be changed.
All changes are included in leach+pegasis-ns234-files-2.tar.gz .
If you did any editing, please start from scratch,
with $ tar xvf ns-allione-2.34.tar.gz, etc.

How to find a file :
1) $ cd ns-allione-2.34/ns-2.34/
2) $ find * -name "ns-pegasis.tcl"

How to run ./test :
a) Edit all files with "tomas" to your location,
like /home/pon/ns-allinone-2.34/ns-2.34/
b) Finding files (in ns-2.34) with "tomas" : $ grep -Rn tomas *
c) The test command :
$ export RCA_LIBRARY=/home/pon/ns-allinone-2.34/ns-2.34/mit/rca && export uAMPS_LIBRARY=/home/pon/ns-allinone-2.34/ns-2.34/mit/uAMPS && ./test

Please read (again) http://www.linuxquestions.org/questions/tags/leach/
and http://www.linuxquestions.org/questions/tags/pegasis/
* I.e. all your questions have been answered before.

-


All times are GMT -5. The time now is 06:15 AM.