Advertisement

Blog

Mixed-Signal Circuits, Part 2: ADC and DAC Dynamics, the w-Domain, and Feedback Loop Design

In Mixed-Signal Circuits, Part 1: From s to z – The Discrete Complex-Frequency Domain , discrete-time analog circuit analysis introduced the z -domain, a simple shortcut from discrete time-domain equations to the sampled s , or s *-domain. In this part, we push forth to transfer functions in s and z of ADCs and DACs, then consider briefly how to design feedback loops that span the analog-digital boundary.

Part 1 left us hanging as to how impulse trains relate to discrete-time waveforms. The development continues, and in the concrete context of ADCs, so that the abstraction of impulses can have a clearer meaning.

ADC Dynamics in z

To demonstrate how the z -domain can be applied in circuit engineering, a 12-bit ADC transfer function is

where vADC is the input voltage, VR is the full-scale 3.3 V ADC reference voltage, and wADC is the 12-bit ADC output. This ADC transfer function is quasistatic; it applies at 0+ Hz. The ADC dynamics of the clock-sampled zero-order hold (ZOH) output accounts for the sampling behavior of the ADC. The sampler, which produces the impulse trains from Part 1, is followed conceptually by a hold function,

The right-side expression can be interpreted as the gain-normalized integration (1/s x Ts ) of an impulse train in the time domain, resulting in a sequence of step functions, each turned off Ts later (− exp(−s x Ts )) so that their effect only occurs over one sample interval. At each sample time, a new value of ADC output is acquired and held. Plotted against time, this waveform has the stair-step look of a sample-and-hold waveform described by TZOH (s ), as shown below.

The acquired continuous voltage waveform, vi (t ), is plotted along with its piecewise-continuous or “stepped” digital output, approximated as the continuous vo (t ), shown as a dotted curve. This approximation of the acquired waveform is reconstructed by shifting the continuous waveform, vi , by Ts /2 to the right, a delay of a half sampling period. It passes through the centers of the vertical steps of the acquired ZOH waveform.

The ADC sample-hold frequency response is the magnitude and phase of TZOH (j ω );

The main step in this derivation is to multiply numerator and denominator by e-jω Ts /2, then apply (from Euler’s equation, ej θ = cos θ + sin θ , where θ = ω x Ts /2),

The amplitude of TZOH (j ω ) is thus

This function begins with a value of one at zero frequency ( ω = 0 s–1 ) and decreases to zero at the sampling frequency. Then it “bounces” (because of the absolute value) between zero values at harmonics of fs , outside the Nyquist interval. The rolloff of magnitude with frequency can be compensated with an inverse ZOH (ZOH-1 ) function and can be included following the ADC block as code in the μ C. It can be omitted if the ADC sample rate is enough above the analog-circuit bandwidth to make amplitude roll-off and phase delay insignificant so that the sampled result is approximately continuous.

The phase is

In degrees, the phase is −180o (f /fs ), where fs = 1/Ts . The Ts /2 delay in the phase is the half-step of delay observed graphically in the plot above of vo delayed from vi .

At the Nyquist frequency, fs /2, the magnitude will have decreased to (sin( π /2))/( π /2) = 2/ π ≈ 0.637 with a phase delay of −180o /2 = −90o . A sampling rate of 10 times fs results in a normalized amplitude of 0.9836, with about 6 bits of accuracy. Some values are given in the following table.

We arrive at the final step, the ZOH function, which completes the transformation from z to s :

Thus, to transform from z to s , substitute z (s ) = exp(sTs ) for z , then multiply the resulting impulse-train or sampled expression in s by the ZOH function.

Discrete-Time Control in w

There is a way (yet another transform) which avoids the complication of doing control analysis in z . Then z is used only as a quick way to get from discrete t to s *. Control design of feedback loops can be worked out as though the feedback system were continuous, then convert to the discrete domains using the bilinear transform , w (z ), to account for sampling effects. We now have four domains: t , s , z , and w . The w -transform maps the left half-plane of s onto the unit circle of z so that whatever is stable in s is stable in z (within the unit circle) and t and whatever is unstable in s is unstable in z and t . The new quantity, w , has units of frequency and behaves more like s than z , which is unitless. Stability analysis in s applies to w . Indeed, ws ;

