LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 03-27-2017, 03:31 PM   #1
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Rep: Reputation: Disabled
Unhappy LEACH Protocol (Mit + uAMPS )


Hello My friend
Really new in ns2 and I am installing leach protocols (mit-uAMPS) in ns-2.35 and success to run the leach_test and wireless.tcl and get no error and there are leach.tr and leach.out .
My problems are I have my own scenarios which I make it in setdest in ns2
how I can apply this scenario in leach protocol and the change must do in wireless.tcl and leach_test .

Also I need the Packet delivery ratio (PDF) how I can calculate it in leach from leach.tr or leach.out

Thank you
 
Old 03-27-2017, 06:27 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,325

Rep: Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583
Quote:
I have my own scenarios which I make it in setdest in ns2
Please read wireless.tcl to know that a scenario file is already used :
Like ../mobility/scene/scen-670x670-50-600-20-0, or scen-670x670-50-600-20-2.
(Line number : $ grep -n mobility wireless.tcl ) (The "cbr" traffic file will also be listed.)

So you can just try adding your own file specs to wireless.tcl, and the file(s) to tcl/mobility


About Packet delivery ratio, PDF :
Find a file.awk in awk#perl#python__scripts-1-2017.tar.gz (~170 scripts) that can work with your file
https://drive.google.com/file/d/0B7S...ew?usp=sharing
List :
all.awk
Pdf-0.awk
pdf.awk
PDR.awk
PacketDeliveryFraction.awk
PacketDeliveryRatio.awk


Leach INFO http://www.linuxquestions.org/questi...leach%20ns235/


-
 
Old 03-28-2017, 07:30 AM   #3
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thank you very much knudfl to fast answer
I put my scenario in the wireless.tcl and there is no errors
My question is ... there are also scenario in the leach_test file must I change it or not ? also the result for simulation for leach protocols in leach.tr or leach.out ?



Thank you
 
Old 03-28-2017, 08:58 AM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,325

Rep: Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583
Re #3.
Quote:
there are also scenario in the leach_test file
You can try making copies of 'leach_test' ( 1-leach_test , 2-leach_test ).
... And then try out the modifications : ./1-leach_test , ./2-leach_test


Ref. http://www.linuxquestions.org/questi...4175556129/#11


-
 
Old 04-05-2017, 12:13 PM   #5
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
LEACH Resulats
I hope all have a nice day
I installed Mit-uAmps in Ns-2.35 and run leach_test and No error in leach.err My problem When I need to calculate the packet send and packets drop and PDR from leach.tr by using AWK I get different results in each time I run leach_test.
Please, any body can help me for that.

Best Regards
 
Old 04-05-2017, 01:21 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,325

Rep: Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583
Re #5.

"Different results / random results" :

I guess that's caused by the ns2 function "random seed".
Though seed is set to 0.0, seed is by definition still random, AFAIK.

