Presentation is loading. Please wait.

Presentation is loading. Please wait.

Error Detection and Correction (Pengesanan dan Pembetulan ralat)

Similar presentations


Presentation on theme: "Error Detection and Correction (Pengesanan dan Pembetulan ralat)"— Presentation transcript:

1 Error Detection and Correction (Pengesanan dan Pembetulan ralat)

2 DKT 224 DATA COMMUNICATION & NETWORK
Causes of error 1.Distance of data transmission delay,attenuation 2.Enviroment change of temperature,rain,fog 3.Medium of transmission 4.Devices modem,mux,repeater, etc DKT DATA COMMUNICATION & NETWORK

3 DKT 224 DATA COMMUNICATION & NETWORK
Types of Error an error occurs when a bit is altered between transmission and reception single bit errors only one bit altered caused by white noise burst errors contiguous sequence of B bits in which first last and any number of intermediate bits in error caused by impulse noise or by fading in wireless effect greater at higher data rates DKT DATA COMMUNICATION & NETWORK

4 DKT 224 DATA COMMUNICATION & NETWORK
Figure Single-bit error DKT DATA COMMUNICATION & NETWORK

5 DKT 224 DATA COMMUNICATION & NETWORK
Figure Burst error of length 8 DKT DATA COMMUNICATION & NETWORK

6 DKT 224 DATA COMMUNICATION & NETWORK
Errors Detection To detect or correct errors, we need to send extra (redundant) bits with data. Redundant – extra bits added at each transmission data. Errors detection techniques A) Asynchronous - i) Codewords checking - Vertical Redundancy Checking (VRC). ii) Block sum check – Checksum B) Synchronous - i) Longitudinal Redundancy Checking (LRC). ii) Cyclic Redundancy Checking (CRC). DKT DATA COMMUNICATION & NETWORK

7 Vertical Redundancy Checking (VRC).
Extra bits are added to each codeword before transmits. Purpose- to identify nos of bits 1 in codeword is either even or odd. Even or odd parity is depend on the system set up, either in even parity or odd parity checking. DKT DATA COMMUNICATION & NETWORK

8 Vertical Redundancy Checking (VRC) cont..
Even parity checking If nos of bits 1 in codewords is odd, bits level is set at 1. If nos of bits 1 in codewords is even, bits level is set at 0. Odd parity checking If nos of bits 1 in codewords is odd, bits level is set at 0. If nos of bits 1 in codewords is even, bits level is set at 1. Pros & cons Simple mechanism for detecting error in single bit error BUT failed in burst errors. DKT DATA COMMUNICATION & NETWORK

9 DKT 224 DATA COMMUNICATION & NETWORK
Figure Datawords and codewords in block coding DKT DATA COMMUNICATION & NETWORK

10 DKT 224 DATA COMMUNICATION & NETWORK
Block Sum Check When blocks of character are being transmitted, there is an increased probability that a character (the block) will contain a bit error.The probability of a block containing an error is known as block error rate All data are collected and grouped together in block for transmission.(Block coding) Refer to figure 10.5 Datawords are divided into m segments with same size (n bits). Sum-up all segments using binary arithmetics Checksum is using one’s complement of resulted sum. The checksum value is attached to original codeword before transmit. DKT DATA COMMUNICATION & NETWORK

11 DKT 224 DATA COMMUNICATION & NETWORK
Example: Data to be sent: size of checksum = 8 bits Generate Checksum 1) segment segment2 2) add both segments segment segment sum using binary arithmetic checksum using one’s complement Attach checksum to original data, therefore the transmitted data will be DKT DATA COMMUNICATION & NETWORK

12 DKT 224 DATA COMMUNICATION & NETWORK
Checksum checking 1.Received data unit are divided into m segment with 8 bits each segment segment segment3 2. add all segments using binary arithmetic segment segment segment sum using binary arithmetic checksum complimentary =0. This shows that received data unit is free from errors DKT DATA COMMUNICATION & NETWORK

