This example compares two implementations of a buck DC-DC converter. The switched version is built using mostly blocks from Modelica's electrical library but also includes the SwitchingPWM model. The averaged version is built around a replaceable instance of the average switch model for CCM (continuous conduction mode) and DCM (discontinuous conduction mode) considering no losses.
This example showcases how components from PVSystems can be mixed with components from the Modelica Standard Library to build systems that might be of interest. Additionally, it aims validating the average switch model performance by comparison with the more accurate/detailed switched model.
This is still an open-loop system. A duty cycle value is fed to the SwitchingPWM block to drive the ideal closing switch or to the averaged switch network model. The duty cycle value begins at 0.1 and changes to 0.6 in the middle of the simulation. The effect of this change can be observed by plotting the output voltages:
The output voltage for both implementations is not exactly the same but it can be seen that the averaged model provides a very decent approximation. This is the case because both the switching and the averaged implementations are neglecting losses and because they are both correctly modelling CCM and DCM modes. The converter is operating in DCM in the first interval and in CCM in the second:
An interesting exercise to complete this example would be to build a controller to close the loop and study the system's behaviour.