Skip to content

Commit 1aff556

Browse files
committed
Fixed one file per model
1 parent 63e2512 commit 1aff556

10 files changed

Lines changed: 387 additions & 379 deletions

File tree

OpenIPSL/Electrical/VSD/Generic.mo

Lines changed: 0 additions & 378 deletions
This file was deleted.
Lines changed: 161 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,161 @@
1+
within OpenIPSL.Electrical.VSD.Generic.ControllerLogic;
2+
model VoltsHertzController "Volts/Hertz controller model"
3+
extends OpenIPSL.Electrical.Essentials.pfComponent(
4+
final enabledisplayPF=false,
5+
final enablefn=false,
6+
final enableV_b=false,
7+
final enableangle_0=false,
8+
final enablev_0=false,
9+
final enableQ_0=false,
10+
final enableS_b=true);
11+
12+
import Modelica.Constants.pi;
13+
14+
parameter Modelica.Units.SI.Frequency f_max = 80 "Maximum input voltage frequency" annotation (Dialog(group="VSD project specifics"));
15+
parameter Modelica.Units.SI.Frequency f_min = 40 "Minimum input voltage frequency" annotation (Dialog(group="VSD project specifics"));
16+
parameter Real m0= 0.1 "Initial PWM Modulation Value" annotation (Dialog(group="VSD project specifics"));
17+
18+
Modelica.Blocks.Interfaces.RealInput motor_speed "Motor speed from motor model" annotation (Placement(
19+
transformation(
20+
extent={{-20,-20},{20,20}},
21+
rotation=0,
22+
origin={-120,70}),iconTransformation(
23+
extent={{-20,-20},{20,20}},
24+
rotation=180,
25+
origin={120,40})));
26+
OpenIPSL.NonElectrical.Continuous.SimpleLag Speed_Sensor(K=1, T=Tr,
27+
y_start=0.1*1.9*Modelica.Constants.pi*SysData.fn)
28+
annotation (Placement(transformation(extent={{-38,-22},{-18,-2}})));
29+
parameter OpenIPSL.Types.Time Tr=0.01 "Time constant for speed sensor filter"
30+
annotation (Dialog(group="Control Parameters"));
31+
Modelica.Blocks.Math.Add add(k1=-1)
32+
annotation (Placement(transformation(extent={{-82,-78},{-62,-58}})));
33+
Modelica.Blocks.Nonlinear.Limiter limiter(uMax=we_max, uMin=we_min)
34+
annotation (Placement(transformation(extent={{60,-50},{80,-30}})));
35+
Modelica.Blocks.Math.Gain gain(k=Kp)
36+
annotation (Placement(transformation(extent={{-48,-60},{-28,-40}})));
37+
Modelica.Blocks.Continuous.Integrator integrator(k=Ki,
38+
initType=Modelica.Blocks.Types.Init.InitialState,
39+
y_start=0)
40+
annotation (Placement(transformation(extent={{-48,-92},{-28,-72}})));
41+
Modelica.Blocks.Math.Add add1(k1=+1)
42+
annotation (Placement(transformation(extent={{-14,-76},{6,-56}})));
43+
Modelica.Blocks.Math.Add add2(k1=+1)
44+
annotation (Placement(transformation(extent={{18,-50},{38,-30}})));
45+
Modelica.Blocks.Interfaces.RealOutput we(start=0.01*2*Modelica.Constants.pi*
46+
SysData.fn)
47+
"Synchronous speed"
48+
annotation (Placement(transformation(extent={{100,-60},{140,-20}}),
49+
iconTransformation(extent={{100,-60},{140,-20}})));
50+
Modelica.Blocks.Math.Gain gain1(k=1)
51+
annotation (Placement(transformation(extent={{10,-10},{-10,10}},
52+
rotation=0,
53+
origin={70,10})));
54+
Modelica.Blocks.Interfaces.RealOutput m "PWM modulation index"
55+
annotation (Placement(transformation(extent={{-20,-20},{20,20}},
56+
rotation=90,
57+
origin={60,120}), iconTransformation(
58+
extent={{-20,-20},{20,20}},
59+
rotation=90,
60+
origin={60,120})));
61+
Real Kf= 1/(2*pi*fn) "Gain value multiplied with input signal"
62+
annotation (Dialog(group="Control Parameters"));
63+
parameter Real Kp=5 "PI proportional gain"
64+
annotation (Dialog(group="Control Parameters"));
65+
parameter Real Ki=0.1 "PI integrator gain"
66+
annotation (Dialog(group="Control Parameters"));
67+
parameter Real we_max=2*pi*f_max "Maximum Synchronous Speed"
68+
annotation (Dialog(group="Control Parameters"));
69+
parameter Real we_min=2*pi*f_min "Minimum Synchronous Speed"
70+
annotation (Dialog(group="Control Parameters"));
71+
Modelica.Blocks.Interfaces.RealInput Vc "Capacitor voltage value" annotation (Placement(transformation(
72+
extent={{-20,-20},{20,20}},
73+
rotation=270,
74+
origin={-60,120}), iconTransformation(
75+
extent={{-20,-20},{20,20}},
76+
origin={-60,120},
77+
rotation=270)));
78+
Modelica.Blocks.Interfaces.RealInput W_ref "Synchronous speed reference"
79+
annotation (Placement(transformation(extent={{-140,-20},{-100,20}}),
80+
iconTransformation(extent={{-140,-20},{-100,20}})));
81+
Modelica.Blocks.Nonlinear.Limiter limiter1(uMax=1, uMin=0) annotation (
82+
Placement(transformation(
83+
extent={{-10,-10},{10,10}},
84+
rotation=0,
85+
origin={18,40})));
86+
Modelica.Blocks.Math.Gain gain2(k=1/V_b)
87+
annotation (Placement(transformation(extent={{-32,70},{-12,90}})));
88+
Modelica.Blocks.Sources.RealExpression realExpression(y=Kf)
89+
annotation (Placement(transformation(extent={{-72,36},{-52,56}})));
90+
Modelica.Blocks.Math.Product product1
91+
annotation (Placement(transformation(extent={{-30,30},{-10,50}})));
92+
Modelica.Blocks.Continuous.FirstOrder firstOrder(
93+
T=0.01,
94+
initType=Modelica.Blocks.Types.Init.InitialState,
95+
y_start=m0)
96+
annotation (Placement(transformation(extent={{46,30},{66,50}})));
97+
equation
98+
connect(motor_speed, Speed_Sensor.u) annotation (Line(points={{-120,70},{-84,70},
99+
{-84,-12},{-40,-12}},color={0,0,127}));
100+
connect(Speed_Sensor.y, add.u1) annotation (Line(points={{-17,-12},{-12,-12},{
101+
-12,-34},{-88,-34},{-88,-62},{-84,-62}},
102+
color={0,0,127}));
103+
connect(add.y, gain.u) annotation (Line(points={{-61,-68},{-56,-68},{-56,-50},
104+
{-50,-50}},
105+
color={0,0,127}));
106+
connect(integrator.u, gain.u) annotation (Line(points={{-50,-82},{-56,-82},{-56,
107+
-50},{-50,-50}},
108+
color={0,0,127}));
109+
connect(gain.y, add1.u1) annotation (Line(points={{-27,-50},{-24,-50},{-24,-60},
110+
{-16,-60}},
111+
color={0,0,127}));
112+
connect(integrator.y, add1.u2) annotation (Line(points={{-27,-82},{-24,-82},{-24,
113+
-72},{-16,-72}},color={0,0,127}));
114+
connect(add2.u1, Speed_Sensor.y)
115+
annotation (Line(points={{16,-34},{-12,-34},{-12,-12},{-17,-12}},
116+
color={0,0,127}));
117+
connect(add.u2, W_ref) annotation (Line(points={{-84,-74},{-94,-74},{-94,0},{-120,
118+
0}}, color={0,0,127}));
119+
connect(Vc, gain2.u) annotation (Line(points={{-60,120},{-60,80},{-34,80}},
120+
color={0,0,127}));
121+
connect(gain1.u, we) annotation (Line(points={{82,10},{94,10},{94,-40},{120,-40}},
122+
color={0,0,
123+
127}));
124+
connect(add1.y, add2.u2) annotation (Line(points={{7,-66},{16,-66},{16,-46}},
125+
color={0,0,127}));
126+
connect(add2.y, limiter.u)
127+
annotation (Line(points={{39,-40},{58,-40}}, color={0,0,127}));
128+
connect(limiter.y, we) annotation (Line(points={{81,-40},{120,-40}},
129+
color={0,0,127}));
130+
connect(integrator.u, add.y) annotation (Line(points={{-50,-82},{-56,-82},{-56,
131+
-68},{-61,-68}}, color={0,0,127}));
132+
connect(realExpression.y, product1.u1)
133+
annotation (Line(points={{-51,46},{-32,46}}, color={0,0,127}));
134+
connect(gain1.y, product1.u2) annotation (Line(points={{59,10},{-32,10},{-32,34}},
135+
color={0,0,127}));
136+
connect(limiter1.y, firstOrder.u) annotation (Line(points={{29,40},{44,40}},
137+
color={0,0,127}));
138+
connect(firstOrder.y, m) annotation (Line(points={{67,40},{72,40},{72,96},{60,
139+
96},{60,120}}, color={0,0,127}));
140+
connect(product1.y, limiter1.u) annotation (Line(points={{-9,40},{6,40}},
141+
color={0,0,127}));
142+
annotation (preferredView = "info", Icon( graphics={
143+
Rectangle(
144+
extent={{-100,100},{100,-100}},
145+
lineColor={28,108,200}), Text(
146+
extent={{-80,80},{80,-80}},
147+
lineColor={28,108,200},
148+
textString="V/f
149+
Control")}),
150+
Documentation(info="<html>
151+
<p>The VoltsHertzController component represents the controller logic for the variable speed drive. The volts hertz control is a simple and widely used method for controlling the speed of an AC induction motor by adjusting the voltage and frequency supplied to the motor at a constant ratio.</p>
152+
<p>The model has three inputs and two output connectors. The W_ref input connector represents the reference synchronous speed that is user defined,
153+
motor_speed input is the motor speed that is generated by the motor model, and the Vc input is the capacitor voltage value from the AC2DCandDC2AC component.
154+
The m output is the PWM modulation index, and the we output is the synchronous speed that is used in the controllable motor model.</p>
155+
<p>The modelling of such devices is based, mainly, on the following reference:</p>
156+
<ul>
157+
<li>Panasetsky: Variable Speed Drive Modeling\"
158+
<a href=\"modelica://OpenIPSL.UsersGuide.References\">[Panasetsky2016]</a>,</li>
159+
</ul>
160+
</html>"));
161+
end VoltsHertzController;
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
within OpenIPSL.Electrical.VSD.Generic;
2+
package ControllerLogic "Controller logic for variable speed drive"
3+
extends Modelica.Icons.Package;
4+
annotation (Documentation(info="<html>
5+
<p>This package contains the controlling logic of the variable speed drive model.</p>
6+
</html>"));
7+
end ControllerLogic;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
VoltsHertzController
Lines changed: 190 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,190 @@
1+
within OpenIPSL.Electrical.VSD.Generic.PowerElectronics;
2+
model AC2DCandDC2AC "Phasor based voltage source converter model."
3+
extends OpenIPSL.Electrical.Essentials.pfComponent(
4+
final enabledisplayPF=false,
5+
final enablefn=false,
6+
final enableV_b=false,
7+
final enableangle_0=true,
8+
final enableP_0 = false,
9+
final enableQ_0=false,
10+
final enablev_0=true,
11+
final enableS_b=true);
12+
13+
import Modelica.Constants.eps;
14+
import Modelica.Constants.pi;
15+
OpenIPSL.Interfaces.PwPin p "Grid side pin"
16+
annotation (Placement(transformation(extent={{-110,-10},{-90,10}}),
17+
iconTransformation(extent={{-110,-10},{-90,10}})));
18+
OpenIPSL.Interfaces.PwPin n "Motor side pin" annotation (Placement(transformation(extent={{90,-10},
19+
{110,10}}), iconTransformation(extent={{90,-10},{110,10}})));
20+
Modelica.Electrical.Analog.Sources.SignalVoltage Voltage "DC voltage source" annotation (
21+
Placement(transformation(
22+
extent={{-10,10},{10,-10}},
23+
rotation=270,
24+
origin={-46,-14})));
25+
Modelica.Blocks.Sources.RealExpression Vd0(y=3*sqrt(6)*Vs.y*(V_b)/Modelica.Constants.pi) "DC voltage after converter stage"
26+
annotation (Placement(transformation(extent={{-84,-24},
27+
{-64,-4}})));
28+
Modelica.Electrical.Analog.Basic.Resistor Resistor(R=Rdc) "DC link resistor"
29+
annotation (Placement(transformation(extent={{-42,-10},{-22,10}})));
30+
Modelica.Electrical.Analog.Basic.Inductor Inductor(i(start=Il0, fixed=false),
31+
L=Ldc) "DC link inductor"
32+
annotation (Placement(transformation(extent={{-16,-10},{4,10}})));
33+
Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch switch(Ron=1e-5, Goff=1e-5) "Switch enforcing no inverse current flow in DC link"
34+
annotation (Placement(transformation(extent={{10,-10},{30,10}})));
35+
Modelica.Electrical.Analog.Basic.Capacitor Capacitor(v(start=Vc0, fixed=true),
36+
C=Cdc) "DC link capacitor"
37+
annotation (
38+
Placement(transformation(
39+
extent={{-10,-10},{10,10}},
40+
rotation=270,
41+
origin={30,-14})));
42+
Modelica.Electrical.Analog.Sources.SignalCurrent signalCurrent "Current drawn source" annotation (Placement(transformation(
43+
extent={{-10,-10},{10,10}},
44+
rotation=270,
45+
origin={50,-14})));
46+
Modelica.Blocks.Sources.RealExpression Ii(y=Pmotor.y*S_b/Capacitor.v) "Current drawn expression"
47+
annotation (Placement(transformation(
48+
extent={{-10,10},{10,-10}},
49+
rotation=180,
50+
origin={78,-14})));
51+
Modelica.Blocks.Sources.RealExpression Vs(y=sqrt(p.vr^2 + p.vi^2)) "Inverter side voltage magnitude"
52+
annotation (Placement(transformation(extent={{-70,50},{-50,70}})));
53+
Modelica.Blocks.Sources.BooleanExpression open_circuit_condition(y=if
54+
Resistor.i < 0 then true else false) "Boolean expression for boolean switch to block current from flowing the opposite direction "
55+
annotation (Placement(transformation(extent={{52,6},{32,26}})));
56+
Modelica.Blocks.Sources.RealExpression Pmotor(y=-(n.vr*n.ir + n.vi*n.ii)) "Active power for drawn motor current"
57+
annotation (Placement(transformation(extent={{24,70},{44,90}})));
58+
Modelica.Blocks.Sources.RealExpression Qmotor(y=n.vr*n.ii - n.vi*n.ir) "Reactive power for drawn motor current"
59+
annotation (Placement(transformation(extent={{24,54},{44,74}})));
60+
OpenIPSL.Types.PerUnit P "Active Power";
61+
Modelica.Units.SI.ActivePower Pdc "DC Circuit Active Power";
62+
OpenIPSL.Types.PerUnit Q "Reactive Power";
63+
OpenIPSL.Types.PerUnit S "Apparent Power";
64+
65+
Modelica.Blocks.Sources.RealExpression Vmotor(y=Capacitor.v*m_input/(2*sqrt(2)
66+
*V_b)) "Motor terminal voltage"
67+
annotation (Placement(transformation(extent={{24,38},{44,58}})));
68+
Modelica.Blocks.Interfaces.RealInput m_input "PWM modulation index input" annotation (Placement(transformation(
69+
extent={{-20,-20},{20,20}},
70+
rotation=90,
71+
origin={60,-120}), iconTransformation(
72+
extent={{-20,-20},{20,20}},
73+
rotation=90,
74+
origin={60,-120})));
75+
Modelica.Blocks.Sources.RealExpression vr_m(y=Vmotor.y*cos(0)) "Motor real current"
76+
annotation (Placement(transformation(extent={{62,70},{82,90}})));
77+
Modelica.Blocks.Sources.RealExpression vi_m(y=Vmotor.y*sin(0)) "Motor imaginary current"
78+
annotation (Placement(transformation(extent={{62,54},{82,74}})));
79+
Modelica.Electrical.Analog.Basic.Ground ground "Electrical ground"
80+
annotation (Placement(transformation(extent={{-14,-50},{6,-30}})));
81+
82+
Modelica.Blocks.Interfaces.RealOutput Vc "Value of Real output" annotation (
83+
Placement(transformation(
84+
extent={{-10,-10},{10,10}},
85+
rotation=270,
86+
origin={-50,-110}), iconTransformation(
87+
extent={{-18.1811,-18.1819},{21.819,-58.1819}},
88+
rotation=270,
89+
origin={-21.8181,-118.181})));
90+
parameter Modelica.Units.SI.Resistance Rdc=0.1
91+
"DC link resistance"
92+
annotation (Dialog(group="DC Link Parameters"));
93+
parameter Modelica.Units.SI.Inductance Ldc=0.001
94+
"DC link inductance"
95+
annotation (Dialog(group="DC Link Parameters"));
96+
parameter Modelica.Units.SI.Capacitance Cdc=0.02
97+
"DC link capacitance"
98+
annotation (Dialog(group="DC Link Parameters"));
99+
parameter Real m0= 0.1 "Initial PWM modulation value" annotation (Dialog(group="DC Link Parameters"));
100+
Modelica.Blocks.Sources.RealExpression Smotor(y=sqrt(Pmotor.y^2 + Qmotor.y^2)) "Motor apparent power"
101+
annotation (Placement(transformation(extent={{62,38},{82,58}})));
102+
103+
protected
104+
parameter OpenIPSL.Types.Voltage Vc0 = 2*sqrt(2)*Vmotor0*V_b/m0 "Initial capacitor voltage";
105+
parameter OpenIPSL.Types.Current Il0 = 0 "Initial inductor current";
106+
parameter OpenIPSL.Types.PerUnit Vmotor0 = (3*sqrt(3)/(2*pi))*m0 "Initial terminal voltage";
107+
108+
Modelica.Blocks.Sources.RealExpression Capacitor_Voltage(y=Capacitor.v) "Capacitor voltage"
109+
annotation (Placement(transformation(extent={{-84,-84},{-64,-64}})));
110+
111+
equation
112+
connect(Vd0.y, Voltage.v)
113+
annotation (Line(points={{-63,-14},{-58,-14}}, color={0,0,127}));
114+
connect(Voltage.p, Resistor.p)
115+
annotation (Line(points={{-46,-4},{-46,0},{-42,0}}, color={0,0,255}));
116+
connect(Resistor.n, Inductor.p)
117+
annotation (Line(points={{-22,0},{-16,0}}, color={0,0,255}));
118+
connect(Inductor.n, switch.p)
119+
annotation (Line(points={{4,0},{10,0}}, color={0,0,255}));
120+
connect(switch.n, Capacitor.p)
121+
annotation (Line(points={{30,0},{30,-4}}, color={0,0,255}));
122+
connect(Voltage.n, Capacitor.n) annotation (Line(points={{-46,-24},{-46,-28},{
123+
30,-28},{30,-24}}, color={0,0,255}));
124+
connect(switch.n, signalCurrent.p) annotation (Line(points={{30,0},{50,0},{50,
125+
-4}}, color={0,0,255}));
126+
connect(signalCurrent.n, Capacitor.n) annotation (Line(points={{50,-24},{50,-28},
127+
{30,-28},{30,-24}}, color={0,0,255}));
128+
connect(signalCurrent.i, Ii.y) annotation (Line(points={{62,-14},{67,-14}}, color={0,0,127}));
129+
connect(open_circuit_condition.y, switch.control)
130+
annotation (Line(points={{31,16},{20,16},{20,12}}, color={255,0,255}));
131+
P = p.vr*p.ir + p.vi*p.ii;
132+
Q = (-p.vr*p.ii) + p.vi*p.ir;
133+
Q = 0;
134+
S = sqrt(P^2 + Q^2);
135+
Pdc = Vd0.y*Resistor.i;
136+
P*S_b = Pdc;
137+
138+
n.vr = vr_m.y;
139+
n.vi = vi_m.y;
140+
connect(ground.p, Capacitor.n) annotation (Line(points={{-4,-30},{-4,-28},{30,
141+
-28},{30,-24}},
142+
color={0,0,255}));
143+
connect(Capacitor_Voltage.y, Vc) annotation (Line(points={{-63,-74},{-50,-74},
144+
{-50,-110}}, color={0,0,127}));
145+
annotation (preferredView = "info",Icon(
146+
graphics={Rectangle(
147+
extent={{-100,100},{100,-100}},
148+
lineColor={28,108,200}),
149+
Line(points={{-100,-100},{100,100}}, color={28,108,200}),
150+
Text(
151+
extent={{-90,80},{30,20}},
152+
textColor={28,108,200},
153+
textString="AC/DC"),
154+
Text(
155+
extent={{-30,-20},{90,-80}},
156+
textColor={28,108,200},
157+
textString="DC/AC")}), Diagram( graphics={Rectangle(
158+
extent={{14,90},{94,40}},
159+
lineColor={0,0,255},
160+
pattern=LinePattern.Dash), Text(
161+
extent={{24,98},{84,92}},
162+
lineColor={0,0,255},
163+
pattern=LinePattern.Dash,
164+
textString="Motor Variables"), Rectangle(
165+
extent={{-80,80},{-40,40}},
166+
lineColor={0,0,255},
167+
pattern=LinePattern.Dash), Text(
168+
extent={{-92,88},{-30,82}},
169+
lineColor={0,0,255},
170+
pattern=LinePattern.Dash,
171+
textString="Grid Variables"), Rectangle(
172+
extent={{-94,-54},{-54,-94}},
173+
lineColor={0,0,255},
174+
pattern=LinePattern.Dash), Text(
175+
extent={{-106,-46},{-44,-52}},
176+
lineColor={0,0,255},
177+
pattern=LinePattern.Dash,
178+
textString="DC Link Variables")}),
179+
Documentation(info="<html>
180+
<p>The AC2DCandDC2AC component represents the power electronics component of the variable speed drive.
181+
The model provides an interface between two terminals. Terminal pin p is related to the grid bus side and terminal pin n is related to the
182+
motor terminal bus. The model is an average representation of the switching components of a real variable speed drive, thus being ideal for long simulation durations on phasor dynamic simulations.</p>
183+
<p>The model has one input and one output connectors. The m_input input connector represents the pwn modulation index, while the Vc output connector represents the capacitor voltage value used in the controller logic block.</p>
184+
<p>The modelling of such devices is based, mainly, on the following reference:</p>
185+
<ul>
186+
<li>Panasetsky: Variable Speed Drive Modeling\"
187+
<a href=\"modelica://OpenIPSL.UsersGuide.References\">[Panasetsky2016]</a>,</li>
188+
</ul>
189+
</html>"));
190+
end AC2DCandDC2AC;
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
within OpenIPSL.Electrical.VSD.Generic;
2+
package PowerElectronics "Variable speed drive power electronics model"
3+
extends Modelica.Icons.Package;
4+
5+
annotation (Documentation(info="<html>
6+
<p>This package contains the power electronics component of the variable speed drive model.</p>
7+
</html>"));
8+
end PowerElectronics;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
AC2DCandDC2AC

0 commit comments

Comments
 (0)