how to integrate the "Resource/Energy" leach class into NS-2.34?
Linux - SoftwareThis 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
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
@deepa
hi, deepa, i want to calculate energy of CH.for that i used set E [[$currentCH_ getER]query] but its not working..it shows that invalid command name "0"..here "0" is ChID..when i use set E [[$self_ getER]query], it works well for that current node..but how can i get cluster head energy..please help..
@helyos #64
m getting the same leach.err file contents as you were getting
Also made modifications in uAMPS file as told by deepa
now after making moifications when m doing
saurabh@saurabh-Satellite-C850:~/ns-allinone-2.34/ns-2.34$ ./test
m getting
couldn't open "694demo.tr": permission denied
while executing
"open $opt(tr) w"
invoked from within
"set tracefd [open $opt(tr) w]"
(file "wireless-demo-csci694.tcl" line 121)
saurabh@saurabh-Satellite-C850:~/ns-allinone-2.34/ns-2.34$ ./test
num_nodes is set 3
warning: Please use -channel as shown in tcl/ex/wireless-mitf.tcl
INITIALIZE THE LIST xListHead
Loading connection pattern...
Loading scenario file...
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
SORTING LISTS ...DONE!
NS EXITING...
m getting the test file executed properlybut in leach.err m getting the error as ./ns-2.34/mit/leach_sims there this is the file
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 "/home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.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 /home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 30)
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)
m getting the same contents in /ns-2.34/mit/leach_sims/leach.err mentioned below.
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 "/home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.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 /home/saurabh/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 30)
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)
Also as pr your post I have changed all paths in uAMPS.tcl file but still while executing ./test err file showing me the same contents......
@helyos #64
m getting the same leach.err file contents as you were getting
Also made modifications in uAMPS file as told by deepa
now after making moifications when m doing
saurabh@saurabh-Satellite-C850:~/ns-allinone-2.34/ns-2.34$ ./test
m getting
couldn't open "694demo.tr": permission denied
while executing
"open $opt(tr) w"
invoked from within
"set tracefd [open $opt(tr) w]"
(file "wireless-demo-csci694.tcl" line 121)
You haven't made the changes to leach_test .. The changes involve setting the proper wireless.tcl.
Quote:
Originally Posted by mittal_saurabhin
@helyos #64
m getting the same leach.err file contents as you were getting
Also made modifications in uAMPS file as told by deepa
now after making moifications when m doing
saurabh@saurabh-Satellite-C850:~/ns-allinone-2.34/ns-2.34$ ./test
m getting
couldn't open "694demo.tr": permission denied
while executing
"open $opt(tr) w"
invoked from within
"set tracefd [open $opt(tr) w]"
(file "wireless-demo-csci694.tcl" line 121)
@deepa,
hi deepa..i want the clusters formed in first round which is presented in ns-bsapp.tcl but i want to retrieve that array or list in ns-leach.tcl for some work..but it is not retrieved directly..just some post before u said that though one function is in other tcl file, for accessing it we dont require its path as it is already defined in uamps.tcl.but m unable to retrieve that cluster info..please help me..thanx in advance..
as per comment #600 I have changed the name of my file from wireless.tcl to wireless_leach.tcl
Also I have changed the path of number of statements in that file for various tcl files used with source command
now finally what m getting after using ns command is
Today I reinstall ns-2.34 and then leach protocol
but when I run make command it gives error
trace/cmu-trace.cc:1531: error: stray ‘\342’ in program
trace/cmu-trace.cc:1531: error: stray ‘\200’ in program
trace/cmu-trace.cc:1531: error: stray ‘\230’ in program
trace/cmu-trace.cc:1531: error: stray ‘\342’ in program
trace/cmu-trace.cc:1531: error: stray ‘\200’ in program
trace/cmu-trace.cc:1531: error: stray ‘\231’ in program
trace/cmu-trace.cc:1535: error: stray ‘\342’ in program
trace/cmu-trace.cc:1535: error: stray ‘\200’ in program
trace/cmu-trace.cc:1535: error: stray ‘\230’ in program
trace/cmu-trace.cc:1535: error: stray ‘\342’ in program
trace/cmu-trace.cc:1535: error: stray ‘\200’ in program
trace/cmu-trace.cc:1535: error: stray ‘\231’ in program
trace/cmu-trace.cc:1539: error: stray ‘\342’ in program
trace/cmu-trace.cc:1539: error: stray ‘\200’ in program
trace/cmu-trace.cc:1539: error: stray ‘\230’ in program
trace/cmu-trace.cc:1539: error: stray ‘\342’ in program
trace/cmu-trace.cc:1539: error: stray ‘\200’ in program
trace/cmu-trace.cc:1539: error: stray ‘\231’ in program
trace/cmu-trace.cc: In member function ‘void CMUTrace::format_rca(Packet*, int)’:
trace/cmu-trace.cc:1531: error: ‘A’ was not declared in this scope
trace/cmu-trace.cc:1535: error: ‘R’ was not declared in this scope
trace/cmu-trace.cc:1539: error: ‘D’ was not declared in this scope
make: *** [trace/cmu-trace.o] Error 1
Although I have added
#ifdef MIT_uAMPS
void format_rca(Packet *p, int offset);
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’
#endif
in file cmu-trace.h
Problem solved .
It was
}
#define ADV_CHAR ‘A’
#define REQ_CHAR ‘R’
#define DATA_CHAR ‘D’
}
Please help me, am unable to run my leach.nam, it displays nothings, is there a problem with my wireless.tcl or am doing somethings wrong, my leach.out and other came out good but the leach.nam that was generated didnt work, what should i do please?, am stuck here
Did you copy the wireless_leach.tcl to the tcl folder ?
PLEASE READ THE BLOG LINK I pasted.
Quote:
Originally Posted by mittal_saurabhin
@deepa
as per comment #600 I have changed the name of my file from wireless.tcl to wireless_leach.tcl
Also I have changed the path of number of statements in that file for various tcl files used with source command
now finally what m getting after using ns command is
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.