5.1 Introduction

Real-time digital simulation often involves inputs and outputs in the form of analog (i.e., continuous) signals. Clearly this is true for the “hardware-in-the-loop” simulation shown in Figure 5.1, where the hardware requires continuous inputs and produces continuous outputs. In this case the continuous outputs from the hardware must be converted to digital data sequences using A to D (Analog to Digital) converters, a single channel of which is shown in the figure. The computer outputs in the form of data sequences must be converted to continuous signals using D to A (Digital to Analog) converters. Again, a single channel is shown in Figure 5.1. For both A to D and D to A converters we have assumed that the sample period h is fixed, which is almost invariably the case in real-time, hardware-in-the-loop simulation.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image001.jpg

Figure 5.1. Hardware-in-the-loop flight simulation.

 

In this chapter we will examine the dynamics of the A to D and D to A conversion process. As in the previous chapters we will find this most convenient and meaningful in the frequency domain. In the next section we will consider D to A conversion using both zero and first-order extrapolation. The resulting DAC (Digital to Analog Converter) characteristics will be examined in the frequency domain by deriving the DAC transfer function for sinusoidal input data sequences. This will lead in subsequent sections to the development of digital algorithms to compensate for the DAC transfer function gain and phase errors. The spectral characteristics of A to D converters will be examined in the last section of this chapter.

 

5.2 Definition of Zero and First-order DAC extrapolation

Assume that the digital computer produces a data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image002.png  which is converted to a continuous signal using a double-buffered DAC. The DAC data word,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png , is loaded into the outer buffer register prior to time nh, where h is the fixed time between data points. At t = nh the data word  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  is transferred to the inner buffer register so that the DAC output becomes the analog equivalent of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png . Every h seconds this process is repeated, which results in the staircase function shown in Figure 5.2. The DAC output  C:\Users\portman\Documents\Chapter 5 Nuance_files\image004.png  in this case represents a zero-order extrapolation of the input data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image002.png . This is the most common method of mechanizing DAC outputs in a real-time simulation.

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image005.jpg

Figure 5.2. Zero-order DAC extrapolation.

 

An alternative is to use first-order extrapolation, which is illustrated in Figure 5.3. Here the DAC is used in combination with an analog integrator and storage device to produce a linearly-varying output over the nth sample period based on the current  C:\Users\portman\Documents\Chapter 5 Nuance_files\image006.png  and previous  C:\Users\portman\Documents\Chapter 5 Nuance_files\image007.png  data points.

 

5.3 Transfer Function for Zero-order Extrapolating DAC

We will obtain the transfer function for the DAC which uses zero-order extrapolation by taking the Fourier transform of the DAC output  C:\Users\portman\Documents\Chapter 5 Nuance_files\image004.png  when the input data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image002.png is a sinusoid. First we define the unit data point response of the DAC, i.e., the response to the input

(5.1)                                                      C:\Users\portman\Documents\Chapter 5 Nuance_files\image008.png

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image009.png

Figure 5.3. First-order DAC extrapolation.

We define the corresponding DAC response as  C:\Users\portman\Documents\Chapter 5 Nuance_files\image010.png , which is shown in Figure 5.4 in the case of zero-order extrapolation. From the figure it is apparent that

C:\Users\portman\Documents\Chapter 5 Nuance_files\image011.png

Figure 5.4. Unit data point response of zero-order DAC extrapolator.

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image012.png

(5.2)

Then the DAC output  C:\Users\portman\Documents\Chapter 5 Nuance_files\image004.png  for any input data sequence can be represented as

(5.3)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image013.png

 

We now derive the frequency domain representation of the DAC output by taking the Fourier transform of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image004.png . Thus

C:\Users\portman\Documents\Chapter 5 Nuance_files\image014.png

or, interchanging the order of integration and summation,

(5.4)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image015.png

 

Here  C:\Users\portman\Documents\Chapter 5 Nuance_files\image016.png  is the Fourier transform of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image017.png . We recall the translation theorem of the Laplace transform, which states that

C:\Users\portman\Documents\Chapter 5 Nuance_files\image018.png

The equivalent theorem for the Fourier transform states that

C:\Users\portman\Documents\Chapter 5 Nuance_files\image019.png

Thus we can rewrite Eq. (5.4) as

C:\Users\portman\Documents\Chapter 5 Nuance_files\image020.png

 

or

(5.5)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image021.png

 

 

where

(5.6)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image022.png

 

We also recall that the Z transform of the data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image002.png is defined as

C:\Users\portman\Documents\Chapter 5 Nuance_files\image023.png

Hence we can write Eq. (5.5) as

(5.7)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image024.png

 

It follows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image025.png  can be interpreted as representing the transfer function of the zero-order DAC extrapolator for a sinusoidal data sequence input. We can determine the formula for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image025.png  by substituting Eq. (5.2) into (5.6). Thus

(5.8)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image026.png

 

An alternative expression for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image025.png  is obtained as follows:

(5.9)      C:\Users\portman\Documents\Chapter 5 Nuance_files\image027.png

 

Figure 5.5 shows a plot of the magnitude (gain) and phase angle of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image025.png  versus dimensionless frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image028.png  over the range  C:\Users\portman\Documents\Chapter 5 Nuance_files\image029.png . Here  C:\Users\portman\Documents\Chapter 5 Nuance_files\image030.png  corresponds to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image031.png , the data sequence sample frequency in radians per second. In Figure 5.5 the gain is normalized by plotting  C:\Users\portman\Documents\Chapter 5 Nuance_files\image032.png , which from Eq. (5.9) is given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image033.png . The phase angle is given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image034.png .  The resulting linear phase lag with frequency is apparent in Figure 5.5. This phase characteristic corresponds to a pure time delay of h/2 seconds, which is also intuitively obvious in Figure 5.2 when a smoothed curve through the staircase function is compared with the data sequence driving the DAC.

 

If we make a power series expansion of the zero-order extrapolator transfer function in Eq. (5.8), the following formula is obtained:

(5.10)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image035.png

 

Ideally, the DAC extrapolator transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image036.png , should be 1, i.e., the DAC output for a sinusoidal input should be a sinusoid of the same amplitude with no phase shift. From Eq. (5.10) it is easy to show that the DAC gain error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image037.png , and the phase error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image038.png , are given by the following approximate formulas

(5.11)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image039.png

 

