Skip to content

Cognitive Radio Cognitive Network(CRCN) Simulator for ns-2.

Cognitive Radio 

“A cognitive radio (CR) is a radio that can be programmed and configured dynamically to use the best wireless channels in its vicinity to avoid user interference and congestion. Such a radio automatically detects available channels in wireless spectrum, then accordingly changes its transmission or reception parameters to allow more concurrent wireless communications in a given spectrum band at one location. [4]”

CRCN Simulator

As cognitive radio research is emerging, more and more researchers are looking forward to a simulator that is suitable for cognitive radio. In [5], they have developed a CRCN simulator with NS-2, and that version has been widely utilized in the academic field.

This cognitive radio cognitive network (CRCN) simulator is a software based network simulator for network-level simulations. It is based on open-source NS-2 (network simulator 2). CRCN simulator supports performance evaluations for the proposed dynamic spectrum resource allocation, power control algorithms, and the adaptive Cognitive Radio (CR) networking protocols including the CR MAC and the CR Routing protocols. This simulator uses NS-2 to generate realistic traffic and topology patterns. For each node in this simulator, a reconfigurable multi-radio multi-channel PHY layer is available by customizing the spectrum parameters such as transmission power, propagation and etc[5′]”

 

The following is the architecture block diagram for this simulator presented in [5]. CRCN simulator enables the interface parameters transmission between different layers, as shown in arrows with blue color. Users just need to replace their own Routing and MAC algorithms according to NS-2 protocol design requirements with the existing ones in the CRCN.

Functionality of CRCN

The functionality provided by this simulator is summarized in [5] as follows:

Support for CR Routing
  • Multi-radio multi-channel support
  • Single-radio multi-channel support
  • Interface to select the radio
  • Interface to select the channel
  • Heterogeneous radio and spectrum environment
  • Information needed during the routing process
Support for CR MAC
  • Single-radio multi-channel support
  • Multi-radio multi-channel support
  • Interface to select the channel

· Information needed during dynamic spectrum access

Support for CR PHY
  • Reconfigurable spectrum parameters and radio parameters
  • Interference information
  • SINR/SNR physical model
CR Routing/CR MAC algorithms

Several exemplary algorithms for CR Routing and CR MAC are given in the CRCN simulators. These algorithms illustrate how to use the functionality provided by this simulator. Also, these algorithms provide a simulation environment for CR networking protocols. Users can replace these components with their own algorithms, and test the performance of their designs.

Performance Evaluation for CR algorithms

This simulator contains several evaluation metrics for performance evaluations of the algorithms at different layers. Currently, the evaluation metric include summate, and interference.

 

In this article, we are going to try this installation under a chroot jail.  installation also. The following procedure[3] will explain the Chroot Jail based ns2 installation.

Installing ns2.35(ns-allinone-2.35) Under Debian chroot Jail

You may use the same procedure to install crcn on a normal Linux also.

Installation of ns-2.31

Step 1: Install the necessary dependencies of ns-2

# refresh the database of available packages
$ apt-get update

#install the dependencies
$ apt-get install perl xgraph libxt-dev libx11-dev libxmu-dev
$ apt-get install gcc-4.4 cpp-4.4 gcc-4.4 gcc-4.4-base

Step 2: Download ns2.35 from the following link

https://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.31/ns-allinone-2.31.tar.gz/download

# copy the download ns-allinone-2.31.tar.gz file to the home directory

$ cd /home/your_home
$ tar -xvf  ./ns-allinone-2.31.tar.gz 
#or extract the compressed file using your own way

Step 3: Installing ns-allinone-2.31

First, we have to compile ns2 to check whether it will compile correctly or not.

#Installing ns-allinone-2.31

$ cd /home/your_home/ns-allinone-2.31/

#Run the main installation script (that will compile and install everything)
$ ./install 

The following final output of the installation process at the terminal shows the successful installation of ns-2.31 and all other related things.

 

The following terminal outputs at the end of the installation process will show the things that we need to do in the startup script .bashrc of .profile that we can find the home directory of the user.

 

Ns-allinone package has been installed successfully.
Here are the installation places:
tcl8.4.14: /home/ns-allinone-2.31/{bin,include,lib}
tk8.4.14: /home/ns-allinone-2.31/{bin,include,lib}
otcl: /home/ns-allinone-2.31/otcl-1.13
tclcl: /home/ns-allinone-2.31/tclcl-1.19
ns: /home/ns-allinone-2.31/ns-2.31/ns
nam: /home/ns-allinone-2.31/nam-1.13/nam
gt-itm: /home/ns-allinone-2.31/itm, edriver, sgb2alt, sgb2ns, sgb2comns, sgb2hierns

———————————————————————————-

Please put /home/ns-allinone-2.31/bin:/home/ns-allinone-2.31/tcl8.4.14/unix:/home/ns-allinone-2.31/tk8.4.14/unix
into your PATH environment; so that you’ll be able to run itm/tclsh/wish/xgraph.

