wireless sensor networks

37
1 Wireless Sensor Networks Link Layer Protocols Mario Čagalj [email protected] FESB University of Split 23/4/2010. on “Protocols and Architectures for Wireless Sensor Networks”, Holger Karl, 2005.

Upload: sinjin

Post on 15-Jan-2016

44 views

Category:

Documents


0 download

DESCRIPTION

Wireless Sensor Networks. Link Layer Protocols. Mario Č agalj [email protected] FESB University of Split 23 / 4 /20 10. Based on “Protocols and Architectures for Wireless Sensor Networks”, Holger Karl , 2005. Data Link Layer services (source: Wiki). - PowerPoint PPT Presentation

TRANSCRIPT

Page 1: Wireless Sensor Networks

1

Wireless Sensor Networks

Link Layer Protocols

Mario Č[email protected]

FESB University of Split

23/4/2010.

Based on “Protocols and Architectures for Wireless Sensor Networks”, Holger Karl, 2005.

Page 2: Wireless Sensor Networks

2

Data Link Layer services (source: Wiki)

o Encapsulation of network layer data packets into frames o Frame synchronization o Logical link control (LLC) sublayer:

> Error control (automatic repeat request,ARQ), in addition to ARQ provided by some Transport layer protocols, to forward error correction (FEC) techniques provided on the Physical Layer, and to error-detection and packet canceling provided at all layers, including the network layer. Data link layer error control (i.e. retransmission of erroneous packets) is provided in wireless networks, error detection and canceling of erroneous packets are provided.

> Flow control, in addition to one provided on the Transport layer. Data link layer error control is not used in LAN protocols such as Ethernet, but in modems and wireless networks.

o Media access control (MAC) sublayer: > Multiple access protocols for channel-access control, for

example CSMA/CD protocols for collision detection and retransmission in Ethernet bus networks and hub networks, or the CSMA/CA protocol for collision avoidance in wireless networks.

> Physical addressing (MAC addressing)

Page 3: Wireless Sensor Networks

3

Link layer tasks in general

o Framing – group bit sequence into packets/frames> Important: format, size (impact on energy-consumtion and

throughput)

o Error control – make sure that the sent bits arrive and no other> Forward and backward error control

o Flow control – ensure that a fast sender does not overrun its slow(er) receiver

o Link management – discovery and manage links to neighbors > Do not use a neighbor at any cost, only if link is good

enough

Understand the issues involved in turning the radio communication between two neighboring nodes into a somewhat reliable link

Page 4: Wireless Sensor Networks

4

Error control

o Error control has to ensure that data transport is > Error-free – deliver exactly the sent bits/packets> In-sequence – deliver them in the original order> Duplicate-free – and at most once > Loss-free – and at least once

o Error sources: fading, interference, loss of bit synchronization, …> Results in bit errors, “bursty” (they tend to occur in

clusters with error-free periods)> In wireless, sometimes quite high average bit error rates

– 10-2 … 10-4 possible!

Page 5: Wireless Sensor Networks

5

Characteristics of transmission errors

o IEEE 802.11 physical layer frame> MPDU – MAC Protocol Data Unit> Preamble – constant bit pattern for bit and frame synchronization of the

receiver> The PHY header describes the lenght and the modulation used in the data part

(MPDU)

o The distortion of waveforms translates into bit errors and packet losses

o Packet losses (the MAC protocol does not see any data at all)> The receiver fails to acquire bit/frame synchronization> The SFD is wrong, the PHY header has an incorrect checksum

o Bit errors> Synch and PHY header ok, but some bits in MPDU not the same as

their transmitted counterpart

Page 6: Wireless Sensor Networks

6

Basic approaches to error control

o Backward error control> Automatic Repeat Request (ARQ)

o Forward error control > Forward Error Correction

o Different combinations

Page 7: Wireless Sensor Networks

7

Backward error control – ARQ

o Basic procedure> Put header information around

the payload> Compute a checksum and add it

to the packet• Typically: Cyclic redundancy

check (CRC), quick, low overhead, low residual error rate

> Provide feedback from receiver to sender• Send positive (pkt received) or negative acknowledgement

(pkt lost)> Sender uses timer to detect that acknowledgements have

not arrived• Assumes packet has not arrived• Optimal timer setting?

> If sender infers that a packet has not been received correctly, sender can retransmit it

• What is maximum number of retransmission attempts?

Page 8: Wireless Sensor Networks

8

Standard ARQ protocols

o Alternating bit (or Send-and-Wait)> Transmitter (XMTR) buffers one packet, sends it and sets

