Digital Transmission Fundamentals

Chapter 3. Communication Networks Leon-Garcia, Widjaja

The Questions

● Digital representation ● Why digital transmission ● Digital representation of analog signals ● Characterization of communication channels ● Fundamental limits ● Line coding ● Properties of transmission media ● Error detection-correction

Block vs Stream communication

● Block: – Text, pictures, software – Total time of communication ● Stream: – Internet radio, streaming video, midi – Restrictions on rate of arrival of packets

Block information

L D=t + p R

Reducing delay

● Decrease propagation delay – Increase speed of light ;-) – Optimize routing

● Avoid satellite channels ● Increase transmission rate – The subject of intense research ● Reduce data length – Compression.

Secret to compression

● In text – Some letters or letter pairs are far more common – “ae” is more common than “zq” – We may encode “ae” with 3 bits and “zq” with 16 ● In images, sound, etc – Do not transmit non perceivable information (lossy) – Exploit statistical correlations – Use different encoding

Streaming

● For analog signals, the most important quantity is bandwidth (of the signal) – A measure of how fast the signal changes – The unit is the Hz – It is the frequency of the highest frequency component

Streaming

● Voice (telephony) – 4 kHz is considered enough – We need 8,000 samples per second – This is called Pulse Code ● Music – 20 kHZ is enough, but use 22 kHz – We need 44,000 sample per second

Streaming

● PCM – A stream of 8-bit (or 16 or ...) samples ● Differential PCM – Transmit difference from previous sample. ● Adaptive DPCM – Adapts to variation of voice level ● Linear Predictive Methods – Predict next value and transmit the difference only

Why Digital Comunication

● Many common signals are analog ● Yet almost all communication is digital now ● Reasons – Cheaper – Ability to restore signal after degradation – Advanced routing

Analog vs Digital

● Analog: if we transmit .8 Volt and receive .81 Volt the receiver does not know if it is noise – Noise is impossible (to a great extend) to remove ● Digital: If we transmit 1 Volt and receive .8 Volt we know it is 1 Volt – All the noise enters the system upon digitization. – Can have re-generators at regular intervals – Only if the noise is strong and signal weak we lose information (kind of)

Channel Bandwidth

● Amplitude response function – The amplification (or attenuation) of every frequency component going through the channel ● Bandwidth is the frequency after which the components have much more significant attenuation. – Frequency after which the ARF dips

Channel Bandwidth

A(f)

f

Sawtooth components

Intermediate components

Signal to Noise Ratio

● SNR, one of the most useful quantities ● Ratio of (average) signal power to (average) noise power ● Power and variance of a signal are sometimes indistinguishable for electrical engineers ● Commonly reported in decibell (db) – It is a logarithmic scale

Signal to Noise ratio

2 2 σ n =E {n }

1 P= n2 R

Signal to Noise ratio

P SNR= sig Pnoise

SNR db=10 log10 SNR

Why is SNR Important?

● Imagine we had no noise... ● We could take the entire wikipedia, say 1 TB ● Treat the whole thing as a number ● Transmit it as 0.10111001101.... Volt ● We need zero bandwidth for this!

Noise and Signal

Multilevel Signals

Multilevel Signals

● The noise should be small enough to allow us to distinguish the levels – Increase the power of the signal – Decrease the noise – Lower the (if we transmit every bit for a longer time we can average the noise out)

Example: Telephone lines

● They have 1% noise (amplitude) ● SNR is 10,000:1 ● SNR in db is 10*log 10000 = 10*4 = 40

Channel Capacity

● Depends on: – Bandwidth – SNR ● Studied by Claude E. Shannon, father of communication theory – Information Theory (1948) ● It is a probabilistic theory ● Provides upper limit for the amount of data the receiver can meaningfully determine

Channel Capacity

C=W log2(1+SNR)

Example Telephone lines

● Bandwidth 3.4 kHz ● SNR 10,000 ● Capacity is: – 3400 * log(10000)/log(2) = 3400*4*3.3 = 45,178

