LinuxQuestions.org
Welcome to the most active Linux Forum on the web.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This 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


Reply
  Search this Thread
Old 04-30-2014, 10:06 AM   #1
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Rep: Reputation: Disabled
PU activity in crahn-ns2 simulator


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
Attached Thumbnails
Click image for larger version

Name:	error while executing test-3nodes.tcl.jpg
Views:	77
Size:	111.9 KB
ID:	15368   Click image for larger version

Name:	error while executing test-random-topology.tcl.jpg
Views:	36
Size:	81.6 KB
ID:	15369  
 
Old 04-30-2014, 01:27 PM   #2
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
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.

--
 
Old 04-30-2014, 04:05 PM   #3
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
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

-
 
2 members found this post helpful.
Old 05-02-2014, 05:35 AM   #4
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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???

Last edited by Retta; 05-02-2014 at 06:29 AM.
 
Old 05-02-2014, 07:29 AM   #5
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
# 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

-
 
2 members found this post helpful.
Old 05-02-2014, 09:06 AM   #6
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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?

Last edited by Retta; 05-02-2014 at 11:31 AM.
 
Old 05-02-2014, 11:40 AM   #7
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
# 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

-

Last edited by knudfl; 05-02-2014 at 11:43 AM.
 
Old 05-02-2014, 12:10 PM   #8
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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)

Last edited by Retta; 05-02-2014 at 01:13 PM.
 
Old 05-02-2014, 01:16 PM   #9
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
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 ?

-
 
Old 05-05-2014, 09:26 AM   #10
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
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!!!

Last edited by Retta; 05-06-2014 at 07:56 AM.
 
Old 05-05-2014, 10:37 AM   #11
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
# 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
 
1 members found this post helpful.
Old 05-05-2014, 11:30 AM   #12
Retta
LQ Newbie
 
Registered: Nov 2013
Posts: 16

Original Poster
Rep: Reputation: Disabled
# 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

Last edited by Retta; 05-05-2014 at 12:50 PM.
 
1 members found this post helpful.
Old 06-11-2014, 08:33 AM   #13
nayanb2k7
LQ Newbie
 
Registered: May 2014
Posts: 28

Rep: Reputation: Disabled
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
 
Old 06-11-2014, 02:02 PM   #14
knudfl
LQ 5k Club
 
Registered: Jan 2008
Location: Copenhagen, DK
Distribution: pclos2017 CentOS6.9 CentOS7.4 + 50+ other Linux OS, for test only.
Posts: 16,746

Rep: Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319Reputation: 3319
Post #13, @nayanb2k7.

""how to proceed"" : Read post #3.
 
Old 06-12-2014, 01:46 AM   #15
nayanb2k7
LQ Newbie
 
Registered: May 2014
Posts: 28

Rep: Reputation: Disabled
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)
 
  


Reply

Tags
crahn-ns2, crcn, ns2, ns2 ns-allinone, tfrc-cr_ns2


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
NS2 simulator in manet raji27 Linux - Software 7 02-24-2013 10:44 AM
NS2 Simulator raji27 Linux - Software 7 03-28-2012 04:05 PM
NS2 simulator Vaishali4 Linux - Newbie 1 10-07-2011 10:03 AM
NS2 simulator in manet raji27 Linux - Software 2 09-13-2011 11:38 PM
NS2 simulator raji27 Linux - Software 1 09-12-2011 07:34 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:56 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration