LinuxQuestions.org
Help answer threads with 0 replies.
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 02-02-2011, 11:15 AM   #1
Stanley33
LQ Newbie
 
Registered: Feb 2011
Location: LOndon
Posts: 3

Rep: Reputation: 0
running leach on ns2.34


I am trying to run leach ns2.27 on ns2.34, can any one give me a clue of how to do it am currently using ubuntu 10.4
thank you
 
Old 02-02-2011, 11:24 AM   #2
Snark1994
Senior Member
 
Registered: Sep 2010
Distribution: Debian
Posts: 1,632
Blog Entries: 3

Rep: Reputation: 346Reputation: 346Reputation: 346Reputation: 346
What do you mean "how to run"? I was under the impression LEACH was a wireless protocol... Can you explain exactly what you're trying to do, where you've looked for information and at what point in the process you've got stuck? Thankyou
 
Old 02-02-2011, 11:33 AM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Welcome to LQ. .. .. ..

You can have as many versions of ns-allinone-2.x installed, as you want.

Installing ns-allinone-2.27 on Ubuntu, post #3 here
http://www.linuxquestions.org/questi...10-a-782356/#3

More info : LQ Search , Tag = leach
Or LQ Search , keyword = leach

..

Last edited by knudfl; 02-02-2011 at 12:55 PM.
 
Old 02-03-2011, 11:11 AM   #4
Stanley33
LQ Newbie
 
Registered: Feb 2011
Location: LOndon
Posts: 3

Original Poster
Rep: Reputation: 0
leach simulation

I want to run a simulation on leach (protocol )so I downloaded an ns2.27 package of it, currently I have ns2.34 installed
I am having problem compiling it

is there any modification that needs to be made
or
I would not mind if I can get a link where I can download a package that can run on ns2.34
 
Old 02-03-2011, 11:32 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
NS-allinone-2.27 :
Quote:
I am having problem compiling it
Did you follow all the mentioned 27 steps ?
You will have to read everything , post #3 here
http://www.linuxquestions.org/questi...10-a-782356/#3

EDIT : New package ns-234-leach.tar.gz + instructions here
http://www.linuxquestions.org/questi...34-a-870368/#5
( LEACH for ns-2.34 : posts 68 - 78 - 88 , etc., here
http://www.linuxquestions.org/questi...379/page5.html )

..

Last edited by knudfl; 04-05-2011 at 01:42 PM.
 
Old 04-05-2011, 11:26 AM   #6
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 185

Rep: Reputation: 268Reputation: 268Reputation: 268
hey !

I have just added LEACH to Ns 2.35. HAd to make a couple of changes, but it has passed all the validation tests.
Now, while trying to run LEACH, am stuck at ::

couldn't read file "/usr/local/ns-allinone-2.35-RC4
/ns-2.35/mit/rca
/ns-ranode.tcl": no such file or directory
while executing
"source.orig {/usr/local/ns-allinone-2.35-RC4
/ns-2.35/mit/rca
/ns-ranode.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 $env(RCA_LIBRARY)/ns-ranode.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 9)
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]
..."
(procedure "source" line 8)
invoked from within
"source mit/uAMPS/sims/uamps.tcl"
(file "tcl/mobility/leach.tcl" line 18)
invoked from within
"source.orig tcl/mobility/leach.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_leach.tcl" line 187)

I know this is from uamps.tcl. I know the file is there, and the env variables are set. Have seen this question on a couple of forums, but not able to figure out how to fiz this. Please help !
 
Old 04-05-2011, 01:36 PM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post #6 @deepa_2111 : Welcome to LQ. .. .. ..

Please edit post #6 to use code tags:
[/code] at code end, and [code] at code text start.
http://www.linuxquestions.org/questi....php?do=bbcode

Why ns-allinone-2.35-RC4, when RC7 is available ?
http://www.isi.edu/nsnam/dist/release/

And /usr/local/ is not a very convenient location for ns-allinone-2.xx.
Default is /home/<user-name>/ns2/ns-allinone-2.xx/.

