LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   calculating PDR--leach in NS2.35 (https://www.linuxquestions.org/questions/linux-software-2/calculating-pdr-leach-in-ns2-35-a-4175604877/)

rc49 04-28-2017 12:42 PM

calculating PDR--leach in NS2.35
 
i run leach application in NS2.35.
system configuration Ubuntu14.04 64bit

received output files successfully. please find attached documents below
leach.out https://drive.google.com/file/d/0B3n...ew?usp=sharing

leach.alive https://drive.google.com/file/d/0B3n...ew?usp=sharing

leach.data https://drive.google.com/file/d/0B3n...ew?usp=sharing

leach.save1 https://drive.google.com/file/d/0B3n...ew?usp=sharing

leach.save2 https://drive.google.com/file/d/0B3n...ew?usp=sharing

in the files leach.save1 and leach.save2 both files have different values of total data BUT in leach.out total data=0
this is confusing.
for calculating metric PDR if the total data is data received by BS node then how could i get sent data so as to calculate packet delivery ratio

i also have to calculate other metrics like throughput and delay but different values in different files,,!!
i also searched for the same on google but havent found enough stuff to calculate PDR of leach!!
any help will be appreciated!
thank you

knudfl 04-30-2017 04:30 AM

The files leach.alive, leach.data, leach.energy are for meant for a graphics plot e.g. Xgraph.

I don't know if you can get anything useful from the leach.out files.
Usually the genuine trace file.tr (leach.tr) is used for PDR, e.g. with :
PDR.awk, PacketDeliveryRatio.awk, PaDeFr.awk, Pdf-0.awk, pdf.awk
https://drive.google.com/file/d/0B7S...ew?usp=sharing



"packet delivery ratio leach" https://scholar.google.dk/scholar?q=...1MAicQgQMIITAA
→ omnet++ → http://ieeexplore.ieee.org/abstract/...8/?reload=true

omnet++ https://groups.google.com/forum/?fro...!forum/omnetpp
→ leach https://groups.google.com/forum/?fro...sort:relevance
Latest postings https://groups.google.com/forum/?fro...ch%7Csort:date


-

rc49 04-30-2017 01:46 PM

Quote:

Originally Posted by knudfl (Post 5704168)

what i am able to conclude on the basis of facts collected,,,,most of the authors in their papers,,,plots total received packets at base station..not the ratio actually(A:B)

i think its not possible to calculate PDR(A:B) of leach in ns2.35 via trace file unless we change leach code files..m i right?
what u say knudfl??

knudfl 04-30-2017 02:14 PM

Re #3.
Quote:

I think its not possible to calculate PDR(A:B) of leach in ns2.35 via trace file unless we change leach code files
I have no Idea.
Please ask Pradeepkumar http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html
... He is the latest person who have worked with the leach code.


The leach setup for ns2 is ancient. I guess the OMNeT++ leach is better ?

-

mauriz 12-26-2017 10:40 PM

Quote:

Originally Posted by rc49 (Post 5703653)
in the files leach.save1 and leach.save2 both files have different values of total data BUT in leach.out total data=0
this is confusing.
for calculating metric PDR if the total data is data received by BS node then how could i get sent data so as to calculate packet delivery ratio

i also have to calculate other metrics like throughput and delay but different values in different files,,!!
i also searched for the same on google but havent found enough stuff to calculate PDR of leach!!
any help will be appreciated!
thank you


Hello!
I do research on this too.
1. leach.save1 and leach.save2 used for what?
2. Did you find any solution?
Thankyou

knudfl 12-27-2017 06:32 AM

Re #5, @mauriz.

leach.save1 and leach.save2 : Are old saved examples of leach.out .
Not to be used for anything : You can read the files.

PDR :
Code:

$ awk -f PDR.awk leach.tr
cbr s:102 r:199, r/s Ratio:1.9510, f:0

The file leach.tr should be present: ns-2.35/leach.tr

Perl, awk scripts https://drive.google.com/file/d/1oid...ew?usp=sharing

P.S. : Better results, see posts #1007, #1009 here
https://www.linuxquestions.org/quest...68/page68.html


-

mauriz 12-27-2017 08:23 PM

Quote:

Originally Posted by knudfl (Post 5798330)
leach.save1 and leach.save2 : Are old saved examples of leach.out .
Not to be used for anything : You can read the files.

-

Thanks. But why when I check leach.out the result is always show Total Data = 0 ?
Even though leach.save1 and save2 have different results? Is it time-based? Then I'd better process the data from leach.out or leach.save?
Additionally, is there an explanation of the data that displayed? Like, what is total energy, total data, total alive, how can node die, etc?

knudfl 12-28-2017 03:23 AM

Re #7.
Quote:

is there an explanation of the data that displayed
May be somewhere in the documentation .... leach-doc.tar.gz
https://drive.google.com/file/d/0B7S...ew?usp=sharing


Quote:

when I check leach.out the result is always show Total Data = 0
1. You are using an OS that's not ns2-leach friendly? Ubuntu 10.04 seems to work →
→ #1013 → https://www.linuxquestions.org/quest...68/page68.html
2. Wrong patch. Wrong ns2 version.
``ns-2.34 and leach+pegasis_ns234.patch.gz creates better results →
https://www.linuxquestions.org/quest...68/page68.html → #1007 #1009

-

mauriz 12-28-2017 09:18 AM

calculating PDR--leach in NS2.35
 
Thank you for sharing. I am using leach in ns-2.35, Ubuntu 14.04. I do patch with tutorial on youtube (https://www.youtube.com/watch?v=XX9fooieASAS&sns=sms). In the video, leach.out shows Total Data = 0 too, is this error on leach patch or does leach can not be used on ns-2.35? Thank you

knudfl 12-28-2017 10:57 AM

Re #9.

The "Leach for ns-2.35" may have worked once.
With a specific OS, at a specific OS update level.
I have tested "leach_ns235-Jun2015.patch" with multiple OSs.
No perfect results with any, I think.
Ref. http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html


Quote:

shows Total Data = 0
? Which file ? ?

A typical leach.out from a contemporary OS: Uploaded as leach.out__ns235.txt →
https://drive.google.com/file/d/1bFw...ew?usp=sharing
All . https://drive.google.com/drive/folde...lk?usp=sharing

-

mauriz 12-28-2017 08:09 PM

Quote:

Originally Posted by knudfl (Post 5798826)
The "Leach for ns-2.35" may have worked once.
With a specific OS, at a specific OS update level.
I have tested "leach_ns235-Jun2015.patch" with multiple OSs.
No perfect results with any, I think.
Ref. http://www.nsnam.com/2015/05/leach-p...in-ns2-ns.html
-

Thank you. I also use the ref
So, Is there any simulator I can use for LEACH and DTN?
Actually I use ns-2.35 because I know ns-2.35 can be used for DTN.
Ref. https://www.netlab.tkk.fi/tutkimus/dtn/ns/

Quote:

? Which file ? ?
leach.out

knudfl 12-29-2017 04:58 AM

Re #11.

? Do you want to combine DTN with Leach ?

Note : You can have as many ns-allinone-2.xx as you want, installed at the same time.
But do never add any *PATH text to .bashrc. Not required.



-

mauriz 12-29-2017 09:25 PM

calculating PDR--leach in NS2.35
 
yes, but I think I need much ref for simulate it
Did you have any ref, Mr?

knudfl 12-30-2017 04:45 AM

Quote:

I think I need much ref for simulate it
Please explain in common words, what your question really means.
( Ref. is short for reference. And "it" can mean anything.)


To use "Leach": ns-2.34 + an old Ubuntu version is required : For Leach only.
For DTN : A separate ns-allinone-2.35, for DTN only.
( And a /usr/local/bin/ns-orig for default simulations.)


-

mauriz 12-31-2017 09:36 AM

Quote:

Originally Posted by knudfl (Post 5799598)
Please explain in common words, what your question really means.
( Ref. is short for reference. And "it" can mean anything.)
-

It = wsn (leach) over dtn

Quote:

To use "Leach": ns-2.34 + an old Ubuntu version is required : For Leach only.
For DTN : A separate ns-allinone-2.35, for DTN only.
( And a /usr/local/bin/ns-orig for default simulations.) -
Is there a simulator to simulate leach and dtn? Not only leach or dtn, but both of them

mauriz 01-03-2018 09:09 PM

Quote:

Originally Posted by knudfl (Post 5799178)
Re #11.

Note : You can have as many ns-allinone-2.xx as you want, installed at the same time.
But do never add any *PATH text to .bashrc. Not required.

-

Sorry for disturbing you, Mr @knudfl
I've do install ns-2.34 and ns-2.35 and didn't add any *PATH text to .bashrc then I got this
Quote:

mau@mau-Satellite-L745:~$ ns
The program 'ns' is currently not installed. You can install it by typing:
sudo apt-get install ns2
How to solve it?
Thankyou for your attention and sorry.

knudfl 01-04-2018 02:58 AM

Re #16.

ns-2.34/ , assume Leach :
$ cd ns-2.34/
$ sudo make install ('make install' will copy 'ns' to /usr/local/bin/)


And for a stock ns-2.35/, i.e. no patches / no changes :
$ cd ns-2.35/
$ cp ns ns235-orig
$ sudo cp ns235-orig /usr/local/bin/
Note : The leach 'ns' from ns-2.34 is no good with default simulations.tcl.


Notes
Quote:

The executable 'ns' or "ns-<any-name>" is hard coded to know the location of it`s libraries:
ns-allinone-2.35/{ lib/{libtcl*, tclConfig.sh, tcl8*/}, bin/tcsh8* }.

The old year ~1999 text ....
Please put .... ,, IMPORTANT NOTICES: You MUST put ..
.. was meant only for a "University Computer" :
.. i.e. when you had no write permissions to /usr/local/.


mauriz 01-04-2018 07:57 PM

Quote:

Originally Posted by knudfl (Post 5801547)
Re #16.

ns-2.34/ , assume Leach :
$ cd ns-2.34/
$ sudo make install ('make install' will copy 'ns' to /usr/local/bin/)


And for a stock ns-2.35/, i.e. no patches / no changes :
$ cd ns-2.35/
$ cp ns ns235-orig
$ sudo cp ns235-orig /usr/local/bin/

Ok Mr. Thank you so much for your attention. I really appreciate it :)
But I get the same problem as when I use ns-2.35 for leach.
When I use ns-2.34, leach.out shows me this :
Quote:

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

Simulation complete.
There is no errors:
Quote:

INITIALIZE THE LIST xListHead
SORTING LISTS ...DONE!
What must I do? :(

And what do you mean about this:
Quote:

Note : The leach 'ns' from ns-2.34 is no good with default simulations.tcl.
Sorry, but I dont understand

knudfl 01-05-2018 07:43 AM

Re #18.
Quote:

I get the same problem
? Which OS ? Must be a 32bits OS. Must be Ubuntu 10.04 or earlier !


Quote:

The leach 'ns' from ns-2.34 is no good with default simulations.tcl
The executable 'ns' from ns-2.34 + leach can be used for Leach only.
Hence /usr/local/bin/ns-orig


-

mauriz 01-06-2018 10:07 PM

Quote:

mau@mau-Satellite-L745:~$ lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 14.04.5 LTS
Release: 14.04
Codename: trusty
mau@mau-Satellite-L745:~$ uname -i
x86_64


Quote:

The executable 'ns' from ns-2.34 + leach can be used for Leach only.
Hence /usr/local/bin/ns-orig
Ok. Thank you
My simulation always stop at 1.09 or 2.3 and show Total Data=0, and I've try for many time but it always shows the same until now.

knudfl 01-07-2018 06:14 AM

Re #20.

Repeat : Must be a 32bits OS. Must be Ubuntu 10.04 or earlier

mauriz 01-07-2018 08:53 AM

So why my simulation still show Total Data=0 and stop at 1 or 2s ? :(
Do you have any solution?

knudfl 01-07-2018 10:05 AM

Re #22.

? Which OS are you using ? And : Is it 32bits or 64bits ?

bingyou 01-22-2019 04:23 AM

about pdr and end-to-end delay
 
PDR :
Code:

$ awk -f PDR.awk leach.tr
cbr s:102 r:199, r/s Ratio:1.9510, f:0

=========================================
=========================================
hello,
1)Why is the value of PDR greater than 1? Is this normal?
And I want to evaluate the delay through the leach. tr file, but can't find the column of cbr? (my $opt (cp) "")? Is it correct to calculate delay only by [ recvTime[pkt_id] - sendTime[pkt_id] ] ? or,i need add -cp(in leach_test.tcl) with the file generated by cbrgen.tcl?
thanks!!!

knudfl 01-22-2019 07:35 AM

Post #24, @bingyou : Welcome to LQ.

PDR > 1 : Happens sometimes with various simulations / protocols. Don't know why.
... I guess the trace file is actually listing more r than s ?
* You can extract send (s) and receive (r) lines to make a count :
Code:

$ grep "s " leach.tr | wc
  43711

$ grep "r " leach.tr | wc
  99317


Delay examples
Code:

[AWK-first.10.18]$ perl End-to-End-Delay##.pl leach.tr
.
.
Delay:32.3383429999922
Delay:64.6264480000127
Delay:32.3380539999789
 Simulation Time = 498.20000 seconds
 Total Receive Count = 43707
 Average End to End Delay = 32.8981541589885 milliseconds

Code:

[AWK-first.10.18]$ awk -f Avg_Del.awk leach.tr
 avgDelay[ms] overall:  498174

~240 awk and perl ns2-scripts https://drive.google.com/drive/folde...7T?usp=sharing
( AWK-first.10.18 is the "top 25 scripts.)

-

bingyou 01-24-2019 03:01 AM

@knudfl Thanks for your reply .It helps me a lot .
1)r is more than s .I think in the Cluster Building Phase the CH broadcasts the ADV message to all other nodes. the s is 1, and the r is 99(if there are 100nodes) in trace file.Bur i don't understand the 9th pkt that node 60 sends to node48. s is 1,r is 3. also the 7th, 10th pkt.
Code:

r 0.001121952 _16_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001121959 _65_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001121974 _5_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001121974 _1_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001121990 _27_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001122008 _56_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001122011 _39_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
r 0.001122017 _40_ AGT  --- 4 rca 2 [0 21000000 ffff0008 0] ------- [A 33 -1 -1]
s 0.018505691 _5_ AGT  --- 5 rca 16 [0 5000000 0 0] ------- [R 5 10 -1]
r 0.018843847 _10_ AGT  --- 5 rca 16 [0 5000000 ffff0008 0] ------- [R 5 10 -1]
s 0.038531366 _22_ AGT  --- 6 rca 16 [0 16000000 0 0] ------- [R 22 48 -1]
r 0.038869541 _48_ AGT  --- 6 rca 16 [0 16000000 ffff0008 0] ------- [R 22 48 -1]
s 0.047816087 _95_ AGT  --- 7 rca 16 [0 5f000000 0 0] ------- [R 95 48 -1]
r 0.048154124 _48_ AGT  --- 7 rca 16 [0 5f000000 ffff0008 0] ------- [R 95 48 -1]
r 0.048154251 _22_ AGT  --- 7 rca 16 [0 5f000000 ffff0008 0] ------- [R 95 48 -1]
s 0.058963609 _93_ AGT  --- 8 rca 16 [0 5d000000 0 0] ------- [R 93 36 -1]
r 0.059301702 _36_ AGT  --- 8 rca 16 [0 5d000000 ffff0008 0] ------- [R 93 36 -1]
s 0.072799292 _60_ AGT  --- 9 rca 16 [0 3c000000 0 0] ------- [R 60 48 -1]
r 0.073137331 _22_ AGT  --- 9 rca 16 [0 3c000000 ffff0008 0] ------- [R 60 48 -1]
r 0.073137443 _95_ AGT  --- 9 rca 16 [0 3c000000 ffff0008 0] ------- [R 60 48 -1]
r 0.073137461 _48_ AGT  --- 9 rca 16 [0 3c000000 ffff0008 0] ------- [R 60 48 -1]
s 0.094977208 _68_ AGT  --- 10 rca 16 [0 44000000 0 0] ------- [R 68 48 -1]
r 0.095315225 _22_ AGT  --- 10 rca 16 [0 44000000 ffff0008 0] ------- [R 68 48 -1]
r 0.095315263 _60_ AGT  --- 10 rca 16 [0 44000000 ffff0008 0] ------- [R 68 48 -1]
r 0.095315386 _95_ AGT  --- 10 rca 16 [0 44000000 ffff0008 0] ------- [R 68 48 -1]
r 0.095315394 _48_ AGT  --- 10 rca 16 [0 44000000 ffff0008 0] ------- [R 68 48 -1]
s 0.096349800 _44_ AGT  --- 11 rca 16 [0 2c000000 0 0] ------- [R 44 2 -1]
r 0.096687957 _2_ AGT  --- 11 rca 16 [0 2c000000 ffff0008 0] ------- [R 44 2 -1]

2)I think the avgDelay in "
Quote:

[AWK-first.10.18]$ awk -f Avg_Del.awk leach.tr avgDelay[ms] overall: 498174
" is wrong. In file "Avg_Del.awk" the pkt_id =$12, I think it should be "pkt_id=$6". The end-to-end delay calculated with file "End-to-End-Delay##.pl" is more reasonable.The receive time is determined by the first time it is accepted.

3)
Quote:

[AWK-first.10.18]$ perl End-to-End-Delay##.pl leach.tr
.
.
Delay:32.3383429999922
Delay:64.6264480000127
Delay:32.3380539999789
Simulation Time = 498.20000 seconds
Total Receive Count = 43707
Average End to End Delay = 32.8981541589885 milliseconds
Quote:

$ grep "s " leach.tr | wc
43711
The PDR = 43707 / 43711 . Is it correct?


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