I want to design a PID controller I created the design with all the components but when I run my ac sweep my output graph of Vout/Vin is not correct as a PID controller should function but when i run the transient I get the correct results. Can there be something wrong in my design?

1 Answers
It is often the same problem with these ac simulations: you need to ensure a proper dc operating point for the op-amps. In other words, always check the bias point computed by SPICE after a simulation is run. In your example, since you have an integrator, there must be a tiny dc bias at the PID input to make sure the output lies within normal boundaries, i.e. the op-amp does not rail up or down. If it does, then you have a goofy response.
Below is a circuit I published in my book on loop control a while ago and shows how to automate the filtered PID parameters calculations to make it look like a type 3 compensator (a third pole is added, \$f_{p2}\$):
A bias circuit is drawn in the bottom and it provides the needed dc component to the ac stimulus, ensuring an arbitrarily-selected 2.5-V level at the PID output. The cool thing with that circuit is that it automatically sets the bias ok otherwise, considering the high dc gain, you would need to tweak the input dc component at the µV level to obtain a meaningful PID output.
- 21,968
- 1
- 18
- 55
-
I think I might be missing something. Where is the integrator in the questioner's circuit? I see one opamp (U3) with an input capacitor, but I would think the
.opanalysis would open the capacitor and then the opamp turns into a voltage follower with zero volts (disregarding offset error of course). – Ste Kulov Jun 01 '23 at 20:46 -
It should be $U_2$ I believe but I can't see the resistor value across the capacitor. – Verbal Kint Jun 02 '23 at 05:19
-
For U2 it looks like 10k to me, and the capacitor across it is 10µ. Is a 10k/1k ratio not enough to get a stable operating point? I'm asking because usually I solve something like this if there's no resistor there and I add one on the order of hundreds of K's or megs. But I'm not familiar with this topology so I don't know if there's something additional to consider. Is it much more sensitive to input DC offset where it's way better to avoid the whole situation and use the auto-biasing instead? – Ste Kulov Jun 02 '23 at 08:22
-
Well, an integrator is supposed to offer an infinite gain at $s=0$ so if you have a resistor of too low a value, then it defeats the integrator action. I don't have a resistor in my circuit as you can see setting the dc gain to 10k or 80 dB. – Verbal Kint Jun 02 '23 at 09:16
-

.acstatement looks wrong. Try something like.ac dec 100 1 10. Also, as Andy suggested, it's easier to post your results directly and point to where you think there's a discrepancy. – Ste Kulov Jun 01 '23 at 04:01