Radio and Medium Access Control

65
1 Radio and Medium Access Control

description

Radio and Medium Access Control. Learning Objectives. Understand important concepts about radio signals Understand radio properties of WSNs Understand schedule-based medium access protocols in WSNs Understand contention-based medium access protocols in WSNs Understand S-MAC, B-MAC, and X-MAC. - PowerPoint PPT Presentation

Transcript of Radio and Medium Access Control

Page 1: Radio and Medium Access Control

1

Radio and Medium Access Control

Page 2: Radio and Medium Access Control

2

Learning Objectives

• Understand important concepts about radio signals

• Understand radio properties of WSNs• Understand schedule-based medium access

protocols in WSNs• Understand contention-based medium access

protocols in WSNs• Understand S-MAC, B-MAC, and X-MAC

Page 3: Radio and Medium Access Control

3

Prerequisites

• Module 2• Basic concepts of wireless communications• Basic concepts of computer networks

Page 4: Radio and Medium Access Control

4

Radio Properties

Page 5: Radio and Medium Access Control

5

Some Basic Concepts

• RSSI• dbm• Noise floor: see wikipedia• CCA thresholding algorithms• Duty cycle• LPL

Page 6: Radio and Medium Access Control

6

Signal Transmission

Ref: Fig. 2.9 of “Wireless Communications and Networks” by William Stallings

Page 7: Radio and Medium Access Control

7

Packet Reception and Transmission

• Ref: [Hardware_1] Figure 5

Page 8: Radio and Medium Access Control

8

Signal

• An electromagnetic signal– A function of time– Also a function of frequency

• The signal consists of components of different frequencies

Page 9: Radio and Medium Access Control

9

802.15.4 Physical Layer

Page 10: Radio and Medium Access Control

10

dB• dB (Decibel)

– Express relative differences in signal strength– dB = 10 log10 (p1/p2)– dB = 0: no attenuation. p1 = p2– 1 dB attenuation: 0.79 of the input power survives: 10

* log10(1/0.79)– 3 dB attenuation: 0.5 of the input power survives: 10

* log10(1/0.5)– 10 dB attenuation: 0.1 of the input power survives: 10

* log10(1/0.1)

• http://en.wikipedia.org/wiki/Decibel• http://www.sss-mag.com/db.html

Page 11: Radio and Medium Access Control

11

dBm

• The referenced quantity is one milliwatt(mW)• dBm = 10 log10 (p1/1mW)• 0 dBm: p1 is 1 mW• -80 dBm: p1 is 10-11W = 10pW

• http://en.wikipedia.org/wiki/DBm

Page 12: Radio and Medium Access Control

12

Received Signal Strength Indicator (RSSI)

• The strength of a received RF signal• Many current platforms provide hardware

indicator– CC2420, the radio chip of MicaZ and TelosB,

provides RSSI indicator and LQI (Link Quality Indicator)

Page 13: Radio and Medium Access Control

13

LQI (Link Quality Indicator)

• A measure of chip error rate• Error rate

– The rate at which errors occur– Error

• 0 is transmitted while 1 is received• 1 is transmitted while 0 is received

Page 14: Radio and Medium Access Control

14

Noise Floor

• The measure of the signal created from the sum of all the noise sources and unwanted signals

Page 15: Radio and Medium Access Control

15

Signal Noise Ratio (SNR)

• The ratio of the power in a signal to the power contained in the noise that is present

• Typically measured at the receiver• Take CC2420 as the example:

– Noise Floor: the RSSI register from the CC2420 chip when not receiving a packet

• For example -98dBm– The strength field from the received packet: RSSI

of the received packet

Page 16: Radio and Medium Access Control

16

Radio Spectrum Frequency Allocation

• http://www.ntia.doc.gov/osmhome/allochrt.pdf

Page 17: Radio and Medium Access Control

ref: [radio_1]

Radio Irregularity

• Spherical radio range is not valid• When an electromagnetic signal propagate, the

signal may be– Diffracted– Reflected– Scattered

• Radio irregularity and variations in packet loss in different directions

Page 18: Radio and Medium Access Control

[Radio_1] Figure 1 18

Radio Signal Property

• Anisotropic Signal Strength: Different path losses in different directions

-65-64-63-62-61-60-59-58-57-56-55

0 25 50 75Beacon SeqNo

South NorthWest East

Figure 1: Signal Strength over Time in Four Directions

Page 19: Radio and Medium Access Control

[Radio_1]: Figure 3 19

Radio Signal Property

• Anisotropic Packet Loss Ratio: Packet Reception Ratio (PRR) varies in different directions

Page 20: Radio and Medium Access Control

[Radio_1]: Figure 4 20

Radio Signal Property• Anisotropic Radio Range: The communication

range of a mote is not uniform

Page 21: Radio and Medium Access Control

21

Medium Access Control (MAC)

Page 22: Radio and Medium Access Control

22

Introduction

• A radio channel cannot be accessed simultaneously by two or more nodes that are in a radio interference range– Nodes may transmit at the same time on the same

channel• Medium Access Control

– On top of Physical layer– Control access to the radio channel

Page 23: Radio and Medium Access Control

23

MAC Protocol Requirements • Energy Efficiency

– Sources of energy waste• Collision, Idle Listening, Overhearing, and Control Packet

Overhead

• Effective collision avoidance– When and how the node can access the medium and send

its data• Efficient channel utilization at low and high data rates

– Reflects how well the entire bandwidth of the channel is utilized in communications

• Tolerant to changing RF/Networking conditions• Scalable to large number of nodes

Ref: [MAC_2] Section I, II

Page 24: Radio and Medium Access Control

[MAC_3]: Section 4 24

Two Basic Classes of MAC Protocol – Slotted and Sampling

• Slotted Protocols (Synchronous Protocols)– Nodes divides time into slots– Radio can be in receive mode, transmit mode, or powered

off mode– Communication is synchronized– Data transfers occur in “slots”– TDMA, IEEE 802.15.4, S-MAC, T-MAC, etc.

• Also Ref: J. Polastre Dissertation – Section 2.4: http://www.polastre.com/papers/polastre-thesis-final.pdf

Page 25: Radio and Medium Access Control

25

Two Basic Classes of MAC Protocol – Slotted and Sampling

• Sampling Protocols– Nodes periodically wake up, and only start

receiving data if they detect channel activity– Communication is unsynchronized– Data transfer wakes up receiver– Must send long, expensive messages to wake up

neighbors– B-MAC, Preamble sampling, LPL, etc.

Page 26: Radio and Medium Access Control

26

Slotted Protocol Example: 802.15.4

• Each node beacons on its own schedule• Other nodes synchronize with the received

BeaconsB

eaco

n

Bea

con

Superframe Duration

Beacon Frame Duration

sleep

Dat

a

Dat

a

Ack

CSMA Contention Period

Page 27: Radio and Medium Access Control

27

IEEE 802.15.4 Superframe

Page 28: Radio and Medium Access Control

28

Using 802.15.4

RF Channel

15.4

SPwake forbeacon period

start radiosend beacon

Bea

con

beaconTX

are messagespending?

If yes,wake up

send

Dat

a

beaconRX

senddone

TX firstpacket

packetRX

Dat

a

Ack

TXdone

Ackreceived

send donereliability set

packetreceived

stop radiosuperframe complete

Stopradio

SP

15.4

Coordinator

Neighbors

Updateschedule

Page 29: Radio and Medium Access Control

29

Main MAC ProtocolsWireless medium access

Centralized

Distributed

Contention-based

Schedule-based

Fixedassignment

Demandassignment

Contention-based

Schedule-based

Fixedassignment

Demandassignment

Page 30: Radio and Medium Access Control

[MAC_2]: Figure 1 30

Scheduled Protocols

• TDMA divides the channel into N time slots

Page 31: Radio and Medium Access Control

[MAC_2]: Section IV 31

Contention-based Protocols

• A common channel is shared by all nodes and it is allocated on-demand

• A contention mechanism is employed• Advantages over scheduled protocols

– Scale more easily– More flexible as topologies change– No requirement to form communication clusters– Do not require fine-grained time synchronization

• Disadvantage– Inefficient usage of energy

• Node listen at all times• Collisions and contention for the media

Page 32: Radio and Medium Access Control

[MAC_2]: Section IV 32

CSMA

• Listening before transmitting• Listening (Carrier Sense)

– To detect if the medium is busy• Hidden Terminal Problem

Page 33: Radio and Medium Access Control

[MAC_2]: Section IV 33

Hidden Terminal Problem

• Node A and C cannot hear each other

• Transmission by node A and C can collide at node B

• On collision, both transmissions are lost

• Node A and C are hidden from each other

BA C

Page 34: Radio and Medium Access Control

[MAC_2]: Section IV 34

CSMA-CA

• CA– Collision Avoidance: to address the hidden

terminal problem• Basic mechanism

– Establish a brief handshake between a sender and a receiver before transmission

– The transmission between a sender and a receiver follows RTS-CTS-DATA-ACK

Page 35: Radio and Medium Access Control

35

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

Page 36: Radio and Medium Access Control

36

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!