It is not quite clear, what you are doing. "run LEACH" : What do you mean ?
Please specify the used command.
(Most things are probably described here, posts # 68...# 140 .... ..
http://www.linuxquestions.org/questi...79/page10.html )

LEACH for ns-2.34 : The latest files and install instructions are here
http://www.linuxquestions.org/questi...34-a-870368/#5
..

Last edited by knudfl; 04-05-2011 at 01:43 PM.
 
1 members found this post helpful.
Old 04-05-2011, 02:57 PM   #8
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 185

Rep: Reputation: 268Reputation: 268Reputation: 268
Hey ..

Thanks a lot ...

I've got it running. Regarding ns-allinone-2.35-RC4, it is coz I'm running it on cygwin, and I think this is the most stable version.
I was trying to run the leach_test file, and i had the issues i mentioned above. I fixed it by manually typing the path to remove any extra spaces.

I am going to analyse my results now.

Thanks for the "code" suggestions.
 
1 members found this post helpful.
Old 04-07-2011, 10:00 AM   #9
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 185

Rep: Reputation: 268Reputation: 268Reputation: 268
Hello,

I was analysing the results, and I come across this discrepancy (which I see mentioned on a couple of forum posts as well).

If I start with 2J energy per node, with 100 nodes, the maximum energy that can be expended in the network is 200J.
But, leach.out shows me::

Code:
At 548.60000000005618:
		Total Energy = 373.70924811232476
		Total Data = 56353
		Total Alive = 4

Simulation complete
This is impossible. How can the network expend 373.7J of energy.

Further, the document "Porting and Verifying AROS to NS in Linux/UNIX" (by Francisco José Mosqueira Sáez) (http://www.idt.mdh.se/utbildning/exj...les/TR0509.pdf) mentions this issue on page 33, with an explanation::

Quote:
The problem was in the medium, implemented by a class that is not modified by the MIT code.
That is the reason why it was so difficult to find the problem. In ns2.1b5,
there is already
implemented a wireless channel. But this channel behaves like a normal cable connected to every
node. This channel also simulated a more accurate wireless propagation delay than a normal cable.
When a packet arrives to a node, the network interface of the receiving node decides if the power of
transmission was enough to allow the reception of the packet.
In ns2.31,
the channel propagates the signal to every node listening to the channel within a
radius of propagation. To calculate this radius, propagation equations are used based on the
transmitted power of the wireless interface.
How do I go about fixing this ?? Help !!
 
Old 04-24-2011, 02:08 AM   #10
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Rep: Reputation: 39
Quote:
Originally Posted by deepa_2111 View Post
Hello,

I was analysing the results, and I come across this discrepancy (which I see mentioned on a couple of forum posts as well).

If I start with 2J energy per node, with 100 nodes, the maximum energy that can be expended in the network is 200J.
But, leach.out shows me::

Code:
At 548.60000000005618:
		Total Energy = 373.70924811232476
		Total Data = 56353
		Total Alive = 4

Simulation complete
This is impossible. How can the network expend 373.7J of energy.

Further, the document "Porting and Verifying AROS to NS in Linux/UNIX" (by Francisco José Mosqueira Sáez) (http://www.idt.mdh.se/utbildning/exj...les/TR0509.pdf) mentions this issue on page 33, with an explanation::



How do I go about fixing this ?? Help !!
The total energy and other statistics are calculated through the tcl file "/mit/uAMPS/stats.tcl". the reason for this unreasonable value is that the expended energy of the node is added to the total energy even when the node is dead, while it should be zero. you can check the individual expended energies by reviewing the output file "leach.energy", so you need to check the status of the current node if it's still alive. otherwise the expended value should be zero.
 
2 members found this post helpful.
Old 04-25-2011, 12:06 AM   #11
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Rep: Reputation: 39
Quote:
Originally Posted by MayTamer View Post
The total energy and other statistics are calculated through the tcl file "/mit/uAMPS/stats.tcl". the reason for this unreasonable value is that the expended energy of the node is added to the total energy even when the node is dead, while it should be zero. you can check the individual expended energies by reviewing the output file "leach.energy", so you need to check the status of the current node if it's still alive. otherwise the expended value should be zero.
I've wrote this simple awk file https://docs.google.com/uc?id=0BzLWx...download&hl=en to calculate the actual cumulative expanded energy by all nodes over time, it's for Leach-C. to be executed for Leach just comment or delete the first 'if condition'. download it into "/mit/leach_sims" and run the command:
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34/mit/leach_sims$ awk -f TotEn.awk leach-c.energy // for Leach-C
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34/mit/leach_sims$ awk -f TotEn.awk leach.energy // for Leach
 
2 members found this post helpful.
Old 04-25-2011, 02:33 AM   #12
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511

Rep: Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641Reputation: 3641
Post # 11 : Thank you.

But the link isn't working. Shared settings in 'Google Docs':

<awk file> → Actions > Share > Sharing Settings > Change >
> Anyone with a link >>> Save ( > Close ).
 
1 members found this post helpful.
Old 04-25-2011, 11:18 PM   #13
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 185

Rep: Reputation: 268Reputation: 268Reputation: 268
Hello ,

Thanks for ur replies. I modified the code as well ::

In \mac\Wireless-Phy.cc:
Code:
if (energy_)
	  { 
		if(alive_ != 0) // Deepa
		{
			if (energy_->remove(pktEnergy(Pt_, PXcvr_, ch->size())) != 0) 
			{
		  		printf("alive = 0\n");
		  		alive_ = 0;
			}
		} // Deepa
	  }
i.e., add the <code> if(alive_ != 0) </code> wherever the remove energy function is called,

and in mit\rca\energy.cc :
Code:
int EnergyResource::remove(double amount)
{
  double new_level = energy_level_ - amount;

  if(new_level >= 0 )
  {
  	energy_level_ = new_level;
  	expended_ += amount;
  } // Deepa
check if the new_level is greater or equal to 0. if it is not, energy cant be removed
 
1 members found this post helpful.
Old 04-25-2011, 11:20 PM   #14
deepa_2111
Member
 
Registered: Apr 2011
Distribution: -
Posts: 185

Rep: Reputation: 268Reputation: 268Reputation: 268
Have you noticed that LEACH-C performs worse than LEACH though actually it is supposed to give better performance ? In a previous post, I see someone has mentioned this same observation ... not sure if it has been rectified though.
 
Old 04-26-2011, 12:18 AM   #15
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Rep: Reputation: 39
Quote:
Originally Posted by deepa_2111 View Post
Have you noticed that LEACH-C performs worse than LEACH though actually it is supposed to give better performance ? In a previous post, I see someone has mentioned this same observation ... not sure if it has been rectified though.
I'm sorry to miss the shared settings. Well, for Homogeneous wireless network (i.e. eq_energy=1), Leach-C performance should be worse because it's a centralised protocol and will consume more energy during the set-up phase than Leach. but for Heterogeneous network (eq_energy=0) Leach-C should came up with a better performance than Leach. However, I've run both protocols for Heterogeneous network and to my surprise, Leach still outperforms Leach-C. I've checked the file ns_leach.tcl, which is called for both protocols, and found that when eq_energy=0 then the calculated threshold of Leach would differ from the conventional one, taking into consideration the proportional current energy of the node to the total energy. hence enhancing the clusterheads election. i'm still confused about this point because Leach is local/distributed clustering algorithm so how the nodes would calculate the total energy without exchanging messages ??? However, if you force Leach to use it's conventional threshold for Heterogeneous then it'll perform worse.
 
1 members found this post helpful.
  


Reply

Tags
leach, leach ns235, ns2, tcl-pp


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
installing leach patch in ns2.34 in ubuntu9.10 g_vaibh Ubuntu 19 04-09-2015 09:43 AM
how to install leach patch in ns2.34 in ubuntu 9.10 anjon.sunny Linux - Newbie 9 04-30-2014 04:05 AM
LEACH protocol installation on NS2.27 Scofield Linux - General 255 03-08-2012 05:19 PM
Leach Installation on NS2 Asmaa Seyam Linux - General 3 10-19-2010 12:31 PM
[SOLVED] NS2 LEACH make problem dkpcad Linux - Wireless Networking 2 10-02-2010 09:04 AM

LinuxQuestions.org > Forums > Linux Forums > Linux - Software

All times are GMT -5. The time now is 01:53 PM.

Main Menu
Advertisement
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
Open Source Consulting | Domain Registration