6
\$\begingroup\$

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?

circuit and Bode diagrams of the output (open-loop transfer function)

\$\endgroup\$
8
  • \$\begingroup\$ Open loop or closed loop gain? \$\endgroup\$
    – Voltage Spike
    Oct 26, 2020 at 23:21
  • \$\begingroup\$ 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) \$\endgroup\$ Oct 26, 2020 at 23:38
  • \$\begingroup\$ @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. \$\endgroup\$
    – Ste Kulov
    Oct 27, 2020 at 4:24
  • 2
    \$\begingroup\$ If you want to obtain the ac response of a switching circuit, either you use an averaged model - see my seminar here 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. \$\endgroup\$ Oct 27, 2020 at 9:38
  • \$\begingroup\$ @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. \$\endgroup\$ Oct 27, 2020 at 14:10

5 Answers 5

8
\$\begingroup\$

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.

\$\endgroup\$
8
  • \$\begingroup\$ +1 for correct. AC analysis doesn't work with switching sources. \$\endgroup\$
    – Andy aka
    Oct 27, 2020 at 0:21
  • \$\begingroup\$ Many thanks for your answers. \$\endgroup\$ Oct 27, 2020 at 0:24
  • \$\begingroup\$ So, another question. What I need to do with the diode. It is also a nonlinear component. \$\endgroup\$ Oct 27, 2020 at 1:04
  • 1
    \$\begingroup\$ @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. \$\endgroup\$
    – The Photon
    Oct 27, 2020 at 4:13
  • \$\begingroup\$ Or, if you really want to understand what's going on, do a pencil and paper analysis instead of using SPICE> \$\endgroup\$
    – The Photon
    Oct 27, 2020 at 4:14
5
\$\begingroup\$

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:

enter image description here

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:

enter image description here

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:

enter image description here

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.

\$\endgroup\$
8
  • \$\begingroup\$ "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. \$\endgroup\$ Oct 27, 2020 at 20:18
  • \$\begingroup\$ @aconcernedcitizen What's "PoP" ? \$\endgroup\$
    – Ste Kulov
    Oct 28, 2020 at 7:42
  • \$\begingroup\$ 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? \$\endgroup\$
    – Ste Kulov
    Oct 28, 2020 at 7:44
  • 2
    \$\begingroup\$ The 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. \$\endgroup\$ Oct 28, 2020 at 7:59
  • 1
    \$\begingroup\$ You can check my APEC 2018 seminar in which I describe the various ways to obtain the transfer function of your choice. \$\endgroup\$ Oct 28, 2020 at 7:59
3
\$\begingroup\$

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:

buck

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:

eg2

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 .STEPping 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).

fra

\$\endgroup\$
3
  • \$\begingroup\$ Do you happen to know if LTpowerCAD uses the same time-domain technique when generating its own plots? \$\endgroup\$
    – Ste Kulov
    Oct 29, 2020 at 6:02
  • 1
    \$\begingroup\$ @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). \$\endgroup\$ Oct 29, 2020 at 7:50
  • \$\begingroup\$ Haha. No worries, brother. I was just curious and thought I'd ask really quick. Thanks! \$\endgroup\$
    – Ste Kulov
    Oct 29, 2020 at 18:32
0
\$\begingroup\$

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.

\$\endgroup\$
1
  • \$\begingroup\$ Yes, the switch works properly. I guess the other answer I got makes sense. The AC analysis is not suitable and appropriate for switching. \$\endgroup\$ Oct 27, 2020 at 0:25
0
\$\begingroup\$

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.

\$\endgroup\$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.