Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
55 changes: 40 additions & 15 deletions Modelica/Electrical/PowerConverters/DCAC/Control/SVPWM.mo
Original file line number Diff line number Diff line change
Expand Up @@ -22,12 +22,19 @@ block SVPWM "Space vector pulse width modulation"
annotation (Placement(transformation(extent={{100,-70},{120,-50}})));
protected
discrete Real uRef(start=0, fixed=true) "Length of reference vector";
discrete SI.Angle phiRef(start=0, fixed=true) "Angle of reference vector within (-pi, +pi]";
discrete SI.Angle phiPos(start=0, fixed=true) "Angle of reference vector within [0, 2*pi)";
discrete SI.Angle phiRef(start=0, fixed=true)
"Angle of reference vector within (-pi, +pi]";
discrete SI.Angle phiPos(start=0, fixed=true)
"Angle of reference vector within [0, 2*pi)";
Integer ka(start=0, fixed=true), kb(start=0, fixed=true) "Switching patterns limiting the sector";
discrete SI.Angle phiSec(start=0, fixed=true) "Angle of reference vector within sector within [0, pi/m)";
discrete SI.Angle phiSec(start=0, fixed=true)
"Angle of reference vector within sector within [0, pi/m)";
discrete Real ta(start=0, fixed=true), tb(start=0, fixed=true), t0(start=1, fixed=true) "Relative time spans of vectors a, b, and 0";
discrete SI.Time T0(start=startTime, fixed=true) "Start time of switching interval";
// take sector number into account: swapping for sectors 2,4,6
Integer k1(start=0, fixed=true), k2(start=0, fixed=true) "Switching patterns limiting the sector";
discrete Real t1(start=0, fixed=true), t2(start=0, fixed=true) "Relative time spans of first and second active vector";
discrete SI.Time T0(start=startTime, fixed=true)
"Start time of switching interval";
algorithm
when sampleTrigger then
//Limited relative reference signal
Expand All @@ -49,25 +56,39 @@ algorithm
tb:=min(uRef*sin(phiSec)/sin(pi/m), 1);
ta:=min(uRef*cos(phiSec) - tb*cos(pi/m), 1);
t0:=max(1 - ta - tb, 0);
// take sector number into account: swapping for sectors 2,4,6
if mod(ka, 2) == 0 then
// sectors 1,3,5
k1:=ka;
k2:=kb;
t1:=ta;
t2:=tb;
else
// sectors 2,4,6
k1:=kb;
k2:=ka;
t1:=tb;
t2:=ta;
end if;
//Remember start time of switching interval
T0:=time;
end when;
equation
//Distribute switching patterns t0/4 + ta/2 + tb/2 + t0/2 + tb/2 + ta/2 + t0/4
//Distribute switching patterns t0/4 + t1/2 + t2/2 + t0/2 + t2/2 + t1/2 + t0/4
if time<startTime then
fire_p= fill(true, m);
elseif time < T0 + samplePeriod * (t0/4) then
fire_p= fill(false, m);
elseif time < T0 + samplePeriod * (t0/4 + ta/2) then
fire_p= fire[ka + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2) then
fire_p= fire[kb + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2) then
elseif time < T0 + samplePeriod * (t0/4 + t1/2) then
fire_p= fire[k1 + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + t1/2 + t2/2) then
fire_p= fire[k2 + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + t1/2 + t2/2 + t0/2) then
fire_p= fill(true, m);
elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2 + tb/2) then
fire_p= fire[kb + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + ta/2 + tb/2 + t0/2 + tb/2 + ta/2) then
fire_p= fire[ka + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + t1/2 + t2/2 + t0/2 + t2/2) then
fire_p= fire[k2 + 1, :];
elseif time < T0 + samplePeriod * (t0/4 + t1/2 + t2/2 + t0/2 + t2/2 + t1/2) then
fire_p= fire[k1 + 1, :];
else
fire_p= fill(false, m);
end if;
Expand Down Expand Up @@ -116,8 +137,12 @@ The relative time spans for averaging over one switching period are determined b
<li>t<sub>a</sub> + t<sub>b</sub> + t<sub>0</sub> = 1</li>
</ul>
<p>
For sectors 2,4,6 ta and tb as well as the vector indices ka and kb have to get swapped.
The results are t1 and t2 as well as k1 and k2, swapped for sector 2,4,6 and without swapping for sector 1,3,5.
</p>
<p>
To obtain the positive fire signal, the switching time spans are distributed symmetrically:
t<sub>0</sub>/4 + t<sub>a</sub>/2 + t<sub>b</sub>/2 +t<sub>0</sub>/2 + t<sub>b</sub>/2 + t<sub>a</sub>/2 + t<sub>0</sub>/4
t<sub>0</sub>/4 + t<sub>1</sub>/2 + t<sub>2</sub>/2 +t<sub>0</sub>/2 + t<sub>2</sub>/2 + t<sub>1</sub>/2 + t<sub>0</sub>/4
</p>
<p>
The switching pattern of the negative fire signal is just the inverse of the positive fire signal.
Expand Down
7 changes: 7 additions & 0 deletions Modelica/Electrical/PowerConverters/UsersGuide/References.mo
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,13 @@ class References "References"
<td><a href=\"http://personal.strath.ac.uk/barry.williams/book.htm\">
<em>Principles and Elements of Power Electronics: Devices, Drivers, Applications, and Passive Components</em></a>, available at <a href=\"http://personal.strath.ac.uk/barry.williams/book.htm\">University of Strathclyde</a>, ISBN 978-0-9553384-0-3</td>
</tr>

<tr>
<td>[TIspra524]</td>
<td>Zhenyu Yu,
<a href=\"https://www.ti.com/lit/an/spra524/spra524.pdf\">
<em>TI Application Report SPRA524: Space-Vector PWM With TMS320C24x/F24x Using Hardware and Software Determined Switching Patterns</em></a></td>
</tr>
</table>
</html>"));
end References;
Loading