Appendix A: Discrete-Time Simulation of Feedback Loops

Consider two transfer functions arranged in a feedback loop as shown below

By the methods described in previous sections we can determine the following two recurrence formulas for the two individual transfer functions:

yn = c1 yn-2 + c2 yn-1 + c3 wn-2 + c4 wn-1 + c5 wn(A1)

zn = f1 zn-1 + f2 yn-1 + f3 yn(A2)

We also have the equation for the summing junction

wn = xn - zn(A3)

Together these three formulas define the dynamic relationship between xn and yn. However, they cannot be executed as written, because the computation of yi by equation (A1) requires the value of wi, and the computation of wi by equation (A3) requires the value of zi, but the computation of zi by equation (A2) requires the value of yi, which is what we are trying to find.

A simple approach to simulating this system would be to approximate the summing junction equation by

wn = xn - zn-1(A4)

In other words, wi would be computed as the current value of x minus the past value of z. However, in some circumstances, especially when x changes rapidly, this approximation can lead to unrealistic and even unstable results.

To overcome this problem it is necessary to "solve" the complete set of loop equations simultaneously. Well first show how this is done for loops in which all the piece-wise relationships are linear functions (as in the preceding example), and then we will show how this approach can be modified to accommodate non-linear functions.

Assuming all the functions in the loop are linear, we re-write equation (A1) for yi, and eliminate all appearances of wi by substituting from equation (A3), which gives

yi = c1 yi-2 + c2 yi-1 + c3 (xi-2 - zi-2) + c4 (xi-1 - zi-1) + c5 (xi - zi)(A5)

The corresponding equation for yi-1 is

yi-1 = c1 yi-3 + c2 yi-2 + c3 (xi-3 - zi-3) + c4 (xi-2 - zi-2) + c5 (xi-1 - zi-1)(A6)

Also, equation (A2) can be written for the times ti-2, ti-1, and ti as follows

zi-2 = f1 zi-3 + f2 yi-3 + f3 yi-2(A7)

zi-1 = f1 zi-2 + f2 yi-2 + f3 yi-1(A8)

zi = f1 zi-1 + f2 yi-1 + f3 yi(A9)

Equations (A5) through (A9) constitute five equations in the five unknowns zi-3, zi-2, zi-1, zi, and yi. Solving these equations simultaneously gives the following recurrence formula for yi:

yi = q1 yi-3 + q2 yi-2 + q3 yi-1 + q4 xi-3 + q5 xi-2 + q6 xi-1 + q7 xi(A10)

where

Now suppose the first-order lead/lag in the above example were replaced by an arbitrary function F of y, that is

zn = F(yn)(A11)

Substituting this into equation (A5) and rearranging terms gives the equation

yi + c5 F(yi) = c1 yi-2 - c3 F(yi-2) + c2 yi-2 - c4 F(yi-1) + c3 xi-2 + c4 xi-1 + c5 xi

(A12)

At each application of this (implicit) recurrence formula we are given the values of yi-2, yi-1, xi-2, xi-1, and xi, so the right side of (A12) can be computed (assuming F is computable). Given this value, which we will denote as Vi, equation (A12) is simply

yi + c5 F(yi) = Vi(A13)

Depending on the form of the function F, this equation may or may not be explicitly solveable for yi. In any case, it can be solved numerically to any desired degree of precision.

If the arbitrary function F is inserted into the feedback loop in series with (rather than in place of) the dynamic function, the resulting set of equations can still be reduced to essentially the same form as (A13). Consider the feedback loop shown below.

By substituting F(yn) for yn in equations (A7), (A8), and (A9), we can solve the five equations (A5) through (A9) for yi to give

yi + (c5 f3) F(yi) = -(f1 c1) yi-3 + (c1 - f1 c2) yi-2 + (c2 + f1) yi-1

- (c3f2) F(yi-3) - (2c5f1f2 + c4f2 + c3f3) F(yi-2) - (2c5f1f3 + c4f3 + c5f2) F(yi-1)

- (c3 f1) xi-3 + (c3 - c4 f1) xi-2 + (c4 - f1 c5) xi-1 + (c5) xi

The right hand side of this equation consists entirely of "given" information. If we call the right hand value Vi then the recurrence formula is

yi + (c5 f3) F(yi) = Vi

As in the case of equation (A13), this equation may or may not be explicitly solveable for yi, but a numerical solution of any desired precision can be computed. Notice that the execution frequency of the algorithm must be high enough so that the values of yn occur close enough together so that the discrete values of F(yn) provide an adequate definition of the acutal function F(y(t)).

Сайт управляется системой uCoz