¿ªÔÆÌåÓý

Re: How can I create a continuously (kind of) varying duty cycle in one simulation


 

On Wed, Apr 9, 2025 at 04:47 PM, <kmesne@...> wrote:
I am trying to create a duty cycle that kind of continuously varying like in a 200ms simulation I want a duty cycle start from 0.01 to 0.99 ?(approximately 0.01 Duty increase per 2 ms). How can I do this I am really struggling with it .?
If I were to do this, I would use something like the one suggested by Donald.? I prefer it because I think it is easy to visualize how it gives you the? varying duty cycle, and it might be close to how you would build it in hardware.? But I have two differences from Donald's example:
?
(1)? Donald's example (DutyCycleModulator.zip) needs a Maximum Timestep.? Without it, it works but LTspice uses far too few timepoints to get good signal edges.
.tran 0 200m 0 10u
.options plotwinsize=0? ?; <-- Disables waveform compression
?
(2)? Instead of Donald's voltage-controlled switch S1, I would use a comparator, to compare the voltage ramp with the triangle or sawtooth wave.? LTspice's "diffschmitt" element works well for this, even if you omit the hysteresis of the Schmitt function.
?
I uploaded an example, VaryingDutyCycle.asc, in the Temp folder.
?
Andy
?

Join [email protected] to automatically receive all group messages.