This example shows how to model a switching power supply that converts a 30V DC supply into a regulated 15V DC supply. The model can be used to both size the inductance L and smoothing capacitor C, as well as to design the feedback controller. By selecting between continuous and discrete controllers, the impact of discretization can be explored. Modeling the switching devices as MOSFETs rather than ideal switches ensures that device on-resistances are correctly represented. The model also captures the switch-on/switch-off timing of the devices, this depending primarily on the gate capacitance values and the PWM driver output resistance.
If you have Simscape™ Power Systems™, see example model power_switching_power_supply for an abstracted version of this model that uses ideal switching to give faster simulation times. The model here can be used to determine the on-resistance values required for the ideal switches, plus timing offsets if necessary. Using the ideal switching approach of Simscape Power Systems can be used to simulate more complex power converters.
The MOSFETs are configured to show thermal ports, these being connected to subsystems modeling the heatsinks and environment. The total heat flow is calculated and shown by Scope 3. For an abstracted model of the thermal dynamics only, see the 'Thermal Characteristics of a Synchronous Buck Converter' example, elec_switching_power_supply_thermal_only. The abstracted model is used to determine initial temperatures for this model. Diode thermal ports are not exposed as their thermal contribution is very small compared to that of the MOSFETs
The plot below shows the output voltage as compared to the reference voltage. It also shows the changing load current and the dissipated power of the two MOSFETS averaged over the PWM cycle.
The plot below shows the switch-on/switch off timing of the two MOSFETS and the drain-source current.
The plots below show the behavior of the different implementations of the PI controller.