13 DKT 224 DATA COMMUNICATION & NETWORK
Error detection: Synchronisation Transmission - Cylic Redundancy Check (CRC) Cylic Redundancy Check (CRC)- very efficient and widely use in data communication. The division operation is equivalent to performing the Exclusive-OR operation bit by bit in parallel as each bit in the frame is processed. Data block to be sent will be divided by CRC generator/divisor CRC process 1. To obtain the CRC code, additional n bits 0 are added to data block, where n<1bit from generator bits. M(x) =frame contents,i.e data block + additional bits. 2. M(x)/G(x), where G(x)= CRC generator, the Remainder (R(x)) is then the frame check sequence (FCS) which is appended at the tail of the information digits. 3. The resultant CRC bits will replace all additional bits 0 in step1.If the quotient bits < n bits, add bits 0 on the most left bit until n bits. This data unit will be sent to receiver. 4. Similarly, on receipt,the received bits stream including the FCS digits is again divided by the same generator polynomial. if R(x)=0,therefore no errors are present or some bits are corrupted, but the encoder failed to detect them. if R(x) = 0,therefore an error is present. DKT DATA COMMUNICATION & NETWORK

14 DKT 224 DATA COMMUNICATION & NETWORK
EXAMPLES 1. A series of 8 bit message blocks (frames) is to be transmitted across a data link using a CRC for error detection. A generation polynomial of is to be used. Use an example to illustrate the following : (a) The FCS generation process (b) The FCS checking process 2. Data to be transmitted is and using a CRC generator of 1101. With the information given , show the generation process and checking process of CRC. DKT DATA COMMUNICATION & NETWORK

15 DKT 224 DATA COMMUNICATION & NETWORK
Polynomial Codes Polynomial arithmetic instead of check sums Implemented using shift-register circuits Also called cyclic redundancy check (CRC) codes Most data communications standards use polynomial codes for error detection Polynomial codes also Polynomials instead of vectors for codewords basis for powerful error-correction methods DKT DATA COMMUNICATION & NETWORK

16 Binary Polynomial Arithmetic
Binary vectors map to polynomials (ik-1 , ik-2 ,…, i2 , i1 , i0)  ik-1xk-1 + ik-2xk-2 + … + i2x2 + i1x + i0 Addition: (x7 + x6 + 1) + (x6 + x5) = x7 + x6 + x6 + x5 + 1 = x7 +(1+1)x6 + x5 + 1 = x7 +x since 1+1=0 mod2 Multiplication: (x + 1) (x2 + x + 1) = x(x2 + x + 1) + 1(x2 + x + 1) = x3 + x2 + x) + (x2 + x + 1) = x3 + 1 DKT DATA COMMUNICATION & NETWORK

17 Binary Polynomial Division
Division with Decimal Numbers 35 ) 1222 3 105 17 2 4 140 divisor quotient remainder dividend 1222 = 34 x dividend = quotient x divisor +remainder 32 x3 + x + 1 ) x6 + x5 x x4 + x3 x5 + x4 + x3 x x3 + x2 x x2 x x2 + x x = q(x) quotient = r(x) remainder divisor dividend + x + x2 x3 Polynomial Division Note: Degree of r(x) is less than degree of divisor DKT DATA COMMUNICATION & NETWORK

18 Polynomial Coding Code has binary generating polynomial of degree n–k
g(x) = xn-k + gn-k-1xn-k-1 + … + g2x2 + g1x + 1 k information bits define polynomial of degree k – 1 i(x) = ik-1xk-1 + ik-2xk-2 + … + i2x2 + i1x + i0 Find remainder polynomial of at most degree n – k – 1 g(x) ) xn-k i(x) q(x) r(x) xn-ki(x) = q(x)g(x) + r(x) Define the codeword polynomial of degree n – 1 b(x) = xn-ki(x) + r(x) n bits k bits n-k bits DKT DATA COMMUNICATION & NETWORK

19 Polynomial example: k = 4, n–k = 3
Generator polynomial: g(x)= x3 + x + 1 Information: (1,1,0,0) i(x) = x3 + x2 Encoding: x3i(x) = x6 + x5 x3 + x + 1 ) x6 + x5 x3 + x2 + x x x4 + x3 x5 + x4 + x3 x x3 + x2 x x2 x x2 + x x 1011 ) 1110 1011 1010 010 Transmitted codeword: b(x) = x6 + x5 + x b = (1,1,0,0,0,1,0) DKT DATA COMMUNICATION & NETWORK

