I am trying to simulate a buck converter operating with 1 Mhz switching frequency. The controller is configured as a low frequency-PI cascaded with a high frequency lead-lag (zero at 1e6r/s and pole at 1000e6r/s). Initially I tried to simulate using variable step - dopri solver but got this “model is stiff“ message and shifted to radau solver. However, the simulation is coming to a halt at 1.4ms. So I tyried to use a fixed step to see whether this works out but then fixed step is showing a “Derivative is infinite or NaN” error. The plecs file has been uploaded.
You controller design approach and target frequencies are not appropriate given your switching frequency.
The fundamental error is that your controller output is changing faster than your carrier wave, leading to multiple comparator events per period. The result is an effective switching frequency much higher than you intended (100’s of GHz). This brings the simulation to a halt.
You’ll see this if you zoom in on the PWM waveform for the last few hundred picoseconds of the simulation. The tweaking of the solver (Fixed vs. Variable step and setting the “Max step size (s)” to 1e-8) just hide the underlying issue. You should reset to a variable-step solver with the default max step size of 1e-3.
The solution is to fix the control scheme with an appropriately tuned controller. You can also insert a zero-order hold before the modulator to prevent multiple comparator events per period, but you will see the general control issue still remains, with the output toggling between the high and low limits.
Thank you for pointing out my blind spot!! Yes, I overlooked this part while migrating from matlab transfer function (no modulator) based demonstration to plecs.