(redundant) bits with data.

Error Detection and
Correction
(Pengesanan dan
Pembetulan ralat)
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 224
DATA COMMUNICATION & NETWORK
2
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 224
DATA COMMUNICATION & NETWORK
3
Figure 10.1 Single-bit error
DKT 224
DATA COMMUNICATION & NETWORK
4
Figure 10.2 Burst error of length 8
DKT 224
DATA COMMUNICATION & NETWORK
5
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 224
DATA COMMUNICATION & NETWORK
6
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 224
DATA COMMUNICATION & NETWORK
7
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 224
DATA COMMUNICATION & NETWORK
8
Figure 10.5 Datawords and codewords in block coding
DKT 224
DATA COMMUNICATION & NETWORK
9
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 224
DATA COMMUNICATION & NETWORK
10
Example:
Data to be sent: 11100100010110 size of checksum = 8 bits
Generate Checksum
1)
10111001
00010110
segment1
segment2
 2) add both segments
segment1
10111001
segment2 00010110
sum
11001111 using binary arithmetic
checksum 00110000 using one’s complement
Attach checksum to original data, therefore the transmitted data will be
1011100100010110 00110000
DKT 224
DATA COMMUNICATION & NETWORK
11
Checksum checking
 1.Received data unit are divided into m segment with 8 bits each
10111001
segment1
00010110
segment2
00110000
segment3
2. add all segments using binary arithmetic
segment1
10111001
segment2 00010110
segment3 00110000
sum
11111111 using binary arithmetic
checksum 00000000 complimentary =0. This shows that received data unit is
free from errors
DKT 224
DATA COMMUNICATION & NETWORK
12
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 224
DATA COMMUNICATION & NETWORK
13
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 11001 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 100100 and using a CRC generator of
1101. With the information given , show the generation process
and checking process of CRC.
DKT 224
DATA COMMUNICATION & NETWORK
14
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 224
DATA COMMUNICATION & NETWORK
15
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 +x5 + 1 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 224
DATA COMMUNICATION & NETWORK
16
Binary Polynomial Division
 Division with Decimal Numbers
34
35 ) 1222
105
divisor
17 2
140
32
quotient
dividend
dividend = quotient x divisor +remainder
1222 = 34 x 35 + 32
remainder
 Polynomial
Division
x3 + x2 + x
= q(x) quotient
x3 + x + 1 ) x6 + x5
x6 +
x4 + x3
dividend
divisor
x5 + x4 + x3
x5 +
x3 + x2
Note: Degree of r(x) is less than
degree of divisor
x4 +
x4 +
DKT 224
DATA COMMUNICATION & NETWORK
x2
x2 + x
x
17
= r(x) remainder
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
q(x)
g(x) ) xn-k i(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
DKT 224
DATA COMMUNICATION & NETWORK
k bits
n-k bits
18
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 + x2 + x
x3 + x + 1 ) x6 + x5
x6 +
1110
1011 ) 1100000
1011
x 4 + x3
x5 + x4 + x3
x5 +
x3 + x 2
x4 +
x4 +
1110
1011
x2
x2 + x
x
Transmitted codeword:
b(x) = x6 + x5 + x
DKT 224
b = (1,1,0,0,0,1,0)
DATA COMMUNICATION & NETWORK
1010
1011
010
19
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 224
DATA COMMUNICATION & NETWORK
20
Standard Generator Polynomials
CRC = cyclic redundancy check
CRC-8:
= x8 + x2 + x + 1
CRC-16:
ATM
Bisync
= x16 + x15 + x2 + 1
= (x + 1)(x15 + x + 1)
CCITT-16:
HDLC, XMODEM, V.41
= x16 + x12 + x5 + 1
CCITT-32:
IEEE 802, DoD, V.42
11 + x10 + x8 + x7 + x5 + x4 + x2 + x + 1
= x32 + x26 + x23 + x22 + x16 + x12 DKT
+ x224
DATA COMMUNICATION & NETWORK
21
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 224
DATA COMMUNICATION & NETWORK
22
Error Correction Process
DKT 224
DATA COMMUNICATION & NETWORK
23
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
DKT 224
DATA COMMUNICATION & NETWORK
24
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 224
DATA COMMUNICATION & NETWORK
25
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 224
DATA COMMUNICATION & NETWORK
26
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 224
DATA COMMUNICATION & NETWORK
27
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 224
DATA COMMUNICATION & NETWORK
28
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 224
DATA COMMUNICATION & NETWORK
29
Error Control (Cont..)
ARQ :
Stop and wait
Go back N
Selective repeat
Forward error correction (FEC)
DKT 224
DATA COMMUNICATION & NETWORK
30
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 224
DATA COMMUNICATION & NETWORK
31
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 224
DATA COMMUNICATION & NETWORK
32
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 224
DATA COMMUNICATION & NETWORK
33
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 :
http://media.pearsoncmg.com/aw/aw_kurose_network_2/applets/go-back-n/go-back-n.html
DKT 224
DATA COMMUNICATION & NETWORK
34
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 GoBack-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 :
http://www.eas.asu.edu/trace/eee459_sp02/applet/archana/gupta5463.html
DKT 224
DATA COMMUNICATION & NETWORK
35