Ticket #6323: Test1.mo

File Test1.mo, 17.8 KB (added by massimo ceraolo, 4 years ago)
Line 
1package Test1
2
3 model ScTT
4 extends Modelica.Icons.Example;
5 import PI = Modelica.Constants.pi;
6 inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) annotation(
7 Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
8 PowerGrids.Electrical.Buses.BusFault bus(R = 0.05, SNom(displayUnit = "V.A") = 500000000, UNom(displayUnit = "V") = 21000, UStart = 1.050 * 380e3, X = 0, portVariablesPhases = true, portVariablesPu = true, startTime = 0.1, stopTime = 990.2) annotation(
9 Placement(visible = true, transformation(origin = {14, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
10 Modelica.Blocks.Sources.RealExpression ufPu(y = 1) annotation(
11 Placement(visible = true, transformation(extent = {{-52, 16}, {-32, 36}}, rotation = 0)));
12 Modelica.Blocks.Sources.RealExpression pmPu annotation(
13 Placement(visible = true, transformation(extent = {{-52, 36}, {-32, 56}}, rotation = 0)));
14 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(
15 Placement(visible = true, transformation(origin = {2, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
16 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(
17 Placement(visible = true, transformation(origin = {86, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
18 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(
19 Placement(visible = true, transformation(origin = {34, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
20 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(
21 Placement(visible = true, transformation(origin = {64, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
22 PowerGrids.Electrical.Buses.Bus bus1(SNom(displayUnit = "V.A") = 500000000, UNom(displayUnit = "V") = 380000, portVariablesPhases = true, portVariablesPu = true) annotation(
23 Placement(visible = true, transformation(origin = {58, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
24 equation
25 connect(pmPu.y, GEN.PmPu) annotation(
26 Line(points = {{-31, 46}, {-22, 46}, {-22, 42}, {-8, 42}}, color = {0, 0, 127}));
27 connect(GEN.ufPuIn, ufPu.y) annotation(
28 Line(points = {{-8.2, 34}, {-22.2, 34}, {-22.2, 26}, {-31, 26}}, color = {0, 0, 127}));
29 connect(TGEN.terminalB, bus1.terminal) annotation(
30 Line(points = {{44, -24}, {58, -24}}));
31 connect(bus1.terminal, GRID.terminal) annotation(
32 Line(points = {{58, -24}, {86, -24}}));
33 connect(GRIDL.terminal, GRID.terminal) annotation(
34 Line(points = {{64, -38}, {64, -24}, {86, -24}}));
35 connect(TGEN.terminalA, bus.terminal) annotation(
36 Line(points = {{24, -24}, {14, -24}}));
37 connect(GEN.terminal, bus.terminal) annotation(
38 Line(points = {{2, 38}, {2, -24}, {14, -24}}));
39 annotation(
40 experiment(StopTime = 0.1, Interval = 0.001, Tolerance = 1e-06, StartTime = 0),
41 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>
42 </body></html>"),
43 Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}})));
44 end ScTT;
45
46 model ScTT1
47 extends Modelica.Icons.Example;
48 import PI = Modelica.Constants.pi;
49 inner PowerGrids.Electrical.System systemPowerGrids(fNom = 50) annotation (
50 Placement(visible = true, transformation(origin = {70, 30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
51 PowerGrids.Electrical.Buses.BusFault bus(R = 0.05, SNom (displayUnit = "V.A") = 500000000, UNom (displayUnit = "V") = 21000, UStart = 1.050 * 380e3, X = 0, portVariablesPhases = true, portVariablesPu = true, startTime = 0.1, stopTime = 990.2) annotation (
52 Placement(visible = true, transformation(origin = {14, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
53 Modelica.Blocks.Sources.RealExpression ufPu(y = 1) annotation (
54 Placement(visible = true, transformation(extent = {{-52, 16}, {-32, 36}}, rotation = 0)));
55 Modelica.Blocks.Sources.RealExpression pmPu annotation (
56 Placement(visible = true, transformation(extent = {{-52, 36}, {-32, 56}}, rotation = 0)));
57 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 (
58 Placement(visible = true, transformation(origin = {2, 38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
59 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 (
60 Placement(visible = true, transformation(origin = {86, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
61 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 (
62 Placement(visible = true, transformation(origin = {34, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
63 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 (
64 Placement(visible = true, transformation(origin = {64, -38}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
65 PowerGrids.Electrical.Buses.Bus bus1(SNom (displayUnit = "V.A") = 500000000, UNom (displayUnit = "V") = 380000, portVariablesPhases = true, portVariablesPu = true) annotation (
66 Placement(visible = true, transformation(origin = {58, -24}, extent = {{-10, -10}, {10, 10}}, rotation = 90)));
67 Support.GetCurrent iMach annotation (
68 Placement(visible = true, transformation(origin = {2, -2}, extent = {{-10, 10}, {10, -10}}, rotation = -90)));
69 Support.FromPark fromPark(p = 1) annotation (
70 Placement(visible = true, transformation(extent = {{-28, -14}, {-48, 6}}, rotation = 0)));
71 Modelica.Blocks.Sources.RealExpression theta(y = 2 * PI * 50 * time) annotation (
72 Placement(visible = true, transformation(origin = {-72, -28}, extent = {{-16, -10}, {16, 10}}, rotation = 0)));
73 equation
74 connect(pmPu.y, GEN.PmPu) annotation (
75 Line(points = {{-31, 46}, {-22, 46}, {-22, 42}, {-8, 42}}, color = {0, 0, 127}));
76 connect(GEN.ufPuIn, ufPu.y) annotation (
77 Line(points = {{-8.2, 34}, {-22.2, 34}, {-22.2, 26}, {-31, 26}}, color = {0, 0, 127}));
78 connect(TGEN.terminalB, bus1.terminal) annotation(
79 Line(points = {{44, -24}, {58, -24}}));
80 connect(bus1.terminal, GRID.terminal) annotation(
81 Line(points = {{58, -24}, {86, -24}}));
82 connect(GRIDL.terminal, GRID.terminal) annotation (
83 Line(points = {{64, -38}, {64, -24}, {86, -24}}));
84 connect(TGEN.terminalA, bus.terminal) annotation (
85 Line(points = {{24, -24}, {14, -24}}));
86 connect(GEN.terminal, iMach.term_p) annotation (
87 Line(points={{2,38},{2,24},{2,8.1},{1.9,8.1}}));
88 connect(iMach.term_n, bus.terminal) annotation (
89 Line(points={{1.9,-11.9},{1.9,-24},{14,-24}}));
90 connect(fromPark.Xd, iMach.i_d) annotation (
91 Line(points={{-26,2},{-9,2}}, color = {0, 0, 127}));
92 connect(iMach.i_q, fromPark.Xq) annotation (
93 Line(points={{-9,-6},{-16,-6},{-16,-10},{-26,-10}}, color = {0, 0, 127}));
94 connect(fromPark.phi, theta.y) annotation (
95 Line(points={{-38,-16},{-38,-28},{-54.4,-28}}, color = {0, 0, 127}));
96 annotation (
97 experiment(
98 StopTime=0.1,
99 Interval=0.001,
100 Tolerance=1e-06, StartTime = 0),
101 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>
102 </body></html>"),
103 Diagram(coordinateSystem(extent = {{-100, -60}, {100, 60}})));
104 end ScTT1;
105
106 package Support
107 extends Modelica.Icons.Package;
108
109 model FromPark "Semplice PMM con modello funzionale inverter"
110 parameter Integer p "Number or pole pairs";
111 Modelica.Electrical.Machines.SpacePhasors.Blocks.FromSpacePhasor fromSpacePhasor annotation (
112 Placement(transformation(extent = {{60, 0}, {80, 20}})));
113 Modelica.Electrical.Machines.SpacePhasors.Blocks.Rotator rotator annotation (
114 Placement(transformation(extent = {{0, 6}, {20, 26}})));
115 Modelica.Blocks.Routing.Multiplex2 multiplex2_1 annotation (
116 Placement(transformation(extent = {{-40, 0}, {-20, 20}})));
117 Modelica.Blocks.Interfaces.RealOutput y[3] annotation (
118 Placement(transformation(extent = {{100, -10}, {120, 10}}), iconTransformation(extent = {{100, -10}, {120, 10}})));
119 Modelica.Blocks.Interfaces.RealInput Xd annotation (
120 Placement(transformation(extent = {{-140, 40}, {-100, 80}}), iconTransformation(extent = {{-140, 40}, {-100, 80}})));
121 Modelica.Blocks.Interfaces.RealInput Xq annotation (
122 Placement(transformation(extent = {{-140, -80}, {-100, -40}}), iconTransformation(extent = {{-140, -80}, {-100, -40}})));
123 Modelica.Blocks.Interfaces.RealInput phi annotation (
124 Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120}), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 90, origin = {0, -120})));
125 Modelica.Blocks.Math.Gain gain(k = -p) annotation (
126 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {10, -50})));
127 Modelica.Blocks.Sources.Constant const(k = 0) annotation (
128 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {50, -30})));
129 equation
130 connect(multiplex2_1.y, rotator.u) annotation (
131 Line(points = {{-19, 10}, {-10, 10}, {-10, 16}, {-2, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
132 connect(fromSpacePhasor.u, rotator.y) annotation (
133 Line(points = {{58, 10}, {40, 10}, {40, 16}, {21, 16}}, color = {0, 0, 127}, smooth = Smooth.None));
134 connect(fromSpacePhasor.y, y) annotation (
135 Line(points = {{81, 10}, {94, 10}, {94, 0}, {110, 0}}, color = {0, 0, 127}, smooth = Smooth.None));
136 connect(multiplex2_1.u1[1], Xd) annotation (
137 Line(points = {{-42, 16}, {-60, 16}, {-60, 60}, {-120, 60}}, color = {0, 0, 127}, smooth = Smooth.None));
138 connect(multiplex2_1.u2[1], Xq) annotation (
139 Line(points = {{-42, 4}, {-60, 4}, {-60, -60}, {-120, -60}}, color = {0, 0, 127}, smooth = Smooth.None));
140 connect(rotator.angle, gain.y) annotation (
141 Line(points = {{10, 4}, {10, -39}}, color = {0, 0, 127}, smooth = Smooth.None));
142 connect(gain.u, phi) annotation (
143 Line(points = {{10, -62}, {10, -120}, {0, -120}}, color = {0, 0, 127}, smooth = Smooth.None));
144 connect(fromSpacePhasor.zero, const.y) annotation (
145 Line(points = {{58, 2}, {50, 2}, {50, -19}}, color = {0, 0, 127}, smooth = Smooth.None));
146 annotation (
147 Diagram(coordinateSystem(preserveAspectRatio = true, extent = {{-100, -100}, {100, 100}})),
148 experiment(StopTime = 5, Interval = 0.001),
149 Documentation(info = "<html>
150<p>Converts variables form Park into phase quantities</p>
151</html>"),
152 __Dymola_experimentSetupOutput,
153 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")}));
154 end FromPark;
155
156 model GetCurrent
157 Modelica.Blocks.Interfaces.RealOutput i_d annotation (
158 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-40, 110}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {-40, 110})));
159 Modelica.Blocks.Interfaces.RealOutput i_q annotation (
160 Placement(transformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {40, 110}), iconTransformation(extent = {{-10, -10}, {10, 10}}, rotation = 90, origin = {40, 110})));
161 PowerGrids.Interfaces.TerminalAC term_p annotation (
162 Placement(transformation(extent = {{-110, -8}, {-92, 10}}), iconTransformation(extent = {{-110, -8}, {-92, 10}})));
163 PowerGrids.Interfaces.TerminalAC term_n annotation (
164 Placement(transformation(extent = {{90, -8}, {108, 10}}), iconTransformation(extent = {{90, -8}, {108, 10}})));
165 equation
166 i_d = -term_p.i.im;
167 i_q = term_p.i.re;
168 connect(term_p, term_n) annotation (
169 Line(points = {{-101, 1}, {-0.5, 1}, {-0.5, 1}, {99, 1}}, color = {0, 0, 0}));
170 annotation (
171 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")}),
172 Diagram(coordinateSystem(preserveAspectRatio = false)),
173 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")}),
174 Diagram(coordinateSystem(preserveAspectRatio = false)));
175 end GetCurrent;
176 annotation (
177 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)}));
178 end Support;
179equation
180
181 annotation (
182 Diagram(coordinateSystem(extent = {{-100, -80}, {100, 80}})),
183 uses(PowerGrids(version = "1.0.0"), Modelica(version = "3.2.3")));
184end Test1;