In this lecture, I'm going to illustrate how to design the feedback compensator Op-amp circuit, that we specified in the example of the last lecture. I'm going to do this entirely with pen and pencil, on paper here. And, I don't have slides, but my handwritten lecture notes are appended instead to this lecture. So our compensator that, and feedback network from the last lecture was this. We had the output voltage fed back to a gain block h, where h was 1 3rd. That went into a summing node, where it, the fedback signal was subtracted from a reference. And Vref DC component was equal to five volts. This made an error signal that went into a compensator network, having a transfer function G c. And the output of the compensator is the control voltage V c. The G c that we specified was this, G c0 is what we call the gain. Then there was a compensator 0. And there is an inverse, or inverted, zero for the lag or p i compensator. And there was a pull as well. So this has a bode plot that looks like this, and let's see the, the corner frequencies fL we chose to be 500 hertz, fz was 1.7 kilohertz, and fp was 14 kilohertz. [SOUND] This midband gain Gc0 was 3.7 or 11.3 dB. Our job then is to design some analog circuitry, to realize the feedback gain H and the compensator gain Gc, that has these asymptotes. Design is a creative process, that has more than one answer. We rely on our prior knowledge and experience to invent circuits that realize these transfer functions. So, what circuits would be appropriate here? What circuits do we know? First of all, for H, as I have mentioned previously, we usually realize H with a simple voltage divider. And we can divi, design a voltage divider circuit that has, say gain of 1 3rd very easily. So for the voltage divider, we'll put v into the divider network, the output will be H times V. And we'll have 2 divider resistors that are called R1D and R2D. In my notes, so that the transfer function H is the divider ration R2D over R1d plus R2d and that should be equal to 1 3rd. So that is a design equation then that we can use to choose the resistors. Kay, that one was easy. What about the rest of this circuit? We need a subtractor circuit. With some transfer function G c. Do you know any circuits that can do that? [COUGH] Well, a subtractor circuit from basic circuits, we have this kind of op amp circuit, is one well-known way to do it. We'll put a voltage, I'm going to call v minus, into one terminal and v plus into the other terminal and we build an Op-amp circuit that can subtract these voltages. This is a well known, circuit that can do that. In this circuit, if Z1=Z2, then it turns out that Vc is equal to (v+)-(v-). I f Z1 is different than Z2, then we get an added gain factor of Z2/Z1. So one can show from solving this circuit then, that the output voltage Vc of S is equal to Z2 of S over Z1 of S, times the differential input voltage, V-plus minus V-minus. Our job then is to choose Z1 and Z2 to get the compensator gain that we want. And as for V-plus and V-minus what we want is to subtract the fed-back output from the reference. So we can make V-plus equal to the reference. And we can make V-minus equal to the fed-back output voltage H times V. Okay, and Z, 2 over Z 1 then is chosen so that transfer function, or magnitude of Z 2 over Z 1, should have these asymptotes that we wanted for our compensator. Okay, I pulled that circuit just really out of my prior experience, but I hope if you've taken a beginning circuits class, then you've seen circuits like this before. So, what should we choose for these impedances that go into Z1 and Z2? This is a low power signal processing circuit and generally, in such circuits, we try to avoid inductors because they cost more than capacitors. And they're larger, although nowadays, we, we can get pretty inexpensive inductors. But none of the less, we are going to try to choose resistor and capacitor networks for Z1 and Z2. And we would like to add resistors, and capacitors and series and parallel combinations, so that Z2 over Z1 comes out to have this kind of asymptote. So let's consider first. Suppose we have a resister and capacitor that we put into Z2. What is the impedance of Z2 look like, then? I'm going to draw a resister and capacitor impedances just on regular paper here, as if this were semi-log graph paper for a Bode plot. So we know if we had a resistor, you would have a flat asymptote. And with a capacitor, we would have a minus-20 dB per decade. One over omega-c asymptote. And our choices here are, we could use either a series or parallel combination. So if we used a series combination, we take the largest, like this. [SOUND] And if we used a parallel combination we take the smallest, so we get something like that. And if we realize z2 using one of these, then we will get z2 asymptotes that look like one or the other of these. Well the low frequency asymptotes of G or Gc, here and here, in fact have the, the same shape as the series combination. So what we might think of doing then is to use an R in series of c. To get the Fs of L corner frequency for out of Z2. So, so Z2 then, we can start out with some R in series with C. So I will call this R2 and C2. And we'll choose them so that we get this f sub L corner frequency. And f sub L, which we wanted to be 500 hertz, is the frequency where these two asymptotes intersect. So that would be equal to 1 over 2 pi R2C2. That's a good start then for our transfer function. So that gives us the beginning of our transfer function, the first two asymptotes. How do we get the 0 at fz? At 1.7 kilohertz. Well, if we did it inside Z2, we would need to add an asymptote that increased with 20 dB per decade slop, which would be an inductor. We don't want to put inductors in this little low-power compensator network. So instead what we should do is, perhaps think about what happen if we put resistors and capacitors into z1. If we put resistors and capacitors into z1, then its effect on the overall transfer function goes, which goes like 1 over z1, We'll have asymptotes that go, like, 1 over those impedances. So I can draw up the asymptote for 1 over R, and the asymptote for 1 over the capacitor impedence, which is 1 over 1 over omega C, or just omega C. And our asymptotes for 1 over z1 then will be what? Well, if we put the resister in parallel with the capacitor, and then take the smallest asymptote for the parallel combination, one over Z will have the, the largest and we'll, we'll do this. So this is the parallel combination and likewise, if we put r and c in series, we'll take the largest. And then when, the effect on one over Z will be to follow the smaller of these inverse asymptotes. So this is what we'll get in 1 over z 1 when we put r and c in series. Well, we can see that this parallel combination asymptote can give us the kind of asymptotes that we need to realize the 0. A flat asymptote at low-frequency, and the we have a 0 here at this frequency and we'll increase after that. So if we make Z1 be R1 in parallel with C1, and then we make Z2 be R2 in series with C2, so that our Z2 our Z2 asymptote looks like this and our one over Z-1 asymptote. Looks like this. And to multiply z-2 by one over z-1, we simply add the, the asymptotes, or multiply. We, we add the asymptotes on a dB scale or multiply them on a linear scale, and what we'll get I'll draw down here at the bottom. At low frequency, we'll be this asymptote, 1 over c2 times this asymptote, 1 over R1. Which gives us something with a minus 20 dB per decade slope overall. Or 1 over omega C2 R1. At mid frequency, we'll get this asymptote, R2, divided by this asymptote, R1. So we get R2 over R1. And we follow that until we get to the next break frequency right here at fz. After that, we'll follow the R2 asymptote times the omega C1 asymptote, and we'll get this. So that would be r 2 times omega c one. Looks like we're almost done. We have our f's of l and our f's of z corners. We simply need to add one more, which is a high-frequency f p corner. What can we do to make our gain flatten out at high frequency? Well, there's more than one way to do it. One way would be to add a capacitor in parallel with Z2 to make this quantity go down. And cancel out the, the C1 asymptote that is going up. Another way would just be to make the Z1 asymptote flatten out. So we could make 1 over Z1 flatten out. If we added another resister into Z1 For example, if we simply put a resistor here, which I'm going, going to call R3, then at high frequency, after capacitor C1 has shorted out or become much smaller in magnitude than R3. The overall series combination of z1 will become R3, and 1 over z1 will go to 1 over R3. For this to work, you can see that 1 over R3 has to be bigger than 1 over R1. In other words, R3 is smaller than R1. If we do that, our overall gain at high frequency will go to R2 here, multiplied by the 1 over R3. So our high frequency gain will be R2 over R3. These corner frequencies then z1 are found as as usual the fz corner is where the resistor r1 is equal to magnitude to omega c1 so this is at 1 over 2 pi R1C1. And the fp corner is where the Rr3 asymptote is equal to the c1 asymptote, so that would be at 1 over 2 pi c1 r3. Then here's our complete design. So we put H times V, which is our V-minus, into one terminal and we put a Z-1 there, which was R-1 in parallel with the C-1. And then both of those are in series with R-3. And we put v ref into the other terminal and we put a z1 there, also. Then our feedback impedance is Z2, which was our two in series with C2, and we have a z2 in the other leg as well. The output of the circuit is the compensator output voltage v sub c, that goes to the pulse with modulator. And then here are all of our design equations. So from our previous slide, this gain, mid-band gain, that we call g-c-0 is r-2 over r-1. So g-c-0 equals r-2 over r-1. And we wanted Gc0 to be 3.7. Then our corner frequency f sub L was from the z2, and that was 1 over 2 pi R2 C2, which we wanted to be 500 Hz. The corner frequency of z was from the R1 and C1. So it was one over two pi R one C one, and we wanted that to be, that was one point seven kilohertz. And then finally, the high frequency pole came from R three and C one. It was at one over two pi, R3C1 and that was 14 kilohertz. So then here are the design equations for our circuit, and we can now solve these for all of the element values. One thing I would point out here is that we have five different element values, alright? One, two, three, four, five. But we only have four equations. How do we get the fifth equation to solve for the fifth element value? Well, this is typically what happens, we don't have a fifth equation and we can choose one of the element values arbitrarily. In fact, what we normally do for the last equation is, we pick an element value to make the impedance levels come out to, to have reasonable power dissipations in this circuit. We'll have voltages in a circuit on the order of one or two volts. If we chose resistor values of, say, 1 ohm, then we would have 1 or two amps in our resistors, which is not a reasonable number. Typically, our Op-amp can produce several milliamps or maybe 10 or 20 milliamps at most. And in fact, what we would like to do is, choose the element value so that the power dissipation in these elements is small. If you choose 1 k type resistors value then with one or two volts we'll have one or two miliamps. If you choose a megome then we'll have one or two micro amps. With miliamps then we'll get milliwatts of power dissipation, and with microamps we'll get microwatts. On the other hand if we choose the impedence levels to be too high, then our circuit is succeptable to noise. And it will, with very high impedence levels we have antennas that are just the wiring and the componets that can pick up noise. And in a power converter, we're in an environment where there generally is a lot of noise from the switching of the power duh-, stage. The set-, susceptibility depends on the layout of the circuit, which we don't know yet. But typically, if you have mega ohms, then the [INAUDIBLE] are getting pretty high. And they are susceptible to picking up noise. And so a typical choice might be resistor values of tens of k-ohms, or hundreds of k, but not megaohms. What is chosen in this design is, is to use r-2 equals a hundred k. As our last equation. And then from there, we can solve for the other element values. 'Kay, I wont write down the element values, but they are in the, the, the accompanying lecture notes. There are several other considerations here to think about. First of all, if V ref truly is just a dc voltage that never changes. Then we don't really need all these Rs and Cs. If you put a DC value for Dref, for Vref, then you can see that the voltage at this node will also be Vref. And we don't really need the R2C2, or for that matter, we don't need the z1 there. We can simply just connect V ref up to the plus terminal of the Op-amp. Often you see this done in power supply designs that have a fixed output voltage. On the other hand, if v ref is something that can change then removing all these r's and c's will change the transfer function from V ref to the output. And in that case I think we probably want to put these all my values here. The second consideration is that we're going to connect the voltage divider to this HV point. And so we have to think about how the interaction happens between the voltage divider and our off hand circuit. So the full circuit, we'll have our divider coming from the output voltage, and then we'll have our Z 1 and Z 2. In this case, the Z 1 can actually load down this voltage divider and change its transfer function, so we need to account for this in our design. One way to do it is to choose the divider resisters to be small in value relative to Z one, but that might mean that there's substantial power dissipation in these resisters. Another way to account for it, is to make a Thevenin equivalent model of the divider. And the Thevenin equivalent, looking back, into the divider from this node will have voltage source equal to the open circuit voltage, which is the desired transfer function. It's v times the divider ratio. And then it has a thevenin equivalent resistance. That is the resistance seen from this node when you short the voltage source or short v to ground, and you get the parallel combination of the two resistors. [SOUND] So that's our thevenin equivalent. And we put that then in series, are connected to the z1. Well, what this suggests is that, why don't we use the parallel combination, R1d and R2d to be equal to R3? Then we don't need to add another R3, and we can simply choose R1 and put R1 and C1 there if, in the actual circuit. Along with the rest of our Op-amp circuit. And I'm not drawing what's connected to the plus terminal. So then this gives another constraint, that the value of our three that we solved before on the previous slide, should be, in fact, equal to R one and D and parallel with R two D, and we also want the divider ratio to come out to give us our H. And we again have a set of equations that we can then solve for all of the element values. One last practical point regarding this design. What we're asking our Op-amp to do, is to make a transfer function that looks like this. And one feature of this transfer function is that the high frequency gain is flat, and doesn't roll off. In fact the value of the high frequency gain would be this mid-band gain, Gc0, multiplied by the ratio of the pole on 0 frequencies, and that works out to be 30 and one half which is approximately 30dB. The FP corner frequency is 14 kilohertz. So we are asking our Op-amp to produce this gain of 30dB at all frequencies above 14 kilohertz. Well, real Op-amps can't do that, they can't produce gain out to infinite frequency. They have what's called a gain bandwidth product. The internal gain of an off amp that's compensated, so that it can operate at unity gain, is typically some single pole slope that passes through zero DD, or unity gain. An average Op-amp might have a unity gain frequency of one megahertz or so, which is a decent Op-amp, but not a fancy high frequency Op-amp. And it will have a very large low-frequency gain, but at some point it rolls off like this. So let's suppose we used a, an, a standard one megahertz Op-amp and let's compare the gain this Op-amp has to what we're asking it to do. Well, where does this Op-amp gain pass through this 30 and, a gain of 30 and a half? It's basically at 1 megahertz divided by 30 and a half. So we're at 30 dB at one MHz over 30.5, which is about 33 kHz. Okay, that's higher than 14 kHz, that's not bad. What it's going to do is, introduce another pole into our overall transfer function. You can build a circuit and ask for whatever gain you want, but you aren't going to get that gain if the Op-amp can't produce it. So we would expect to see some pole, a second pole up here at some higher frequency. It'll be in the vicinity of 33 kilohertz, although you have to do some more work to analyse the Op-amp, the Op-amp feedback loop including its at, its actual gain to see exactly where that corner frequency happens. But let's say it's on the order of 30 kilohertz, now our crossover frequency for this example was five kilohertz. And you can see that this 30 kilohertz is less than a decade higher than 5 kilohertz. That means that the added pole that we get is going to be significant, and it's going to reduce the phase margin of our compensator in our feedback loop If we want to fix that, we would have to either redesign the compensator to get more phase margin or perhaps use an Op-amp with a wider bandwidth. If we used, for example, a 2 MHz Op-amp, then this corner might happen up above, around 60 kHz. Which then would be a decade higher than our cross over frequency. So, perhaps, we need a two megahertz or faster Op-amp here. So, we can use our graphical construction of Bode plots to gain the insight that we need to design an Op-amp compensator circuit. To complete our design of the feedback loop.