Note in this case that the approximate gain error is not equal to the real part,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image040.png , of the fractional error in DAC transfer function, as stated earlier in Eq. (1.53). This is because here the real part of the fractional transfer function error is of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image041.png , whereas the imaginary part of the fractional transfer function error is of order h. Thus the imaginary part as well as the real part make contributions of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image041.png  to the gain error.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image042.jpg

Figure 5.5.  Frequency Response of zero and first-order DAC extrapolators

 

5.4. Transfer Function for First-order Extrapolating DAC

The unit data point response for the first-order DAC extrapolator illustrated in Figure 5.3 is shown in Figure 5.6. It is given by the formula

(5.13)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image043.png

 

When we take the Fourier transform of Eq. (5.13) using Eq. (5.6), the following formula is obtained for the first-order extrapolator transfer function:

(5.14)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image044.png

 

Plots of the normalized gain,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image032.png , and the phase angle of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image025.png are shown as a function of dimensionless frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image028.png in Figure 5.5. Note that the gain exhibits a peak of approximately 1.6 at about one-third the sample frequency. By comparison, the transfer function gain for the zero-order extrapolator has no peaking. Also, at low frequencies the phase lag for the first-order extrapolator is quite small compared to the phase lag for the zero-order extrapolator. However, at higher frequencies the first-order extrapolator exhibits a larger lag.

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image045.png

Figure 5.6. Unit data point response for first-order DAC extrapolator.

 

When we make a power series expansion of the first-order extrapolator transfer function in Eq. (5.14), the following formula is obtained:

(5.15)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image046.png

 

Here the real and imaginary parts of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image047.png  represent, respectively, the approximate fractional gain error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image037.png , and the phase error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image038.png , of the first-order extrapolator. This is in accordance with Eqs. (1.53) and (1.54), which apply in this case since the order of the phase error is higher than half the order of the gain error. Thus we can write

(5.16)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image048.png

 

Comparison with Eq. (5.12) for the zero-order extrapolating DAC shows that for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image049.png  the gain error magnitude is 2.5 times larger when using first-order extrapolation. For both schemes the gain varies as  C:\Users\portman\Documents\Chapter 5 Nuance_files\image041.png . Again, comparison of Eqs. (5.12) and (5.16) shows that for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image049.png  the phase error is much larger in the case of the zero-order extrapolating DAC. Specifically, in the zero-order DAC the phase error is proportional to the first power of the sample period h and will be the predominant cause of dynamic errors when using zero-order extrapolating DAC’s.

 

5.5 Digital Compensation of Zero-order Extrapolating DAC’s.

In this section we consider means for compensating the dynamic errors produced by zero-order extrapolation. Since the DAC phase error is equivalent to a pure time delay of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image050.png , we can cancel the lag if we extrapolate ahead in time by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image050.png  seconds the digital output  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png .

 

5.5.1 DAC Compensation Based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image051.png  

One way to extrapolate ahead by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image050.png  seconds is to use first-order extrapolation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png , and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image052.png , as considered in Section 4.1. When the dimensionless extrapolation interval C:\Users\portman\Documents\Chapter 5 Nuance_files\image053.png , the compensated DAC input,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image054.png , is then given by

(5.17)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image055.png

 

The compensator Z transform becomes

(5.18)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image056.png

 

The corresponding transfer function for sinusoidal inputs is simply

(5.19)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image057.png

 

The product of the compensator transfer function and the normalized DAC transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image036.png , as obtained from Eq. (5.8), becomes

(5.20)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image058.png

 

Expanding  C:\Users\portman\Documents\Chapter 5 Nuance_files\image059.png  in a power series and retaining terms up to order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image060.png , we obtain the following approximate formula for the combined transfer function:

(5.21)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image061.png

 

Ideally,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image059.png  should equal 1 if the DAC compensation is complete. As before, we note that the terms  C:\Users\portman\Documents\Chapter 5 Nuance_files\image062.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image063.png  on the right side of Eq. (5.21) represent, respectively, the approximate gain and phase errors in  C:\Users\portman\Documents\Chapter 5 Nuance_files\image064.png . Figure 5.7 shows the DAC response to a sinusoidal data sequence without and with compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image052.png  .. The effectiveness of the compensation in removing the half-step lag in DAC output is clearly evident.

 

5.5.2 DAC Compensation Based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image065.png  

Next we let the compensation of the half-frame lag associated with the zero-order extrapolator be based on extrapolation using  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png . This requires, of course, that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  is a state variable or is explicitly related to state variables so that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  can be calculated. In this case the formula for the compensated output becomes

(5.22)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image067.png

 

And the compensator transfer function for sinusoidal inputs is simply

(5.23)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image068.png

 

The product of the compensator transfer function and the normalized DAC transfer function now becomes

(5.24)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image069.png

Expanding  C:\Users\portman\Documents\Chapter 5 Nuance_files\image059.png  in a power series, we obtain the following approximate formula for the combined transfer function:

(5.25)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image070.png

 

Again the compensator has cancelled the first-order phase error in the DAC transfer function. However, comparison of Eq. (5.25) with (5.21) shows that the compensator based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  produces residual gain and phase errors which are only 1/4 and 1/6 times as much, respectively, as the corresponding errors when the compensation is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image052.png . Clearly the compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png , is preferable. Eqs. (5.21) and (5.25) are of course valid only for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image049.png  .

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image071.png

Figure 5.7. DAC response to sinusoidal input without and with compensation
based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image051.png

 

5.5.3 DAC Compensation Based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image072.png 

In both Eqs. (5.21) and (5.25) it is apparent that the dominant error in the combined compensator-DAC transfer function is proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image073.png . This suggests that an incremental compensation proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image073.png  can be used to cancel these errors. To find such a compensation we note that the sinusoidal function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image074.png ,  has a second derivative,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image075.png , which is given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image076.png . The following formula represents a numerical approximation to the second derivative:

C:\Users\portman\Documents\Chapter 5 Nuance_files\image077.png

This in turn suggests that we consider a compensation increment proportional to

(5.26)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image078.png

 

Taking the transform of Eq. (5.26) and solving for the incremental transfer function  C:\Users\portman\Documents\Chapter 5 Nuance_files\image079.png , we obtain

C:\Users\portman\Documents\Chapter 5 Nuance_files\image080.png

The incremental transfer function for sinusoidal inputs is then given by

(5.27)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image081.png

Expanding the exponential functions in power series, we have

