ENع
→A digital communication system
الدرس 52 · Digital communications: bits on a wire

Inside a digital communication system

لم يُترجم بعد؛ يُعرض باللغة الإنجليزية

15 دقيقة10 خطوات5 أسئلةAdvanced
عن هذا الدرس

Follow one letter through a complete baseband link. The letter C becomes the bits 01000011, a mapper turns them into +1 V and −1 V symbols, a pulse shaper holds each for 1 ms, an RC wire smears the pulses into each other (intersymbol interference) and noise is added on the way. The receiver averages each bit, samples once per bit and compares with 0 V, and gets C back. Every curve is computed by real convolution, and the whole chain is four lines of numpy. It builds on the Networking lesson "Bits on the wire", the Hardware lesson "Signal integrity", and the white-noise model from "Power spectral density and white noise".

ستتعلّم

حدّد ما تشعر بأنك أتقنته. هذا التقييم الذاتي لا يؤثر في درجة الدرس.

شكل 52 · تفاعلي
01 / 10

The message is a list of bits

We want to send the letter C. In ASCII, the standard text code, C is the number 67: the 8 bits 01000011. The transmitter sends 1000 bits a second, one every Tb = 1 ms.

message      "C"
ASCII code   ord("C") = 67
in 8 bits    01000011   (most significant first)

bit rate     1000 bit/s
bit time     Tb = 1 / 1000 s = 1 ms
8 bits take  8 ms

