LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   running leach on ns2.34 (https://www.linuxquestions.org/questions/linux-software-2/running-leach-on-ns2-34-a-860250/)

deepa_2111 05-11-2012 06:13 AM

@ Shailu (#44)

pp is a function that prints only when a certain flag is set to 1 (unlike puts). This function is described in one of the tcl files in the mit folder.

Please study properly all the tcl and cc files in the mit library before asking these kind of questions.

nzny 07-13-2012 06:39 PM

leach-energy calculation
 
Hi asrmaster,

I've also tried the code suggested by deepa,but the total expended energy is still much greater than the total initial energy. Could you show me your modified code?

Quote:

Originally Posted by asrmaster (Post 4386517)
Hi Deepa,

Thanks for your reply, it solved the problem of calculating the energy consumption.

But I still see problems in the results. For ns-2.1b5 simulation results are approximately as follows:

Parameters:
energy: 2j energy per node;
number of nodes: 100;
network area: 100m x 100m;
number of clusters: 5;
distance from the base station: 75m;

Approximate results in ns-2.1b5:
Lifetime: 560
Amount of data being sent: between 62,000 and 64,000;

Approximate results in ns-2.34:
Lifetime: between 480 and 550;
Amount of data being sent: between 45000 and 55000;

That is, the ns-2.34 the results have a greater sway, with much variation. While ns-2.1b5, the results vary less. Moreover, ns-2.1b5, the results are better than the ns-2.34.

Does anyone know how to explain these differences?

NOTE: Please disregard any typos because my English is not very good.


nzny 07-13-2012 06:45 PM

leach-energy calculation
 
Hello deepa,

I've tried your code and did make clean and make. However, I still got the total expended energy is much greater than the total initial energy. Did I miss any important step? Really appreciated if you could reply. TQ

Quote:

Originally Posted by deepa_2111 (Post 4336329)
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


madhudora 02-15-2013 01:24 PM

number of nodes alive
 
hello @deepa_2111
i modified the code in energy.cc file and wireless_phy.cc file.. and i got my energy decreased.. but still my number of alive nodes are 4.. Is there any way to increase it?????

emma166 03-11-2013 07:48 PM

Quote:

Originally Posted by nzny (Post 4727497)
Hi asrmaster,

I've also tried the code suggested by deepa,but the total expended energy is still much greater than the total initial energy. Could you show me your modified code?

i installed leach finally in my ns2.27 according to one of the threads in this site but when i do ./test and verify my energy in leach .out my nergy is > 200 j which is not correct because i have 100 nodes with 2 J each one i did all the modifications i even change my CC=gcc-4.4 and cpp=g++-4.4 in makefile.in i don't know what to do everything seems normal and i got no error when i do
./configure
make clean
make
but my leach.out is false !!
please help this is urgent for my project and i have no more time

emma166 03-11-2013 07:52 PM

Quote:

Originally Posted by deepa_2111 (Post 4317071)
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 !!

i installed leach finally in my ns2.27 according to one of the threads in this site but when i do ./test and verify my energy in leach .out my nergy is > 200 j which is not correct because i have 100 nodes with 2 J each one i did all the modifications i even change my CC=gcc-4.4 and cpp=g++-4.4 in makefile.in i don't know what to do everything seems normal and i got no error when i do
./configure
make clean
make
but my leach.out is false !!
i heard about some changes in code in ../uAMPS/stats.tcl about the expended enery when i changed it i got errors and my leach.out is empty so i delete these changes when i simulate the energy is always >200J
please can anyone help this is urgent for my project and i have no more time.thx in advance.

DeepaliDeshpande 07-08-2013 05:55 AM

Leach
 
Hi
please let me know how leach.out file is created.
let me know the sequence of files to be run in leach patch

DeepaliDeshpande 07-08-2013 06:05 AM

hi,
i getting very difficulty to link between stats.tcl,uamps.tcl and leach.tcl
please let me know their linking since i need to find remaining energy using stats.tcl file

DeepaliDeshpande 07-10-2013 05:08 AM

Leach
 
Dear all , my final dissertation is very close now so just i want to find remaining energy using stats.tcl.Please help me. In my leach patch not single tcl file is run by ns command i dont know why. when i give command ns stats.tcl nothing happens pls let me know all these things. Specially i request knudlf and deepa_2111. thank u

mirbaha 01-08-2014 03:40 AM

running leach in ns2.34
 
hi all
I installed ns2 in ubuntu 12.04 and run leach on it without any error(I fixed them)
but there is no valid output I think, I saw this problem later that no one know it.
can any one help me where is the problem?
http://www.4shared.com/file/iEc3lORcba/leach.html


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 99: (44.071560420129238,10.71598111219517)
Max Distance for this Simulation is 139.0
Load complete...
Starting Simulation...
THRESH = 0.050000000000000003
0: *******************************************
THRESH = 0.050000000000000003
1: *******************************************
THRESH = 0.050000000000000003
2: *******************************************
THRESH = 0.050000000000000003
3: *******************************************
THRESH = 0.050000000000000003
4: *******************************************
THRESH = 0.050000000000000003
5: *******************************************
THRESH = 0.050000000000000003
.
.
.

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
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
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: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
4: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
.
.
.
99: Warning!!! No Cluster Head ADVs were heard!
Data being sent to the Base Station
Data was sent to the base station
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
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
Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead
Warning! There are no nodes in this cluster (11)!
Data being sent to the Base Station
Data was sent to the base station
Warning! There are no nodes in this cluster (26)!
Data being sent to the Base Station
Data was 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 94 is DEAD!!!!
Node 95 is DEAD!!!!

At 1.0999999999999999:
Total Energy = 30125.543246939353
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



as we see , at end Total data is 0 and all of the nodes dead!!!
help plsss:)

michou_87 02-07-2014 07:59 AM

@Maytamer
Hello; I didn't found the awk file please sent it to this email" bejaouichaima@gmail.com" thank you

nasgelicvijay 02-26-2014 03:58 PM

Error in tmix.cc
 
Following error comes when i am performing make command.


In function `Tmix::picktcp()':
tmix.cc:(.text+0xc87): undefined reference to `agentFactory(Tmix, char, char)'
tmix/tmix.o: In function `Tmix::setup_connection()':
tmix.cc:(.text+0x18ea): undefined reference to `typeinfo for TmixOneWayAgent'
tmix.cc:(.text+0x18f2): undefined reference to `typeinfo for TmixAgent'
tmix.cc:(.text+0x1e8e): undefined reference to `typeinfo for TmixAgent'
collect2: ld returned 1 exit status
make: [ns] Error 1



please help me to solve this Error.

Vijay

knudfl 02-26-2014 04:46 PM

# 57, @nasgelicvijay.

Which code did you add to ns-2.xx ? LEACH ? ( This thread is leach only ! )
Which version of ns-allinone-2.xx is it about ? ?

Which Ubuntu version ? And please show the reply from $ uname -m <Enter>

-

nasgelicvijay 02-27-2014 02:28 AM

e
 
Yes sir, I have added "mannasim patch" and "ns-234-leach patch" simuntaneously.
But i have deleted the ns-234-leach patch now.
I am using ns-allinone-2.35 version.
My ubuntu version is ubuntu-12.04

Thanks for reply sir.

abhi.samyak 04-07-2014 11:54 PM

Quote:

Originally Posted by deepa_2111 (Post 4336330)
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 am not getting how to simulate normal LEACH and C-LEACH ... please help me with this :) Thanking in advance :)


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