Page 37: Radio and Medium Access Control

37

Schedule- vs. Contention-based MACs

• 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

Page 38: Radio and Medium Access Control

38

Possible Solutions

• CSMA (Carrier Sense Multiple Access)– Advantage:

• No clock synchronization required• No global topology information required

– Disadvantage• Hidden terminal problem: serious throughput

degradation• RTS/CTS can alleviate hidden terminal problem, but

incur high overhead

Page 39: Radio and Medium Access Control

39

Possible Solutions

• TDMA (Time-division multiple access)– Advantage

• Solve the hidden terminal problem without extra message overhead

– Disadvantage• It is challenging to find an efficient time schedule• Need clock synchronization

– High energy overhead• Handling dynamic topology change is expensive• Given low contention, TDMA gives much lower

channel utilization and higher delay

Page 40: Radio and Medium Access Control

40# of Contenders

Channel Utilization(The fraction of time that the channel is transmitting data)

TDMACSMA

IDEAL

Effective Throughput CSMA vs. TDMA

Sensitive to Time synch. errors,

Topology changes,

Slot assignment errors.

Do not use any topology or time synch. Info.

Thus, more robust to time synch. errors and changes.

Page 41: Radio and Medium Access Control

[MAC_2]: Section II.B 41

Four important sources of wasted energy in WSN:

– Idle Listening (required for all CSMA protocols)– Overhearing (since RF is a broadcast medium)– Collisions (Hidden Terminal Problem)– Control Overhead (e.g. RTS/CTS or

DATA/ACK)

MAC Energy Usage

Page 42: Radio and Medium Access Control

42

S-MAC

• During sleep, the node turns off its radio, and sets a timer to awake itself

[S-MAC]: Figure 2

Page 43: Radio and Medium Access Control

43

S-MAC

• Requires periodic synchronization among neighboring node– Negotiate a schedule– Prefer that neighboring nodes listen at the same

time and go to sleep at the same time– Use SYNC message

[S-MAC]

Page 44: Radio and Medium Access Control

44

S-MAC

• All senders perform CS (Carrier Sense) before initiating a transmission– Broadcast packets are sent without using

RTS/CTS– Unicast packet follow

RTS/CTS/DATA/ACK• To avoid collision

[S-MAC]

Page 45: Radio and Medium Access Control

45

S-MAC – Overhearing Avoidance

• To avoid overhearing: let interfering nodes go to sleep after they hear an RTS or CTS packet

[S-MAC]

Page 46: Radio and Medium Access Control

46

S-MAC – Adaptive Listening

• To improve latency caused by the periodic sleep of each node in the multi-hop network

• Let each node who overhears its neighbor’s transmissions (RTS and CTS) wake up a short period of time at the end of transmission

[S-MAC]

Page 47: Radio and Medium Access Control

47

S-MAC with Adaptive Listening

Ref: Figure 1 of [DW-MAC]

Page 48: Radio and Medium Access Control

48

B-MAC• A set of primitives that other

protocols may use as building block• Provide basic CSMA access• Optional link level ACK, no link

level RTS/CTS• CSMA backoffs configurable by

higher layers• Carrier Sensing using Clear Channel

Assess (CCA)• Sleep/Wake scheduling using Low

Power Listening (LPL)• Ref: Section 1, 3 of ref. [MAC_1]• LPL: See Section 2.1 of ref. [Energy_1]

Page 49: Radio and Medium Access Control

49

B-MAC

• Does not solve hidden terminal problem• Duty cycles the radio through periodic channel

sampling – Low Power Listening (LPL)

Page 50: Radio and Medium Access Control

50

B-MAC Clear Channel Assessment- Before transmission – take a sample of the channel- If the sample is below the current noise floor, channel is clear, send immediately.- If five samples are taken, and no outlier found => channel busy, take a random backoff- Noise floor updated when channel is known to be clear e.g. just after packet transmission

A packet arrives between 22 and 54ms. The middle graph shows the output of a thresholding CCA algorithm. ( 1: channel clear, 0: channel busy)

• Ref: Section 1, 3 of ref. [MAC_1]

Page 51: Radio and Medium Access Control

[MAC_1]: Figure 3 51

A Trace of Power Consumption

Page 52: Radio and Medium Access Control

52

B-MAC Low Power Listening

Receive data

Carrier sense

Receiver

Long Preamble Data TxSender

CheckInterval

Similar to ALOHA preamble sampling Wake up every Check-Interval Sample Channel using CCA If no activity, go back to sleep for Check-

Interval Else start receiving packet Preamble > Check-Interval

Goal: minimize idle listening

Page 53: Radio and Medium Access Control

