# PI Controller or Type 2 compensator using SIMetrix/SIMPLIS

I have PI controller build around one OPAM (link:https://www.researchgate.net/figure/Schematic-diagram-for-PI-controller-using-operational-amplifier_fig2_338104251) and I want to simulate it in SIMetrix/SIMPLIS simulator.Knowing that SIMPLIS simulator does not need an average model for AC simulation, the circuit is redrawn as follows:

I have used an error amplifier with 100k open loop gain, V3 (AC Source) as a perturbation signal that is need by SIMPLIS for AC analysis and the DC point of my system is expected to be 2.5v

When I simulate the circuit, I expect the bode plot to be shaped as of that of PI controller as given bellow:

But what I got is totally different, whiche means that my simulation model is incorrect

In the internet I have found a simulation model that uses a different approach:

I am not at the level of evaluating the work of the author, but I think this is a classical approach by using 1k capacitor and 1k inductor, that could work on any SPICE simulator and does not take advantage of SIMPLIS method of simulation.

Could anyone explain to me why my model did not work even though SIMPLIS does not need an average model, and how can I simulate a PI controller around one OPAMP?

• Including a link to the source material that you found would be very helpful (a Google search of "automated type 2 calculations with simplis" didn't immediately reveal your reference material.) It appears to me in the internet simulation that E1 / LOL / COL comprise a plant (maybe a PWM switch block, or something similar) which produces an voltage based on the error voltage. In your model you're just feeding the output of the error amplifier back into itself - there's no plant - so it's not an apples-to-apples comparison. Commented May 1, 2023 at 18:29
• @AdamLawrence, E1/LOL/COL, creates the operating DC operating point with a reference voltage of 2.5v, and in my case, I have used Vdc=2.5 to create my DC operating point! Commented May 1, 2023 at 18:34
• The issue is always the same: the dc operating point of the op-amp. In your approach, what makes sure the output of X1 is within its linear region? Nothing and you would have to tweak at the µV level the 2.5-V source in series with the ac source for that purpose. Quite tedious particularly if the op-amp has a large open-loop gain as it will quickly rail up or down, what you don't want. In my approach, the LOL/COL is the simplest and fastest way to stabilize the op-amp output at an arbitrary 2.5-V level. Commented May 1, 2023 at 20:04

The cited automated type 2 compensator in SIMPLIS is part of the ready-made templates you can freely download from my web page. As with any op-amp-based circuit, you need to make sure the device operates in its linear range, away from ground and the supply rail. Here, as the maximum output of the op-amp model is 5 V, I force its output to be around 2.5 V via the extra E1 component.

It is an old SPICE trick to auto-bias an averaged model regardless of the operating conditions. When SPICE starts simulating, whether this is an ac or transient exercise, a bias point needs to be determined. By doing so, SPICE opens all the capacitors and short circuits all inductors. In the given circuit, LOL is shorted and the solver determines the exact bias to apply at $$\R_{upper}\$$ for having the op-amp output set to 2.5 V roughly (the 100 gain is weak so don't expect a precise output but the exact value is irrelevant here as long as the op-amp does not rail up or down). Then, when the ac simulation starts, capacitor COL injects the ac and, together with LOL, form a low-pass filter which blocks any modulation from E1 and effectively opens the loop in ac.

Why is this useful? Because if your error circuit uses an op-amp featuring a 90-dB open-loop gain, to force its output to be between 1-3 V, you will have to tweak the input dc bias at the µV level which is extremely tedious. With the proposed circuit, it is done immediately in one shot.

Of course, as shown below, you could get rid of the COL/LOL network and insert the ac source in series, nothing mysterious here but you still need the auto-bias circuit:

As with any simulation, particularly ac, always check the dc operating point before considering the simulated data. Here it is 2.6 V as expected and the ac response is what we want.

If you want the PI response, disable $$\C_2\$$ and push the op-amp low-frequency pole to 30 MHz or so (infinite bandwidth) and you will see the response you want:

Make sure the Bode box receives the output from the op-amp as the phase margin should be -270° or 90° at dc (the op-amp reverses by -180° and the pole at the origin adds another 90° lag).