Presentation is loading. Please wait.

Presentation is loading. Please wait.

1 Wireless Sensor Networks Link Layer Protocols Mario Čagalj FESB University of Split 2013. Based on “Protocols and Architectures.

Similar presentations


Presentation on theme: "1 Wireless Sensor Networks Link Layer Protocols Mario Čagalj FESB University of Split 2013. Based on “Protocols and Architectures."— Presentation transcript:

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

2 2 Data Link Layer services (source: Wiki) oEncapsulation of network layer data packets into frames oFrame synchronization oLogical 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. oMedia 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)

3 3 Link layer tasks in general oFraming – group bit sequence into packets/frames >Important: format, size (impact on energy-consumtion and throughput) oError control – make sure that the sent bits arrive and no other >Forward and backward error control oFlow control – ensure that a fast sender does not overrun its slow(er) receiver oLink 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

4 4 Error control oError 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 oError 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!

5 5 Characteristics of transmission errors oIEEE 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) oThe distortion of waveforms translates into bit errors and packet losses oPacket 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 oBit errors >Synch and PHY header ok, but some bits in MPDU not the same as their transmitted counterpart

6 6 Basic approaches to error control oBackward error control >Automatic Repeat Request (ARQ) oForward error control >Forward Error Correction oDifferent combinations

7 7 Backward error control – ARQ oBasic 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?

8 8 Standard ARQ protocols oAlternating 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

9 9 Standard ARQ protocols oGoback 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

10 10 Standard ARQ protocols oSelective 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) oAlternating bit and Selective Repeat retransmit only erroneous packets (while Goback N potentially retransmits correctly received packets) oThe 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) oExample (Energy consumption of alternating bit)

11 11 Digital channel model oHow to stochastically capture the behavior of a wireless channel oDirectly model the resulting bit error behavior >Each bit is erroneous with constant probability p, independent of the other bits -> binary symmetric channel (BSC)

12 12 Example: Energy consumption of alternating bit

13 13 How to use acknowledgements oBe 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 oDo not (necessarily) acknowledge every packet – use cumulative ACKs >Tradeoff against buffer space >Tradeoff against number of negative ACKs to send

14 14 When to retransmit oAssuming 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 oHow 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

15 15 Basic approaches to error control oBackward error control >Automatic Repeat Request (ARQ) oForward error control >Forward Error Correction oDifferent combinations

16 16 Forward error control oIdea: 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)

17 17 Forward error control oCan 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 oIn practice FEC is used thogether with acknowlegments (backward error control) for more robust/reliable communicaiton

18 18 Block-coded FEC oLevel 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 oInjective mapping of p k source symbols -> q n channel symbols >This mapping is called a code oCode rate: (k ld p) / (n ld q) >When p=q=2: k/n is code rate oFor p=q=2: Hamming bound – code can correct up to t bit errors only if >Codes for (n,k,t) do not always exist!

19 19 Hamming distance oAn important metric for a block code oThe 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 oThe Hamming distance d min of the whole code is defined as the minimum Hamming distance of all pairs of valid channel words oAny code with a Hamming distance d min can reliably detect up to and including d min − 1 bit errors and can reliably correct up to and including (d min −1)/2 bit errors

20 20 Popular block codes oPopular examples >Reed-Solomon codes (RS) >Bose-Chaudhuri-Hocquenghem codes (BCH) oEnergy 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) E add and E mult are the energy needed to carry out addition and multiplication >Similar for RS codes

21 21 Convolutional codes oHere also k bits of user data are mapped to n channel symbols; the coding of two successive k-bit blocks is not independent oCode rate: ratio of k user bits mapped onto n coded bits oConstraint length K determines coding gain (by increasing K we can reduce the transmit power required to achieve fixed BER) oEnergy >Encoding: cheap >Decoding: Viterbi algorithm, energy & memory depends exponentially (!) on constraint length (K)

22 22 Energy consumption of convolutional codes oTradeoff between coding energy and reduced transmission power (coding gain) oOverall: block codes tend to be more energy- efficient

23 23 Interleaving oBursy error characteristics affect performances of codes oSolution: 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 oThe 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

24 24 Hybrid schemes: FEC and ARQ oNo single fixed error-control strategy will give optimum energy efficiency at all times oFEC >Constant overhead for each packet >Not (easily) possible to adapt to changing channel characteristics oARQ >Overhead only when errors occurred (expect for ACK, always needed) oBoth schemes have their uses ->hybrid schemes BCH + unlimited number of retransmissions Relative energy consumption t: error correction capacity

25 25 Power control on a link level oFurther controllable parameter: transmission power >Higher power, lower error rates – less FEC/ARQ necessary >Lower power, higher error rates – higher FEC necessary oTradeoff oHowever, 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

26 26 Link layer tasks in general oFraming – group bit sequence into packets/frames >Important: format, size (impact on energy-consumtion and throughput) oError control – make sure that the sent bits arrive and no other >Forward and backward error control oFlow control – ensure that a fast sender does not overrun its slow(er) receiver oLink management – discovery and manage links to neighbors >Do not use a neighbor at any cost, only if link is good enough

27 27 Framing oWe discuss two aspects of framing >Choice of packet size >Intemediate checksum schemes oThe goal is to try to reduce the amount of information that has to be retransmitted in case of errors while maintaining minimal overhead

28 28 Frame, packet size oSmall packets: low packet error rate, high packetization overhead oLarge packets: high packet error rate, low overhead oDepends on bit error rate, energy consumption per transmitted bit oNotation: h(overhead, payload size, BER)

29 29 Dynamically adapt frame/packet length oFor known bit error rate (BER), optimal frame length is easy to determine oProblem: 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) oSecond problem: how long are observations valid/how should they be aged? >Only recent past is – if anything at all – somewhat credible

30 30 Intermediate checksum schemes oWith traditional framing the whole packet has to be retransmitted oIn 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 oRECV 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 oHigh overhead in low BER scenarios oOptimal chunk size exists for fixed BER

31 31 Putting it together: ARQ, FEC, packet length optimization oApplying 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.

32 32 Link layer tasks in general oFraming – group bit sequence into packets/frames >Important: format, size (impact on energy-consumtion and throughput) oError control – make sure that the sent bits arrive and no other >Forward and backward error control oFlow control – ensure that a fast sender does not overrun its slow(er) receiver oLink management – discovery and manage links to neighbors >Do not use a neighbor at any cost, only if link is good enough

33 33 Link management oGoal: 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 oEstablish a neighborhood table for each node >Partially automatically constructed by MAC protocols

34 34 Link quality characteristics oExpected: simple, circular shape of “region of communication” – not realistic oInstead: >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

35 35 Three regions of communication oEffective region: PER consistently < 10% oTransitional region: anything in between, with large variation for nodes at same distance oPoor region: PER well beyond 90%

36 36 Link quality estimation oHow to estimate, on-line, in the field, the actual link quality? oRequirements >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 oExample: EWMA only estimates at fixed intervals EWMA exponentially weighted moving average

37 37 Conclusion oLink 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


Download ppt "1 Wireless Sensor Networks Link Layer Protocols Mario Čagalj FESB University of Split 2013. Based on “Protocols and Architectures."

Similar presentations


Ads by Google