(5.28)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image082.png

 

From Eq. (5.21) we see that the desired incremental transfer function is equal to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image083.png , i.e.,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image084.png  based on Eq. (5.28). Thus we add  C:\Users\portman\Documents\Chapter 5 Nuance_files\image085.png , or from Eq. (5.26),  C:\Users\portman\Documents\Chapter 5 Nuance_files\image086.png  , to the original compensator equation (5.17). This results in the new compensator equation

(5.29)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image087.png

 

After taking the Z transform, replacing z by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image088.png , and solving for the compensator transfer function, we obtain

(5.31)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image089.png

 

From Eq. (5.8) the combined compensator-DAC transfer function now becomes

(5.31)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image090.png

 

Expanding the exponential functions in power series and retaining terms up to h4, we obtain

(5.32)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image091.png

 

Eq. (5.32) shows that the DAC compensator algorithm of Eq. (5.29) has eliminated the gain error of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image062.png  in the earlier combined compensator-DAC transfer function in Eq. (2.8). The Predominant error for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image049.png  is now the phase error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image092.png  .

 

5.5.4 DAC Compensation Based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image093.png 

In Section 5.5.2 we found that DAC compensation using  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  gave better results than the compensation using  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image052.png  in Section 5.5.1. If  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  is available, then the following formula can be used to define an incremental compensation  C:\Users\portman\Documents\Chapter 5 Nuance_files\image094.png  proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image075.png , as needed to cancel transfer function errors proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image073.png :

(5.33)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image095.png

 

This formula is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image096.png  representing a central difference approximation to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image097.png .  It follows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image098.png  represents an approximation to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image075.png , which leads directly to Eq. (5.33). The incremental compensator transfer function is given by

(5.34)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image099.png

 

Expanding the exponential function in a power series, we obtain

(5.35)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image100.png

 

Comparison with Eq. (5.25) shows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image079.png  in Eq. (5.35) must be multiplied by 1/6 to produce the increment  C:\Users\portman\Documents\Chapter 5 Nuance_files\image101.png  which, when added to Eq. (5.25), will cancel the error of order C:\Users\portman\Documents\Chapter 5 Nuance_files\image041.png . Thus the new compensator algorithm is obtained by adding 1/6 times the  C:\Users\portman\Documents\Chapter 5 Nuance_files\image094.png  of Eq. (5.33) to the right side of Eq. (5.22) to produce the following compensator formula:

(5.36)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image102.png

 

Following the same procedure used earlier to derive the combined compensator-DAC transfer function in Eq. (5.31), we obtain

(5.37)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image103.png

 

Expanding the exponential functions in power series and retaining terms up to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image104.png , we have

(5.38)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image105.png

 

Comparison with Eq. (5.32) for compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png , and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image107.png  shows that the compensation here, which is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png , exhibits much smaller gain and phase errors. Again, we see that if the derivative  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  is available, it should be used in preference to past data sequence values when constructing compensator formulas.

 

5.5.4 DAC Compensation Based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image108.png 

In Section 4.6 we considered extrapolation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image109.png  as an alternative to extrapolation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png .  This may be necessary when r is a state variable but  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  is not, in which case  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  is not calculated in the nth frame. Then the following formula based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image109.png  can be used to define an incremental compensation  C:\Users\portman\Documents\Chapter 5 Nuance_files\image111.png  proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image075.png , as needed to cancel transfer function errors proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image112.png :

(5.39)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image113.png

 

As before, this formula is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image096.png  representing a central difference approximation to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image097.png . It follows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image114.png  represents an approximation to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image075.png , which leads directly to Eq. (5.39). The incremental compensator transfer function is now given by

(5.40)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image115.png

Expanding the exponential function in a power series, we obtain

(5.41)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image116.png

 

Comparison with Eq. (5.21) shows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image079.png  in Eq. (5.35) must be multiplied by 2/3 to produce the increment  C:\Users\portman\Documents\Chapter 5 Nuance_files\image083.png  which, when added to Eq. (5.21), will cancel the error of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image041.png .  Thus the new compensator algorithm is obtained by adding 2/3 times the  C:\Users\portman\Documents\Chapter 5 Nuance_files\image094.png  of Eq. (5.39) to the right side of Eq. (5.17) to produce the following compensator formula:

(5.42)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image117.png

 

The combined compensator-DAC transfer function is then given by

(5.43)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image118.png

 

Expanding the exponential functions in power series and retaining terms up to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image104.png , we have

(5.44)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image119.png

.

Comparison with Eq. (532) for compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image107.png  shows that the compensation here, which is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image109.png , exhibits smaller gain and phase errors. On the other hand the errors are larger than those in Eq. (5.38) for compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png .

 

5.6. Summary of Methods for Dynamic Compensation of D to A Convertors

Table 5.1 summarizes the different methods considered for DAC compensation in this chapter. Listed for each method are the required inputs, the compensator formula, and the approximate fractional gain error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image037.png , and phase error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image038.png , for the combined compensator-DAC transfer function. Also listed in the table are the gain and phase errors for the uncompensated DAC. As noted earlier, the approximate gain and phase errors are equal to the real and imaginary parts, respectively, of the fractional error in transfer function. The one exception to this, as noted in Section 53, is in the case of the uncompensated DAC transfer function, where the gain error is not simply the real part of the fractional error in transfer function.

Table 5.1

Summary of Compensator Formulas and Combined Compensator-DAC Transfer

Function Errors for Sinusoidal Input Data Sequences

 

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image120.jpg

 

 

5.7 Effect of Integration Errors for Compensation Formulas Using  C:\Users\portman\Documents\Chapter 5 Nuance_files\image121.png

In deriving the formulas in Table 5.1 for combined compensator-DAC transfer function errors, we assumed that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image122.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image123.png  for a sinusoidal data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image002.png . In fact, when r is determined by numerical integration of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png , which will always be true in a digital simulation for which r is a state variable,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  is actually related to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png  by the transfer function  C:\Users\portman\Documents\Chapter 5 Nuance_files\image124.png  of the numerical integrator. In Chapter 3 we derived both exact and approximate formulas for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image124.png  for a number of numerical methods. In particular, we determined in Eq. (3.37) the following general form for the integrator transfer function:

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image125.png

or

C:\Users\portman\Documents\Chapter 5 Nuance_files\image126.png

 

(5.45)

 

It follows that

(5.46)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image127.png

 

 

 

