LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Software (https://www.linuxquestions.org/questions/linux-software-2/)
-   -   how to integrate the "Resource/Energy" leach class into NS-2.34? (https://www.linuxquestions.org/questions/linux-software-2/how-to-integrate-the-resource-energy-leach-class-into-ns-2-34-a-870368/)

MayTamer 03-22-2011 09:49 PM

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!!!!!

knudfl 03-23-2011 03:44 AM

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

..

MayTamer 03-25-2011 10:04 AM

solved!!
 
Thank you very much, Leach is working now on ns-2.34 :) I've started from scratch and installed g++4.3.

knudfl 03-25-2011 12:42 PM

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

..

MayTamer 03-31-2011 06:34 PM

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!

knudfl 03-31-2011 07:03 PM

Thank you for the excellent description and the repacked files.



Regards.

..

melokuhle 04-30-2011 08:46 AM

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

MayTamer 04-30-2011 11:20 PM

did you try to change the path in bash file to '/home/keepwalking/..' ?

jschiwal 05-01-2011 12:14 AM

Moved: This thread is more suitable in Linux-Software and has been moved accordingly to help your question get the exposure it deserves.

melokuhle 05-03-2011 04:52 AM

@Maytamer
Yes I did so but It still show me the same error can any one help me to solve this problem

knudfl 05-03-2011 05:09 AM

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"

..

magicbullet 05-04-2011 07:50 PM

How did you install gcc-4.3 on Ubuntu 11.04?
Thanks

knudfl 05-05-2011 03:29 AM

@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

..

melokuhle 05-05-2011 04:35 AM

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

melokuhle 05-05-2011 05:18 AM

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.


All times are GMT -5. The time now is 04:56 PM.