Plecs Tutorial: Modeling A Switched-Mode Power Supply Using PLECS
Plecs Tutorial: Modeling A Switched-Mode Power Supply Using PLECS
Plecs Tutorial: Modeling A Switched-Mode Power Supply Using PLECS
Tutorial
www.plexim.com
Request a PLECS trial license
1 Introduction
The aim of this exercise is to use PLECS to create a detailed model of a two-stage power electronic
converter. The example application, shown in Fig. 1, is a switched-mode power supply comprising a
single-phase input rectifier that creates a DC voltage of approximately 325 V, and an output forward
converter stage that steps the input DC voltage down to approximately 11 V. Since the focus of this ex-
ercise is on modeling the switching converter rather than the control system, the forward converter is
operated in open-loop control mode with a fixed duty cycle. The specific learning goals for this exercise
www.plexim.com 1
Modeling a Switched-Mode Power Supply using PLECS
Your Task: Model the idealized forward converter shown in Fig. 2. Be sure to use the ideal
MOSFET component from the library. Use a Pulse Generator block with a frequency of 20e3 Hz
and a duty cycle of 0.4 to control the switch. Display the load voltage using the PLECS Scope.
Monitor the MOSFET and inductor currents by dragging these components into a Probe block
and checking the Current signals. Use a Signal Demultiplexer block to display the MOSFET
and inductor currents on separate scope plots. Adjust the simulation Stop time to 3 ms (found in
the Simulation + Simulation Parameters menu, or press Ctrl+E), but leave all other param-
eters as their defaults and run the simulation (Simulation + Run or Ctrl+T).
L: 50e-6
D1
D2 C: 400e-6 R: 1 V
V: 325 n: [12 1]
Scope
Probe
Probe
Pulse Generator
f: 20e3
DutyCycle: 0.4
A After the startup transient settles, it is in continuous conduction mode. In continuous conduc-
tion mode, the steady-state inductor current is always greater than zero.
At this stage, your model should be the same as the reference model:
Forward_Converter_1.plecs.
Your Task: To add this effect to your model, add a magnetizing inductance Lm in parallel with
the primary winding of the ideal transformer, as shown in Fig. 3. Set Lm = 5 mH and try to run
the simulation again.
? Why does PLECS abort with an error message? (Take a look at the conduction state of the
semiconductors.)
A When the MOSFET opens, there is no longer a path for the magnetizing inductance current to
flow, thus forcing it to instantaneously jump to zero. This isn’t possible in PLECS.
www.plexim.com 2
Modeling a Switched-Mode Power Supply using PLECS
L: 50e-6
D1
Lm D2 C: 400e-6 R: 1 V
V: 325 n: [12 1]
Scope
Probe
Probe
Pulse Generator
f: 20e3
DutyCycle: 0.4
Note: If PLECS aborts with such an error message, there is usually something wrong with the
circuit design. In reality, the MOSFET in off-state represents a very large resistance rather than
an open circuit. You can model this with an additional resistor, e.g. Roff = 10 kΩ, connected in
parallel to the MOSFET. If you display the voltage across the MOSFET now, you will observe
a very high voltage when the MOSFET is turned off. It is this voltage that would destroy the
MOSFET in reality.
Your Task: Add a third winding to the transformer and connect a diode according to Fig. 4. To
do this, add an additional winding to the primary side by changing the number of windings to
[2 1]. Set the number of turns on the additional winding to 12 and reverse its polarity by setting
the polarity vector to +-+.
www.plexim.com 3
Modeling a Switched-Mode Power Supply using PLECS
Note: In order to avoid transformer saturation the transformer must be totally demagnetized
before the MOSFET starts to conduct. It is a common practice to have the same number of turns
on the primary and the demagnetizing windings.
? Add a Probe and Scope block to monitor the current through Lm and gradually increase the
duty cycle of the pulse generator. What is the maximum duty cycle that can be reached before
the transformer saturates?
A 50 %
At this stage, your model should be the same as the reference model:
Forward_Converter_2.plecs.
4 Parasitic effects
The output DC-DC stage of the converter now operates correctly with ideal components. The next
stage of this modeling exercise is to add parasitic effects such as transformer leakage inductance and
diode reverse recovery charge to investigate the effects of these non-idealities.
Your Task: Add a leakage inductance of Ll = 10 nH at the secondary side of the transformer as
shown in Fig. 5.
? How does the leakage inductance influence the shape of the current through the diodes D1 and
D2 ? If you cannot observe any difference, zoom into the commutation interval.
A The diode current now rises over a short period of time rather than instantaneously.
? Why is it not possible to connect leakage inductances in series with the primary and the de-
magnetizing windings?
www.plexim.com 4
Modeling a Switched-Mode Power Supply using PLECS
A Again, by adding inductance in these paths, there would be no route for the inductive current
to flow when the MOSFET is turned off.
Your Task: In the circuit from Section 4.1, replace the diodes D1 and D2 with the Diode with
Reverse Recovery component, Drr . For this exercise, you can use the default diode parameters.
Note: The reverse recovery diode model introduces stiff differential equations and will create an
error or result in a long simulation time if you use the standard ode45 solver. In the Simulation
Parameters, you will need to manually change the Solver type from the non-stiff DOPRI to
the stiff RADAU for PLECS Standalone or ode15s for PLECS Blockset. However since PLECS
version 4.5 a new variable-step solver auto has been added as default, where the solver switch-
ing from DOPRI to RADAU is automatically done if a model is found to become stiff during a
simulation. By default the Relative tolerance setting is 1e−3 . Change the relative tolerance to
1e−6 and observe the effect on the simulation speed and the diode currents during a switching
transition.
? How large is the peak overcurrent value in diode Drr1 and the peak overvoltage in diode Drr2
in steady-state operation?
At this stage, your model should be the same as the reference model:
Forward_Converter_3.plecs.
Your Task: Add a 325 V (230 Vrms), 50 Hz Voltage Source AC component in series with a 200 µH
inductor to model the single-phase mains. The input stage of the power supply consists of a
diode rectifier with a DC filter capacitor. Model the input stage according to Fig. 6 and display
the mains current and the DC link voltage using a Scope block. Adjust the simulation stop time
to 40 ms in order to simulate two full periods of mains supply.
www.plexim.com 5
Modeling a Switched-Mode Power Supply using PLECS
At this stage, your model should be the same as the reference model:
Forward_Converter_4.plecs.
Figure 6: Circuit model for power supply including mains rectifier and forward converter
6 Conclusion
This exercise has demonstrated a step by step approach for creating a detailed model of a two stage
DC-DC converter starting with an idealized model of a forward converter. When the diode reverse re-
covery effect was added, the system became numerically stiff because the simulation model had time
constants differing by several orders of magnitude. The time constant of the reverse recovery phe-
nomenon is in the range of 10 ns and the time constant of the output filter is in the order of 1 ms. How-
ever, with the use of a stiff solver and appropriate tolerance settings, the converter could still be simu-
lated with a fast speed.
In practice a control system would be added to regulate the output voltage. A voltage controller can
easily be implemented using the control blocks in the PLECS component library, but this step is left
for the user to explore.
References
[1] Ned Mohan, Tore M. Undeland, William P. Robbins, Power Electronics – Converters, Applications
and Design, Third Edition, John Wiley & Sons, 2003
[2] Alan Courtay, MAST Power Diode and Thyristor Models Including Automatic Parameter Extrac-
tion, SABER User Group Meeting Brighton, UK, September 1995
www.plexim.com 6
Revision History:
PLECS Tutorial
© 2002–2022 by Plexim GmbH
The software PLECS described in this document is furnished under a license agreement. The software
may be used or copied only under the terms of the license agreement. No part of this manual may be
photocopied or reproduced in any form without prior written consent from Plexim GmbH.
PLECS is a registered trademark of Plexim GmbH. MATLAB, Simulink and Simulink Coder are regis-
tered trademarks of The MathWorks, Inc. Other product or brand names are trademarks or registered
trademarks of their respective holders.