Buck Converter With Parameter Sweep
Buck Converter With Parameter Sweep
dx
DEMO MODEL
www.plexim.com
Request a PLECS trial license
1 Overview
This demonstration is based on the demo model “Buck Converter with Analog Controls” in the PLECS
demo models library. It performs a parameter sweep by modifying the value of inductor L1 from a sim-
ulation script.
2 Model
The schematic shows a buck converter with an analog proportional integral derivative (PID) controller.
The inductor L1 is labeled in the schematic below and can be simulated three times in an automated
fashion, with a value of 50 µH, 100 µH, and 200 µH, respectively.
L1
Time: 1e-3
L: varL
S1
V: 28 C: 500e-6 R: 6 R: 1
R: 11e3
R: 85e3 C: 1.1e-9
R: 120e3 C: 2.7e-9
f: 100e3 +
-
< .25 V V: 5
R: 47e3
UpperLimit: 0.9
LowerLimit: 0.1
3 Simulation
The simulation demonstrates the start-up of the converter and a load jump at 1 s. A single transient
simulation can be performed where an inductance value of 50 µH is assigned to L1 from the model
initializations. Alternatively, by using the pre-defined script, three simulations are performed, one
for each inductance value of L1 described above. The result of each simulation is displayed as a new
trace in the scope. Each trace is labeled with the corresponding inductance value. The script also ana-
lyzes the simulation result and prints the peak current value into the MATLAB or Octave console. To
run the scripted simulation demonstration execute the following steps for either PLECS Blockset or
PLECS Standalone:
• Blockset: Double-click on the subsystem block in the Simulink model to view and run the m-file
parameter_sweep_script.m in the MATLAB editor which has the following content:
% create path to scope
scope = ('buck_converter_with_parameter_sweep/Circuit/Scope');
www.plexim.com 1
Buck Converter with Parameter Sweep
for ix = 1:length(inductorValues)
% set value for L1
varL = inductorValues(ix) * 1e-6;
% start simulation, return probed signal values to workspace using Output port '1'
[t, x, y] = sim('buck_converter_with_parameter_sweep');
% hold and label traces in scope
plecs('scope', scope, 'HoldTrace', ['L=' mat2str(inductorValues(ix)) 'uH']);
% find maximum current value and index
[maxv, maxidx] = max(y(:,1));
% Output maximum current values to MATLAB console
fprintf('Max current for L=%duH: %fA at %fs\n', inductorValues(ix), maxv, t(maxidx));
end
for ix = 1:length(inductorValues)
% set value for L1
simStruct.ModelVars.varL = inductorValues(ix) * 1e-6;
% start simulation, return probed signal values to workspace using Output port '1'
out = plecs('simulate', simStruct);
% hold and label traces in Scope
plecs('scope', './Scope', 'HoldTrace', ['L=' mat2str(inductorValues(ix)) 'uH']);
% find maximum current value and index
[maxv, maxidx] = max(out.Values(1,:));
% Output maximum current values to Octave Console window
printf('Max current for L=%duH: %fA at %fs\n',
inductorValues(ix), maxv, out.Time(maxidx));
end
The results are printed into the Octave console which can be accessed by selecting Show Console
from the Window menu.
4 Conclusion
This model demonstrates using a simulation script to perform a parameter sweep of a physical circuit
value in either PLECS Blockset or PLECS Standalone. This example code can be readily be adapted to
other applications.
www.plexim.com 2
Buck Converter with Parameter Sweep
Inductor current
30
25
20
15
A
10
5 L=50uH:Inductor current
L=100uH:Inductor current
0 L=200uH:Inductor current
Load voltage
18
17
16
15
V
14
13
L=50uH:Capacitor voltage
12 L=100uH:Capacitor voltage
L=200uH:Capacitor voltage
11
0.0 0.5 1.0 1.5 × 1e-3
Time (s)
Figure 2: Output results of three different inductance values from parameter sweep
www.plexim.com 3
Revision History: