Author Topic: Why is my loop compensation so bad? Linear reg fail.  (Read 8170 times)

0 Members and 1 Guest are viewing this topic.

Offline rs20Topic starter

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Why is my loop compensation so bad? Linear reg fail.
« on: February 24, 2015, 10:09:21 am »
I'm having a go at building my own linear regulator from scratch (just for the experience of understanding control loops, and maybe to build a lab supply at some point). It's been more challenging than I expected, mostly because I've almost completely forgotten what loop compensation is.

So here's my very naive design, with the control loop broken and an AC sweep of that loop:



With a phase margin of -119°, this design is sure to be unstable. So, I have a go at "dominant pole compensation", which wikipedia says involves placing a pole of a lower frequency than all the other poles already in the circuit. So I experiment with adding a C in the feedback path, but I have to make the corner frequency ridiculously low (~ 10 Hz) to get a marginally acceptable phase margin of 35°:



So, now it's "stable", but it's horrible at dealing with load steps:





How can I do better? Any recommendations on online material to help me remember exactly what a pole is, and the Laplace transform, and all that stuff, would be greatly appreciated too. I've completed forgotten why s is better than j?...

EDIT: Fixed broken image link.
« Last Edit: November 04, 2016, 11:26:59 am by rs20 »
 

Offline RobinF

  • Newbie
  • Posts: 6
  • Country: 00
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #1 on: February 24, 2015, 10:56:38 am »
"How do I find the poles of a circuit?" is one of those questions that I've never been able to get a satisfactory answer to from any of my teachers. They either end up telling you to write down all Kirchhoff equations and solve for Vout/Vin, which is unrealistic for any circuit containing more than two components, or they just tell you "this R and that C form a pole".

So it's experience, really.

In this circuit, one pole comes from the opamp (its internal pole, shifted up by the gain of R5/R6), and the second is the opamp's output with M1's gate capacitance. You've added a third pole, which only makes things more complicated. You could instead slow down the second pole by just adding more capacitance to M1's gate. Why do you have R5/R6 there?
« Last Edit: February 24, 2015, 11:52:09 am by RobinF »
 

Online tom66

  • Super Contributor
  • ***
  • Posts: 6706
  • Country: gb
  • Electronics Hobbyist & FPGA/Embedded Systems EE
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #2 on: February 24, 2015, 10:59:00 am »
I'm new to control loops myself, but shouldn't the capacitor be across the top resistor? Adding the capacitor to the bottom will shift the phase by -90 degrees making the loop even more unstable (you're probably shifting it back into stability, but only just.) The way it was explained to me was the capacitor injects some ac ripple into the loop which helps keep it stable on load transients (the capacitor effectively amplifying the dip caused by transients.)
 

Offline Phoenix

  • Frequent Contributor
  • **
  • Posts: 422
  • Country: au
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #3 on: February 24, 2015, 11:59:35 am »
I'm not sure your understanding of phase margin is correct. Phase margin is how far away your phase is from -180deg at the 0dB crossover frequency.

So your first circuit looks to have a phase margin of about 60deg, which is (arguably) quite optimal.
 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #4 on: February 24, 2015, 12:59:36 pm »
When the gain is only a little above 1 the loop phase needs to be pretty close to -180 degrees to have a positive loop gain, and a risk of oscillation. If you are still well away from -180 degrees as the gain falls through unity you will always have negative feedback, and a stable loop. You seem to have confused the need to be positively away from -180 degrees with a need to have a positive phase.

As tom66 said, the way you have added a capacitor forms a low pass filter, really slugging the loop's response. When you are well above the turnover frequency of this filter it gives you something very close to 90 degree of phase shift. In your loop its actually making the phase margin much worse.
« Last Edit: February 24, 2015, 01:18:06 pm by coppice »
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21685
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #5 on: February 24, 2015, 01:44:11 pm »
"How do I find the poles of a circuit?" is one of those questions that I've never been able to get a satisfactory answer to from any of my teachers. They either end up telling you to write down all Kirchhoff equations and solve for Vout/Vin, which is unrealistic for any circuit containing more than two components, or they just tell you "this R and that C form a pole".

So it's experience, really.

You can write it down and solve, or you can actually ask SPICE to do the same (it does it at a linearized operating point, assuming it finds a stable DC operating point of course).

The problem with both is, the result won't be very useful.  Why?  Consider the humble common-emitter amplifier.  You have a dominant pole due to Ccb and Cbe.  The former is often expressed as Miller effect.  But you also have a positive zero due to Ccb -- at frequencies where the transistor is no longer achieving inverting amplification, gain goes through zero, reverses and becomes slightly positive, as the input signal itself pushes through to the output.

Impedances at the emitter terminal have similar effects.  The basic bypassed emitter resistor technique produces a rather pronounced pole-zero pair, meaning, the difference in frequencies and therefore the corresponding rise in gain between them, is fairly large; the usual strategy is to place the zero below the lowest signal frequency, to maximize signal gain.  But that doesn't remove the lower frequency pole from the equation, it's still there whether you're interested in it or not.

Compound this further by adding representative parasitics: resistor and node capacitances, capacitor and transistor lead inductances, source and load impedances (often very complex, having transmission lines attached); all of these factor into the analytic transfer function.  (Note that transmission lines can only be crudely approximated by a lumped-equivalent polynomial transfer function!)

So, when speaking of poles and zeros, it's almost exclusively about very limited circumstances.  "Within this frequency range, there will be a pole and/or zero, with frequencies determined in large part (i.e., having high sensitivity to these components and few others) by this resistor and this capacitor."  You can meaningfully speak of introducing poles and zeros to a transfer function, though the total transfer function (in the theoretical sense) is rarely, if ever, of interest or use.

So, if this was at all illuminating... now you know? ;)

Tim
« Last Edit: February 24, 2015, 01:45:44 pm by T3sl4co1l »
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline RobinF

  • Newbie
  • Posts: 6
  • Country: 00
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #6 on: February 24, 2015, 02:18:12 pm »
I'm not saying pole/zero analysis isn't useful; I use it on a daily basis. In fact, I can't sign off a circuit without showing that each and every loop is stable, using AC analysis. Parasitics are no different from "normal" components, you just need to know how big they are and if they will affect your transfer function significantly.

The problem that rs20 showed is a simple two-pole system, but finding the solution still isn't obvious. The hard bit is connecting the poles and zeros that SPICE gives you with circuit parameters.
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #7 on: February 24, 2015, 02:42:06 pm »
Does it work any better if you supply -12V to the op amp. Although the LT1006 is specified so that its inputs can go down to the negative rail, you might get some ideas if your circuit is operating too close to the negative rail if it starts working while supplying some negative voltage to it.
 

Offline rs20Topic starter

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #8 on: February 25, 2015, 12:08:06 am »
Thanks everyone for all the input!

Would using a BJT instead of a MOSFET make things easier? Loosely speaking, BJTs don't really have a "base capacitance" with which to form a pole with the op-amp's output impedance?

I'm not sure your understanding of phase margin is correct. Phase margin is how far away your phase is from -180deg at the 0dB crossover frequency.

So your first circuit looks to have a phase margin of about 60deg, which is (arguably) quite optimal.

I'm prepared to agree that I don't know what phase margin is, but the first ("uncompensated") circuit I showed is definitely not optimal, as demonstrated by this transient response:



Maybe the confusion stems from the fact that I've cut the control loop and am looking at the response of the entire loop, inverting op-amp and all (instead of just the feedback network)? The Barkhausen stability criterion states that instability will occur if there exists a frequency such that phase shift around the loop is a multiple of 360 and loop gain is > 0dB. Nothing special about 180 degrees at all?? Maybe you're used to excluding the inverting opamp from your plots? Please correct me if I'm wrong!

When the gain is only a little above 1 the loop phase needs to be pretty close to -180 degrees to have a positive loop gain, and a risk of oscillation. If you are still well away from -180 degrees as the gain falls through unity you will always have negative feedback, and a stable loop. You seem to have confused the need to be positively away from -180 degrees with a need to have a positive phase.

As above, I'm sure you're right, but I don't understand where 180 degrees comes from. And, as shown above, it definitely isn't stable.

As tom66 said, the way you have added a capacitor forms a low pass filter, really slugging the loop's response. When you are well above the turnover frequency of this filter it gives you something very close to 90 degree of phase shift. In your loop its actually making the phase margin much worse.

I'm glad to hear this because yes, that C obviously destroys the ability of the reg to deal with load steps. Again, I'm going to stop mentioning phase margin because I'm not sure I know what it means, but the addition of the C did make the loop stable where it wasn't before? I assume this is what dominant pole compensation is; heavily attenuating the frequencies where the existing poles are so that they become irrelevant. I really wanted to find a better way though, of course.

In this circuit, one pole comes from the opamp (its internal pole, shifted up by the gain of R5/R6), and the second is the opamp's output with M1's gate capacitance. You've added a third pole, which only makes things more complicated. You could instead slow down the second pole by just adding more capacitance to M1's gate.

I added a capacitor across VGS -- I tried a bunch of values; and even if it's set to 100uF (which is clearly beyond absurd, I realise that), it still doesn't achieve stability. The reason I set it so large was to bring the poles apart so we can see each one, and it seems that the opamp output vs gate capacitance actually forms a double pole/some sort of resonance (note the 180 degrees of phase change from 100 Hz to 1 kHz).



When phase reaches zero degrees, gain is still > 0dB, and the Barkhausen criteria correctly predicts instability:



If only I was moving a single pole, everything would be fine, right? Am I dealing with inductance in the op-amp output? Would using a BJT be better?

Why do you have R5/R6 there?

Not particularly good reasons:
-- To reduce the gain of the loop, which I thought was always a way to improve stability (correct me if I'm wrong)
-- In order to make biasing the loop when I cut it remotely possible (if I left the opamp completely open loop, it would be nearly impossible to set V3 to keep the op-amp from saturating when finding the DC op point).


EDIT: Fixed broken image link.
« Last Edit: November 04, 2016, 11:26:55 am by rs20 »
 

Offline rs20Topic starter

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #9 on: February 25, 2015, 12:10:18 am »
Does it work any better if you supply -12V to the op amp. Although the LT1006 is specified so that its inputs can go down to the negative rail, you might get some ideas if your circuit is operating too close to the negative rail if it starts working while supplying some negative voltage to it.

I tried, but there was no visible change to the transient response. Both inputs are sitting around 2.5V, which seems plenty clear from the rails in any case?
 

Online T3sl4co1l

  • Super Contributor
  • ***
  • Posts: 21685
  • Country: us
  • Expert, Analog Electronics, PCB Layout, EMC
    • Seven Transistor Labs
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #10 on: February 25, 2015, 01:52:09 am »
You're putting a large capacitor across a low impedance (the op-amp output) -- result, not much, just making the op-amp sweat more.  And probably self oscillate!

You need to put the compensation components either from sensitive nodes to voltage gain nodes, or if the sensitive nodes have voltage gain at the same time (a transconductance output, usually), then to ground is also acceptable.

Where is the voltage gain?  At the op-amp output.  One terminal goes there, that sounds good.  Where's the other one go?  The most sensitive node, ampere for ampere, is the amp -in.  So, put the cap across the op-amp.

This isn't perfect, because it won't reduce gain asymptotically to zero.  It will go down to 1, because the amp is wired as noninverting.  To achieve that, you need a complementary pole at +in.  Since +in is supplied by an equivalent resistance (the voltage divider -- which is itself supplied by the output, which has a fairly low impedance -- we presume -- but, this depends on load capacitance and resistance!), we know what capacitance is necessary to achieve that as well.

When you can arrange the error amplifier as fully inverting, you don't need to do this.

Tim
Seven Transistor Labs, LLC
Electronic design, from concept to prototype.
Bringing a project to life?  Send me a message!
 

Offline Kalvin

  • Super Contributor
  • ***
  • Posts: 2145
  • Country: fi
  • Embedded SW/HW.
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #11 on: February 25, 2015, 02:04:48 am »
Does it work any better if you supply -12V to the op amp. Although the LT1006 is specified so that its inputs can go down to the negative rail, you might get some ideas if your circuit is operating too close to the negative rail if it starts working while supplying some negative voltage to it.

I tried, but there was no visible change to the transient response. Both inputs are sitting around 2.5V, which seems plenty clear from the rails in any case?

Ok. Have you checked that op amp output is not hitting the negative rail all the time?

Maybe these application notes are useful:

"Linear Regulators: Theory of Operation and Compensation"
http://www.ti.com/lit/an/snva020b/snva020b.pdf

"A User's Guide to Compensating Low-Dropout Regulators"
http://www.ti.com/lit/ug/snoa826/snoa826.pdf
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #12 on: February 25, 2015, 02:54:37 am »
Hi,

Try this circuit:



And:



I have attached the LTspice models in the zip file.

Regards,

Jay_Diddy_B
« Last Edit: February 25, 2015, 03:19:18 am by Jay_Diddy_B »
 

Offline rs20Topic starter

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #13 on: February 25, 2015, 03:08:27 am »
You're putting a large capacitor across a low impedance (the op-amp output) -- result, not much, just making the op-amp sweat more.  And probably self oscillate!

You need to put the compensation components either from sensitive nodes to voltage gain nodes, or if the sensitive nodes have voltage gain at the same time (a transconductance output, usually), then to ground is also acceptable.

Where is the voltage gain?  At the op-amp output.  One terminal goes there, that sounds good.  Where's the other one go?  The most sensitive node, ampere for ampere, is the amp -in.  So, put the cap across the op-amp.

This isn't perfect, because it won't reduce gain asymptotically to zero.  It will go down to 1, because the amp is wired as noninverting.  To achieve that, you need a complementary pole at +in.  Since +in is supplied by an equivalent resistance (the voltage divider -- which is itself supplied by the output, which has a fairly low impedance -- we presume -- but, this depends on load capacitance and resistance!), we know what capacitance is necessary to achieve that as well.

When you can arrange the error amplifier as fully inverting, you don't need to do this.

Tim

Thanks; I tried this and after a lot of trial and error and a little (undoubtedly misguided) intuition with transient responses, came up with a fairly decent result:



Looking at the loop response reveals that it's dangerously close to meeting the Barkhausen criterion, but hey:



I clearly still need to do a lot more research to learn how to come up with optimal values, and meaningfully manipulate the loop response rather than just feeling my way around the solution space through trial and error and trying to infer phase margin through the amount of ringing in the transient response.

EDIT: Fixed broken image link.
« Last Edit: November 04, 2016, 11:26:47 am by rs20 »
 

Offline rs20Topic starter

  • Super Contributor
  • ***
  • Posts: 2318
  • Country: au
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #14 on: February 25, 2015, 03:14:03 am »
Hi,

Try this circuit:
...

Hey, thanks for this! As you can see, I somehow came up with a similar design (component values aside, topologically identical in fact) in parallel to you! I guess that makes me feel better about my design. I'm intrigued by placing the AC swept source referenced to the output, rather than to ground... can you be sure that V(va) is really a signal that went around the loop, as opposed to straight out of the voltage source? I could completely cut the loop and still see some response coming through the non-existent "loop"? Or is the low impedance transistor assumed to completely swamp the signal? Or is your method actually technically more precise for subtle reasons that are beyond me?
 

Offline Jay_Diddy_B

  • Super Contributor
  • ***
  • Posts: 2733
  • Country: ca
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #15 on: February 25, 2015, 03:30:03 am »

Hey, thanks for this! As you can see, I somehow came up with a similar design (component values aside, topologically identical in fact) in parallel to you! I guess that makes me feel better about my design. I'm intrigued by placing the AC swept source referenced to the output, rather than to ground... can you be sure that V(va) is really a signal that went around the loop, as opposed to straight out of the voltage source? I could completely cut the loop and still see some response coming through the non-existent "loop"? Or is the low impedance transistor assumed to completely swamp the signal? Or is your method actually technically more precise for subtle reasons that are beyond me?

In placing the disturbance in series with the top of the voltage divider, the control loop is closed for dc signals. The control loop will try and maintain the top of the divider constant. If you plot V(va) and V(Vb) separately you see this:



The V(b) signal, top of the divider, is attenuated at frequencies less than the BW of the circuit. The signal at the output is constant at low frequencies, because the disturbance source is sitting on top of a fixed voltage.

The loop gain is V(va)/ V(vb)

Jay_Diddy_B

 

Offline coppice

  • Super Contributor
  • ***
  • Posts: 8646
  • Country: gb
Re: Why is my loop compensation so bad? Linear reg fail.
« Reply #16 on: February 25, 2015, 04:53:43 am »
Maybe the confusion stems from the fact that I've cut the control loop and am looking at the response of the entire loop, inverting op-amp and all (instead of just the feedback network)? The Barkhausen stability criterion states that instability will occur if there exists a frequency such that phase shift around the loop is a multiple of 360 and loop gain is > 0dB. Nothing special about 180 degrees at all?? Maybe you're used to excluding the inverting opamp from your plots? Please correct me if I'm wrong!

When the gain is only a little above 1 the loop phase needs to be pretty close to -180 degrees to have a positive loop gain, and a risk of oscillation. If you are still well away from -180 degrees as the gain falls through unity you will always have negative feedback, and a stable loop. You seem to have confused the need to be positively away from -180 degrees with a need to have a positive phase.

As above, I'm sure you're right, but I don't understand where 180 degrees comes from. And, as shown above, it definitely isn't stable.
The two things above are equivalent. The Barkhausen criterion relates to the entire loop. The 180 degrees relates to any poles and zeros. To this you need to add the 180 degree shift which using an inverting amp represents. To make the loop unstable you need excessive positive feedback, so the feedback needs to be in phase (i.e. a multiple of 360 degrees) for a bad effect when you look at the entire loop, including the inverting effect of the amp.
 


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf