In this post, I want to look at the circuit as a servo loop.

At this point I probably need to throw in a bit of theory (which I don't understand all that well). This is going to be fast and furious and won't cover the ground in the way that an expensive textbook would (but then I'm not qualified to write a textbook). Servo loops can be numbered according to type. A type 0 loop (a regulator) simply generates an error term which is the difference between the desired output and the current output and drives the output with that. The disadvantage is that, as the output approaches the desired output, the drive declines to the point where the output either doesn't get to where it's going or is very slow to do so. One way round that is to increase the gain, but at some point that results in the output shooting past the desired position and having to return back. Even more gain and the output will keep moving backwards and forwards until it finally settles, or possibly doesn't settle at all and just sits there oscillating about the desired position. So simply increasing the gain isn't the answer. A type 1 loop adds an integrator. Any residual error will accumulate on the integrator until there is enough drive to move the output closer to where it needs to go. A type 2 loop then adds a differentiator. The differentiator notices if things are changing too quickly and slows everything down. That enables the gain to be increased, driving the loop response quicker, by stopping it from overshooting. Hope I got that more or less right.

For a better explanation of all this, the Wikipedia page for PID controller looks quite good:

https://en.wikipedia.org/wiki/PID_controller

This circuit seems to me to be a type 2 servo system: C2 is functioning as an integrator (a capacitor integrates charge to give a resulting voltage) and C3 as a differentiator (if the signal is changing quickly, it feeds the change forward quickly to the summing node). Neither is pure - in both cases there is a resistor associated with them that will allow them to charge or discharge, so they have a short term effect as things are changing but then disappear again in the steady state. But a complication here is that C4 also integrates, as does the intrinsic capacitance within the power MOSFET. So which do I tune? C2 has the longest time constant, and will dominate the response, so I guess I concentrate on that one.

In the previous post I showed the shape of the waveform for a 200Hz square wave input. I'm now going to experiment with changing the integral and derivative terms to see what the effect is on the resulting waveform. To do this, I'm going to use a facility within the simulator that allows you to set a control object and step its value in increments so that we can see multiple traces. That way I'll get a feel for the effect increasing the value of each part has on the resulting waveform. I'm going to quickly point out here that the objective isn't necessarily to get the best looking waveform - in further posts I'm going to look at the effects of varying the output load, try to assess how stable the loop is (by more scientific means than by chucking arbitrary input waveforms at it), and at the frequency response. All of those may conflict with what I'm doing here, so this loop tuning is a starting point and won't necessarily be the final outcome [I haven't done those blogs yet, so I don't know where this will end up either].

Just as a reminder, here's the original waveform with C2=4.7nF and C3=100pF

To put the simulator into the mode where it will step parameter values, I click on "Mode..." in the Analysis menu

That then brings up the Analysis Mode Selection box. I select 'Parameter stepping' as the Current Mode. The other selection 'Parameter stepping' can be either - I'm only working with one parameter at the moment (that selection controls how the software operates when there is more than one control object).

I then go back to the Analysis Menu, click on 'Select Control Object', and then click on C2 with the modified cursor that comes up; then I select the '...' next to the parts value in the dialog box that comes up; then I enter the parameter stepping values in the 'Control object selection'. Here I put in a start value of 1nF, an end value of 5nf and asked for 5 linear steps, so I'll get traces for 1nF, 2nF, 3nf, 4nF, and 5nF.

Here's the resulting trace when I run a transient analysis for the leading edge of the input. The different colour curves are for each of the different component values. In the software you can click on an individual curve and the parameter(s) will be reported on the status bar at the bottom. For this blog, I annotated them afterwards using Gimp.

Here's the trailing edge.

I love these. They show beautifully the way in which the waveform shape changes and the sensitivity of the circuit to the value. Here we can see that the waveform shape is much better with a 1nF capacitor than it was with the original 4.7nF.

Now I'm going to try varying the value of C3 with C2 set back to the original value of 4.7nF. Here are plots for C3 from 50pF to 250pF in steps of 50pF

This shows the way that the differentiator holds back the rapid change and counters the overshoot.

It's evident from these two experiments that I need to adjust C3 first, and then use C2 to correct for any overshoot. Here are the rise and fall waveforms with C2 set to 1n and C3 set to 220p

that's about the best I'm going to do without changing other values. It looks like it will raise the large-signal bandwidth from several hundred Hz to a couple of kHz. One thing that's evident from the waveforms is that the fall is different to the rise. That's evidently due to the non-linearity of the MOSFET down at the bottom end - where the control voltage needs to move further towards the end of turning off than it does towards the end of turning on, but is limited in the rate at which it can move. This is the point at which we're starting to move away from simple servo-loop theory which assumes the system is linear.

The next question I'm going to look at is the effect of inductance on the output and the interesting question as to whether what I've done here makes the situation better, worse, or doesn't change anything at all with regard to the stability.

Programmable Electronic Load: Dynamic Behaviour: Part 1 Overview

Programmable Electronic Load: Dynamic Behaviour: Part 3 Effect of Output Inductance