Download as pdf or txt
Download as pdf or txt
You are on page 1of 55

ITCE419

Wireless Sensor Networks

Medium Access Protocols for Wireless


Sensor Networks
This Chapter
• Medium Access Protocol
• Introduction
• For traditional wireless networks
• For sensor networks

ITCE419 2
Medium access protocol (MAC) for wireless
• In terms of protocol stack, sits above the physical layer and
below the link layer
• Has been researched since 1960s but still hasn’t been
completely resolved
• Traditionally, the key function of MAC is: Control when to
send a packet
• You will see later that sensor networks add a new dimension due
to its need to be energy efficient
• We take a progressive approach
• Step 1: MAC design for tradition wireless networks
• Slides 1-29
• Step 2: MAC design for sensor networks
• Slides 30-54

ITCE419 3
Why is MAC necessary?

Figure: Wireless network F


with a number of nodes. A
C D E
Red circle: transmission
range of Node A
B

• Assuming that
• Node A wants to send a packet to Node B
• Node C wants to send a packet to Node D
• If both transmissions (A -> B and C -> D) take place at the same
time, Node B will not be able to decode the packet
• We say that a collision occurs at Node B
• The packet at Node B will be destroyed by interference and has to be
sent again
• Consequence: Only some of the nodes can transmit at the same
time
• Medium access control protocol is to control when a node can
send a packet

ITCE419 4
A naïve approach: Token

Figure: Wireless network F


with a number of nodes. A
C D E
Red circle: transmission
range of Node A
B

• Rule: The node with a token can transmit


• Main problem:
• Inefficiency for a large network
• A token will only allow one transmission to take place in the
network at a time.
• Some transmissions can take place in parallel, e.g. A -> B and E
-> F.
• Lessons learnt:
• Need to consider scalability and efficiency
• Parallel transmission should be allowed if they don’t interfere
with each other.

ITCE419 5
Another naïve approach: Centralised scheduling

Figure: Wireless network F


with a number of nodes. A
C D E
Red circle: transmission
range of Node A
B

• Rule:
• Divide into time slots
• For each time slot, specify which transmissions can
take place
• Example:
• Slot 1: A -> B, E -> F
• Slot 2: C -> D
• …
• What are the problems?
• A distributed approach will be better

ITCE419 6
ALOHA (1)
• First wireless MAC protocol
• Implemented in Hawaii in 1970s in a wireless network that
connects multiple Hawaiian islands
• When a node receives a packet to send, it sends it
immediately
• A transmission is successful if
• The packet is correctly received by the receiver.
• The receiver sends an ACK packet and is correctly received by the
transmitter.
• If the transmission is not successful, the transmitter waits a
random delay before trying again
• Why?
• Unsuccessful transmission means a collision has occurred.
• If all the nodes involved in the collision transmit again, this will result
in another collision.

ITCE419 7
ALOHA (2)

• What is the Performance of Aloha?


• Let G = attempted transmission rate
• = arrival rate of new packet + re-attempt rate
• Note: re-attempt rate depends on the random delay
• Throughput (the rate at which packets are successfully
transmitted) = G exp(-2 G)
• A graph of G versus throughput is on the next slide
• If G is too big, there is simply too many collisions and not many
packets are successfully transmitted

ITCE419 8
ALOHA performance

Throughput

Attempt rate

ITCE419 9
ALOHA (3)

• Aloha is an example of contention MAC protocol


• Nodes content for the channel in a random manner
• If no other nodes are contenting for the channel, packet
transmission will be successful
• Price to pay: possible collisions
• Comments:
• Advantages:
• Simple, low protocol overhead
• Distributed: a node doesn’t have to know what other nodes will do
• Disadvantage:
• Collision overhead
• Low throughput
• Slotted ALOHA is an enhanced version !

ITCE419 10
CSMA - Carrier Sense Multiple Access
• The main weakness of ALOHA is packet collision
• Can we reduce it?
• An improvement is by using carrier sensing

• Example
• A is currently transmitting to B A C D
• C wants to send to D
• If before C transmits, it listens to the
channel to check whether there is any B
radio activity.
• If yes (which is this case), it delays
its transmission.
• Result: The potential collision
between the transmissions A->B and
C->D can be avoided.

ITCE419 11
Carrier sensing
• Means listening to the channel to see whether there is any
activity in the radio channel
• Carrier sense  decoding the packet
• A node doesn’t have to be able to decode the packet to know there
is transmission activity going on.
• Let SNR_threshold_decode = SNR threshold
needed to decode a packet F
• SNR_threshold_cs = SNR threshold needed to
detect transmission activity (= carrier sense)
• SNR_threshold_cs < SNR_threshold_decode D
• Carrier sensing range (green cicle) > A C
transmission range (red circle) E
• Nodes B and C can decode as well as
carrier sense A’s transmission B
• Nodes D and E cannot decode but can still
carrier sense A’s transmission
• Node F cannot sense A’s transmission
ITCE419 12
CSMA algorithms (1)
• There are a number different CSMA algorithms
• Common to all versions:
• If the medium is sensed to be busy
• Delay the transmission
• Different CSMA algorithms have different ways of finding
the delay

ITCE419 13
CSMA algorithms (2)
• 1-persistent CSMA ????
• Non-persistent CSMA
• Generate a random delay
• Wait until the end of this delay and check whether the medium is
idle.
• If idle, send the packet.
• If busy, generate another delay and wait
• Too large random delay may cause inefficiency

Radio transmission taking place


time

Channel sensed to
be busy random delay

ITCE419 14
CSMA algorithms (3)
• p-Persistent CSMA
• If the medium is busy, keep sensing the medium until it becomes
idle.
• The node makes a decision on a per time slot basis.
• In each time slot
• The node transmits with a probability p or waits with probability 1-p
• If a node decides to wait, it continues to sense the channel
• If another node has begun transmissions (thus the medium is busy),
the node continues to sense the medium until idle and repeats the
process.
• The role of p is to trade-off between collision and delay

Radio transmission taking place


time

Time slots
Channel sensed to be busy

ITCE419 15
Problems with CSMA
• CSMA improves over ALOHA
• Although CSMA can prevent some collisions from
happening, it cannot prevent possible collisions. An
example is the hidden node problem
• It also introduces some inefficiency: exposed node problem

ITCE419 16
Hidden node problem
• Node A is transmitting to Node B
• Node C is outside the carrier sensing range of A so it is
unaware of the transmission of A
• If C begins a transmission, it interferes with B’s reception
thus resulting in a collision. • Node C is a hidden node.
• Note that not all the nodes
D
outside the carrier sensing
range are hidden nodes.
B C • Node D’s transmission is not
A
going to destroy Node B’s
reception, then it is not a
hidden node i.e. whether
Node D’s transmission will
decrease the SINR at Node
B to below the decoding
threshold
ITCE419 17
Exposed node problem
• Node A is transmitting to Node B
• Node C wants to transmit to Node D but it senses that the
medium is busy, so it refrains from transmitting due to
CSMA protocol.

• However, the transmissions


• A -> B
• C -> D
A C D
B can take place simultaneously
• That is, Node A’s (C’s)
transmission won’t destroy
Node D’s (B’s) reception
• Result: Inefficiency

ITCE419 18
Recap: MAC layer unicast and broadcast (1)
• MAC addresses can be unicast or broadcast addresses
• If Node A sends a broadcast frame
• Recall a frame is a layer 2 protocol data unit
• Node A will put the MAC layer broadcast address in the recipient
field of the frame
• All the nodes within the transmission range of Node A will be able
to decode it
• Nodes B, C, D see that this is a broadcast frame and will pass the
frame to the upper layer for further processing.

A C
B

ITCE419 19
Recap: MAC layer unicast and broadcast (2)
• If Node A sends a unicast frame to Node B
• Node A will put the MAC layer address of Node B in the recipient
field of the frame
• All the nodes within the transmission range of Node A will be able
to decode it
• Nodes B sees that this is a unicast frame for it and will pass the
frame to the upper layer for further processing
• Nodes C and D, after decoding the frame and find it is not meant
for them, will discard the frame

A C
B

ITCE419 20
IEEE 802.11 MAC
• The IEEE 802.11 standards on MAC has two different
modes
• PCF (Point Coordination Function)
• Centralised control by an access point (AP)
• AP polls the nodes for packets
• DCF (Distributed Coordination Function) is a distributed MAC
• DCF uses
• CSMA
• Backoff algorithm for delaying the transmission when sensed busy
• RTS/CTS for mitigating the hidden node problem

ITCE419 21
IEEE 802.11 MAC

ITCE419 22
RTS/CTS handshake (1)
• Node B has a frame (Layer 2 protocol data unit) to send to
C and senses the channel to be idle
• Node B uses the RTS/CTS handshake which consists of 4
phases
• Phase 1: Node B broadcasts an RTS (Ready to send)
packet
• All nodes within the transmission range of B will pick up this frame
• Both Nodes A and C hear the RTS frame
• RTS frame contains the address of the destined recipients