Fourier Transform Signals x(t)=∑ αk cos(2 π k f o t+ϕk ) x(t)=∑ αk sin (2π k f ot +ϕ k ) x(t)=∑ αk cos(2 π k f o t)+¿

∑ βk sin(2π k f o t) Signal Bandwidth

● It is the frequency of the highest frequency component... but ● Components of very high frequency with miniscule weight are always present ● A better definition is: – Bandwidth is the frequency range that contains 99% of the power of the signal

Bandwidth: Examples

1 0

1 2 3 4 kHz

1 2 3 4 Sampling

● We can approximate an analog signal with a set of discrete measurements ● Under certain conditions the original analog signal can be reconstructed exactly ● The “Sampling Theorem” provides the preconditions – The bandwidth of the signal can be no more than half the sampling rate

Sampling x(t) x(nT ) xr (t)=∑ xn s(t−nT) xn= x(nT ) n s(t )

Sampling xr =∑ xn s(t−nT) n x 1 x3

s(t )

x 1 x3

Sampling

● We can do linear interpolation with this little triangle ● We can do a smoother interpolation with a “spline” ● The “perfect” interpolation is the sampling function

Sampling Function

sin (2π W t ) s(t )= 2π W t 1 W = T

Sampling Function

● Works perfectly... in theory ● It dies off very slowly (1/t) ● Cannot be implemented in practice ● We use various approximations ● Typically we window it with a Gaussian

Sampling Function

Quantization

● In modern applications samples are digitized ● Digital signals can be transmitted error-free (almost) ● All the error sneaks in during digitization ● Simplest is the uniform quantizer

Quantization Error

en= yn− xn

2 σ x SNR= 2 σ e

Quantization Error

y

−Δ Δ 2 2 x

Quantization Error

2 σ 2=Δ e 12

V Δ= 2m−1

Power of the Signal

● It is related to V – Signal ranges between -V...V ● V is chosen so that the signal is almost always between -V...V ● If we assume that the pdf of the signal is Gaussian – Signal is almost always within 4 standard deviations

Power of the Signal

V =4 σ x

-V V

SNR

V 2 2 σ x 16 SNR = 2 = 2 σ e Δ 12 3 V 2 = 4 Δ2 2(m−1) 3 22 3 2(m−1) = V = 2 4 V 2 4 3 = 4m 16

SNR db

3 SNR db = 10log(4)m + 10log( ) 16

= 6m−7.27

3 = 10 log 4m 16

SNR - Example

● For 8 bit per sample (telephones) ● SNR = 48 – 7.27 = 40.73 db ● Every extra bit adds 6db to the SNR – An extra bit halves the quantization error – So it reduces the power of the quantization error by 4 – The log of 4 is about 6

Non-uniform Quantization

● Depending on the application it might not be optimal to have all intervals same size ● For audio we prefer larger intervals for larger signal magnitude ● This may increase – The SNR for a particular application – The perception of quality by humans

Communication Channels

● We usually assume channels to be – Linear – Time invariant ● Neither is perfectly true but works in practice. ● Summarized as: – The response to the sum of two signals is equal to the sum of the responses. – The response does not change with time. – The response to a sine is a shifted scaled sine

Linear Time Invariant

x1(t )→ y1(t)

x2(t)→ y2(t)

x1(t )+ x2(t)→ y1(t)+ y2(t)

x1 (t +τ)→ y1(t+ τ)

Attenuation

● The ratio of power going in over the power coming out ● If we have attenuation 3db per kilometer – In one kilometer the power if halved – In 15km the power is down about 30,000 times! – Voltage is down about 170 times

Amplitude Response Function & Fourier x(t) = ∑ αk cos(2π k f o t) k y(t ) = ∑ A(k f o )ak cos(2 π k f o t + ϕ (k f o)) k

Delay ϕ(f ) = −2π f τ

cos(2π k f o t−2π f τ) = cos(2 π k f o(t −τ))

Finding the Frequency Response

● We could send one cosine after another through the channel and measure the response ● Or we could send the sum of all the cosines at once – It is linear time invariant after all ● This sum is called impulse or Dirac function or Delta function

Impulse Response Function

