In this page, we give a brief overview of the building blocks and the introduced changes to the core of ns-3. More details can be obtained by reading the technical report
CRE-NS3 building blocks
The extension provides the following basic building blocks:
- Spectrum Manager: This global block will expose the cognitive radio APIs to any network layer in the simulator. Example of such APIs are "startSensing", "startHandoff", etc. This block serves as a "blackbox" to mask the internal submodules of this extension.
- Spectrum Sensing/DB Query: This submodule performs the functionality of sensing or querying the FCC database to determine the PU availability. It uses a static database file to infer the PU activity.
- Spectrum Mobility: performs handoff from one channel to another.
- Spectrum Decision: contains expandable decision policies such as when to handoff to a new channel and to what channel. This submodule is also linked to a global repository that holds each node's current channel assignment. Such information can be used when deciding to switch to the least congested channel, for example.
- Spectrum Sharing: this building block ensures that free spectrum is shared among CR nodes collision-free using the protocols that are provided by ns-3 such as 802.11
The database file
The database file that is linked initially needs to specify the number of PUs in the vicinity and their on and off times. You can find an example of such a file here.
The file needs to start with the total number of PUs, followed by a line that defines the attributes of each PU.
10 100 0 150 0 0.5 0.1 100
After each PU's attributes are defined, a single number defines how many on times this PU is going to have. Next are the actual and off times. This number of on times, followed by the exact times (in seconds) is repeated for every defined PU. In the example file posted above, both PUs have 21 on times.
- 10: is the channel the PU is occupying.
- 100: is the x-coordinate of the PU transmitter.
- 0: is the y-coordinate of the PU transmitter.
- 150: is the x-coordinate of the PU receiver.
- 0: is the y-coordinate of the PU receiver.
- 0.5: is the average of the PU on times (exponential distribution).
- 0.1: is the average of the PU off times (exponential distribution).
Changes to ns-3
The following shows an overview of our changes to the core of the ns-3 simulator
Details fo the introduced changes can be found in the technical report. I want to emphasize the cognitive interface in this section.
A regular ns-3 wireless node may contain any number of wireless/wired interfaces with different IP addresses and subnets. For our cognitive radio extension, we provide a new interface that actually constitutes of three different MAC-PHY interfaces.
The three interfaces are assigned only one IP address. The decision to route packets to the different interfaces is done internally using the tagging system in ns-3. Each node also knows to which interface it should send its packets based on the MAC ethernet address.
- Interface 0 or CTRL_IFACE: is used to exchange control messages between nodes.
- Interface 1 or TX_IFACE: is used to transmit packets on different channels to neighboring nodes. This interface switches channels based on predefined switching policies in the Spectrum Decision block (see above). For example, the interface switches between different 'active' channels every given time interval where an active channel is a channel that this node has outgoing packets queued for.
- Interface 2 or RX_IFACE: is used to sense (or query database) and switch channel if PU is detected. The decision to switch and to what channel is tied to the Spectrum Decision block (see above).
Every ns-3 node may combine any number of cognitive interfaces per node.