We will explain why RTS


A B C D is broadcast rather than
unicast later.

ITCE419 23
RTS/CTS handshake (2)
• Phase 2: Node C replies with a CTS frame
• After receiving the RTS frame, Node C knows it is the intended
recipient of an upcoming unicast
• Node C senses the channel and if finds it idle, it replies to Node B
with a CTS (Clear to Send) frame
• Again, the CTS frame is broadcast
• Note:
• Node A also receives the RTS frame but it won’t reply. It will do
something and we will see that later.
• Node D will also do something with the received CTS - see later.

B sends RTS.
A B C D C replies with CTS

ITCE419 24
RTS/CTS handshake (3)
• Phase 3: Node B sends the data to Node C
• After Node B has received the CTS frame, it sends the data frame
to Node C
• The data frame is unicast
• Phase 4: Node C replies with an ACK
• After Node C has received the packet and checks the CRC (cyclic
redundancy check), it sends an ACK to node B to say that the
frame has been received correctly
• The ACK frame is broadcast.

B sends RTS.
C replies with CTS
A B C D B sends data.
C replies with ACK

ITCE419 25
RTS/CTS handshake (4)
• RTS/CTS/ACK are known as control frames
• All the control frames are broadcast. Why?
• Example:
• Node C broadcasts CTS
• Node D hears it and knows that Node C is the intended recipient of a
data transmission
• Node D therefore keeps quiet so that Node C can receive the packet
correctly
• What problem does this solve?
• How long does Node D has to keep quiet for?

B sends RTS.
C replies with CTS
A B C D B sends data.
C replies with ACK

ITCE419 26
RTS/CTS handshake (5)
A B C D
• The time that a
transmission will last is RTS
contained in the NAV
field of the RTS/CTS
frames CTS

• NAV stands for Network


Allocation Vector Data

• This method is also NAV indicates


busy medium

known as virtual carrier NAV indicates


busy medium
sensing
Ack

ITCE419 27
RTS/CTS handshake (6)
• RTS/CTS ameliorate, but do not solve hidden/exposed
terminal problems
• Example problem cases:
A B C D A B C D
RTS RTS

RTS
CTS CTS
RTS

Data RTS Data CTS

CTS Data

Ack

ITCE419 28
IEEE 802.11 MAC: Backoff
• An IEEE 802.11 node will go into backoff if it senses the
channel to be busy
• Backoff procedure
• It chooses a random value called the contention window (CW)
• It starts a count down timer whose length is CW time slots
• Timer actions:
• If the time slot is sensed to be idle: decrement the time
• If the time slot is sensed to be busy: suspend the count down until a
time slot is sensed to be idle
• When the countdown reaches zero and the slot is sensed to be
idle, send the frame.
• If collision occurs or sensed to be idle, resume countdown with
2*CW
• Design philosophy: Busy channel means other nodes are
transmitting so delay transmission.
ITCE419 29
Summary on MAC for traditional wireless networks
• Three traditional MAC: ALOHA, CSMA, IEEE 802.11
• What MAC does? Decide when to transmit a frame
• Issues:
• Prevent collision
• Contention based protocol has to live with collision but we can’t let it
get too serious
• Efficiency in terms of delay and throughput
• Fairness
• Will one node be able to access the channel more often than some
other nodes?

ITCE419 30
Sensor network MAC
• The major issue with designing sensor network MAC is
energy efficiency
• In order to understand how we can make MAC energy
efficient, we need to know how energy is spent first!
• A radio consumes energy when
• Transmitting
• Receiving
• Idle
• Sleep

ITCE419 31
Radio energy consumption (1)
• Transmitting
• The radio is switched ON
• Energy is needed to transmit a frame
• Receiving
• The radio is switched ON
• Energy is needed to receive a frame
• Idle
• The radio is switched ON but it is neither transmitting nor receiving
• However, it is ready to transmit and ready to receive
• It also consumes energy

ITCE419 32
Radio energy consumption (2)
• Sleep
• The radio is turned OFF
• It cannot transmit nor receive. It can only do that if the radio is
turned ON again.
• If Node A sends a frame to Node B while the radio of Node B is
sleeping, Node B is totally unaware of this transmission and Node
A’s transmission is wasted

• For Mica motes:


• Transmission costs 36mW
• Receiving costs 14.4 mW
A B
• Idle costs about the same as receiving
• Sleep costs 15W
• Sleep can save energy but must be
done at the right time!
ITCE419 33
Sources of energy wastage (1)
• Four sources of energy wastage
• Collision
• Overhearing
• Protocol overhead
• Idle listening
• Collision
• Collision of packets mean the packet has to be re-transmitted
• The more collisions, the more energy is wasted
• Should minimise collision!
• Protocol overhead
• Control frames are overhead because they are not part of data
• Should minimise protocol overhead!