5-14

 

Thus  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  should be replaced by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image128.png  , not simply  C:\Users\portman\Documents\Chapter 5 Nuance_files\image129.png , in deriving formulas for the DAC-compensator transfer function  C:\Users\portman\Documents\Chapter 5 Nuance_files\image130.png , where  C:\Users\portman\Documents\Chapter 5 Nuance_files\image131.png  can be expressed in either the exact or approximate form for any given integration algorithm. For example, Eq. (5.23) for the compensator transfer function based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image003.png , and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  is then replaced by

(5.47)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image132.png

 

Then the combined compensator-DAC transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image059.png  becomes

(5.48)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image133.png

 

Eq. (5.48) is exact. When the approximate representation of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image131.png  is used, the formula becomes

(5.49)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image134.png

 

If the order k of the integration algorithm is equal to or greater than the order of the compensator algorithm, which here is 2, then the approximate formula for the combined compensator-DAC transfer function can be written as

(5.50)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image135.png

 

 

The first term on the right side of Eq. (5.50) agrees exactly with Eq. (5.24) and represents the combined compensator-DAC transfer function when the dynamic error associated with the numerical integration of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r is not taken into account. The second term on the right side of Eq. (5.50) represents the contribution of the integrator error to the overall compensator-DAC transfer function error. To illustrate, consider the case where the AB-2 algorithm is used to integrate  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r. Substituting Eq. (3.35) for the AB-2 integrator transfer function into Eq. (5.48), we obtain the following formula for the exact transfer function of the combined compensator-DAC:

(5.51)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image136.png

 

Noting that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image137.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image138.png  for AB-2 integration and using Eq. (5.25) to represent the first term on the right side of Eq. (5.50), we obtain the following approximate formula for the combined compensator-DAC transfer function:

(5.52)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image139.png

 

or

C:\Users\portman\Documents\Chapter 5 Nuance_files\image140.png

 

(5.53)

Comparison with Eq. (5.25) shows that the dominant gain error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image141.png , has not been changed as a result of including the dynamics of the AB-2 integrator in the analysis, but the phase error of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image142.png  has changed from  C:\Users\portman\Documents\Chapter 5 Nuance_files\image143.png  to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image063.png . If we had used the RTAM-2 algorithm instead of AB-2 in integrating  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r, where from Table 3.1 on page 85 we see that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image144.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image138.png , then the phase error of the combined compensator-DAC transfer function is approximately equal to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image145.png  or  C:\Users\portman\Documents\Chapter 5 Nuance_files\image141.png . The approximate gain error remains equal to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image141.png .

 

As another example, consider DAC compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png , as described in Section 5.5.4. Replacing  C:\Users\portman\Documents\Chapter 5 Nuance_files\image146.png  in Eq. (5.37) with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image147.png , we obtain the following formula for the combined compensator-DAC transfer function:

(5.54)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image148.png

 

If the order k of the integration algorithm is equal to or greater than the order of the compensator algorithm, which here is 3, then the approximate formula for the combined compensator-DAC transfer function can be written as

(5.55)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image149.png

 

Again, the first term on the right side of Eq. (5.55) agrees exactly with Eq. (5.37) and represents the combined compensator-DAC transfer function when the dynamic error associated with the numerical integration of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain  C:\Users\portman\Documents\Chapter 5 Nuance_files\image150.png  is not taken into account. The second term on the right side of Eq. (5.55) represents the contribution of the integrator dynamic error to the overall compensator-DAC transfer function error. To illustrate, consider the case where the AB-3 algorithm is used in integrating  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain  C:\Users\portman\Documents\Chapter 5 Nuance_files\image150.png . From Eq. (3.71) it is apparent that the AB-3 integrator transfer function for sinusoidal inputs is given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image151.png .  Substitution into Eq. (5.55) leads in this case to the following formula for the exact transfer function of the combined compensator-DAC when the compensation is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png  and the integration of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r is accomplished with AB-3 integration:

(5.56)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image152.png

 

Noting that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image153.png  and k =3 for AB-3 integration and using Eq. (538) to represent the first term on the right side of Eq. (5.50), we obtain the following approximate formula for the combined compensator-DAC transfer function:

(5.57)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image154.png

 

Comparison with Eq. (5.38) shows that the dominant phase error,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image155.png , has not been changed as a result of including the dynamics of the AB-3 integrator in the analysis, but the phase error of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image142.png  has changed from  C:\Users\portman\Documents\Chapter 5 Nuance_files\image156.png  to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image157.png  a substantial increase. The calculation of the approximate gain error for DAC-compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image066.png ,  when using an algorithm other than AB-3 for integrating  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r only requires substitution of the appropriate values for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image158.png  and k into Eq. (5.55).

 

As a final example we consider DAC compensation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image159.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image109.png , as described in Section 5.5.4. Replacing  C:\Users\portman\Documents\Chapter 5 Nuance_files\image146.png  in Eq. (5.43) with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image147.png , we obtain the following formula for the transfer function of the combined compensator:

(5.58)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image160.png

 

Once again, if the order k of the integration algorithm is equal to or greater than the order of the third-order compensator algorithm used here, then the approximate formula for the combined compensator-DAC transfer function can be written as

C:\Users\portman\Documents\Chapter 5 Nuance_files\image161.png

(5.59)

 

For the case where the AB-3 algorithm is used in integrating  C:\Users\portman\Documents\Chapter 5 Nuance_files\image110.png  to obtain r the following formula for the exact transfer function of the combined compensator-DAC when the compensation is based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image109.png  is obtained

(5.60)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image162.png

 

Following the same procedure used above to derive Eq. (5.56), we obtain the following formula for the approximate compensator-DAC transfer function:

(5.61)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image163.png

 

Comparison with Eq. (5.44) shows that the dominant phase error, proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image142.png , is unchanged by including the AB-3 integrator dynamics, but the gain error, proportional to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image164.png , is different, which is as expected.

 

5.8 Compensator-DAC Gain Errors for C:\Users\portman\Documents\Chapter 5 Nuance_files\image165.png 

