how to integrate the "Resource/Energy" leach class into NS-2.34?
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
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
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
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
# 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
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
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
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
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]
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$
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)
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$
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)
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
# 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
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.