I am working on a buck converter and I want to obtain the Bode diagrams of the open-loop circuit. The below circuit is what I made. However, the DC-gain is -96 dB while it should be very small around -6 dB according to the transfer function. So, am I missing something? Could you please help me out with this?
-
Open loop or closed loop gain? – Voltage Spike Oct 26 '20 at 23:21
-
Open-loop. What I mean by open-loop is that there is no controller for handling the duty cycle. In fact, what I want is Vout/Vin in this circuit. However, the DC-gain is very different from the transfer function. The Vout in very low frequency (let's say zero frequency) should be D*Vg where D is the duty cycle and Vg is the input small-signal variation. So, it gives me a magnitude of around - 6dB but what I get from the simulation is very different (-96 dB) – Mehdi Ghazavi Oct 26 '20 at 23:38
-
@MehdiGhazavi Your `Voff` and `Von` parameters for your switch don't do anything. I think you want `Vt`, but your simulation might still work since `Vt` is zero by default. Please check the LTspice help for `S. Voltage Controlled Switch`. – Ste Kulov Oct 27 '20 at 04:24
-
2If you want to obtain the ac response of a switching circuit, either you use an averaged model - see my seminar [here](https://cbasso.pagesperso-orange.fr/Downloads/PPTs/Chris%20Basso%20APEC%20seminar%202018.pdf) or you use a program capable of extracting the small-signal response out of a switching circuit. SIMPLIS is purposely designed for this job while LTspice requires you to run a .TRAN analysis with an ac source sweeping the points. Certainly not using a .AC statement as in your example which is intended for linear -read non-switching - circuits only. – Verbal Kint Oct 27 '20 at 09:38
-
@SteKulov It's true that those parameters aren't officially documented, but they work as compatibility with PSpice (or generic SPICE? not sure). They also don't alter the hysteresis behaviour. – a concerned citizen Oct 27 '20 at 14:10
-
@aconcernedcitizen SPICE3 syntax is the same as LTspice. PSpice uses `VSWITCH` instead of `SW`, but it sounds like based on your comment that LTspice not only recognizes `VSWITCH` but can mix n' match parameters between the two. Thanks for the comment! – Ste Kulov Oct 27 '20 at 18:22
-
@SteKulov I wasn't very sure of it, but the [PSpice reference manual](https://www.electronics-lab.com/wp-content/uploads/2015/08/PSPCREF.pdf) (p. 219/367) cleared the confusion. I don't have PSpice and the last time I used it was ...years ago. – a concerned citizen Oct 27 '20 at 18:55
-
@VerbalKint I talked about the LTspice side of things, but I left out the averaged model part because I have a feeling you might have more to say about it. – a concerned citizen Oct 27 '20 at 18:57
5 Answers
The AC analysis is a linearized analysis. That means it simulates the small-signal behavior of each element at its operating point.
In the case of the switch, that means it is held in either the on or off state, and behaves as a resistor with either the ROFF
or RON
value.
The -96 dB transfer gain is due to the leakage through the switch's 1 megohm off resistance.
If the reason you're simulating this circuit is enable designing the switching control loop, really you should just remove the switch and diode and drive the left end of the inductor with your voltage source. Because the control loop critical frequencies will be much lower than the switching frequency, the whole switching circuit (input source, switch and diode) just looks like a voltage source with a value depending on the switch duty cycle when you're designing the control loop.

- 126,425
- 3
- 159
- 304
-
-
-
So, another question. What I need to do with the diode. It is also a nonlinear component. – Mehdi Ghazavi Oct 27 '20 at 01:04
-
1@MehdiGhazavi, really you should just remove the switch and diode and drive the left end of the inductor with your voltage source. The idea is that the control loop critical frequencies should be much lower than the switching frequency, so the whole switching circuit (input source, switch and diode) just looks like a voltage source with a value depending on the switch duty cycle when you're designing the control loop. – The Photon Oct 27 '20 at 04:13
-
Or, if you really want to understand what's going on, do a pencil and paper analysis instead of using SPICE> – The Photon Oct 27 '20 at 04:14
-
@ThePhoton Can you explain the logic behind the \$R_{eq}\$ equation? Seems like even if \$D\$ was 0.9999, then the \$R_{off}\$ term would still dominate. Is that intentional? – Ste Kulov Oct 27 '20 at 04:20
-
-
@ThePhoton Ah, OK. Just wanted to make sure I fully understood the answer before upvoting. Thanks for your answer! – Ste Kulov Oct 27 '20 at 04:51
The discussion is interesting an in particular, the (always) comprehensive reply given by a concerned citizen. However, it shows, in my opinion, that LTspice is not really suited for extracting the ac response of a switching circuit. The problem lies with the stimulus frequency, its amplitude (to avoid saturation) and the switching period. The ac plots that are provided start at 1 kHz but going down to 10 Hz (or even for a PFC circuit) would probably imply a tremendous amount of time. It is not to criticize LTspice that I find excellent, but my feeling is that it is not meant for making this measurement practical.
Instead, look at the below circuit captured with Elements, the free demo version of SIMPLIS:
This is a voltage-mode buck converter with current limit. It is a switching circuit and the program will deliver the cycle-by-cycle waveforms (to make sure the operating point is correct) but also the transfer functions of your choice. In this example, the total simulation time is 5 s on my computer:
This circuit is part of the newly-developed free templates that I posted on my page.
The other option, as underlined in my comments, it is to resort to an average model and LTspice will deliver the information we want very quickly:
The switching component has disappeared and you work on a circuit linearized by the simulation engine. A .AC statement is now valid and will do the job at any frequency.

- 20,420
- 1
- 16
- 50
-
"*LTspice is not really suited for the extracting the ac response of a switching circuit*" -- this is an old wound, I'm afraid. :-) There even were petitions to bring the PoP into LTspice. Alas... But (and I'm not trying to point the finger) even the averaged model fails when close to fs and beyond, or for self-oscillating stages. But for the bandwidth of interest they're more than suitable. – a concerned citizen Oct 27 '20 at 20:18
-
-
Do either of you two have any quick comments on how the Loop Gain plotting within LTpowerCAD compares to both the "SIMPLIS/.tran" method and the ".ac w/ averaged model" method? – Ste Kulov Oct 28 '20 at 07:44
-
2The POP stands for periodic operating point. It is a way to determine the moment in simulation time at which the simulator considers steady state is reached, it is fully stabilized if you wish (average current in caps is 0 A and average voltage across inductors is 0 V). The SIMPLIS approach is close to reality and predicts all contributions in the response (e.g. harmonics of ripple). Average models are fast - the switching component is gone - and well suited for small-signal analysis. – Verbal Kint Oct 28 '20 at 07:59
-
1You can check my [APEC 2018 seminar](https://cbasso.pagesperso-orange.fr/Downloads/PPTs/Chris%20Basso%20APEC%20seminar%202018.pdf) in which I describe the various ways to obtain the transfer function of your choice. – Verbal Kint Oct 28 '20 at 07:59
-
@VerbalKint Yes, I already went through that PDF when I saw it in the question's comments (it's excellent, by the way). I was just curious if you guys knew what LTpowerCAD is specifically doing underneath its hood to generate its plots, and how accurate it is. – Ste Kulov Oct 28 '20 at 09:27
-
Looking at the introductory video and the obtained results in ac and transient, it looks like there is a simulation engine behind but I would not be capable to tell which one. The program is impressive. – Verbal Kint Oct 28 '20 at 09:32
-
Ah, OK. Nevermind. I thought you were already familiar with it. Thanks again for the detailed answer! – Ste Kulov Oct 29 '20 at 06:01
The Photon's answer says why you can't perform an .AC
analysis on this particular type of circuit, and Verbal Kint's comment deals with the possibility of making an .AC
analysis possible by using an averaged model (which I'll leave up to him to answer).
I'll show you two other methods that can be done in .TRAN
.
One of them is found in the LTspiceXVII/examples/Educational/FRA
folder, in My Documents
, as part of the default installation of LTspice(XVII). This method implies setting up a literal small-signal source, which is the equivalent of Middlebrook's LTspiceXVII/examples/Educational/LoopGain.asc
and LoopGain2.asc
, but for .TRAN
.
Among the three shematics in there, Eg2.asc
shows how to setup a frequency sweep in .TRAN
and some .MEAS
scripts in order to extract the frequency information. It's all done with an LTC3611, but you can implement it easily in your schematic like this:
This is a very basic voltage-mode buck converter, don't give it too much thought other than to see it's a buck converter and how it can be set up for this analysis. Note that I used *pi
in the .MEAS
scripts, because I have checked the option User radian measure in waveform expressions
inside the Control Panel > Waveforms
. That's why you see "only" a few degrees, because they're radians. In Eg2.asc
, the commands make use of 360
, so degrees, and they rely on that option being ticked off (which is the default). The result is this:
Note that I've made a few changes compared to the original schematic: freq
sweep is from 50k
to 500k
, with 50
steps per decade, not octave. The option nomarch
is also added.
The second method is similar, in that the previous one dealt with .STEP
ping a parameter and then collating the results of the .MEAS
scripts, while this one does everything dunamically, trying to perform as a real-life FRA would, giving the results in (quasi-)real-time. The downside is that it is slow, but it delivers.
This schematic belongs to the user analog spiceman
from the LTspice user group, so I'll only post the result of the simulation of FRA-CCM.asc
(one schematic from the FRA folder), and if you want to give it a try, you'll have to go to the group's Files area and get the files from there (registration is needed, though).

- 21,167
- 1
- 20
- 40
-
Do you happen to know if LTpowerCAD uses the same time-domain technique when generating its own plots? – Ste Kulov Oct 29 '20 at 06:02
-
1@SteKulov I don't know, because the last time I tried installing it required some extra special libraries to be installed, and Wine complained about it, so I didn't insist on it. But if it takes time to give the results, then it's probably the same technique. Otherwise it would mean they've implemented the PoP (see Verbal Kint's comment), and then why wouldn't it be in LTspice, too? Sorry, only now I saw your question below Verbal Kint's answer. It got buried between the rest of the notices (aka I'm blind). – a concerned citizen Oct 29 '20 at 07:50
-
Haha. No worries, brother. I was just curious and thought I'd ask really quick. Thanks! – Ste Kulov Oct 29 '20 at 18:32
Are you sure the switch is working properly in the AC simulation? I don't believe that the pulse source operates in the AC simulation.
If you take the voltage division of the switch off resistance (1MΩ), you get an output voltage of 15µV (for a 1V input), which is -96.48dB.

- 2,052
- 1
- 10
- 18
-
Yes, the switch works properly. I guess the other answer I got makes sense. The AC analysis is not suitable and appropriate for switching. – Mehdi Ghazavi Oct 27 '20 at 00:25
LTspice is quite capable of doing this work, sweeping the bode plot on the switching circuit. Much better results can be obtained than are shown here, but you have to know how to set up the frequency response analyzer properly. That's no different from the real world.
We have given several seminars on this, and the speed of LTspice is more than acceptable if your models are set up properly.