LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
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 07-21-2011, 03:51 AM   #121
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,383

Rep: Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599Reputation: 3599

# 120 : Please read http://linuxsilo.net/docs/smart-questions_en.html
I.e. please tell, which Linux OS, you are using, like CentOS6, Fedora 11 etc.

And look for bash with the which command : which bash

I assume you already have used one of these commands : ./install , make.
Then bash is most possibly in use too.

And by the way, did the 'sh test' command work ? ?

..
 
Old 08-14-2011, 04:36 PM   #122
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
having the same error

Hellow everyody
me too i had the same error melokuhle had when i tried to setup the leach on ns2.34 using above steps:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.

Can anyone help me asap please as i need it badly
 
Old 08-14-2011, 04:40 PM   #123
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
Dears,
I had the same problem mealokuhle had when i tried to install leach on ns2.34 using above steps, the errors are:
trace/cmu-trace.cc:1327: error: ‘format_rca’ was not declared in this scope
trace/cmu-trace.cc: At global scope:
trace/cmu-trace.cc:1523: error: no ‘void CMUTrace::format_rca(Packet*, int)’ member function declared in class ‘CMUTrace’
make: *** [trace/cmu-trace.

can anyone help plz asap as i need it badly
thanks in advance
 
Old 08-15-2011, 03:59 AM   #124
exidus
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Rep: Reputation: Disabled
@monazEssam

Hi,
you must have these pieces of code (lines between #ifdef and #endif) in file trace/cmu-trace.cc

Code:
...
	case PT_ARP:
		format_arp(p, offset);
		break;
#ifdef MIT_uAMPS
	case PT_RCA:
		format_rca(p,offset);
		break;
#endif
	default:
...
and append this to end of file

Code:
#ifdef MIT_uAMPS
void
CMUTrace::format_rca(Packet *p, int offset)
{
    struct hdr_rca *rca_hdr = HDR_RCA(p);
    char op = (char) type_;

    switch (rca_hdr->msg_type())
      {
      case ADV:
        op = ADV_CHAR;
        break;

      case REQ:
        op = REQ_CHAR;
        break;

      case DATA:
        op = DATA_CHAR;
        break;

      default:
        //printf("format_rca:  Warning, unknown meta-data type %d\n",rca_hdr->msg_type());
        op = (char) type_;
        break;
      }

    sprintf(pt_->buffer() + offset, "------- [%c %d %d %d] ",
        op,
        rca_hdr->rca_src(),
        rca_hdr->rca_link_dst(),
        rca_hdr->rca_mac_dst()
        );
    return;
}
#endif
This may help you

Last edited by exidus; 08-15-2011 at 04:00 AM.
 
1 members found this post helpful.
Old 08-16-2011, 05:26 AM   #125
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
Thanks exidus, it's working now, the make file executed without errors but when i type ./test and try to run the .nam file i found there are only 3 nodes and there is no connection between them, so i need to know how can i see the simulation of the leach i mean i need to see the clusters and cluster heads formed and sending we receiving the packets after the clusters formed

also if i want to add something to the packets sent and received in leach , where should i add my code?
 
Old 08-16-2011, 05:47 AM   #126
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
Dears,
I got this error in leach.err file when i run the test file:
can't read "env(RCA_LIBRARY)": no such variable
while executing
"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.tcl" line 187)

Can anyone help?
 
Old 08-17-2011, 07:22 AM   #127
exidus
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Rep: Reputation: Disabled
@monazEssam

Answer for your problem is in post #58
You must change path to sources in file /mit/uAMPS/sims/umaps.tcl

For example you must change all 7 sources from this:
source $env(RCA_LIBRARY)/ns-ranode.tcl
to this
source /your_path_to_ns2/ns-2.34/mit/rca/ns-ranode.tcl
 
Old 08-19-2011, 06:30 PM   #128
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
@exidus: thank you exidus for your support to me. thanks GOD the leach now is running without errors but i have 2 questions:

The first question is:
there are some files in mit/leach_sims i don't know their structure and can't understand their content and i tried to search for them in leach files to know when and where they are filled but i can't find anything:
Leach.Data
leach.alive
Leach.save1
Leach.save2

the second question that i want to add a security to all leach packets/messages. i mean i want to encrypt all sent messages in leach protocol before they are sent and decrypt them on receiving, could you tell me where exactly(in which files) i can add my code for encryption & decryption at each sent and receive function in leach protocol

thanks in advance
 
Old 08-21-2011, 04:34 AM   #129
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
Dears,
i want to know the name of the trace file i should analyze it when running the leach using ./test as i found alto of .tr (like out.tr, 694demo.tr and leach.tr ) files and i don't know which one i should analyze it for leach performance

also the name file names 694demo.nam when i run it , it simulated 2 nodes with no connection , while in leach_test file the used topology is :topology_file="mit/uAMPS/sims/100nodes.txt". which contains 100 nodes not only 3 and i can't see the clusters formation in the nam simulation, how can i see it?

Thanks in advance,
Mona Essam
 
Old 08-23-2011, 06:51 AM   #130
monazEssam
LQ Newbie
 
Registered: Aug 2011
Posts: 22

Rep: Reputation: Disabled
dears,
Has anyone an awk script for energy consumption, throuhput and the packets delay for leach trace files?
 
Old 08-23-2011, 12:44 PM   #131
subzero155
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Rep: Reputation: Disabled
Leach

HI,

I am trying to add LEACH to NS2.35 on Cygwin by following these steps but I am getting this error when I make:
Code:
queue/priqueue.cc: In member function `virtual void PriQueue::recv(Packet*, Hand
ler*)':
queue/priqueue.cc:94: error: `PT_MDART' was not declared in this scope
make: *** [queue/priqueue.o] Error 1
Any ideas why?

Thanks

Quote:
Originally Posted by MayTamer View Post
I suppose that ns-2.34 is installed with the compiler gcc-4.3.
The home directory of ns-2.34 is "/opt/ns-allinone-2.34"
1- download the package "ns-234-leach.tar.gz" into the directory "/opt/ns-allinone-2.34/ns-2.34".
https://docs.google.com/uc?id=0BzLWx...CNWG1NQK&hl=en
2- download the bash file "leach-setup.sh" into the directory "/opt/ns-allinone-2.34/ns-2.34".
https://docs.google.com/uc?id=0BzLWx...CJSU5ZYG&hl=en
3- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the file "leach-setup.sh".
4- move to the directory "/opt/ns-allinone-2.34/ns-2.34" and patch the file "leach-setup.sh"
wsn@ubuntu:~$ cd /opt/ns-allinone-2.34/ns-2.34/
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
5- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the follwoing two files:
- "Makefile" : found in the directory "yourpath/ns-allinone-2.34/ns-2.34".
- "Makefile.in" : found in the directory "yourpath/ns-allinone-2.34/ns-2.34".
6. Edit both “Makefile” & “Makefile.in” as following:
CC = gcc-4.3
CPP = g++-4.3
7- run the following commands
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./configure
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make clean
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make
7- If the previous commands passed successfully then you are ready to test your "Leach" by running ./test:
wsn@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./test
8. check the file "leach.err", if no error reported then go to "leach.out" and enjoy your results!
 
Old 08-25-2011, 04:37 AM   #132
exidus
LQ Newbie
 
Registered: Jun 2011
Posts: 14

Rep: Reputation: Disabled
@monazEssam

1. Main output file is leach.out. There are information about which file is a cluster head, which node send a message etc. You can see total spend energz at the end of file. Can you check a number of total energy at the end of simulation when you simulate 100 nodes?

2. If you want to add security to leach packets, I think that a good place for it will be a files mit/rca/rcagent.cc and mit/uAMPS/bsagent.cc. There are function for sending and receiving packets. But I am not sure if my idea is correct.

3. Trace file is for leach_test file is leach.tr in ns-2.34 directory. I think that nam file is not created for leach_test.
 
1 members found this post helpful.
Old 08-25-2011, 06:52 AM   #133
subzero155
LQ Newbie
 
Registered: Aug 2011
Posts: 3

Rep: Reputation: Disabled
Leach

Thank you. I have managed to implement LEACH on ns2.34. However, I don't know how to use the test output files such as leach.energy and leach.data, etc. Is there any recommended resource that explains them?

Regards


Quote:
Originally Posted by exidus View Post
@monazEssam

1. Main output file is leach.out. There are information about which file is a cluster head, which node send a message etc. You can see total spend energz at the end of file. Can you check a number of total energy at the end of simulation when you simulate 100 nodes?

2. If you want to add security to leach packets, I think that a good place for it will be a files mit/rca/rcagent.cc and mit/uAMPS/bsagent.cc. There are function for sending and receiving packets. But I am not sure if my idea is correct.

3. Trace file is for leach_test file is leach.tr in ns-2.34 directory. I think that nam file is not created for leach_test.
 
Old 08-25-2011, 12:19 PM   #134
farab
LQ Newbie
 
Registered: Aug 2011
Posts: 18

Rep: Reputation: 22
It worked Thanks all.

---------- Post added 08-25-11 at 08:49 PM ----------

Thanks a lot all mates. I have created a simple how to, called: "Installing NS and LEACH on ubuntu" in PDF format and I want to share my experinces collected from this usefull site:

Code:
I suppose that you have: 

1. Ubuntu installed on your machine and I suggest ubuntu 10.10.

2. ns-2.34 is installed in "/opt/ns-allinone-2.34" this is path is optional but it could be easier if this path changed because the default directory of LEACH is "/opt/ns-allinone-2.34/ns-2.34".

3. The gcc-4.3 compiler. If not, First you MUST install gcc-4.3 and g++-4.3. It seems gcc-4.2 and g++-4.2 will work but I suggest 4.3:
		Add following lines to end of the  /etc/apt/sources.list by:
		
		sudo gedit /etc/apt/sources.list

deb http://76.73.4.58/ubuntu/ maverick-updates main
deb http://76.73.4.58/ubuntu/ maverick universe
deb http://security.ubuntu.com/ubuntu maverick-security main
deb http://security.ubuntu.com/ubuntu maverick-security universe

		Now save the file and close, then refresh your catalog by:

		sudo apt-get update

		Now gcc-4.3 and g++-4.3 will be available. install them:

		sudo apt-get install gcc-4.3 and g++-4.3

		If you prefer 4.2, simlpy add 'hardy' instead of  'maverick'. And:
		
		sudo apt-get install gcc-4.2 and g++-4.2


Download and install LEACH

1- download the package "ns-234-leach.tar.gz" into the directory "/opt/ns-allinone-2.34/ns-2.34".
	https://docs.google.com/uc?id=0BzLWx...CNWG1NQK&hl=en

2- download the bash file "leach-setup.sh" into the directory "/opt/ns-allinone-2.34/ns-2.34".
	https://docs.google.com/uc?id=0BzLWx...CJSU5ZYG&hl=en

3- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the file "leach-setup.sh".

4- move to the directory "/opt/ns-allinone-2.34/ns-2.34" and patch the file "leach-setup.sh"
	farab@ubuntu:~$ cd /opt/ns-allinone-2.34/ns-2.34/

	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh

5- If the home directory of your "ns-2.34" is other than "/opt/...", then you need to find "/opt/ns-allinone-2.34" and replace with "yourpath/ns-allinone-2.34" for the follwoing two files:
	- "Makefile" : found in the directory "yourpath/ns-allinone-2.34/ns-2.34".
	- "Makefile.in" : found in the directory "yourpath/ns-allinone-2.34/ns-2.34".

6. Edit both “Makefile” & “Makefile.in” as following:
	CC = gcc-4.3
	CPP = g++-4.3

7. You need to add a declaration of format_rca in cmu-trace.h found in the directory "yourpath/ns-allinone-2.34/ns-2.34/”.

        void    format_imep(Packet *p, int offset);
        void    format_aodv(Packet *p, int offset);
        void    format_aomdv(Packet *p, int offset);
#ifdef MIT_uAMPS
        void    format_rca(Packet *p, int offset);
#endif

        // This holds all the tracers added at run-time
        static PacketTracer *pktTrc_;

};

And the flowing lins to end of that:

#ifdef MIT_uAMPS
#define ADV_CHAR             'A'
#define REQ_CHAR             'R'
#define DATA_CHAR            'D'
#endif
8. Then, modify the uamps.tcl in the /opt/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/ folder and replace:
	$env(uAMPS_LIBRARY) with  yourpath/ns-allinone-2.34/ns-2.34/mit/rca
and
	$env(uAMPS_LIBRARY) with  yourpath/ns-allinone-2.34/ns-2.34/mit/uAMPS

9. You need to set the variables in \tcl\lib\ns-default.tcl

# ------------------------------------------------------
Phy/WirelessPhy set alive_ 1
Phy/WirelessPhy set Efriss_amp_ 100e-12
Phy/WirelessPhy set Etwo_ray_amp_ 0.013e-12 

Phy/WirelessPhy set EXcvr_ 50e-9
Phy/WirelessPhy set sleep_ 0
Phy/WirelessPhy set ss_ 1 
Phy/WirelessPhy set dist_ 0
# ------------------------------------------------------

once u modify the .tcl, make sure you do a 'make clean' and a 'make depend'

10. run the following commands:

 	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./configure
 	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make clean
 	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$make
      	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$sudo chmod 777 -R ns-allinone-2.34

If the previous commands passed successfully then you are ready to test your "Leach" by running ./test:
 	farab@ubuntu:/opt/ns-allinone-2.34/ns-2.34$./test