The asymptotic formulas for transfer function gain and phase errors, as derived above for the various compensator algorithms, are, of course, only valid for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image049.png , where  C:\Users\portman\Documents\Chapter 5 Nuance_files\image166.png  is the frequency and h is the step size. In each case we also derived exact transfer function formulas, i.e., those given in Eqs. (5.9), (5.20), (5.31), (5.50), (5.56) and (5.60). From the magnitude of the complex number represented by each transfer function we can calculate the exact transfer function gain. For all five schemes, as well as the uncompensated case, plots of the exact  C:\Users\portman\Documents\Chapter 5 Nuance_files\image167.png   versus  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png  are shown in Figure 5.8 for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png  up to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image169.png , which corresponds to the sample frequency of the data sequence. Note the substantial peaking at about one-half the sample frequency when the compensation is based on either  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image107.png , or  C:\Users\portman\Documents\Chapter 5 Nuance_files\image106.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image170.png .  This could conceivably cause difficulties in a hardware-in-the-loop simulation in the unlikely case that the digital computer output driving the DAC contains significant components in this frequency regime.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image171.jpg

Figure 5.8. Combined compensator-DAC gain versus frequency.

 

5.9 Use of Multi-rate DAC Outputs to Improve Dynamic Performance

Up to this point all of our discussion of D to A converters has assumed that the DAC’s themselves are zero-order extrapolators. This means that the DAC output remains at its present value until updated to a new value with the next digital data-sequence input. This is clearly evident in Figure 5.7. It is possible to add additional analog circuitry to each DAC to convert it to a first-order extrapolator. This means that the DAC produces an analog output which is a linear extrapolation based on the current and past data sequence input values. As we have seen in Section 5.4, this has the potential of significantly reducing dynamic errors associated with the D to A conversion process, especially for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image172.png .  However, first-order extrapolation is accomplished at the expense of added analog complexity and is generally not used in practice. In this section we show how comparable or better improvement in performance can be achieved using multi-rate inputs to zero-order extrapolating DAC’s. The multi-rate inputs are generated using the digital extrapolation algorithms described and analyzed in Chapter 4.

 

For example, consider the generation of a multi-rate DAC input using extrapolation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image173.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image174.png . As in Section 4.2, we define the extrapolation time interval as  C:\Users\portman\Documents\Chapter 5 Nuance_files\image175.png , where a is a dimensionless constant and h is the time-step size. From Eq. (4.2) the extrapolation formula is given by

(5.62)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image176.png

 

Using Eq. (5.62), we will now define an equally-spaced sequence of N data-points over the interval  C:\Users\portman\Documents\Chapter 5 Nuance_files\image177.png  in order to drive a multi-rate DAC. The N DAC inputs over the nth frame will occur at  C:\Users\portman\Documents\Chapter 5 Nuance_files\image178.png .  In order to compensate for the half-step delay inherent in the zero-order DAC, the data sequence values driving the DAC over the nth frame are advanced in time by one-half of the fast frame period, i.e.,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image179.png . This means that the N DAC inputs are actually provided at  C:\Users\portman\Documents\Chapter 5 Nuance_files\image180.png , respectively.  For N = 4 (4 DAC updates per slow frame) Figure 5.9 shows the resulting DAC output for a portion of an input sinusoidal cycle with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png  = 0.25. Figure 5.10 shows the result for N = 10. As N becomes large, it is clear that the multi-rate DAC output will approach the continuous (i.e., analog) output associated with a DAC that uses first-order rather than zero-order extrapolation.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image181.jpg

Figure 5.9. Multi-rate DAC output for = 4 based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image182.png

 

The accuracy of the fast data sequence used to drive the DAC’s can be further improved by using formulas based on quadratic rather than linear extrapolation. For example, we can base the extrapolation on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image183.png , and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image184.png . In this case the quadratic curve passes through the data points  C:\Users\portman\Documents\Chapter 5 Nuance_files\image173.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image174.png , and matches the slope  C:\Users\portman\Documents\Chapter 5 Nuance_files\image184.png  at  C:\Users\portman\Documents\Chapter 5 Nuance_files\image185.png .  We have seen in Eq. (4.28) that the extrapolation formula is then given by

(5.63)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image186.png

 

Figure 5.11 shows the resulting multi-rate DAC output with N = 10 when the slow data sequence again is a portion of a sinusoidal cycle with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png  = 0.25. Comparison with Figures 5.9 and 5.10 demonstrates the additional accuracy obtained by using quadratic instead of linear extrapolation to obtain the multi-rate DAC output.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image187.jpg

Figure 5.10. Multi-rate DAC output for N = 10 based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image188.png ,

 

The dynamic error of the DAC output in Figure 5.11 can be estimated by adding the error associated with the multi-rate data sequence to the error associated with the zero-order DAC. From Table 43 we see that the dominant error in the multi-rate data sequence when using extrapolation based on  C:\Users\portman\Documents\Chapter 5 Nuance_files\image183.png , and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image184.png  is the phase error  C:\Users\portman\Documents\Chapter 5 Nuance_files\image189.png , which is equal to 0.0972 C:\Users\portman\Documents\Chapter 5 Nuance_files\image190.png  for an input sinusoid of frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png , sample-period h, and a frame multiple of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png . For N = 10 the result will be very nearly the same as for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png . With  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png  = 0.25, as in Figure 5.11, it follows that the phase error  C:\Users\portman\Documents\Chapter 5 Nuance_files\image193.png  radians. From Table 4.3 the fractional gain error is given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image194.png . To these errors in the fundamental component of the multi-rate data sequence used to drive the DAC we must add the dynamic error of the zero-order DAC. Because the half-frame delay associated with the DAC has been exactly compensated by advancing in time the multi-rate DAC input by 0.5h/N seconds, there will be no phase error associated with the DAC itself. Since the sample period associated with the DAC is h/N, we see from Eq. (5.11) that the DAC gain error  C:\Users\portman\Documents\Chapter 5 Nuance_files\image195.png . Thus the total gain error in the DAC output in Figure 5.11 is given approximately by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image196.png , whereas the phase error is approximately equal to 0.0015 radians. If the DAC had been driven directly by the sinusoidal data sequence with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image168.png = 0.25 instead of the multi-rate data sequence (N = 10) with a half-frame lead, we see from Eq. (5.11) that the gain error would be  C:\Users\portman\Documents\Chapter 5 Nuance_files\image197.png  and the phase error would be – (0.25)/2 = – 0.125 radians. The accuracy improvement obtained by using the multi-rate DAC output with a half-frame advance is very apparent, especially in the phase error.

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image198.jpg

Figure 5.11. Multi-rate DAC output for N = 10 based on C:\Users\portman\Documents\Chapter 5 Nuance_files\image199.png

 