Using grep with the Leach files :
Code:
$ grep -Rin seed *
common/mobilenode.cc:228:              energy_model()->afe()->set_sleepseed(atof(argv[2]));
mit/uAMPS/ns-bsapp.tcl:30:  $rng_ seed 0
mit/uAMPS/ns-leach.tcl:39:  $rng_ seed 0
mit/uAMPS/ns-mte.tcl:32:  $rng_ seed 0
mit/uAMPS/sims/genscen:11:$rng seed 0
tcl/ex/wireless.tcl:57:set opt(seed)            0.0
tcl/ex/wireless.tcl:116:        puts "\t\t\[-seed seed\] \[-stop sec\] \[-tr tracefile\]\n"
tcl/ex/wireless.tcl:122:        lappend optlist cp nn seed sc stop tr x y
tcl/ex/wireless.tcl:206:if {$opt(seed) > 0} {
tcl/ex/wireless.tcl:207:        puts "Seeding Random number generator with $opt(seed)\n"
tcl/ex/wireless.tcl:208:        ns-random $opt(seed)
tcl/ex/wireless.tcl:304:puts $tracefd "M 0.0 sc $opt(sc) cp $opt(cp) seed $opt(seed)"
The reason for "random seed" : ns2 intends to imitate a real world situation. AFAIK.
https://www.google.com/webhp?hl=all&...=en&q=ns2+seed
* http://www.isi.edu/nsnam/ns/doc/node268.html


-
 
1 members found this post helpful.
Old 04-05-2017, 01:40 PM   #7
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thank you very much knudfl
I will check that
 
Old 04-05-2017, 04:08 PM   #8
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Question Need Help

I want to thanks again knudfl Really I check seed it is 0 in all places, and it is the same problem the result is different when run leach_test and read results from leach.tr please see the attach files maybe u can help me.
thanks knudfl
Attached Files
File Type: txt leach.tr.txt (140.0 KB, 36 views)
File Type: txt leach_test.txt (1.5 KB, 34 views)
File Type: txt wireless.tcl.txt (8.9 KB, 37 views)
File Type: txt sendreceiveAWK.txt (388 Bytes, 23 views)
File Type: txt leach.out.txt (29.0 KB, 45 views)
 
Old 04-05-2017, 04:21 PM   #9
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,333

Rep: Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026
Quote:
Originally Posted by ITengineer View Post
I want to thanks again knudfl Really I check seed it is 0 in all places, and it is the same problem the result is different when run leach_test and read results from leach.tr please see the attach files maybe u can help me.
thanks knudfl
Sorry, but do you really not understand what a random number is??? It STARTS with 0...and generates a random number. It will NEVER be the same twice.
 
Old 04-05-2017, 04:31 PM   #10
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Really I understand what you mean But? I want to make comparative and I fix the number of nodes and all parameters and when run Leach_ test and see the results when nodes are 50 and nodes are 100 it's same PDR and packet lsot and etc ... I am new in this field.

Thanks

Last edited by ITengineer; 04-06-2017 at 05:36 AM.
 
Old 04-05-2017, 04:34 PM   #11
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,333

Rep: Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026
Quote:
Originally Posted by ITengineer View Post
Really I understand what you mean But? I want to make comparative and I fix the number of nodes and all parameters and want run Leach_ test and see the results when nodes are 50 and nodes are 100. I am new in this field .
And you are seeing those results. The 'field' doesn't matter in this context....a random number is just that: RANDOM. You won't get the same results twice. Not sure what you don't understand about that....
 
Old 04-06-2017, 05:46 AM   #12
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thanks TB0ne
I want to make comparative and I fix the number of nodes and all parameters. when running leach_test twice the results of PDR, packet lost and etc ...which read it from leach.tr different in each time and I don't change any parameters I thought if I don't change the parameters results must be same . But I get not same when running leach_test
Thanks

Last edited by ITengineer; 04-06-2017 at 05:47 AM.
 
Old 04-06-2017, 07:21 AM   #13
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen DK
Distribution: PCLinuxOS2020 CentOS6.10 CentOS7.7 + 50+ other Linux OS, for test only.
Posts: 17,325

Rep: Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583Reputation: 3583
Re #12, etc.

http://www.isi.edu/nsnam/ns/doc/node268.html : Quote → →
Quote:
To get non-deterministic behavior, set the seed of the default RNG to 0.
This will set the seed based on the current time of day and a counter.
I.e. "seed = 0" causes a random result.


-

Last edited by knudfl; 04-06-2017 at 07:23 AM.
 
1 members found this post helpful.
Old 04-06-2017, 10:01 AM   #14
TB0ne
LQ Guru
 
Registered: Jul 2003
Location: Birmingham, Alabama
Distribution: SuSE, RedHat, Slack,CentOS
Posts: 22,333

Rep: Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026Reputation: 6026
Quote:
Originally Posted by ITengineer View Post
Thanks TB0ne
I want to make comparative and I fix the number of nodes and all parameters. when running leach_test twice the results of PDR, packet lost and etc ...which read it from leach.tr different in each time and I don't change any parameters I thought if I don't change the parameters results must be same . But I get not same when running leach_test
Thanks
YOU ARE USING A RANDOM NUMBER GENERATOR...IT WILL GENERATE RANDOM NUMBERS. How, exactly do you think you'll get the same results twice with random values???? What do you not understand about this???? The seed is where the random number pool STARTS from.

If you truly can't understand that, then you need to ask your teacher to explain what a random number is.
 
Old 04-08-2017, 05:55 AM   #15
ITengineer
LQ Newbie
 
Registered: Mar 2017
Posts: 10

Original Poster
Rep: Reputation: Disabled
Thumbs up

Quote:
Originally Posted by knudfl View Post
Re #12, etc.

http://www.isi.edu/nsnam/ns/doc/node268.html : Quote → →


I.e. "seed = 0" causes a random result.


-
Thank you very much knudf for your cooperation. I now understand that But I have another question why always receive in zero PLeease if you guide me to solve this problem
 
  


Reply

Tags
leach, leach ns235, ns2


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
problem with running leach protocol in ns2.34 leach.er Mohamed69 Linux - Software 14 04-16-2018 08:10 AM
[SOLVED] Problem at LEACH/LEACH-C MIT source emprit Linux - Wireless Networking 9 03-04-2016 11:45 AM
Errors on LEACH MIT uAMPS project wireless.tcl file kingrulez Linux - Wireless Networking 2 07-17-2013 09:27 AM
Changing the transmission power in leach uAMPS yeomjang Linux - Software 0 03-22-2013 08:44 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 05:37 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
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration