LinuxQuestions.org
Did you know LQ has a Linux Hardware Compatibility List?
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 03-22-2011, 09:49 PM   #1
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Rep: Reputation: 36
how to integrate the "Resource/Energy" leach class into NS-2.34?


Hello ...
I recently started installing leach protocol on NS-2.34 and Ubuntu 11.04.
I'm sure that I did all the necessary steps that were mentioned in this thread and other threads related Leach.
However, when running the ./test I got this error :
invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams {args} {
$self instvar energyLevel_ alarmLevel_
set energyLevel_ [lindex $args 0]
set alarmLevel_ [lind..."
(file "/opt/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
........
I've read that I need to use either g++3.3 or g++4.1, but seems as there's a problem in installing these versions of compiler.
Can any one help me to integrate the "Resource/Energy" class into NS-2.34? Please!!!!!
 
Old 03-23-2011, 03:44 AM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,678

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
Welcome to LQ.

Add 'hardy' to /etc/apt/sources.list : g++-3.3....gcc-4.2((g++-4.2)) will be available.
sudo gedit /etc/apt/sources.list ; sudo apt-get update
Code:
deb http://76.73.4.58/ubuntu/ hardy-updates main
deb http://76.73.4.58/ubuntu/ hardy universe
deb http://security.ubuntu.com/ubuntu hardy-security main
deb http://security.ubuntu.com/ubuntu hardy-security universe
A missing "Resource/Energy" : It was not compiled into ns.
All new objects must be added to 'Makefile' ( Makefile.in ).
Patch ns234-leach.tar.bz2 https://docs.google.com/uc?id=0B7S25...CJzYt5QP&hl=en
May be compare the Makefile with the original ns-2.27 LEACH Makefile :
https://docs.google.com/uc?id=0B7S25...CNPCuaYP&hl=en

EDIT : See post # 22

..

Last edited by knudfl; 09-10-2011 at 05:45 AM.
 
Old 03-25-2011, 10:04 AM   #3
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 36
solved!!

Thank you very much, Leach is working now on ns-2.34 I've started from scratch and installed g++4.3.
 
1 members found this post helpful.
Old 03-25-2011, 12:42 PM   #4
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,678

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
Several members have asked how to add "ns234-leach files" to ns-2.34.

It will be very much appreciated, if you can write a short HOWTO.

Either here in the thread, or a in a blog entry :
http://www.linuxquestions.org/questi...yTamer-578702/
Or LQ 'Linux Wiki'
http://wiki.linuxquestions.org/wiki/Main_Page

..

Last edited by knudfl; 03-26-2011 at 04:45 AM.
 
Old 03-31-2011, 06:34 PM   #5
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 36
Install Leach on ns-2.34

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!

Last edited by MayTamer; 03-31-2011 at 07:02 PM. Reason: syntax error
 
6 members found this post helpful.
Old 03-31-2011, 07:03 PM   #6
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,678

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
Thank you for the excellent description and the repacked files.



Regards.

..

Last edited by knudfl; 04-01-2011 at 02:04 AM.
 
Old 04-30-2011, 08:46 AM   #7
melokuhle
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 2
Hello All

I tried to install LEACH on ns2.34 but IO got thi error when I was trying to Install it.keepwalking@ubuntu:~/ns-allinone-2.34/ns-2.34$ bash leach-setup.sh
ns-234-leach/trace/cmu-trace.cc
ns-234-leach/trace/
ns-234-leach/test
ns-234-leach/tcl/mobility/stat-clus.tcl
ns-234-leach/tcl/mobility/mte.tcl
ns-234-leach/tcl/mobility/leach.tcl
ns-234-leach/tcl/mobility/leach-c.tcl
ns-234-leach/tcl/mobility/
ns-234-leach/tcl/ex/wireless.tcl
ns-234-leach/tcl/ex/
ns-234-leach/tcl/
ns-234-leach/package_up
ns-234-leach/mit/uAMPS/stats.tcl
ns-234-leach/mit/uAMPS/sims/uamps.tcl
ns-234-leach/mit/uAMPS/sims/stat-clus.tcl
ns-234-leach/mit/uAMPS/sims/nodescen
ns-234-leach/mit/uAMPS/sims/mte.tcl
ns-234-leach/mit/uAMPS/sims/leach.tcl
ns-234-leach/mit/uAMPS/sims/leach-c.tcl
ns-234-leach/mit/uAMPS/sims/genscen
ns-234-leach/mit/uAMPS/sims/100nodes.txt
ns-234-leach/mit/uAMPS/sims/
ns-234-leach/mit/uAMPS/ns-stat-cluster.tcl
ns-234-leach/mit/uAMPS/ns-mte.tcl
ns-234-leach/mit/uAMPS/ns-leach.tcl
ns-234-leach/mit/uAMPS/ns-leach-c.tcl
ns-234-leach/mit/uAMPS/ns-bsapp.tcl
ns-234-leach/mit/uAMPS/extras.tcl
ns-234-leach/mit/uAMPS/bsagent.o
ns-234-leach/mit/uAMPS/bsagent.h
ns-234-leach/mit/uAMPS/bsagent.cc
ns-234-leach/mit/uAMPS/
ns-234-leach/mit/rca/resources/ns-resource.tcl
ns-234-leach/mit/rca/resources/ns-resource-manager.tcl
ns-234-leach/mit/rca/resources/ns-neighbor-resource.tcl
ns-234-leach/mit/rca/resources/ns-energy-resource.tcl
ns-234-leach/mit/rca/resources/
ns-234-leach/mit/rca/resource.o
ns-234-leach/mit/rca/resource.h
ns-234-leach/mit/rca/resource.cc
ns-234-leach/mit/rca/rcagent.o
ns-234-leach/mit/rca/rcagent.h
ns-234-leach/mit/rca/rcagent.cc
ns-234-leach/mit/rca/rca-ll.o
ns-234-leach/mit/rca/rca-ll.h
ns-234-leach/mit/rca/rca-ll.cc
ns-234-leach/mit/rca/ns-ranode.tcl
ns-234-leach/mit/rca/energy.o
ns-234-leach/mit/rca/energy.h
ns-234-leach/mit/rca/energy.cc
ns-234-leach/mit/rca/
ns-234-leach/mit/leach_sims/startup.energy
ns-234-leach/mit/leach_sims/leach.save2
ns-234-leach/mit/leach_sims/leach.save1
ns-234-leach/mit/leach_sims/leach.out
ns-234-leach/mit/leach_sims/leach.err
ns-234-leach/mit/leach_sims/leach.energy
ns-234-leach/mit/leach_sims/leach.data
ns-234-leach/mit/leach_sims/leach.alive
ns-234-leach/mit/leach_sims/conditions.txt
ns-234-leach/mit/leach_sims/TDMAschedule.80.txt
ns-234-leach/mit/leach_sims/TDMAschedule.60.txt
ns-234-leach/mit/leach_sims/TDMAschedule.480.txt
ns-234-leach/mit/leach_sims/TDMAschedule.460.txt
ns-234-leach/mit/leach_sims/TDMAschedule.440.txt
ns-234-leach/mit/leach_sims/TDMAschedule.420.txt
ns-234-leach/mit/leach_sims/TDMAschedule.400.txt
ns-234-leach/mit/leach_sims/TDMAschedule.40.txt
ns-234-leach/mit/leach_sims/TDMAschedule.380.txt
ns-234-leach/mit/leach_sims/TDMAschedule.360.txt
ns-234-leach/mit/leach_sims/TDMAschedule.340.txt
ns-234-leach/mit/leach_sims/TDMAschedule.320.txt
ns-234-leach/mit/leach_sims/TDMAschedule.300.txt
ns-234-leach/mit/leach_sims/TDMAschedule.280.txt
ns-234-leach/mit/leach_sims/TDMAschedule.260.txt
ns-234-leach/mit/leach_sims/TDMAschedule.240.txt
ns-234-leach/mit/leach_sims/TDMAschedule.220.txt
ns-234-leach/mit/leach_sims/TDMAschedule.200.txt
ns-234-leach/mit/leach_sims/TDMAschedule.20.txt
ns-234-leach/mit/leach_sims/TDMAschedule.180.txt
ns-234-leach/mit/leach_sims/TDMAschedule.160.txt
ns-234-leach/mit/leach_sims/TDMAschedule.140.txt
ns-234-leach/mit/leach_sims/TDMAschedule.120.txt
ns-234-leach/mit/leach_sims/TDMAschedule.100.txt
ns-234-leach/mit/leach_sims/TDMAschedule.0.txt
ns-234-leach/mit/leach_sims/
ns-234-leach/mit/
ns-234-leach/mac/wireless-phy.h
ns-234-leach/mac/wireless-phy.cc
ns-234-leach/mac/phy.h
ns-234-leach/mac/phy.cc
ns-234-leach/mac/mac.cc
ns-234-leach/mac/mac-sensor.h
ns-234-leach/mac/mac-sensor.cc
ns-234-leach/mac/mac-sensor-timers.h
ns-234-leach/mac/mac-sensor-timers.cc
ns-234-leach/mac/ll.h
ns-234-leach/mac/channel.cc
ns-234-leach/mac/
ns-234-leach/leach_test
ns-234-leach/common/packet.h
ns-234-leach/common/packet.cc
ns-234-leach/common/mobilenode.cc
ns-234-leach/common/
ns-234-leach/apps/app.h
ns-234-leach/apps/app.cc
ns-234-leach/apps/
ns-234-leach/Makefile.in
ns-234-leach/Makefile
ns-234-leach/
cp: cannot create directory `/keepwalking/ns-allinone-2.34/ns-2.34': No such file or directory
cp: target `/keepwalking/ns-allinone-2.34/ns-2.34/apps' is not a directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/mac': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/mac': No such file or directory
cp: target `/keepwalking/ns-allinone-2.34/ns-2.34/mac' is not a directory
cp: target `/keepwalking/ns-allinone-2.34/ns-2.34/mac' is not a directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/mac': No such file or directory
cp: target `/keepwalking/ns-allinone-2.34/ns-2.34/mac' is not a directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/trace': No such file or directory
cp: target `/keepwalking/ns-allinone-2.34/ns-2.34/common' is not a directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/common': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/tcl/mobility': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/tcl/mobility': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/tcl/mobility': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/tcl/mobility': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34/tcl/ex': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34': No such file or directory
cp: cannot create regular file `/keepwalking/ns-allinone-2.34/ns-2.34': No such file or directory
keepwalking@ubuntu:~/ns-allinone-2.34/ns-2.34$ cd
keepwalking@ubuntu:~$ ns
may you please help me to solve this problem
 
0 members found this post helpful.
Old 04-30-2011, 11:20 PM   #8
MayTamer
LQ Newbie
 
Registered: Mar 2011
Posts: 7

Original Poster
Rep: Reputation: 36
did you try to change the path in bash file to '/home/keepwalking/..' ?
 
Old 05-01-2011, 12:14 AM   #9
jschiwal
Guru
 
Registered: Aug 2001
Location: Fargo, ND
Distribution: SuSE AMD64
Posts: 15,733

Rep: Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654Reputation: 654
Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your question get the exposure it deserves.
 
Old 05-03-2011, 04:52 AM   #10
melokuhle
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 2
@Maytamer
Yes I did so but It still show me the same error can any one help me to solve this problem
 
Old 05-03-2011, 05:09 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,678

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
Post # 7, @ melokuhle.

Please edit post #7 to use code tags :
Write [/code] after the text, and [code] at error text start.
Or use the ( # ) button in the 'Advanced Editor' :
> Edit > Go Advanced.
http://www.linuxquestions.org/questi....php?do=bbcode

About the errors :
The first command to be used is : pwd
.. which will reply with your location.
I.e. you are either doing the command from a wrong location,
or you have no "/keepwalking/ns-allinone-2.34/ns-2.34/tcl/mobility"

..
 
Old 05-04-2011, 07:50 PM   #12
magicbullet
LQ Newbie
 
Registered: May 2011
Posts: 6

Rep: Reputation: 0
How did you install gcc-4.3 on Ubuntu 11.04?
Thanks
 
Old 05-05-2011, 03:29 AM   #13
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2014, Slack14.1 DebWheezy, +50+ other Linux OS, for test only.
Posts: 13,678

Rep: Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546Reputation: 2546
@magicbullet, post # 12 : Welcome to LQ.

No gcc-4.3 for Ubuntu 11.04, but you can then use gcc-4.2. *** EDIT
*** EDIT: see post #22.

Add hardy to etc/apt/sources.list, as described in post # 2.
( sudo gedit etc/apt/sources.list ).


And next ..
sudo apt-get update && sudo apt-get install g++-4.2 gcc-4.2

..

Last edited by knudfl; 08-05-2011 at 11:36 AM.
 
Old 05-05-2011, 04:35 AM   #14
melokuhle
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 2
thanks for help me to solve the above problem now I came across another one may you please help me to solve it.

Last edited by melokuhle; 05-05-2011 at 05:21 AM.
 
Old 05-05-2011, 05:18 AM   #15
melokuhle
LQ Newbie
 
Registered: Apr 2011
Posts: 6

Rep: Reputation: 2
Hello every body


when I'm using the make command I get the following error:
Code:
trace/cmu-trace.cc: In member function ‘void CMUTrace::format(Packet*, const char*)’:
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.o] Error 1
luuh@ubuntu:~/ns-allinone-2.34/ns-2.34$ ns
ns: command not found
can any one help me to to solve this problem.
 
2 members found this post helpful.
  


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


All times are GMT -5. The time now is 11:34 PM.

Main Menu
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
identi.ca: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration