LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   PU activity in crahn-ns2 simulator (https://www.linuxquestions.org/questions/linux-newbie-8/pu-activity-in-crahn-ns2-simulator-4175503446/)

Retta 04-30-2014 09:06 AM

PU activity in crahn-ns2 simulator
 
2 Attachment(s)
Hi guys,

My research is regarding the cognitive radio network, in my project I need to model the Primary User activity so I tried to use the CRAHN simulator which has been published on "https://github.com/abdulla-alali".
I installed the ns and patched it without any problems, but when I tried to execute the crahn_examples I got the following error "invalid command name "PUMap" see the attached images.

It seems like there is a problem with the definition of one of the tcl classes.

May i ask your help/advice, cause i stuck in this.

BR,
Retta

knudfl 04-30-2014 12:27 PM

ns2-CRAHN , ns-2.31 .
 
https://github.com/abdulla-alali

$ git clone https://github.com/abdulla-alali/TFRC-CR
→ → You will get TFRC-CR/ : 54 folders and 30 files → No CRAHN.

How to get CRAHN ( Use a new folder, git doesn't write into TFRC-CR/ ? )
Ref. http://krc.coe.neu.edu/?q=node/16
$ git clone git://github.com/abdulla-alali/TFRC-CR.git -b CRAHN
Now with `CRAHN´ : TFRC-CR/ alias TFRC-CRAHN : 55 folders and 31 files :
* The folder cognitive/, and a new Makefile.in with the 8 times cognitive/*.o
* And the file README.md, that tells how to get CRAHN !
Quote : 1. Get ns-allinone-2.31.tar.gz and extract it
2. Install git, e.g. in Debian: ```sudo apt-get install git```
3. Clone this repository:
```git clone git://github.com/abdulla-alali/TFRC-CR.git -b CRAHN```
4. You'll end up with a ns-2.31 clone that has the CRAHN module integrated.
Replace the ns-2.31 subfolder (from the ns-allinone file that you already extracted)
with the one you cloned from here.
5. ```./configure``` and then ```make```
----

$ ns-crahn test-3nodes.tcl : OK.
$ ns-crahn test-random-topology.tcl : OK.

--

knudfl 04-30-2014 03:05 PM

There are some missing files in the "TFRC-CRAHN" you get with ..
$ git clone git://github.com/abdulla-alali/TFRC-CR.git -b CRAHN
( The diffusion3/ns/ folder, etc.)

You can use this patch : TFRC-CRAHN_ns231.patch
https://drive.google.com/file/d/0B7S...it?usp=sharing
(Which was made with $ diff -Naur ns-2.31-orig/ ns-2.31/ > TFRC-CRAHN_ns231.patch)

Using : $ tar xvf ns-allinone-2.31.tar.gz
$ cd ns-allinone-2.31/
$ patch -p0 < TFRC-CRAHN_ns231.patch

-

Retta 05-02-2014 04:35 AM

Dear kundfl,

Just to be assured,
$ tar xvf ns-allinone-2.31.tar.gz
$ cd ns-allinone-2.31/
$ patch -p0 < TFRC-CRAHN_ns231.patch (the patch created by you and available on "https://drive.google.com/file/d/0B7S...it?usp=sharing")
$ ./install
$ cd ns-2.31/
$ ./configure
$ make clean
$ make depend
$ make

Is that right???

knudfl 05-02-2014 06:29 AM

# 4 .

Like post #3 :
$ tar xvf ns-allinone-2.31.tar.gz
$ cd ns-allinone-2.31/
$ patch -p0 < TFRC-CRAHN_ns231.patch
$ ./install
... I.e. the build command "install" will do all
the "configure && make" commands automatically.

P.S. :
There is a patch for ns-2.33 too : TFRC-CRAHN_ns233.patch
https://drive.google.com/file/d/0B7S...it?usp=sharing

-

Retta 05-02-2014 08:06 AM

I did exactly what you mentioned in post #4, ns2 is built with the patch and installed successfully.

Unfortunately i got those errors when i tried to execute the CRAHN-examples

-bash-3.2$ ./ns-coh cr_examples/3nodes/test-3nodes.tcl
num_nodes is set 3
INITIALIZE THE LIST xListHead
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
Segmentation fault

-bash-3.2$ ./ns-coh cr_examples/randomTopology/test-random-topology.tcl
syntax error in expression " * 1000": unexpected operator *
while executing
"expr [lindex $argv 1] * 1000 "
invoked from within
"set val(rate) [ expr [lindex $argv 1] * 1000 ]"
(file "cr_examples/randomTopology/test-random-topology.tcl" line 52)

You did mention in #2 its executed successfully.
Any suggestions?

knudfl 05-02-2014 10:40 AM

# 6 .

Well, you must go to the directory with the simulation files.
$ cd CRAHN_examples/cr_examples/3nodes/
$ ./ns-coh test-3nodes.tcl

The README in CRAHN_examples/cr_examples/3nodes/
isn't very clearly written. The text means → →
First line ..
Launch in this directory ( Else no dependencies={channel.txt, map.txt}.)
Next line :
<full-path-to-folder-with-ns>/ns test-3nodes.tcl
( Like $ /home/retta/bin/ns test-3nodes.tcl )


Other possible reasons for simulation(s) to fail :
Using the wrong OS / the wrong compiler.
So you will have to specify your OS :
a) Please show the output from the command $ uname -m
b) OS version : $ cat /etc/redhat-release

-

Retta 05-02-2014 11:10 AM

I went to the directory with the simulation files, and executed the scripts, the errors as follow:

1-
-bash-3.2$ ./ns-coh test-3nodes.tcl
warning: no class variable PUMap::debug_

see tcl-object.tcl in tclcl for info about this warning.

warning: no class variable SpectrumMap::debug_

see tcl-object.tcl in tclcl for info about this warning.

Reading PU Data from File: map.txt
[READING MAP FILE] #PU users: 2
[READING MAP FILE] #PU Location: 1 0.000000 0.000000 #PU Receiver: 100.000000 100.000000 ALPHA: 1.000000e+00 BETA: 1.000000e+00 TX RANGE: 500.000000
[READING MAP FILE] #PU Location: 2 0.000000 0.000000 #PU Receiver: 100.000000 100.000000 ALPHA: 1.000000e+00 BETA: 1.000000e+00 TX RANGE: 500.000000
[READING MAP FILE] #PU data: 1
[READING MAP FILE] #PU arrival: 0 0.000000
[READING MAP FILE] #PU departure: 0 200.000000
[READING MAP FILE] #PU data: 1
[READING MAP FILE] #PU arrival: 1 3.000000
[READING MAP FILE] #PU departure: 1 3.500000
Reading PU Data from File: channel.txt
[READING SPECTRUM FILE] #CHANNEL: 0 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 1 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 2 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 3 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 4 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 5 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 6 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 7 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 8 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 9 #BANDWIDTH: 2000000.000000 PER: 0.000000
[READING SPECTRUM FILE] #CHANNEL: 10 #BANDWIDTH: 2000000.000000 PER: 0.000000
num_nodes is set 3
INITIALIZE THE LIST xListHead
Starting Simulation...
channel.cc:sendUp - Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
Segmentation fault

2-

-bash-3.2$ ./ns-coh test-random-topology.tcl
syntax error in expression " * 1000": unexpected operator *
while executing
"expr [lindex $argv 1] * 1000 "
invoked from within
"set val(rate) [ expr [lindex $argv 1] * 1000 ]"
(file "test-random-topology.tcl" line 52)


So you will have to specify your OS :
a)x86_64
b)CentOS release 5.10 (Final)

knudfl 05-02-2014 12:16 PM

CentOS 5.10 - x86_64 + TFRC-CRAHN
 
#8, #6.