As 1/s Ts is a continuous integrator in s , 1/w Ts is a trapezoidal integrator in the time domain. If w (z ) were inverse-Z transformed from z to t , it would be a trapezoidal integrator, what in numerical analysis (which, by the way, is equivalent to DSP, expressed more in mathematical than engineering language) is Euler’s integration rule; the two endpoints of an interval to be integrated are averaged in value and multiplied by the time interval, Ts .

Because the pole and zero values of s are only approximately the same in w , to accurately transform s -domain poles and zeros to the w -domain, a prewarp transform is applied to them. The relationship between s = and w = x is found by recalling the defining relationship between s and z ;

Then for s = j ω ,

Substitute this into the w (z ) transform;

Then the s -domain steady-state frequency, ω , is related to its corresponding frequency in w of ωw by

The desired poles and zeros of a continuous function of f can be prewarped to fw values before applying frequency-response analysis by substituting the fw pole-zero values into the s -domain transfer function. The following table gives some prewarp values.

where fw = ω w /2 π , and ω w is the w -domain approximation to ω of s = . As the sampling ratio fs /f increases, f in s approaches fw in w. As fs /f approaches the Nyquist-frequency value of 2, the ratio of steady-state w to s decreases and the frequencies diverge. At a sampling rate 10 times the s -domain f , the error in the corresponding discrete-time frequency is about −3.3 %. At this ratio of 10, the sample frequency, fs is often high enough that the difference between continuous- and discrete-frequency poles and zeros is negligible, and prewarping can be omitted.

From z to Discrete-Time Equations

To illustrate the use of the w -domain, a common motor-drive feedback-loop compensator is the PID transfer function, y (z )/e (z ), from Part 1, where e is the feedback-loop input error, implemented here by converting to the z -domain the three terms of

Substituting w (z ) for s and simplifying,

This can be solved for the outputs of y (z ) by first rewriting

to express the z quantities as delays of one sampling cycle or computed iteration, z –1 . Then

The time-domain difference equations to be implemented in computer code follow by applying (apart from initial conditions) the time-shifting transform from z to discrete-time t = nTs :

For yD (z ), conversion from the z -domain to the discrete time-domain of computer code is

For the remaining two terms,

where in general, x (nk ) is the k th previous sample point of x from the x (n ) of the n th sample point and iteration that is presently being computed. These three difference equations can be implemented directly in software, keeping in mind that if n corresponds to the present iteration of the computation loop in time, then the n − 1 samples are from the previous iteration last time through the loop. The combined output, y (z ), is the sum of the three outputs. Usually, these iterations of y (n ) computations are implemented as interrupt-driven by a timer that produces regular Ts intervals.

If the fs /f ratio is high enough – often ≥ 10 – then ω p and ω z do not need to be pre-warped. Otherwise, apply the prewarp formula of the w -domain to more accurately position the pole and zero in the s -domain.

Summary

The z discrete-sequence and w discrete-frequency domains add some further complication to electronics that take sampling into account. Happily, mastery of the different rules of dynamics in the z -domain can be largely avoided by using it as a shortcut between the discrete-time and sampled-frequency domains. If design values of poles and zeros in s for loop frequency compensation are to be implemented in the μ C, then the w -domain is another shortcut in that w is an approximate, sampling-affected s . Prewarping from s to w and using the bilinear formula of ω w result in z -domain transfer functions that are then directly converted (as z–n x (tn Ts )) to discrete-time equations and computer code.

As μ C-based systems continue to proliferate, digital signal processing and discrete control have become commonplace and an essential part of the electronics engineering body of knowledge. The concepts of this brief tutorial on discrete-time circuit analysis – of sampling by ADCs and DACs – is an increasingly important and familiar part of the working knowledge of the analog engineer of mixed-signal electronics.

0 comments on “Mixed-Signal Circuits, Part 2: ADC and DAC Dynamics, the w-Domain, and Feedback Loop Design

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.