IMPORTANT NOTICES:

(1) You MUST put /home/ns-allinone-2.31/otcl-1.13, /home/ns-allinone-2.31/lib,
into your LD_LIBRARY_PATH environment variable.
If it complains about X libraries, add path to your X libraries
into LD_LIBRARY_PATH.
If you are using csh, you can set it like:
setenv LD_LIBRARY_PATH
If you are using sh, you can set it like:
export LD_LIBRARY_PATH=

(2) You MUST put /home/ns-allinone-2.31/tcl8.4.14/library into your TCL_LIBRARY environmental
variable. Otherwise ns/nam will complain during startup.

After these steps, you can now run the ns validation suite with
cd ns-2.31; ./validate

For trouble shooting, please first read ns problems page
http://www.isi.edu/nsnam/ns/ns-problems.html. Also search the ns mailing list archive
for related posts.

root@AsusK55:/home/ns-allinone-2.31#

So you have to add the necessary lines in the startup script so that the commands ns, nam and exgraph can be executed within any folder of the system.

Step 4: Testing the Installation

#Testing the working of ns-2 (keep in mind that you should add the
#path of ns binary correctly in the startup script before running ns
$ ns
%
So the ns command will just open a % prompt at the terminal.  In fact, ns-2 is nothing but an extended version of tcl – so what we see here is the command prompt of tcl – that’s all. The prompt is just waiting for your tcl/ns2 command. Since we are not going to use it in this way, simply press Ctrl+”C” to exit from this prompt. The following screenshot shows the testing output of ns command. (if you get a command not found error, then it means you didn’t set the PATH variable correctly or not successfully compiled ns-2 at all.

Cognitive Radio Cognitive Network(CRCN) Simulator for ns-2

#Testing the working of xgraph
$ xgraph
_
The prompt is just waiting for your inputs. Since we are not going to use it in this way, simply press Ctrl+”C” to exit from this prompt. 
 
#Testing name with some example simulation

$ nam

The above command will open the main GUI of nam. From that, we can open the name trace output of any previous simulation  and animate/visualize it on nam.

 

Installing the CRCN Extension

Step 5: Download CRCN extension

You can download CRCN extension from the following link

https://faculty.uml.edu/tricia_chigan/Research/CRCN%20user%20code%203/CRCN%20user%20code%203/crcn.zip

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

Now the above set of commands will successfully compile ns-2.31 without any errors.

The following screenshot shows the successful recompile of ns-2.31 with the crcn extension module. (check the highlighted components)

 

Testing the CRCN Installation

Now we can test the working of crcn extension by running a suitable example.

$ ns test4wcett.tcl

If we run the “test4wcett.tcl”, then it will end with following terminal output. It shows the successful completion of the simulation.

 

Now we can open the nam ouput and visualize it.

 

The following gif animation shows the output of the simulation.

 

The GUI for CRCN Simulations

There is a java based GUI that can be used to generate CRCN scenarios without writing much code.  One can learn about its usage from[6]. 

GUI Installation

We can install this GUI as follows:

Hidden Section! Contact Charles  

The key/passphrase will be given once you have been approved for getting paid research support/assistance from Charles. To get paid support, you may start a 'free' research discussion.  

WhatsApp chatDiscuss Through WhatsApp
 

The following is the java-based GUI for generating CRCN scenarios.

One can generate a CRCN simulation script using this interface and can start to run  it from this interface. It will used the ns-2 to run the script that is referenced in this form.

 

Further, it can be used to display some primitive graphical outputs of the simulation.

 

Note: While doing a big, iterative batch simulation for a scholarly research work on CRCN, in that case, this Java Interface will have no use for it. I mean, one can not do a quality research work on CRCN using this primitive java interface. A scholarly research work will need manual writing of a lot of tcl and other scripts.

 

Future work on CRCN

There is a much enhanced CRCN simulation that is under development on ns-3. It will be available at [7] in future.  This simulator uses NS-3 to generate realistic traffic and topology patterns. For each node in this simulator, a reconfigurable multi-radio multi-channel PHY layer is available by customizing the spectrum parameters such as transmission power etc. The following diagram from[7] gives an overview of this simulator.

Our future article will explain the installation and usage of this ns-3 version of CRCN simulator.

References

 

  1. https://sourceforge.net/projects/nsnam/files/allinone/ns-allinone-2.31/ns-allinone-2.31.tar.gz/download
  2. https://faculty.uml.edu/tricia_chigan/Research/NS3/CRCN%20-%20NS3.htm
  3. https://www.projectguideline.com/installing-ns2-35ns-allinone-3-35-under-debian-chroot-jail/
  4. https://en.wikipedia.org/wiki/Cognitive_radio
  5. https://faculty.uml.edu/tricia_chigan/
  6. https://faculty.uml.edu//Tricia_Chigan/Research/helpv4.htm
  7. https://faculty.uml.edu/tricia_chigan/Research/NS3/CRCN%20-%20NS3.htm
WhatsApp Discuss Through WhatsApp