State of Op-Amps

The questions below are due on Friday November 15, 2024; 05:00:00 PM.
 
You are not logged in.

Please Log In for full access to the web site.
Note that this link will take you to an external site (https://shimmer.mit.edu) to authenticate, and then you will be redirected back to this page.

Connecting Transfer Functions to State Space: An op-amp example.

The operational amplifier, or the op-amp for the cognosenti, was an early, and remarkably successful, application of continuous-time control theory, and an essential component in most control systems. The first op-amp was introduced more than 80 years ago (using vacuum tubes), the modern op-amp (the 741, an integrated circuit) was introduced more than 50 years ago, and 20 years ago, at the end of the 20th century, the electronics industry consumed five billion op-amps a year. So, the op-amp has a well-deserved place in control theory's history, and is discussed in nearly every introductory class on control.

If op-amps are so important, why haven't we mentioned them earlier? The main reason is that fast microcontrollers, which can run sophisticated DT control algorithms, have displaced the use of op-amp-based CT controllers in all but the very highest frequency applications. For example, we used to have students implement a lead controller using an op-amp, three resistors, and a capacitor, but it is much easier for students to implement using a DT approximation on the Teensy.

Op-amps continue to play an extremely important role in signal processing, because an op-amp, plus a few resistors and capacitors, can implement a wide range of filters and amplifiers. But all those circuits rely on feedback principles, so one should learn a little about op-amps.

A little about op-amps

To understand op-amp theory, recall that when we started discussing continuous time, our first feedback example was the speed control problem. And we saw that when using proportional feedback, we could use any positive proportional gain, and the system would be stable. More precisely, suppose

\frac{d}{dt} \omega_m(t) = - \beta \omega_m(t) + \gamma u(t),

where \omega_m(t) is motor speed, \beta is a friction coefficient, u(t) is a control input, and \gamma is a scaling coefficient. Then if u(t) proportional to the difference between the desired (\omega_d(t)) and measured motor speed,

u(t) = K_p \left(\omega_d(t) - \omega_m(t) \right),

where K_p is the proportional gain, then

\frac{d}{dt} \omega_m(t) = -(\gamma K_p + \beta) \omega_m(t) + \gamma K_p \omega_d(t),

and the response to an input step (\omega_m(0) = 0 and \omega_d(t) = 1 for all t>0) is a rising exponential

\omega_m(t) = \frac{\gamma K_p}{\gamma K_p + \beta} \left(1 - e^{-(\gamma K_p + \beta)t}\right)

and in steady state (given \omega_d(t) = 1 for all t > 0),

\omega_m(\infty)= \frac{\gamma K_p}{\gamma K_p + \beta},

What we discovered is that for first-order CT systems, we can make the proportional feedback gain as large as we want, and the system will just get faster and more accurate. And the step response never overshoots!

A typical high-gain op-amp

Consider a nearly ideal op-amp whose transfer function from input difference (V_+ - V_-) to output voltage V_o is given by

V_o(s) = H_{OPAMP}(s) (V_+(s) - V_-(s)) = \frac{10^6}{s+1} (V_+(s) - V_-(s)).

If we use what is usually referred to as non-inverting configuration, using resistors R_1 and R_2 to create the feedback network. This op-amp may be modeled using a feedback block diagram, with a 'forward-path' given by H_{OPAMP}(s) and a 'feedback path' scaled by a factor f.

This is not our usual tracking configuration, because the output is scaled by f before comparing to the input, but this form is more natural when describing operational amplifier circuits. To analyze this case, we know that based on how the circuit elements are connected,

V_{+} = V_{in}, \; \; \; V_{-} = f V_{out}
where f is LESS than one, and is determined by the resistor divider network.

The operational amplifier's output voltage, V_{out}, is determined by the product of its transfer function and the differential input voltage,

V_{out} = H_{OPAMP}(s) (V_{+} - V_{-}),
as is also shown in the block diagram above.

Combining,

V_{out} = H_{OPAMP}(s) (V_{in} - f V_{out}),
resulting in a variant of Black's formula,
V_{out} = \frac{H_{OPAMP}(s)}{1+f H_{OPAMP}(s)} V_{in}.
where we have put the s back in the the equation to remind ourselves that we have a tranfer function with a frequency response. Note that
V_{out} \approx \frac{1}{f} V_{in}.
when |H_{OPAMP}(s)| >> 1.

In the following examples, we we generate state-space models of op-amp circuits, in order to gain a better understanding of the relationship between state-space and the classical transfer function approach to control.

A low-gain op-amp example.

Consider the non-inverting amplifier using an op-amp as in the circuit below.

In the non-inverting op-amp circuit, with primary input, v_{in}(t), and observed output, v_{out}(t), the closed-loop gain steady-state gain is

\text{Closed loop gain} = \frac{v_{out_{ss}}}{v_{in_{ss}}} \approx 1+\frac{R_f}{R_{in}},
where we say "approximately" because the formula is only exact if the op-amp has infinite open-loop gain.

When we represent the non-inverting amplifier op-amp circuit using block diagrams, we use Laplace transforms to convert dynamics into transfer functions, and organize the feedback structure by separating the open loop gain stage from the subtraction stage. That is, we introduce

V_+ = V_{in},
V_{diff} = V_+ - V_{-},
and
V_{out} = H(s) V_{diff},
as in the diagram below.

As an example, suppose R_f = R_{in}, then

1 + \frac{R_f}{R_{in}} = \frac{R_{in} + R_f}{R_{in}} = 2,
and f, as in the above diagram, is given by
f = \frac{V_{-}}{V_{out}} = \frac{R_{in}}{R_{in} + R_f} = \frac{1}{2}.

If we have an ideal op-amp, then the non-inverting amplifier gain, \frac{V_{out}}{V_{in}}, will be equal to two. If we have a lousy op-amp, one with a steady-state gain of only 20, then the noninverting gain will be less than two. In particular, if the op-amp's transfer function, H(s), is given by

H(s) = \frac{V_{out}}{V_{diff}} = \frac{20}{s+1},
then the closed-loop transfer function, G(s), is given by
G(s) = \frac{V_{out}}{V_{in}} = \frac{H(s)}{1 + f H(s)} = \frac{20}{s+11}.
To determine the steady-state closed-loop gain, we evaluate G(s) at s =0. For this case, the gain is \frac{20}{11} = 1.8182, significantly below the ideal case closed-loop gain of two.

By adding a resistor divider between v_{in} and v_+, we could convert the approximate gain-of-two amplifier into an exact gain-of-one amplifier, but to do so, we would need to know the op-amp's exact transfer function (at least in steady-state). Such a strategy for designing a gain-of-one amplifier might not be particularly practical, but examining the strategy using a state-space approach will help clarify the roles of the matrices and vectors involved, and provide a concrete example of the often-confusing role of K_r.

The Generic State-Space Feedback System.

We can also describe the non-inverting amplifier circuit using a state-space model. The generic form of the state-space model using \textbf{E}, \textbf{A}, \textbf{B}, and \textbf{C} matrices is

\textbf{E} \frac{d}{dt} \textbf{x} = \textbf{A}\textbf{x}(t) + \textbf{B} u(t)
and
y(t) = \textbf{C} \textbf{x}(t),
or after Laplace transformation,
s \textbf{E} \textbf{X}(s) = \textbf{A}\textbf{X}(s) + \textbf{B} U(s)
and
Y(s) = \textbf{C} \textbf{X}(s).

Reorganizing the transformed state-space model to more easily recognize the transfer function from the "plant" input, \textbf{U}(s), (distinct from the primary input r(t)) to the state, \textbf{X}(s), we get

\textbf{X}(s) = \left( s\textbf{E} - \textbf{A} \right)^{-1} \textbf{B} U(s)
and
Y(s) = \textbf{C} \textbf{X}(s).
Applying state feedback to the state-space system yields the block diagram below, where \textbf{K} is the state feedback gain and K_r is the scaling of the primary input, r.

State-space for Op-amps

How do we connect the block diagram for the op-amp to the block diagram for the state-space system? Let us consider a specific example, and suppose that the operational amplifier's open loop gain is given by

H(s) = \frac{1000}{s+2}
and that
R_f = 3 R_{in}.
If we write the differential equation for v_{out}(t) in terms of v_{diff}(t),
\frac{d}{dt} v_{out}(t) + 2v_{out}(t) = 1000 v_{diff}(t),
where
v_{diff}(t) = v_{+}(t) - v_{-}(t),
v_+(t) = v_{in}(t),
and for the given resistor ratio,
v_-(t) = 0.25 v_{out}(t).
To construct a state-space representation of this closed-loop op-amp circuit, suppose we choose to associate the state-space u with the op-amp voltage v_{diff}, then what are the state-space matrices?

For this op-amp example, all the associated state-space matrices are 1 \times 1 (scalars), so we need only determine those scalar values. And in this case, we have NOT computed a K_r to ensure unity steady-state gain. Instead, we are stuck with the K_r that models the circuit. In fact, since v_{+} = v_{in}, K_r = 1 in this case. Also, we can assume that the observed output, y, is equal to v_{out}, so \textbf{C} = 1.

The remaining matrices can then be determined by matching the generic state-space model with the op-amp circuit, please determine \textbf{E}, \textbf{A}, \textbf{B}, and K to complete the model. Note, since the matrices are 1x1 in this case (scalars), give your answers as scalar numbers (For example, use 1 and NOT [1] or [[1]]).

\textbf{E}=

\textbf{A}=

\textbf{B}=

K=

Focusing On Kr

When we modeled the non-inverting amplifier circuit, K_r had to be equal to one because v_{+} = v_{in}. But suppose we insert a resistor divider between v_{in} and v_{+}, as in the diagram below.

We can use the divider to scale v_{in} and thereby change K_r. Suppose we want to select a K_r so that the closed-loop transfer function from input to output,

\frac{V_{out}(s)}{V_{in}(s)} = C\left(sE-(A-BK)\right)^{-1}B K_r
is exactly one in steady state. At s = 0 (for steady-state),
\frac{V_{out_{ss}}}{V_{in_{ss}}} = -C\left(A-BK\right)^{-1}B K_r = 1,
or
K_r = -\frac{1}{C\left(A-BK\right)^{-1}B},

where we can use fraction notation since K_r is a scalar.

The non-inverting op-amp circuit with R_f = 3 R_{in} implies the circuit was designed to have a steady-state gain of four, but by changing K_r, we can achieve other steady-state gains, including EXACTLY unity. And since we can pick R_1 and R_2 in the above circuit to set K_r, without altering \textbf{E}, \textbf{A}, \textbf{B}, and \textbf{C}, the values for the divider resistors are easily computed.

What is the EXACT value of K_r = \frac{R_2}{R_1 + R_2} so that the steady-state gain is EXACTLY one (K_r is approximately, but NOT EXACTLY, 0.25)!

R_2/(R_1+R_2) =

What is the value of K_r so that the steady-state gain is EXACTLY FOUR (K_r is almost, but NOT EXACTLY, 1)!

K_r =

Check Yourself 1:

Can you implement a K_r to get a steady state gain of EXACTLY four using a resistor divider on the input (No, do you see why)?

And what about the Pole?

When K = 0.25, where is the pole of the closed-loop op-amp system?

pole =

If we made K = 10, where is the pole of the closed-loop op-amp system? And for K=10, what value of K_r will give us a steady-state closed-loop gain of EXACTLY one?

pole for K=10

K_r at K=10

So, if we use a feedback gain of 10, meaning V_{-} = 10 V_{out}, the above op-amp model suggests we can make the closed-loop pole far more negative, and therefore get step responses that are much faster. Though, to maintain a steady-state closed-loop gain of one, we will also have to scale the primary input, v_{+} \approx 10 v_{in}, or K_r \approx 10. If we want a gain-of-one non-inverting amplifier to be ten times faster, we need two extra gain-of-ten amplifiers, hardly a practical trade-off. And if the op-amp's transfer function is more complicated, stability issues will also interfere (see the next example).

Check Yourself 2:

When we implement state feedback using microcontroller, we sense the states and then compute u = K_r r - K x where x is the sensed state and r is the primary input. For example, r could be the desired propeller arm angle, the elements of the vector \textbf{x} could be the sensed angle, the sensed rotation rate, and the sensed propeller speed. The gains we multiply each of these sensed states by are much larger than one, but we do not even think about it. When we use a microcontroller to perform state feedback, we do not need an extra amplifiers whenever we want to scale a state by more than one. This simple observation is a big part of why the proliferation of inexpensive microcontrollers has dramatically increased the popularity of state-space controllers.

Three-Pole Op-amp Example in State-Space

Suppose the op-amp has an open-loop gain with the transfer function

\frac{V_{out}(s)}{V_{diff}(s)} = H(s) = \left(\frac{200}{s+200}\right) \left(\frac{20}{s+20}\right)\left(\frac{1000}{s+2}\right).
For the non-inverting amplifier configuration, what is the smallest integer value for
G_{ideal} = \frac{R_{f} + R_{in}}{R_{in}}
(the formula for the closed-loop gain in the IDEAL op-amp case) such that the system has a phase margin of 45 degrees, and when using those resistor values, what is the real part of the least stable pole and what is the actual closed-loop steady-state gain.
Lowest Gideal for 45 degrees phase =

Real part of least stable pole

Actual Steady-State Gain

We can model this more complicated op-amp in state-space, and a simple way to derive the state-space model is to introduce a few auxillary variables. We define

V_3(s) = \frac{1000}{s+2} V_{diff}(s),
and
V_2(s) = \frac{20}{s+20} V_3(s).
Then V_{out}(s) is given by
V_{out}(s) = \frac{200}{s+200} V_2(s) = \left(\frac{200}{s+200}\right)\left(\frac{20}{s+20}\right) V_3(s) = \left(\frac{200}{s+200}\right)\left(\frac{20}{s+20}\right)\left(\frac{1000}{s+2}\right) V_{diff}(s).
We can then write a series of differential equations,
\frac{d}{dt} v_{out}(t) = -200 v_{out}(t) + 200 v_{2}(t)
\frac{d}{dt} v_{2}(t) = -20 v_{2}(t) + 20 v_{3}(t)
\frac{d}{dt} v_{3}(t) = -2 v_{3}(t) + 1000 v_{diff}(t).

What are the state-space matrices for our three-pole op-amp model, assuming x_1 = v_{out}, x_2 = v_2 and x_3 = v_3, and that we assign u = v_{diff} and y = v_{out}. Enter the \textbf{E}, \textbf{A} \textbf{B}, and \textbf{C} matrices below for the state space representation, (Remember to use Python form, so if \textbf{C} is \begin{bmatrix}1&15\end{bmatrix}, you should enter [[1,15]], and for a column vector, like \textbf{B}, you should enter [[1],[15]].)

\textbf{E}=

\textbf{A}=

\textbf{B}=

\textbf{C}=

Check Yourself 3:

Why are the poles of the open-loop state-space system equal to the diagonals of the \textbf{A} matrix? The poles of the open-loop system are the eigenvalues of \textbf{E}^{-1}\textbf{A} = \textbf{A}, since \textbf{E} is the identity matrix. And since \textbf{A} is triangular, its eigenvalues are its diagonal entries.

The Three Feedback Gains

For the non-inverting amplifier op-amp circuit, you determined the smallest integer value of G_{ideal} = \frac{R_{f} + R_{in}}{R_{in}} so the amplifier would have a phase margin of 45 degrees. Note that G_{ideal} would be the closed-loop gain if the op-amp had been ideal, and in terms of G (shorthand for G_{ideal}), what is an expression for the ratio

\frac{V_{out_{ss}}}{V_{-_{ss}}}?
Steady-State ratio V_{\textrm{out}_{ss}}/V_{{-}_{ss}} =

The state-space model derived above can describe a non-inverting amplifier with ideal-op-amp closed-loop gain of G, provided feedback gains are chosen appropriately. Assuming G is still the smallest integer such that the closed-loop system has 45 degrees of phase margin, what are the feedback gains K_1, K_2 and K_3 for the state-space model of that non-inverting amplifier? And, what is the closed-loop system matrix, \textbf{A-BK}.

K_1

K_2

K_3

\textbf{A-BK}

Notice the location of the non-zero value associated with the one nonzero component of K. Does the change in one location of \textbf{A-BK} cause a change in all the eigenvalues, or only one?

How many eigenvalues of \textbf{A-BK} are different from the eigenvalues of \textbf{A}?

Check Yourself 4:

Notice that the matrix \textbf{A-BK} is not triangular, thanks to the fact that (A-BK)_{3,1} \ne 0. Therefore, the poles are no longer equal to the matrix diagonals.

With the above gains, what value of K_r will give us a steady-state closed-loop gain of EXACTLY one?

K_r =

If we can feedback a weighted combination of all three states, we can achieve far faster response times. Using Matlab's place command, find values for K_1, K_2 and K_3 so that the poles of the closed-loop state-space system are -100, -110 and -120. Additionally find the value of K_r so that the steady-state gain is exactly one.

K_1

K_2

K_3

K_r

And what is the associated \textbf{A-BK}?

\textbf{A-BK}

Notice that it was not necessary to use very large gains to produce a dramatic improvement in performance. The performance was achieved by observing all the states in the system, and then acting on that collection of information. With classical control, the feedback was based on a single state (the output in this case), and the results were much poorer.

A quick trick of zero value for E

Suppose the open-loop transfer function for the op-amp gain had a zero, that is, suppose

\frac{V_{out}(s)}{V_{diff}(s)} = H(s) = \left(\frac{200}{s+200}\right) \left(\frac{5s + 20}{s+20}\right)\left(\frac{1000}{s+2}\right).
Could you update the state-space system above to include the zero by only changing E? And if so, what would that change be?

\textbf{E}=

We have used matlab's place command to determine the gains needed to place the closed-loop poles in specified locations. But to use the place command, the system has to be converted to "normal form",

\frac{d}{dt} \textbf{x} = \textbf{A}_n\textbf{x}(t) + \textbf{B}_n u(t),

or equivalently, \textbf{E}_n matrix has to be the identity. What are \textbf{A}_n and \textbf{B}_n for our three-state system?

\textbf{A}_n=

\textbf{B}_n=

Find values for K_1, K_2 and K_3 so that the poles of this new closed-loop state-space system are -100, -110 and -120, and find the value of K_r so that the steady-state gain is exactly one.

K_1

K_2

K_3

K_r

Could you have guessed how the K's would change after including a single zero in the transfer function? We could not.