MATLAB Tutorial II: Power Electronics and Simulink
MATLAB Tutorial II: Power Electronics and Simulink
1
Simulink Basics
In practice, you will implement both stages iteratively until you reach
your intended goal. Each new model should be based on a pre-existing
one (no need to start from scratch)
3
Simulink Extensions
4
Creating a Model
• By using blocks – (simple ?)
• Similar to making block-diagrams
• Blocks:
– Are copied from libraries and connected
manually.
– Contain parameters that can be fixed or changed.
– Some parameters can be changed during
simulations.
• Two main types of block libraries:
– Standard, Simulink lib.
– User-defined lib.
5
Creating a Model
• A model is created by a drag-and-drop
technique from a specific library to the
workspace.
• The connection lines represent mathematical
relations and determine the data flow.
• One can edit the model via operations like: copy,
past, undo, align, distribute, resize.
• Please try to keep your models as organized
and intuitive as possible. Others (and even you)
can easily get lost in more complex systems.
• Group your blocks in subsystems (more on them
later), name your variables accordingly and use
signal routing blocks in order to avoid
unnecessary lines.
6
Model Hierarchy
7
Lets Get Started
• To initiate Simulink, simply type “simulink”in
your MATLAB command window.
8
Setting-up the Model
• Before you begin, do not forget to save the model in a
separate folder.
• Afterword, configure the model as such:
3
2
9
Start drawing
• First assignment- from yesterday: basic circuit.
What do we need ?
- Resistors
- DC voltage source
- Some way to measure currents and voltages 10
Library
• Since this tutorial is mostly focused on power electronics,
our main library will be SimPowerSystems
Second very
important
group of
libraries
11
Useful Tips for Modeling
• Place all different element from the library to
the workspace first.
• Change the names and parameters of the first
blocks to something that can be easily edited
later.
• Right-click and drag the block to copy them.
• Hold ctrl and to connect two blocks.
• Press ctrl+R to rotate the blocks.
• Hide the names of generic blocks like math
functions or some signal routing elements.
12
Important when working with PE !
14
Important for Scopes
• Remove the data limit as soon as you
copy the first scope to your workspace
15
Extracting Data from the Simulation
From file:
In the block, specify to
save the format as array
To workspace
In the block, specify to
save the format as
structure with time
16
Using PE Devices- Uncontrolled
Rectifier
- Start with a diode bridge, AC voltage source and a 100 ohm resistor.
- Measure all relevant values.
17
Diode Parameters
18
Time to Save Time and Switch the
Switches in Digital
• Or in this case the
diodes, and the
simulation, to be more
precise, in fixed-step
(discrete).
• Modify the powergui and
configuration
parameters as such:
19
Finalising the Rectifier
20
Analysing the Harmonics
• In the case of PE converters or various electrical systems,
there is a great focus on evaluating the THD and harmonic
spectre of electrical parameters.
• To achieve this in Simulink, we specify the values variables
of interest and analyse them via the powergui block.
22
Time to Switch to a More Controllable
Device and Boost our Understanding
• In order to function properly, PE switches require signals that
determine there state (on/off) and modulates the output signal.
• In Simulink, this signal represents a logical (1 or 0) value that we
bring to the gate terminal of the block.
• The most simple form of modulation is a fixed duty-cycle periodic
signal that can easily be achieved via the Pulse Generator block
Make sure that your simulation period is in sync with your switching period
23
Your task:
• Construct a Boost converter with one of the two main
types of switches and their respective parameters:
If you are done, try to make a Buck or Buck-Boost converter using these blocks.
25
Single Phase Inverter
• In order to operate a full-bridge converter we need to
implement a variable duty-cycle PWM.
• To generate this type of PWM, we need to construct a
carrier and a modulation signal and compare them.
For now, construct a FB inverter using IGBTs blocks, a
controlled voltage source on the DC bus and a 100 ohm
resistor on the output.
26
PWM Signal
• The PWM generator, as previously stated need
to provide the neccesary type of signal to the
gates of the switches.
• One way to construct it using block is as
followed:
27
PWM Signal
• The carrier signal in this case is a triangular
periodic signal with the following parameters:
29
Unipolar Modulation
• Modify the model to operate with a unipolar PWM.
• What is the difference in THD in comparison with
bipolar modulation ?
31