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

elemenohpi 01-16-2016 12:49 AM

Post #990 @knudfl : Thanks for the reply. I assumed that it might be the OS. I'll try it either on UBUNTU 14.04 - amd64 or another already tested operating system and will share my experience here.


EDIT: I installed ns-2.34 + LEACH on an old Fedora OS. (I think it was 8 or 9) And compiled it with gcc 4.3. Now everything works peacfully

knudfl 01-16-2016 10:10 AM

Re #991, @elemenohpi.

Fedora 8 / 9 : 32 or 64 bits ?

Pashya 02-11-2016 05:45 AM

Hello everyone,
I am new to NS2 2.35 and would want to know where could I download the source code for CBRP or LEACH and which of them is appropriate to modify in order to implement my clustering mechanism for ad hoc networks

TB0ne 02-11-2016 07:07 AM

Quote:

Originally Posted by Pashya (Post 5498512)
Hello everyone,
I am new to NS2 2.35 and would want to know where could I download the source code for CBRP or LEACH and which of them is appropriate to modify in order to implement my clustering mechanism for ad hoc networks

You first need to read the LQ Rules, the "Question Guidelines" and the "How to ask a smart question" links in my posting signature.

You re-opened an old thread, hijacked it with your own off-topic question, and have NOT done any basic research on your own first. We are happy to help you with questions and problems, but you need to LOOK THINGS UP FOR YOURSELF. Google has MANY links you can find for downloading what you're after. Go look.

celiajohn 04-16-2016 02:03 AM

Resource/Energy integration issue while running LEACH on ns2.34
 
Hi,

I was unable to download the ns234-leach.tar.bz2 file from the below solution ( link provided).
Please send me the link to the file.

celiajohn 04-16-2016 02:32 AM

Resource/Energy integration issue while running LEACH on ns2.34
 
Hi,

I was unable to download the ns234-leach.tar.bz2 file from the below solution ( link provided).
Please send me the link to the file.

Below is the error clipping that I get while running LEACH protocol

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/celia/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/celia/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
"leach.err" 55 lines, 1823 characters

####################################################################

The solution to this was posted in this group but the linke for download is not available now.
Please help

Regards,
Celia

haitam09 04-18-2016 03:55 AM

Hi Celiojohn,

Look this link.It describes the install leach protocol in ns2.34.

http://www.linuxquestions.org/questi...2-34-a-870368/

Thank you M.Knudfl and M.MayTamer

knudfl 05-03-2016 09:10 AM

Re #996, @celiajohn.

The link suggested in post #997 was valid in the year 2011, not any more.

INFO, the ns234 patch http://www.linuxquestions.org/questi...-4175524367/#2

INFO, ns-2.35 http://www.linuxquestions.org/questi...4175556129/#11
.... etc. posts in the linked thread.


-

bayazidaufar 11-15-2016 11:02 PM

leach.out results differs from the original leach.out
 
hello sir. i have successfully installed and patched ns-234-leach.tar.gz in my ubuntu 12.04 (with gcc 4.4). however, my output in leach.out is far different from the original leach.out results.

in my leach.out results, all of my node is dead at the end of the simulation. i got this:
Quote:

At 23.2000000000000006:
Total Energy = 21631.616394359524
Total Data = 0
Total Alive = 4
the total energy is far higher than the one used in original leach.out, which stands in 327.82507706058254. and my total data is only 0 compared to the 44146 in original leach.out. the total alive shows the same result. why is this happened? and in my leach.out, i all of the nodes is dead at the end of the simulation and i get so many warning message (warning!!! no cluster head advs were heard) at the beginning of my simulation.

bayazidaufar 11-16-2016 01:03 AM

hi sir. hello knudfl and deepa_2111. i have the same problem regarding my weird leach.out result. the total data is always zero and all node is dead

Quote:

Originally Posted by mhmdmahdi (Post 5076085)
Thanks God.
And thanks for your help knudfl and deepa_2111. :hattip:
Finally i can get my simulation results as I expected.

I don't know exactly the reason why "Warning!!! No Cluster Head ADVs were heard!" appears on my simulation output yesterday, but maybe this warning appears because i made a mistake when I build NS on my computer. I will explain how I can solve this problem and i hope you can tell me my mistakes.

A few days ago knudfl help me to created a binary package: pegasis-ns-2.34-ubuntu10_i386.deb (post #584)
I install those package but I wasn't using it since I was really focusing on my weird simulation output.
These days when I almost gave up, I just remembered about the package so I changed a line on my leach_test file (ns-allinone-2.34/ns2.34/)

ns tcl/ex/wireless.tcl ->> ns-pegasis tcl/ex/wireless.tcl

And voila, the problems on simulation results gone forever.
To be honest, I feel so stupid now. Can you tell me my mistakes that cause this problem?
Maybe your answer could help other people who face this problem in the future.

Thank you so much. :)

i do as instructed in this post above, to install a binary package (pegasis-ns-2.34-ubuntu10_i386.deb) and change the 'ns' in leach_test file with 'ns-pegasis' but the leach.out result is not completed (the simulation stopped midway). can you help me?

best regards,

bayazid

koshy1222 12-07-2017 09:47 PM

Quote:

Originally Posted by shahidz (Post 5179259)
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

