Presentation is loading. Please wait.

Presentation is loading. Please wait.

Transmission Errors Error Detection and Correction.

Similar presentations


Presentation on theme: "Transmission Errors Error Detection and Correction."— Presentation transcript:

1 Transmission Errors Error Detection and Correction

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

3 3 reliable delivery unreliable communication channels Error control mechanisms are techniques (e.g., Checksum, CRC) that enable reliable delivery of data over unreliable communication channels Error Control

4 Error Detection and Correction Error detection detectinggarbled messages ◦ Error detection refers to a class of techniques for detecting garbled messages ExtraOccurance ◦ 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 expensivehard ◦ Error Correction are too expensive and hard Advanced Computer Networks Transmission Errors4

5 Error Detection and Correction Error Detection +ARQ Error Detection + ARQ Automatic Repeat reQuest (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 Types of ARQ protocols ◦ Stop-and-wait ARQ ◦ Go-Back-N ARQ ◦ Selective Repeat ARQ ◦ Sliding Window Advanced Computer Networks Transmission Errors5

6 Error Detection and Correction ARQ ARQ Automatic Repeat Query ◦ A.K.A Automatic Repeat Query Acknowledgement Ack ◦ Using Acknowledgement (Ack) (Ack is the messages sent by receiver indicating the correction of reception) Timeout ◦ Using Timeout (A specified time period of time allowed to elapse before an acknowledgment is to be received) automaticallyre-transmits ◦ Sender automatically re-transmits the frame/packet until the reception of acknowledgement (or exceeds a predefined number of re-transmissions) Advanced Computer Networks Transmission Errors6

7 Error Detection and Correction Single error V.S. Burst error Errors Errors ◦ Single-bit error  Only one bit  Only one bit in the given data is in error  Easy to correct ◦ Burst error  Two or more (continuous) first corrupted  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 Errors7

8 Error Detection and Correction Single error V.S. Burst error Example: Example: 0.001 ◦ Error rate=0.001 1000 ◦ Frame size=1000 bits 100 ◦ Message length= 100 frame 100 ◦ Burst error length=100 bits ◦ Single bit error  All frames  All frames might be corrupted averagely ◦ Burst error  Only one frame  Only one frame is corrupted averagely Advanced Computer Networks Transmission Errors8

9 Hamming Codes Code Word A legal data word consisting of m data bits and r redundant 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 Smallest The Smallest (minimum possible) distance between every pair of words of a code system. Advanced Computer Networks Transmission Errors9

10 Hamming Codes Error Detection Mechanism ◦ Comparison of received message with code system Matches ◦ 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 Errors10

11 x = codewords o = non-codewords x x x x x x x o o o o o o o o o o o o x x x x x x x o o o o o o o o o o o o poor A code with poor distance properties good A code with good distance properties (a) (b) Hamming Distance 11 a legal code word to an illegal Error detection is possible only if the error changes a legal code word to an illegal

12 Hamming Codes d To detect d single-bit errors, a (d+1) code distance is needed d(d-1) ◦ In a code system with distance d, (d-1)-bits errors can be detected at most. ◦ Example: 00000000 1111 00001111 1111 1111000011111111 Code distance=4 11111 00001111 single bit error 10001111 (illegal) 111111 00001111 two bit errors 11001111 (illegal) 1111111 00001111 three bit errors 11101111 (illegal) 11111111legal 00001111 four bit errors 11111111 (legal) Advanced Computer Networks Transmission Errors12

13 Hamming Codes d(2d+1) To correct d single-bit errors, a (2d+1) code distance is needed. d  (d-1)/2  - ◦ In a code system with distance d,  (d-1)/2  -bits errors can be corrected at most. Example: Example: 0000000000 0000011111 1111100000 1111111111 Code Distance= 5 Detect & Correct Can Detect & Correct 1, 2 errors Detect Not correct Can Detect but Not correct 3,4 errors Can't Detect Can't Detect 5 errors. Advanced Computer Networks Transmission Errors13

14 Error Detection mm+r r If data is m bit and total number of bits is m+r, then to correct single bit errors r is defined as 2 r  m + r + 1 (why?) Example: m =7smallest r 4 For m = 7(ASCII), the smallest r value that can satisfy above equation is 4 2 4  7 + 4 + 1 Advanced Computer Networks Transmission Errors14

15 Hamming Code Advanced Computer Networks Transmission Errors15 Positions of Redundant bits in Hamming Code Example for 7 bits data r 1 = bits [3, 5, 7, 9, 11] r 2 = bits [3, 6, 7, 10, 11] r 4 = bits [5, 6, 7] r 8 = bits [9, 10, 11]

16 Hamming Code Calculation of Redundant Bits Advanced Computer Networks Transmission Errors16

17 Hamming Code Calculation of Redundant Bits Advanced Computer Networks Transmission Errors17

18 Hamming Code Error Detection & Correction Advanced Computer Networks Transmission Errors18 R1R1 R2R2

19 Hamming Code Error Detection & Correction Advanced Computer Networks Transmission Errors19 R3R3 R4R4

20 Hamming Code Error Detection & Correction Advanced Computer Networks Transmission Errors20 R 4 R 3 R 2 R 1 (m+r) The binary number R 4 R 3 R 2 R 1 represents the position of the happened error in sequence (m+r) bit.

21 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 Row Parity bits for each Row Single Parity Check Code Horizontal Parity Check Advanced Computer Networks Transmission Errors21 Even Parity Check for each row XOR Parity bit=XOR of all data bits Odd Detection of all Odd bit errors Even Detection of Even bit errors is impossible Error detection rate=50% 1 0 0 0 0 0 0 0 1 1 0 0 1 0 1 1 1 0

22 1 0 0 0 1 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 Column Check bit for each Column Row check bits for each Row Two-dimensional Parity Check Code Horizontal Vertical Parity Check Advanced Computer Networks Transmission Errors22

23 1 0 0 0 0 0 0 0 1 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 0 0 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 1 1 0 1 0 0 1 1 1 1 0 0 0 0 0 1 0 1 1 0 0 1 0 0 0 1 0 1 0 0 1 1 1 Two errors One error Three errors Four errors Multiple Errors Advanced Computer Networks Transmission Errors23

24 Checksum Advanced Computer Networks Transmission Errors24 Kn Data is divided into K sections (words), each of n bits K All K sections are added (discarding any overflow) Checksum Checksum= Two's complement of the total Receiver adds all the words including the checksum no error If the result is a word full of zeros, there is no error Otherwise, error is detected.

25 Checksum Advanced Computer Networks Transmission Errors25 Example: ABC Data=ABC A=65 (0041), B=66(0042), C=67(0043) Checksum= 65+66+67=198 Or 0041+0042+0043=00C6 003A Checksum= 003A 003A Transmitting data= 0041, 0042, 0043, 003A

26 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 Errors26

27 CRC Codeword n bit codeword Advanced Computer Networks Transmission Errors27 k information bits n-k check bits

28 Polynomial Codes k-1 k-bit A polynomial of degree k-1 can be represented by a k-bit bit string i At each position i Bit 0=Coefficient 0x Bit 1=Coefficient x (i-1) i k-1 i k-2 i 1 i 0 i(x) = i k-1 x k-1 + i k-2 x k-2 + … + i 1 x + i 0 Example: i(x) = x 6 + x 4 + x 3 1 0 1 1 0 0 0 Advanced Computer Networks Transmission Errors28

29 Polynomial Notation check bits) Let the codeword be n bits with k bits information bits and n-k redundant bits (check bits). n-k We need a generator polynomial g(x) of degree n-k of the form g(x) = 1 x n-k + g n-k-1 x n-k-1 + g n-k-2 x n-k-2 +… + g 1 x + 1 first and last Note – the first and last coefficient are always 1. Advanced Computer Networks Transmission Errors29

