Pages

Sunday 11 November 2012

Cognitive Radio Cognitive Network (CRCN) Simulator installation in Linux

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 1: Download CRCN from <Code Here> and ns-allinone-2.31 from <Here>

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/
Source Links:
http://stuweb.ee.mtu.edu/~ljialian/installation.htm
http://getch.wordpress.com/2010/12/30/cognitive-radio-network-simulator-installation/

60 comments:

  1. Hi there,

    i am using ns-allinone-2.35, there is any compatibility problem with crcn??

    Thanks.

    ReplyDelete
    Replies
    1. Hi,

      CRCN have been tested in ns-2.31 under Linux environment. so i suggest you to go with ns-2.31..

      Delete
    2. Dear sir,
      Is there any compatible package for NS-2.35? I'm also using NS-2.35 and I think it isn't compatible.

      Delete
  2. can u please give me some basic codes to implement cr on ns2.. my project work is to improve the throughput of the cr ..

    ReplyDelete
    Replies
    1. Hi,
      Once 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..!!

      Delete
    2. This comment has been removed by the author.

      Delete
  3. While patching the Makefile:

    mac/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!?

    ReplyDelete
    Replies
    1. Hi,

      with out a gap it works for me.

      Even if i allow a gap between .o and \ then also, it works fine.

      Thank you..!!

      Delete
  4. sir,

    where 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

    ReplyDelete
    Replies
    1. Hi Ravi,

      The 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.

      Delete
  5. when I run ‘make depend’, I get :
    make: *** [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.

    ReplyDelete
    Replies
    1. clearly post what the error is???? else it would be difficult to suggest something blindly..

      Delete
  6. cant edit the Makefile
    my system is showing it as a read only file

    ReplyDelete
    Replies
    1. 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

      Delete
  7. not able to edit Makefile for necessary changes
    even 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 .

    ReplyDelete
    Replies
    1. 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.

      This is very useful, when you will add new protocol files into your simulator too.

      give a try... good luck :)

      Delete
  8. 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.

    ReplyDelete
  9. please 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

    ReplyDelete
  10. Hi ,i followed each and every steps ,but i got error on command 'make'. The error displayed on terminal for command 'make ' is
    cmu-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?

    ReplyDelete
  11. Hi, I have the same problem as Santosh's. I use ubuntu 12.04-32 bit, with ns2.31 installed.

    ReplyDelete
  12. I got the solution for "make: *** [ns] Error 1". When replacing of files from CRCN folder is done ,follow the following steps:
    1)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.

    ReplyDelete
    Replies
    1. Hi Santosh,

      Thanks 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

      Delete
  13. @Santosh : can you run test4macngenhanced.tcl ?

    ReplyDelete
  14. Hi Sir,
    I 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.

    ReplyDelete
    Replies
    1. Hi Priya.
      Apologies 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 :)

      Delete
  15. what is the problem sir

    ReplyDelete
  16. Hi. 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.

    Appreciate your help. Thank you.

    ReplyDelete
    Replies
    1. Hi,
      With no option available with me, i will surly say there is "NO" other source to get the CRCN coding is available.

      Thank you
      Hema :)

      Delete
    2. Oh I see. In that case, can i get it from you? :)

      Delete
    3. Hi Hema, When i re-read your blogpost again I found the link to the CR coding. Thank you so much! :D

      However 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 :)

      Delete
  17. 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:

    ns 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.

    ReplyDelete
    Replies
    1. 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:

      num_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.

      Delete
    2. Hi Both,

      FYI, 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

      Delete
  18. I download the CRCN code from http://getch.wordpress.com/2010/12/30/cognitive-radio-network-simulator-installation/

    if error is in phy.cc, can u tell more clearly about it?

    Thanks

    ReplyDelete
    Replies
    1. Hi Anonymous,

      I 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. :)

      Delete
    2. Oh Ok. Thank you very much :)

      Delete
  19. besides, if i type node-config channel $chan(0)\ the error will be :
    num_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?

    ReplyDelete
  20. i need valid ns2 installation for crcn patch ...i am getting errors while make clean,,depend ,,make

    ReplyDelete
  21. #Anonymous...u need to define the channels and add them to the channel array before configuring the nodes

    ReplyDelete
  22. Dear sir,
    I 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

    ReplyDelete
    Replies
    1. Hi,

      In 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

      Delete
  23. i am getting the following error when i run command make depend
    kindly give me solution..
    make: *** No rule to make target `mac/macngenhanced.cc', needed by `depend'. Stop.

    ReplyDelete
  24. I got this error ,i did changes in Makefile.in and then i executed ./configure, but i got error as follows

    make: *** [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

    ReplyDelete
    Replies
    1. What are the changes you made in Makefile.in.. add or delete...
      It 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

      Delete
  25. while executing this /ns-allinone-2.35/ns-2.35$ make depend
    i am getting the below error too,.......... PLS HELP SOON
    make: *** No rule to make target `mac/macngenhanced.cc', needed by `depend'. Stop.

    ReplyDelete
  26. Hi, i think it is because you are missing the file macngenhanced.cc itself.

    download 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 :)

    ReplyDelete
  27. Dear sir,
    I 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

    ReplyDelete
    Replies
    1. Hi,
      The 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

      Delete
  28. Hi
    I 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

    ReplyDelete
    Replies
    1. 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)

      Delete
    2. Wcett 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.

      Thanking you,
      Abhinav S

      Delete
    3. Okk.. that's fine..
      Yeh, 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.

      Delete
    4. Hi
      With all your help everything is working perfectly fine on ubuntu 10.04.I wanted to know how to add primary and secondary users??

      Delete
    5. please tell me about the chanhe in packet.c and packet.cc files

      Delete
  29. Hello,
    I 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

    ReplyDelete
  30. Hello can anyone help me I get following ERRORS while installing CRCN patch.
    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 :

    ReplyDelete
  31. hello sir,
    Ubuntu 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

    ReplyDelete
  32. hello sir,
    I have a similar problem with WCETT

    please suggest

    ReplyDelete
  33. getting an error while doing 'make depend' for ns2 installation in ubuntu12.04....
    giving an error
    make:**No rule to make target 'mac/macngenhanced.cc', needed by 'depend'. Stop
    please help me.......

    ReplyDelete
  34. Hello sir, may I know how to delete crcn patch

    ReplyDelete