Matlab Simulink SimPowerSystems For Power Lab 2014
Matlab Simulink SimPowerSystems For Power Lab 2014
Matlab Simulink SimPowerSystems For Power Lab 2014
The Matlab software package will be used, with its companion products Simulink and
SimPowerSystem, to model and simulate power-electronics circuits. In order to enable Matlab
to successfully represent the performance of power circuits, a special library of component
blocks, Powerlib, is used in SimPowerSystems. Note that SimPowerSystems works with
Simulink within Matlab. A guide to creating a circuit in SimPowerSystems can be found at:
http://www.mathworks.com/help/physmod/powersys/ug/building-and-simulating-a-simplecircuit.html
A. Starting Matlab, Simulink and SimPowerSystems
Note that there are two versions of Matlab in H-945 and H-921. Version 2009 is in H-945 while
later versions 2012 and 2013 appear in the undergraduate computer labs.To begin using either
versions use the sequence: Start, All Programs, MATLAB from the Windows desktop.
Matlab Version 2009. For version 2009, the Matlab display will appear as shown in Fig. 1.
When the Matlab desktop opens, at the >> prompt in the command window type: powerlib .
to draw the test circuit. As soon as the circuit window opens, assign a name to the circuit (file)
and save it with a .mdl extension.
Figure 2. Starting a circuit (model file .mdl) from the Powerlib panel.
Later Matlab Versions, 2012, 2013. For the later versions of Matlab (2012 and 2013), the
Matlab window will appear as shown in Fig.3. To open a file type Simulink in the command
window after the >> prompt. Wait until the display changes, it may take some time to load.
When the Simulink panel appears, click on either SimPowerSystems or Simscape and then
SimPowerSystems in the drop-down file menu that appears on the left. Item 1 of Fig. 4 is the
Simulink command. The locations of the Simscape and SimPowerSystems files are shown in
items 2 and 3. The library of power components will appear as shown in Fig. 3, item 4. These
library groups will be opened and used to select the required circuit components. The next step
is to create a panel that will contain the schematic of the circuit that you wish to simulate.
Create A New Workspace. To create a new workspace panel click on the open new model
icon shown as item 5 in Fig. 3. Name the new circuit-drawing file before starting to build the
schematic. The location of the commands is shown in Fig. 4. The new model will have either an
.mdl or a .slx extension. If a schematic window opens immediately, use the File. Save As
commands to start the new drawing. Take note of the location where the file is stored.
Figure 6 shows the workspace and the placement of the first element of the example circuit the
ac voltage source. First click on the Electrical Sources library as shown in Fig. 6, step 1. The
3
is
vs = Vmax sin t
vD
+
iload
+
vs
iD
vload
300
vR
iR
iL
+
+
0.8 H
vL
The remaining circuit components are chosen from the SimPowerSystems libraries and placed in
the diagram as shown in Fig. 7. The components are :
1 Ground. The element is found in Simulink/Simscape/SimPowerSystems/Elements.
2. AC Voltage Source. The element is found in Simulink/ Simscape/SimPowerSystems
/Electrical Sources
3. Diode. The element is found in Simulink/Simscape/SimPowerSystems/Power Electronics.
4. Voltage Measurement. The element is found in Simulink/Simscape/SimPowerSystems/
Measurements.
5. Current Measurement. The element is found in Simulink/Simscape/SimPowerSystems/
Measurements.
6. Series RLC Branch. The element is found in Simulink/Simscape/SimPowerSystems/
Elements.
7. MUX. The element is found in Simulink/Signal Routing or /Commonly Used Blocks.
5
The operating parameters must be set for the individual blocks before the circuit can be
simulated.
1. The AC Voltage Source. Click on the component and in the dialogue box that opens, set
the following parameters: Peak Amplitude (V) = 169 V. Phase = (deg)- 0 (This will be
changed later to -130.71 deg. To make the load voltage a reference at 0 deg.), Frequency
6
(Hz) = 60 Hz, Sample Time = 0 and Measurements = None. Enable the Set
Measurements to voltage function so that the values can be seen by the Multimeter
block. Click on the Apply and OK buttons to save the changes. Click the Help button to
get more information.
2. Diode. Click on the component and in the dialogue box that opens, set the following
parameters: Resistance, Ron = 0.001, Inductance Lon = 0, Forward Voltage Vf = 0.8 V,
Initial Current = 0, Snubber Resistance = 500 Ohms, The Snubber Capacitance is Cs =
250 nF or 250e-9. Be sure to check the box titled Show measurement Port. This allows
the component voltage and current to be measured. Note that the output, m, is a bus (two
signals on one line) and must go to a Bus Selector Block or a DEMUX block set up as a
bus selector. Click on the Apply and OK buttons to save the changes. Click the Help
Figure 10. The output waveforms of the scope block with legends enabled.
white background. Set Figure Color so that the color white appears below the bucket.
Set the Axes Colors fill bucket to be white and set the paintbrush to the color black.
Since there are two individual plots, the Properties for both lines 1 and 2 are Line =
solid, 0.5 thickness and the paintbrush black. To get a higher resolution and the
8
corresponding value of the waveform at a particular point, use the Zoom buttons on the
Toolbar (3rd, 4th and 5th buttons from the left). Use Autoset, the 6th button from the left to
reset the plot. Click on the Apply and OK buttons to save the changes. Click the Help
button to get more information.
6. Scope. This configuration of a Scope block will produce 1 plot for 2 different signal
tracesas shown in Fig. 10. Click on the component and in the dialogue box that opens,
set the following parameters: In the tool bar at the top click on the second icon. The
Parameters window will open with the General pane active. Set number of axes = 1, this
will produce two separate curves in one plot. This scope has 2 signals connected through
a MUX block. Set Time Range = auto or a number larger than the simulation time.
Leave the Sampling field at the default: Decimation, 1. Do not use the Floating Scope
option since the Scope1 is connected to the circuit by 2 wires. The Legends command
will add a default label to each curve trace. The History section is set to Save Data to
WorkSpace. The Structure selection is set to Structure With Time. The Style section
must be modified so that the curves and the plots will appear as black traces on a white
background and each trace has a different type of line. This is shown in Fig. 11. Set
Figure Color so that the color white appears below the bucket. Set the Axes Colors fill
bucket to be white and set the paintbrush to the color black. Since there are two curves
on the same set of axes plots, the Properties for both lines 1 and 2 must be distinct. Thus,
Figure 13. The PowerGUI block parameters are set to the continuous mode.
buttons to save the changes. Note that the Diode in this circuit means that the Continuous
Simulation setting is the only type allowed. The box that allows the use of ideal switches
can be set if the snubber or other circuit elements are not required Click the Help button
to get more information.
Figure 14. Setting the Solver parmeters in the Configure Parameters window.
Click on the Simulation command in the upper toolbar. Click on the Update Diagram button to
reset the schematic. In Simulation mode use the Run button to start the simulation. Check the
Matlab Command window to verify the progress of the simulation and find any errors that may
halt the program execution.
12
Figure 16. The Zoom tool is used to magnify the diode voltage curve.
The PowerGUI can also be used to generate data describing the results of the simulation. Fig.
18 shows the output from the Steady-State Voltages and Currents tool. Note that the angle of the
13
The results are copied to the Clipboard where they can be edited by using a basic graphics editor
such as Paint or Visio. The results of the Steady-State Voltages and Currrents tool are
Figure 18. The Simulation and Configuration Options panel and the Steady-State
Voltages and Currents window.
reproduced in the Generate Report Function of the Simulation and Configuration Options
dialogue box of the PowerGUI block shown in Fig. 18.
15