20 The Pattern in Polynomial Coding
All codewords satisfy the following pattern: b(x) = xn-ki(x) + r(x) = q(x)g(x) + r(x) + r(x) = q(x)g(x) All codewords are a multiple of g(x)! Receiver should divide received n-tuple by g(x) and check if remainder is zero If remainder is nonzero, then received n-tuple is not a codeword DKT DATA COMMUNICATION & NETWORK

21 Standard Generator Polynomials
CRC = cyclic redundancy check CRC-8: CRC-16: CCITT-16: CCITT-32: = x8 + x2 + x + 1 ATM Bisync = x16 + x15 + x2 + 1 = (x + 1)(x15 + x + 1) HDLC, XMODEM, V.41 = x16 + x12 + x5 + 1 IEEE 802, DoD, V.42 = x32 + x26 + x23 + x22 + x16 + x12 + x11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1 DKT DATA COMMUNICATION & NETWORK

22 DKT 224 DATA COMMUNICATION & NETWORK
Error Correction There are two main methods of error correction: i) Correction by retransmission. ii) Forward Error Correction. - Error can be detected and correct it at the receiver (the receiver must be intelligent). DKT DATA COMMUNICATION & NETWORK

23 Error Correction Process
Figure 6.7 shows in general how this is done. On the transmission end, each k-bit block of data is mapped into an n-bit block (n > k) called a codeword, using an FEC (forward error correction) encoder. The codeword is then transmitted. During transmission, the signal is subject to impairments, which may produce bit errors in the signal. At the receiver, the incoming signal is demodulated to produce a bit string that is similar to the original codeword but may contain errors. This block is passed through an FEC decoder, with one of four possible outcomes: 1. If there are no bit errors, the input to the FEC decoder is identical to the original codeword, and the decoder produces the original data block as output. 2. For certain error patterns, it is possible for the decoder to detect and correct those errors, the FEC decoder is able to map this block into the original data block. 3. For certain error patterns, the decoder can detect but not correct the errors, the decoder simply reports an uncorrectable error. For certain, typically rare, error patterns, the decoder does not detect that any errors have occurred and maps the incoming data block into a block different from the original. DKT DATA COMMUNICATION & NETWORK

24 How Error Correction Works
adds redundancy to transmitted message can deduce original despite some errors eg. block error correction code map k bit input onto an n bit codeword each distinctly different if get error assume codeword sent was closest to that received means have reduced effective data rate In essence, error correction works by adding redundancy to the transmitted message. The redundancy makes it possible for the receiver to deduce what the original message was, even in the face of a certain level of error rate. In this section we look at a widely used form of error-correcting code known as a block error-correcting code. If wish to transmit blocks of data of length k bits, so map each k-bit sequence into a unique n-bit codeword, which differ significantly from each other. Typically, each valid codeword reproduces the original k data bits and adds to them (n – k) check bits to form the n-bit codeword. Then if an invalid codeword is received, assume the valid codeword is the one that is closest to it, and use the input bit sequence associated with it. The ratio of redundant bits to data bits, (n – k)/k, is called the redundancy of the code, and the ratio of data bits to total bits, k/n, is called the code rate. The code rate is a measure of how much additional bandwidth is required to carry data at the same data rate as without the code. For example, a code rate of 1/2 requires double the transmission capacity of an uncoded system to maintain the same data rate. DKT DATA COMMUNICATION & NETWORK

25 DKT 224 DATA COMMUNICATION & NETWORK
Block Code Principles The Hamming distance between two words is the number of differences between corresponding bits. The minimum Hamming distance is the smallest Hamming distance between all possible pairs in a set of words. DKT DATA COMMUNICATION & NETWORK

26 DKT 224 DATA COMMUNICATION & NETWORK
Example Let us find the Hamming distance between two pairs of words. 1. The Hamming distance d(000, 011) is 2 because 2. The Hamming distance d(10101, 11110) is 3 because DKT DATA COMMUNICATION & NETWORK

27 DKT 224 DATA COMMUNICATION & NETWORK
Example Find the minimum Hamming distance of the coding scheme in Table 10.1. Solution We first find all Hamming distances. The dmin in this case is 2. DKT DATA COMMUNICATION & NETWORK

