LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Error in running leach_test in NS-2.34 (https://www.linuxquestions.org/questions/linux-newbie-8/error-in-running-leach_test-in-ns-2-34-a-4175519581/)

tsabran 09-21-2014 02:16 AM

Error in running leach_test in NS-2.34
 
Hi all,

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)

Your help are very much appreciated, thanks!

knudfl 09-21-2014 02:48 AM

Leach+pegasis (@exidus) http://www.linuxquestions.org/questions/tags/pegasis/

The latest patch package is exidus-pegasis-leach-ns234-patch.2.tar.gz
https://drive.google.com/file/d/0B7S...it?usp=sharing

A build example : http://www.linuxquestions.org/questi...-a-4175504301/
( "leach+pegasis-ns234-files-2.tar.gz" is identical with
exidus-pegasis-leach-ns234-patch.2.tar.gz , it's just a different naming.)

! Important → → Using : http://www.linuxquestions.org/questi...-a-4175505299/

-

tsabran 09-21-2014 06:56 AM

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!

knudfl 09-21-2014 08:08 AM

← #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

Other possibility : You have a failed build.

-

tsabran 09-21-2014 10:05 AM

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!

emprit 02-20-2015 05:02 PM

Quote:

Originally Posted by tsabran (Post 5241819)
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"


All times are GMT -5. The time now is 12:37 AM.