Salta al contenuto
Note per Studenti Signal Acquisition - Sampling, Conditioning and Filtering Report

Signal Acquisition - Sampling, Conditioning and Filtering

In questa pagina 6

Measurements and signals

Many current measurement instruments can be seen as particular data acquisition systems. They have a dedicated input section that transduces the quantity of interest into a signal s(t)s(t), generally a voltage. Knowing the behaviour of the transducer, one goes back from s(t)s(t) to the input quantity of the measurement system, i.e. the actual measurand.

The measurement is generally the result of processing a numerical sequence q[n]q[n], obtained through an analog-to-digital conversion of s(t)s(t) (see Analog-to-Digital ConversionAnalog-to-digital conversion consists of sampling (sample-and-hold), uniform quantization with step Delta and error uniformly distributed in plus or minus Delta over 2, and binary coding; flash, successive-approximation and integrating converters trade speed against resolution.Analog-to-Digital Conversion →). Before being digitized the signal must be "prepared" by signal conditioning.

The acquisition chain is:

sensor -> signal conditioning -> [ sampling -> quantization ] -> processing -> MEASURE
                                  (analog to digital conversion)
                                   ^ REFERENCE      ^ SAMPLE

The steps treated in this lecture are: conditioning, sampling, quantization, signal reconstruction. The blocks "sampling" and "quantization" together form the analog-to-digital conversion; the sampling block has a REFERENCE input and the quantization block a SAMPLE input in the slide diagram.

Sampling

  • Sampling is the process of observing the measurand at a discrete set of time instants tnt_n, with n∈Zn \in \mathbb{Z}.
  • In most cases uniform sampling is used: the instants are integer multiples of a constant interval TsT_s, the sampling interval, so tn=nTst_n = nT_s.
  • Since TsT_s is constant and known, it is useless to store the time of each sample. The data are stored in an acquisition memory as a vector of amplitude values q[n]q[n] having the integer nn as index.
  • Because sampling changes the appearance of the signal s(t)s(t), the samples must be sufficiently "dense" to represent faithfully the original shape.

The slides compare the same continuous-time signal s(t)s(t) (a waveform made of repeating lobes of different amplitude) sampled "densely", with approximately 40 samples per period, and "sparsely", with approximately 10 samples per period: in the dense case the shape of the waveform is still evident from the dots, in the sparse case it is no longer recognisable.

Sampling in the frequency domain

Any signal can be represented in the time domain or in the frequency domain. The Fourier transform of a continuous-time signal s(t)s(t) is

S(f)=∫−∞+∞s(t) e−j2πft dtS(f) = \int_{-\infty}^{+\infty} s(t)\, e^{-j2\pi f t}\, dt

A sampled signal (sampling interval TCT_C) is defined as

sC(t)=s(t)∑n=−∞+∞δ(t−nTC)=∑n=−∞+∞s(nTC) δ(t−nTC)s_C(t) = s(t)\sum_{n=-\infty}^{+\infty}\delta(t-nT_C) = \sum_{n=-\infty}^{+\infty} s(nT_C)\,\delta(t-nT_C)

Through the properties of the Fourier transform one obtains the transform of the sampled signal:

SC(f)=1TC∑n=−∞+∞S ⁣(f−nTC)S_C(f) = \frac{1}{T_C}\sum_{n=-\infty}^{+\infty} S\!\left(f-\frac{n}{T_C}\right)

SC(f)S_C(f) is a sum of repetitions of S(f)S(f), each translated in frequency by 1/TC1/T_C with respect to the previous one. The function is periodic in ff with period FC=1/TCF_C = 1/T_C, which, being the reciprocal of the sampling interval, is called the sampling frequency. In the slide figure the spectrum ∣S(f)∣|S(f)| of the original signal appears once, while the sampled spectrum ∣Sˇ(f)∣|\check S(f)| shows copies centred at 00, ±1/Ts\pm 1/T_s, and so on.

Aliasing

Reconstructing a signal from its samples requires that sampling does not significantly alter its information content. This holds if there is no overlap between adjacent replicas of S(f)S(f): then knowing any period of SC(f)S_C(f) gives back s(t)s(t).

This amounts to assuming a band-limited signal, i.e. its Fourier transform satisfies

S(f)=0for ∣f∣>F0S(f) = 0 \quad \text{for } |f| > F_0

The frequency range where S(f)≠0S(f)\neq 0 is the signal band. Its width 2F02F_0 is also the lower bound of the sampling frequency, called the Nyquist frequency FNF_N. The condition is therefore Fs≥2F0F_s \ge 2F_0 (see Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →).

When Fs<2F0F_s < 2F_0 the repetitions of S(f)S(f) overlap, at least partially, and irreversibly modify the information on s(t)s(t), which can no longer be reconstructed from its samples: this effect is called aliasing (see Aliasing and Anti-Aliasing FiltersAliasing is the overlap of spectral replicas that occurs when the band-limited or Nyquist assumptions of the sampling theorem fail; an anti-aliasing low-pass filter with cut-off omega_s/2 applied before sampling removes it at the price of losing the high frequencies; two worked exercises.Aliasing and Anti-Aliasing Filters →). In the slide figure, the left-bottom spectrum (replicas just touching at ±F0\pm F_0) has no overlap, the right-bottom one (replicas overlapping around ±1/Ts\pm 1/T_s) has aliasing.

Example: two sinusoids, same samples

Both cases use FS=100 kHzF_S = 100\ \text{kHz} and a sinusoid of amplitude 0.5 V0.5\ \text{V} shown over 1 ms:

case F0F_0 FSF_S what the samples show
left 2.5 kHz2.5\ \text{kHz} 100 kHz100\ \text{kHz} a sine with period 0.4 ms (40 samples per period), starting upward
right 97.5 kHz97.5\ \text{kHz} 100 kHz100\ \text{kHz} the same-looking sine at 2.5 kHz2.5\ \text{kHz}, but with opposite sign (it starts falling)

In the first plot the sinusoid shows 2.5 kHz behaviour (peaks at 0.1, 0.5, 0.9 ms, i.e. period 0.4 ms). In the second the samples draw a sinusoid with the same period but opposite phase (minima at 0.1, 0.5, 0.9 ms): the 97.5 kHz97.5\ \text{kHz} tone is indistinguishable from a 2.5 kHz2.5\ \text{kHz} one, because FS−f0=2.5 kHzF_S - f_0 = 2.5\ \text{kHz}.

The spectra on the slide show the lines of a real sinusoid at ±f0\pm f_0 replicated around ±FS\pm F_S: for F0=2.5F_0=2.5 kHz the replicas fall at ±FS±f0\pm F_S \pm f_0 far from the baseband; for F0=97.5F_0 = 97.5 kHz the replica at FS−f0F_S - f_0 falls near the origin, next to −f0-f_0 and f0f_0 (labels −FS+f0-F_S+f_0, FS−f0F_S-f_0, 2FS−f02F_S-f_0, −2FS+f0-2F_S+f_0).

In principle aliasing should be totally avoided, but in practice it is difficult to eliminate completely (unless very high sampling frequencies are used). It is therefore preferable to intervene through filtering operations or sampling techniques.

Signal conditioning

In a measurement system the information is obtained by processing signals acquired with probes or sensors. In most cases the analog signals taken from the physical system cannot be directly converted into digital form. A preliminary processing, called signal conditioning, is therefore needed. Conditioning devices transform the electrical signal supplied by a generic source into a voltage signal with characteristics suitable for the measurement system.

Source and load

The signal source, seen from the input of the measurement system, is described as an equivalent voltage or current generator with an output impedance ZsZ_s (Thevenin: voltage source E(x)E(x) in series with ZsZ_s; Norton: current source I(x)I(x) in parallel with ZsZ_s). ZsZ_s accounts for the output characteristics and is to be considered not modifiable when designing an instrument or an acquisition system. The subsequent acquisition stage is represented by an input impedance, which is the load impedance of the source.

The conditions in which a conditioning element must operate are:

  • signal generator with given characteristics: signal amplitude and output impedance are not design parameters;
  • load with given characteristics, often with constraints on the trend of the output signal, depending on the device that follows the conditioning in the chain;
  • possible presence of a noise component superimposed on the useful signal.

Minimum required functions

  • adaptation of the signal level to the limits imposed on the output (may require both attenuation and amplification);
  • minimization of the load effect on the signal source: a circuit with an appropriate input impedance;
  • creation of a suitable output impedance;
  • optimization of the signal/noise ratio.

The conditioning block can be considered a linear network: all these functions can be realised as linear time-invariant transformations.

Loading effect

To minimize the loading effect, if the source is seen as a voltage generator the input impedance ZiZ_i of the conditioning block must satisfy

∣Zi∣≫∣Zs∣|Z_i| \gg |Z_s|

The transfer function is given by the voltage gain AvA_v; to reduce the loading effect also at the output we must set

∣Zu∣≪∣ZL∣|Z_u| \ll |Z_L|

(ZuZ_u output impedance of the conditioning block, ZLZ_L load impedance.) The slide circuit is: source VSV_S with series RsR_s, input resistance RinR_{in} across which the voltage VV appears, then a controlled voltage source AVV0A V_{V0} with series RoutR_{out} feeding the load RLR_L.

Non-distortion conditions

Conditioning must not alter the essential features of the signal; the measurand s(t)s(t) should remain substantially unchanged. The amplitude is often varied by amplification or attenuation; the optimal situation is the multiplication by a constant G0G_0. Propagation through any physical system takes a finite time, so the output is delayed by a constant time τ0\tau_0.

sout(t)=G0 sin(t−τ0)⟺Sout(f)Sin(f)=G(f)=G0 e−j2πfτ0s_{out}(t) = G_0\, s_{in}(t-\tau_0) \qquad\Longleftrightarrow\qquad \frac{S_{out}(f)}{S_{in}(f)} = G(f) = G_0\, e^{-j2\pi f\tau_0}

Ideal filters

Time-domain measurements

For measurements in the time domain (e.g. analysis with an oscilloscope, see The OscilloscopeThe oscilloscope displays the joint trend of two or more quantities; its functional blocks are input channels, trigger and synchronization, time base and acquisition and display, and its input impedance, bandwidth, rise time, coupling, hold-off and probe compensation determine how faithfully a signal is shown.The Oscilloscope →) the optimal criterion for a linear filter is to reproduce the trend of the signal as faithfully as possible. The most critical condition is the measurement of a step, displayed as the step response of the conditioning section. The optimal features are:

  • the shortest rise time possible;
  • the absence of overshoots.

These allow following all variations of the signal while avoiding artefacts (here, more or less damped oscillations). The slide shows a clock signal (amplitude about 0 to 1 V, time in ns) with labelled period, rise time, fall time, positive overshoot (peak about 1.2 V), positive undershoot and negative overshoot (about −0.2-0.2 V).

Frequency-domain measurements

If the primary target is to analyse the frequency composition in detail, the conditioning section must approximate an ideal low-pass filter:

