Cognitive Radio Cognitive Networks(CRCN) Simulator
is based on ns2 Simulator. This post mainly explains in detail the steps needed
to run CRCN simulations in your system.
Note: The installation is successful only in
version 2.31 of ns (ns-allinone-2.31)
Step 2: IMPORTANT:
backup your ns-allinone-2.31 folder before proceeding. This is will help us to
restore the working ns2 installation in case anything unexpected occurs.
Step 3: After installing the NS 2.31, Extract CRCN.zip and you will see several files inside that. You have to copy each file in that and replace the corresponding files in ns2.31 folder.
Step 3 is explained more detailed manner:
If you have a folder named AODV in crcn.
Copy all its contents and paste it in /home/Hema/ns-allinone-2.31/ns-2.31/aodv
folder.
Note: Here ”Hema” is my username, replace
it with your username.
You would be replacing the existing aodv folder
contents with the new one you copied from CRCN folder. Leave rest of the files
unmodified. Similarly,
you will have folders named common, mac, mobile and so on. Repeat Step 3 for
all these folders.
Step4: Finally, you will be left with some tcl and
perl scripts inside the CRCN folder. Just copy them and place them in any
folder, preferably /home/Hema/ns-allinone-2.31/ns-2.31.
Step5: Open “Makefile” of /home/Hema/ns-allinone-2.31/ns-2.31
in root user mode.
Note: instead of making changes in “Makefile”
directly, you can make changes in “Makefile.in” and run “./configure” command
to generate the Makefile. This method is more simple and helpful, when you will
add new protocol files into your simulator.
Code:
$ su
# gedit /home/Hema/ns-allinone-2.31/ns-2.31/Makefile
Here gedit editor is used; replace it with the
editor of your preference.
Step6: In the “Makefile”, find the line that says
OBJ_CC = \
Step7: Copy the following lines and append it
to OBJ_CC listing as shown in the figure bellow.
wcett/wcett_logs.o wcett/wcett.o \
wcett/wcett_rtable.o wcett/wcett_rqueue.o \
mac/macng.o mac/maccon.o\
mac/macngenhanced.o\
Fig 1: CRCN Cod |
Save and close the Makefile.
Step8: Next execute the following commands in
Terminal.
make clean
make depend
make
If any error message experienced, fix them and run
the above commands again. If each of these commands runs without any error,
then CRCN installation is successful.
There is also a GUI available for CRCN simulation.
Users can also use the CRCN NS2
components without using the GUI. For GUI
requires some dependencies/per-requisites. To Install the GUI, please refer the
following link.
CRCN Manual:
http://stuweb.ee.mtu.edu/~ljialian/
http://stuweb.ee.mtu.edu/~ljialian/
Source Links:
http://stuweb.ee.mtu.edu/~ljialian/installation.htm
http://getch.wordpress.com/2010/12/30/cognitive-radio-network-simulator-installation/
http://stuweb.ee.mtu.edu/~ljialian/installation.htm
http://getch.wordpress.com/2010/12/30/cognitive-radio-network-simulator-installation/
Hi there,
ReplyDeletei am using ns-allinone-2.35, there is any compatibility problem with crcn??
Thanks.
Hi,
DeleteCRCN have been tested in ns-2.31 under Linux environment. so i suggest you to go with ns-2.31..
Dear sir,
DeleteIs there any compatible package for NS-2.35? I'm also using NS-2.35 and I think it isn't compatible.
can u please give me some basic codes to implement cr on ns2.. my project work is to improve the throughput of the cr ..
ReplyDeleteHi,
DeleteOnce you patch your ns 2.31 with the CRCN patch, you will get few example code for CR implementation. Few basic CR MAC protocol examples are also included in CRCN as well named as "maccon", "macng" and "macngenhanced" etc... You can dip into the code to understand CR implementation.
for more info you can refer this link
http://stuweb.ee.mtu.edu/~ljialian/
Thank you..!!
This comment has been removed by the author.
DeleteWhile patching the Makefile:
ReplyDeletemac/macng.o mac/maccon.o\
mac/macngenhanced.o\
The above two lines doesnt give any gap between .o and \
is it correct, does it work for you!?
Hi,
Deletewith out a gap it works for me.
Even if i allow a gap between .o and \ then also, it works fine.
Thank you..!!
sir,
ReplyDeletewhere can i get detailed tutorials for ns-2, i am getting much errors while simulating..i am very new
to this tool...all i know till now is through browsing net.Is there any GUI tool that creates topology
file many doubts just bubbling in my mind...can you please help in this.....
Regards
Ravikiran Bhonagiri
Hi Ravi,
DeleteThe are lot of resources on the wen for NS-2. Any way, i suggest the Book titled "Introduction to Network Simulator NS2". please find more details about the book using bellow link. It is a good book with all the things explained nicely.
http://www.amazon.com/Introduction-Network-Simulator-Teerawat-Issariyakul/dp/1441944125
Try to find the E-copy of the book on the web.
There might be some GUI tools, i have no knowledge about them, but you can generate the required topology by using a command called.. "Setdest" available in NS utility tools.
when I run ‘make depend’, I get :
ReplyDeletemake: *** [depend] Error 1
A few lines before it are as follows:
internet.cc emulate/ping_responder.cc emulate/arp.cc emulate/icmp.cc emulate/net-pcap.cc emulate/nat.cc emulate/iptap.cc emulate/tcptap.cc common/tclAppInit.cc common/tkAppInit.cc >& /dev/null
As I am new to Ubuntu, I don't know how to get rid of this error.
Please help.
clearly post what the error is???? else it would be difficult to suggest something blindly..
Deletecant edit the Makefile
ReplyDeletemy system is showing it as a read only file
just go to the super user mode and make the necessary changes in the "Makefile" in vi editor...... it will work. once done, run the ./configure command to generate new make
Deletenot able to edit Makefile for necessary changes
ReplyDeleteeven though i get into the superuser mode
and also not able to tun configure file
it is showing access denied in config.log at line no 994
config.log is also a read only file .
instead of making changes in “Makefile” directly, you can make changes in “Makefile.in” and run “./configure” command to generate the updated Makefile. This method is more simple.
DeleteThis is very useful, when you will add new protocol files into your simulator too.
give a try... good luck :)
Please upload the patch file as the original link is no longer working. I have searched everywhere but it's not available anywhere. You are my only hope now. Thank you.
ReplyDeleteplease can you upload the crcn.zip or give me a link that i can get from it.. this link "http://stuweb.ee.mtu.edu/~ljialian/crcn.zip " is no longer working.. please again i like to do project on cognetive radio network
ReplyDeleteHi ,i followed each and every steps ,but i got error on command 'make'. The error displayed on terminal for command 'make ' is
ReplyDeletecmu-trace.cc:(.text._ZN9hdr_wcett6accessEPK6Packet[hdr_wcett::access(Packet const*)]+0xe): undefined reference to `hdr_wcett::offset_'
collect2: ld returned 1 exit status
make: *** [ns] Error 1
Is there any idea to fix it?
Hi, I have the same problem as Santosh's. I use ubuntu 12.04-32 bit, with ns2.31 installed.
ReplyDeleteI got the solution for "make: *** [ns] Error 1". When replacing of files from CRCN folder is done ,follow the following steps:
ReplyDelete1)It is instructed to modify the Makefile ,but when we modify and run './configure' command ,all the lines we copied get deleted. So don't try to modify Makefile ,instead of that modify the Makefile.in.
2) While modifying Makefile.in file just copy the first three lines (not the fourth line as instructed above,i don't know the exact reason);
"wcett/wcett_logs.o wcett/wcett.o \
wcett/wcett_rtable.o wcett/wcett_rqueue.o \
mac/macng.o mac/maccon.o\"
3) Save the Makefile.in and go to ns-2.31 directory in terminal and run './configure' command.
4) When configuration is done ,run the commands 'make clean' ,'make depend' and 'make' command in terminal respectively.
For further information:santoshmsubedi@gmail.com ,twitter@santobedi.
Hi Santosh,
DeleteThanks for sharing your experience.Yes, the way you said is also possible.
Basically, the thing can be performed in two ways.Firstly, if you directly make changes in the "Makefile" no need to run the "./configure" command.
On the other hand, if you make changes in the "Makefile.in", you have to run the command "./configure" to reflect the changes in Makefile. That is what also mentioned in the post clearly.
Thank you..!!
Hema
@Santosh : can you run test4macngenhanced.tcl ?
ReplyDeleteHi Sir,
ReplyDeleteI ve installed the CRCN patch in my ns2.31. It dint show any error messsage. but when i give ns, it doesnt shows % symbol. It shows, ns command not found.
Hi Priya.
DeleteApologies for the delay, as i was out of station.
Is your "make" execution is successful. If yes go to the ns folder, check for the executable file named "ns".
If "make" is not successful, fix the errors and run the "make" command again.
Good luck
Hema :)
what is the problem sir
ReplyDeleteHi. I would like to ask is there any other website except "http://stuweb.ee.mtu.edu/~ljialian/" and "http://www.ece.mtu.edu/~ljialian/" that I possibly can get the CRCN coding? FYI, I am doing cognitive radio in 802.22 using ns-2.35 running in ubuntu-13.10.
ReplyDeleteAppreciate your help. Thank you.
Hi,
DeleteWith no option available with me, i will surly say there is "NO" other source to get the CRCN coding is available.
Thank you
Hema :)
Oh I see. In that case, can i get it from you? :)
DeleteHi Hema, When i re-read your blogpost again I found the link to the CR coding. Thank you so much! :D
DeleteHowever i do encounter some problems. My problems included libpcap and flex. I managed to solve both already. But now the problem is at "make". I checked the previous posts but none seem to match with my problem. FYI, I run ubuntu 13.10 in vmware. The ns version is ns-2.35. Managed to do ./configure, make clean, make depend, but stuck at make. The following lines come out:
common/packet.cc:44:16: error: conflicting declaration ‘char** p_info::name_’
char** p_info::name_;
^
In file included from common/packet.cc:40:0:
common/packet.h:299:15: error: ‘p_info::name_’ has a previous declaration as ‘char* p_info::name_ [63]’
static char* name_[PT_NTYPE+1];
^
common/packet.cc:44:16: error: declaration of ‘char* p_info::name_ [63]’ outside of class is not definition [-fpermissive]
char** p_info::name_;
^
common/packet.cc:45:22: error: ‘unsigned int p_info::nPkt_’ is not a static member of ‘class p_info’
unsigned int p_info::nPkt_ = 0;
^
common/packet.cc:46:1: error: ‘PacketClassifier’ does not name a type
PacketClassifier *p_info::pc_ = 0;
^
common/packet.cc:48:33: error: no ‘int p_info::addPacket(char*)’ member function declared in class ‘p_info’
int p_info::addPacket(char *name)
^
make: *** [common/packet.o] Error 1
Appreciate your help so much :)
Hi. I have installed both ns-2.31 and crcn using vmware ubuntu 13.10. However I'm not able to run test4macng.tcl. the following error pop out:
ReplyDeletens test4macng.tcl
num_nodes is set 6
(_o3 cmd line 1)
invoked from within
"_o3 cmd add-channel 0 _o13"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o3" line 2)
(SplitObject unknown line 2)
invoked from within
"$ns_ add-channel $i $chan_($i)"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $val(channum) } {incr i} {
$ns_ add-channel $i $chan_($i)
}"
(file "test4macng.tcl" line 43)
does it mean i still havent successfully install crcn? FYI, i am able to do make clean, make depend, and make.
thank you.
I have encountered the similar error after modifying some files of ns2 (like mobilenode.cc,mobilenode.h,phy.cc etc) which is required for implementing my MAC protocol.The error that i got is:
Deletenum_nodes is set 26
(_o3 cmd line 1)
invoked from within
"_o3 cmd add-channel 0 _o13"
invoked from within
"catch "$self cmd $args" ret"
invoked from within
"if [catch "$self cmd $args" ret] {
set cls [$self info class]
global errorInfo
set savedInfo $errorInfo
error "error when calling class $cls: $args" $..."
(procedure "_o3" line 2)
(SplitObject unknown line 2)
invoked from within
"$ns_ add-channel $i $chan_($i)"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $val(channum) } {incr i} {
$ns_ add-channel $i $chan_($i)
}"
(file "test4mycrmac1.tcl" line 43)
I have successfully installed ns2.31 without any error.
Hi Both,
DeleteFYI, the link stated in my post is broken. From where you got the patch and if so does the new patch contains all the patched/required file?? Please check and proceed forward.
The error is basically sue to the missing of things in phy.cc and you use wireless channel interface.
Good Luck
I download the CRCN code from http://getch.wordpress.com/2010/12/30/cognitive-radio-network-simulator-installation/
ReplyDeleteif error is in phy.cc, can u tell more clearly about it?
Thanks
Hi Anonymous,
DeleteI am sorry to say that, the original source for CRCN code is down for last several days. FYI, i am also not aware of the code you have mentioned in the above link. Kindly accept my apologies as i was helpless in this regard.
All the best. :)
Oh Ok. Thank you very much :)
Deletebesides, if i type node-config channel $chan(0)\ the error will be :
ReplyDeletenum_nodes is set 9
can't set "chan(0)": variable isn't array
while executing
"set chan($indexch) $ch"
(procedure "_o3" line 3)
(Simulator add-channel line 3)
invoked from within
"$ns add-channel $i $chan($i)"
("for" body line 2)
invoked from within
"for {set i 0} {$i < $val(ni)} {incr i} {
$ns add-channel $i $chan($i)
}"
(file "han.tcl" line 99)
However, if i type node-config channel_ $chan(0)\ the error becomes :
num_nodes is set 9
can't read "chan": variable is array
while executing
"$node add-interface $chan $propInstance_ $llType_ $macType_ $ifqType_ $ifqlen_ $phyType_ $antType_ $topoInstance_ $inerrProc_ $outerrProc_ $FECProc_"
(procedure "_o3" line 83)
(Simulator create-wireless-node line 83)
invoked from within
"_o3 create-wireless-node"
("eval" body line 1)
invoked from within
"eval $self create-wireless-node $args"
(procedure "_o3" line 23)
(Simulator node line 23)
invoked from within
"$ns node"
("for" body line 2)
invoked from within
"for {set k 1} {$k < [expr $val(nn)+1]} {incr k} {
set s($k) [$ns node]
$s($k) random-motion 0
$ns initial_node_pos $s($k) 20
$s($k) set X_ 5.0
$s..."
(file "han.tcl" line 104)
If I were to create multiple-interface multiple-channel, which one should I type?
i need valid ns2 installation for crcn patch ...i am getting errors while make clean,,depend ,,make
ReplyDelete#Anonymous...u need to define the channels and add them to the channel array before configuring the nodes
ReplyDeleteDear sir,
ReplyDeleteI have compiled ns-2.31 along with CRCN. Could you please send me a scripting file (any scenario file .tcl) that contain cognitive radio networks functionalities to test.
Thanks
Hi,
DeleteIn the CRCN Patch it self, you will get scripting files namely, maccon.tcl and macang.tcl. These two files are the testing TCL scripting files for MACCON and MACANG MAC protocol that comes with CRCN patch respectively. There are few other files as well, kindly go through the code.
Thank you and good luck
i am getting the following error when i run command make depend
ReplyDeletekindly give me solution..
make: *** No rule to make target `mac/macngenhanced.cc', needed by `depend'. Stop.
I got this error ,i did changes in Makefile.in and then i executed ./configure, but i got error as follows
ReplyDeletemake: *** [common/packet.o] Error 1
pls tell me to get rid of this error, sir,....... it is very urgent to me ,.i am using ns2.35 and ubuntu 12.10
What are the changes you made in Makefile.in.. add or delete...
DeleteIt may be the case that, you might deleted some dependencies of packet.c, which gives an error while building the packet.o file.
Thank you..!!
Hema K. Yarnagula
while executing this /ns-allinone-2.35/ns-2.35$ make depend
ReplyDeletei am getting the below error too,.......... PLS HELP SOON
make: *** No rule to make target `mac/macngenhanced.cc', needed by `depend'. Stop.
Hi, i think it is because you are missing the file macngenhanced.cc itself.
ReplyDeletedownload from here:
https://www.cct.lsu.edu/~hsunda3/Lax-Downloads/crcn/mac/macngenhanced.cc
and place it inside the mac folder inside the ns-2.31
also please note that CRCN patch will only work with ns-2 version 2.31
i am trying to install and troubleshoot this myself now :)
Dear sir,
ReplyDeleteI have installed crcn in ns 2.31.I have maccon.cc,macng.h files but i didn't have maccon and macng tcl files.Is there any other way to functionalish the cr network...? Is there any source code for crcn....
thanks
Hi,
DeleteThe CRCN patch contains all the necessary files, you don't require any other source core to add into it..
Please make sure that you are installing the right CRCN patch with NS2.31..
Thank you..!!
Hema K. Yarnagula
Hi
ReplyDeleteI have compiled the crcn patch on ubuntu 12.04 and ns-2.31 bu I am unable to run test4wcett.tcl.I get the error
format_wcett: invalid WCETT packet type.Please help
Thanks
Hi, please check is "WCETT packet type" is declared in packet.h and packet.cc files. if not do the necessary changes by declaring the packet type and necessary macros for accessing the packet variables. ( you may get the idea of declaring macros and packet type in packet.h file of NS)
DeleteWcett packet type is declared in packet.h and packet.cc and I am able to run test4macng.tcl and test4maccon.tcl , the two MAC examples provided with crcn.Do I have to use gcc,g++ version 4.1 to compile the patch??.Is it possible to install the patch on ubuntu 12.04(i386)??.Any help is extremely appreciated.
DeleteThanking you,
Abhinav S
Okk.. that's fine..
DeleteYeh, you need to use gcc,g++ version 4.3 or higher to compile the patch.
Yes, It is possible to install the patch on ubuntu 12.04, Personally, i never done it, but i know few who did it successfully. So, the OS is not a problem at all.
You can try the patch in Fedora 14/16/17.. As i have installed the patch and worked on them as well...
As per my knowledge concerns, the OS DOES not matters much.
BTW, also check in the Makefile.in, whether Wcett is included or not. If not, then your object file will not be created and may lead to an error.
Hi
DeleteWith all your help everything is working perfectly fine on ubuntu 10.04.I wanted to know how to add primary and secondary users??
please tell me about the chanhe in packet.c and packet.cc files
DeleteHello,
ReplyDeleteI have compiled the crcn patch on ubuntu 12.04 and ns-2.31 but unable to run test4wcett.tcl.I get the error
format_wcett: invalid WCETT packet type.Please help
wcett is included in packet.h but not in packet.cc
how to include in packet.cc
plz help
Thanks
Hello can anyone help me I get following ERRORS while installing CRCN patch.
ReplyDeletecommon/packet.cc:44:16: error: conflicting declaration ‘char** p_info::name_’
char** p_info::name_;
^
In file included from common/packet.cc:40:0:
common/packet.h:299:15: error: ‘p_info::name_’ has a previous declaration as ‘char* p_info::name_ [63]’
static char* name_[PT_NTYPE+1];
^
common/packet.cc:44:16: error: declaration of ‘char* p_info::name_ [63]’ outside of class is not definition [-fpermissive]
char** p_info::name_;
^
common/packet.cc:45:22: error: ‘unsigned int p_info::nPkt_’ is not a static member of ‘class p_info’
unsigned int p_info::nPkt_ = 0;
^
common/packet.cc:46:1: error: ‘PacketClassifier’ does not name a type
PacketClassifier *p_info::pc_ = 0;
^
common/packet.cc:48:33: error: no ‘int p_info::addPacket(char*)’ member function declared in class ‘p_info’
int p_info::addPacket(char *name)
^
make: *** [common/packet.o] Error 1
Appreciate your help so much :
hello sir,
ReplyDeleteUbuntu version i've installed was 14.04...with ns2.31 along with crcn patch..But,when i compiled test4wcett .tcl there was an error "format_wcett: invalid WCETT packet type..May I know what's the reason for the error?
Thank you
hello sir,
ReplyDeleteI have a similar problem with WCETT
please suggest
getting an error while doing 'make depend' for ns2 installation in ubuntu12.04....
ReplyDeletegiving an error
make:**No rule to make target 'mac/macngenhanced.cc', needed by 'depend'. Stop
please help me.......
Hello sir, may I know how to delete crcn patch
ReplyDelete