● It is the response of the channel to the impulse function ● It is mathematically equivalent to the amplitude and phase responses of the channel – The one can be obtained from the other through a Fourier transform

Example: Low-pass channel A(f )=1 −W ≤f ≤W ϕ(f )=2π f τ h(t)=s(t− τ) sin(2 π W t) s(t ) = 2π W t

The Nyquist Signaling Rate

● Let p(t) be the response to a pulse that appears at the other side of the channel ● What is a good shape for p(t) so that we recover the original signal most easily ● Reduce the inter-symbol interference. ● What is the pulse rate under these conditions?

Nyquist Signaling Rate

The Nyquist Signaling Rate

The Nyquist Signaling Rate

● The peak of a pulse coincides with the zeros of all the other pulses ● This allows us to pack the pulses closely ● Pulse rate is twice the bandwidth ● The sampling function is not implementable ● There are very good approximations

Shannon Channel Capacity

Without noise

Shannon Channel Capacity

With little noise

Shannon Channel Capacity

More bits

Shannon Channel Capacity

Too many bits

Shannon Channel Capacity

C = W log2(1+SNR)

Line Coding

● We want to transmit bits over a channel ● The obvious is to send 5V to transmit 1 and 0V to transmit 0 ● Sounds good, but can we do better ● What are the problems with this? – Bandwidth – Clocking – Polarity

Return to Zero

● A transition 0, 5, 0 Volt is an one ● A constant 0 Volt is a zero ● Self clocking is easy (as long as we do not have too many zeros in a row)

Non-Return to Zero

● Consecutive 1s have no intermediate zero in between ● Fewer transitions than RZ

DC component

● This simplest scheme is called Unipolar NRZ ● Biggest problem: – DC component – Wastes energy – Very low frequencies are tricky

● Most transmission lines cut-off DC component ● May lose clock synchronization

DC Component Power

P=0.5∗02+0.5∗12

P=0.5

DC Component

● A long series of 1s can cause even more problems

Polar NRZ

● A simple solution is to represent – 1: +2.5V – 0: -2.5V ● Same separation ● Half the energy ● DC component much smaller – 0s and 1s are about 50-50

Polar NRZ Power

P=0.5∗(−0.5)2+0.5∗0.52

P=0.5∗0.25+0.5∗0.25

P=0.25

Polar NRZ

● Long sequences of either zeros or ones is still a problem – DC component – Loss of clocking

Bipolar NRZ

● Zero is 0V ● One is either -2.5 or +2.5V (alternates) ● DC component disappears ● Clocking problem for long strings of 0s

NRZ-inverted (differential encoding)

● It is easy to detect polarity on a cable ● How do you detect it in wireless? – Hard ● Map bits to transitions – No transition: zero 1 1 1 0 0 – Transition: one ● Still a problem with long strings of zeros

Manchester Encoding

● Like polar encoding (positive-one, negative zero) ● But: – Transmit 10 for one – Transmit 01 for zero ● There is always a transition in the middle of the pulse ● Clocking easy, little low frequencies ● Wastes bandwidth

Manchester Encoding

● Variant (differential): – Zero: transition at the beginning of pulse – One: no transition at the beginning of pulse ● Variant (mBnB): – Straight Manchester uses two bits to encode one (1B2B) – 4B5B is used in FDDI (Fiber Distributed Digital Interface)

Manchester Encoding

● Variant : – Uses 3 ternary bits (0, 1, 2) to represent 4 binary – The ternary bits are positive, negative and zero voltage – Used in 100Base-T4

Modulation-Demodulation

● Modems ● We have to use them whenever we cannot use the – Telephone lines – Cable – Wireless – Fiber

Amplitude Modulation

● Amplitude Shift Key in digital communication ● Used in fiber mostly or in conjunction with PSK ● The carrier frequency is turned on for 1, off for 0

Frequency Modulation

● Frequency Shift Keying ● We have two carrier frequencies – O: transmit one frequency – 1: transmit the other ● Not used much ● Very similar to PSK

Phase Shift Keying

● Transmit cos(w t) for 0 ● Transmit cos(w t + ph) for 1

Decoding PSK

