Research breakthrough possible @S-Logix

Office Address

  • 2nd Floor, #7a, High School Road, Secretariat Colony Ambattur, Chennai-600053 (Landmark: SRM School) Tamil Nadu, India
  • +91- 81240 01111

Social List

How to enable multi-radio and multi-channel in CR (Cognitive Radio) Maccon MAC using NS2

In the code segment given below, contention based MAC Maccon is used in which each node randomly selects the channel from available channels. Collision occurs due to the independent random selection of the channels by the nodes and the selected channel information is attached in packet header and passed to PHY layer.

Sample Code
TCL part :

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(mac) Mac/Maccon ;# MAC type
set val(ll) LL ;# link layer type
set val(nn) 6 ;# number of mobilenodes
set val(channum) 3 ;# number of channels per radio
set val(cp) ./topo4.tcl ; # topology traffic file
set val(stop) 50 ;# simulation time

# ==================================================================
# Main Program

# ======================================================================

# Initialize Global Variables

set ns_ [new Simulator]

set tracefd [open w]

$ns_ trace-all $tracefd

# set up topography object

set topo [new Topography]

$topo load_flatgrid 1000 1000

#create nam

set namtrace [open test.nam w]

$ns_ namtrace-all-wireless $namtrace 1000 1000

# Create God

set god_ [create-god $val(nn)]

# configure node

$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 -agentTrace ON -routerTrace ON -macTrace ON -movementTrace ON

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)


#Configure for channels

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

for {set i 0} {$i < $val(nn) } {incr i} {

set node_($i) [$ns_ node]

$node_($i) set recordIfall 1

$node_($i) random-motion 0 ;# disable random motion


source $val(cp) ; #source topology and traffic file generated by others

Deprecated: vcExtractDimensions is deprecated since version 5.8! Use vc_extract_dimensions instead. in /home/sglkmvhshgqr/public_html/wp-includes/functions.php on line 4777

How to enable multi-radio and multi-channel in CR (Cognitive Radio) Maccon MAC using NS2