Skip to content

An Evaluation of Sensor-MAC (S-MAC) and Normal MAC under Mobile Adhoc Network

Sensor-MAC (S-MAC):

S-MAC is a medium-access control (MAC) protocol designed for wireless sensor networks. Wireless sensor networks use battery-operated computing and sensing devices. A network of these devices will collaborate for a common application such
 as environmental monitoring. We expect sensor networks to be deployed in an ad hoc fashion, with individual nodes remaining largely inactive for long periods of time, but then becoming suddenly active when something is detected. These characteristics of sensor networks and applications motivate a MAC that is different from traditional wireless MACs such as IEEE 802.11 in almost every way: energy conservation and self-configuration are primary goals, while per-node fairness and latency are less important. S-MAC uses three novel techniques to reduce energy consumption and support self-configuration. To reduce energy consumption in listening to an idle channel, nodes periodically sleep. 

 

The Important Sections of the TCL Script of SMAC scenario

Setting Some Common Parameters

# =====================================================================
Agent/TCP set precisionReduce_ false ; # default changed on 2006/1/24.
Agent/TCP set rtxcur_init_ 6.0 ; # Default changed on 2006/01/21
Agent/TCP set updated_rttvar_ false ; # Variable added on 2006/1/21

set opt(chan) Channel/WirelessChannel
set opt(prop) Propagation/TwoRayGround
set opt(netif) Phy/WirelessPhy
set opt(mac) Mac/SMAC
set opt(ifq) Queue/DropTail/PriQueue
set opt(ll) LL
set opt(ant) Antenna/OmniAntenna
set opt(x) 1000 ;# X dimension of the topography
set opt(y) 1000 ;# Y dimension of the topography
set opt(ifqlen) 50 ;# max packet in ifq
set opt(seed) 0.0
set opt(adhocRouting) DSR
set opt(filters) GradientFilter
set opt(nn) [lindex $argv 2] ;# how many nodes are simulated
set opt(stop) 1000.0 ;# simulation time
set opt(syncFlag) 1 ;# is set to 1 when SMAC uses sleep-wakeup cycle
set opt(selfConfigFlag) 1 ;# is set to 0 when SMAC uses user configurable schedule start time
set val(initialenergy) 100
set val(radiomodel) Radio/Simple ;# generic radio hardware
set val(receivepower) .125 ;# Receiving Power
set val(transmitpower) .15 ;# Transmitting Power
set val(idlepower) .05 ;# Idle Power
set val(sleepPower) 0.00005 ;# sleep Power 

# =====================================================================
# Other default settings

LL set mindelay_ 50us
LL set delay_ 25us
LL set bandwidth_ 0 ;

Agent/Null set sport_ 0
Agent/Null set dport_ 0

Agent/CBR set sport_ 0
Agent/CBR set dport_ 0

Agent/TCPSink set sport_ 0
Agent/TCPSink set dport_ 0

Agent/TCP set sport_ 0
Agent/TCP set dport_ 0
Agent/TCP set packetSize_ 512

Queue/DropTail/PriQueue set Prefer_Routing_Protocols 1

 

 

 

Setting up SMAC parameters

# =====================================================================
Setting up SMAC parameters
# ===================================================================== 
# Turning on/off sleep-wakeup cycles for SMAC
Mac/SMAC set syncFlag_ [lindex $argv 0]

# Nodes synchronize their schedules in SMAC
Mac/SMAC set selfConfigFlag_ 1

# Default duty cycle in SMAC
Mac/SMAC set dutyCycle_ [lindex $argv 1]

 

Mobile Node Settings

 

# node setting

$ns_ node-config -adhocRouting $opt(adhocRouting) \
-llType $opt(ll) \
-macType $opt(mac) \
-ifqType $opt(ifq) \
-ifqLen $opt(ifqlen) \
-antType $opt(ant) \
-propType $opt(prop) \
-phyType $opt(netif) \
-channelType $opt(chan) \
-topoInstance $wtopo \
-diffusionFilter $opt(filters) \
-agentTrace ON \
-routerTrace ON \
-namtrace ON \
-movementTrace ON \
-macTrace ON \
-energyModel "EnergyModel" \
-initialEnergy $val(initialenergy) \
-rxPower $val(receivepower) \
-txPower $val(transmitpower) \
-sleepPower $val(sleepPower) \
-idlePower $val(idlepower)

 