Hi there, can I know what are the steps that you followed to get this results?
I'm having the same problem: No CH ADVs were heard and data is 0 always. My results are such:
Creating sensor nodes...
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)
*** NOTE: no connection pattern specified.
Loading scenario file...
Node 0: (65.745973803916002,92.581722416254564)
Node 1: (21.008649990432268,92.380389195112684)
Node 2: (37.201202259027028,40.606367467253641)
Node 3: (71.218022131928251,61.297971318148988)
Node 4: (35.003944130150579,11.288995440718249)
Node 5: (34.146372151629237,98.076752432657756)
Node 6: (75.978135678906995,64.526355389750734)
Node 7: (94.45503554048716,5.7823289678349754)
Node 8: (83.602962402441989,14.98909784247591)
Node 9: (21.767438492629417,45.338745622587737)
Node 10: (8.2976788321033492,59.088131160982016)
.................................................
.................................................
98: *******************************************
THRESH = 0.050000000000000003
99: *******************************************
Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead
Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead
................................................
0: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
1: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
2: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
3: Current cluster-head is 3, code is 1, dist is 139.0
4: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
..........................................
..........................................
Warning! There are no nodes in this cluster (3)!
Data being sent to the Base Station
Data was sent to the base station
Warning! There are no nodes in this cluster (14)!
Data being sent to the Base Station
.........................................
.........................................
Node 0 is DEAD!!!!
Node 1 is DEAD!!!!
Node 2 is DEAD!!!!
Node 3 is DEAD!!!!
Node 4 is DEAD!!!!
Node 5 is DEAD!!!!
Node 6 is DEAD!!!!
Node 7 is DEAD!!!!
Node 8 is DEAD!!!!
Node 9 is DEAD!!!!
Node 10 is DEAD!!!!
........................................
........................................
Node 95 is DEAD!!!!

At 1.0999999999999999:
Total Energy = 2.7329719516298452
Total Data = 0
Total Alive = 4

Simulation complete.

num_nodes is set 101
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 222.8
alive = 0

Can someone please help me? Thank you in advance.

koshy1222 12-09-2017 10:10 AM

Quote:

Originally Posted by deepa_2111 (Post 5074037)
You are right. You do indeed have a problem with the receiving time / time at which nodes send their data to the BS.
I think the issue is related to the MAC layer/channel.
Have you added the required changes to the MAC folder ? I forget what exactly, but there were a couple of MAC/channel related changes that had to be added in the c/c++ code.

Before that, can you try modifying the value of $opt(ra_adv_total) ?
In tcl/leach.tcl, set it as : set opt(ra_adv_total) [expr $opt(ra_adv)*($opt(num_clusters)*4 + 1)*100]

Hi deepa_2111, I keep getting "No Cluster Head ADVs were heard" warning. Can you advice me on the changes that need to be made on the MAC folder? Thank you.

deepa_2111 12-11-2017 09:08 AM

I dont remember now. It was 5+ years ago.
But i did mention all my changes somewhere in this thread.


Quote:

Originally Posted by koshy1222 (Post 5790976)
Hi deepa_2111, I keep getting "No Cluster Head ADVs were heard" warning. Can you advice me on the changes that need to be made on the MAC folder? Thank you.


deepa_2111 12-11-2017 09:14 AM

See https://www.linuxquestions.org/quest...2-34-a-860250/
Post #13


I dont remember now. It was 5+ years ago.
But i did mention all my changes somewhere in this thread.


Quote:

Originally Posted by koshy1222 (Post 5790976)
Hi deepa_2111, I keep getting "No Cluster Head ADVs were heard" warning. Can you advice me on the changes that need to be made on the MAC folder? Thank you.


koshy1222 12-12-2017 12:08 AM

Quote:

Originally Posted by deepa_2111 (Post 5791892)
See https://www.linuxquestions.org/quest...2-34-a-860250/
Post #13


I dont remember now. It was 5+ years ago.
But i did mention all my changes somewhere in this thread.

Hi deepa_2111, thank you so much for your reply. I checked both the mac/wireless-phy.cc and mit/rca/energy.cc files, but the changes have been made already. Yet, I keep getting the same error: No Cluster Head ADVs were heard. Also, my Total Data is always zero.

Cluster Head 18 broadcasting ADV of length 22 over distance at 84.0 time 5.576064853731573e-05
Cluster Head 6 broadcasting ADV of length 22 over distance at 84.0 time 0.00010195596794688887
Cluster Head 14 broadcasting ADV of length 22 over distance at 84.0 time 0.00020954459189322992
now + ra_adv_total = 0.003016
now = 0.003016
0: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
now + ra_adv_total = 0.003016
now = 0.003016
1: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
now + ra_adv_total = 0.003016
now = 0.003016
.....................
.....................
59: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
19 rcvd ADV_CH from 18 at 0.11534577894629565
11 rcvd ADV_CH from 18 at 0.11534578876699243
43 rcvd ADV_CH from 18 at 0.11534579903625525
.....................
.....................
Node 56 is DEAD!!!!
Node 57 is DEAD!!!!

At 0.69999999999999996:
Total Energy = 0.6716827985292545
Total Data = 0
Total Alive = 2

Simulation complete.

From the results, I can see that non-CH nodes do not wait for the CH to advertise. Instead, they send data directly to BS (but, Total Data = 0). Non-CH nodes received ADV only after some time. I am running LEACH Protocol using ns-2.35 on Ubuntu 14.04. Please help me. My dateline is nearing and my work is nowhere close to complete.


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