State of Op-Amps
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
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,
where K_p is the proportional gain, then
and the response to an input step (\omega_m(0) = 0 and \omega_d(t) = 1 for all t>0) is a rising exponential
and in steady state (given \omega_d(t) = 1 for all t > 0),
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
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,
The operational amplifier's output voltage, V_{out}, is determined by the product of its transfer function and the differential input voltage,
Combining,
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
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
As an example, suppose R_f = R_{in}, then
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
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
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
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
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]]).
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,
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)!
What is the value of K_r so that the steady-state gain is EXACTLY FOUR (K_r is almost, but NOT EXACTLY, 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?
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?
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).
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
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
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]]
.)
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
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}.
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?
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?
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.
And what is the associated \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
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",
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?
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.
Could you have guessed how the K's would change after including a single zero in the transfer function? We could not.