H(f)H(0)={1∣f∣<B0∣f∣>B\frac{H(f)}{H(0)} = \begin{cases} 1 & |f| < B \\ 0 & |f| > B \end{cases}

(normalized response, gain 1, neglecting the delay term τ0\tau_0). The corresponding impulse response is

h(t)=sin⁡2πBt2πBth(t) = \frac{\sin 2\pi B t}{2\pi B t}

which is symmetric but of infinite duration and gives an oscillatory step response. Achieving optimal characteristics in one domain implies significant limitations in the other.

Anti-aliasing filters

The condition S(f)=0S(f)=0 for ∣f∣>F0|f|>F_0 is generally very difficult to satisfy. It is more realistic to identify a band of "meaningful" frequencies ∣f∣≤B|f| \le B, while components with ∣f∣>B|f|>B are of no interest for measurement. This does not mean the out-of-band components have negligible amplitude (the slide spectrum has total width 2B02B_0 with the meaningful part 2B2B inside it). Their replicas after sampling would fold into the band of interest (replicas around ±1/2T\pm 1/2T, 3/2T3/2T in the figure).

To avoid this, a filter is put before the sampler to add, for ∣f∣>B|f|>B, an attenuation large enough to make the out-of-band components negligible. Features of an anti-aliasing filter H(f)H(f):

  • Pass band, delimited by BPB_P, where the filter does not alter the signal: ∣H(f)∣≅∣H(0)∣|H(f)| \cong |H(0)| for ∣f∣<BP|f| < B_P.
  • Attenuated band (dark band), delimited at the bottom by BAB_A, with strong attenuation: ∣H(f)∣<H(0)A|H(f)| < \dfrac{H(0)}{A} for ∣f∣>BA|f| > B_A.
  • Transition band BP<f<BAB_P < f < B_A, where signal components, although outside the pass band, still have non-negligible amplitude.

When choosing the sampling frequency one must refer to BAB_A:

FC≥2BAF_C \ge 2B_A

The oversampling factor is now BA/BPB_A/B_P and depends on the frequency response of the filter.

The parameters that determine the complexity and cost of a filter are the flatness of the pass band, the dark band attenuation and the width of the transition band. For measurement, flatness directly influences accuracy, since it contributes to the uncertainty with which the amplitude is reproduced. The width BA−BPB_A - B_P is one of the most significant parameters: a very narrow transition requires high-order transfer functions, more difficult and expensive to realize.

Signal reconstruction

Reconstructing a time-continuous signal from its samples is called interpolation (mathematically, determining a function given its values in a set of points). In instrumentation it is needed in two cases:

  • graphic representation of a sampled waveform: a discrete interpolation shows the waveform on a denser time grid;
  • correct reproduction of the desired signal at the output of a digital synthesis generator: a real interpolator filter is used, since the generator output is necessarily analogue.

Versione ripasso

sC(t)=s(t)∑n=−∞+∞δ(t−nTC)=∑n=−∞+∞s(nTC) δ(t−nTC)s_C(t)=s(t)\sum_{n=-\infty}^{+\infty}\delta(t-nT_C)=\sum_{n=-\infty}^{+\infty}s(nT_C)\,\delta(t-nT_C)

  • Spectrum of the sampled signal: replicas of S(f)S(f) shifted by 1/TC1/T_C:

SC(f)=1TC∑n=−∞+∞S ⁣(f−nTC)S_C(f)=\frac{1}{T_C}\sum_{n=-\infty}^{+\infty}S\!\left(f-\frac{n}{T_C}\right)

The function is periodic with period FC=1/TCF_C=1/T_C, the sampling frequency.

  • No overlap of the replicas needs a band-limited signal, S(f)=0S(f)=0 for ∣f∣>F0|f|>F_0, and

Fs≥2F0F_s\ge 2F_0

where 2F02F_0 is the Nyquist frequency FNF_N (Sampling and the Sampling TheoremSampling multiplies a continuous-time signal by a pulse train, which replicates its spectrum every omega_s; if the signal is band-limited with maximum angular frequency omega_M and omega_s exceeds 2 omega_M, an ideal low-pass filter recovers it exactly (Shannon theorem and sinc interpolation formula).Sampling and the Sampling Theorem →).

sout(t)=G0 sin(t−τ0)⟺G(f)=Sout(f)Sin(f)=G0 e−j2πfτ0s_{out}(t)=G_0\,s_{in}(t-\tau_0)\qquad\Longleftrightarrow\qquad G(f)=\frac{S_{out}(f)}{S_{in}(f)}=G_0\,e^{-j2\pi f\tau_0}

FC≥2BAF_C\ge 2B_A

  • oversampling factor BA/BPB_A/B_P.
  • Cost: flatness of the pass band (affects amplitude accuracy), attenuation in the dark band, and the width of the transition band. A narrow transition needs high-order, costly filters.
  • Reconstruction = interpolation. Used for plots (a discrete interpolation on a denser grid) and for the output of a digital synthesis generator, where a real interpolation filter gives the analog signal.
  • Typical errors:
    • sampling at 2F02F_0 the raw signal without filtering out-of-band components;
    • using BPB_P instead of BAB_A to choose FCF_C;
    • assuming a filter is optimal in both time and frequency domains.

Teoria collegata