Buck converter - Increased accuracy and simulation speed using interpolation in SimPowerSystems.

Interpolation method of SPS R2014b to allow larger time step while preserving model accuracy.
Updated 7 Nov 2014

View License

This example illustrates a DC-DC buck converter feeding an RC load from a 200 V source. The PWM frequency is set to 5 kHz and duty cycle varies between 0.1 and 0.8. With this 5 kHz PWM frequency, the sample time that would be required to get a 0.5 % resolution on duty cycle using a standard discretization method would be 1e-6 sec:
1 MHz sampling frequency = 200 x 5000 Hz -> resolution = 1/200 = 0.5 %

In the solver tab of the powergui block the simulation type is set to Discrete, and the interpolation option is checked. The Simulation Data Inspector is enabled and the Vload signal is logged. The sample time has been initialized to 20e-6 s in the model properties.

1) First perform a simulation with the interpolation in service, with Ts set to 20e-6.

2) In the powergui, uncheck the interpolation and specify Ts=1e-6 in the MATLAB command window. Perform a second simulation.

3) In the powergui set the simulation type to Continuous and select Use of Ideal switching devices. Perform a third simulation.

4) Open the Data inspector and compare the three simulation runs for the Vload signal. The voltage obtained during first two runs (interpolation with Ts=20e-6 s, and no interpolation with Ts=1e-6 sec) should be close the continuous simulation result.

5) Zoom on the signals and observe that the result obtained with the interpolation solver perfectly matches the result obtained with the continuous solver, and is even more accurate than the standard discrete solver.

6) Compare simulation speeds of discrete models (interpolation with Ts=20e-6 sec and no interpolation with Ts=1e-6 sec). Increase simulation stop time to 0.5 sec. Run the simulations. The simulation time is displayed at the end of each simulation run in the Diagnostic Viewer. The speed increase obtained with the interpolation method is approximately 4X.

About the interpolation option of the powergui block:
Select this option to increase simulation speed by enabling the solver to interpolate in discrete models using power electronics. When this option is selected the solver captures gate transitions of power electronic devices occurring between two sample times, thus allowing larger sample times (typically 20X) than you would normally use with the standard solvers. For example, simulating a 5 kHz PWM converter with Tustin (no interpolation) or Tustin/Backward Euler would normally require a 1.0 usec sample time (sampling frequency = 200 x PWM frequency) in order to obtain a good resolution on pulse generation and guarantee accurate results. With the interpolation enabled, using a sample time as large as 20 usec will execute faster while preserving model accuracy.

When you enable this option:

Use a continuous pulse generator in order guarantee best accuracy on pulse generation (specify sample time = 0 in the pulse generator blocks).

In Simulink Model Configuration Parameters select a continuous, variable step solver (ode45 or ode23tb with default settings). The continuous solver is required by the interpolation solver to compute the gate signals time delays with respect to discrete sample times. These pulse delays are used by the solver to interpolate between sample times and produce accurate results.

Cite As

Patrice Brunelle (2024). Buck converter - Increased accuracy and simulation speed using interpolation in SimPowerSystems. (https://www.mathworks.com/matlabcentral/fileexchange/48381-buck-converter-increased-accuracy-and-simulation-speed-using-interpolation-in-simpowersystems), MATLAB Central File Exchange. Retrieved .

MATLAB Release Compatibility
Created with R2014b
Compatible with any release
Platform Compatibility
Windows macOS Linux

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!


Version Published Release Notes

Fixed typos in ddescription. Verifed the model execute well in R2014b

Added an image of the model

icon showing the new Interpolation option in Powergui block.

added an image to the description, fixed some typos in the title