Setting up the Network Topology

#
# Create the specified number of nodes [$opt(nn)] and "attach" them
# to the channel.
#
# Create the topology
#
set rng [new RNG]
$rng seed 10

set NodeSize 30

for {set i 0} {$i < $opt(nn) } {incr i} {
set node_($i) [$ns_ node $i]
# $node_($i) random-motion 0 ;# disable random motion
set tx [$rng integer $opt(x)-100]
set ty [$rng integer $opt(y)-100]
set tx [expr $tx + 50 ]
set ty [expr $ty + 50 ]
$node_($i) set X_ $tx
$node_($i) set Y_ $ty
$node_($i) set Z_ 0.0
$ns_ initial_node_pos $node_($i) $NodeSize 
}

#
# Create DSR Agent
# rt_rq_max_period indicates maximum time between rt reqs
# rt_rq_period indicates length of one backoff period
# send_timeout indicates how long a packet can live in sendbuf

for {set i 0} {$i < $opt(nn)} {incr i} {
set dsr($i) [new Agent/DSRAgent]
$dsr($i) node $node_($i)
$dsr($i) rt_rq_max_period 100
$dsr($i) rt_rq_period 30
$dsr($i) send_timeout 300
}

 

Setting up Some Traffic

 

#
# Define traffic model
#
puts "Loading connection pattern..."
for {set i 1} {$i < 3} {incr i} { 
set udp_($i) [new Agent/UDP]
$ns_ attach-agent $node_($i) $udp_($i)
set null_(0) [new Agent/Null]
$ns_ attach-agent $node_(0) $null_(0)
set cbr_($i) [new Application/Traffic/CBR]
$cbr_($i) set packetSize_ 150
# Interval is measured in seconds
$cbr_($i) set interval_ 100
$cbr_($i) set random_ 1
#$cbr_($i) set maxpkts_ 1000
$cbr_($i) set fid_ 0
$cbr_($i) attach-agent $udp_($i)
$ns_ connect $udp_($i) $null_(0)
$ns_ at 250.$i "$cbr_($i) start"
}

 

 The Terminal outputs

The syncFlag : 0
The dutyCycle : 20
Loading connection pattern…
Starting Simulation…
num_nodes is set 15
channel.cc:sendUp – Calc highestAntennaZ_ and distCST_
highestAntennaZ_ = 1.5, distCST_ = 550.0
node: 4 …………..data sent Uni…………
node: 0 …………..data sent Uni…………
node: 1 …………..data sent Uni…………
node: 11 …………..data sent Uni…………
node: 4 …………..data sent Uni…………
node: 4 …………..data sent Uni…………
node: 1 …………..data sent Uni…………
node: 0 …………..data sent Uni…………
node: 4 …………..data sent Uni…………
node: 1 …………..data sent Uni…………
……………………………………………
…………………………………………..
……………………………………………
…………………………………………..
node: 9 …………..data sent Uni…………
node: 7 …………..data sent Uni…………
node: 3 …………..data sent Uni…………
node: 4 …………..data sent Uni…………
node:Stopping Simulation…

The NAM output

 

The Outputs of Trace Analysis

The Following comparison is made on the network with 15 nodes with four senders and receivers.

The performance of SMAC with and without Sleep and Wakeup cycle is compared in the following graphs.

The SMAC with sleep-wakeup cycles was able to send and receive much data packets than the normal MAC

 

As shown in the above graph, the SMAC with sleep-wakeup cycles consumed lower battery power than the normal MAC

 

As shown in the above graph, the SMAC with sleep-wakeup cycles provided little bit of higher throughput than the normal MAC


    

 

Conclusion 

As far as we have experimented with this protocols, in sensor network like communication scenario, the performance of s-mac was good.

Leave a Reply

WhatsApp Discuss Through WhatsApp