At the moment I'm simulating a basic buck converter circuit and would like to be able to vary the duty cycle given to the circuit by a microcontroller (switching a MOSFET).

I'm simulating the micro using a pulsed voltage source, and I want to vary the tOn parameter but am not sure how. I've tried placing {dutyCyc} in the tOn window, and adding .param dutyCyc=value*time to the circuit, which doesn't work.

I've seen suggestions on stepping through a list of values, but that performed multiple simulations as opposed to a single one with an increasing duty cycle over time.

What am I missing?

  • \$\begingroup\$ Not quite sure what you really want but you can always use pwl files for arbitrary waveforms \$\endgroup\$
    – PlasmaHH
    Jun 3 '18 at 11:48
  • \$\begingroup\$ How do you want to vary the tOn parameter? The expression you wrote for dutyCyc has tOn increasing with the simulation time, and it should work. You may need more curly braces. A picture of your pulsed source and .param statement may be helpful. \$\endgroup\$
    – DavidG25
    Jun 3 '18 at 17:14
  • \$\begingroup\$ This may help electronics.stackexchange.com/questions/247396/… \$\endgroup\$
    – Indraneel
    Feb 2 '19 at 7:54

You probably need a ramp, or triangle carrier, to be compared against an error voltage, or current. That implies a comparator of some sort, too. Here's a simplified version of a most basic voltage mode buck converter:


The error amplifier is made up of G1, which takes a reference of the output and compares it to the reference, V2 (5V), then forms a 1st order loop filter with C2 and its series resistance. The result is compared against the ramp, V3, with A1 (a Schmitt trigger, but here it has the role of a comparator), then controls the switch (think of it as an idealized FET). Here are some zoomed portions of the error amplifier (V(err), black), the ramp (V(ramp), blue), and the "gate" voltage (V(c), red):


As I said, this is a most basic version, and there are other methods of control, current, voltage+current, hysteresis, which I have not included, that's up to you -- this should be enough to get you started, though.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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