Skip to content

Commit 05e8a6b

Browse files
committed
Update
1 parent a5e85e6 commit 05e8a6b

3 files changed

Lines changed: 4336 additions & 16 deletions

File tree

OpenIPSL/Electrical/Machines/ControlsMotors.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -232,7 +232,7 @@ package ControlsMotors "Control models"
232232
Modelica.Electrical.Analog.Ideal.IdealOpeningSwitch switch(Ron=1e-5, Goff=1e-5)
233233
annotation (Placement(transformation(extent={{10,-10},{30,10}})));
234234
Modelica.Electrical.Analog.Basic.Capacitor Capacitor(v(start=Vc0, fixed
235-
=false), C=Cdc)
235+
=true), C=Cdc)
236236
annotation (
237237
Placement(transformation(
238238
extent={{-10,-10},{10,10}},

OpenIPSL/Electrical/Machines/MultiDomain.mo

Lines changed: 238 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -817,7 +817,8 @@ PSSE")}));
817817
package PSAT "Three-phase induction motor models from PSAT software"
818818

819819
model MD_MotorTypeI "Multidomain type I three-phase induction motor model"
820-
extends BaseClasses.BaseMultiDomainThreePhase;
820+
extends BaseClasses.BaseMultiDomainThreePhase(Rotor_Inertia(
821+
stateSelect=StateSelect.prefer));
821822

822823
// Parameter Set
823824
parameter OpenIPSL.Types.PerUnit Xs=0.0759 "Stator reactance" annotation (Dialog(group="Machine parameters"));
@@ -830,7 +831,7 @@ PSSE")}));
830831
OpenIPSL.Types.PerUnit Xe;
831832
OpenIPSL.Types.PerUnit Xmag;
832833
OpenIPSL.Types.PerUnit Omegar "Rotor angular velocity";
833-
OpenIPSL.Types.PerUnit Pmotor;
834+
//OpenIPSL.Types.PerUnit Pmotor;
834835
OpenIPSL.Types.PerUnit Te;
835836
equation
836837

@@ -847,7 +848,7 @@ PSSE")}));
847848

848849
//Mechanical Swing Equation
849850
s = (1 - Omegar);
850-
der(s) = (Tmech_pu_motor - Pmotor)/(2*H);
851+
der(s) = (Tmech_pu_motor - Te)/(2*H);
851852

852853
//Electromagnetic Torque
853854
Te = if Ctrl == true then P_motor/(we_fix.y/w_b) else P_motor;
@@ -978,6 +979,48 @@ PSSE")}));
978979
annotation(preferredView = "info");
979980
end MD_MotorTypeV;
980981

982+
model MD_MotorTypeI_modified
983+
"Multidomain type I three-phase induction motor model"
984+
extends BaseClasses.BaseMultiDomainThreePhase_modified(Rotor_Inertia(
985+
stateSelect=StateSelect.prefer));
986+
987+
// Parameter Set
988+
parameter OpenIPSL.Types.PerUnit Xs=0.0759 "Stator reactance" annotation (Dialog(group="Machine parameters"));
989+
parameter OpenIPSL.Types.PerUnit R1=0.0085 "1st cage rotor resistance" annotation (Dialog(group="Machine parameters"));
990+
parameter OpenIPSL.Types.PerUnit X1=0.0759 "1st cage rotor reactance" annotation (Dialog(group="Machine parameters"));
991+
parameter OpenIPSL.Types.PerUnit Xm=3.1241 "Magnetizing reactance" annotation (Dialog(group="Machine parameters"));
992+
993+
// Variable Set
994+
OpenIPSL.Types.PerUnit Re;
995+
OpenIPSL.Types.PerUnit Xe;
996+
OpenIPSL.Types.PerUnit Xmag;
997+
OpenIPSL.Types.PerUnit Omegar "Rotor angular velocity";
998+
//OpenIPSL.Types.PerUnit Pmotor;
999+
OpenIPSL.Types.PerUnit Te;
1000+
Modelica.Mechanics.Rotational.Sources.Torque torque
1001+
annotation (Placement(transformation(extent={{-36,-80},{-56,-60}})));
1002+
equation
1003+
1004+
//Real and Imaginary currents drawn by the motor in the motor base
1005+
Ii = (-p.vr/Xmag) + (p.vi*Re - p.vr*Xe)/(Re*Re + Xe*Xe);
1006+
Ir = p.vi/Xmag + (p.vr*Re + p.vi*Xe)/(Re*Re + Xe*Xe);
1007+
1008+
//Rotor impedance
1009+
Re = R1/max(s,Modelica.Constants.eps);
1010+
Xe = (if Ctrl == false then Xs + X1 else (we_fix.y/w_b)*(Xs + X1));
1011+
1012+
//Magnetization Impedance
1013+
Xmag = (if Ctrl == false then Xm else (we_fix.y/w_b)*Xm);
1014+
1015+
//Mechanical Swing Equation
1016+
s = (1 - Omegar);
1017+
der(s) = (Tmech_pu_motor - Te)/(2*H);
1018+
1019+
//Electromagnetic Torque
1020+
Te = if Ctrl == true then P_motor/(we_fix.y/w_b) else P_motor;
1021+
Tee = Te*CoB*T_b;
1022+
annotation(preferredView = "info");
1023+
end MD_MotorTypeI_modified;
9811024
annotation(preferredView = "info", Icon(graphics={
9821025
Rectangle(
9831026
lineColor={200,200,200},
@@ -1149,6 +1192,9 @@ PSAT")}));
11491192
P = if Ctrl == true then (p.vr*p.ir + p.vi*p.ii)*(we_fix.y/w_b) else (p.vr*p.ir + p.vi*p.ii);
11501193
Q = if Ctrl == true then ((-p.vr*p.ii) + p.vi*p.ir)*(we_fix.y/w_b) else (-p.vr*p.ii) + p.vi*p.ir;
11511194

1195+
//P = (p.vr*p.ir + p.vi*p.ii);
1196+
//Q = (-p.vr*p.ii) + p.vi*p.ir;
1197+
11521198
//Active and Reactive Power consumption in the machine base
11531199
P_motor = P/CoB;
11541200
Q_motor = Q/CoB;
@@ -1182,6 +1228,195 @@ PSAT")}));
11821228
textColor={0,140,72},
11831229
textString="MD")}), Diagram(coordinateSystem(preserveAspectRatio=false)));
11841230
end BaseMultiDomainThreePhase;
1231+
1232+
partial model BaseMultiDomainThreePhase_modified
1233+
"Three-phase motor partial model"
1234+
1235+
parameter OpenIPSL.Types.ApparentPower M_b = 15e6 "Machine base power"
1236+
annotation (Dialog(group="Power flow data"));
1237+
extends OpenIPSL.Electrical.Essentials.pfComponent(
1238+
final enabledisplayPF=false,
1239+
final enablefn=false,
1240+
final enableV_b=false,
1241+
final enableangle_0=false,
1242+
final enablev_0=false,
1243+
final enableQ_0=false,
1244+
final enableP_0=false,
1245+
final enableS_b=false);
1246+
1247+
import Modelica.Constants.pi;
1248+
import OpenIPSL.NonElectrical.Functions.SE;
1249+
import Modelica.Constants.eps;
1250+
1251+
parameter Boolean Sup = true "True: Start-up process, False: Steady-state condition" annotation (Dialog(group="Motor Setup"));
1252+
parameter Boolean Ctrl = true "True: Model for VSD control, False: Model not controllable"
1253+
annotation (Dialog(group="Motor Setup"));
1254+
parameter Real N = 1 "Number of pair of Poles"
1255+
annotation (Dialog(group="Machine parameters"));
1256+
parameter Modelica.Units.SI.Time H = 0.4 "Inertia constant"
1257+
annotation (Dialog(group="Machine parameters"));
1258+
1259+
OpenIPSL.Types.PerUnit v "Bus voltage magnitude";
1260+
OpenIPSL.Types.Angle anglev " Bus voltage angle";
1261+
OpenIPSL.Types.Angle delta " Bus voltage angle";
1262+
OpenIPSL.Types.PerUnit s;
1263+
OpenIPSL.Types.PerUnit P;
1264+
OpenIPSL.Types.PerUnit Q;
1265+
Modelica.Units.SI.AngularVelocity nr;
1266+
Modelica.Units.SI.AngularVelocity ns;
1267+
Modelica.Units.SI.AngularVelocity w_sync;
1268+
Modelica.Units.SI.Torque T_b;
1269+
OpenIPSL.Types.PerUnit Tmech_pu_sys;
1270+
OpenIPSL.Types.PerUnit Tmech_pu_motor;
1271+
Modelica.Units.SI.Torque Tee;
1272+
OpenIPSL.Types.PerUnit P_motor "OK";
1273+
OpenIPSL.Types.PerUnit Q_motor "OK";
1274+
OpenIPSL.Types.PerUnit Vr "OK";
1275+
OpenIPSL.Types.PerUnit Vi "OK";
1276+
OpenIPSL.Types.PerUnit Ir "OK";
1277+
OpenIPSL.Types.PerUnit Ii "OK";
1278+
OpenIPSL.Types.PerUnit Imag;
1279+
1280+
Modelica.Blocks.Sources.RealExpression Rotor_Speed(y=nr)
1281+
annotation (Placement(transformation(extent={{20,-50},{0,-30}})));
1282+
Modelica.Mechanics.Rotational.Components.Inertia Rotor_Inertia(J=J_load, w(fixed=
1283+
true, start=Modelica.Constants.eps))
1284+
annotation (Placement(transformation(extent={{-40,-10},{-60,10}})));
1285+
Modelica.Blocks.Math.Gain we_fix(k=1)
1286+
annotation (Placement(transformation(extent={{70,-90},{80,-80}})));
1287+
Modelica.Blocks.Sources.Constant we_source_fix(k=0)
1288+
if not Ctrl
1289+
annotation (Placement(transformation(extent={{32,-86},{44,-74}})));
1290+
OpenIPSL.Interfaces.PwPin p(
1291+
vr(start=vr0),
1292+
vi(start=vi0),
1293+
ir(start=ir0_sys),
1294+
ii(start=ii0_sys))
1295+
annotation (Placement(transformation(extent={{90,-10},{110,10}})));
1296+
Modelica.Mechanics.Rotational.Interfaces.Flange_b flange annotation (
1297+
Placement(transformation(extent={{-110,-10},{-90,10}}),
1298+
iconTransformation(extent={{-110,-10},{-90,10}})));
1299+
Modelica.Blocks.Interfaces.RealOutput wr
1300+
"Absolute angular velocity of flange as output signal"
1301+
annotation (Placement(transformation(extent={{-100,-50},{-120,-30}}),
1302+
iconTransformation(
1303+
extent={{20,-20},{-20,20}},
1304+
rotation=90,
1305+
origin={60,-120})));
1306+
Modelica.Blocks.Interfaces.RealInput we if Ctrl annotation (Placement(
1307+
transformation(
1308+
extent={{-20,-20},{20,20}},
1309+
rotation=90,
1310+
origin={60,-120}), iconTransformation(
1311+
extent={{-20,-20},{20,20}},
1312+
rotation=90,
1313+
origin={0,-120})));
1314+
Modelica.Blocks.Interfaces.RealInput mech_torque annotation (Placement(
1315+
transformation(
1316+
extent={{-20,-20},{20,20}},
1317+
rotation=90,
1318+
origin={-60,-120}), iconTransformation(
1319+
extent={{-20,-20},{20,20}},
1320+
rotation=90,
1321+
origin={-60,-120})));
1322+
1323+
Modelica.Mechanics.Rotational.Sources.Torque torque
1324+
annotation (Placement(transformation(extent={{0,-10},{-20,10}})));
1325+
Modelica.Blocks.Sources.RealExpression Telectromagnetic(y=Tee)
1326+
annotation (Placement(transformation(extent={{48,-10},{28,10}})));
1327+
protected
1328+
parameter Modelica.Units.SI.Inertia J_load = 2*H*M_b/((2*pi*fn/N)^2);
1329+
parameter OpenIPSL.Types.PerUnit p0 = P_0/M_b;
1330+
parameter OpenIPSL.Types.PerUnit q0 = Q_0/M_b;
1331+
parameter Modelica.Units.SI.AngularVelocity w_b=2*pi*fn/N "Base freq in rad/s";
1332+
parameter OpenIPSL.Types.PerUnit vr0=v_0*cos(angle_0);
1333+
parameter OpenIPSL.Types.PerUnit vi0=v_0*sin(angle_0);
1334+
parameter OpenIPSL.Types.PerUnit ir0=(p0*vr0 + q0*vi0)/(vr0^2 + vi0^2);
1335+
parameter OpenIPSL.Types.PerUnit ii0=(p0*vi0 - q0*vr0)/(vr0^2 + vi0^2);
1336+
parameter OpenIPSL.Types.PerUnit ir0_sys = CoB*ir0 "Initial real current in system base";
1337+
parameter OpenIPSL.Types.PerUnit ii0_sys = CoB*ii0 "Initial imaginary current in system base";
1338+
parameter Real CoB = M_b/S_b;
1339+
parameter Real s0 = 1 - eps;
1340+
parameter Real w0 = if Sup == true then 100*eps else 2*Modelica.Constants.pi*SysData.fn;
1341+
//parameter OpenIPSL.Types.PerUnit epm0 = 0;
1342+
//parameter OpenIPSL.Types.PerUnit eppm0 = 0;
1343+
//parameter OpenIPSL.Types.PerUnit eppr0 = 0;
1344+
//parameter OpenIPSL.Types.PerUnit epr0 = 0;
1345+
1346+
initial equation
1347+
if Sup == false then
1348+
der(s) = Modelica.Constants.eps;
1349+
else
1350+
s = 1 - Modelica.Constants.eps;
1351+
end if;
1352+
1353+
equation
1354+
connect(Rotor_Inertia.flange_b,flange)
1355+
annotation (Line(points={{-60,0},{-100,0}}, color={0,0,0}));
1356+
connect(wr,Rotor_Speed. y) annotation (Line(points={{-110,-40},{-1,-40}},
1357+
color={0,0,127}));
1358+
connect(we,we_fix. u)
1359+
annotation (Line(points={{60,-120},{60,-85},{69,-85}}, color={0,0,127}));
1360+
connect(we_source_fix.y,we_fix. u)
1361+
annotation (Line(points={{44.6,-80},{69,-80},{69,-85}}, color={0,0,127}));
1362+
1363+
//Synchronous speed based on controllable boolean parameter
1364+
w_sync = (if Ctrl == true then we_fix.y/N else w_b);
1365+
1366+
// Network Interface Equations
1367+
anglev = atan2(p.vi, p.vr) "OK";
1368+
delta = anglev "OK";
1369+
v = sqrt(p.vr^2 + p.vi^2) "OK";
1370+
Vr = p.vr "OK";
1371+
Vi = p.vi "OK";
1372+
[Ir; Ii] = (1/CoB)*[p.ir; p.ii] "OK";
1373+
Imag = sqrt(Ir^2 + Ii^2);
1374+
1375+
// MISSING VOLTAGE EQUATIONS
1376+
1377+
P = if Ctrl == true then (p.vr*p.ir + p.vi*p.ii)*(we_fix.y/w_b) else (p.vr*p.ir + p.vi*p.ii);
1378+
Q = if Ctrl == true then ((-p.vr*p.ii) + p.vi*p.ir)*(we_fix.y/w_b) else (-p.vr*p.ii) + p.vi*p.ir;
1379+
1380+
//P = (p.vr*p.ir + p.vi*p.ii);
1381+
//Q = (-p.vr*p.ii) + p.vi*p.ir;
1382+
1383+
//Active and Reactive Power consumption in the machine base
1384+
P_motor = P/CoB;
1385+
Q_motor = Q/CoB;
1386+
1387+
//Rotor speed equation
1388+
ns = w_sync;
1389+
nr = (1-s)*ns;
1390+
1391+
//Conversion from SI torqur to p.u. torque
1392+
Tmech_pu_sys = mech_torque/T_b;
1393+
Tmech_pu_motor = Tmech_pu_sys/CoB;
1394+
1395+
//Torque System base
1396+
T_b = S_b/w_b;
1397+
1398+
connect(torque.flange, Rotor_Inertia.flange_a)
1399+
annotation (Line(points={{-20,0},{-40,0}}, color={0,0,0}));
1400+
connect(Telectromagnetic.y, torque.tau)
1401+
annotation (Line(points={{27,0},{2,0}}, color={0,0,127}));
1402+
annotation (preferredView = "info",Icon(coordinateSystem(preserveAspectRatio=false), graphics={
1403+
Rectangle(extent={{-100,100},{100,-100}}, lineColor={28,108,200}),
1404+
Ellipse(
1405+
fillColor={255,255,255},
1406+
extent={{-56,-58},{55.932,54}}), Text(
1407+
extent={{-50,48},{50,-52}},
1408+
lineColor={0,0,0},
1409+
textString="M"),Text(
1410+
origin={0,-80},
1411+
extent={{-100,-20},{100,20}},
1412+
fontName="Arial",
1413+
lineColor={0,0,0},
1414+
textString="%name"),
1415+
Text(
1416+
extent={{-90,100},{-30,60}},
1417+
textColor={0,140,72},
1418+
textString="MD")}), Diagram(coordinateSystem(preserveAspectRatio=false)));
1419+
end BaseMultiDomainThreePhase_modified;
11851420
annotation(preferredView = "info");
11861421
end BaseClasses;
11871422
annotation (preferredView = "info", Icon(graphics={

0 commit comments

Comments
 (0)