ITCE419 34
Sources of energy wastage (2)
• Overhearing
• Node A transmits a unicast frame to Node B
• Nodes C and D also decode them and find the frame is meant for
Node B
• This is overhearing and consumes as much energy as receiving.
Nodes C and D better off sleep!
• Idle listening
• If a node knows that it won’t have to transmit or receive packets in
the next x seconds, it can sleep for the next x seconds without
problem
• Difficulty: How do we know what x should be?

A C
B

ITCE419 35
Sensor networks MAC
• Requirements
• Primary: Seek to minimise energy usages by reducing the wastes
discussed earlier
• Secondary: Identical to traditional MAC. Throughput, delay,
fairness etc.
• As simple as possible
• Examples of sensor network MAC
• S-MAC
• TMARA
• IEEE 802.15.4

ITCE419 36
S-MAC
• MAC protocols can be either contention-based or
contention-free.
• S-MAC (Sensor-MAC) : Contention-based
• Reduces idle listening, collisions and overhearing
• Key features:
• Periodic wakeup
• Virtual clusters
• Adaptive listening
• Message passing

ITCE419 37
S-MAC: Periodic wakeup (1)
• Motivation
• Some applications may collect sensing data periodically, say once
an hour
• The radio may take only one minute to forward its data and relay
data for its neighbours
• The other 59 minutes, the radio doesn’t have any work to do
• If the radio is left on, this idling listening consumes energy and can be
saved!
• A period is divided into
• Sleep period where the radio is OFF
• Listen period where the radio is ON

Node A’s schedule:

= Listen period = Sleep period

ITCE419 38
S-MAC: Periodic wakeup (2)
• Two neighbouring nodes can only communicate if their
listen period overlaps
• Need to know their neighbours’ wake up patterns
• Node A can communicate with Node B but not with Node C
• S-MAC uses virtual clustering to ensure that neighbouring
nodes share the same schedule
• Note: Schedule = listen/sleep schedule

Node A’s schedule:

Node B’s schedule:

Node C’s schedule:

= Listen period = Sleep period


ITCE419 39
S-MAC: Listen period
• The listen period is divided into SYNCH, RTS, CTS
• SYNCH (for Synchronisation)
• For nodes to exchange schedules
• Need to re-synchronise

• RTS/CTS
• Same role as 802.11 Active period

• This is followed by data Wakeup period


exchange
Sleep period

For SYNCH For RTS For CTS

ITCE419 40
S-MAC: Virtual clusters
• Nodes try to pick up schedule from neighboring nodes
• If no neighbor found, nodes pick some schedule to start
with
• If additional nodes join, some node might learn about two
different schedules from different nodes
• To bridge this gap, it has to follow both schemes

A A A A A A
B B B B B
E E E E E E E
C C C C C
D D D D Time
ITCE419 41
S-MAC: Reduce overhearing
• Example:
• Node A transmits to Node B
• Node C hears Node B’s CTS with NAV
• Node C cannot transmit and can go to sleep according to the NAV
- this reduces overhearing
Listen period Sleep period

Node A RTS CTS Data ACK

Node B

Node C can
sleep
Node C

ITCE419 42
S-MAC: Adaptive listening (1)
• A price to pay for sleeping is latency
• Node A sends data to Node B
• By the time Node B gets the data and would like to forward to Node C,
Node C is already sleep
• Not good. Node B needs to wait until the next listen period.

Listen period Sleep period

Node A RTS CTS Data ACK

Node B RTS

C doesn’t hear!
Node C

Node C goes to sleep


ITCE419 43
S-MAC: Adaptive listening (2)
• Solution: Adaptive listening
• Node C thinks that Node B may want to forward the packet to it, it
schedules an extra listen period
• If Node B sends an RTS, Node C sends CTS, …
• If no RTS from Node B or frame is not meant for Node C, Node C goes
back to sleep.
Listen period Sleep period

Node A RTS CTS Data ACK

Node B

Sleep Extra listening


Node C

Node C hears Node


ITCE419B’s CTS. It schedules an extra listening period44
TRAMA
• Nodes are synchronized
• Time divided into cycles, divided into
• Random access periods
• Scheduled access periods
• Nodes exchange neighborhood information
• Learning about their two-hop neighborhood
• Using neighborhood exchange protocol: In random access
period, send small, incremental neighborhood update information
in randomly selected time slots
• Nodes exchange schedules
• Using schedule exchange protocol
• Similar to neighborhood exchange

