Physical Layer – How bits are sent

Download Report

Transcript Physical Layer – How bits are sent

Physical Layer – How bits are
sent
Goal
• Physical layer design goal: send out bits as fast
as possible with acceptable low error ratio
• Goal of this lecture: get to know the basics of
physical layer design, the constraints, the
solutions, should be able to solve some simple
problems
Some simple schemes
• There is a wire between A and B. If A wants to
send a bit `1’, he connects the wire to the positive
end of a battery. Otherwise he disconnects it
from the battery.
• Or A can hold a radio, if `1’, he sends at frequency
f1 and if `0’ he sends at frequency f2.
• Or there is an optical fiber between A and B and
if `1’ A lit up a light and if `0’ A does nothing.
Ethernet
• So, why not simply do that? We can let a
electronic switch to do the switching between
0s and 1s.
• In fact, yes we can.
• This is what is done in 10Mbs Ethernet.
Ethernet Physical Layer
• Get bits from upper layer, do Manchester
encoding, then pull the voltage up and down
• The only thing that is added other than simply
sending 1 and 0 is the Manchester encoding –
why do we need it? What could happen if you
miss the sample time?
• How do you know the beginning of a frame?
Ethernet
• 10 M Ethernet is probably the simplest case –
computers all connect to a bus of limited
length (<1km) and the speed is not required to
be very high – so it can afford to be simple
• In a sense, it does not have to deal with the
two things that can make life a lot more
complicated
– Bandwidth
– Noise
Bandwidth and noise
• Bandwidth basically means how fast your
signal can change or how fast can you send
out symbols.
– Symbol is something you send out to represent
bit(s)
• Noise means that although you sent 1 to me, I
may receive something like 1+x, where x is the
noise added by the media.
Ideal case
• If the bandwidth is infinite and absolutely no
noise, how fast can you send/receive data?
Bandwidth
• If the media is of infinite bandwidth but with
some noise, how fast can you send/receive
data? Assuming that your device is fast
enough.
Noise
• If there is absolutely no noise but the
bandwidth is limited, how fast can you
send/receive data? Assuming that your device
is fine enough to tell the slightest differences
of signal voltage.
Shannon’s Theorem
• C=B*log(1+S/N)
– C is the capacity of the channel, B is the
bandwidth of the channel, S is power of the signal
and N is the power of the noise
– Channel capacity means how many bits you can
send out per second reliably
Shannon’s Theorem
• There is actually a very simple way to
understand Shannon’s theorem
– B means how fast can you send out symbols
– S/N determines how many bits each symbol
carries – why there is a log?
Limited bandwidth
• The trouble is, we live in a world with limited
bandwidth and some noise.
• Noise is easy to model.
• In mathematical languages, any signal can be
viewed as the sum of a series of sine waves on
different frequencies
• You pass the signal to a channel that can pass
frequencies up to B, all sine waves on frequencies
higher than B will be lost – you will receive a
distorted signal
Nyquist Theorem
• If the bandwidth is limited to B, in the ideal case when
there is no noise, how fast can you send/receive
symbols?
– Note that the channel capacity is infinity because each
symbol can carry infinite number of bits
• Nyquist Theorem says that it only makes sense for you
to send/receive symbols at a speed of 2B – if B is 4KHz,
you send/receive 8K symbols per second – the baud
rate is 8K per second.
• Why? If a signal is band-limited by BHz, by taking 2B
samples per second, you can completely reconstruct it.
Limited Bandwidth
• Bandwidth is limited because of many reasons
– The wire itself, if too long, is a capacitor and slows
down voltage transition
– In wireless transmissions, the whole spectrum
shared by many communication parties and each
can have only a limited chunk of it
Modulation
• Even in the simplest 10Mbs Ethernet case, the
signals you send out is different from the 0-1
waveform.
• Modulation is to convert the 0-1 waveform to the
actual signal to be sent out.
• In most cases the signals are derived from sine
waves.
– Given the 0-1 waveform, you do some tricks to the
sine wave at some frequency f, and send it out
– This sine wave is called the carrier
Different modulation techniques
•
•
•
•
Amplitude modulation
Frequency modulation
Phase modulation
In digital communications, phase modulation
is used
Demodulation
• The problem is, given a (0,180) phase
modulated signal, how to determine whether
the bit is 0 or 1?
• This is demodulation.
• Assume that you know the beginning of a
binary symbol.
Demodulation
• You multiply the received signal with a sine
wave and do an integral. If the result is
positive, it was 1 and if it was negative, it was
0.
• If no noise, things are simple!
Demodulation
• With noise, it’s all about guessing, because you
don’t know what the noise is when this symbol is
sent as noise is random.
• You may know some statistics of the noise, based
on which you make your best guess.
• For example, let’s say 0 is 0 volt 1 is 5 volts.
Suppose you know that very rarely the noise
exceeds 2.5 volts. If you received a 2.2 volts, you
would guess it to be 0 or 1? What is the chance
that you got it right/wrong?
Maximum Likelihood Detection
• Detection – given a received signal, determine
which of the possible original signals was sent.
There are finite number of possible original
signals (2 for the binary case – 0 or 1)
• Compute a likelihood value for every possible
input, choose the one with largest likelihood –
maximum likelihood detection
Maximum Likelihood Detection
• There are two inputs, x1 and x2. Noise is n.
What you receive is y.
• If I sent x1, you receive y=x1 + n. If I sent x2,
you receive y=x2+n. You don’t know what I
sent and how large n is.
• You compute the likelihood of receiving y if I
sent xi, Li (i=1,2). If L1 > L2, you say I sent x1.
Else you say I sent x2.
• How to compute L1 and L2?
Maximum Likelihood Detection
• If n=0 always, y=x1 if I sent x1 and y=x2 if I sent x2. Of course x1 !=
x2. Will you make mistake in this case? What is the likelihood of
y=x2 if I sent x1?
• If n is not always zero, we assume n follows some probability
distribution. If it is Gaussian, the channel is called AWGN.
• Given y, the likelihood of x1 being sent is the likelihood that n=y-x1.
Similarly, the likelihood of x2 being sent is the likelihood that n=yx2. (likelihood is derived from probability, but likelihood could be
taking some values that probability cannot take depending on how
you define likelihood)
• So what you are doing is to compare the likelihood of n=y-x1 and
n=y-x2. So the detection rule is if p(n=y-x1)/p(n=y-x2) > 1, output
x1, else output x2.
• That’s all!
• Wait, what if you know that x1 is more likely to be sent than x2?
I,Q channels
• In modern communications, you have two carriers on the
same frequency but their phases differ by 90 degrees. So
one is sine and the other is cosine. You can apply two
symbol streams (called the baseband signals) to them
separately, and add the two together and send out.
• The receiver won’t be confused because what he does is to
multiply the received signal with two locally generated sine
waves on the same frequency as the sender side, one sine
and one cosine. Then he passes each of the two multiplied
signals to a device that only allows signals on frequency no
higher than B to pass (assuming the highest frequency of
your signal is B). Why?
QAM
• With two carriers, you have two dimensions.
So the signal will appear on a plane. 16-QAM,
64-QAM, 256-QAM
Wired Communication – Telephone
Company
• Dial-up – 56kbps
• DSL – Digital Subscriber Line
– ADSL: Asymmetric DSL, different upload and
download bandwidth
– Available bandwidth is about 1.1MHz, divided into
256 channels, one for voice, some unused or for
control, the rest divided among upstream and
downstream data. My DSL at Pittsburgh was 100kbps
upstream and 768kbps downstream
– How ADSL is set up. Fig. 2-29. The ADSL modem is 250
QAM modems operating at different frequencies. The
actual QAM depends on the noise.
Wired Communications – The Cable TV
Company
• Cable frequency allocation. Fig. 2-48.
– Downstream channel bandwidth is 6MHz. If using
QAM-64, how much of a speed we can get?
– Upstream channel is worse so use QAM-4.
– Upstream – stations contend for access (MAC
layer issue, will be discusses later)
– Downstream – no contention, from the head end
to user
– Shared medium, so some security is needed
Wired communication – Optical
Backbone
• SONET
Wireless communications
• FDMA – Frequency division multiplexing
• TDMA – Time division multiplexing
• CDMA – Code division multiplexing