Testing CentOS 5.10 - x86_64 + TFRC-CRAHN ...
No `Segmentation fault´ with the two files test*.tcl,
by using four different 'ns23*-crahn64-gcc<?>' executable´s :

1. ns-allinonne-2.33, TFRC-CRAHN_ns233.patch, gcc34 / g++34.
2. ns-allinonne-2.31, TFRC-CRAHN_ns231.patch, gcc34 / g++34.
3. ns-allinonne-2.31, TFRC-CRAHN_ns231.patch, gcc-4.1.2 / g++-4.1.2.
4. ns-allinonne-2.33, TFRC-CRAHN_ns233.patch, gcc-4.1.2 / g++-4.1.2.
.... ( gcc-4.1.2 / g++-4.1.2 are the default CentOS5 compilers gcc, g++,
and gcc34 / g++34 are the extra compilers "compat-gcc-34-c++".)

? Did you add any other code / patch /// any changes at all to ns-2.31 ?

-

Retta 05-05-2014 08:26 AM

I've re-installed ns-allinone-2.31 and the TFRC-CRAHN_ns231.patch again and i executed the CRAHN_examples:

1- $ ./ns-crahn test-3nodes.tcl : OK.

2- $ ./ns-crahn test-random-topology.tcl
syntax error in expression " * 1000": unexpected operator *
while executing
"expr [lindex $argv 1] * 1000 "
invoked from within
"set val(rate) [ expr [lindex $argv 1] * 1000 ]"
(file "test-random-topology.tcl" line 52)

then i commented line 52 in the script and executed the script again:
$ ./ns-crahn test-random-topology.tcl : OK.

I don't know why i got this error!!!

knudfl 05-05-2014 09:37 AM

# 10 .

Actually the file USAGE in ``cr_examples/randomTopology/´´ says :
$ ns test-random-topology.tcl [NUMBER_CONNECTIONS] [RATE, Kbs] [SEED]

My file is OK with $ test-random-topology.tcl
.. but I get errors like you when adding <options>.

The file lines around line 52 in test-random-topology.tcl are ..
Code:

    48        set val(rp)            AODV                      ;# routing protocol
    49       
    50       
    51        set val(connection)    [lindex $argv 0]
    52        # set val(rate)            [ expr [lindex $argv 1] * 1000 ]
    53        set val(rate)            [ expr [lindex $argv 1] 1000 ]
    54        set val(seed)          [lindex $argv 2]
    55       
    56        # routing: 0 # XCHARM
    57        # routing: 1 # AODV-MR


Retta 05-05-2014 10:30 AM

# 11

I've read the file USAGE and the test-random-topology.tcl script, finally i got it.

To execute the script correctly i must set the number of connections (how many pairs of nodes is going to communicate),
rate in kbs (the transmission rate/bandwidth of the wireless channels), and the seed (introduce a randomness to NS2).

For ex:
$ ./ns-crahn test-random-topology.tcl 10 128 2

then i got:

$ ./ns-crahn test-random-topology.tcl : OK.

***My file is OK with $ test-random-topology.tcl
.. but I get errors like you when adding <options>.

just delete line #53 and uncomment line 52, it should work now with the options.

Actually i can't understand how you executed it without options!!!



I would like to thank you again knudfl for all the support/advice/help you gave to me.
Many many thanks.


Retta

nayanb2k7 06-11-2014 07:33 AM

refer to Post # 2

...
3. Clone this repository:
```git clone git://github.com/abdulla-alali/TFRC-CR.git -b CRAHN```
4. You'll end up with a ns-2.31 clone that has the CRAHN module integrated.


I ran the command as given above but cannot see any CRAHN folder or a different ns-2.31 folder.
Only I could see some 55 folders inside the TFRC-CR folder which I downloaded.

Please help how to proceed with the installation of CRAHN integrated with NS2.31

knudfl 06-11-2014 01:02 PM

Post #13, @nayanb2k7.

""how to proceed"" : Read post #3.

nayanb2k7 06-12-2014 12:46 AM

Finish with the installation.

Now trying to tun the examples (going inside the examples folder) -

$ ns test-random-topology.tcl 10 128 2

The Error is -

num_nodes is set 50
invalid command name "PUMap"
while executing
"PUMap create _o12 "
invoked from within
"catch "$className create $o $args" msg"
invoked from within
"if [catch "$className create $o $args" msg] {
if [string match "__FAILED_SHADOW_OBJECT_" $msg] {
delete $o
return ""
}
global errorInfo
error "class $..."
(procedure "new" line 3)
invoked from within
"new PUMap"
invoked from within
"set pumap [new PUMap]"
(file "test-random-topology.tcl" line 86)


All times are GMT -5. The time now is 02:47 AM.