Op-amp closed loop regulation - Page 1
Forum section: electronics / beginners

author: mcdesca
author_rank: Contributor
timestamp: April 22, 2015, 10:30:56 am
content: Hello everybody,I've built a circuit that performs a constant current control. Right now it's perfoming great by having the voltage that the shunt resistor transduces at the inverting input, and the setpoint at the noninverting input.Given that the setpoint is not to be constant (periodic waveform), I was wondering what would be the difference if the regulation was a PID op-amp-implemented control instead of just a differential amplifier.Thanks a lot.Best,

author: Simon
author_rank: Unknown
timestamp: April 22, 2015, 10:37:53 am
content: Surely a Diff. opamp setup is a PID of sorts ? it see's and error and compensates exactly to eliminate the error, that is the purpose of opamps, it's all they do. Perhaps you can post your schematic ?

author: mcdesca
author_rank: Contributor
timestamp: April 22, 2015, 10:51:51 am
content: Hello,Attached my circuit of the basic regulation scheme.I imagine that both regulations work on the setpoint-feedback difference. But how is a single op-amp regulating? Does it perform the integral and derivative term (I don't think so since there is no higher order components like capacitors or inductors) or what type of control is performing?When the gain of the loop is set too high, it starts oscillating so it kind of resembles me a slide mode control, but I'm not sure...Thanks.

author: Simon
author_rank: Unknown
timestamp: April 22, 2015, 11:14:45 am
content: the opamp will do whatever is neccessary to make the 2 inputs equal, do it will output more voltage or current so that via the feedback network the 2 inputs become equal.

author: Zero999
author_rank: Super Contributor
timestamp: April 22, 2015, 12:03:17 pm
content: It's oscillating because the inductor introduces a phase shift.When the op-amp's output goes high, it takes awhile for the current in increase in the inductor so the voltage across the R1 is still lower than V2. Eventually the voltage across R1 exceeds V2 so the op-amps output goes low but it takes awhile for the fall in voltage to reduce the current and the cycle repeats, causing oscillation.

author: mcdesca
author_rank: Contributor
timestamp: April 22, 2015, 12:17:03 pm
content: Hello,The circuit above reaches stability, maybe at high frequency would make the regulation loop unstable but that wasn't my question.I'll try to restate it: In terms of regulation, what are the differences between the two circuits attached? When should I use a PID control instead of just a differential amplifier. Is the differential op-amp just a regulation loop with only P term?Best,

author: Simon
author_rank: Unknown
timestamp: April 22, 2015, 12:25:27 pm
content: A PID system looks at the difference between what you want and what you have and then uses formula's to work out what correction to apply. So the question is what trype of compensation do YOU want in the middle ? and opamp is doing exactly what you want already.

author: mikerj
author_rank: Super Contributor
timestamp: April 22, 2015, 05:51:54 pm
content: Quote from: Simon on April 22, 2015, 10:37:53 amAn ideal diff amp would provide only a P term, i.e. the error signal is amplified by the gain of the amp and applied to the output. There are no time dependant gain operations as there would be if there were an I and a D term.If the system had an I term, then a constant error would cause the output to ramp up or down at a rate proportional to the error. If it had a D term, then the output would be proportional to the rate of change or the error.

author: Simon
author_rank: Unknown
timestamp: April 23, 2015, 06:52:38 am
content: ok but what does this circuit actually need. I think the pid discussion is almost irrelevant here and it's a case of what is the Op trying to do and what does he need.

author: macboy
author_rank: Super Contributor
timestamp: April 23, 2015, 02:09:17 pm
content: Quote from: mcdesca on April 22, 2015, 10:51:51 amThe op-amp is technically doing PID control, with I and D terms set to zero. So it is doing only the proportional part.The op-amp looks at the voltage difference between the + and - inputs and amplifies this by its open-loop gain, and applies that voltage to the output. That is literally all any op-amp ever does. Output voltage is set proportionally to input voltage. When you 'close the loop' by making the output affect the input (i.e. negative feedback), this provides the effect that the op-amp will enforce that the + and - inputs are at exactly (nearly) the same voltage. So when the setpoint (+ input) goes up, the op-amp reacts by driving the MOSFET harder, which causes more current to flow though it, which causes more voltage in the sense resistor, which is connected to the - input... until the inputs are balanced.There is an error term in the op-amp circuit related to the open-loop gain. The op-amp is limited in its ability to balance those two inputs, and open-loop gain is the key. For less DC error, you need a higher open-loop gain.You can also null out this small DC error by adding the integral term. The small DC error will be integrated over time and contribute to a correction factor which should null it out over time. Most of the time, you don't see such a thing in an analog system like this because the static/DC error is very small. It can be a different story for things like temperature controllers where other sources of error (environmental effects etc.) cause much greater errors. There, you can't compensate for all of those by just bumping up the gain; the system will start to oscillate. Instead, the integral part of PID ensures that the long-term average is equal to the set point, even though at any given instant, there will be small unavoidable errors relative to the set point. You might occasionally see a "DC servo" where a specific DC operating point (usually 0 V) is desired over time, such as in an audio amplifier. The audio amplifier is designed for good AC characteristics like low distortion and flat frequency response, and this sometimes leaves the DC performance suffering. The DC servo might be added to null out the DC offset that would otherwise be present. This is a rare example of an integral term being explicitly implemented in pure linear electronics, where the integral compensates for some artifact of the circuit rather than an external factor.Then there is the Derivative part. Op-amps are already fast, and in many cases, need to be slowed down. You won't see the derivative part explicitly implemented often either. When designed properly (compensated for no overshoot and good damping), the op-amp will adjust quickly and accurately. Again, it is generally in systems with significant lag between control input and the observed effect (e.g. temperature control) where you might want to literally over-react to a change in input via an explicit derivative term. (You could also argue that the compensation itselfisa derivative factor because it often effects a phase-lead to the inputs... and I guess you'd be right.)

author: Kevin.D
author_rank: Frequent Contributor
timestamp: April 23, 2015, 02:47:47 pm
content: Hi . PID terms are usually applied to low frequency control loops, for high speed analogue loops like here, If you are wanting to analyse it then it's better to think in terms of poles, zero's, phase and gain .Inductive loads always have a large effect on constant current control loops just as a Capacitive load can have large effect on C.V loop, as explained by another poster an inductor opposes change of current which then causes the control loop to 'overshoot' continuously (this is what oscillation is). One way to deal with inductive load is to put cap in parallel to it, A caps works in a kinda oppposite sense to the inductor and creates a pole with L ,above the 3dB Frequency of this pole the load appears capacitive instead of inductive and so removes effect of inductor on loop. Here you would put a cap from drain to gnd (try ~4uF with a 2 ohm in series from drain to gnd should cope with most size inductance), notice that from drain to gnd will be in effect in parallel with any load in the drain (when doing ac analysis you ignore dc voltage source as it becomes a short ) . This will slow the load step transient response time though (because this cap now has to dis/charge before control loop can make any difference so best keep it small as needed).With this ' decoupling' of the inductive load it's now easier for control loop to be kept stable. After this you need to remove C1 which does not help here (it creates another uneeded pole), then add a cap ~330pf from opamp ouput to -inv, keep gate resistor about 100R .