This 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 SignalPWM model. The averaged version is built around the average switch model for CCM (continuous conduction mode).
This example showcases how components from PVlib 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 SignalPWM block to drive the ideal closing switch or to the IdealAverageCCMSwitch model. The duty cycle value begins at 0.2 and changes to 0.6 and finally to 0.7. The effect of this change can be observed by plotting the output voltage:
This figure also displays the input voltage for the sake of comparison. It make the point that the function of the buck converter is to reduce the voltage level from the input to the output.
Additionally, one can see that the output voltage for both implementations is not exactly the same. The main difference can be found at the begining of the simulation, when the duty cycle is 0.2. By close inspection of the inductor current one can see that the converters are not operating in CCM but rather are working in DCM (Discontinuous Conduction Mode). This condition is defined by the fact that the inductor current remains at 0 for a certain part of the switching period, as shown in the following figure:
Since the average model used is valid only in CCM, this innaccuaricy is to be expected.
An interesting exercise to complete this example would be to build a controller to close the loop and study the system's behaviour.