WSN Unit-3
WSN Unit-3
Networks
Unit – III
Syllabus
2
Medium Access Control
3
Overview
4
MAC Protocol Categorization
Collisions can be avoided by ensuring that each node can use its allocated
resources exclusively
Examples of fixed assignment strategies:
FDMA: Frequency Division Multiple Access
the frequency band is divided into several smaller frequency bands
the data transfer between a pair of nodes uses one frequency band
all other nodes use a different frequency band
TDMA: Time Division Multiple Access
multiple devices to use the same frequency band
relies on periodic time windows (frames)
– frames consist of a fixed number of transmission slots to
separate the medium accesses of different devices
– a time schedule indicates which node may transmit data during a
certain slot
6
Contention-Free Medium Access
7
Contention-Free Medium Access
Dynamic assignment strategies: allow nodes to access the medium on demand
polling-based protocols
a controller device issues small polling frames in a round-robin
fashion, asking each station if it has data to send
if no data to be sent, the controller polls the next station
token passing
stations pass a polling request to each other (round-robin fashion) using
a special frame called a token
a station is allowed to transmit data only when it holds the token
reservation-based protocols
static time slots used to reserve future access to the medium
e.g., a node can indicate its desire to transmit data by toggling a
reservation bit in a fixed location
these often very complex protocols then ensure that other
potentially conflicting nodes take note of such a reservation to
avoid collisions
8
Contention-Based Medium Access
9
Contention-Based Medium Access
10
Hidden and Exposed Terminal Problems
Hidden-terminal problem
senders A and C are able to reach B, but cannot overhear each o t h e
rʼ s signals
it is possible for A and C to transmit data to B at the same time, causing
a collision at B, without being able to directly detect this collision
Exposed-terminal problem
C wants to transmit data D, but decides to wait because it overhears an
ongoing transmission from B to A
B ʼ s transmission could not interfere with data reception at
C
11
Carrier Sense Multiple Access
Nodes first sense the medium before they begin a transmission (reduces
number of collisions)
Non-persistent CSMA
node is allowed to immediately transmit data once medium is idle
if the medium is busy, the node performs a back-off operation
wait for a certain amount of time before attempting to transmit again
1-persistent CSMA
node wishing to transmit data continuously senses the medium for
activity
once the medium is found idle, the node transmits data immediately
if a collision occurs, the node waits for a random period of time before
attempting to transmit again
12
Carrier Sense Multiple Access
p-persistent CSMA
node continuously senses the medium
node transmits data with a probability p once the medium becomes idle
delays transmission with a probability 1 − p
random back-off values are either continuous values in the case of un-
slotted CSMA or multiples of a fixed slot size in slotted CSMA
CSMA/CA (CSMA with Collision Avoidance)
nodes sense the medium, but do not immediately access the channel
when it is found idle
instead, a node waits for a time period called DCF interframe space
(DIFS) (Distributed coordination function (DCF)) plus a multiple of a
slot size
in case there are multiple nodes attempting to access the medium, the
one with the shorter back-off period will win
13
Carrier Sense Multiple Access
Example:
node A waits for DIFS + 4 ∗ s (where s represents the slot size), while
node Bʼ back-off is DIFS + 7 ∗ s
once node A begins with its transmission, node B freezes its own back-
off timer and resumes the timer after node A completes its transmission
plus another period of DIFS
once node Bʼs Back-off timer expires, it can also begin its
transmission
14
MACA and MACAW
15
MACA By Invitation
16
IEEE 802.11
18
IEEE 802.11
After a successful transmission
receiver device responds with an acknowledgment after waiting for a
time period called the short interframe space (SIFS)
the value of SIFS is smaller than the value of DIFS to ensure that no
other device accesses the channel before the receiver can transmit its
acknowledgment
Once a node A makes a reservation using RTS and CTS control messages
another neighboring node B, overhearing the RTS message, must
refrain from accessing the medium until node A ‘s transmission
has been completed and acknowledged
however, this would mean that node B has to continuously sense the
medium to detect when it becomes idle again
19
IEEE 802.11
20
IEEE 802.11
21
IEEE 802.11
PCF mode
access point (AP) coordinates channel access to ensure collision-free
communication
periodically broadcasts a beacon to its client devices (includes list of
devices with data pending at AP)
during contention-free period, AP transmits these packets to its client
devices
AP can also poll client devices to allow them to initiate data transfers
AP uses a wait period called the PCF interframe space (PIFS)
PIFS is shorter than DIFS, but longer than SIFS
ensures that PCF traffic has priority over traffic generated by devices
operating in the DCF mode, without interfering with control
messages in the DCF mode such as CTS and ACK
22
IEEE 802.11
23
ZigBee
Before 802.15.4, ZigBee Alliance worked on low-cost communication technology
for low data rates and low power consumption
IEEE and ZigBee Alliance joined forces and ZigBee has become the
commercial name for the IEEE 802.15.4 technology
Star mode:
communication via the Personal Area Network (PAN) coordinator
synchronized mode (beacon-enabled)
PAN coordinator periodically broadcasts beacons for synchronization
and management
slotted channel access: device performs random backoff before channel
is sensed
– if no activity, node waits until next slot and senses channel again until
no activity has been detected for two consecutive slots
– if activity, backoff procedure is repeated
unsynchronized mode: device access channel immediately when no activity
is detected during the first initial backoff time
25
ZigBee
Peer-to-peer mode:
devices are free to communicate directly with each other
but they still must associate with the PAN coordinator before they can
participate in peer-to-peer communication
Data transfer between the device and its PAN coordinator is always initiated
by the device
allows a device to determine when data is transferred and to maximize
its energy savings
when a device wants to send data to the PAN coordinator, it can use
the previously described channel access method
the PAN coordinator transmits data intended for a device only after
the device explicitly requested such a transmission
in both cases, optional acknowledgments can be used to let the PAN
coordinator or device know that the transmission was successful
26
IEEE 802.15.4 and ZigBee
Challenges:
standard does not clearly define the operation of the peer-to-peer
approach
in large WSNs, it is unlikely that all devices will be able to use the same
PAN coordinator
standard does allow communication among PAN coordinators, but this
again is not well defined
27
Characteristics of MAC Protocols in WSNs
28
Energy Efficiency
Sensor nodes must operate using finite energy sources, therefore MAC
protocols must consider energy efficiency
Common technique: dynamic power management (DPM)
a resource can be moved between different operational modes such as
active, idle, and asleep
for resources such as the network, the active mode can group together
multiple different modes of activity, e.g., transmitting and receiving
Periodic traffic models are very common in WSNs
significant energy savings can be obtained by putting a device into a
low-power sleep mode
fraction of time a sensor nodes spends in active mode is called the duty
cycle
29
Energy Efficiency
30
Energy Efficiency
31
Scalability
Many wireless MAC protocols have been designed for use in infrastructure-
based networks
access points or controller nodes arbitrate access to the channel and
perform some centralized coordination and management functions
Most wireless sensor networks rely on multi-hop and peer-to-peer
communications without centralized coordinators
MAC protocols must be able to allow for efficient use of resources without
incurring unacceptable overheads, particularly in very large networks
MAC protocols based on CDMA have to cache a large number of code
(may be impractical for resource-constrained sensor devices)
WSNs are not only constrained in their energy resources, but also in their
processing and memory capacities
Therefore, MAC protocols should not impose excessive computational
burden should not require too much memory to save state information
32
Adaptability
33
Low Latency and Predictability
34
Reliability
35
Contention-Free MAC Protocols
Concept:
allow only one sensor node to access the channel at any given time
thereby avoiding collisions and message retransmissions
assuming a perfect medium and environment
i.e., no other competing networks or misbehaving devices exist that
could otherwise cause collisions or even jam a channel
Contention-free protocols allocate resources to individual nodes to ensure
exclusive resource access by only one node at any given time
Exposes a number of desirable characteristics
node knows exactly when it has to turn on its radio
during all other times, radio can be turned off to preserve energy
fixed slot allocations impose upper bounds on delay
difficult to design schedules for large networks
difficult to handle changes in topology, density, traffic load
36
Traffic-Adaptive Medium Access
37
Traffic-Adaptive Medium Access
38
Traffic-Adaptive Medium Access
39
Traffic-Adaptive Medium Access
– node can indicate which slots it gives up, allowing other nodes to
claim these unused slots
a node can determine its state for any given time slot t based on its
two-hop neighborhood information and the announced schedules
– node i is in the transmit (TX) state if it has the highest priority and
if it has data to send
– node i is in the receive (RX) state if it is the intended receiver of
the transmitter during slot t
– otherwise, the node can be switched into the sleep (SL) state
41
Traffic-Adaptive Medium Access
Summary
compared to CSMA-based protocols
reduces the probability of collisions
increases the sleep time and energy savings
unlike standard TDMA approaches
TRAMA divides time into random-access and scheduled-access
intervals
during the random-access intervals
– nodes are awake to either transmit or receive topology
information
– the length of the random-access interval affects the overall duty
cycle and achievable energy savings of a node
42
Y-MAC
44
Y-MAC
Unicast period
messages are initially exchanged on the base channel
at the beginning of its receive slot
a receiver switches its frequency to the base channel
the node that won the medium in the contention window also uses
the base channel to transmit its packet
the receiver acknowledges this packet (if the acknowledgment
request flag was set in the packet)
Broadcast period
every node tunes to the base channel
the potential senders take part in the contention process described
above
45
Y-MAC
Every node polls the medium only during broadcast time slots and its own
unicast receive time slots
makes this approach energy-efficient
however, under heavy traffic conditions, many unicast messages may
have to wait in the message queue or are dropped due to the limited
bandwidth reserved for the receiving node
as a consequence, Y-MAC uses a channel hopping mechanism to
reduce packet delivery latency
46
Y-MAC
After receiving a packet during its time slot on the base channel, the
receiving node hops to the next channel and sends a notification
it can continue to receive packets on the second channel
contention for the medium in the second channel is resolved as before
At the end of this slot, the receiving node can decide to hop again to
another channel
until reaching the last channel or
until no more data is being received
The hopping sequence generation algorithm
determines the actual hopping sequence among the available channels
should guarantee that there is only one receiver among one-hop
neighbors on any particular channel
47
Y-MAC
Summary
Y-MAC uses slot assignments (such as TDMA)
communication is receiver-driven to ensure low-energy consumption
i.e., a receiver briefly samples the medium during its slot and returns
to the sleep mode if no packets arrive
uses multiple channels
to increase the achievable throughput
to reduce delivery latency
main drawbacks of the Y-MAC approach:
has the same flexibility and scalability issues as TDMA (i.e., fixed
slot allocations)
requires sensor nodes with multiple radio channels
48
Low-Energy Adaptive Clustering Hierarchy
56
Low-Energy Adaptive Clustering Hierarchy
Setup phase
cluster heads are determined and communication schedules within
each cluster are established
since the cluster head is responsible for coordinating cluster activity and
forwarding data to the base station, its energy requirements will be
significantly larger compared to other sensor nodes
therefore, LEACH rotates the cluster head responsibility among sensor
nodes to evenly distribute the energy load
every sensor i elects itself to be a cluster head with a certain
probability Pi(t)
In a network with N nodes and a desired number of cluster heads of
k, the probabilities can be chosen to satisfy:
57
Low-Energy Adaptive Clustering Hierarchy
58
Low-Energy Adaptive Clustering Hierarchy
This approach does not consider the actual amount of energy available to
each node
An alternative approach to determining the probability of becoming a cluster
head can be used:
Ei(t) is node iʼs actual current energy and Etotal(t) is the sum of the energy
levels of all nodes
a disadvantage of this approach is that every node must know (or
estimate) Etotal(t)
59
Low-Energy Adaptive Clustering Hierarchy
Once a sensor node has determined that it will serve as cluster head for the
next round, it informs other sensor nodes of its new role by broadcasting an
advertisement message (ADV) using a non-persistent CSMA protocol
Every sensor node joins a cluster by selecting the cluster head that can be
reached with the smallest amount of transmit energy, based on received
signal strength of the ADV messages from the cluster heads
Joining is achieved by transmitting a join-request (Join-REQ) message to
the chosen cluster head using CSMA
The cluster head establishes a transmission schedule for its cluster and
transmits this schedule to each node in its cluster
60
Low-Energy Adaptive Clustering Hierarchy
Steady-state phase
a sensor node communicates only with the cluster head
it is allowed to transmit data only during its allocated slots (indicated
by the schedule received from the cluster head)
the responsibility of the cluster head is to forward sensor data
originating at one of its sensor nodes to the base station
in order to preserve energy:
each cluster member uses the minimum required transmit power to
reach the cluster head
each cluster member turns off the wireless radio between its
designated slots
the cluster head remains awake at all times
to receive sensor data from its cluster members
to communicate with the base station
61
Low-Energy Adaptive Clustering Hierarchy
Sensor nodes use the direct sequence spread spectrum (DSSS) technique
to limit the interference among clusters, while intra-cluster communication is
contention-free using TDMA-style frames and slots
Communication occurring in one cluster can still interfere with
communication in another cluster
Each cluster uses a spreading sequence that is different from the spreading
sequences used in neighboring clusters
Another reserved sequence is used for communication between cluster
heads and the base station
Communication between cluster heads and base station is based on CSMA
Before a cluster head transmits data, it first senses the channel to see if
there is an ongoing transmission using the same spreading code
62
Low-Energy Adaptive Clustering Hierarchy
LEACH-C
variation of LEACH protocol
relies on the base station to determine the cluster heads
during setup phase, each sensor node transmits its location and
energy levels to the base station
based on this information, the base station determines the cluster
heads and informs the cluster heads of their new role
other sensor nodes can then join clusters using join messages as
described in the original LEACH protocol
63
Low-Energy Adaptive Clustering Hierarchy
Summary
LEACH relies on a variety of techniques to reduce energy consumption
minimum transmit energy
avoiding idle listening of cluster members
LEACH attempts to obtain contention-free communication
schedule-based communication
DSSS
intra-cluster communication is contention-free and interferences among
clusters are avoided
communication between the cluster heads and the base station is still
based on CSMA
assumes that all nodes are able to reach the base station (affects the
scalability of this protocol; can be addressed using multi-hop routing or
by implementing a hierarchical clustering approach)
64
Contention-Based MAC Protocols
70
Sensor MAC
75
Sensor MAC
All nodes are free to communicate with nodes outside their clusters
Nodes periodically exchange their schedules with their neighbors using
SYNC messages (every node knows when any of its neighbors will be
awake)
If node A wants to communicate with a neighbor B that uses a different
schedule, A simply waits until B is listening and then initiates the data
transfer
contention for the medium is resolved using the RTS/CTS scheme
In order to choose a schedule, a node initially listens to the medium for a
certain amount of time
if this node receives a schedule from a neighbor, it chooses this
schedule as its own and this node becomes a follower
the node broadcasts its new schedule after a random delay td to
minimize the possibility for collisions from multiple new followers
76
Sensor MAC
77
Sensor MAC
78
Sensor MAC
79
Sensor MAC
Summary
S-MAC is a contention-based protocol
utilizes the sleep mode of wireless radios to trade energy for throughput
and latency
collision avoidance is based on RTS/CTS (which is not used by
broadcast packets, thereby increasing the collision probability)
duty cycle parameters (sleep and listen periods) are decided
beforehand and may be inefficient for the actual traffic characteristics in
the network
80
Timeout MAC
If there is only little traffic, S-MAC can actually waste energy because the
listening period of S-MAC is of fixed duration
On the other hand, if traffic is heavy, the fixed duration may not be large
enough
Therefore, the T-MAC protocol is a variation of S-MAC that uses an active
period that adapts to traffic density
Nodes wake up during the beginning of a slot to listen very briefly for activity
and return to the sleep mode when no communication has been observed
When a node transmits, receives, or overhears a message, it remains
awake for a brief period of time after completion of the message transfer to
see if more traffic can be observed
this brief timeout interval allows a node to return to the sleep mode as
quickly as possible
the end effect is that a nodeʼs awake times will increase with the heavier
traffic and will be very brief if traffic is light
81
Timeout MAC
To reduce potential collisions, each node waits for a random period of time
within a fixed contention interval before the medium is accessed
82
Timeout MAC
Once a node hears a CTS, it knows that another node won the medium
This node then stays awake until the end of the transmission, which can be
observed by overhearing the acknowledgment (ACK) sent by node B
This event initiates the beginning of the next contention interval and node C
will have an opportunity to transmit its data if it wins the medium
84
Timeout MAC
Summary
T-MACʼs adaptive approach allows it to adjust a nodeʼs sleep and
awake intervals based on the traffic load
nodes send messages as bursts of variable length and sleep between
such bursts to conserve energy
both S-MAC and T-MAC concentrate message exchanges to small
periods of time, resulting in inefficiencies under high traffic loads
intended receivers are kept awake using messages that indicate future
transmissions, which can significantly increase the idle listening times
(and energy consumption) of nodes
85
Pattern MAC
Nodes use patterns to describe their tentative sleep and awake times
a pattern is a string of bits, each bit representing a time slot
a node plans to sleep: bit is 0
a node plans to awake: bit is 1
86
Pattern MAC
While patterns are only tentative, schedules represent the actual sequence
of sleep and awake times
format of a pattern is always 0m1 where m = 0, 1, . . . , N − 1 and N time
slots are considered to be a period (example: pattern 001 and N=6)
value of m (number of leading zeros) is an indicator of traffic load
around the node
a small value indicates heavy traffic
a large value indicates light traffic
every nodeʼs pattern during the first period is 1 (m=0), i.e., every node
assumes a heavy traffic load should be awake at all times
87
Pattern MAC
If a node does not have any data to send during the first slot, then it uses
this as an indicator that the traffic around it is potentially light (pattern
becomes 01)
The node continues to double the sleep interval every time it has no data to
send (i.e., doubling the number of zeros; allowing it to sleep longer)
This process is continued until a predefined threshold is reached, then the
number of zeros is increased linearly
If there is no data for node i to send, the following sequence of patterns will
be generated:
1, 01, 021, 041, . . . , 0δ1, 0δ01, 0δ021, 0δ031, . . . , 0N−11
Whenever a node has data to send, the pattern is immediately reset to 1,
allowing the node to wake up quickly and to handle the traffic load
88
Pattern MAC
While a pattern is only a tentative sleep plan, patterns are used to derive
actual sleep schedules
A node broadcasts its own pattern at the end of a period during a time
interval called the Pattern Exchange Time Frame (PETF)
the PETF is divided into a sequence of brief slots where the number of
slots is set to the maximum number of neighbors a node could have
these slots are accessed using CSMA, i.e., collisions can occur
If a node does not receive a pattern update from one of its neighbors, the
node simply assumes the neighborʼs pattern remains unchanged
89
Pattern MAC
Once a node has received the patterns from its neighbors, it determines its
own schedule, where each slot can be used for one of three possible
operations
1. if the neighbor has advertised a 1 for that slot, a node wakes up and
transmits a message to a neighbor
2. if a node has advertised a 1, but has no data to send, the slot is used to
listen
3. if none of these two conditions holds, the node sleeps
90
Pattern MAC
Summary
PMAC provides a simple mechanism to build schedules that adapt to
the amount of traffic in a neighborhood
when traffic loads are light, a node is able to spend considerable
amounts of time in the sleep mode, thereby preserving energy
however, collisions during the PETF prevent nodes from receiving
pattern updates from all neighbors, while other nodes may have
received these updates
leads to inconsistent schedules among nodes in a neighborhood,
which can cause
– further collisions
– wasted transmissions
– unnecessary idle listening
91
Summary
127
Summary
128
Introduction
▪ Several MAC duty-cycle protocols have been proposed during the last
decade
to
▪ address specific WSNs requirements and constraints such as a
▪ low energy consumption linked to battery operated nodes
▪ Radio Duty-Cycle (RDC) MAC protocols try to reduce the energy consumption
by allowing a node to keep its radio-transceiver off most of the time.
▪ This allow a node to avoid to keep the radio on unnecessarily, i.e when not involved in
any transmission
▪ Idle listening is used to solve such problem in which RDC MAC forces node to switch its
transceiver between short active(listen) periods and long inactive (sleep) periods
ContikiMAC
Radio on
D
Data frame
Sender D A
D
D
DA ACK frame
Receiver DA
The first one is a simple pass-through protocol that simply calls the
appropriate RDC functions.
And the second one implements addressing, sequence number and
retransmissions.
CSMA protocol keep a list of packets to each of the neighbors and calculate
statistics such as number of retransmissions, collisions, deferrals, etc.
Even though the name, CSMA mean Carrier-Sense Medium Access, the
implementation in ContikiOS does not rely on the carrier sensing, because the
medium access is performed by RDC protocol.
MAC Drivers
• CSMA mechanism is currently the only MAC layer that retransmits packets
if a collision is detected. The most commonly used are
• ContikiMAC,
• CSMA
• NullRDC
• ContikiMAC provides a very good power efficiency but is somewhat tailored for the
802.15.4 radio and the CC2420 radio transceiver
References
:
• Fundamentals of Wireless Sensor Networks:
Theory and Practice Waltenegus Dargie and
Christian Poellabauer © 2010 John Wiley &
Sons Ltd.
• https://anrg.usc.edu/contiki/index.php/MAC_
protocols_in_ContikiOS
Thank You!!