30 Addition: Multiplication: Division: x 3 + x + 1 ) x 6 + x 5 x 3 + x 2 + x x 6 + x 4 + x 3 x 5 + x 4 + x 3 x 5 + x 3 + x 2 x 4 + x 2 x 4 + x 2 + x x = q(x) quotient = r(x) remainder divisor dividend Polynomial Arithmetic Module 2 Arithemetic Advanced Computer Networks Transmission Errors30

31 CRC Algorithm CRC Steps: 1) Multiply i(x) by x n-k Putting zeros in (n-k) low order positions i(x).x n-k 2) Dividing i(x).x n-k by g(x) i(x).x n-k 3) Adding remainder r(x) to i(x).x n-k i(x). x n-k + r(x) = g(x) q(x) Advanced Computer Networks Transmission Errors31 transmitted codeword b(x) = i(x). x n-k + r(x) quotient remainder i(x). x n-k = g(x) q(x) + r(x)

32 CRC Algorithm / b(x) / g(x)=0 b(x) is dividable by g(x) y(x) Let y(x) denotes the received Data at receiver e(x) Let e(x) denotes the Error mixed with sent data y(x)=b(x)+e(x) y(x)=b(x)+e(x) (message with error) y(x)/g(x)= b(x)/g(x)+e(x)/g(x) y(x)/g(x)= b(x)/g(x)+e(x)/g(x) b(x)/g(x) First term b(x)/g(x) is divisible by definition e(x)/g(x) e(x)/g(x) determines the error. Advanced Computer Networks Transmission Errors32

