## Introduction#

Electromagnetic spectrums allotted to networks such as GSM/HSPA, 3G, 4G, TV, Wi-Fi, defense communication, radio broadcasting, mobile satellites, aeronautical satellites are not always evenly utilized. While some bands in the spectrum are heavily used and overcrowded, some other bands are idle most times and underutilized. This underutilization of bands in the electromagnetic spectrum leads to Spectrum Holes, that are nothing but available channels in the wireless spectrum. These channels are a band of frequencies which are assigned to a primary user, but at times are not utilized by that user.
With the advent of Cognitive Radio (CR), spectrum can beutilized more efficiently. A user who is unable to be serviced by a band, can access a spectrum hole at the correct time and geographic location. Thus, CR is an adaptive, intelligent radio and network technology that can automatically detect spectrum holes and utilize them for data transmission.
NetSim models CR by using the specifications in the IEEE 802.22 standard. Users can also connect a Cognitive Radio with Internetwork devices, use all the protocols that Internetworks support, and view packet and event traces

## Simulation GUI#

Open NetSim and click New Simulation  Cognitive Radio Networks as shown Figure 2-1.

### Create Scenario#

Cognitive Radio Networks come with a palette of various devices like CR_CPE, Base_Station L2 Switch, Router, Wired Node, Wireless Node, and AP (Access Point).

### Click and drop into environment#

• Add a Base Station (BTS) – click the Base_Station icon on the toolbar and place the BTS in the grid.
• Add a Cognitive Radio CPE – click the CR_CPE icon on the toolbar and place the CR_CPE in the grid.
• Add a Switch, Router, Wired Node, Wireless Node, and an Access point – click the appropriate icon on the toolbar and place the device in the grid.

Note: If you change the settings of the grid, then ensure that you place the CPE in the BS’s coverage area.

• Connect the devices in the Cognitive Radio network by clicking the Wired/Wireless icon on the toolbar.

• Configure an application as follows:
• Click the Application icon on the toolbar.
• Specify the source and destination devices in the network.
• Specify other parameters such as method and type of the application.
• Set the properties of the BTS, CR_CPE, and other devices as follows:

• Right-click a BTS, CR_CPE, device, click Properties and modify the interface and layers’ properties to your requirement.
• For a BTS, specify incumbent count, minimum and maximum frequency, channel bandwidth, modulation technique, coding rate

### Enable Packet Trace, Event Trace & Plots (Optional)#

Click Packet Trace / Event Trace icon in the tool bar and click on OK button. For detailed help, please refer sections 8.4 and 8.5 of the User Manual. Select Plots icon for enabling Plots and click on OK button see Figure 2-4

### Run Simulation#

Click on Run Simulation icon on the top ribbon/toolbar

Set the Simulation Time and click on OK button

## Model Features#

The following are the 802.22 features implemented in NetSim:

