Skip to content

Evaluation of Multichannel MAC with Cognitive Radio Cognitive Network (CRCN) Simulator

CRCN Simulator: 

This cognitive radio cognitive network (CRCN) simulator is a software-based network simulator for network-level simulations. It is based on  ns-2.

In our previous post, we have explained the procedure for installing CRCN  MultiChannel patch for simulating cognitive network models.

 

Procedure for Installing MultiChannel Patch for ns-2 Cognitive Radio Network Model Simulations

In this article, we will see the ways of using that MultiChannel extension and comparing its performance with normal mac protocol.

Important Parts of The Simulation Script

The following are the main part of this example simulation.

 

Setting Some of the Constant Parameters of this Multichannel Simulation

 

#################################################################################
# Some of the Constant Parameters of this Multichannel Simulation
######################################################################################

set val(chan) Channel/WirelessChannel ;#Channel Type
set val(prop) Propagation/TwoRayGround ;#Radio propagation model
set val(netif) Phy/WirelessPhy ;#Network interface type
set val(ant) Antenna/OmniAntenna ;#Antenna model
set val(rp) AODV ;#Routing Protocol
set val(ifq) Queue/DropTail/PriQueue ;# interface queue type
set val(ifqlen) 50 ;# max packet in ifq
set val(ll) LL ;# link layer type
set val(stop) 150 ;# simulation time

Setting up Some of the Variable Parameters of this Multichannel Simulation

 

######################################################################################
# Some of the Variable Parameters of this Multichannel Simulation
######################################################################################

set MacType [lindex $argv 0] ;# Set the Mac Type
set NumberOfChannels [lindex $argv 1] ;# Set The Number of Channels
set NumberOfNodes [lindex $argv 2] ;# Set The Number of Nodes
set NumberOfConnections [lindex $argv 3] ;# Set The Number of Connections
set NAMtraceFlag [lindex $argv 4] ;# Set The Number of Connections

set val(nn) $NumberOfNodes
set val(channum) $NumberOfChannels

set TraceFileName “MacSimulatoin-$MacType-Chan$NumberOfChannels-Nodes$NumberOfNodes-Conn$NumberOfConnections”
set ScenarioFileName “MobilityScenario-N$NumberOfNodes-P0-S1.sc”
puts $ScenarioFileName

Setting up the channels and configuring the nodes with the multi channels

######################################################################################
# Setup channels and configure the nodes with the channels
######################################################################################

if { $MacType == “Simple” } {

set val(mac) Mac/Simple ;# Set Multichannel MAC
set val(channum) [lindex $argv 1] ;# number of channels per radio
}

if { $MacType == “Macng” } {

set val(mac) Mac/Macng ;# Set Multichannel MAC
set val(channum) [lindex $argv 1] ;# number of channels per radio
Mac/Macng set fullduplex_mode_ 1

}

for {set i 0} { $i < $val(channum)} {incr i} {
set chan_($i) [new $val(chan)]
}

for {set i 0} {$i < $val(channum) } {incr i} {
$ns_ add-channel $i $chan_($i)
}

$ns_ node-config -channel $chan_(0) -ChannelNum $val(channum)

################################################################################
# configure default node settings
######################################################################################
$ns_ node-config -adhocRouting $val(rp) \
-llType $val(ll) \
-macType $val(mac) \
-ifqType $val(ifq) \
-ifqLen $val(ifqlen) \
-antType $val(ant) \
-propType $val(prop) \
-phyType $val(netif) \
-topoInstance $topo \
-wiredRouting OFF \
-agentTrace ON \
-routerTrace ON \
-macTrace ON \
-movementTrace ON

 

Creating the nodes and configuring the channels and other parameters

################################################################################
# Create the nodes and setup the channels and other parameters
######################################################################################
for {set i 0} {$i < $val(nn) } {incr i} {
set node_($i) [$ns_ node]
$node_($i) set SingleIfMultiChan 1
$ns_ initial_node_pos $node_($i) 25
$node_($i) set recordIfall 1
$node_($i) random-motion 0 ;# disable random motion
}

 

Include the Node Movement file and Setting up the flows

The following are the things that we generally do in a MANET simulation as per the need.

 

######################################################################################
# Include the Node Movement file and Setting up the flows
# ######################################################################################
source $ScenarioFileName ;#topology file

for {set i 0} {$i < $NumberOfConnections } {incr i} {
set SourceNode $i
set DestinationNode [ expr $i + $NumberOfConnections]
puts “Setting ftp over Tcp Connections”
puts ” $SourceNode to $DestinationNode”

set tcp_($SourceNode) [$ns_ create-connection TCP $node_($SourceNode) TCPSink $node_($DestinationNode) 0]
$tcp_($SourceNode) set window_ 32
$tcp_($SourceNode) set packetSize_ 1024
set ftp_($SourceNode) [$tcp_($SourceNode) attach-source FTP]
$ns_ at 2.0$i “$ftp_($SourceNode) start”
}

# Tell nodes when the simulation ends
for {set i 0} {$i < $val(nn) } {incr i} {
$ns_ at $val(stop).0 “$node_($i) reset”;
}

$ns_ at $val(stop).1 stop

 

The Results of the Simulation

 

Running the Simulation and invoking nam from the terminal window

 

The Nam Output

 

The Graphical Outputs of Some Preliminary Analysis.

Note : For Getting this kinds of graph, we have to run the simulation for different parameters and store the generated trace file outputs and then use suitable trace analysis scripts for different metrics and do an elaborate trace analysis. (this part is not explained in this article)

 

Performance of Multichannel MAC with respect to  Packet Delivery Fraction(PDF) 

 

Performance of Multichannel MAC with respect to Throughput

 

Performance of Multichannel MAC with respect to Dropped Packets

 

Performance of Multichannel MAC with respect to End to End Delay(EED)

Leave a Reply

WhatsApp Discuss Through WhatsApp