Vous êtes sur la page 1sur 25

Network and Systems Laboratory

nslab.ee.ntu.edu.tw

Wireless Sensor Networks:


Zigbee Stack
Polly Huang
Department of Electrical Engineering
National Taiwan University
http://cc.ee.ntu.edu.tw/~phuang
phuang@cc.ee.ntu.edu.tw

Copyright © 2008
Polly@NTU 1
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Zigbee Stack
Designed for indoor home appliances
Routing
MAC

Copyright © 2008
Polly@NTU 2
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Radio Coverage

Good link Grey link Bad link


Copyright © 2008
Polly@NTU 3
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Problems in Networking
No one node can reach every other node
Need multiple routing

Each node can reach a high number of other nodes


Need MAC with collision avoidance

No link is 100% reliable


Need (quasi-)reliable data transport

Copyright © 2008
Polly@NTU 4
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Ad Hoc Routing
Multi-hop Routing for Wireless Network

Copyright © 2008
Polly@NTU 5
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Ad Hoc Network
A collection of
wireless and/or
mobile nodes
Forming a
spontaneous
network

Copyright © 2008
Polly@NTU 6
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Ad Hoc Routing
Finding a path
Each host is
also a router

Simplest Solution
Shortest path routing
Ex: Distance Vector or Link State
Copyright © 2008
Polly@NTU 7
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Temporally-Ordered Routing Algorithm


(TORA)
Presented INFOCOM ’97 by Park and Carson
Think about it as water flowing through tubes
on its way to a destination
Node broadcasts a QUERY packet, recipient
broadcasts an UPDATE packet

Copyright © 2008
Polly@NTU 8
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Copyright © 2008
Polly@NTU 9
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Ad Hoc On-Demand Distance Vector


(AODV)
Presented as Internet-Draft, Perkins and Royer,
1997
Takes the basic
On-demand mechanism of Route Discovery and
Maintenance from DSR
Plus hop-by-hop routing, etc from DSDV
Source broadcasts a Route Request packet,
recipient sends back a Route Reply packet

Copyright © 2008
Polly@NTU 10
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

AODV Example
Route Request

Route Reply

Copyright © 2008
Polly@NTU 11
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Wireless MAC

Copyright © 2008
Polly@NTU 12
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Types of MAC
Reservation Based
Allocating a certain amount of resource
Exclusive for a particular node
Example: TDMA, FDMA, CDMA
For cellular networks
Random Access
Sharing the channel
Listen and try
Example: CSMA, CSMA/CD, CSMA/CA
For WiFi
Copyright © 2008
Polly@NTU 13
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Time Division Multiple Access


Access to channel in "rounds"
Each station gets fixed length slot in each round
 Length = packet transmission time
Unused slots go idle
Example: 6-station LAN, 1,3,4 have pkt, slots 2,5,6 idle

Copyright © 2008
Polly@NTU 14
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Frequency Division Multiple Access


Channel spectrum divided into frequency bands
Each station assigned fixed frequency band
Unused transmission time in frequency bands go idle
Example: 6-station LAN, 1,3,4 have pkt, frequency bands
2,5,6 idle
time
frequency bands

Copyright © 2008
Polly@NTU 15
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Carrier Sense Multiple Access


CSMA: listen before transmit:
 If channel sensed idle: transmit entire frame
 If channel sensed busy, defer transmission

Human analogy: don’t interrupt others!

Copyright © 2008
Polly@NTU 16
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

spatial layout of nodes

collisions can still occur:


propagation delay means
two nodes may not hear
each other’s transmission

collision:
entire packet transmission
time wasted

Copyright © 2008
Polly@NTU 17
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

CSMA/CD (Collision Detection)


CSMA/CD: carrier sensing, deferral as in CSMA
Collisions detected within short time
Colliding transmissions aborted, reducing channel
wastage

Human analogy: the polite conversationalist

Copyright © 2008
Polly@NTU 18
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Copyright © 2008
Polly@NTU 19
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Collision Detection in Wireless


Can’t sense all collisions in any case:
 Hidden terminal
 Signal fading
goal: avoid collisions: CSMA/C(ollision)A(voidance)

A B C
C
A’s signal C’s signal
strength
B strength
A
space
Copyright © 2008
Polly@NTU 20
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

CSMA/CA Collision Avoidance


802.11 sender sender receiver
if sense channel idle for DIFS then
transmit entire frame (no CD) DIFS
if sense channel busy then
1. start random backoff time
2. timer counts down while channel idle data
3. transmit when timer expires
4. if no ACK, increase random backoff interval,
SIFS
repeat 2.
802.11 receiver ack
if frame received OK
return ACK after SIFS (ACK needed due to hidden
terminal, fading problems)

Copyright © 2008
Polly@NTU 21
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Really Avoiding Collisions


idea: allow sender to “reserve” channel rather than random access
of data frames: avoid collisions of long data frames
 Sender first transmits small request-to-send (RTS) packets using
CSMA
RTSs may still collide with each other (but they’re short)
 Receiver broadcasts clear-to-send CTS in response to RTS
 RTS/CTS heard by all nodes
 sender transmits data frame
 other stations defer transmissions

Avoid data frame collisions completely


using small reservation packets!
Copyright © 2008
Polly@NTU 22
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

CSMA/CA - Illustrated
A Receiver B

RTS(A) RTS(B)
reservation
RTS(A) collision

CTS(A) CTS(A)

DATA (A)
defer

time
ACK(A) ACK(A)

Copyright © 2008
Polly@NTU 23
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Zigbee Stack
AODV
Identifying single path
On-demand for mobile network
CSMA-like MAC
Listen before transmit
 Ack optional
 RTS/CTS optional

Copyright © 2008
Polly@NTU 24
Network and Systems Laboratory
nslab.ee.ntu.edu.tw

Questions?

Copyright © 2008
Polly@NTU 25

Vous aimerez peut-être aussi