28 To guarantee the detection of up to s errors in all cases, the minimum
Note To guarantee the detection of up to s errors in all cases, the minimum Hamming distance in a block code must be dmin = s + 1. DKT DATA COMMUNICATION & NETWORK

29 DKT 224 DATA COMMUNICATION & NETWORK
Error Control Digital transmission systems introduce errors Applications require certain reliability level Data applications require error-free transfer Voice & video applications tolerate some errors Error control used when transmission system does not meet application requirement Error control ensures a data stream is transmitted to a certain level of accuracy despite errors Two basic approaches: Error detection & retransmission (ARQ) Forward error correction (FEC) DKT DATA COMMUNICATION & NETWORK

30 DKT 224 DATA COMMUNICATION & NETWORK
Error Control (Cont..) ARQ : Stop and wait Go back N Selective repeat Forward error correction (FEC) DKT DATA COMMUNICATION & NETWORK

31 DKT 224 DATA COMMUNICATION & NETWORK
Stop and wait ARQ One frame at time. After sending, sender waits for ACK signal and doesn't send any further frames until it is received. If the received frame is damaged or lost, the receiver discards it and does not send an ACK. If a certain time, known as the timeout, passes without ACK, the sender sends the frame again. Problem 1 - is where the ACK sent by the receiver is damaged or lost. In this case, the sender doesn't receive the ACK, times out, and sends the frame again. Now the receiver has two copies of the same frame, and doesn't know if the second one is a duplicate frame or the next frame of the sequence carrying identical data. DKT DATA COMMUNICATION & NETWORK

32 Stop and wait ARQ (cont..)
Problem 2 - is when the sender's timeout runs out before the frame reaches the receiver. In this case the sender resends the same packet. Eventually the receiver gets two copies of the same frame, and sends an ACK for each one. The sender, waiting for a single ACK, receives two ACKs, which may cause problems if it assumes that the second ACK is for the next frame in the sequence. DKT DATA COMMUNICATION & NETWORK

33 Stop and wait ARQ (cont..)
To avoid these problems, the most common solution is to define a 1 bit sequence number which is attached to the header of the frame. This sequence number alternates (from 0 to 1) in subsequent frames. When the receiver sends an ACK, it attaches the sequence number of the next packet it expects. This way, the receiver can detect duplicated frames by checking if the frame sequence numbers alternate. If two subsequent frames have the same sequence number, they are duplicates, and the second frame is discarded. Similarly, if two subsequent ACKs have the same sequence number, they are acknowledging the same frame. DKT DATA COMMUNICATION & NETWORK

34 DKT 224 DATA COMMUNICATION & NETWORK
Go back N ARQ Protocol, in which the sending process continues to send a number of frames specified by a window size without receiving an ACK packet from the receiver. The receiver process keeps track of the sequence number of the next frame it expects to receive, and sends that number with every ACK it sends. If a frame from the sender does not reach the receiver, the receiver will stop acknowledging received frames. Once the sender has sent all of the frames in its window, it will detect that all of the frames since the first lost frame are outstanding, and will go back to sequence number of the last ACK it received from the receiver process and fill its window starting with that frame and continue the process over again. Demo : DKT DATA COMMUNICATION & NETWORK

35 DKT 224 DATA COMMUNICATION & NETWORK
Selective Repeat ARQ Protocol, in which the sending process continues to send a number of frames specified by a window size even after a frame loss. Unlike Go-Back-N ARQ, the receiving process will continue to accept and acknowledge frames sent after an initial error. The receiver process keeps track of the sequence number of the earliest frame it has not received, and sends that number with every ACK it sends. If a frame from the sender does not reach the receiver, the sender continues to send subsequent frames until it has emptied its window. The receiver continues to fill its receiving window with the subsequent frames, replying each time with an ACK containing the sequence number of the earliest missing frame. Once the sender has sent all the frames in its window, it re-sends the frame number given by the ACKs, and then continues where it left off. Demo : DKT DATA COMMUNICATION & NETWORK


Download ppt "Error Detection and Correction (Pengesanan dan Pembetulan ralat)"

Similar presentations


Ads by Google