5.10 Dynamics of Analog-to-digital Conversion

When a real-time digital simulation requires inputs from physical systems with continuous (analog) outputs, then conversion of the continuous signals to digital data sequences is required. This is accomplished for each continuous input by means of an ADC (analog-to-digital converter). Each ADC requires a finite conversion time, usually short compared with the interval h between samples. Sometimes a single ADC is used for a number of analog input channels, in which case a multiplexer switch much be used to connect the ADC to successive input channels. Under these circumstances it is necessary to buffer each analog channel with a sample-hold circuit if time skew is to be avoided. Then all of the analog channels can be sampled simultaneously and held at their sampled value while the multiplexed ADC successively converts each signal to digital form.

 

With the advent of low-cost, monolithic ADC’s, it is now common to assign one ADC to each analog channel, so that all conversions can proceed in parallel. Even in this case, however, a sample-hold circuit may be desirable so that the converted digital data in a given frame represents all analog signals samples at a common time.

 

In this section we will examine the frequency spectrum which results when a continuous signal is sampled at a fixed rate. Consider the continuous signal f(t) shown in Figure 5.12a. Assume that f(t) is sampled every h seconds using a switch that is closed for ah seconds, where 0 < a < 1 and a represents the duty cycle of the switch. Then the sampled signal f*‘(t) results, as shown in Figure 5.12b. We can represent f*(t) as follows:

(5.64)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image200.png

 

where the switch function S(t), shown in Figure 5.12c, is given by

(5.65)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image201.png

 

For a =1 the sampling process is continuous. As  C:\Users\portman\Documents\Chapter 5 Nuance_files\image202.png  the sampling operation becomes instantaneous. For finite a we can expand the switch function in a Fourier series. Thus we let

(5.66)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image203.png

 

Where  C:\Users\portman\Documents\Chapter 5 Nuance_files\image204.png , the sample frequency in radians per second. The Fourier coefficients are given by the formula

(5.67)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image205.png

 

From Eq. (5.65) we have

C:\Users\portman\Documents\Chapter 5 Nuance_files\image206.png

or

(5.68)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image207.png

 

For  C:\Users\portman\Documents\Chapter 5 Nuance_files\image208.png , i.e.,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image209.png  becomes

(5.69)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image210.png

 

Thus for a very short duty cycle a, the Fourier coefficients for the fundamental frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png  and the lower harmonics (k = ± 2, ± 3, etc.,) are all equal approximately to a.

 

Substituting Eq. (5.66) into Eq. (5.64), we obtain

C:\Users\portman\Documents\Chapter 5 Nuance_files\image212.jpg

Figure 5.12  Sampling process

(5.70)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image213.png

 

To obtain the frequency domain representation of f*(t) we take the Fourier transform of f*(t). Thus

C:\Users\portman\Documents\Chapter 5 Nuance_files\image214.png

or

(5.71)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image215.png

 

But the Fourier transform of f(t) is given by

(5.72)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image216.png

 

Thus we can write Eq. (5.70) as

(5.73)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image217.png

 

Eq. (5.73) shows that the spectrum  C:\Users\portman\Documents\Chapter 5 Nuance_files\image218.png  of the sample function f*(t) is the sum of the original spectrum  C:\Users\portman\Documents\Chapter 5 Nuance_files\image219.png  and the original spectrum shifted by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image220.png  . Furthermore, for near instantaneous sampling (<< 1), all the translated spectra will have essentially the same amplitude  C:\Users\portman\Documents\Chapter 5 Nuance_files\image221.png   until k becomes quite large in magnitude.

 

Figure 5.13 shows this result graphically, where for simplicity only the magnitudes  C:\Users\portman\Documents\Chapter 5 Nuance_files\image222.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image223.png  are plotted versus  C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png . Note that for frequencies  C:\Users\portman\Documents\Chapter 5 Nuance_files\image224.png , the spectrum  C:\Users\portman\Documents\Chapter 5 Nuance_files\image222.png  of the continuous signal f(t) “folds back” on itself in the spectrum of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image223.png  of the sample signal f*(t). This means that frequencies in f(t) that are larger than one-half the sample frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png , will show up as frequencies below one-half the sample frequency in f*(t). In fact, a frequency in f(t) equal to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png  will be converted to zero frequency, i.e., a constant offset or bias in f*(t) .

 

This foldback phenomena, called aliasing, can be prevented by passing f(t), the continuous signal, through a low-pass analog filter before sampling. This is an important consideration in interfacing a real-time digital simulation to analog inputs. If the analog signals have significant frequency content above one-half the sample frequency, which, for example, would be the case when the analog signals contain high-frequency noise, then the signals should be passed through a low-pass filter before being sampled for A to D conversion.

 

Determining the order and cutoff frequency for the low-pass filter involves a tradeoff. The lower the cutoff frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image225.png , which must be below  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png , the larger the accompanying phase lag. In addition, input components of f(t) with frequencies which are below  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png  but above  C:\Users\portman\Documents\Chapter 5 Nuance_files\image225.png  will be lost. Also, the higher the order n of the low-pass filter, the larger will be the accompanying phase lag for a given  C:\Users\portman\Documents\Chapter 5 Nuance_files\image225.png .  On the other hand, the larger the order n and the lower the cutoff frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image225.png , the higher the attenuation of the unwanted frequencies in f(t) above  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png .

 

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image227.png

Figure 5.13. Frequency spectrum, C:\Users\portman\Documents\Chapter 5 Nuance_files\image228.png, of the continuous signal f(t), and frequency spectrum, C:\Users\portman\Documents\Chapter 5 Nuance_files\image229.png, of the sample signal, f*(t).

 

 

Note that a sinusoidal data sequence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image230.png  can be viewed as a sample function r*(t) derived from a continuous signal  C:\Users\portman\Documents\Chapter 5 Nuance_files\image231.png , where the duty cycle  C:\Users\portman\Documents\Chapter 5 Nuance_files\image202.png . Then the single spectral frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png  contained in f(t) will be transformed in r*(t) to the frequencies  C:\Users\portman\Documents\Chapter 5 Nuance_files\image232.png ,  as shown in Figure 5.14. For those frequencies contained in r*(t), and hence  C:\Users\portman\Documents\Chapter 5 Nuance_files\image230.png , which are greater than  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png , output DAC’s driven by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image230.png  will respond in accordance with the DAC transfer function  C:\Users\portman\Documents\Chapter 5 Nuance_files\image233.png  or the combined compensator-DAC transfer function  C:\Users\portman\Documents\Chapter 5 Nuance_files\image234.png . In the DAC frequency response curves shown in Figures 5.5 and 5.8 the gain was plotted only up to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image235.png , the sample frequency (equivalent to  C:\Users\portman\Documents\Chapter 5 Nuance_files\image236.png ).  Figure 5.14 shows that the sinusoidal data sequence input to the DAC or compensated DAC will also contain frequencies above  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png  to which the DAC will respond. Reference to the various DAC and compensator-DAC gain formulas in Sections 5.3, 5.4 and 5.5 shows that in general the gain falls off with increasing frequency.

 

