This (below) is basically a copy and paste of a short article I did on it elsewhere. I should mention that the current measurements are using a homemade Rogowski coil so are at best indicative measurements.
The buck converter that I built has a 16 bit, 16MHz MSP430G2553 for control and USB-C for logic power. on/off control is via the UART.
The simulation has a basic model of the microcontroller with 10 bit ADCs for input voltage, output voltage and inductor current. and a simple triangle PWM generator. The voltage and current measurement circuit gains are all set as per the hardware. The basic algorithm was a modified version of the example linked above with an inner current loop and outer voltage loop.
Switching frequency is 25kHz. Actual calculation time with measurements is currently around 35us which leaves 5us spare. The processor isn't too powerful so it's all fixed point with careful scheduling of ADC measurements and use of what passes for DMA on it. I used it as a challenge but would not recommend it for serious power converter designs.
I'm using a 25R resistive load for step tests, input voltage 27V due to my available power supplies and output 14V.
No load start up simulation (there's a 40ms start up ramp):
No load start up measurements: Current measurement is indicative only. It's a home made rogowski coil but it shows the same frequency oscillations as the voltage.
No load to 25R step response (14V). Step at 50ms (see blue trace for switch trigger)
Measured: load step from no load to 25R. Blue channel 4, Vout,
this looks even better than simulation as well. There's a bit of oscillation when load step occurs but it decays rapidly.
The simulation has oscillations on start up at around 330Hz whereas the measured one is around 400Hz. This could be because I didn't model delays in the measurements or gate drivers. Alternatively, it could be down to the non ideal nature of the inductors and capacitors used. The inductor used is an iron powder core which has a soft saturation
The controller was tuned in simulation and transferred to real hardware where it reacts in a similar way. I wasn't trying to get perfect control but just good enough to show that the Kicad can be used for useful power electronics simulations. Since the modelling tool is a varient of SPICE (ngspice,
https://ngspice.sourceforge.io/), you can get the model running with basic switches (as I did) and then drop in your gate driver and MOSFET models to get loss results. You can also model the layout parasitics to get switching spikes. ngspice is also used as the simulation engine in Eagle, Fusion Electronics and Altium but I've no idea how you would set it up to do this sort of simulation (or which version of ngspice is used -this requires one from this year).
I did test it with a 48V supply that I have lying around after I was confident it wouldn't blow up and it seemed to be performing just as well. Capacitors and MOSFETs were all at least 60V rated and the voltage dividers on the input and output max out at 60V anyway.