• Primary user: A user who has higher priority or legacy rights to use a specific part of the spectrum. Also known as Incumbent user.
In NetSim, the primary user is part of the base station.
• Secondary user: A user who has a lower priority or legacy rights to use a specific part of the spectrum, and therefore uses the spectrum in such a way that it does not cause interference to the primary users.
• Keep-out distance: The minimum distance between the primary user and the secondary user to ensure that there is no interference.
• Spectrum sensing: A process of monitoring and sensing the spectrum to capture information such as holes in the spectrum and the interference, and the primary users in the geographical area.
http://www.ieee802.org/22/Meeting_documents/2006_Mar/22-06-0028-05-0000-Spectrum-Sensing-Simulation-Model.doc
You can find the definition of the Spectrum sensing function the SpectrumManager.c file.
If you want to modify this function at run-time, you must write a new sensing algorithm that checks if the incumbent user’s signal is present. This changes the keep-out distance.
The following is the Spectrum sensing function:
struct stru_802_22_SSFOutput* fn_NetSim_CR_CPE_SSF(struct stru_802_22_SSFInput* input,NETSIM_ID nDevId,NETSIM_ID nInterfaceId)
• UCS notification: UCS or Urgent Coexistence Situation notification is a notification that the secondary user sends when it senses that the primary user is back to use the channel.
In NetSim, this happens when the distance between the primary user and the secondary user is less than the keep-out distance.
UCS notifications are generated at the end of the quiet period (network-wide quiet periods when all network traffic is suspended and the base stations and CPEs perform in-band sensing.
• Channel switching: A process where the secondary user switches the channel when the primary user of the channel comes back to use it.
In NetSim, the secondary user does not switch the channel to an adjacent one. The secondary user switches the channel to a channel that is next to an adjacent channel.
For example, if the primary user has returned to channel 1, the secondary user switches to channel 3 and not channel 2.

• Operating frequency: The frequency band at which the incumbent operates. This band can range from 54 MHz to 862 MHz. The bandwidth of every channel is 6 MHz.
For example, if the operating frequency is set from 54 MHz to 72 MHz, then

• Channel 1 will be 54 to 60 MHz.
• Channel 2 will be 60 to 66 MHz.
• Channel 3 will be 66 to 72 MHz.
• ON duration: The duration of time for which the primary or incumbent user operates.
In NetSim, you can specify a duration between 1 second and 100,000 seconds.
• OFF duration: The time interval between two successive ON durations of an incumbent.
For example, if you specify an ON duration on 5 seconds, the incumbent operates once every 5 seconds. If you specify an ON duration of 0, the incumbent remains always active.

PHY rate: The PHY rate in the IEEE 802.22 standard depends on the following parameters:

• Number of bits per symbol
• Coding rate
• Cyclic prefix
• Symbol duration

PHY rate in Cognitive Radio is calculated as follows $$PHY rate = \frac{Bit \ count \ in \ One\ symbol}{Symbol \ duration}$$ $$Bit\ count \ in \ one \ symbol = Subcarrier \ count \times Number \ of \ bits \times Coding \ Rate$$ $$Bit \ count \ in \ One \ symbol = 1440\times2\times 2(\frac{1}{2}) \quad where \ Subcarrier \ count = 1440$$

For Subcarrier count, refer the table on page 201 in the document available here –

https://ieeexplore.ieee.org/document/7098301

The following table lists the different modulation techniques and the number of bits per symbol see Table 3-1, the modulation technique uses

Modulation technique # of bits per symbol
BPSK 1
QPSK 2
16-QAM 4
64-QAM 6

The following displays the coding rate.

Coding rate Data bits Redundant bits (n-k)
1/2 (default) 1 1
2/3 2 1
3/4 3 1
4/5 4 1

The following table displays the cyclic prefix

Cyclic prefix
1/4
1/8
1/16
1/64

$$Symbol duration = \frac{Subcarrier \ spacing}{Cyclic \ prefix} = 317.38$$ $$Data rate = \frac{Bit \ count \ in \ One \ symbol}{Symbol \ duration} = \frac{1440}{317.38} = 4.53Mbps$$

In NetSim, the base station allocates a maximum of One symbol per CPE. If the generation rate is more than the data filled in one symbol, the allocation fails and this results in Zero throughput. The first symbol is reserved for CR control frames or any broadcast PDU.

• Coding rate: A fractional number used for error correction. Coding rate specifies what part of the redundant message is meaningful. If the code rate is k/n, for every ‘k’ bits of useful information, the coder generates a total of ‘n’ bits of data, of which n-k are redundant.

### How to avoid low Application Layer Throughput#

When you simulate a Cognitive Radio network in NetSim, the throughput in the Application layer is lesser than the throughput in the Datalink layer throughput because of the following factors:

• TCP connection establishment.
• ARP set up.
• Service flow created for the CPE to the BS and the BS to the CPE.
• Bandwidth request.

To avoid the above effects:

• Set the application traffic model to Custom.
• Run UDP in the Transport layer.
• Use static ARP.
• Run the simulation for more than 100 seconds.

### Segmentation#

CR segments packets of 100B. In the application settings if the packet size is greater than 100B, then those packets will be segmented. The segment IDs can be viewed in the packet trace

### How to Modify Device Parameters at Run-time#

For information about how to change the device parameters at run-time, see

NetSim contains some example configuration files to let you simulate and understand the concepts associated with Cognitive Radio. To simulate these examples, click Examples > Cognitive-Radio in the NetSim Home Screen.

Users can change the default values of the parameters in these examples and see how they impact the Cognitive Radio network.

## Cognitive Radio Networks Experiments in NetSim#

Apart from examples, in-built experiments are also available in NetSim. Examples help the user understand the working of features in NetSim. Experiments are designed to help the user (usually students) learn networking concepts through simulation. The experiments contain objective, theory, set-up, results, and inference. The following experiments are available in the Experiments manual (pdf file).

## Reference Documents#

IEEE 802.22 - 2011 Standard for Wireless Regional Area Network (WRAN).

## Latest FAQs#

You can refer to the up-to-date FAQs about NetSim’s Cognitive Radio library at
https://tetcos.freshdesk.com/support/solutions/folders/14000105116