the whole chain, left to right:
source -> mapper -> pulse shaper -> channel
(+ noise) -> receive filter -> sampler -> decision
جارٍ تحميل الرسم…
أو ← →
اقرأ الدرس خطوة بخطوة
  1. The message is a list of bits

    We want to send the letter C. In ASCII, the standard text code, C is the number 67: the 8 bits 01000011. The transmitter sends 1000 bits a second, one every Tb = 1 ms.

    message      "C"
    ASCII code   ord("C") = 67
    in 8 bits    01000011   (most significant first)
    
    bit rate     1000 bit/s
    bit time     Tb = 1 / 1000 s = 1 ms
    8 bits take  8 ms
    
    the whole chain, left to right:
    source -> mapper -> pulse shaper -> channel
    (+ noise) -> receive filter -> sampler -> decision
  2. Bits become symbols

    A wire carries voltages, not digits. The mapper turns each bit into a number called a symbol: 1 becomes +1 V and 0 becomes −1 V. Two opposite levels is called polar signalling.

    symbol = 2·bit − 1
      bit 1  ->  +1 V
      bit 0  ->  −1 V
    
    01000011
    ->  −1 +1 −1 −1 −1 −1 +1 +1
    
    polar (antipodal): the two levels are
    as far apart as the power allows
  3. Symbols become pulses

    The pulse shaper holds each symbol's voltage for one bit time, 1 ms. These flat pulses are called NRZ (non-return-to-zero). Together they make s(t), the voltage the transmitter puts on the wire.

    s(t) = Σ a_k · p(t − k·Tb)
      a_k   symbol k (+1 or −1)
      p(t)  1 for 0 ≤ t < Tb, else 0
            (a rectangle: the NRZ pulse)
    
    plot: s(t) in volts, t in ms
    slow motion: 8 ms played in 9 s
    other pulse shapes: see "Line coding"
    and "Pulse shaping" in this module
  4. The channel smears the pulses

    A real wire is a low-pass filter. Ours is an RC filter with time constant τ = 0.2 ms, so sharp edges become curves. Each pulse spills into the next bit: intersymbol interference (ISI).

    channel = RC low-pass, τ = RC = 0.2 ms
    
    c[n] = a·c[n−1] + (1−a)·s[n]
      computed every dt = 40 µs
      a = exp(−dt/τ) = exp(−0.2) = 0.8187
    
    after a change, one bit later:
      c = 1 − 2·exp(−Tb/τ) = 0.987 V
    
    same as convolving s with the
    channel's impulse response g[n] = (1−a)·aⁿ
  5. The channel adds noise

    Electrons in the wire and the receiver jiggle at random. That adds noise: here a fresh random value every 40 µs, spread σ = 0.5 V, as strong at all frequencies (white). The receiver gets r(t) = c(t) + n(t).

    r[n] = c[n] + w[n]
      w[n] Gaussian, mean 0, σ = 0.5 V
      independent every 40 µs
      -> flat power spectral density (white)
    
    this draw: measured σ = 0.55 V
    
    noise and its PSD: see "Power spectral
    density and white noise"
  6. The receive filter averages

    The receive filter averages the last 1 ms of r(t): a convolution with a 1 ms box. The pulse survives, but averaging 25 independent noise values divides their spread by √25 = 5, from 0.5 V to 0.1 V.

    y[n] = (1/25) · Σ r[n−m],  m = 0 .. 24
         = r convolved with a box
           of height 1/25 and length 1 ms
    
    noise spread after averaging:
      σ / √25 = 0.5 / 5 = 0.1 V
      this draw: 0.09 V
    
    why a box is the best filter for a box
    pulse: "The matched filter" lesson
  7. Sample once per bit

    A clock closes the sampler once per bit, at the end of each bit time: t = 1, 2 … 8 ms. Each closing keeps one number y[k]. The receiver must know where bits end; finding that is timing recovery.

    y[k] = y(t = (k+1)·Tb),  k = 0 .. 7
    
      y[0] = −0.79 V
      y[1] = +0.67 V
      y[2] = −0.68 V
      y[3] = −1.16 V
      y[4] = −1.04 V
      y[5] = −0.95 V
      y[6] = +0.69 V
      y[7] = +0.94 V
    
    in Python: y_full[24::25]
    (the last point of every bit)
  8. Decide: above or below zero

    The decision device compares each sample with a threshold of 0 V: above means 1, below means 0. Out come 01000011, which is 67, the letter C again. All 8 bits arrived correctly.

    bit = 1 if y[k] > 0 V else 0
    
      y[0] = −0.79 V  ->  0
      y[1] = +0.67 V  ->  1
      y[2] = −0.68 V  ->  0
      y[3] = −1.16 V  ->  0
      y[4] = −1.04 V  ->  0
      y[5] = −0.95 V  ->  0
      y[6] = +0.69 V  ->  1
      y[7] = +0.94 V  ->  1
    
    sent      01000011
    received  01000011   errors: 0
  9. ISI and noise eat the margin

    Without noise, a bit that repeats the last one reaches 1.00 V, but a bit right after a change only 0.64 V: ISI ate the rest. That gap to the threshold is the noise margin, here 0.64 V against noise of σ = 0.1 V.

    noiseless samples (signal + ISI only):
      after a repeat  |y| ≥ 1.00 V
      after a change  |y| ≥ 0.64 V
    
    with this noise draw the smallest
    |y[k]| is 0.67 V (bit 1)
    
    noise after the filter: σ = 0.1 V
    a wrong bit needs the noise to cross
    the whole gap, about 6 σ here
    
    reading this at a glance: "Eye diagrams"
  10. The whole chain in Python

    In Python with numpy the chain is four lines: repeat makes the pulses, one convolution is the channel, a second is the receive filter, and the slice [24::25] is the sampler. y > 0 decides.

    import numpy as np
    b = np.array([0,1,0,0,0,0,1,1])   # 'C' = 67
    a = np.exp(-0.04 / 0.2)           # dt / tau
    g = (1 - a) * a**np.arange(200)   # channel
    h = np.ones(25) / 25              # 1 ms box
    n = np.random.default_rng(1).normal(0, 0.5, 200)
    
    s = np.repeat(2*b - 1, 25)
    r = np.convolve(s, g)[:200] + n
    y = np.convolve(r, h)[24::25]
    bits = (y > 0).astype(int)
    
    >>> bits
    array([0, 1, 0, 0, 0, 0, 1, 1])
    
    (Python 3 with numpy; numpy's noise is a
    different draw, the bits come out the same)

اختبار يتاح بعد الخطوة الأخيرة.