a timer> RECV receives the packet -> positive ACK -> XMTR frees

the buffer and transmits the next packet> RECV receives nothing -> negative ACK or being quite ->

XMTR retransmits the packet> XMTR marks each new packet with sequence numbers

alternating between 0 and 1> Retransmitted packets are coplies of the original packets

• Have the same sequence number

> The sequence numbers allow the RECV to detect duplicates

• Occurs when positive ACK is lost

Page 9: Wireless Sensor Networks

9

Standard ARQ protocols

o Goback N > Send up to N packets, if a packet has not been acknowledged

when timer goes off, retransmit all unacknowledged packets> Goback N allows the XMTR to have multiple unacknowledged

packets> XMTR keeps a buffer for up to N packets (a window)> Each packet has its own timer, started upon the packet’s

transmission> RECV accepts packets only in sequence and drops packets

received out of sequence (some previous packet had been lost)

• For this RECV needs only buffer space for one packet

> Usually RECV acknowledges the last packet arrieved in sequence

> If at the XMTR the timer for the oldest packet expires before receiving the corresponding ACK, this packet and all other packets in the window are retransmitted

Page 10: Wireless Sensor Networks

10

Standard ARQ protocols

o Selective Repeat > Similar to Goback N, however here the RECV has N buffers and

uses them to buffer frames arriving out of sequence> RECV sends either positive or negative ACKs> XMTR retransmits only those packet for which no ACK has

been received withing the timeout period (more energy-efficient)

o Alternating bit and Selective Repeat retransmit only erroneous packets (while Goback N potentially retransmits correctly received packets)

o The number of retransmissions allowed per packet must be bounded (to avoid spending too much energy)> A loss-free service therefore cannot be guaranteed

(semireliable protocols)

o Example (Energy consumption of alternating bit)

Page 11: Wireless Sensor Networks

11

Digital channel model

o How to stochastically capture the behavior of a wireless channel

o Directly model the resulting bit error behavior > Each bit is erroneous with constant probability p,

independent of the other bits -> binary symmetric channel (BSC)

Page 12: Wireless Sensor Networks

12

Example: Energy consumption of alternating bit

Page 13: Wireless Sensor Networks

13

How to use acknowledgements

o Be careful about ACKs from different layers> A MAC ACK (e.g., S-MAC) does not necessarily imply

buffer space in the link layer> On the other hand, having both MAC and link layer ACKs

is a waste

o Do not (necessarily) acknowledge every packet – use cumulative ACKs> Tradeoff against buffer space > Tradeoff against number of negative ACKs to send

Page 14: Wireless Sensor Networks

14

When to retransmit

o Assuming sender has decided to retransmit a packet – when to do so? > In a BSC channel, any time is as good as any > In fading channels, try to avoid bad channel states –

postpone transmissions• Retransmissions may be unecessarily lost

> Instead (e.g.): send a packet to another node (if in queue and if it has better channel) -> exploit multi-user diversity

o How long to wait? > Example solution: Probing protocol> Idea: reflect channel state by two protocol modes,

“normal” and “probing”> When error occurs, go from normal to probing mode> In probing mode, periodically send short packets

(acknowledged by receiver) – when successful, go to normal mode

Page 15: Wireless Sensor Networks

15

Basic approaches to error control

o Backward error control> Automatic Repeat Request (ARQ)

o Forward error control > Forward Error Correction

o Different combinations

Page 16: Wireless Sensor Networks

16

Forward error control

o Idea: Endow symbols in a packet with additional redundancy to withstand a limited amount of random permutations> Additionally: interleaving – change order of symbols to

withstand burst errors (clustered errors)

Channel encoder(FEC)

Inter-leaver

Modula-tor

Demo-dulator

Deinter-leaver

Channel decoder

Channel

Tx antenna

Rx antenna

Source symbols Channel symbols Channel symbols Digital waveform

Channel symbols Channel symbolsSource symbols Digital waveform

Information source

Informationsink

Page 17: Wireless Sensor Networks

17

Forward error control

o Can be used as an open loop technique> No feedback from the receiver> Possibly more energy-efficient as no ACK packets are sent> Moreover, the transmitter does not have to switch from the

transmitting to receiving states in order to be able to receive ACKs

o In practice FEC is used thogether with acknowlegments (backward error control) for more robust/reliable communicaiton

Page 18: Wireless Sensor Networks

18

Block-coded FEC

o Level of redundancy: blocks of symbols> Block: k p-ary source symbols (not necessarily just bits)> Encoded into n q-ary channel symbols> Mostly, we have p = q = 2, n ≥ k, and the symbols

