Skip to content

Commit 1889f92

Browse files
committed
1 parent 4c40388 commit 1889f92

3 files changed

Lines changed: 104 additions & 100 deletions

File tree

‎Modelica/Electrical/PowerConverters/DCAC/Control/IntersectivePWM.mo‎

Lines changed: 26 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -24,48 +24,48 @@ block IntersectivePWM "Intersective PWM"
2424
origin={-70,30})));
2525
Modelica.Blocks.Sources.SawTooth sawTooth[m](
2626
each final nperiod=-1,
27-
each final amplitude=uMax,
28-
each final offset=-uMax/2,
27+
each final amplitude=2,
28+
each final offset=-1,
2929
each final period=1/f,
30-
final startTime={startTime - 1.5 + (if refType == ReferenceType.Sawtooth1
31-
then 0 else k)/m for k in 0:m - 1}/f)
30+
final startTime={startTime - 1.5/f + (if refType == ReferenceType.Sawtooth1
31+
then 0 else k)/m/f for k in 0:m - 1})
3232
if (refType==ReferenceType.Sawtooth1 or refType==ReferenceType.Sawtooth3)
33-
annotation (Placement(transformation(extent={{-80,-30},{-60,-10}})));
34-
Modelica.Blocks.Sources.Trapezoid trapezoid[3](
35-
each final amplitude=uMax,
33+
annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
34+
Modelica.Blocks.Sources.Trapezoid trapezoid[m](
35+
each final amplitude=2,
3636
each final width=0,
3737
each final nperiod=-1,
38-
each final offset=-uMax/2,
38+
each final offset=-1,
3939
each final rising=0.5/f,
4040
each final falling=0.5/f,
4141
each final period=1/f,
42-
final startTime={startTime - 1.25 + (if refType == ReferenceType.Triangle1
43-
then 0 else k)/m for k in 0:m - 1}/f)
42+
final startTime={startTime - 1.25/f + (if refType == ReferenceType.Triangle1
43+
then 0 else k)/m/f for k in 0:m - 1})
4444
if (refType==ReferenceType.Triangle1 or refType==ReferenceType.Triangle3)
45-
annotation (Placement(transformation(extent={{-80,-60},{-60,-40}})));
45+
annotation (Placement(transformation(extent={{-80,-40},{-60,-20}})));
4646
Modelica.Blocks.Logical.GreaterEqual greaterEqual[m]
4747
annotation (Placement(transformation(extent={{30,50},{50,70}})));
4848
Modelica.Blocks.Logical.Not negation[m]
4949
annotation (Placement(transformation(extent={{72,-70},{92,-50}})));
5050
Modelica.Blocks.Logical.Switch switch1[m]
5151
annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
52-
Modelica.Blocks.Sources.Constant const[m](each k=-uMax) annotation (Placement(
52+
Modelica.Blocks.Sources.Constant const[m](each k=-1) annotation (Placement(
5353
transformation(
5454
extent={{-10,-10},{10,10}},
5555
rotation=90,
5656
origin={-20,-30})));
5757
Modelica.Blocks.Sources.BooleanExpression booleanExpression(y=time >=
5858
startTime)
59-
annotation (Placement(transformation(extent={{-100,-90},{-80,-70}})));
59+
annotation (Placement(transformation(extent={{-100,-70},{-80,-50}})));
6060
Modelica.Blocks.Routing.BooleanReplicator booleanReplicator(nout=m)
61-
annotation (Placement(transformation(extent={{-70,-90},{-50,-70}})));
61+
annotation (Placement(transformation(extent={{-70,-70},{-50,-50}})));
62+
Blocks.Math.Gain gain[m](each k=1/uMax)
63+
annotation (Placement(transformation(extent={{-30,50},{-10,70}})));
6264
equation
6365
connect(u, fromSpacePhasor.u) annotation (Line(points={{-120,0},{-90,0},{-90,60},
6466
{-62,60}}, color={0,0,127}));
6567
connect(zero.y, fromSpacePhasor.zero)
6668
annotation (Line(points={{-70,41},{-70,52},{-62,52}}, color={0,0,127}));
67-
connect(fromSpacePhasor.y, greaterEqual.u1)
68-
annotation (Line(points={{-39,60},{28,60}}, color={0,0,127}));
6969
connect(greaterEqual.y, fire_p)
7070
annotation (Line(points={{51,60},{110,60}}, color={255,0,255}));
7171
connect(negation.y, fire_n)
@@ -74,16 +74,20 @@ equation
7474
60,-60},{70,-60}}, color={255,0,255}));
7575
connect(switch1.y, greaterEqual.u2)
7676
annotation (Line(points={{11,0},{20,0},{20,52},{28,52}}, color={0,0,127}));
77-
connect(sawTooth.y, switch1.u1) annotation (Line(points={{-59,-20},{-50,-20},{
78-
-50,8},{-12,8}}, color={0,0,127}));
79-
connect(trapezoid.y, switch1.u1) annotation (Line(points={{-59,-50},{-50,-50},
77+
connect(sawTooth.y, switch1.u1) annotation (Line(points={{-59,0},{-50,0},{-50,
78+
8},{-12,8}}, color={0,0,127}));
79+
connect(trapezoid.y, switch1.u1) annotation (Line(points={{-59,-30},{-50,-30},
8080
{-50,8},{-12,8}}, color={0,0,127}));
8181
connect(const.y, switch1.u3)
8282
annotation (Line(points={{-20,-19},{-20,-8},{-12,-8}}, color={0,0,127}));
83-
connect(booleanReplicator.y, switch1.u2) annotation (Line(points={{-49,-80},{-40,
84-
-80},{-40,0},{-12,0}}, color={255,0,255}));
83+
connect(booleanReplicator.y, switch1.u2) annotation (Line(points={{-49,-60},{-40,
84+
-60},{-40,0},{-12,0}}, color={255,0,255}));
8585
connect(booleanExpression.y, booleanReplicator.u)
86-
annotation (Line(points={{-79,-80},{-72,-80}}, color={255,0,255}));
86+
annotation (Line(points={{-79,-60},{-72,-60}}, color={255,0,255}));
87+
connect(fromSpacePhasor.y, gain.u)
88+
annotation (Line(points={{-39,60},{-32,60}}, color={0,0,127}));
89+
connect(gain.y, greaterEqual.u1)
90+
annotation (Line(points={{-9,60},{28,60}}, color={0,0,127}));
8791
annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={
8892
Line(
8993
points={{-60,0},{-51.6,34.2},{-46.1,53.1},{-41.3,66.4},{-37.1,74.6},{-32.9,
Lines changed: 78 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -1,119 +1,129 @@
11
within Modelica.Electrical.PowerConverters.Examples.DCAC.PolyphaseTwoLevel;
22
model ThreePhaseTwoLevel_PWM "Test of pulse width modulation methods"
33
extends Modelica.Icons.Example;
4-
import Modelica.Electrical.Polyphase.Functions.factorY2DC;
54
import Modelica.Constants.pi;
6-
parameter Real RMS=1 "Reference RMS Y";
7-
Modelica.Blocks.Sources.Cosine cosine(f=2,
8-
phase=0,
9-
amplitude=RMS*sqrt(2))
10-
annotation (Placement(transformation(extent={{-90,10},{-70,30}})));
11-
Modelica.Blocks.Sources.Sine sine(
12-
amplitude=cosine.amplitude,
13-
f=cosine.f,
14-
phase=cosine.phase)
15-
annotation (Placement(transformation(extent={{-90,-30},{-70,-10}})));
16-
PowerConverters.DCAC.Control.PWM pwm(uMax=sqrt(2*3), f=100)
17-
annotation (Placement(transformation(extent={{-50,-10},{-30,10}})));
18-
PowerConverters.DCAC.Polyphase2Level multiPhase2Level
19-
annotation (Placement(transformation(extent={{-10,40},{10,60}})));
20-
Modelica.Electrical.Analog.Sources.ConstantVoltage dcPos(V=pwm.uMax/2)
5+
parameter SI.Voltage V_LL=400 "RMS line-to-line voltage";
6+
parameter SI.Voltage V_DC=sqrt(2)*V_LL "Ideal DC volatge";
7+
parameter SI.Voltage Vmax=V_DC/sqrt(3) "Max. output voltage";
8+
parameter SI.Frequency f_sw=2500 "Switching frequency";
9+
parameter SI.Voltage VNom=V_LL/sqrt(3) "Nominal RMS voltage";
10+
parameter SI.Frequency fNom=50 "Nominal frequency";
11+
parameter SI.Frequency fRef=50 "Reference frequency";
12+
Modelica.Blocks.Sources.Constant refFrequ(k=fRef)
13+
annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
14+
Modelica.Electrical.Machines.Utilities.VfController vfController(
15+
VNominal=VNom, fNominal=fNom, BasePhase=pi/2)
16+
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
17+
Modelica.Electrical.Machines.SpacePhasors.Blocks.ToSpacePhasor toSpacePhasorRef
18+
annotation (Placement(transformation(extent={{-30,-10},{-10,10}})));
19+
Modelica.Electrical.PowerConverters.DCAC.Control.PWM pwm(
20+
pwmType=Modelica.Electrical.PowerConverters.Types.PWMType.SVPWM,
21+
uMax=Vmax, f=f_sw)
22+
annotation (Placement(transformation(extent={{-10,-10},{10,10}},
23+
rotation=90,
24+
origin={10,20})));
25+
Modelica.Electrical.PowerConverters.DCAC.Polyphase2Level multiPhase2Level
26+
annotation (Placement(transformation(extent={{0,40},{20,60}})));
27+
Modelica.Electrical.Analog.Sources.ConstantVoltage dcPos(V=V_DC/2)
2128
annotation (Placement(transformation(
2229
extent={{-10,-10},{10,10}},
2330
rotation=270,
24-
origin={-40,70})));
25-
Modelica.Electrical.Analog.Sources.ConstantVoltage dcNeg(V=pwm.uMax/2)
31+
origin={-30,70})));
32+
Modelica.Electrical.Analog.Sources.ConstantVoltage dcNeg(V=V_DC/2)
2633
annotation (Placement(transformation(
2734
extent={{-10,-10},{10,10}},
2835
rotation=270,
29-
origin={-40,30})));
36+
origin={-30,30})));
3037
Modelica.Electrical.Analog.Basic.Ground ground annotation (Placement(
3138
transformation(
3239
extent={{-10,-10},{10,10}},
3340
rotation=270,
34-
origin={-50,50})));
41+
origin={-40,50})));
3542
Modelica.Electrical.Polyphase.Sensors.PotentialSensor potentialSensor
36-
annotation (Placement(transformation(extent={{20,40},{40,60}})));
37-
Modelica.Blocks.Math.Harmonic harmonic(f=cosine.f, k=1)
38-
annotation (Placement(transformation(extent={{60,40},{80,60}})));
43+
annotation (Placement(transformation(extent={{30,40},{50,60}})));
44+
Modelica.Blocks.Math.Harmonic harmonic(f=fRef, k=1)
45+
annotation (Placement(transformation(extent={{70,40},{90,60}})));
3946
Modelica.Electrical.Machines.SpacePhasors.Blocks.ToSpacePhasor toSpacePhasor
40-
annotation (Placement(transformation(extent={{-30,-50},{-10,-30}})));
47+
annotation (Placement(transformation(extent={{-20,-50},{0,-30}})));
48+
Modelica.Blocks.Sources.RealExpression rotationAngle(y=vfController.x)
49+
annotation (Placement(transformation(extent={{-60,-70},{-40,-50}})));
4150
Modelica.Electrical.Machines.SpacePhasors.Blocks.Rotator rotator
42-
annotation (Placement(transformation(extent={{0,-50},{20,-30}})));
43-
Modelica.Blocks.Sources.Constant const(k=cosine.f)
44-
annotation (Placement(transformation(extent={{-60,-80},{-40,-60}})));
45-
Modelica.Blocks.Continuous.Integrator integrator(k=2*pi)
46-
annotation (Placement(transformation(extent={{-30,-80},{-10,-60}})));
47-
Modelica.Blocks.Continuous.Filter filter[2](
51+
annotation (Placement(transformation(extent={{10,-50},{30,-30}})));
52+
Modelica.Blocks.Continuous.Filter filter2[2](
4853
each init=Modelica.Blocks.Types.Init.InitialOutput,
49-
each analogFilter=Modelica.Blocks.Types.AnalogFilter.CriticalDamping,
50-
y_start={cosine.amplitude,cosine.phase},
54+
each analogFilter=Modelica.Blocks.Types.AnalogFilter.Bessel,
55+
y_start={VNom*sqrt(2),0},
5156
each order=2,
52-
each f_cut=0.5*cosine.f)
53-
annotation (Placement(transformation(extent={{30,-50},{50,-30}})));
57+
each f_cut=0.5*fRef)
58+
annotation (Placement(transformation(extent={{40,-50},{60,-30}})));
5459
Modelica.Electrical.Machines.SpacePhasors.Blocks.ToPolar toPolar
55-
annotation (Placement(transformation(extent={{60,-50},{80,-30}})));
60+
annotation (Placement(transformation(extent={{70,-50},{90,-30}})));
5661
equation
5762
connect(pwm.fire_p, multiPhase2Level.fire_p)
58-
annotation (Line(points={{-29,6},{-6,6},{-6,38}}, color={255,0,255}));
63+
annotation (Line(points={{4,31},{4,38}}, color={255,0,255}));
5964
connect(pwm.fire_n, multiPhase2Level.fire_n)
60-
annotation (Line(points={{-29,-6},{6,-6},{6,38}}, color={255,0,255}));
61-
connect(dcNeg.n, multiPhase2Level.dc_n) annotation (Line(points={{-40,20},
62-
{-20,20},{-20,44},{-10,44}},
65+
annotation (Line(points={{16,31},{16,38}}, color={255,0,255}));
66+
connect(dcNeg.n, multiPhase2Level.dc_n) annotation (Line(points={{-30,20},{
67+
-10,20},{-10,44},{0,44}},
6368
color={0,0,255}));
64-
connect(dcPos.p, multiPhase2Level.dc_p) annotation (Line(points={{-40,80},
65-
{-20,80},{-20,56},{-10,56}},
69+
connect(dcPos.p, multiPhase2Level.dc_p) annotation (Line(points={{-30,80},{
70+
-10,80},{-10,56},{0,56}},
6671
color={0,0,255}));
6772
connect(dcPos.n, ground.p)
68-
annotation (Line(points={{-40,60},{-40,50}}, color={0,0,255}));
73+
annotation (Line(points={{-30,60},{-30,50}}, color={0,0,255}));
6974
connect(ground.p, dcNeg.p)
70-
annotation (Line(points={{-40,50},{-40,40}}, color={0,0,255}));
71-
connect(cosine.y, pwm.u[1]) annotation (Line(points={{-69,20},{-60,20},{-60,
72-
-1},{-52,-1}}, color={0,0,127}));
73-
connect(sine.y, pwm.u[2]) annotation (Line(points={{-69,-20},{-60,-20},{-60,
74-
1},{-52,1}}, color={0,0,127}));
75+
annotation (Line(points={{-30,50},{-30,40}}, color={0,0,255}));
7576
connect(multiPhase2Level.ac, potentialSensor.plug_p)
76-
annotation (Line(points={{10,50},{20,50}}, color={0,0,255}));
77+
annotation (Line(points={{20,50},{30,50}}, color={0,0,255}));
7778
connect(toSpacePhasor.y, rotator.u)
78-
annotation (Line(points={{-9,-40},{-2,-40}}, color={0,0,127}));
79-
connect(potentialSensor.phi, toSpacePhasor.u) annotation (Line(points={{41,50},
80-
{50,50},{50,-20},{-40,-20},{-40,-40},{-32,-40}}, color={0,0,127}));
81-
connect(const.y, integrator.u)
82-
annotation (Line(points={{-39,-70},{-32,-70}}, color={0,0,127}));
83-
connect(integrator.y, rotator.angle)
84-
annotation (Line(points={{-9,-70},{10,-70},{10,-52}},color={0,0,127}));
79+
annotation (Line(points={{1,-40},{8,-40}}, color={0,0,127}));
80+
connect(potentialSensor.phi, toSpacePhasor.u) annotation (Line(points={{51,50},
81+
{60,50},{60,-20},{-30,-20},{-30,-40},{-22,-40}}, color={0,0,127}));
8582
connect(potentialSensor.phi[1], harmonic.u)
86-
annotation (Line(points={{41,50},{58,50}}, color={0,0,127}));
87-
connect(rotator.y, filter.u)
88-
annotation (Line(points={{21,-40},{28,-40}}, color={0,0,127}));
89-
connect(filter.y, toPolar.u)
90-
annotation (Line(points={{51,-40},{58,-40}}, color={0,0,127}));
83+
annotation (Line(points={{51,50},{68,50}}, color={0,0,127}));
84+
connect(rotator.y, filter2.u)
85+
annotation (Line(points={{31,-40},{38,-40}}, color={0,0,127}));
86+
connect(filter2.y, toPolar.u)
87+
annotation (Line(points={{61,-40},{68,-40}}, color={0,0,127}));
88+
connect(pwm.u, toSpacePhasorRef.y)
89+
annotation (Line(points={{10,8},{10,0},{-9,0}},
90+
color={0,0,127}));
91+
connect(vfController.y, toSpacePhasorRef.u)
92+
annotation (Line(points={{-39,0},{-32,0}}, color={0,0,127}));
93+
connect(refFrequ.y, vfController.u)
94+
annotation (Line(points={{-69,0},{-62,0}}, color={0,0,127}));
95+
connect(rotationAngle.y, rotator.angle)
96+
annotation (Line(points={{-39,-60},{20,-60},{20,-52}}, color={0,0,127}));
9197
annotation (experiment(
92-
StopTime=2,
98+
StopTime=0.1,
9399
Interval=0.001,
94-
Tolerance=1e-05),
100+
Tolerance=1e-06),
95101
Documentation(info="<html>
96102
<p>
97-
A reference space vector (formed by real part = cosine and imaginary part = sine) of length &radic;2*RMS and frequency 2 Hz is applied.
98-
The resulting switching patterns are applied to a three-phase twolevel bridge with switching frequency 100 Hz, fed by DC voltage = &radic;2*&radic;3*1
99-
where 1 is the theoretical maximum voltage from terminal to neutral.
103+
A reference space vector (formed by a vfController and a transformation to space phasor) is applied.
104+
The resulting switching patterns are applied to a three-phase twolevel bridge, fed by DC voltage.
100105
The resulting voltages with reference to midpoint of the DC voltage are measured.
101106
</p>
102107
<p>
103108
The RMS of the first harmonic of the first of these voltages is calculated.
104-
Please note that the value of the first harmonic is valid after the first period (i.e. 0.5 s).
109+
Please note that the value of the first harmonic is valid after the first period.
105110
</p>
106111
<p>
107112
Furthermore, these three voltages are transformed to the corresponding space phasor.
108113
Note that the zero component is not zero, indicating the shift of the neutral with respect to the midpoint of the DC voltage.
109114
</p>
110115
<p>
111-
The space phasor is rotated to the coordinate system rotating with 2*&pi;*2 Hz.
116+
The space phasor is rotated to the coordinate system rotating with reference frequency.
112117
To suppress the influence of switching, real and imaginary part of the rotated phasor are filtered.
113118
The polar representation of this rotated and filtered phasor are calculated.
114119
</p>
115120
<p>
116-
Please note that the filter has a settle time depending on the filter parameters.
121+
Please note that the filter has a settle time depending on the filter parameters and causes a delay (phase shift).
122+
</p>
123+
<h4>Note</h4>
124+
<p>
125+
Intersective PWM without additional measures (e.g. over-modulation or injection of 3<sup>rd</sup> harmonic) achieves lower voltages (&radic;3 / 2)
126+
than space vector PWM, in this example 200 V RMS comapred to 230.94 V RMS.
117127
</p>
118128
</html>"));
119129
end ThreePhaseTwoLevel_PWM;
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,5 @@
11
time
2-
filter[1].x[1]
3-
filter[1].x[2]
4-
filter[2].x[1]
5-
filter[2].x[2]
6-
harmonic.mean1.x
7-
harmonic.mean2.x
82
harmonic.y_rms
93
harmonic.y_arg
10-
integrator.y
11-
potentialSensor.phi[1]
12-
potentialSensor.phi[2]
13-
potentialSensor.phi[3]
144
toPolar.y[1]
155
toPolar.y[2]

0 commit comments

Comments
 (0)