● To decode a PSK signal we need – A local oscillator at the same frequency (easy) and phase (hard) with the transmitter – A signal multiplier ● We multiply the incoming signal with the cosine produced by the local oscillator

Decoding PSK

A cos(ωc t)×cos(ωc t ) = A (1−cos(2ω t )) 2 c A (1−cos(2ω t ))∗LPF = 2 c A 2

Half the Bandwidth?

● In baseband line coding the pulse rate was 2W for a channel of bandwidth W ● It can be shown that the pulse rate is only W for this scheme ● Somewhere someone is hiding something!

Quadrature Amplitude Modulation

● We can transmit the sum of a sine and a cosine and separate them at the receiver end ● Mathematicians say that a sine and a cosine are orthogonal to each other – Orthogonal means that their dot product is zero – The dot product is the integral of their product over their period (or multiple of it) – We approximate the integral with a LPF

QAM

Y (t ) = A cos(ωc t) + B sin(ωc t )

(Y (t )×cos(ωc t))∗LPF = A B (1+cos(2ω t)) + sin(2ω t) ∗LPF = ( 2 c 2 c ) A 2

QAM

Y (t ) = A cos(ωc t) + B sin(ωc t )

(Y (t )×sin (ωc t ))∗LPF = A B sin (2ω t) + (1−cos(2ω t)) ∗LPF = ( 2 c 2 c ) B 2

QAM Mod-Demod

× A k

cos(ωc t) + Y k

B × LPF k × A k

2cos(ω t) sin(ωc t) Y k c

LPF × Bk

2sin(ωc t) Signal Constellations

B B

A A

QPSK

● Same as QAM but – A and B take values +1 or -1 ● Can encode 2 bits per pulse – Constellation of 4 points ● QAM systems fall back to QPSK in the presence of strong noise

WiFi-n

● Combines WiFi-g with – Broader channel (40MHz vs 20MHz) – MIMO antennas ● Negotiation between transmitter and receiver – Single stream PSK (6.5 Mb/s) – … – 4 stream QAM-64 (5B6B) (600 Mb/s)

MIMO

● Multiple Input Multiple Output ● Several transmitting and receiving antennas ● Spatial beam forming ● E.g. a x b : c – Transmit antennas: a – Receive antennas: b – Spatial streams: c

Properties of Media

● Distortion – Amplitude response function – Phase shift (response) function ● Signal to noise ratio – Signal attenuation – Crosstalk and interference ● Signal delay

Speed of Propagation

● Speed of light – Affected by the dielectric medium, geometry – Modality ● Skew – Multiple paths – Multiple modes – Multiple wires

Wired vs Wireless

● Wired ● Wireless – Point to point – Limited spectrum – Needs right of way – Heavily regulated – Can bundle more – Mobile wires to increase – Polynomial capacity attenuation (for small – Exponential distances) attenuation

Twisted Pair

● The twists help minimize interference ● Many pairs can be bundled together ● Significant attenuation w/ distance – 1-4 db/mile @ 1kHz – 10-20 db/mile @ 500kHz ● Bandwidth depends on distance

Digital Subscriber Lines

● Asymmetric DSL – Uses twisted pairs – Depending on the distance can have from 1.5 to 6 Mbps – Often use Discrete MultiTone to avoid noisy and distorting areas of the spectrum – Subchannels use QAM

Local Area Networks

● Mostly twisted pairs currently – Used coaxial cable 20 years ago ● Cat-3 is Unshielded Twisted Pair ● Cat-5 (5e, 6) is tightly twisted UTP

10BASE-T

● 10 Mb/s baseband twisted pair ● Two cat-3 UTP connect between computer and hub (star configuration) ● Manchester line coding ● Max distance 100 meters

100BASE-T

● Comes in at least two flavours – 100BASE-T4 (defunct)

● 3 pairs of UTP, cat-3, + one more for collision detection ● Each pair carries 33 1/3 Mb ● Uses a 4B3T scheme – 100BASE-TX

● Two cat-5, one per direction ● 125 Mpulses/s ● Uses a 4B5B scheme

Coaxial Cable