check the file "leach.err", if no error reported then go to "leach.out" and enjoy your results!
 
Old 09-03-2011, 11:54 AM   #135
jimctu
LQ Newbie
 
Registered: Aug 2011
Posts: 13

Rep: Reputation: Disabled
Hi everyone, I followed the tips here and got ns-2.34 + leach working (I guess hehehe) but my leach.out has some warnings?
Code:
Warning dst_ is no longer being supported in NS. dst_ 0xffffffff
Use dst_addr_ and dst_port_ instead
some one knows where I change it and which one I have to use?
 
  


Reply

Tags
leach, leach-warning50, ns2, ns2 ns234, pegasis


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
ns:"error when calling class OldSim"&tclsh:"invalid command+child process exits abn." shojaru Linux - Newbie 0 03-05-2009 04:23 AM
labview stopped at "init tmp resource files" on FC4 baosheng Linux - Software 2 09-28-2007 11:02 AM
ORiNOCO WLAN card not working - "failed to allocate resource" hauneboo Linux - Laptop and Netbook 1 11-29-2005 09:08 AM
What "kernel opts" allow PC to power down with "turning energy off"? kornerr Linux - General 1 03-10-2005 12:07 PM
nvidia insmod: "Device or resource busy" w/GeForce 4 MX KeithSpook Linux - Hardware 4 03-03-2004 12:21 PM

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

All times are GMT -5. The time now is 09:51 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