53

Low Power Listening• Purpose

– Energy cost = RX + TX + Listen– Save energy

• How– Duty cycle the radio while ensuring reliable message

delivery– Periodically wake up, sample channel, and sleep

• The duty cycling receiver node performs short and periodic receive checks

• If the channel is checked every 100ms– The preamble must be at least 100 ms long for a node to

wake up, detect activity on the channel, receive the preamble, and then receive the message.

Page 54: Radio and Medium Access Control

54

X-MAC

• Asynchronous duty-cycled MAC protocol• Provide the following advantages over B-

MAC– Avoid overhearing problem: embedding the Target

ID in the Preamble– Reduce excessive preamble: strobed preamble

• Ref: Section 1, 3 of ref. [MAC_4]

Page 55: Radio and Medium Access Control

55

X-MAC and B-MAC

• Ref: Section 1, 3 of ref. [MAC_4]

Page 56: Radio and Medium Access Control

56

802.15.4 Frame Format

• Page 36 of CC2420 Data Sheet

Page 57: Radio and Medium Access Control

http://www.mail-archive.com/[email protected]/msg07600.html

TinyOS Implementation of CSMA o CC2420 - CCA

• Hardware– CC2420 has CCA as a pin that can be sampled to

determine if another node is transmitting– See CC2420 Data Sheet – Figure 1 CC2420 Pinout

• Software– CC2420Transmit has the option to send the

message with or without CCA• See CC2420TransmitP.send();

Page 58: Radio and Medium Access Control

https://www.millennium.berkeley.edu/pipermail/tinyos-help/2008-February/031061.html

TinyOS Implementation of CSMA of CC2420 - Ack

• Hardware Ack– If MDMCTRL0.AUTOACK of CC2420 is enabled

• Software Ack– SACK strobe in CC2420ReceiveP can be used to

set software ack

Page 59: Radio and Medium Access Control

59

Lab

• Please add the Low Power Listening feature to the PingPong application. That is, the packet from A to B and from B to A should be received using LPL.

Please follow TEP 126 - CC2420AckLplP / CC2420NoAckLplP

Page 60: Radio and Medium Access Control

60

Assignment

• 1. In many research papers about wireless sensor networks, spherical radio range is assumed. Is this true or not? Please brief explain.

• 2. What is the main idea of Low Power Listening (LPL)? Why do we need LPL?

• 3. What is the purpose of Clear Channel Assessment? • 4. What are the main advantages of X-MAC over B-

MAC?

Page 61: Radio and Medium Access Control

61

Project• This is a group project. Each group can have up to 3 students

• Project Description

• In this project, you will develop a multi-hop data collection tree protocol based on TinyOS 2.x. 1. Development of a multi-hop data collection tree protocol

1.1 The protocol to form a multi-hop data collection tree

The base station locally broadcast a tree construction message, which includes its own ID and its depth to be

0;a. When a node, say A, receives a tree construction message

from node B at its first time (i.e., node A has not joined the data collection tree yet), node A assigns its depth to be the depth of node B plus one, and its parent to be node B. After this, node A rebroadcasts the tree construction message.

Page 62: Radio and Medium Access Control

62

Project - continue

b. When a node, say A, already joins the data collection tree and receives a tree construction message from node B, node A just simply disregards the tree construction message.

c. When a node, say A, already joins the data collection tree (suppose that node A’s parent is node B and node A’s depth is n) and receives a tree construction message from node C: 1. suppose that if node A selects node C as its parent, node A’s depth is m;2. suppose m < n;node A will change its parent to node C.

Page 63: Radio and Medium Access Control

63

Project - continue

DBE

HA

F

G

I

Base Station

J

C

Depth = 0

Depth = 1

Depth = 2Depth = 2

Depth = 3 Depth = 3

Depth = 3

Depth = 3

Depth = 3Depth = 3

Depth = 3

one example multi-hop data collection tree

Page 64: Radio and Medium Access Control

64

Project - continue

• Also see attached slide tree.ppt for a dynamic view about how to construct a multi-hop data collection tree.1.2 After the multi-hop data collection tree is formed, each node senses and transmits its light intensity to the base station every one second. For each received message, the base station displays the following information:– Node ID which originates the message;– Tree depth of the Node;– Sensed light value

Page 65: Radio and Medium Access Control

65

Project - continue

• Basic Steps:Please follow the steps listed below:1. Setting up TinyOS environment - XubunTOSXubunTOS can be downloaded here:http://toilers.mines.edu/Public/XubunTOS2. Go through the TinyOS tutorials at http://docs.tinyos.net/index.php/TinyOS_Tutorials