ITCE419 45
TRAMA
• TRAMA operation consists of three : mechanisms: the
neighbor protocol (NP), schedule exchange protocol
(SEP), and adaptive election algorithm (AEA).

• TRAMA consists of four main phases:


• Neighborhood discovery
• Traffic information exchange
• Schedule establishment
• Data transmission

ITCE419 46
TRAMA – adaptive election
• Given: Each node knows its two-hop neighborhood and
their current schedules
• How to decide which slot (in scheduled access period) a
node can use?
• Use node identifier x and globally known hash function h
• For time slot t, compute priority p = h (x © t)
• Compute this priority for next k time slots for node itself and all two-
hop neighbors
• Node uses those time slots for which it has the highest priority

Priorities of t=0 t=1 t=2 t=3 t=4 t=5


node A and A 14 23 9 56 3 26
its two
neighbors B B 33 64 8 12 44 6
&C C 53 18 6 33 57 2

ITCE419 47
TRAMA – possible conflicts
• When does a node have to receive?
• Easy case: one-hop neighbor has won a time slot and announced a
packet for it
• But complications exist – compare example

• What does B
believe?
• A thinks it can send
• B knows that D has
higher priority in its A D
2-hop B C
neighborhood!
• Rules for resolving
such conflicts are
part of TRAMA Prio 100 Prio 95 Prio 79 Prio 200

ITCE419 48
IEEE 802.15.4
• IEEE standard for low-rate WPAN applications
• Goals: low-to-medium bit rates, moderate delays without
too stringent guarantee requirements, low energy
consumption
• Physical layer
• 20 kbps over 1 channel @ 868-868.6 MHz
• 40 kbps over 10 channels @ 905 – 928 MHz
• 250 kbps over 16 channels @ 2.4 GHz
• MAC protocol
• Single channel at any one time
• Combines contention-based and schedule-based schemes
• Asymmetric: nodes can assume different roles

ITCE419 49
IEEE 802.15.4 MAC overview
• Star networks: devices are associated with coordinators
• Forming a PAN, identified by a PAN identifier
• Coordinator
• Bookkeeping of devices, address assignment, generate beacons
• Talks to devices and peer coordinators Coordinator Device

• Beacon-mode superframe structure Beacon

• GTS assigned to devices upon request Data


request
Active period Inactive period
Acknowledgement

Data

Contention
Guaranteed time
access Acknowledgement
slots (GTS)
Beacon period

ITCE419 50
Comparison of wireless standards

Source: G-Z Yang (Ed), Body sensor networks,


ITCE419 51
Different classes of MAC

Wireless medium access

Centralized
Distributed

Schedule- Contention-
based based Schedule- Contention-
based based
Fixed Demand
assignment assignment Fixed Demand
assignment assignment

ITCE419 52
Centralized medium access
• Idea: Have a central station control when a node may
access the medium
• Example: Polling, centralized computation of TDMA schedules
• Advantage: Simple, quite efficient (e.g., no collisions), burdens the
central station

• Not directly feasible for non-trivial wireless network sizes


• But: Can be quite useful when network is somehow divided
into smaller groups
• Clusters, in each cluster medium access can be controlled
centrally – compare Bluetooth piconets, for example

! Usually, distributed medium access is considered

ITCE419 53
Schedule- vs. contention-based MACs
• Schedule-based MAC
• A schedule exists, regulating which participant may use which resource at
which time (TDMA component)
• Typical resource: frequency band in a given physical space (with a given
code, CDMA)
• Schedule can be fixed or computed on demand
• Usually: mixed – difference fixed/on demand is one of time scales
• Usually, collisions, overhearing, idle listening no issues
• Needed: time synchronization!
• Contention-based protocols
• Risk of colliding packets is deliberately taken
• Hope: coordination overhead can be saved, resulting in overall improved
efficiency
• Mechanisms to handle/reduce probability/impact of collisions required
• Usually, randomization used somehow

ITCE419 54
Summary on Sensor network MAC
• Sensor MAC design is an ongoing research problem
• It’s a difficult research problem
• We’ve given you a glimpse of some of the solutions but new and
better solution keep popping up
• Main approach: contention and/or schedule
• Main issue: energy
• Reading:
• Karl and Willing: Chapter 5
• Sections 5.1, 5.2 (Introduction), 5.2.2, 5.4.3, 5.5
• Papers on S-MAC and TRAMA (available on course Dropbox
folder)

ITCE419 55

You might also like