5.11. Multi-rate Input sampling and Averaging

In the previous section it was noted that frequencies above one-half the sample frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png  of an A to D converter “fold-over” into frequencies below  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png  in the resulting digital data sequence. Since this is in general undesirable, each analog signal is normally passed through a low-pass analog filter with cutoff frequency below  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png . An alternative to passing f(t) through an

C:\Users\portman\Documents\Chapter 5 Nuance_files\image237.jpg

 

Figure 5.14. Spectrum C:\Users\portman\Documents\Chapter 5 Nuance_files\image238.png of a continuous sinusoid of frequency C:\Users\portman\Documents\Chapter 5 Nuance_files\image239.png, and spectrum C:\Users\portman\Documents\Chapter 5 Nuance_files\image240.png  of the sinusoid when sampled at frequency C:\Users\portman\Documents\Chapter 5 Nuance_files\image241.png.

 

analog filter before sampling and A to D conversion is to perform the sampling and A to D conversion at a higher frame rate, one that is an integer multiple N of the original frame rate 1/h. The resulting fast data sequence is turned into a data sequence having the original frame rate by simply averaging every N successive samples to produce a single sample. The multi-rate sampling followed by averaging constitutes a low-pass digital filter. The single filter output for the nth frame is representative of the smoothed input halfway through the frame, i.e.,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png .  The effective time delay of this filter is h/2, where h is the period of the final output data sequence resulting from the A to D conversion process. This is because the algorithm which computes  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png  must wait until all N samples over the interval from t = nh to t = (n+1)h are received in order to compute the average, which then represents the smoothed data value at the midpoint of the nth frame. In this section we analyze the dynamics of the multi-rate sampling and averaging process in order to better understand how it can be used to improve the performance of simulations.

 

We first consider first the case where N = 2, with the samples of the continuous input f(t) taken at t = (n + 1/4)h and (n + 3/4)h. Note that the two samples are taken, respectively, at the midpoint of each of the two equal intervals into which the nth frame has been divided. Then the formula for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png  is given by

(5.74)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image243.png

From the Z transform of Eq. (5.74) we obtain the following formula for the transfer function of the average for  N = 2:

C:\Users\portman\Documents\Chapter 5 Nuance_files\image244.png

(5.75)

Note that there is no phase lag associated with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png , and that the gain error  C:\Users\portman\Documents\Chapter 5 Nuance_files\image246.png  is approximately given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image247.png  for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image172.png . Next consider the case where N = 3, with the samples given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image248.png  and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image249.png .  Again, the samples are taken at the midpoint of each of the three equal intervals into which the nth frame is divided. The averager formula is then given by

(5.76)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image250.png

 

This results in the following transfer function for N = 3

(5.77)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image251.png

 

Again there is no phase lag, and here the gain error is approximately  C:\Users\portman\Documents\Chapter 5 Nuance_files\image252.png . For N = 4 the difference equation is given by

(5.78)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image253.png

 

and the transfer function for N = 4 becomes

 

C:\Users\portman\Documents\Chapter 5 Nuance_files\image254.png

(5.79)

 

For the general case of samples,

(5.80)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image255.png

 

For this general case it can be shown that the approximate formula for the average transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png , is given by

(5.81)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image256.png

 

It is useful to examine the result when the number of samples N averaged over one frame approaches infinity. In this case the average of  f(t) over the interval  C:\Users\portman\Documents\Chapter 5 Nuance_files\image257.png  is given by the following formula:

(5.82)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image258.png

 

To derive the averager transfer function for sinusoidal inputs, we substitute C:\Users\portman\Documents\Chapter 5 Nuance_files\image259.png  into Eq. (5.82) and obtain

C:\Users\portman\Documents\Chapter 5 Nuance_files\image260.jpg

 

from which the averager transfer function for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  is given by

(5.83)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image261.png

 

From Eq. (5.81) it is apparent that as the number N of multi-rate samples increases, the approximate gain error of the averager rapidly approaches the value given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image262.png  for the case where  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  . Reference to Eqs. (5.75), (5.77) and (5.79) confirms this.

 

In Figure 5.15 is shown the exact transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png , versus dimensionless frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image263.png , for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image264.png   and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image265.png . Also shown in the figure is the frequency response of a second-order analog low-pass filter with a damping ratio  C:\Users\portman\Documents\Chapter 5 Nuance_files\image266.png  = 0.707 and a bandwidth of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png , which is typical of the type which might be used to filter the inputs to A to D converters. Note the similarity of the digital transfer functions for different N over the frequency range  C:\Users\portman\Documents\Chapter 5 Nuance_files\image267.png ; up to the basic frame sample frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png , i.e., the output sample frequency of the averaging algorithm, all of the averagers, regardless of N, behave approximately as low-pass filters with a bandwidth of roughly  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png . But for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image268.png  the averager gains for finite N are quite different than the gain for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  , as given in Eq. (5.82) by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image269.png .

 

The characteristics of the digital averaging filters can be better understood by reference to Figure 5.16, where  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  is plotted versus  C:\Users\portman\Documents\Chapter 5 Nuance_files\image263.png  for N = 9, 10, and  C:\Users\portman\Documents\Chapter 5 Nuance_files\image265.png . As in Figure 5.15 we see that up to the sample frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png  the transfer functions are almost identical. But as  C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png  increases beyond  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.pngC:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  for both N = 9 and 10 begins to diverge from  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png . In particular, at  C:\Users\portman\Documents\Chapter 5 Nuance_files\image270.png  the transfer function for N = 9 is back up to unity. Although not shown in the figure,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  for N = 9 will in fact repeat itself for increasing  C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png  with a period of 9 on the dimensionless frequency scale,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image263.png . The reason for this becomes clear when we consider the averaging algorithm of Eq. (5.80) for N = 9. In order to take the Z transform of Eq. (5.80) we must rewrite the difference equation so that all the samples occur at integer step times. This requires using a step size of h/h/9. Then the formula for the transfer function for sinusoidal inputs is obtained from the Z transform by replacing C:\Users\portman\Documents\Chapter 5 Nuance_files\image271.png with  C:\Users\portman\Documents\Chapter 5 Nuance_files\image272.png . The resulting transfer function will then be periodic in the frequency domain, with the period given by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image273.png , or  C:\Users\portman\Documents\Chapter 5 Nuance_files\image274.png .

 