● Solid center conductor inside a braided cylindrical outer conductor ● Great immunity against interference and crosstalk (low SNR) ● High bandwidth; good for backbone networks ● Costly to make, install and handle – Fiber (mostly) took over

Cable Modem

● Original cable was for downstream only ● Was modified to carry a narrow band of upstream ● Each TV channel can carry 36Mb/s ● User modem has to listen for packets in a certain channel and compete for time slots on the cable

Old Style Ethernet

● 10Base5 and 10BASE2 ● Aka thick and thin Ethernet ● Baseband, Manchester ● Thick, was too bulky

Optical Fiber

● Thin ultra-transparent glass fiber ● Transparency varies with wavelength ● For some bands (1300 nm, 1550 nm) goes down to about .2 db/km

Transmission Modes

Propagation

● Different modes travel with different speeds ● After a long run the two modes will be out of sync and the signal will be heavily distorted ● Very thin fibers will support only one mode – Unimodal fibers can be used for large distances (5-70 km) ● Unimodal fibers have very little (but non-zero) distortion

Frequency and Bandwidth

c = f λ 3⋅108 f = = 3⋅1014 10−6 c ∂ f = ∂ λ = f ∂ λ λ 2 λ

Higher Frequency-Higher Bandwidth

● Light is EM radiation, just higher frequency (in the order of a million times higher then WiFi) ● What looks like a narrow band can carry many Gb of information ● Main limit to distance is power loss – Intermediate optical amplifiers (now are cheap) – Electronic regeneration (expensive)

Wavelength Division Multiplexing

● Similar to Frequency Division Multiplexing – Like tuning to radio stations ● We do not quote frequencies in optical bands ● Hence “wavelength” ● Lasers of different color carry different signals – “Color” is in the infrared and thus invisible

WDM

● Early systems handled 16 channels, 2.5 Gb/s each ● Coarse WDM have few channels widely separated (cheap) ● Dense WDM have dense packing of channels – 80-160 channels – 10-40 Gb/s – .8-.4 nm separation

Backbone Networks

● High capacity of fiber makes them ideal for backbone networks ● Typically 40-1600 Gb/s with WDM ● Cost for the last mile is prohibitive

LAN on Fiber

● Can easily do 1Gb/s and 10Gb/s ● For shorter distances copper is competitive ● For larger distances (.5-5 km) fiber wins ● Multimode can do up to .5 km ● Two primary standards – 1000BASE-SX shortwave (850nm) – 1000BASE-LX longwave (1300nm)

Radio Transmission

● Spectrum ranges from 3 kHz to 300 GHz ● Wavelength is from 10 km to 1 mm ● Bands are spaced every factor ten – LF, MF, HF, VHF, UHF, SHF, EHF ● Higher frequencies more directional ● Most digital communication is currently 1-5 GHz ● Point-to-point, satellite comm in 2-40 GHz

Infrared

● Does not penetrate walls – Reduce interference ● Huge potential bandwidth – In theory! ● IrDA (Infrared Data Association) – Various standards to connect devices like keyboards, mice and printers to a computer

Error Detection and Correction

● Probability of error in a transmission is never zero ● Using various techniques we can make it arbitrarily small ● Media have error rates from 1.0e-3 to 1.0e-9 ● Tolerance to error also varies hugely

Error Control Techniques

● Two basic approaches – ARQ (Automatic Retransmission reQuest)

● Needs a return channel – Forward Error Correction

● Enough redundancy to recover missed signal ● Both require error detection ● Both trade bandwidth for reliability

Error Detection

● Basic idea simple – Specify a “pattern” – Add enough bits to the signal to satisfy the pattern – Check if it still satisfies the pattern after transmission ● Simplest pattern is a parity bit

Single Parity Check-code

● Takes k information bits and produces one check bit ● Append the check bit to the information bits and form a codeword

● If the check bit is the modulo-2 sum of the information bits we have an even parity scheme

● If the receiver sees odd parity, it means an error occurred.

● We use modulo-2 arithmetic throughout this section

Probability of an Error

● We usually assume that the probability of an error (flipped bit) is small ● Also assume that the probability or error in two bits is independent ● Let p is the probability of an error ● Let n be the number of bits in a packet

Probability of having j Errors

p( j) = n p j (1− p)n− j ( j)

n! n = ( j) j!(n− j)!

Two Dimensional Parity

● The simplest method ● Not the most efficient

0 1 1 0 0

1 0 1 1 1

0 1 0 1 0

0 1 0 0 1

1 1 0 0 0

Internet Checksum

● Most communication systems use some form of checksum ● Minimizes the probability of error going undetected ● Has to be simple to compute, portable ● IP uses 16 bit, 1's complement ● We will play with 4 bits

Checksum: example

● The checksum of two words – 10, 12: 1010, 1100 – 10+12 = 22; 1010+1100 = (1)0110 – 22 mod 15 = 7; 0111 – -7 mod 15 = 8; 1000 ● At the receiving end – 10, 12, 8, 1010, 1100, 1000 – 10+12+8=30; (1)1110 – 30 mod 15 = 0

Polynomial Codes

● Also known as Cyclic Redundancy Check (or Codes) ● We use polynomials with modulo-2 coefficients ● Every bit string is a polynomial – In our mind! – Every bit is a coefficient – A byte is a 7th degree polynomial (not 8!)

Modulo-2 Arithmetic

● 1+1 = 0 ● 1+0=0 ● 0+1=0 ● 1-1 = 0 – Addition and subtraction are the same ● 1*1 = 1 ● 1*0=0 ● 0*1=0 ● 0*0=0

Information Polynomial

k−1 m i( x) = ∑ i m x m=0

k−1 k −2 1 i( x) = i k −1 x +ik −2 x +…+i1 x +i0

Operations on Polynomials

● Add two polynomials – Pairwise add of the corresponding coefficients – Bit-wise XOR ● Subtract – Exactly the same as add! ● Multiply – Use the distributive property – Unsurprisingly, polynomial multiplication is a

● Convolution!

Polynomial Division

● Similar to integer division ● It is not (exactly) a convolution ● We use a longhand-like procedure in our examples

Polynomial Division

q

u

o t i e n

x3+ x2+x t x3+ x+1 x6+ x5 divident x6+ +x 4+x3 5 4 3 divisor x + x +x x5+ +x3+ x2 x 4+ + x2 x 4+ + x2+x

remainder x Generator polynomial

● When we k bits of information embedded in n bit codeword we have n-k check-bits ● We will use an n-k degree generator poly ● We multiply our information polynomial by the n-k power of x (stick n-k zeros at the end) ● Divide by the generator polynomial ● Add the remainder to the shifted information polynomial

Error Polynomial R( x) = b( x)+e(x) R( x) = g(x)q(x)+e( x) ? e( x) = g (x)q' ( x)

Error Polynomial

● The error is detectable iff the error polynomial is not divisible by the generating polynomial ● We examine 3 cases: – One error – Two errors – Burst of errors

Single Error e( x)=xi e( x)=xi ≠g (x)q' ( x)

Iff...

● The generating polynomial has more than one 1 in it ● Easy to guarantee that single errors are detected

Double errors e( x) = xi + x j = xi (1+x j −i ) i< j i x ≠ g( x)qi ( x) j−i (1+x ) ≠ g (x)q j −i

Double errors ● The second condition will hold if the polynomial is primitive – A polynomial of degree N is primitive iff the smallest value of m for which 1 + xm is divisible by the polynomial is m = 2N-1 ● If g(x) is of degree n-k will detect double errors if the codeword length is less than 2n-k -1. ● Often the polynomials used in practice have the form – q(x) = ( 1 + x ) p(x) – Where p(x) is primitive

Burst of Errors e( x) = xi d (x)

i x ≠ g( x)qi ( x)

Burst of Errors

● If the degree of d(x) is less than g(x), g(x) will never divide d(x) ● If the length of the burst is less than the degree of the generating polynomial the error will be detected ● I the error burst is longer it will be detected with probability 1-2k-n.

Shift register for remainder

+ Reg 0 + Reg 1 Reg 2