33 CRC Algorithm In a cyclic code, e(x)/g(x) ≠ 0 ◦ If e(x)/g(x) ≠ 0, one or more bits is corrupted. e(x)/g(x) = 0 ◦ If e(x)/g(x) = 0,  No bit is corrupted generator failed  Some bits are corrupted, but the generator failed to detect them generator polynomial Choosing a generator polynomial by which a larger number of errors are detected is of great importance. Advanced Computer Networks Transmission Errors33

34 CRC Algorithm Generator polynomial Generator polynomial catch all single-bit errors, if It has more than one term Coefficient of x 0 is 1 Example (x+1)Note: x i (x + 1) (x + 1) No polynomial x i is divisible by (x + 1). Therefore, single-bit errors can be caught by the generator having factor (x + 1). ( why? ) Advanced Computer Networks Transmission Errors34

35 CRC Example Information: (1,1,0,0) i(x) = x 3 + x 2 g(x) = x 3 + x + 1 Generator polynomial: g(x) = x 3 + x + 1 Encoding: i(x).x 3 = x 6 + x 5 Advanced Computer Networks Transmission Errors35 1011 1011 ) 1100000 1110 1011 1110 1011 1010 1011 x 3 + x + 1 x 3 + x + 1 ) x 6 + x 5 x 3 + x 2 + x x 6 + x 4 + x 3 x 5 + x 4 + x 3 x 5 + x 3 + x 2 x 4 + x 2 x 4 + x 2 + x x Transmitted codeword: b(x) = i(x).x 3 + r(x)= x 6 + x 5 + x b = ( 1,1,0,0,0,1,0 ) 010

36 Advanced Computer Networks Transmission Errors36 CRC Example Information:1101011011 Generator: 10011 (x 4 +x+1) Transmitted Data:11010110111110

37 e(x) = x i 0  i  n-1 1. Single bit errors: e(x) = x i 0  i  n-1 single-bit i th e(x) = x i b(x) If a single-bit error happens at i th position of the sent message, error e(x) = x i is added to the message b(x) y(x)=b(x)+ x i Received message y(x)=b(x)+ x i b(x) is dividable by g(x) b(x) is dividable by g(x) y(x)/g(x)=e(x)= x i y(x)/g(x)=e(x)= x i X i X i shows the position of the error position Advanced Computer Networks Transmission Errors37 Detecting Errors

38 Advanced Computer Networks Transmission Errors38 Detecting Errors Single–bit error CRC Coding Information=1001 g(x)=1011 r(x)=110 b(x)=1001110

39 Advanced Computer Networks Transmission Errors39 Detecting Errors Single–bit error No Error y(x)=1001110 g(x)=1011 Y(x)/g(x)=0 e(x)=000

40 Advanced Computer Networks Transmission Errors40 Detecting Errors Single–bit error Single error at position 3 0 y(x)=100 0 110 g(x)=1011 y(x)/g(x)=011 e(x)=x 3

41 e(x)= x i +x j 0  i < j  n-1 2. Double bit errors: e(x)= x i +x j 0  i < j  n-1 What kind of generator polynomial is capable of detecting isolated double-bit errors? Why? Advanced Computer Networks Transmission Errors41 Detecting Errors

42 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 examplee(x)=x 5 +x 2 +1 ◦ For example: Error e(x)=x 5 +x 2 +1 (x+1) ◦ A generator that contains a factor of (x+1) can detect all odd-numbered errors ( why? ). Advanced Computer Networks Transmission Errors42 Detecting Errors

43 Burst errors: 4. Burst errors: r Let r be the number of redundant bits l Let l be the length of the burst error m and n m<n If burst error happens between bits m and n, where m<n e(x)=x n +…+x m (n-m+1=l) e(x)=x n +…+x m (n-m+1=l) All burst errors with length ◦ L ≤ r ◦ L ≤ r is always detected ◦ L=r+11–(1/2) r–1 ◦ L=r+1 is detected with probability 1–(1/2) r–1 ◦ L>r+11–(1/2) r ◦ L>r+1 is detected with probability 1–(1/2) r Advanced Computer Networks Transmission Errors43 Detecting Errors

44 Standard Generating Polynomials Advanced Computer Networks Transmission Errors44 A good polynomial generator needs to have the following characteristics: 1. It should have at least two terms. 2. The coefficient of the term x 0 should be 1. x t + 1 3. It should not divide x t + 1 (x + 1) 4. It should have the factor (x + 1).

45 Standard Generating Polynomials Advanced Computer Networks Transmission Errors45 CRC-8: 100000111 CRC-10: 11000110011 CRC-16: 11000000000000101 CRC-CCITT: 10001000000100001 CRC-32: 100000100110000010001110110110111

46 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 Errors46


Download ppt "Transmission Errors Error Detection and Correction."

Similar presentations


Ads by Google