correspond to bits

o Injective mapping of pk source symbols -> qn channel symbols> This mapping is called a code

o Code rate: (k ld p) / (n ld q)> When p=q=2: k/n is code rate

o For p=q=2: Hamming bound – code can correct up to t bit errors only if

> Codes for (n,k,t) do not always exist!

Page 19: Wireless Sensor Networks

19

Hamming distance

o An important metric for a block code

o The Hamming distance of two valid channel words w1 and w2 is defined as the number of bits in which they differ > E.g., 1001 and 1011 -> Hamming distance = 1

o The Hamming distance dmin of the whole code is defined as the minimum Hamming distance of all pairs of valid channel words

o Any code with a Hamming distance dmin can reliably detect up to and including dmin − 1 bit errors and can reliably correct up to and including (dmin−1)/2 bit errors

Page 20: Wireless Sensor Networks

20

Popular block codes

o Popular examples> Reed-Solomon codes (RS)> Bose-Chaudhuri-Hocquenghem codes (BCH)

o Energy consumption> E.g., BCH encoding: negligible overhead (linear-feedback

shift register)> BCH decoding: depends on block length (n) and Hamming

distance (that is the number of correctable bits t)

• Eadd and Emult are the energy needed to carry out addition and multiplication

> Similar for RS codes

Page 21: Wireless Sensor Networks

21

Convolutional codes

o Here also k bits of user data are mapped to n channel symbols; the coding of two successive k-bit blocks is not independent

o Code rate: ratio of k user bits mapped onto n coded bitso Constraint length K determines coding gain (by increasing K

we can reduce the transmit power required to achieve fixed BER)

o Energy> Encoding: cheap> Decoding: Viterbi algorithm, energy & memory depends

exponentially (!) on constraint length (K)

+ + ++ ……...

1 2 3 k * K

……...Stream of user bits

(k shifted in at once)

Code bits: Bit 1 Bit 2 Bit 3 Bit n

Page 22: Wireless Sensor Networks

22

Energy consumption of convolutional codes

o Tradeoff between coding energy and reduced transmission power (coding gain)

o Overall: block codes tend to be more energy-efficient

Page 23: Wireless Sensor Networks

23

Interleaving

Channel encoder(FEC)

Inter-leaver

Modula-tor

Demo-dulator

Deinter-leaver

Channel decoder

Channel

Tx antenna

Rx antenna

Source symbols Channel symbols Channel symbols Digital waveform

Channel symbols Channel symbolsSource symbols Digital waveform

Information source

Informationsink

o Bursy error characteristics affect performances of codeso Solution: Bit interleaving

> An interleaver at the XMTR takes the packet (of multiple blocks) generated by the FEC encoder

> The bits in this packet are permuted before transmitting> The deinterleaver at the RECV inverts the permutation before the packet

is handed to the FES decoder

o The error burst are spread over multiple coding blocks instead of being concatrated to one or a few blocks> Increases the chance that each block can be successfully decoded

Page 24: Wireless Sensor Networks

24

Hybrid schemes: FEC and ARQ

o No single fixed error-control strategy will give optimum energy efficiency at all times

o FEC> Constant overhead

for each packet> Not (easily)

possible to adapt to changing channel characteristics

o ARQ> Overhead only

when errors occurred (expect for ACK, always needed)

o Both schemes have their uses ->hybrid schemes

0

1

2

3

4

5

6

7

8

1e-07 1e-06 1e-05 0.0001 0.001 0.01 0.1

p

no FECt=2t=4t=6t=8

t=10

BCH + unlimited number of retransmissions

Rela

tive e

nerg

y c

on

su

mp

tion

t: error correction capacity

Page 25: Wireless Sensor Networks

25

Power control on a link level

o Further controllable parameter: transmission power > Higher power, lower error rates – less FEC/ARQ necessary> Lower power, higher error rates – higher FEC necessary

o Tradeoffo However, by increasing the power of a single XMTR,

the interference on other (neigboring) XMTRs increases -> i.e., the BER increases as well> Tradeoffs of this nature are very complex in multihop

networks

Page 26: Wireless Sensor Networks

26

Link layer tasks in general

o Framing – group bit sequence into packets/frames> Important: format, size (impact on energy-consumtion

and throughput)

o Error control – make sure that the sent bits arrive and no other> Forward and backward error control

o Flow control – ensure that a fast sender does not overrun its slow(er) receiver

o Link management – discovery and manage links to neighbors > Do not use a neighbor at any cost, only if link is good

enough

Page 27: Wireless Sensor Networks

27

Framing

o We discuss two aspects of framing> Choice of packet size> Intemediate checksum schemes

o The goal is to try to reduce the amount of information that has to be retransmitted in case of errors while maintaining minimal overhead

Page 28: Wireless Sensor Networks

28

Frame, packet size

o Small packets: low packet error rate, high packetization overhead

o Large packets: high packet error rate, low overhead

o Depends on bit error rate, energy consumption per transmitted bit

o Notation: h(overhead, payload size, BER)

0

2

4

6

8

10

12

14

16

18

20

1e-05 0.0001 0.001

En

erg

y p

er

use

ful b

it

Bit error rate

h(100, 100, p)h(100, 500, p)

0

5

10

15

20

25

30

0 500 1000 1500 2000 2500 3000

En

erg

y p

er

use

ful b

it

User data size

h(100,u,0.001)

Page 29: Wireless Sensor Networks

29

Dynamically adapt frame/packet length

o For known bit error rate (BER), optimal frame length is easy to determine

o Problem: how to estimate BER? > Collect channel state information at the receiver (RSSI,

FEC decoder information, …) > Example: Use number of attempts T required to transmit

the last M packets as an estimator of the packet error rate (assuming a BSC)

o Second problem: how long are observations valid/how should they be aged? > Only recent past is – if anything at all – somewhat

credible

Page 30: Wireless Sensor Networks

30

Intermediate checksum schemes

o With traditional framing the whole packet has to be retransmittedo In interdediate checksum schemes

> The user’s data are partitioned into a number L of chunks, each having c bits to which a checksum of h bits is appended

> The chunks are appended to the original frame header of size m bits> The overall frame has size m+L(c+h) bits

o RECV behaves as follows> Error in the header -> discard the whole packet> Check each chunk separatly and buffer the correct ones> If all correct RECV sends final ACK to XMTR> The faulty chunks indicated with and incomplete ACK -> XMTR retransmits

only the faulty packets

o High overhead in low BER scenarioso Optimal chunk size exists for fixed BER

Page 31: Wireless Sensor Networks

31

Putting it together: ARQ, FEC, packet length optimization

o Applying ARQ, FEC (both block and convolutional codes), frame length optimization to a Rayleigh fading channel

> Rayleigh fading models assume that the magnitude of a signal that has passed through such a transmission medium (also called a communications channel) will vary randomly, or fade, according to a Rayleigh distribution the radial component of the sum of two uncorrelated Gaussian random variables.

Page 32: Wireless Sensor Networks

32

Link layer tasks in general

o Framing – group bit sequence into packets/frames> Important: format, size (impact on energy-consumtion

and throughput)

o Error control – make sure that the sent bits arrive and no other> Forward and backward error control

o Flow control – ensure that a fast sender does not overrun its slow(er) receiver

o Link management – discovery and manage links to neighbors > Do not use a neighbor at any cost, only if link is good

enough

Page 33: Wireless Sensor Networks

33

Link management

o Goal: decide to which neighbors that are more or less reachable a link should be established> Problem: communication quality fluctuates, far away

neighbors can be costly to talk to, error-prone, quality can only be estimated

o Establish a neighborhood table for each node> Partially automatically constructed by MAC protocols

Page 34: Wireless Sensor Networks

34

Link quality characteristics

o Expected: simple, circular shape of “region of communication” – not realistic

o Instead: > Correlation between distance

and loss rate is weak; iso-loss-lines are not circular but irregular (see figures)

> Asymmetric links are relatively frequent (up to 15%)

> Significant short-term Packet Eerror Rates (PER) variations even for stationary nodes

Power1

Power2 < Power1

Page 35: Wireless Sensor Networks

35

Three regions of communication

o Effective region: PER consistently < 10%

o Transitional region: anything in between, with large variation for nodes at same distance

o Poor region: PER well beyond 90%

Page 36: Wireless Sensor Networks

36

Link quality estimation

o How to estimate, on-line, in the field, the actual link quality?o Requirements

> Precision – estimator should give the statistically correct result> Agility – estimator should react quickly to changes > Stability – estimator should not be influenced by short

aberrations > Efficiency – Active or passive estimator

o Example: EWMAonly estimates at fixed intervals

7 10 11 15Gap = 2 Gap = 3 Gap = ?

EWMA exponentially weighted moving average

Page 37: Wireless Sensor Networks

37

Conclusion

o Link layer combines traditional mechanisms> Framing, packet synchronization, flow control

with relatively specific issues> Careful choice of error control mechanisms – tradeoffs

between FEC & ARQ & transmission power & packet size …> Link estimation and characterization