Create Presentation
Download Presentation

Download Presentation

Transmission Errors Error Detection and Correction

Download Presentation
## Transmission Errors Error Detection and Correction

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -

**Transmission Errors Outline**• Error Detection V.S. Error Correction • Hamming Distances and Codes • Parity • Checksum • Polynomial Codes • Cyclic Redundancy Checking (CRC) • Properties for Detecting Errors with Generating Polynomials Advanced Computer Networks Transmission Errors**Error Control**Error control mechanisms are techniques (e.g., Checksum, CRC) that enable reliable delivery of data over unreliable communication channels**Error Detection and Correction**• Error detection • Error detection refers to a class of techniques for detectinggarbled messages • Adding some Extra bits to detect Occurance of error • Not enough to detect the position of errors • Error correction • Adding enough redundant bits to deduce what the correct bits are • Error Correction are too expensive and hard Advanced Computer Networks Transmission Errors**Error Detection and Correction**• Error Detection +ARQ • Automatic Repeat reQuest (ARQ) • When only Error Detection is possible • Error is detected • At data link layer, information is automatically resent • Types of ARQ protocols • Stop-and-wait ARQ • Go-Back-N ARQ • Selective Repeat ARQ • Sliding Window Advanced Computer Networks Transmission Errors**Error Detection and Correction**• ARQ • A.K.A Automatic Repeat Query • Using Acknowledgement (Ack) (Ack is the messages sent by receiver indicating the correction of reception) • Using Timeout (A specified time period of time allowed to elapse before an acknowledgment is to be received) • Sender automaticallyre-transmits the frame/packet until the reception of acknowledgement (or exceeds a predefined number of re-transmissions) Advanced Computer Networks Transmission Errors**Error Detection and Correction**Single error V.S. Burst error • Errors • Single-bit error • Only one bit in the given data is in error • Easy to correct • Burst error • Two or more (continuous) bits from a data are in error. The length of burst is measured from the first corrupted bit to the last one • Very common • Hard to correct Advanced Computer Networks Transmission Errors**Error Detection and Correction**Single error V.S. Burst error • Example: • Error rate=0.001 • Frame size=1000 bits • Message length= 100 frame • Burst error length=100 bits • Single bit error • All frames might be corrupted averagely • Burst error • Only one frame is corrupted averagely Advanced Computer Networks Transmission Errors**Hamming Codes**• Code Word A legal data word consisting of mdata bits and rredundant bits. • Code System The set of all code words • Code Word Distance The number of bit positions in which two code words differ • Code System Distance The Smallest (minimum possible) distance between every pair of words of a code system. Advanced Computer Networks Transmission Errors**Hamming Codes**• Error Detection Mechanism • Comparison of received message with code system • If it Matches a code word There is no error (not always) Else Error is detected • Some errors change a legal code to another legal code (not detected) • Correction to the nearest legal code, if possible Advanced Computer Networks Transmission Errors**o**o o o x x x o x o x o x x o o o o o o x x o o o o x x x o o o o o o x x o Hamming Distance Error detection is possible only if the error changes a legal code word to an illegal A code with good distance properties (b) (a) A code with poor distance properties x = codewordso = non-codewords**Hamming Codes**• To detect dsingle-bit errors, a (d+1) code distance is needed • In a code system with distance d, (d-1)-bits errors can be detected at most. • Example: 00000000 00001111 11110000 11111111 Code distance=4 00001111 single bit error 10001111 (illegal) 00001111 two bit errors 11001111 (illegal) 00001111 three bit errors 11101111 (illegal) 00001111 four bit errors 11111111 (legal) Advanced Computer Networks Transmission Errors**Hamming Codes**• To correct d single-bit errors, a (2d+1) code distance is needed. • In a code system with distance d, (d-1)/2-bits errors can be corrected at most. • Example: 0000000000 0000011111 1111100000 1111111111 Code Distance= 5 Can Detect & Correct 1, 2 errors Can Detect but Not correct 3,4 errors Can't Detect 5 errors. Advanced Computer Networks Transmission Errors**Error Detection**• If data is m bit and total number of bits is m+r, then to correct single bit errors r is defined as 2r m + r + 1 (why?) Example: For m =7(ASCII) , the smallest r value that can satisfy above equation is 4 24 7 + 4 + 1 Advanced Computer Networks Transmission Errors**Hamming Code**Positions of Redundant bits in Hamming Code Example for 7 bits data r1 = bits [3, 5, 7, 9, 11] r2 = bits [3, 6, 7, 10, 11] r4 = bits [5, 6, 7] r8 = bits [9, 10, 11] Advanced Computer Networks Transmission Errors**Hamming CodeCalculation of Redundant Bits**Advanced Computer Networks Transmission Errors**Hamming CodeCalculation of Redundant Bits**Advanced Computer Networks Transmission Errors**Hamming CodeError Detection & Correction**R1 R2 Advanced Computer Networks Transmission Errors**Hamming CodeError Detection & Correction**R3 R4 Advanced Computer Networks Transmission Errors**Hamming CodeError Detection & Correction**The binary number R4R3R2R1 represents the position of the happened error in sequence (m+r) bit. Advanced Computer Networks Transmission Errors**Single Parity Check Code**Horizontal Parity Check 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 0 0 0 00 0 0 1 1 0 0 1 0 0 1 011 1 0 Parity bits for each Row Even Parity Check for each row Parity bit=XOR of all data bits Detection of all Odd bit errors Detection of Even bit errors is impossible Error detection rate=50% Advanced Computer Networks Transmission Errors**Two-dimensional Parity Check Code**Horizontal Vertical Parity Check 1 0 0 1 0 0 0 1 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 1 check bits for each Row Check bit for each Column Advanced Computer Networks Transmission Errors**Multiple Errors**1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 1 0 1 0 0 1 1 1 Two errors One error 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 0 1 0 1 0 0 1 1 1 1 0 0 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 0 0 1 1 0 1 0 0 1 1 1 Four errors Three errors Advanced Computer Networks Transmission Errors**Checksum**• Data is divided into K sections (words), each of n bits • All K sections are added (discarding any overflow) • Checksum= Two's complement of the total • Receiver adds all the words including the checksum • If the result is a word full of zeros, there is no error • Otherwise, error is detected. Advanced Computer Networks Transmission Errors**Checksum**• Example: • Data=ABC • A=65 (0041), B=66(0042), C=67(0043) • Checksum= 65+66+67=198 • Or 0041+0042+0043=00C6 • Checksum= 003A • Transmitting data= 0041, 0042, 0043, 003A Advanced Computer Networks Transmission Errors**Polynomial Codes**• A polynomial can be represented by a binary word • Each bit from right to left is mapped onto a power term. • The rightmost bit represents the “0” power term. The bit next to it the “1” power term, etc. • If the bit is of value zero, the power term is deleted from the expression. Advanced Computer Networks Transmission Errors**CRC Codeword**n bit codeword n-k check bits k information bits Advanced Computer Networks Transmission Errors**Polynomial Codes**• A polynomial of degree k-1can be represented by ak-bit bit string • At each position i • Bit 0=Coefficient 0x • Bit 1=Coefficient x(i-1) • i(x) = ik-1xk-1 + ik-2xk-2+ … + i1x + i0 Example: i(x) = x6+ x4 + x3 1 0 1 1 0 0 0 Advanced Computer Networks Transmission Errors**Polynomial Notation**• Let the codeword be n bits with k bits information bits and n-k redundant bits (check bits). • We need a generator polynomial g(x)of degree n-k of the form g(x) = 1xn-k + gn-k-1xn-k-1 + gn-k-2xn-k-2 +… + g1x + 1 Note – the first and last coefficient are always 1. Advanced Computer Networks Transmission Errors**Polynomial ArithmeticModule 2 Arithemetic**Addition: Multiplication: = q(x)quotient x3 + x2 + x Division: x3 + x+ 1 ) x6 + x5 x6 + x4 + x3 dividend divisor x5 + x4 + x3 x5 + x3 + x2 x4 + x2 x4 + x2 + x x = r(x)remainder Advanced Computer Networks Transmission Errors**CRC Algorithm**CRC Steps: 1) Multiply i(x) by xn-k Putting zeros in (n-k) low order positions 2) Dividing i(x).xn-k by g(x) 3) Adding remainder r(x) to i(x).xn-k i(x). xn-k+ r(x) = g(x) q(x) quotient remainder i(x). xn-k= g(x) q(x) + r(x) b(x) = i(x). xn-k+ r(x) transmitted codeword Advanced Computer Networks Transmission Errors**CRC Algorithm**• b(x)/g(x)=0 • b(x) is dividable by g(x) • Let y(x) denotes the received Data at receiver • Let e(x) denotes the Error mixed with sent data • y(x)=b(x)+e(x) (message with error) • y(x)/g(x)= b(x)/g(x)+e(x)/g(x) • First term b(x)/g(x) is divisible by definition • e(x)/g(x) determines the error. Advanced Computer Networks Transmission Errors**CRC Algorithm**• In a cyclic code, • If e(x)/g(x) ≠ 0, one or more bits is corrupted. • If e(x)/g(x) = 0, • No bit is corrupted • Some bits are corrupted, but the generator failed to detect them • Choosing a generator polynomial by which a larger number of errors are detected is of great importance. Advanced Computer Networks Transmission Errors**CRC Algorithm**Generator polynomial catch all single-bit errors, if • It has more than one term • Coefficient of x0 is 1 • Example (x+1) Note: No polynomial xi is divisible by (x + 1). Therefore, single-bit errors can be caught by the generator having factor (x + 1). (why?) Advanced Computer Networks Transmission Errors**CRC Example**Information: (1,1,0,0) i(x) = x3 + x2 Generator polynomial: g(x) = x3 + x + 1 Encoding: i(x).x3 = x6 + x5 x3 + x2 + x 1110 x3 + x+ 1) x6 + x5 1011 ) 1100000 x6 + x4 + x3 1011 x5 + x4 + x3 1110 1011 x5 + x3 + x2 1010 x4 + x2 1011 x4 + x2 + x x 010 • Transmitted codeword: • b(x) =i(x).x3 + r(x)= x6+ x5 + x • b= (1,1,0,0,0,1,0) Advanced Computer Networks Transmission Errors**CRC Example**Information: 1101011011 Generator: 10011 (x4+x+1) Transmitted Data: 11010110111110 Advanced Computer Networks Transmission Errors**Detecting Errors**1. Single bit errors: e(x) = xi0in-1 • If a single-bit error happens at ith position of the sent message, error e(x) = xiis added to the message b(x) • Received message y(x)=b(x)+ xi • b(x) is dividable by g(x) • y(x)/g(x)=e(x)= xi • Xi shows the position of the error position Advanced Computer Networks Transmission Errors**Detecting Errors**Single–bit error • CRC Coding • Information=1001 • g(x)=1011 • r(x)=110 • b(x)=1001110 Advanced Computer Networks Transmission Errors**Detecting Errors**Single–bit error • No Error • y(x)=1001110 • g(x)=1011 • Y(x)/g(x)=0 • e(x)=000 Advanced Computer Networks Transmission Errors**Detecting Errors**Single–bit error • Single error at position 3 • y(x)=1000110 • g(x)=1011 • y(x)/g(x)=011 • e(x)=x3 Advanced Computer Networks Transmission Errors**Detecting Errors**2. Double bit errors:e(x)= xi+xj0 i < j n-1 • What kind of generator polynomial is capable of detecting isolated double-bit errors? Why? Advanced Computer Networks Transmission Errors**Detecting Errors**3. Odd number of bit errors: • If an odd number of errors happen in the message, polynomial of the error has odd number of terms. • For example: Error e(x)=x5+x2+1 • A generator that contains a factor of (x+1)can detect all odd-numbered errors (why?). Advanced Computer Networks Transmission Errors**Detecting Errors**4. Burst errors: • Let r be the number of redundant bits • Let l be the length of the burst error • If burst error happens between bits m and n, where m<n • e(x)=xn+…+xm(n-m+1=l) • All burst errors with length • L≤r is always detected • L=r+1 is detected with probability 1–(1/2)r–1 • L>r+1 is detected with probability 1–(1/2)r Advanced Computer Networks Transmission Errors**Standard Generating Polynomials**• A good polynomial generator needs to have the following characteristics: • 1. It should have at least two terms. • 2. The coefficient of the term x0 should be 1. • 3. It should not dividext + 1 • 4. It should have the factor (x + 1). Advanced Computer Networks Transmission Errors**Standard Generating Polynomials**CRC-8: 100000111 CRC-10: 11000110011 CRC-16: 11000000000000101 CRC-CCITT: 10001000000100001 CRC-32: 100000100110000010001110110110111 Advanced Computer Networks Transmission Errors**Transmission Errors Summary**• Error Detection versus Error Correction • Hamming Distances and Codes • Parity • Internet Checksum • Polynomial Codes • Cyclic Redundancy Checking (CRC) • Properties for Detecting Errors with Generating Polynomials Advanced Computer Networks Transmission Errors