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.
set nr [$ResourceManager_ getResourceByType Resource/NeighborResource]
return $nr
}
[\code]
then I called:
[code]
[[$self getNR] query_ext nodeID]
[\code]
it returns "". I think this is because I didn't define the ID correctly as stated here:
[code]
# Querying for a specific ID returns the descriptor for that ID
# and the distance, if the desc is a wireless neighbor.
# If that ID is not available, we return "".
[code]
Resource/NeighborResource instproc query_ext id {
$self instvar neighbor_list_
if {$id == "all"} {
return $neighbor_list_
}
foreach n $neighbor_list_ {
if {$id == [$n setId]} {
return $n
}
}
return ""
}
[\code]
if you have time, really appreciate if you could suggest how to set the ID or any related args...thank you
I also tried to define a new function in ns-ranode.tcl, similar to getER for energy:
Code:
MobileNode/ResourceAwareNode instproc getNR {} {
$self instvar ResourceManager_
set nr [$ResourceManager_ getResourceByType Resource/NeighborResource]
return $nr
}
then I called:
Code:
[[$self getNR] query_ext nodeID]
it returns "". I think this is because I didn't define the ID correctly as stated here:
Code:
# Querying for a specific ID returns the descriptor for that ID
# and the distance, if the desc is a wireless neighbor.
# If that ID is not available, we return "".
Resource/NeighborResource instproc query_ext id {
$self instvar neighbor_list_
if {$id == "all"} {
return $neighbor_list_
}
foreach n $neighbor_list_ {
if {$id == [$n setId]} {
return $n
}
}
return ""
}
really appreciate if you could suggest how to set the ID or any related args...thank you
@minhntbkhn & @deepa_2111
thanks minhntbkhn for pegasis, its very helpful
I wanna to add security on leach
for example I want to encrypt packets and then send
my first question is where can I add codes of encryption algorithm (tcl files or ...)?
and second, this algorithms dissipate energy of node,where can I consider the energy dissipation?
please help me,plzzzzzzz
alos my leach.out file is empty. while
leach.err file has these errors
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/ns2/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /root/ns2/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/ns2/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 24)
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)
@engr
to solve errors in leach.err :
open uamps.tcl from work/ns-allinone-2.34/ns-2.34/mit/uAMPS/sims
Add these codes in it(after "global opt bs" line):
hi friends.. i need to calculate the means energy of each cluster in leach.. can anyone help me how can i define this function?
one more thing do i need to write new .cc and .h files for my modification in leach or its better to modify the existing leach.tcl files? kindly reply me asap
hi every one.. i need to calculate the average energy for each cluster how can i add this in the leach code.. can anyone plz guide me
reply here asap.
regards
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.