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.
i referred to the previous threads but unfortunately couldnt solve my problem related to "Resource/energy problem" during leach patch simulation process. It would be really kind of you if you could help me out, as my engineering major project is based on leach protocol simulation in ns-2.34.
Kindly help me.. im getting 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 "/root/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /root/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 /root/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "/root/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl" line 18)
invoked from within
"source.orig /root/ns-allinone-2.34/ns-2.34/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 /root/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl"
(file "/root/ns-allinone-2.34/ns-2.34/tcl/mobility/leach.tcl" line 19)
invoked from within
"source.orig /root/ns-allinone-2.34/ns-2.34/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 /root/ns-allinone-2.34/ns-2.34/tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)
As per your suggestion I have changed path in all files of /home/saurabh/ns-allinone-2.34/ns-2.34/mit foder as per my laptop structure.
After modifications error I am getting is
invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams { args } "
(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 "/home/saurabh/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl" line 29)
invoked from within
"source.orig /home/saurabh/ns-allinone-2.34/ns-2.34/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 /home/saurabh/ns-allinone-2.34/ns-2.34/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]
..."invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams { args } "
(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 "/home/saurabh/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl" line 29)
invoked from within
"source.orig /home/saurabh/ns-allinone-2.34/ns-2.34/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 /home/saurabh/ns-allinone-2.34/ns-2.34/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)d
(procedure "source" line 8)invalid command name "Resource/Energy"
while executing
"Resource/Energy instproc setParams { args } "
(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 "/home/saurabh/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims/uamps.tcl" line 29)
invoked from within
"source.orig /home/saurabh/ns-allinone-2.34/ns-2.34/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 /home/saurabh/ns-allinone-2.34/ns-2.34/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)
invoked from within
"source tcl/mobility/$opt(rp).tcl"
(file "tcl/ex/wireless.tcl" line 187)
@ deepa
**updates**
hey deepa, I called my function in "advertiseClusterHead" as you said and it works perfectly.now what i am doing is, i am checking nodes energy with threshold and if it is greater than it then CH will send TDMA schedule directly to nodes so that nodes can send data to CH. for this my code is:
if{ $E < $TE } {
puts "$nodeID is a cluster head at time [$ns_ now]"
$self setClusterHead
$ns_ at $now_ "self createSchedule"
}
and the output is cluster head sending TDMA schedule.. but the schedule is not received to other non CH nodes and hence data transmission is also not done.what is the reason behind this..please help me as soon as possible..thanks..
@deepa
hi deepa..can u please give me the solution to my problem posted in post#829..I am trying to resolve my problem but i am unable to find the "sendmsg" function which may be presented in any cc file..and why it is not receiving the schedule? please help me..i am really stuck here..please..
First of all, you need a space between 'if' and the '{' in your command "if{ $E < $TE } {".
Quote:
Originally Posted by keepwalking123
@deepa
hi deepa..can u please give me the solution to my problem posted in post#829..I am trying to resolve my problem but i am unable to find the "sendmsg" function which may be presented in any cc file..and why it is not receiving the schedule? please help me..i am really stuck here..please..
@deepa
hi deepa..sorry actually that was typo..there is space between if and bracket..and also there is no any syntax error..mine problem is other nodes are not getting CH tdma schedule..while tracing i have found sendmsg fun in rcagent.cc..and in that the event is scheduled..but still not getting the solution..how can i get it..please help me..
Check if your createSchedule function is being called. And if it is, the time when it is called.
Leave the *.cc files. There is not much you can change in them.
Also, check if you are getting the correct values for 'E' and 'TE'.
Quote:
Originally Posted by keepwalking123
@deepa
hi deepa..sorry actually that was typo..there is space between if and bracket..and also there is no any syntax error..mine problem is other nodes are not getting CH tdma schedule..while tracing i have found sendmsg fun in rcagent.cc..and in that the event is scheduled..but still not getting the solution..how can i get it..please help me..
@deepa
hi deepa, my create schedule is called because it is creating and sending schedule also.but after that the nodes are not receiving the schedule i.e. pointer is not going in recv function..what is the problem here can you tell me??
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.