Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
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 am trying to simulate leach on NS2 but I've had problems with running the leach_test. I've followed all steps from installing NS2 up to installing the LEACH patch (used the latest one from exidus). Here's the error message in the leach.err I found.
Code:
couldn't read file "/mit/uAMPS/uamps.tcl": no such file or directory
while executing
"source.orig /mit/uAMPS/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/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)
I've already followed every step, knudfl, the last issue turns out to be a problem with the directory, but now the leach.err contains this message. I'm also using the latest patch from exidus, Ubuntu 12.04, and g++-4.4.
Code:
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/tamisabran/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl" line 11)
invoked from within
"source.orig /home/tamisabran/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/tamisabran/ns-allinone-2.34/ns-2.34/mit/rca/resources/ns-energy-resource.tcl"
(file "mit/uAMPS/sims/uamps.tcl" line 23)
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)
I've read the posts related to similar problems, tried the solutions as well but somehow the leach.err stays like this. Do you have any other possible solution for this? Thank you in advance!
Distribution: PCLinuxOS2023 Fedora38 + 50+ other Linux OS, for test only.
Posts: 17,511
Rep:
← #3 .
Quote:
invalid command name "Resource/Energy"
May be you are using the wrong executable 'ns' ?
Solution : Delete all ns2 related PATH entries you may have in .bashrc,
and do : $ cd ns-allinone-2.34/ns-2.34/ && sudo make install
( 'make install' will copy 'ns' to /usr/local/bin/ ).
? Are you sure you are doing
export RCA_LIBRARY=/home/tsabran/ns-allinone-2.34/ns-2.34/mit/rca && export uAMPS_LIBRARY=/home/tsabran/ns-allinone-2.34/ns-2.34/mit/uAMPS && ./test
I've followed your advice the leach_test now is running but now the leach.out is not as expected. I've also read some threads that mentions similar problems but have not exactly solved the problem I have now.
Below is content of leach.out
Code:
Creating sensor nodes... - uAMPS.tcl
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (100 == BS) - uAMPS.tcl
*** NOTE: no connection pattern specified. - wireless.tcl
Loading scenario file... - wireless.tcl
Node 0: (67.837825076579037,0.95365322239401429)
Node 1: (5.6106347616811441,59.567387057266842)
Node 2: (12.847064953691822,12.473798362758847)
Node 3: (51.243302110230225,83.015594297561606)
...
Max Distance for this Simulation is 138.0
Load complete... - wireless.tcl
Starting Simulation... - wireless.tcl
THRESH = 0.01 - ns-leach.tcl
0: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
1: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
2: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
3: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
4: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
5: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
6: ******************************************* - ns-leach.tcl
...
Cluster Head 63 broadcasting ADV at time 4.7729349769525859e-05 - ns-leach.tcl
0: Warning!!! No Cluster Head ADVs were heard! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 0 sending {{0 , 0.00116}} to BS at time 0.0027482888117750588 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
...
55 rcvd ADV_CH from 63 at 0.10513800972892393 - ns-leach.tcl
85 rcvd ADV_CH from 63 at 0.10513802212761844 - ns-leach.tcl
62 rcvd ADV_CH from 63 at 0.10513802240024794 - ns-leach.tcl
5 rcvd ADV_CH from 63 at 0.10513803192315134 - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 0 sending {{0 , 0.84116000000000002}} to BS at time 0.84175207777054617 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 1 sending {{1 , 0.84116000000000002}} to BS at time 0.84248958218982894 - ns-leach.tcl
...
Node 95 is DEAD!!!! - ns-leach.tcl
Node 96 is DEAD!!!! - ns-leach.tcl
Node 97 is DEAD!!!! - ns-leach.tcl
Node 98 is DEAD!!!! - ns-leach.tcl
Node 99 is DEAD!!!! - ns-leach.tcl
At 1.0999999999999999: - mit/uAMPS/stats.tcl
Total Energy = 2.0152459364510666
Total Data = 0
Total Alive = 0
Simulation complete. - mit/uAMPS/stats.tcl
num_nodes is set 101
Thank you so so much, I really appreciate your time and help!
Location: jl. bogor 1 no 91, malang, jawa timur, indonesia
Distribution: any linux
Posts: 81
Rep:
Quote:
Originally Posted by tsabran
I've followed your advice the leach_test now is running but now the leach.out is not as expected. I've also read some threads that mentions similar problems but have not exactly solved the problem I have now.
Below is content of leach.out
Code:
Creating sensor nodes... - uAMPS.tcl
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 (100 == BS) - uAMPS.tcl
*** NOTE: no connection pattern specified. - wireless.tcl
Loading scenario file... - wireless.tcl
Node 0: (67.837825076579037,0.95365322239401429)
Node 1: (5.6106347616811441,59.567387057266842)
Node 2: (12.847064953691822,12.473798362758847)
Node 3: (51.243302110230225,83.015594297561606)
...
Max Distance for this Simulation is 138.0
Load complete... - wireless.tcl
Starting Simulation... - wireless.tcl
THRESH = 0.01 - ns-leach.tcl
0: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
1: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
2: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
3: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
4: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
5: ******************************************* - ns-leach.tcl
THRESH = 0.01 - ns-leach.tcl
6: ******************************************* - ns-leach.tcl
...
Cluster Head 63 broadcasting ADV at time 4.7729349769525859e-05 - ns-leach.tcl
0: Warning!!! No Cluster Head ADVs were heard! - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 0 sending {{0 , 0.00116}} to BS at time 0.0027482888117750588 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
...
55 rcvd ADV_CH from 63 at 0.10513800972892393 - ns-leach.tcl
85 rcvd ADV_CH from 63 at 0.10513802212761844 - ns-leach.tcl
62 rcvd ADV_CH from 63 at 0.10513802240024794 - ns-leach.tcl
5 rcvd ADV_CH from 63 at 0.10513803192315134 - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 0 sending {{0 , 0.84116000000000002}} to BS at time 0.84175207777054617 - ns-leach.tcl
Data was sent to the base station - ns-leach.tcl
Data being sent to the Base Station - ns-leach.tcl
Node 1 sending {{1 , 0.84116000000000002}} to BS at time 0.84248958218982894 - ns-leach.tcl
...
Node 95 is DEAD!!!! - ns-leach.tcl
Node 96 is DEAD!!!! - ns-leach.tcl
Node 97 is DEAD!!!! - ns-leach.tcl
Node 98 is DEAD!!!! - ns-leach.tcl
Node 99 is DEAD!!!! - ns-leach.tcl
At 1.0999999999999999: - mit/uAMPS/stats.tcl
Total Energy = 2.0152459364510666
Total Data = 0
Total Alive = 0
Simulation complete. - mit/uAMPS/stats.tcl
num_nodes is set 101
Thank you so so much, I really appreciate your time and help!
sir how u fix it about error invalid command name "Resource/Energy"
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.