On the other hand, when N = 10, reference to Eq. (5.80) shows that the step size for the algorithm must be given by h/2N = h/20 in order to have all the samples occur at integer step times. This is because the single output per frame h occurs halfway between two input samples when N is even. The resulting transfer function will have a frequency-domain periodicity of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image275.png  or  C:\Users\portman\Documents\Chapter 5 Nuance_files\image276.png  for N = 10. In Figure 5.16 only the first half period of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  for N = 10 is visible.

C:\Users\portman\Documents\Chapter 5 Nuance_files\image277.jpg

Figure 5.15. Transfer function, C:\Users\portman\Documents\Chapter 5 Nuance_files\image278.png, for average of N samples per frame versus dimensionless frequency C:\Users\portman\Documents\Chapter 5 Nuance_files\image279.png, where C:\Users\portman\Documents\Chapter 5 Nuance_files\image280.png sample frequency of frame.

 

We therefore conclude that the gains of the digital averaging algorithms for finite N do not continue to fall off with increasing frequency beyond  C:\Users\portman\Documents\Chapter 5 Nuance_files\image235.png . Even for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  the falloff in  C:\Users\portman\Documents\Chapter 5 Nuance_files\image245.png  for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image224.png  is relatively gradual (gain proportional to 1/ C:\Users\portman\Documents\Chapter 5 Nuance_files\image191.png ) compared with the falloff as  C:\Users\portman\Documents\Chapter 5 Nuance_files\image281.png  of the second-order analog filter in Figure 5.15. Thus we cannot rely solely on a digital filter based on averaging multi-rate input samples to eliminate the aliasing effects for frequencies in the continuous input  C:\Users\portman\Documents\Chapter 5 Nuance_files\image282.png  that are well beyond the basic frame sample frequency  C:\Users\portman\Documents\Chapter 5 Nuance_files\image211.png . A low-pass analog filter prior to either single or multi-rate sampling is still the most effect means for accomplishing this.

 

What the multi-rate averaging filter does do, especially for large N, is reduce the effect of aliasing. It also provides an output  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png  which, when integrated numerically in the simulation of the system for which  C:\Users\portman\Documents\Chapter 5 Nuance_files\image282.png  is the input, gives a much more accurate result than would otherwise

C:\Users\portman\Documents\Chapter 5 Nuance_files\image283.jpg

Figure 5.16. Transfer function, C:\Users\portman\Documents\Chapter 5 Nuance_files\image278.png,  versus dimensionless frequency C:\Users\portman\Documents\Chapter 5 Nuance_files\image279.png for N = 9, 10 and C:\Users\portman\Documents\Chapter 5 Nuance_files\image265.png.

 

be obtained with integration formulas using  C:\Users\portman\Documents\Chapter 5 Nuance_files\image284.png  or   C:\Users\portman\Documents\Chapter 5 Nuance_files\image285.png  as inputs. To understand this we consider the simple state equation  C:\Users\portman\Documents\Chapter 5 Nuance_files\image286.png  when integrated by the following algorithm:

(5.84)    C:\Users\portman\Documents\Chapter 5 Nuance_files\image287.png

 

Taking the Z transform using a step size of h/2, we obtain the following formula for the integrator transfer function:

C:\Users\portman\Documents\Chapter 5 Nuance_files\image288.png

(5.85)

 

Comparison of Eq. (5.85) with Eq. (3.37) shows that the integration algorithm given by Eq. (5.84) is of order  C:\Users\portman\Documents\Chapter 5 Nuance_files\image289.png  with an integrator error coefficient  C:\Users\portman\Documents\Chapter 5 Nuance_files\image290.png . If   C:\Users\portman\Documents\Chapter 5 Nuance_files\image285.png  in Eq. (5.84) is now replaced by  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png  the transfer function of the resulting integration of the averaged samples of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image282.png  to obtain the data sequence representing x will simply be the product  C:\Users\portman\Documents\Chapter 5 Nuance_files\image291.png , which from Eqs. (5.81) and (5.85) is given by

              C:\Users\portman\Documents\Chapter 5 Nuance_files\image292.png

(5.86)

 

From Eq. (5.86) we see that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image291.png  is equal approximately to the ideal integrater transfer function,  C:\Users\portman\Documents\Chapter 5 Nuance_files\image293.png , with an additional gain error of  C:\Users\portman\Documents\Chapter 5 Nuance_files\image294.png . This error becomes very small indeed as the multi-rate input sampling ratio N becomes large. For  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  the error vanishes. This is also evident in Eq. (5.82), which shows that  C:\Users\portman\Documents\Chapter 5 Nuance_files\image295.png  for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  simply the area under f(t) over the integration frame. Thus when  C:\Users\portman\Documents\Chapter 5 Nuance_files\image242.png  for  C:\Users\portman\Documents\Chapter 5 Nuance_files\image192.png  replaces  C:\Users\portman\Documents\Chapter 5 Nuance_files\image285.png  in Eq. (5.84), the next state  C:\Users\portman\Documents\Chapter 5 Nuance_files\image296.png  is simply the current state  C:\Users\portman\Documents\Chapter 5 Nuance_files\image297.png  plus the area under the f(t) versus t curve over the nth time frame.

 

For those components of f(t) with frequencies beyond  C:\Users\portman\Documents\Chapter 5 Nuance_files\image226.png , the state equation with f(t) as the input will indeed often behave approximately as a simple integrator. For example, this will typically be the case when f(t) represents an input acceleration to a mechanical dynamic system, in which case x represents the velocity state in the equation  C:\Users\portman\Documents\Chapter 5 Nuance_files\image286.png . Under these conditions the integration accuracy represented by Eq. (5.86) is actually realized when using multi-rate input sampling and averaging.