Triangular wave with variable frequency

Hello.

I would like to know how to make a triangular or sawtooth wave in PLECS with a variable frequency in time. I tried with a C-Script, but it makes the simulation slower and because of the time delay, the frequency is not on point.

Thanks in advance.

A good reference for variable frequency ramp generation is the “Half-Bridge LLC Converter with Analysis Tools” demo model. Refer to the “VCO w/ programmable clock duty cycle” subsystem which implements the carrier generation. It uses a resettable integrator to generate a sawtooth waveform. The sawtooth waveform is then mapped into a triangular waveform.

I attached a model of that subsystem here as well.

VoltageControlledOscillator.plecs (26.1 KB)