Computer Networks Chapter 2: Physical layer Holger Karl Computer Networks Group Universität Paderborn
Goals of this chapter Answer the basic question: how can data be transported over a physical medium? Understand the basic service provided by a physical layer Different ways to put bits on the wire Reasons why performance of any physical layer is limited Reasons for errors A few examples of important physical layers Note: This is vastly simplified material WS 09/10, v 1.3 Computer Networks - Physical layer 2
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 3
Basic service of physical layer: transport bits Physical layer should enable the transport of bits between two locations A and B Abstraction: Bit sequence correct, in order delivery Bits Bits SAP of Layer 1 Layer 1 Bit voltage conversion SAP of Layer 1 Layer 1 voltage Bit conversion Layer 0 Physical connection Pair of copper wires WS 09/10, v 1.3 Computer Networks - Physical layer 4
A bit signal conversion rule A simple conversion rule For a 1 bit, apply voltage to the pair of wires For a 0 bit, no voltage This is called Non return to zero NRZ Layer 1 Bit voltage conversion Bit=1: Close switch Bit=0: Open switch Layer 1 voltage Bit conversion If voltage: Indicate a 1 bit If no voltage: Indicate a 0 bit Layer 0 Physical connection WS 09/10, v 1.3 Computer Networks - Physical layer 5
Example: Transmit bit pattern for character b Character b needs a representation as a sequence of bits One option: Use the ASCII code of b, 98, as a binary number 01100010 Resulting voltage put on the wire: Note: Abstract data is represented by physical signals changes of a physical quantity in time or space! Voltage WS 09/10, v 1.3 Computer Networks - Physical layer 6
What arrives at the receiver? Typical pattern at the receiver: 1.2 1 0.8 Voltage Current 0.6 0.4 0.2 0 What is going on here? -0.2 0 1 2 3 4 5 6 7 8 Time Note: this and the following examples are exaggerated! WS 09/10, v 1.3 Computer Networks - Physical layer 7
Some background: Fourier analysis To understand signal propagation on a physical medium, some background is required how such signals can be analyzed/treated mathematically First: Fourier s theorem Any periodic function g(t) (with period T) can be written as a (possibly infinite) sum of sine and cosine functions; the frequencies of these functions are integer multiples of the fundamental frequency f = 1/T. Constants c, a n, b n are to be determined. WS 09/10, v 1.3 Computer Networks - Physical layer 8
Fourier analysis computing coefficients Coefficients c, a n, b n in the Fourier series can be computed: Because of orthogonality of sines and cosines as basis functions The nth summary terms are called harmonics The sum of the squares of the nth coefficients a n2 + b n2 is proportional to the energy contained in this harmonic Why squares? Say, g(t) shows voltage Power P = U I = U (U/R) energy E P T U 2 T WS 09/10, v 1.3 Computer Networks - Physical layer 9
Applying Fourier analysis to example The transmitted waveform of b is not a periodic signal Fourier not applicable directly Voltage Use a trick: Suppose waveform is repeated infinitely often, resulting in a periodic waveform with period 8 bit times Voltage Current 1 0.8 0.6 0.4 Repeated waveform for bit pattern 'b' 0.2 0 0 5 10 15 20 25 WS 09/10, v 1.3 Computer Networks - Physical layer 10 Time
Applying Fourier analysis to example Result of computing a n, b n, c and using first 512 Fourier terms to represent the signal: Almost no discernible difference between original signal and Fourier series Curves overlap Voltage Current 1.2 1 0.8 0.6 0.4 0.2 0-0.2 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 11
Fact 1: Signals are attenuated in a physical medium Attenuation α: Ratio of transmitted to received power High attenuation low power arrives at receiver Attenuation depends on Actual medium Distance between sender and receiver other factors Normalized, typically given in db Current Voltage 1 0.8 0.6 0.4 0.2 Received attenuated signal 0 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 12
Fact 2: Not all frequencies pass through a medium Previous picture assumed that all frequencies travel unhindered through a physical medium This is not the case for real media! Simplified behavior: frequencies up to given upper bound f c can pass; higher frequencies are suppressed Mathematically: the Fourier series is cut off at a certain harmonic High frequencies are attenuated to zero Intuition: Range of frequencies that can pass through a medium is relevant Bandwidth of a physical medium (or channel) to be defined later Bandwidth-limited medium WS 09/10, v 1.3 Computer Networks - Physical layer 13
Bandwidth-limited medium example Result when fewer and fewer harmonics are transported 1.2 Fourier series with 128 harmonics 1.2 Fourier series with 32 harmonics 1.2 Fourier series with 8 harmonics 1 1 1 0.8 0.8 0.8 Voltage Current 0.6 0.4 Voltage Current 0.6 0.4 Voltage Current 0.6 0.4 0.2 0.2 0.2 0 0 0-0.2 0 1 2 3 4 5 6 7 8 Time -0.2 0 1 2 3 4 5 6 7 8 Time -0.2 0 1 2 3 4 5 6 7 8 Time 1.2 Fourier series with 4 harmonics 1.2 Fourier series with 2 harmonics Fourier series with 1 harmonic Voltage Current 1 0.8 0.6 0.4 0.2 0-0.2-0.4 0 1 2 3 4 5 6 7 8 Time Voltage Current 1 0.8 0.6 0.4 0.2 0-0.2-0.4 0 1 2 3 4 5 6 7 8 Time Voltage Current 1 0.8 0.6 0.4 0.2 0 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 14
Fact 3: Frequency-selective attenuation, bandwidth Strictly speaking: channel bandwidth is caused by frequency-selective attenuation Often: both small and large frequencies are attenuated Assuming a cut-off frequency f c is too simple-minded Necessary: Standard on what is acceptable as attenuation Arbitrary (more or less) choice: Attenuation 2 (3dB) is acceptable Corresponds to half the energy! Attenuation 2 1 f 1 f 2 Defines lower/upper frequencies f 1, f 2 where power attenuation = 2 Bandwidth Channel bandwidth := f 2 f 1 Bandwidth-limited channel WS 09/10, v 1.3 Computer Networks - Physical layer 15
Example with frequency-dependent attenuation Suppose attenuation is 2, 2.5, 3.333, 5, 10, for the 1 st, 2 nd, harmonic 1 Received signal with frequency-dependent attenuation We have to explain this behavior: 0.8 1.2 1 Current Voltage 0.6 0.4 Voltage Current 0.8 0.6 0.4 0.2 0.2 0 0-0.2 0 1 2 3 4 5 6 7 8 Time -0.2 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 16
Fact 4: Media not only attenuates, but also distorts Different frequencies have different propagation speed Some wave lengths travel faster than others Speed of electromagnetic waves only constant in vacuum! Apparent result: Waves arrive at receiver out of phase Recall: a sine wave is determined by amplitude a, frequency f, and phase φ Amount of phase shift in the medium depends on frequency This effect may lead to distortion of a signal s amplitude WS 09/10, v 1.3 Computer Networks - Physical layer 17
Example with frequency-dependent attenuation and distortion 1.2 1 0.8 Received signal with frequency-dependent attenuation and phase change We have to explain this behavior: 1.2 1 0.8 Current Voltage 0.6 0.4 0.2 0 Voltage Current 0.6 0.4 0.2 0-0.2 0 1 2 3 4 5 6 7 8 Time -0.2 0 1 2 3 4 5 6 7 8 Time Behavior of real medium already well matched! What about the wriggling? WS 09/10, v 1.3 Computer Networks - Physical layer 18
Fact 5: Real media are noisy A physical medium, in combination with the receiver, exhibits random (thermal) noise Fluctuations of electrons in the receiver circuitry (Side remark: Do NOT confuse with interference!) Materializes as random fluctuations around the (noise-free) received signal Typical model: noise as a Gaussian random variable of zero mean, uncorrelated in time More sophisticated models exist WS 09/10, v 1.3 Computer Networks - Physical layer 19
Example with frequency-dependent attenuation and distortion, random noise When taking all five facts into account, the received wave form can be satisfyingly explained: 1.2 1 0.8 Voltage Current 0.6 0.4 0.2 0-0.2 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 20
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 21
Converting signals to data: Sampling Suppose we have a channel with sufficient bandwidth available, free of noise, no distortion How does a receiver convert the signal back to data? 1.2 Simple: Look at the signal If high, bit is a 1 If low, bit is a 0 1 0.8 Is it so simple? WHEN is the middle of a bit? HOW does receiver know? Current Voltage 0.6 0.4 0.2 0-0.2 0 1 2 3 4 5 6 7 8 Time 0 1 1 0 0 0 1 0 WS 09/10, v 1.3 Computer Networks - Physical layer 22
Sampling over a noisy or bandwidth-limited channel In presence of noise or limited bandwidth (or both), signal will not likely be exactly 0 or 1 Or whatever 0 and 1 amounts to after attenuation Instead of comparing to these precise values, receiver has to use some thresholds within which a signal is declared as a 0 or a 1 Voltage 1.2 1 0.8 0.6 0.4 0.2 0 Fourier series with 8 harmonics -0.2 0 1 2 3 4 5 6 7 8 Time 0 1 1 0 0 0 1 0 WS 09/10, v 1.3 Computer Networks - Physical layer 23
Sampling & low bandwidth What happens when little bandwidth is available? Assuming same thresholds as before At some sampling points, the signal will be outside the thresholds! No justifiable decision possible What are possible ways out? Voltage 1.2 1 0.8 0.6 0.4 0.2 0-0.2 Fourier series with 2 harmonics -0.4 0 1 2 3 4 5 6 7 8 Time 0? 1 0??? 0 WS 09/10, v 1.3 Computer Networks - Physical layer 24
Possible way out: Make thresholds wider? Wide thresholds would (apparently) reduce opportunity for confusion E.g., +/- 0.4 But: what happens in presence of noise? Wider thresholds lead to higher probability of incorrect decisions! Not good! Voltage 1.2 1 0.8 0.6 0.4 0.2 0-0.2 Fourier series with 2 harmonics -0.4 0 1 2 3 4 5 6 7 8 Time WS 09/10, v 1.3 Computer Networks - Physical layer 25
Way out 2: Increase time for a single bit If bandwidth is limited, received signal cannot track very steep raises and falls in the signal Hence: give the signal more time to reach the required level for a 0 or a 1 detection. This means: Time for a single bit has to be extended! Useable data rate is reduced! This is a fundamental limitation and cannot be circumvented Formally: maximum data rate 2H bits/s where H is the channel bandwidth Basic reason: need to sample sufficiently often WS 09/10, v 1.3 Computer Networks - Physical layer 26
Way out 3: Use more than just 0 and 1 in the channel Who says we can only use 0 and 1 as possible levels for the transmitted signal? Suppose the transmitter can generate signals (current, voltage, ) at four different levels, instead of just two Then: to determine one of four levels, two bits are required Distinction: Bits are 0 or 1, used in higher layers Symbols can have 2 or more values, are transmitted over the channel If >2 symbol values, symbols group bits together for transmission Symbol rate: Rate at which symbols are transmitted Measured in baud Data rate: Rate at which physical layer sends incoming data bits Measured in bit/s WS 09/10, v 1.3 Computer Networks - Physical layer 27
Way out 3: Use four-level symbols to encode two bits Example: Map 00 0, 01 1, 10 2, 11 3 Symbol rate is then only half the data rate as each symbol encodes two bits Symbol value 3 2.5 2 1.5 1 0.5 0 1 1 0 0 0 1 0 0 0 1 2 3 4 Time WS 09/10, v 1.3 Computer Networks - Physical layer 28
Data rate with multi-valued symbols Nyquist Using symbols with multiple values, the data rate can be increased Nyquist formula summarizes: maximum data rate 2H log 2 V bits/s where V is the number of discrete symbol values WS 09/10, v 1.3 Computer Networks - Physical layer 29
Unlimited data rate with many symbol levels? Nyquist s theorem appears to indicate that unlimited data rate can be achieved when only enough symbol levels are used Is this plausible? More and more symbol levels have to be spaced closer and closer together What then about noise? Even small random noise would then result in one symbol being misinterpreted for another So, not unlimited? WS 09/10, v 1.3 Computer Networks - Physical layer 30
Shannon limit on achievable data rate Achievable data rate is fundamentally limited by noise More precisely: by the relationship of signal strength S compared to noise N The relatively fewer noise there is at the receiver, the easier it is for the receiver to distinguish between different symbol levels Relationship characterized by Shannon, 1948 maximum data rate H log 2 (1 + S/N) bits/s where S is signal strength, N is noise level Measured in metric units, not db This theorem formed the basis for information theory WS 09/10, v 1.3 Computer Networks - Physical layer 31
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 32
When to sample the received signal? How does the receiver know WHEN to check the received signal for its value? One typical convention: in the middle of each symbol But when does a symbol start? The length of a symbol is usually known by convention via the symbol rate The receiver has to be synchronized with the sender at the symbol level ( Symbol if more than one bit per symbol; if only one bit per symbol, then bit synchronization is the usual term) The link layer will have to deal with frame synchronization There is also character synchronization omitted here WS 09/10, v 1.3 Computer Networks - Physical layer 33
Overly simplistic bit synchronization One simple option: Assume that sender and receiver at some point in time are synchronized That both have an internal clock that tics at every symbol step Usually, this does not work Clock drift is major problem two different clocks never stay in perfect synchrony Errors if synchronization is lost: Sender: Receiver with a slightly fast clock: Channel 1 0 1 1 0 1 0 0 1 1 0 1 1 0 1 1 0 0 WS 09/10, v 1.3 Computer Networks - Physical layer 34
Options to tell the receiver when to sample Relying on permanently synchronized clocks does not work Provide an explicit clock signal Needs parallel transmission over some additional channel Must be in synch with the actual data, otherwise pointless Useful only for short-range communication Synchronize the receiver at crucial points (e.g., start of a character or of a block) Otherwise, let the receiver clock run freely Relies on short-term stability of clock generators (do not diverge too quickly) Often reasonable Extract clock information from the received signal itself Treated next in more detail WS 09/10, v 1.3 Computer Networks - Physical layer 35
Extract clock information from signal itself Put enough information into the data signal itself so that the receiver can know immediately when a bit starts/stops Would the simple 0 low, 1 high mapping of bit symbol work? It should after all, receiver can use 0-1-0 transitions to detect the length of a bit Daten: 1 0 1 1 0 0 0 1 1 0 1 NRZ-L But it fails depending on bit sequences: think of long runs of 1s or 0s receiver can loose synchronization Not nice not to be able to transmit arbitrary data WS 09/10, v 1.3 Computer Networks - Physical layer 36
Extract clock information from signal itself Manchester Idea: At each bit, provide indication to receiver that this is where a bit {starts/stops/has its middle} Example: Manchester encoding For a 0 bit, have the signal change in the middle of a symbol (=bit) from low to high For a 1 bit, have the signal change in the middle of a symbol (=bit) from high to low Daten: 1 0 1 1 0 0 0 1 1 0 1 Manchester Ensures sufficient number of signal transitions Independent of what data is transmitted! WS 09/10, v 1.3 Computer Networks - Physical layer 37
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 38
Baseband versus broadband transmission The transmission schemes described so far: Baseband transmission Baseband transmission directly puts the digital symbol sequences onto the wire At different levels of current, voltage, Baseband transmission suffers from the problems discussed above Direct current components have to be avoided Limited bandwidth reshapes the signal at receiver Attenuation and distortion depend on frequency and baseband transmissions have many different frequencies because of their wide Fourier spectrum Possible alternative: broadband transmission More correct name: bandpass transmission Examples: Wireless communication, DSL, WS 09/10, v 1.3 Computer Networks - Physical layer 39
Broadband transmission Idea: get rid of the wide spectrum needed for DC transmission Use a sine wave as a carrier for the symbols to be transmitted Typically, the sine wave has high frequency But only a single frequency! Pure sine wave has no information, so its shape has to be influenced according to the symbols to be transmitted The carrier has to be modulated by the symbols (widening the spectrum) Three parameters that can be influenced Amplitude a Frequency f Phase φ WS 09/10, v 1.3 Computer Networks - Physical layer 40
Amplitude modulation Given a sine wave f(t) and a time-varying signal s(t) Signal can be analog (i.e., a continuous function of time) or digital (i.e., a discrete function of time) Signal can be e.g. the symbol levels discussed above The amplitude modulated sine wave f A (t) is given as: I.e., the amplitude is given by the signal to be transmitted Receiver can extract s(t) from f A (t) Special cases: s(t) is an analog signal amplitude modulation s(t) is a digital signal also called amplitude keying s(t) only takes 0 and 1 (or 0 and a) as values on/off keying WS 09/10, v 1.3 Computer Networks - Physical layer 41
Amplitude modulation example Binary data On/off modulated carrier Question: How to solve bit synchronization here? Is Manchester applicable? WS 09/10, v 1.3 Computer Networks - Physical layer 42
Frequency modulation The frequency-modulated sine wave f F (t) is given by Modulation/keying terminology like for AM Example Binary data Frequencymodulated carrier Note: s(t) has an additive constant in this example to avoid having frequency zero WS 09/10, v 1.3 Computer Networks - Physical layer 43
Phase modulation Similarly, a phase modulated carrier is given by Modulation/keying terminology again similar Example: Binary data Phasemodulated carrier s(t) is chosen such that there are phase changes when the binary data changes Typical example for differential coding WS 09/10, v 1.3 Computer Networks - Physical layer 44
Phase modulation with high multiple values per symbol A receiver can usually distinguish phase shifts quite well Hence: Use phase shifts of 0, π/2, π, 3/2 π to encode two bits per symbol Clock Extraction? Use π/4, 3/4π, 5/4π, 7/4π phase shifts for each symbol Result: Data rate is twice the symbol rate Technique is called Quadrature Phase Shift Keying (QPSK) Visualization as constellation diagram Angle: Phase of signal Distance from origin: Amplitude of the signal WS 09/10, v 1.3 Computer Networks - Physical layer 45
Combinations of different modulations Amplitude, frequency, and phase modulations can be fruitfully combined Example: 16-QAM (Quadrature Amplitude Modulation) Use 16 different combinations of phase change and amplitude for each symbol Per symbol, 2 4 = 16 states; 4 bits are encoded and transmitted in one step Constellation diagram: Distance from origin: Amplitude of signal WS 09/10, v 1.3 Computer Networks - Physical layer 46
Bit error rate as function of SNR The higher the SNR, the better the reception The more reliably can signals be converted to bits at receiver Actually: Energy per bit E b takes into account data rate, #bits/symbol Concrete bit error probability/rate (BER) depends on SNR and used modulation Example: differential phase shift keying (DPSK), data rate corresponds to bandwidth Note: SNR measured in metric units, not db WS 09/10, v 1.3 Computer Networks - Physical layer 47
Examples for SNR BER mappings 1 0.1 Coherently Detected BPSK Coherently Detected BFSK 0.01 BER 0.001 0.0001 1e-05 1e-06 1e-07 Which one is better? Why do they tend to 0.5 and not 1.0? -10-5 0 5 10 15 SNR(dB) WS 09/10, v 1.3 Computer Networks - Physical layer 48
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 49
Digital vs. analogs signals A sender has two principal options what types of signals to generate 1. It can choose from a finite set of different signals digital transmission 2. There is an infinite set of possible signals analog transmission Simplest example: Signal corresponds to current/voltage level on the wire In the digital case, there are finitely many voltage levels to choose from In the analog case, any voltage is legal More complicated example: finite/infinitely many sinus functions In both cases, the resulting wave forms in the medium can well be continuous functions of time! Advantage of digital signals: There is a principal chance that the receiver can precisely reconstruct the transmitted signal WS 09/10, v 1.3 Computer Networks - Physical layer 50
Structure of digital communication systems How to put these functions together into a working digital communication system? How to structure transmitter and receiver? How to bridge from a data source to a data sink? Essential functions for baseband transmission Data source Format Source encode Channel encode Physical transmit Source bits Channel symbols Physical medium Format Source decode Channel decode Physical receive Data sink WS 09/10, v 1.3 Computer Networks - Physical layer 51
Functions Format: Bring source information in digital form E.g., sample and quantize an analog voice signal, represent text as ASCII Source encode: Remove redundant or irrelevant data E.g., lossy compression (MP3, MPEG 4); lossless compression (Huffmann coding, runlength coding) Channel encode: Map source bits to channel symbols Potentially several bits per symbol May add redundancy bits to protect against errors Tailored to channel characteristics Physical transmit: Turn the channel symbols into physical signals At receiver: Reverse all these steps WS 09/10, v 1.3 Computer Networks - Physical layer 52
Structure of a (digital) broadband system Previous example assumed a simple physical transmission in baseband Using broadband transmission adds complexity to signal generation Data source Format Source encode Channel encode Modu -late Physical transmit Source bits Channel symbols Physical medium Format Source decode Channel decode Demodulate Physical receive Data sink Discrete set of analog waveforms WS 09/10, v 1.3 Computer Networks - Physical layer 53
Tricky part: Receiver! Difficult: How to decide, given an incoming, noisy version of a channel symbol (=a waveform) what the originally sent symbol/waveform was? Receiver (channel decoder) knows, for each channel symbol All legal waveforms s 1 (t),, s m (t) The actual, incoming, distorted waveform r(t) = s i (t) + n(t) Where n(t) is noise, i is unknown index of transmitted channel symbol How to determine i? WS 09/10, v 1.3 Computer Networks - Physical layer 54
Coherent receiver Coherent receiver: Receiver has perfect time synchronization with transmitter, perfect phase Not true in practice, a simplification Conceptually: Receiver compares r(t) with all s i (t), computes distance measure T is length of a channel symbol Result is that waveform i that minimizes this distance measure This waveform is assumed to be the one that the transmitter has sent WS 09/10, v 1.3 Computer Networks - Physical layer 55
Overview Baseband transmission over physical channels Limitations on data rate: Nyquist and Shannon Clock extraction Broadband versus baseband transmission Structure of digital communication systems Examples WS 09/10, v 1.3 Computer Networks - Physical layer 56
Example physical layers Guided transmission media Copper wire twisted pair Copper wire coaxial cable Fiber optics Wireless transmission Radio transmission Microwave transmission Infrared Lightwave WS 09/10, v 1.3 Computer Networks - Physical layer 57
Electromagnetic spectrum leitungsgebundene Übertragungstechniken verdrillte DrähteKoaxialkabel Hohlleiter optische Fasern Hz 10 3 10 5 10 7 10 9 10 11 10 13 10 15 Langwellen- Kurzwelle Mikrowellen Radio Mittelwellen Fernsehen -Radio Infrarot nicht-leitungsgebundene Übertragungstechniken sichtbares Licht WS 09/10, v 1.3 Computer Networks - Physical layer 58
Conclusion The physical layer is responsible for turning a logical sequence of bits into a physical signal that can propagate through space Many different forms of physical signals are possible Signals are limited by their propagation in a physical medium (limited bandwidth, attenuation, dispersion) and by noise Bits can be combined into multi-valued symbols for transmission Gives rise to the difference in data rate and baud rate Baseband transmission is fraught with problems, partially overcome by modulating a signal onto a carrier (broadband transmission) WS 09/10, v 1.3 Computer Networks - Physical layer 59
Compute Fourier transform for square wave Consider a square wave as function g(t) 1-1 Compute Fourier coefficients! T t WS 09/10, v 1.3 Computer Networks - Physical layer 60