Wireless Sensor Networks Link Layer Protocols Mario agalj

  • Slides: 37
Download presentation
Wireless Sensor Networks Link Layer Protocols Mario Čagalj mario. cagalj@fesb. hr FESB University of

Wireless Sensor Networks Link Layer Protocols Mario Čagalj mario. cagalj@fesb. hr FESB University of Split 23/4/2010. Based on “Protocols and Architectures for Wireless Sensor Networks”, Holger Karl, 2005. 1

Data Link Layer services (source: Wiki) o Encapsulation of network layer data packets into

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) 2

Link layer tasks in general o Framing – group bit sequence into packets/frames >

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 3

Error control o Error control has to ensure that data transport is > >

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! 4

Characteristics of transmission errors o IEEE 802. 11 physical layer frame > MPDU –

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 5

Basic approaches to error control o Backward error control > Automatic Repeat Request (ARQ)

Basic approaches to error control o Backward error control > Automatic Repeat Request (ARQ) o Forward error control > Forward Error Correction o Different combinations 6

Backward error control – ARQ o Basic procedure > Put header information around the

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? 7

Standard ARQ protocols o Alternating bit (or Send-and-Wait) > Transmitter (XMTR) buffers one packet,

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 8

Standard ARQ protocols o Goback N > Send up to N packets, if a

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 9

Standard ARQ protocols o Selective Repeat > Similar to Goback N, however here the

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) 10

Digital channel model o How to stochastically capture the behavior of a wireless channel

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) 11

Example: Energy consumption of alternating bit 12

Example: Energy consumption of alternating bit 12

How to use acknowledgements o Be careful about ACKs from different layers > A

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 13

When to retransmit o Assuming sender has decided to retransmit a packet – when

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 14

Basic approaches to error control o Backward error control > Automatic Repeat Request (ARQ)

Basic approaches to error control o Backward error control > Automatic Repeat Request (ARQ) o Forward error control > Forward Error Correction o Different combinations 15

Forward error control o Idea: Endow symbols in a packet with additional redundancy to

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) 16

Forward error control o Can be used as an open loop technique > No

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 17

Block-coded FEC o Level of redundancy: blocks of symbols > Block: k p-ary source

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! 18

Hamming distance o An important metric for a block code o The Hamming distance

Hamming distance o An important metric for a block code o The Hamming distance of two valid channel words w 1 and w 2 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 19

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

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 20

Convolutional codes o Here also k bits of user data are mapped to n

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 bits o 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) 21

Energy consumption of convolutional codes o Tradeoff between coding energy and reduced transmission power

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 22

Interleaving o Bursy error characteristics affect performances of codes o Solution: Bit interleaving >

Interleaving o Bursy error characteristics affect performances of codes o 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 23

Hybrid schemes: FEC and ARQ o No single fixed error-control strategy will give optimum

Hybrid schemes: FEC and ARQ o No single fixed error-control strategy will give optimum energy efficiency at all times t: error correction capacity > 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) Relative energy consumption o FEC o Both schemes have their uses ->hybrid schemes BCH + unlimited number of retransmissions 24

Power control on a link level o Further controllable parameter: transmission power > Higher

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 Tradeoff o 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 25

Link layer tasks in general o Framing – group bit sequence into packets/frames >

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 26

Framing o We discuss two aspects of framing > Choice of packet size >

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 27

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

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) 28

Dynamically adapt frame/packet length o For known bit error rate (BER), optimal frame length

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 29

Intermediate checksum schemes o With traditional framing the whole packet has to be retransmitted

Intermediate checksum schemes o With traditional framing the whole packet has to be retransmitted o 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 scenarios o Optimal chunk size exists for fixed BER 30

Putting it together: ARQ, FEC, packet length optimization o Applying ARQ, FEC (both block

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. 31

Link layer tasks in general o Framing – group bit sequence into packets/frames >

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 32

Link management o Goal: decide to which neighbors that are more or less reachable

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 33

Link quality characteristics o Expected: simple, circular shape of “region of communication” – not

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 Power 1 Power 2 < Power 1 34

Three regions of communication o Effective region: PER consistently < 10% o Transitional region:

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% 35

Link quality estimation o How to estimate, on-line, in the field, the actual link

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: EWMA only estimates at fixed intervals EWMA exponentially weighted moving average 36

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

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 37