1

I'm trying to simulate a buck-boost converter where Vin and Vout are constantly changing. As a result, the time it takes to charge/discharge the inductor varies as well, and a voltage source that controls the MOSFETs with a constant frequency won't cut it.

I've been simulating 1 or 2 cycles at a time by disconnecting the voltage source from the circuit after X seconds, but it's not efficient at all. Is there a way to vary the Ton of the voltage source with an equation? Or perhaps a way I can type a list of Ton values in a text box and have the voltage source pick one every cycle?

Thanks!

brian
  • 49
  • 4

1 Answers1

2

What you need is a variable duty cycle, which is part of the control loop. If you have that but don't know how to implement the PWM part, here's a start:

test

If you don't have the control loop, then you'll have to build one: voltage mode, current mode, karma mode, etc.

a concerned citizen
  • 21,167
  • 1
  • 20
  • 40
  • I didn't know about the .parma card. I usually use .param, myself. ;) – jonk Nov 02 '20 at 00:10
  • 1
    @jonk Well, it's `.param`, normally, but with LTspice XVII, RClick on it brings up the new GUI, which I dislike. To circumvent it you need to Ctrl+RClick (as you know), which is a "complication" I also dislike. But it seems that `.parma` is an accepted mistake (like `,` instead of `.` for dot commands), and which has the happy side-effect of bypassing the new GUI. Or use only the first 3 letters, `.par`, `.fun`, `.opt`. Not sure if you know, but apparently these shortcuts exist since the old days of SPICE. But `.par` looks crippled, while `.parma` resembles the original, so I use `.parma`. – a concerned citizen Nov 02 '20 at 00:18
  • 1
    Thanks for that. I haven't played around like that. You make me now wonder if the .FINIS card is still accepted instead of .ENDS for a .SUBCKT model. (That dates back to Nagel's Spice2 program.) Also, just for you: [Analysis of Performance and Convergence Issues for Circuit Simulation; Quarles, Thomas L.; 1989](https://www2.eecs.berkeley.edu/Pubs/TechRpts/1989/ERL-89-42.pdf). In case you haven't already read it. – jonk Nov 02 '20 at 00:31
  • 1
    @jonk Oh, I haven't either. It just happened that one day was the happy typo day. Thank you very much for the link, that looks like a very interesting read! Now why did I just try to end up this `.subckt` with `.finis`? Eh, never mind, there's a paper to read... – a concerned citizen Nov 02 '20 at 08:04
  • Thanks so much for your response, it was spot on! I'm fairly new to building control loops with comparators, but I'm trying my best to learn. In this scenario, I'm trying to build a current control loop. To sense the current from the inductor, I'm using a LT6105 amplifier to convert the current reading to a voltage. I understand that process, but to compare that voltage reading to the Imin and Imax voltage values in the comparator, do I record what the voltage reading would be from the amplifier for Imax/Imin, and create a voltage pulse off of that? Is it that simple? – brian Nov 03 '20 at 21:43
  • @brian It sounds like you're overthining it a little, but also that you should read about current control for buck-boost stages. You don't need a converter for that, you simply take the switching current and use it in the control loop. I'm not talking about average mode, but peak, or ramp compensation. There are resources on the web for this, or search for APEC seminars. It's a little bit more than just a simple explanation, though. – a concerned citizen Nov 03 '20 at 22:25
  • Understood. I've been reading up on current control modes, but I feel a lot of it is overkill for what I'm trying to do (unless I'm completely missing the mark). I'm following a previous group's work to understand their design process and the only component I'm having trouble understanding is how they're setting the Imin and Imax value for the inductor with two hysteresis comparators. In the comparator they used for their design (AD8561), they must be comparing the inductor's current (converted to a voltage, since current can't flow into a comparator's input) against a Vref and a resistor. – brian Nov 04 '20 at 07:58
  • Also, I stumbled upon your comment for a question very similar a few years back here: (https://electronics.stackexchange.com/questions/377905/ltspice-changing-parameters-of-a-pulsed-voltage-source). Great to see you're still active and helping out! The example you provided makes a lot of sense, but when we start swapping out the voltage comparisons with current, I get a little lost. – brian Nov 04 '20 at 08:01
  • @brian Yes, they're using a sensor of some sorts (opamp, series resistor, current transformer, etc) to convert the current to voltage, reresenting the current. But, it sounds like another question already. – a concerned citizen Nov 04 '20 at 10:40