ad hoc and sensor networks chapter 6: link layer...

45
Ad hoc and Sensor Networks Chapter 6: Link layer protocols Holger Karl

Upload: others

Post on 04-Feb-2021

10 views

Category:

Documents


0 download

TRANSCRIPT

  • Ad hoc and Sensor NetworksChapter 6: Link layer protocols

    Holger Karl

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Goals of this chapter – Link layer tasks in general

    Framing – group bit sequence into packets/framesImportant: format, size

    Error control – make sure that the sent bits arrive and no other

    One of the most important tasks in data link layerFlow control – ensure that a fast sender does not overrun its slow(er) receiver

    Not an issue in sensor networksLink 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

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Overview

    Error controlFramingLink management

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Error control

    Error control has to ensure that data transport is Error-free – deliver exactly the sent bits/packetsIn-sequence – deliver them in the original orderDuplicate-free – and at most once Loss-free – and at least once

    Causes: fading, interference, loss of bit synchronization, …

    Results in bit errors, bursty, sometimes (see physical layer chapter)In wireless, sometimes quite high average bit error rates – 10-2 … 10-4 possible!

    ApproachesBackward error control – ARQ (Automatic Repeat Request)Forward error control – FEC

  • Causes and characteristics of transmission error

    Sync: consists of a string of 0s or 1s, alerting the receiver that a potentially receivable signal is present.SFD (start frame delimiter): defines the beginning of a frame.Signal: identifies the type of modulation that the receiver must use to demodulate the signal.Services: reserves for future use.CRC: The Signal, Service, and Length fields are all protected with a CCITT CRC-16 frame check sequence

    SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Format of an IEEE 802.11 physical layer frame

    Sync(128-bit) SFD(16-bit) Signal(8-bit) Services(8-bit) Length(16-bit) CRC(16-bit) MPDU (variable)

    Preamble PHY header

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Backward error control – ARQ

    Basic procedure (a quick recap)Put header information around the payloadCompute 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 senderSend positive or negative acknowledgement

    Sender uses timer to detect that acknowledgements have not arrived

    Assumes packet has not arrivedOptimal timer setting?

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

    What is maximum number of retransmission attempts? If bounded, at best a semi-reliable protocols results

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Standard ARQ protocols

    Alternating bit – at most one packet outstanding, single bit sequence numberGo-back N – send up to N packets, if a packet has not been acknowledged when timer goes off, retransmit all unacknowledged packetsSelective Repeat – when timer goes off, only send that particular packet

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    How to use acknowledgements

    Be careful about ACKs from different layersA MAC ACK (e.g., S-MAC) does not necessarily imply buffer space in the link layerOn the other hand, having both MAC and link layer ACKs is a waste

    Do not (necessarily) acknowledge every packet – use cumulative ACKs

    Tradeoff against buffer space Tradeoff against number of negative ACKs to send

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    When to retransmit

    Assuming sender has decided to retransmit a packet – when to do so?

    In a BSC (binary symmetric channel) channel, any time is as good as any In fading channels, try to avoid bad channel states – postpone transmissionsInstead (e.g.): send a packet to another node if in queue (exploit multi-user diversity)

    How long to wait? Example solution: Probing protocolIdea: reflect channel state by two protocol modes, “normal” and “probing”When error occurs, go from normal to probing modeIn probing mode, periodically send short packets (acknowledged by receiver) – when successful, go to normal mode

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Forward error control

    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

  • 4/29/2008

    Block Error Correction Codes

    TransmitterForward error correction (FEC) encoder maps each k -bit block into an n -bit block codewordCodeword is transmitted; analog for wireless transmission

    ReceiverIncoming signal is demodulatedBlock passed through an FEC decoder

  • 4/29/2008

    FEC Decoder Possible Outcomes

    No errors presentCodeword produced by decoder matches original codeword

    Decoder detects and corrects bit errorsDecoder detects but cannot correct bit errors; reports uncorrectable errorDecoder detects no bit errors, though errors are present

  • 4/29/2008

    Block Code Principles

    Hamming distance- for 2 n -bit binary sequences, the number of different bits

    E.g., v 1=011011; v 2=110001; d (v 1, v 2) = 3Example: Data block Codeword00 0000001 0011110 1100111 11110We can correct 1-bit error and detect 2-bit error

  • 4/29/2008

    Block Code Principles

    Redundancy – ratio of redundant bits to data bits that is (n - k )/kCode rate – ratio of data bits to total bitsCoding gain – the reduction in the required Eb /N0 to achieve a specified BER of an error-correcting coded system

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Block-coded FEC

    Level of redundancy: blocks of symbolsBlock: k p -ary source symbols (not necessarily just bits)Encoded into n q -ary channel symbols

    Injective mapping (code) of pk source symbols into qn channel symbolsCode rate : (k ld p) / (n ld q )

    When p=q=2: k/n is code rateFor p=q =2: Hamming bound – code can correct up to t bit errors only if

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

  • 4/29/2008

    Hamming Code Process

    Hamming codes are designed to correct single bit errorsEncoding: k data bits + (n - k ) check bitsDecoding: compares received (n -k ) bits with calculated (n - k ) bits using XOR

    Resulting (n - k ) bits called syndrome wordSyndrome range is between 0 and 2(n -k ) - 1Each bit of syndrome indicates a match (0) or conflict (1) in that bit position and hence2(n -k ) – 1 >= k + (n – k ) = n

  • 4/29/2008

    Hamming Code Characteristics

    We would like to generate a syndrome with the following characteristics:

    If the syndrome contains all 0s, no error has been detectedIf the syndrome contains only one bit set to 1, then an error has occurred in one of the check bitsIf the syndrome contains more than one bit set to 1, then the numerical value of the syndrome indicates the position of the data bit in error

  • 4/29/2008

    Hamming Code Generation

    Hamming check bits are inserted at the position of power of 2 i.e., positions 1, 2, 4, …, 2(n-k-1 )The remaining bits are data bitsEach data position which has a value 1 is presented by a binary value equal to its position; thus if the 9th bit is 1 the corresponding value is 1001All of the position values are then XORed together to produce the bits of the Hamming code

    Example: The 8-bit data block is 00111001

  • 4/29/2008

    BCH Codes

    For positive pair of integers m and t , a (n , k ) BCH code has parameters:

    Block length: n = 2m – 1Number of check bits: n – k = 2t + 1

    Correct combinations of t or fewer errorsFlexibility in choice of parameters

    Block length, code rate

  • 4/29/2008

    Reed-Solomon Codes (Option)

    Subclass of nonbinary BCH codesData processed in chunks of m bits, called symbolsAn (n , k ) RS code has parameters:

    Symbol length: m bits per symbolBlock length: n = 2m – 1 symbols = m (2m – 1) bitsData length: k symbolsSize of check code: n – k = 2t symbols = m (2t ) bitsMinimum distance: d min = 2t + 1 symbols

  • 4/29/2008

    Example

    Let t = 1 and m = 2. Denoting the symbols as 00, 01, 10, and 11Then n = 22 – 1 = 3 symbols = 6 bitsCheck code = (n - k ) = 2 symbols = 4 bitsThis code can correct any burst error

  • 4/29/2008

    Block Interleaving

    Data written to and read from memory in different ordersData bits and corresponding check bits are interspersed with bits from other blocksAt receiver, data are de-interleaved to recover original orderA burst error that may occur is spread out over a number of blocks, making error correction possible

  • Block Interleaving

  • 4/29/2008

    Convolutional Codes

    Generates redundant bits continuously Error checking and correcting carried out continuously

    (n , k , K ) codeInput processes k bits at a time Output produces n bits for every k input bitsK = constraint factork and n generally very small

    n -bit output of (n , k , K ) code depends on:Current block of k input bitsPrevious K -1 blocks of k input bits

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Convolutional codes

    Code rate: ratio of k user bits mapped onto n coded bitsConstraint length K determines coding gainEnergy

    Encoding: cheapDecoding: Viterbi algorithm, energy & memory depends exponentially on constraint length K

  • Convolutional Encoder

    Ex: input 1011generates output11100001

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Energy consumption of convolutional codes

    Tradeoff between coding energy and reduced transmission power (coding gain)Overall: block codes tend to be more energy-efficient

    residual bit error prob.!

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Comparison: FEC vs. ARQ

    FECConstant overhead for each packetNot (easily) possible to adapt to changing channel characteristics

    ARQOverhead only when errors occurred (expect for ACK, always needed)

    Both schemes have their uses ! hybrid schemes

    BCH + unlimited number of retransmissions

    Relative energy consumption

    t: error correction capacity

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Power control on a link level

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

    Tradeoff!

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Overview

    Error controlFramingLink management

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Frame, packet size

    Small packets: low packet error rate, high packetization overheadLarge packets: high packet error rate, low overheadDepends on bit error rate, energy consumption per transmitted bit

    Notation: h(overhead, payload size, BER)

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Dynamically adapt frame length

    For known bit error rate (BER), optimal frame length is easy to determineProblem: 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)

    Details: see the references of text bookSecond problem: how long are observations valid/how should they be aged?

    Only recent past is – if anything at all – somewhat credible

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Putting it together: ARQ, FEC, frame length optimization

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

    Channel modeled as Gilbert-Elliot

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Overview

    Error controlFramingLink management

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Link management

    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 estimatedThe quality of a link is not binaryThe quality of a link is time variableThe quality can only to be estimated

    Establish a neighborhood table for each nodePartially automatically constructed by MAC protocols

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Link quality characteristics

    Expected: simple, circular shape of “region of communication” – not realisticSometimes links are asymmetricInstead:

    Correlation between distance and loss rate is weak; iso-loss-lines are not circular but irregularAsymmetric links are relatively frequent (up to 15%)Significant short-term PER variations even for stationary nodes

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Three regions of communication

    Effective region : PER consistently < 10%Transitional region: anything in between, with large variation for nodes at same distancePoor region : PER well beyond 90%

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Link quality estimation

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

    Precision – estimator should give the statistically correct resultAgility – estimator should react quickly to changes Stability – estimator should not be influenced by short aberrations Efficiency – avoid too much listening for other nodes’ transmission

    There are active or passive estimator

    Example: only estimates at fixed intervals

    Pn is the prediction of packet loss rate at time t + nT

    rn : received packets in interval fn : packet identified as lostPn = αPn-1 + (1- α ) fn /(rn + fn )

  • SS 05 Ad hoc & sensor networs - Ch 6: Link layer protocols

    Conclusion

    Link layer combines traditional mechanismsFraming, Error control, flow control

    with relatively specific issuesCareful choice of error control mechanisms – tradeoffs between FEC & ARQ & transmission power & packet size …Link estimation and characterization