Ticket #6319: Test.mo

File Test.mo, 17.6 KB (added by Francesco Casella, 4 years ago)
Line 
1package Test
2
3 model ScTT
4 extends Modelica.Icons.Example;
5 inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) annotation (
6 Placement(visible = true, transformation(origin = {50, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
7 PowerGrids.Electrical.Buses.BusFault bus(R = 0.05, SNom = 500000000, UNom = 380000, UStart = 1.050 * 380e3, X = 0, portVariablesPhases = true, portVariablesPu = true, startTime = 0.1, stopTime = 990.2) annotation (
8 Placement(visible = true, transformation(origin = {-6, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
9 Modelica.Blocks.Sources.RealExpression ufPu(y = 1) annotation (
10 Placement(visible = true, transformation(extent = {{-72, -26}, {-52, -6}}, rotation = 0)));
11 Modelica.Blocks.Sources.RealExpression pmPu annotation (
12 Placement(visible = true, transformation(extent = {{-72, -2}, {-52, 18}}, rotation = 0)));
13 PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 1000, PStart(displayUnit = "W") = -4.75e+08, QStart = -1.56e+08, SNom(displayUnit = "V.A") = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom(displayUnit = "V") = 21000, UPhaseStart = 0.161146, UStart = 21e3 * 0.992, neglectTransformerTerms = false, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) annotation (
14 Placement(visible = true, transformation(origin = {-26, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
15 PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.050 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) annotation (
16 Placement(visible = true, transformation(origin = {66, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
17 PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161146, UPhaseStartB = 0, UStartA = 0.992 * 21e3, UStartB = 1.050 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) annotation (
18 Placement(visible = true, transformation(origin = {14, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
19 PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRef = 4.75e+08, QRef = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) annotation (
20 Placement(visible = true, transformation(origin = {44, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
21 PowerGrids.Electrical.Buses.Bus NTHV(SNom = 500000000, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) annotation (
22 Placement(visible = true, transformation(origin = {38, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
23 equation
24 connect(pmPu.y, GEN.PmPu) annotation (
25 Line(points = {{-51, 8}, {-42, 8}, {-42, 4}, {-36, 4}}, color = {0, 0, 127}));
26 connect(GEN.ufPuIn, ufPu.y) annotation (
27 Line(points = {{-36.2, -4}, {-42, -4}, {-42, -16}, {-51, -16}}, color = {0, 0, 127}));
28 connect(GEN.terminal, bus.terminal) annotation (
29 Line(points = {{-26, 0}, {-26, -24}, {-6, -24}}));
30 connect(TGEN.terminalB, NTHV.terminal) annotation (
31 Line(points = {{24, -24}, {38, -24}}));
32 connect(NTHV.terminal, GRID.terminal) annotation (
33 Line(points = {{38, -24}, {66, -24}}));
34 connect(GRIDL.terminal, GRID.terminal) annotation (
35 Line(points = {{44, -38}, {44, -24}, {66, -24}}));
36 connect(TGEN.terminalA, bus.terminal) annotation (
37 Line(points = {{4, -24}, {-6, -24}}));
38 annotation (
39 experiment(StopTime = 4, Interval = 0.001, Tolerance = 1e-06, __Dymola_Algorithm = "Dassl"),
40 Documentation(info = "<html><head></head><body><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Modello derivato da PowerGrids.Electrical.Machines.Test.SynchronousMachine4WindingsNoLoad per valutare l'andamento nel tempo di correnti di corto circuito trifase franco a partire da macchina a vuoto.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Questo modello non converge se si sceglie di inserire anche i TransformerTerms nel modello della macchina.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Per valutare il comportamento della macchina con i TransformerTerms si può usare il modello contenente \"TT\" nel nome del mesedesimo package do qiesto modello.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Per ottenere una velocità socostante qui si è scelta una enorme costante d'inerzia H=1000s.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\"><br></p>
41 </body></html>"),
42 Diagram(coordinateSystem(extent = {{-80, -60}, {80, 60}})));
43 end ScTT;
44
45 model ScTT1
46 extends Modelica.Icons.Example;
47 import PI = Modelica.Constants.pi;
48 inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) annotation (
49 Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
50 PowerGrids.Electrical.Buses.BusFault bus(R = 0.05, SNom = 500000000, UNom = 380000, UStart = 1.050 * 380e3, X = 0, portVariablesPhases = true, portVariablesPu = true, startTime = 0.1, stopTime = 990.2) annotation (
51 Placement(visible = true, transformation(origin = {14, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
52 Modelica.Blocks.Sources.RealExpression ufPu(y = 1) annotation (
53 Placement(visible = true, transformation(extent = {{-52, 16}, {-32, 36}}, rotation = 0)));
54 Modelica.Blocks.Sources.RealExpression pmPu annotation (
55 Placement(visible = true, transformation(extent = {{-52, 36}, {-32, 56}}, rotation = 0)));
56 PowerGrids.Electrical.Machines.SynchronousMachine4Windings GEN(H = 1000, PStart(displayUnit = "W") = -4.75e+08, QStart = -1.56e+08, SNom(displayUnit = "V.A") = 5e+08, Tpd0 = 5.143, Tppd0 = 0.042, Tppq0 = 0.083, Tpq0 = 2.16, UNom(displayUnit = "V") = 21000, UPhaseStart = 0.161146, UStart = 21e3 * 0.992, neglectTransformerTerms = false, portVariablesPhases = true, raPu = 0, xdPu = 2, xlPu = 0.15, xpdPu = 0.35, xppdPu = 0.25, xppqPu = 0.3, xpqPu = 0.5, xqPu = 1.8) annotation (
57 Placement(visible = true, transformation(origin = {2, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
58 PowerGrids.Electrical.Buses.EquivalentGrid GRID(R_X = 1 / 10, SNom = 5e+08, SSC = 2.5e+09, UNom = 380000, URef = 1.050 * 380e3, c = 1.1, portVariablesPhases = true, portVariablesPu = true) annotation (
59 Placement(visible = true, transformation(origin = {86, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
60 PowerGrids.Electrical.Branches.TransformerFixedRatio TGEN(PStartA = 4.75e+08, PStartB = -4.75e+08, QStartA = 1.56e+08, QStartB = -7.6e+07, R = 0.15e-2 * 419 ^ 2 / 500, SNom = 5e+08, UNomA = 21000, UNomB = 419000, UPhaseStartA = 0.161146, UPhaseStartB = 0, UStartA = 0.992 * 21e3, UStartB = 1.050 * 380e3, X = 16e-2 * 419 ^ 2 / 500, portVariablesPhases = true, portVariablesPu = true, rFixed = 419 / 21) annotation (
61 Placement(visible = true, transformation(origin = {34, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
62 PowerGrids.Electrical.Loads.LoadImpedancePQ GRIDL(PRef = 4.75e+08, QRef = 7.6e+07, SNom = 5e+08, UNom = 380000, URef = 1.05 * 380e3, portVariablesPhases = true, portVariablesPu = true) annotation (
63 Placement(visible = true, transformation(origin = {64, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
64 PowerGrids.Electrical.Buses.Bus NTHV(SNom = 500000000, UNom = 21000, portVariablesPhases = true, portVariablesPu = true) annotation (
65 Placement(visible = true, transformation(origin = {58, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
66 Support.GetCurrent iMach annotation (
67 Placement(visible = true, transformation(origin = {2, -2}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
68 Support.FromPark fromPark(p = 1) annotation (
69 Placement(visible = true, transformation(extent = {{-28, -14}, {-48, 6}}, rotation = 0)));
70 Modelica.Blocks.Sources.RealExpression theta(y = 2 * PI * 50 * time) annotation (
71 Placement(visible = true, transformation(origin = {-72, -28}, extent = {{-16, -10}, {16, 10}}, rotation = 0)));
72 equation
73 connect(pmPu.y, GEN.PmPu) annotation (
74 Line(points = {{-31, 46}, {-22, 46}, {-22, 42}, {-8, 42}}, color = {0, 0, 127}));
75 connect(GEN.ufPuIn, ufPu.y) annotation (
76 Line(points = {{-8.2, 34}, {-22.2, 34}, {-22.2, 26}, {-31, 26}}, color = {0, 0, 127}));
77 connect(TGEN.terminalB, NTHV.terminal) annotation (
78 Line(points = {{44, -24}, {58, -24}}));
79 connect(NTHV.terminal, GRID.terminal) annotation (
80 Line(points = {{58, -24}, {86, -24}}));
81 connect(GRIDL.terminal, GRID.terminal) annotation (
82 Line(points = {{64, -38}, {64, -24}, {86, -24}}));
83 connect(TGEN.terminalA, bus.terminal) annotation (
84 Line(points = {{24, -24}, {14, -24}}));
85 connect(GEN.terminal, iMach.term_p) annotation (
86 Line(points = {{2, 38}, {2, 8}}));
87 connect(iMach.term_n, bus.terminal) annotation (
88 Line(points = {{2, -12}, {2, -24}, {14, -24}}));
89 connect(fromPark.Xd, iMach.i_d) annotation (
90 Line(points = {{-26, 2}, {-8, 2}}, color = {0, 0, 127}));
91 connect(iMach.i_q, fromPark.Xq) annotation (
92 Line(points = {{-8, -6}, {-16, -6}, {-16, -10}, {-26, -10}}, color = {0, 0, 127}));
93 connect(fromPark.phi, theta.y) annotation (
94 Line(points = {{-38, -16}, {-38, -28}, {-54, -28}}, color = {0, 0, 127}));
95 annotation (
96 experiment(StopTime = 4, Interval = 0.001, Tolerance = 1e-06, __Dymola_Algorithm = "Dassl"),
97 Documentation(info = "<html><head></head><body><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Modello derivato da PowerGrids.Electrical.Machines.Test.SynchronousMachine4WindingsNoLoad per valutare l'andamento nel tempo di correnti di corto circuito trifase franco a partire da macchina a vuoto.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Questo modello non converge se si sceglie di inserire anche i TransformerTerms nel modello della macchina.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Per valutare il comportamento della macchina con i TransformerTerms si può usare il modello contenente \"TT\" nel nome del mesedesimo package do qiesto modello.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\">Per ottenere una velocità socostante qui si è scelta una enorme costante d'inerzia H=1000s.</p><p style=\"font-family: 'MS Shell Dlg 2'; font-size: 12px;\"><br></p>
98 </body></html>"),
99 Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}})));
100 end ScTT1;
101
102 package Support
103 extends Modelica.Icons.Package;
104
105 model FromPark "Semplice PMM con modello funzionale inverter"
106 parameter Integer p "Number or pole pairs";
107 Modelica.Electrical.Machines.SpacePhasors.Blocks.FromSpacePhasor fromSpacePhasor annotation (
108 Placement(transformation(extent = {{60, 0}, {80, 20}})));
109 Modelica.Electrical.Machines.SpacePhasors.Blocks.Rotator rotator annotation (
110 Placement(transformation(extent = {{0, 6}, {20, 26}})));
111 Modelica.Blocks.Routing.Multiplex2 multiplex2_1 annotation (
112 Placement(transformation(extent = {{-40, 0}, {-20, 20}})));
113 Modelica.Blocks.Interfaces.RealOutput y[3] annotation (
114 Placement(transformation(extent = {{100, -10}, {120, 10}}), iconTransformation(extent = {{100, -10}, {120, 10}})));
115 Modelica.Blocks.Interfaces.RealInput Xd annotation (
116 Placement(transformation(extent = {{-140, 40}, {-100, 80}}), iconTransformation(extent = {{-140, 40}, {-100, 80}})));
117 Modelica.Blocks.Interfaces.RealInput Xq annotation (
118 Placement(transformation(extent = {{-140, -80}, {-100, -40}}), iconTransformation(extent = {{-140, -80}, {-100, -40}})));
119 Modelica.Blocks.Interfaces.RealInput phi annotation (
120 Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120})));
121 Modelica.Blocks.Math.Gain gain(k = -p) annotation (
122 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {10, -50})));
123 Modelica.Blocks.Sources.Constant const(k = 0) annotation (
124 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -30})));
125 equation
126 connect(multiplex2_1.y, rotator.u) annotation (
127 Line(points = {{-19, 10}, {-10, 10}, {-10, 16}, {-2, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
128 connect(fromSpacePhasor.u, rotator.y) annotation (
129 Line(points = {{58, 10}, {40, 10}, {40, 16}, {21, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
130 connect(fromSpacePhasor.y, y) annotation (
131 Line(points = {{81, 10}, {94, 10}, {94, 0}, {110, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
132 connect(multiplex2_1.u1[1], Xd) annotation (
133 Line(points = {{-42, 16}, {-60, 16}, {-60, 60}, {-120, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
134 connect(multiplex2_1.u2[1], Xq) annotation (
135 Line(points = {{-42, 4}, {-60, 4}, {-60, -60}, {-120, -60}}, color = {0, 0, 127}, smooth = Smooth.None));
136 connect(rotator.angle, gain.y) annotation (
137 Line(points = {{10, 4}, {10, -39}}, color = {0, 0, 127}, smooth = Smooth.None));
138 connect(gain.u, phi) annotation (
139 Line(points = {{10, -62}, {10, -120}, {0, -120}}, color = {0, 0, 127}, smooth = Smooth.None));
140 connect(fromSpacePhasor.zero, const.y) annotation (
141 Line(points = {{58, 2}, {50, 2}, {50, -19}}, color = {0, 0, 127}, smooth = Smooth.None));
142 annotation (
143 Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}})),
144 experiment(StopTime = 5, Interval = 0.001),
145 Documentation(info = "<html>
146<p>Converts variables form Park into phase quantities</p>
147</html>"),
148 __Dymola_experimentSetupOutput,
149 Icon(coordinateSystem(extent = {{-100, -100}, {100, 100}}, preserveAspectRatio = false, initialScale = 0.1, grid = {2, 2}), graphics = {Rectangle(lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(lineColor = {0, 0, 127}, extent = {{-96, 28}, {96, -26}}, textString = "P=>"), Text(lineColor = {0, 0, 255}, extent = {{-108, 150}, {102, 110}}, textString = "%name")}));
150 end FromPark;
151
152 model GetCurrent
153 Modelica.Blocks.Interfaces.RealOutput i_d annotation (
154 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-40, 110}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-40, 110})));
155 Modelica.Blocks.Interfaces.RealOutput i_q annotation (
156 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {40, 110}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {40, 110})));
157 PowerGrids.Interfaces.TerminalAC term_p annotation (
158 Placement(transformation(extent = {{-110, -8}, {-92, 10}}), iconTransformation(extent = {{-110, -8}, {-92, 10}})));
159 PowerGrids.Interfaces.TerminalAC term_n annotation (
160 Placement(transformation(extent = {{90, -8}, {108, 10}}), iconTransformation(extent = {{90, -8}, {108, 10}})));
161 equation
162 i_d = -term_p.i.im;
163 i_q = term_p.i.re;
164 connect(term_p, term_n) annotation (
165 Line(points = {{-101, 1}, {-0.5, 1}, {-0.5, 1}, {99, 1}}, color = {0, 0, 0}));
166 annotation (
167 Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Ellipse(extent = {{-60, 16}, {60, -16}}, lineColor = {28, 108, 200}), Line(points = {{-40, 100}, {-20, 14}}, color = {28, 108, 200}), Line(points = {{42, 100}, {20, 16}}, color = {28, 108, 200}), Line(points = {{-100, 0}, {92, 0}}, color = {28, 108, 200}), Text(extent = {{-98, -36}, {100, -54}}, lineColor = {0, 0, 255}, textString = "%name")}),
168 Diagram(coordinateSystem(preserveAspectRatio = false)),
169 Icon(coordinateSystem(preserveAspectRatio = false), graphics = {Ellipse(lineColor = {28, 108, 200}, extent = {{-60, 16}, {60, -16}}, endAngle = 360), Line(points = {{-40, 100}, {-20, 14}}, color = {28, 108, 200}), Line(points = {{42, 100}, {20, 16}}, color = {28, 108, 200}), Line(points = {{-100, 0}, {92, 0}}), Text(lineColor = {0, 0, 255}, extent = {{-98, -36}, {100, -54}}, textString = "%name")}),
170 Diagram(coordinateSystem(preserveAspectRatio = false)));
171 end GetCurrent;
172 annotation (
173 Icon(graphics={ Ellipse(extent = {{-38, 40}, {38, -36}}, lineColor = {0, 0, 0}), Line(points = {{2, 82}, {-8, 82}, {-12, 72}, {-26, 68}, {-36, 78}, {-48, 70}, {-44, 58}, {-56, 46}, {-68, 50}, {-76, 36}, {-68, 30}, {-70, 16}, {-80, 12}, {-80, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{2, -78}, {-8, -78}, {-12, -68}, {-26, -64}, {-36, -74}, {-48, -66}, {-44, -54}, {-56, -42}, {-68, -46}, {-76, -32}, {-68, -26}, {-70, -12}, {-80, -8}, {-80, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{0, -78}, {10, -78}, {14, -68}, {28, -64}, {38, -74}, {50, -66}, {46, -54}, {58, -42}, {70, -46}, {78, -32}, {70, -26}, {72, -12}, {82, -8}, {82, 2}}, color = {0, 0, 0}, smooth = Smooth.None), Line(points = {{0, 82}, {10, 82}, {14, 72}, {28, 68}, {38, 78}, {50, 70}, {46, 58}, {58, 46}, {70, 50}, {78, 36}, {70, 30}, {72, 16}, {82, 12}, {82, 2}}, color = {0, 0, 0}, smooth = Smooth.None)}));
174 end Support;
175equation
176
177 annotation (
178 Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}})),
179 uses(PowerGrids(version = "1.0.0"), Modelica(version = "3.2.3")));
180end Test;