Ticket #2863: TransformerTotal.mo

File TransformerTotal.mo, 183.0 KB (added by Adrian Pop, 10 years ago)
Line 
1package ModelicaServices
2 "(version = 3.2.1, target = \"Dymola\") Models and functions used in the Modelica Standard Library requiring a tool specific implementation"
3
4package Machine
5
6 final constant Real eps=1.e-15 "Biggest number such that 1.0 + eps = 1.0";
7 annotation (Documentation(info="<html>
8<p>
9Package in which processor specific constants are defined that are needed
10by numerical algorithms. Typically these constants are not directly used,
11but indirectly via the alias definition in
12<a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.
13</p>
14</html>"));
15end Machine;
16annotation (
17 Protection(access=Access.hide),
18 preferredView="info",
19 version="3.2.1",
20 versionDate="2013-01-17",
21 versionBuild=1,
22 uses(Modelica(version="3.2.1")),
23 conversion(
24 noneFromVersion="1.0",
25 noneFromVersion="1.1",
26 noneFromVersion="1.2"),
27 Documentation(info="<html>
28<p>
29This package contains a set of functions and models to be used in the
30Modelica Standard Library that requires a tool specific implementation.
31These are:
32</p>
33
34<ul>
35<li> <a href=\"modelica://ModelicaServices.Animation.Shape\">Shape</a>
36 provides a 3-dim. visualization of elementary
37 mechanical objects. It is used in
38<a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape</a>
39 via inheritance.</li>
40
41<li> <a href=\"modelica://ModelicaServices.Animation.Surface\">Surface</a>
42 provides a 3-dim. visualization of
43 moveable parameterized surface. It is used in
44<a href=\"modelica://Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface\">Modelica.Mechanics.MultiBody.Visualizers.Advanced.Surface</a>
45 via inheritance.</li>
46
47<li> <a href=\"modelica://ModelicaServices.ExternalReferences.loadResource\">loadResource</a>
48 provides a function to return the absolute path name of an URI or a local file name. It is used in
49<a href=\"modelica://Modelica.Utilities.Files.loadResource\">Modelica.Utilities.Files.loadResource</a>
50 via inheritance.</li>
51
52<li> <a href=\"modelica://ModelicaServices.Machine\">ModelicaServices.Machine</a>
53 provides a package of machine constants. It is used in
54<a href=\"modelica://Modelica.Constants\">Modelica.Constants</a>.</li>
55
56<li> <a href=\"modelica://ModelicaServices.Types.SolverMethod\">Types.SolverMethod</a>
57 provides a string defining the integration method to solve differential equations in
58 a clocked discretized continuous-time partition (see Modelica 3.3 language specification).
59 It is not yet used in the Modelica Standard Library, but in the Modelica_Synchronous library
60 that provides convenience blocks for the clock operators of Modelica version &ge; 3.3.</li>
61</ul>
62
63<p>
64This implementation is targeted for Dymola.
65</p>
66
67<p>
68<b>Licensed by DLR and Dassault Syst&egrave;mes AB under the Modelica License 2</b><br>
69Copyright &copy; 2009-2013, DLR and Dassault Syst&egrave;mes AB.
70</p>
71
72<p>
73<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"http://www.modelica.org/licenses/ModelicaLicense2\"> http://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
74</p>
75
76</html>"));
77end ModelicaServices;
78
79package Modelica "Modelica Standard Library - Version 3.2.1 (Build 2)"
80extends Modelica.Icons.Package;
81
82 package Blocks
83 "Library of basic input/output control blocks (continuous, discrete, logical, table blocks)"
84 import SI = Modelica.SIunits;
85 extends Modelica.Icons.Package;
86
87 package Interfaces
88 "Library of connectors and partial models for input/output blocks"
89 import Modelica.SIunits;
90 extends Modelica.Icons.InterfacesPackage;
91
92 connector RealInput = input Real "'input Real' as connector" annotation (
93 defaultComponentName="u",
94 Icon(graphics={
95 Polygon(
96 lineColor={0,0,127},
97 fillColor={0,0,127},
98 fillPattern=FillPattern.Solid,
99 points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})},
100 coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}},
101 preserveAspectRatio=true,
102 initialScale=0.2)),
103 Diagram(
104 coordinateSystem(preserveAspectRatio=true,
105 initialScale=0.2,
106 extent={{-100.0,-100.0},{100.0,100.0}}),
107 graphics={
108 Polygon(
109 lineColor={0,0,127},
110 fillColor={0,0,127},
111 fillPattern=FillPattern.Solid,
112 points={{0.0,50.0},{100.0,0.0},{0.0,-50.0},{0.0,50.0}}),
113 Text(
114 lineColor={0,0,127},
115 extent={{-10.0,60.0},{-10.0,85.0}},
116 textString="%name")}),
117 Documentation(info="<html>
118<p>
119Connector with one input signal of type Real.
120</p>
121</html>"));
122
123 connector RealOutput = output Real "'output Real' as connector" annotation (
124 defaultComponentName="y",
125 Icon(
126 coordinateSystem(preserveAspectRatio=true,
127 extent={{-100.0,-100.0},{100.0,100.0}},
128 initialScale=0.1),
129 graphics={
130 Polygon(
131 lineColor={0,0,127},
132 fillColor={255,255,255},
133 fillPattern=FillPattern.Solid,
134 points={{-100.0,100.0},{100.0,0.0},{-100.0,-100.0}})}),
135 Diagram(
136 coordinateSystem(preserveAspectRatio=true,
137 extent={{-100.0,-100.0},{100.0,100.0}},
138 initialScale=0.1),
139 graphics={
140 Polygon(
141 lineColor={0,0,127},
142 fillColor={255,255,255},
143 fillPattern=FillPattern.Solid,
144 points={{-100.0,50.0},{0.0,0.0},{-100.0,-50.0}}),
145 Text(
146 lineColor={0,0,127},
147 extent={{30.0,60.0},{30.0,110.0}},
148 textString="%name")}),
149 Documentation(info="<html>
150<p>
151Connector with one output signal of type Real.
152</p>
153</html>"));
154
155 connector IntegerInput = input Integer "'input Integer' as connector"
156 annotation (
157 defaultComponentName="u",
158 Icon(graphics={Polygon(
159 points={{-100,100},{100,0},{-100,-100},{-100,100}},
160 lineColor={255,127,0},
161 fillColor={255,127,0},
162 fillPattern=FillPattern.Solid)}, coordinateSystem(
163 extent={{-100,-100},{100,100}},
164 preserveAspectRatio=true,
165 initialScale=0.2)),
166 Diagram(coordinateSystem(
167 preserveAspectRatio=true,
168 initialScale=0.2,
169 extent={{-100,-100},{100,100}}), graphics={Polygon(
170 points={{0,50},{100,0},{0,-50},{0,50}},
171 lineColor={255,127,0},
172 fillColor={255,127,0},
173 fillPattern=FillPattern.Solid), Text(
174 extent={{-10,85},{-10,60}},
175 lineColor={255,127,0},
176 textString="%name")}),
177 Documentation(info="<html>
178<p>
179Connector with one input signal of type Integer.
180</p>
181</html>"));
182
183 connector IntegerOutput = output Integer "'output Integer' as connector"
184 annotation (
185 defaultComponentName="y",
186 Icon(coordinateSystem(
187 preserveAspectRatio=true,
188 extent={{-100,-100},{100,100}}), graphics={Polygon(
189 points={{-100,100},{100,0},{-100,-100},{-100,100}},
190 lineColor={255,127,0},
191 fillColor={255,255,255},
192 fillPattern=FillPattern.Solid)}),
193 Diagram(coordinateSystem(
194 preserveAspectRatio=true,
195 extent={{-100,-100},{100,100}}), graphics={Polygon(
196 points={{-100,50},{0,0},{-100,-50},{-100,50}},
197 lineColor={255,127,0},
198 fillColor={255,255,255},
199 fillPattern=FillPattern.Solid), Text(
200 extent={{30,110},{30,60}},
201 lineColor={255,127,0},
202 textString="%name")}),
203 Documentation(info="<html>
204<p>
205Connector with one output signal of type Integer.
206</p>
207</html>"));
208 annotation (Documentation(info="<HTML>
209<p>
210This package contains interface definitions for
211<b>continuous</b> input/output blocks with Real,
212Integer and Boolean signals. Furthermore, it contains
213partial models for continuous and discrete blocks.
214</p>
215
216</html>", revisions="<html>
217<ul>
218<li><i>Oct. 21, 2002</i>
219 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
220 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
221 Added several new interfaces.
222<li><i>Oct. 24, 1999</i>
223 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
224 RealInputSignal renamed to RealInput. RealOutputSignal renamed to
225 output RealOutput. GraphBlock renamed to BlockIcon. SISOreal renamed to
226 SISO. SOreal renamed to SO. I2SOreal renamed to M2SO.
227 SignalGenerator renamed to SignalSource. Introduced the following
228 new models: MIMO, MIMOs, SVcontrol, MVcontrol, DiscreteBlockIcon,
229 DiscreteBlock, DiscreteSISO, DiscreteMIMO, DiscreteMIMOs,
230 BooleanBlockIcon, BooleanSISO, BooleanSignalSource, MI2BooleanMOs.</li>
231<li><i>June 30, 1999</i>
232 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
233 Realized a first version, based on an existing Dymola library
234 of Dieter Moormann and Hilding Elmqvist.</li>
235</ul>
236</html>"));
237 end Interfaces;
238 annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}, initialScale=0.1), graphics={
239 Rectangle(
240 origin={0.0,35.1488},
241 fillColor={255,255,255},
242 extent={{-30.0,-20.1488},{30.0,20.1488}}),
243 Rectangle(
244 origin={0.0,-34.8512},
245 fillColor={255,255,255},
246 extent={{-30.0,-20.1488},{30.0,20.1488}}),
247 Line(
248 origin={-51.25,0.0},
249 points={{21.25,-35.0},{-13.75,-35.0},{-13.75,35.0},{6.25,35.0}}),
250 Polygon(
251 origin={-40.0,35.0},
252 pattern=LinePattern.None,
253 fillPattern=FillPattern.Solid,
254 points={{10.0,0.0},{-5.0,5.0},{-5.0,-5.0}}),
255 Line(
256 origin={51.25,0.0},
257 points={{-21.25,35.0},{13.75,35.0},{13.75,-35.0},{-6.25,-35.0}}),
258 Polygon(
259 origin={40.0,-35.0},
260 pattern=LinePattern.None,
261 fillPattern=FillPattern.Solid,
262 points={{-10.0,0.0},{5.0,5.0},{5.0,-5.0}})}), Documentation(info="<html>
263<p>
264This library contains input/output blocks to build up block diagrams.
265</p>
266
267<dl>
268<dt><b>Main Author:</b>
269<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
270 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
271 Oberpfaffenhofen<br>
272 Postfach 1116<br>
273 D-82230 Wessling<br>
274 email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
275</dl>
276<p>
277Copyright &copy; 1998-2013, Modelica Association and DLR.
278</p>
279<p>
280<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
281</p>
282</html>", revisions="<html>
283<ul>
284<li><i>June 23, 2004</i>
285 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
286 Introduced new block connectors and adapted all blocks to the new connectors.
287 Included subpackages Continuous, Discrete, Logical, Nonlinear from
288 package ModelicaAdditions.Blocks.
289 Included subpackage ModelicaAdditions.Table in Modelica.Blocks.Sources
290 and in the new package Modelica.Blocks.Tables.
291 Added new blocks to Blocks.Sources and Blocks.Logical.
292 </li>
293<li><i>October 21, 2002</i>
294 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
295 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
296 New subpackage Examples, additional components.
297 </li>
298<li><i>June 20, 2000</i>
299 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
300 Michael Tiller:<br>
301 Introduced a replaceable signal type into
302 Blocks.Interfaces.RealInput/RealOutput:
303<pre>
304 replaceable type SignalType = Real
305</pre>
306 in order that the type of the signal of an input/output block
307 can be changed to a physical type, for example:
308<pre>
309 Sine sin1(outPort(redeclare type SignalType=Modelica.SIunits.Torque))
310</pre>
311 </li>
312<li><i>Sept. 18, 1999</i>
313 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
314 Renamed to Blocks. New subpackages Math, Nonlinear.
315 Additional components in subpackages Interfaces, Continuous
316 and Sources. </li>
317<li><i>June 30, 1999</i>
318 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
319 Realized a first version, based on an existing Dymola library
320 of Dieter Moormann and Hilding Elmqvist.</li>
321</ul>
322</html>"));
323 end Blocks;
324
325 package Electrical
326 "Library of electrical models (analog, digital, machines, multi-phase)"
327 extends Modelica.Icons.Package;
328
329 package Analog "Library for analog electrical models"
330 import SI = Modelica.SIunits;
331 extends Modelica.Icons.Package;
332
333 package Interfaces
334 "Connectors and partial models for Analog electrical components"
335 extends Modelica.Icons.InterfacesPackage;
336
337 connector Pin "Pin of an electrical component"
338 Modelica.SIunits.Voltage v "Potential at the pin" annotation (
339 unassignedMessage="An electrical potential cannot be uniquely calculated.
340The reason could be that
341- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
342 to define the zero potential of the electrical circuit, or
343- a connector of an electrical component is not connected.");
344 flow Modelica.SIunits.Current i "Current flowing into the pin" annotation (
345 unassignedMessage="An electrical current cannot be uniquely calculated.
346The reason could be that
347- a ground object is missing (Modelica.Electrical.Analog.Basic.Ground)
348 to define the zero potential of the electrical circuit, or
349- a connector of an electrical component is not connected.");
350 annotation (defaultComponentName="pin",
351 Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
352 100}}), graphics={Rectangle(
353 extent={{-100,100},{100,-100}},
354 lineColor={0,0,255},
355 fillColor={0,0,255},
356 fillPattern=FillPattern.Solid)}),
357 Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{
358 100,100}}), graphics={Rectangle(
359 extent={{-40,40},{40,-40}},
360 lineColor={0,0,255},
361 fillColor={0,0,255},
362 fillPattern=FillPattern.Solid), Text(
363 extent={{-160,110},{40,50}},
364 lineColor={0,0,255},
365 textString="%name")}),
366 Documentation(revisions="<html>
367<ul>
368<li><i> 1998 </i>
369 by Christoph Clauss<br> initially implemented<br>
370 </li>
371</ul>
372</html>", info="<html>
373<p>Pin is the basic electric connector. It includes the voltage which consists between the pin and the ground node. The ground node is the node of (any) ground device (Modelica.Electrical.Basic.Ground). Furthermore, the pin includes the current, which is considered to be <b>positive</b> if it is flowing at the pin<b> into the device</b>.</p>
374</html>"));
375 end Pin;
376 annotation (Documentation(info="<html>
377<p>This package contains connectors and interfaces (partial models) for analog electrical components. The partial models contain typical combinations of pins, and internal variables which are often used. Furthermore, the thermal heat port is in this package which can be included by inheritance.</p>
378</html>",revisions="<html>
379<dl>
380<dt>
381<b>Main Authors:</b>
382</dt>
383<dd>
384Christoph Clau&szlig;
385 &lt;<a href=\"mailto:Christoph.Clauss@eas.iis.fraunhofer.de\">Christoph.Clauss@eas.iis.fraunhofer.de</a>&gt;<br>
386 Andr&eacute; Schneider
387 &lt;<a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>&gt;<br>
388 Fraunhofer Institute for Integrated Circuits<br>
389 Design Automation Department<br>
390 Zeunerstra&szlig;e 38<br>
391 D-01069 Dresden
392</dd>
393<dt>
394<b>Copyright:</b>
395</dt>
396<dd>
397Copyright &copy; 1998-2013, Modelica Association and Fraunhofer-Gesellschaft.<br>
398<i>The Modelica package is <b>free</b> software; it can be redistributed and/or modified
399under the terms of the <b>Modelica license</b>, see the license conditions
400and the accompanying <b>disclaimer</b> in the documentation of package
401Modelica in file \"Modelica/package.mo\".</i>
402</dd>
403</dl>
404
405<ul>
406<li><i> 1998</i>
407 by Christoph Clauss<br> initially implemented<br>
408 </li>
409</ul>
410</html>"));
411 end Interfaces;
412 annotation (Documentation(info="<html>
413<p>
414This package contains packages for analog electrical components:</p>
415<ul>
416<li>Basic: basic components (resistor, capacitor, conductor, inductor, transformer, gyrator)</li>
417<li>Semiconductors: semiconductor devices (diode, bipolar and MOS transistors)</li>
418<li>Lines: transmission lines (lossy and lossless)</li>
419<li>Ideal: ideal elements (switches, diode, transformer, idle, short, ...)</li>
420<li>Sources: time-dependent and controlled voltage and current sources</li>
421<li>Sensors: sensors to measure potential, voltage, and current</li>
422</ul>
423<dl>
424<dt>
425<b>Main Authors:</b>
426</dt>
427<dd>
428Christoph Clau&szlig;
429 &lt;<a href=\"mailto:Christoph.Clauss@eas.iis.fraunhofer.de\">Christoph.Clauss@eas.iis.fraunhofer.de</a>&gt;<br>
430 Andr&eacute; Schneider
431 &lt;<a href=\"mailto:Andre.Schneider@eas.iis.fraunhofer.de\">Andre.Schneider@eas.iis.fraunhofer.de</a>&gt;<br>
432 Fraunhofer Institute for Integrated Circuits<br>
433 Design Automation Department<br>
434 Zeunerstra&szlig;e 38<br>
435 D-01069 Dresden, Germany
436</dd>
437</dl>
438</html>"), Icon(graphics={
439 Line(
440 points={{12,60},{12,-60}},
441 color={0,0,0}),
442 Line(
443 points={{-12,60},{-12,-60}},
444 color={0,0,0}),
445 Line(points={{-80,0},{-12,0}}, color={0,0,0}),
446 Line(points={{12,0},{80,0}}, color={0,0,0})}));
447 end Analog;
448 annotation (
449 Documentation(info="<html>
450<p>
451This library contains electrical components to build up analog and digital circuits,
452as well as machines to model electrical motors and generators,
453especially three phase induction machines such as an asynchronous motor.
454</p>
455
456</html>"),
457 Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
458 Rectangle(
459 origin={20.3125,82.8571},
460 extent={{-45.3125,-57.8571},{4.6875,-27.8571}}),
461 Line(
462 origin={8.0,48.0},
463 points={{32.0,-58.0},{72.0,-58.0}}),
464 Line(
465 origin={9.0,54.0},
466 points={{31.0,-49.0},{71.0,-49.0}}),
467 Line(
468 origin={-2.0,55.0},
469 points={{-83.0,-50.0},{-33.0,-50.0}}),
470 Line(
471 origin={-3.0,45.0},
472 points={{-72.0,-55.0},{-42.0,-55.0}}),
473 Line(
474 origin={1.0,50.0},
475 points={{-61.0,-45.0},{-61.0,-10.0},{-26.0,-10.0}}),
476 Line(
477 origin={7.0,50.0},
478 points={{18.0,-10.0},{53.0,-10.0},{53.0,-45.0}}),
479 Line(
480 origin={6.2593,48.0},
481 points={{53.7407,-58.0},{53.7407,-93.0},{-66.2593,-93.0},{-66.2593,-58.0}})}));
482 end Electrical;
483
484 package Math
485 "Library of mathematical functions (e.g., sin, cos) and of functions operating on vectors and matrices"
486 import SI = Modelica.SIunits;
487 extends Modelica.Icons.Package;
488
489 package Icons "Icons for Math"
490 extends Modelica.Icons.IconsPackage;
491
492 partial function AxisCenter
493 "Basic icon for mathematical function with y-axis in the center"
494
495 annotation (
496 Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
497 100}}), graphics={
498 Rectangle(
499 extent={{-100,100},{100,-100}},
500 lineColor={0,0,0},
501 fillColor={255,255,255},
502 fillPattern=FillPattern.Solid),
503 Line(points={{0,-80},{0,68}}, color={192,192,192}),
504 Polygon(
505 points={{0,90},{-8,68},{8,68},{0,90}},
506 lineColor={192,192,192},
507 fillColor={192,192,192},
508 fillPattern=FillPattern.Solid),
509 Text(
510 extent={{-150,150},{150,110}},
511 textString="%name",
512 lineColor={0,0,255})}),
513 Diagram(graphics={Line(points={{0,80},{-8,80}}, color={95,95,95}),Line(
514 points={{0,-80},{-8,-80}}, color={95,95,95}),Line(points={{0,-90},{
515 0,84}}, color={95,95,95}),Text(
516 extent={{5,104},{25,84}},
517 lineColor={95,95,95},
518 textString="y"),Polygon(
519 points={{0,98},{-6,82},{6,82},{0,98}},
520 lineColor={95,95,95},
521 fillColor={95,95,95},
522 fillPattern=FillPattern.Solid)}),
523 Documentation(info="<html>
524<p>
525Icon for a mathematical function, consisting of an y-axis in the middle.
526It is expected, that an x-axis is added and a plot of the function.
527</p>
528</html>"));
529 end AxisCenter;
530 end Icons;
531
532 function asin "Inverse sine (-1 <= u <= 1)"
533 extends Modelica.Math.Icons.AxisCenter;
534 input Real u;
535 output SI.Angle y;
536
537 external "builtin" y= asin(u);
538 annotation (
539 Icon(coordinateSystem(
540 preserveAspectRatio=true,
541 extent={{-100,-100},{100,100}}), graphics={
542 Line(points={{-90,0},{68,0}}, color={192,192,192}),
543 Polygon(
544 points={{90,0},{68,8},{68,-8},{90,0}},
545 lineColor={192,192,192},
546 fillColor={192,192,192},
547 fillPattern=FillPattern.Solid),
548 Line(points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
549 -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
550 52.7},{75.2,62.2},{77.6,67.5},{80,80}}, color={0,0,0}),
551 Text(
552 extent={{-88,78},{-16,30}},
553 lineColor={192,192,192},
554 textString="asin")}),
555 Diagram(coordinateSystem(
556 preserveAspectRatio=true,
557 extent={{-100,-100},{100,100}}), graphics={Text(
558 extent={{-40,-72},{-15,-88}},
559 textString="-pi/2",
560 lineColor={0,0,255}),Text(
561 extent={{-38,88},{-13,72}},
562 textString=" pi/2",
563 lineColor={0,0,255}),Text(
564 extent={{68,-9},{88,-29}},
565 textString="+1",
566 lineColor={0,0,255}),Text(
567 extent={{-90,21},{-70,1}},
568 textString="-1",
569 lineColor={0,0,255}),Line(points={{-100,0},{84,0}}, color={95,95,95}),
570 Polygon(
571 points={{98,0},{82,6},{82,-6},{98,0}},
572 lineColor={95,95,95},
573 fillColor={95,95,95},
574 fillPattern=FillPattern.Solid),Line(
575 points={{-80,-80},{-79.2,-72.8},{-77.6,-67.5},{-73.6,-59.4},{-66.3,
576 -49.8},{-53.5,-37.3},{-30.2,-19.7},{37.4,24.8},{57.5,40.8},{68.7,
577 52.7},{75.2,62.2},{77.6,67.5},{80,80}},
578 color={0,0,255},
579 thickness=0.5),Text(
580 extent={{82,24},{102,4}},
581 lineColor={95,95,95},
582 textString="u"),Line(
583 points={{0,80},{86,80}},
584 color={175,175,175},
585 smooth=Smooth.None),Line(
586 points={{80,86},{80,-10}},
587 color={175,175,175},
588 smooth=Smooth.None)}),
589 Documentation(info="<html>
590<p>
591This function returns y = asin(u), with -1 &le; u &le; +1:
592</p>
593
594<p>
595<img src=\"modelica://Modelica/Resources/Images/Math/asin.png\">
596</p>
597</html>"));
598 end asin;
599
600 function atan2 "Four quadrant inverse tangent"
601 extends Modelica.Math.Icons.AxisCenter;
602 input Real u1;
603 input Real u2;
604 output SI.Angle y;
605
606 external "builtin" y= atan2(u1, u2);
607 annotation (
608 Icon(coordinateSystem(
609 preserveAspectRatio=true,
610 extent={{-100,-100},{100,100}}), graphics={
611 Line(points={{-90,0},{68,0}}, color={192,192,192}),
612 Polygon(
613 points={{90,0},{68,8},{68,-8},{90,0}},
614 lineColor={192,192,192},
615 fillColor={192,192,192},
616 fillPattern=FillPattern.Solid),
617 Line(points={{0,-80},{8.93,-67.2},{17.1,-59.3},{27.3,-53.6},{42.1,-49.4},
618 {69.9,-45.8},{80,-45.1}}, color={0,0,0}),
619 Line(points={{-80,-34.9},{-46.1,-31.4},{-29.4,-27.1},{-18.3,-21.5},{-10.3,
620 -14.5},{-2.03,-3.17},{7.97,11.6},{15.5,19.4},{24.3,25},{39,30},{
621 62.1,33.5},{80,34.9}}, color={0,0,0}),
622 Line(points={{-80,45.1},{-45.9,48.7},{-29.1,52.9},{-18.1,58.6},{-10.2,
623 65.8},{-1.82,77.2},{0,80}}, color={0,0,0}),
624 Text(
625 extent={{-90,-46},{-18,-94}},
626 lineColor={192,192,192},
627 textString="atan2")}),
628 Diagram(coordinateSystem(
629 preserveAspectRatio=true,
630 extent={{-100,-100},{100,100}}), graphics={Line(points={{-100,0},{84,0}}, color={95,95,95}),
631 Polygon(
632 points={{96,0},{80,6},{80,-6},{96,0}},
633 lineColor={95,95,95},
634 fillColor={95,95,95},
635 fillPattern=FillPattern.Solid),Line(
636 points={{0,-80},{8.93,-67.2},{17.1,-59.3},{27.3,-53.6},{42.1,-49.4},
637 {69.9,-45.8},{80,-45.1}},
638 color={0,0,255},
639 thickness=0.5),Line(
640 points={{-80,-34.9},{-46.1,-31.4},{-29.4,-27.1},{-18.3,-21.5},{-10.3,
641 -14.5},{-2.03,-3.17},{7.97,11.6},{15.5,19.4},{24.3,25},{39,30},{
642 62.1,33.5},{80,34.9}},
643 color={0,0,255},
644 thickness=0.5),Line(
645 points={{-80,45.1},{-45.9,48.7},{-29.1,52.9},{-18.1,58.6},{-10.2,
646 65.8},{-1.82,77.2},{0,80}},
647 color={0,0,255},
648 thickness=0.5),Text(
649 extent={{-32,89},{-10,74}},
650 textString="pi",
651 lineColor={0,0,255}),Text(
652 extent={{-32,-72},{-4,-88}},
653 textString="-pi",
654 lineColor={0,0,255}),Text(
655 extent={{0,55},{20,42}},
656 textString="pi/2",
657 lineColor={0,0,255}),Line(points={{0,40},{-8,40}}, color={192,192,
658 192}),Line(points={{0,-40},{-8,-40}}, color={192,192,192}),Text(
659 extent={{0,-23},{20,-42}},
660 textString="-pi/2",
661 lineColor={0,0,255}),Text(
662 extent={{62,-4},{94,-26}},
663 lineColor={95,95,95},
664 textString="u1, u2"),Line(
665 points={{-88,40},{86,40}},
666 color={175,175,175},
667 smooth=Smooth.None),Line(
668 points={{-86,-40},{86,-40}},
669 color={175,175,175},
670 smooth=Smooth.None)}),
671 Documentation(info="<HTML>
672<p>
673This function returns y = atan2(u1,u2) such that tan(y) = u1/u2 and
674y is in the range -pi &lt; y &le; pi. u2 may be zero, provided
675u1 is not zero. Usually u1, u2 is provided in such a form that
676u1 = sin(y) and u2 = cos(y):
677</p>
678
679<p>
680<img src=\"modelica://Modelica/Resources/Images/Math/atan2.png\">
681</p>
682
683</html>"));
684 end atan2;
685 annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
686 {100,100}}), graphics={Line(points={{-80,0},{-68.7,34.2},{-61.5,53.1},
687 {-55.1,66.4},{-49.4,74.6},{-43.8,79.1},{-38.2,79.8},{-32.6,76.6},{
688 -26.9,69.7},{-21.3,59.4},{-14.9,44.1},{-6.83,21.2},{10.1,-30.8},{17.3,
689 -50.2},{23.7,-64.2},{29.3,-73.1},{35,-78.4},{40.6,-80},{46.2,-77.6},
690 {51.9,-71.5},{57.5,-61.9},{63.9,-47.2},{72,-24.8},{80,0}}, color={
691 0,0,0}, smooth=Smooth.Bezier)}), Documentation(info="<HTML>
692<p>
693This package contains <b>basic mathematical functions</b> (such as sin(..)),
694as well as functions operating on
695<a href=\"modelica://Modelica.Math.Vectors\">vectors</a>,
696<a href=\"modelica://Modelica.Math.Matrices\">matrices</a>,
697<a href=\"modelica://Modelica.Math.Nonlinear\">nonlinear functions</a>, and
698<a href=\"modelica://Modelica.Math.BooleanVectors\">Boolean vectors</a>.
699</p>
700
701<dl>
702<dt><b>Main Authors:</b>
703<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and
704 Marcus Baur<br>
705 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e.V. (DLR)<br>
706 Institut f&uuml;r Robotik und Mechatronik<br>
707 Postfach 1116<br>
708 D-82230 Wessling<br>
709 Germany<br>
710 email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br>
711</dl>
712
713<p>
714Copyright &copy; 1998-2013, Modelica Association and DLR.
715</p>
716<p>
717<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
718</p>
719</html>", revisions="<html>
720<ul>
721<li><i>October 21, 2002</i>
722 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>
723 and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
724 Function tempInterpol2 added.</li>
725<li><i>Oct. 24, 1999</i>
726 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
727 Icons for icon and diagram level introduced.</li>
728<li><i>June 30, 1999</i>
729 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
730 Realized.</li>
731</ul>
732
733</html>"));
734 end Math;
735
736 package Constants
737 "Library of mathematical constants and constants of nature (e.g., pi, eps, R, sigma)"
738 import SI = Modelica.SIunits;
739 import NonSI = Modelica.SIunits.Conversions.NonSIunits;
740 extends Modelica.Icons.Package;
741
742 final constant Real pi=2*Modelica.Math.asin(1.0);
743
744 final constant Real eps=ModelicaServices.Machine.eps
745 "Biggest number such that 1.0 + eps = 1.0";
746 annotation (
747 Documentation(info="<html>
748<p>
749This package provides often needed constants from mathematics, machine
750dependent constants and constants from nature. The latter constants
751(name, value, description) are from the following source:
752</p>
753
754<dl>
755<dt>Peter J. Mohr and Barry N. Taylor (1999):</dt>
756<dd><b>CODATA Recommended Values of the Fundamental Physical Constants: 1998</b>.
757 Journal of Physical and Chemical Reference Data, Vol. 28, No. 6, 1999 and
758 Reviews of Modern Physics, Vol. 72, No. 2, 2000. See also <a href=
759\"http://physics.nist.gov/cuu/Constants/\">http://physics.nist.gov/cuu/Constants/</a></dd>
760</dl>
761
762<p>CODATA is the Committee on Data for Science and Technology.</p>
763
764<dl>
765<dt><b>Main Author:</b></dt>
766<dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a><br>
767 Deutsches Zentrum f&uuml;r Luft und Raumfahrt e. V. (DLR)<br>
768 Oberpfaffenhofen<br>
769 Postfach 11 16<br>
770 D-82230 We&szlig;ling<br>
771 email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
772</dl>
773
774<p>
775Copyright &copy; 1998-2013, Modelica Association and DLR.
776</p>
777<p>
778<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
779</p>
780</html>", revisions="<html>
781<ul>
782<li><i>Nov 8, 2004</i>
783 by <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br>
784 Constants updated according to 2002 CODATA values.</li>
785<li><i>Dec 9, 1999</i>
786 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
787 Constants updated according to 1998 CODATA values. Using names, values
788 and description text from this source. Included magnetic and
789 electric constant.</li>
790<li><i>Sep 18, 1999</i>
791 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
792 Constants eps, inf, small introduced.</li>
793<li><i>Nov 15, 1997</i>
794 by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br>
795 Realized.</li>
796</ul>
797</html>"),
798 Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
799 Polygon(
800 origin={-9.2597,25.6673},
801 fillColor={102,102,102},
802 pattern=LinePattern.None,
803 fillPattern=FillPattern.Solid,
804 points={{48.017,11.336},{48.017,11.336},{10.766,11.336},{-25.684,10.95},{-34.944,-15.111},{-34.944,-15.111},{-32.298,-15.244},{-32.298,-15.244},{-22.112,0.168},{11.292,0.234},{48.267,-0.097},{48.267,-0.097}},
805 smooth=Smooth.Bezier),
806 Polygon(
807 origin={-19.9923,-8.3993},
808 fillColor={102,102,102},
809 pattern=LinePattern.None,
810 fillPattern=FillPattern.Solid,
811 points={{3.239,37.343},{3.305,37.343},{-0.399,2.683},{-16.936,-20.071},{-7.808,-28.604},{6.811,-22.519},{9.986,37.145},{9.986,37.145}},
812 smooth=Smooth.Bezier),
813 Polygon(
814 origin={23.753,-11.5422},
815 fillColor={102,102,102},
816 pattern=LinePattern.None,
817 fillPattern=FillPattern.Solid,
818 points={{-10.873,41.478},{-10.873,41.478},{-14.048,-4.162},{-9.352,-24.8},{7.912,-24.469},{16.247,0.27},{16.247,0.27},{13.336,0.071},{13.336,0.071},{7.515,-9.983},{-3.134,-7.271},{-2.671,41.214},{-2.671,41.214}},
819 smooth=Smooth.Bezier)}));
820 end Constants;
821
822 package Icons "Library of icons"
823 extends Icons.Package;
824
825 partial package ExamplesPackage
826 "Icon for packages containing runnable examples"
827 extends Modelica.Icons.Package;
828 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
829 -100},{100,100}}), graphics={
830 Polygon(
831 origin={8.0,14.0},
832 lineColor={78,138,73},
833 fillColor={78,138,73},
834 pattern=LinePattern.None,
835 fillPattern=FillPattern.Solid,
836 points={{-58.0,46.0},{42.0,-14.0},{-58.0,-74.0},{-58.0,46.0}})}), Documentation(info="<html>
837<p>This icon indicates a package that contains executable examples.</p>
838</html>"));
839 end ExamplesPackage;
840
841 partial package Package "Icon for standard packages"
842
843 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
844 Rectangle(
845 lineColor={200,200,200},
846 fillColor={248,248,248},
847 fillPattern=FillPattern.HorizontalCylinder,
848 extent={{-100.0,-100.0},{100.0,100.0}},
849 radius=25.0),
850 Rectangle(
851 lineColor={128,128,128},
852 fillPattern=FillPattern.None,
853 extent={{-100.0,-100.0},{100.0,100.0}},
854 radius=25.0)}), Documentation(info="<html>
855<p>Standard package icon.</p>
856</html>"));
857 end Package;
858
859 partial package BasesPackage "Icon for packages containing base classes"
860 extends Modelica.Icons.Package;
861 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
862 -100},{100,100}}), graphics={
863 Ellipse(
864 extent={{-30.0,-30.0},{30.0,30.0}},
865 lineColor={128,128,128},
866 fillColor={255,255,255},
867 fillPattern=FillPattern.Solid)}),
868 Documentation(info="<html>
869<p>This icon shall be used for a package/library that contains base models and classes, respectively.</p>
870</html>"));
871 end BasesPackage;
872
873 partial package VariantsPackage "Icon for package containing variants"
874 extends Modelica.Icons.Package;
875 annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
876 {100,100}}), graphics={
877 Ellipse(
878 origin={10.0,10.0},
879 fillColor={76,76,76},
880 pattern=LinePattern.None,
881 fillPattern=FillPattern.Solid,
882 extent={{-80.0,-80.0},{-20.0,-20.0}}),
883 Ellipse(
884 origin={10.0,10.0},
885 pattern=LinePattern.None,
886 fillPattern=FillPattern.Solid,
887 extent={{0.0,-80.0},{60.0,-20.0}}),
888 Ellipse(
889 origin={10.0,10.0},
890 fillColor={128,128,128},
891 pattern=LinePattern.None,
892 fillPattern=FillPattern.Solid,
893 extent={{0.0,0.0},{60.0,60.0}}),
894 Ellipse(
895 origin={10.0,10.0},
896 lineColor={128,128,128},
897 fillColor={255,255,255},
898 fillPattern=FillPattern.Solid,
899 extent={{-80.0,0.0},{-20.0,60.0}})}),
900 Documentation(info="<html>
901<p>This icon shall be used for a package/library that contains several variants of one components.</p>
902</html>"));
903 end VariantsPackage;
904
905 partial package InterfacesPackage "Icon for packages containing interfaces"
906 extends Modelica.Icons.Package;
907 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
908 -100},{100,100}}), graphics={
909 Polygon(origin={20.0,0.0},
910 lineColor={64,64,64},
911 fillColor={255,255,255},
912 fillPattern=FillPattern.Solid,
913 points={{-10.0,70.0},{10.0,70.0},{40.0,20.0},{80.0,20.0},{80.0,-20.0},{40.0,-20.0},{10.0,-70.0},{-10.0,-70.0}}),
914 Polygon(fillColor={102,102,102},
915 pattern=LinePattern.None,
916 fillPattern=FillPattern.Solid,
917 points={{-100.0,20.0},{-60.0,20.0},{-30.0,70.0},{-10.0,70.0},{-10.0,-70.0},{-30.0,-70.0},{-60.0,-20.0},{-100.0,-20.0}})}),
918 Documentation(info="<html>
919<p>This icon indicates packages containing interfaces.</p>
920</html>"));
921 end InterfacesPackage;
922
923 partial package SourcesPackage "Icon for packages containing sources"
924 extends Modelica.Icons.Package;
925 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
926 -100},{100,100}}), graphics={
927 Polygon(origin={23.3333,0.0},
928 fillColor={128,128,128},
929 pattern=LinePattern.None,
930 fillPattern=FillPattern.Solid,
931 points={{-23.333,30.0},{46.667,0.0},{-23.333,-30.0}}),
932 Rectangle(
933 fillColor= {128,128,128},
934 pattern= LinePattern.None,
935 fillPattern= FillPattern.Solid,
936 extent= {{-70,-4.5},{0,4.5}})}),
937 Documentation(info="<html>
938<p>This icon indicates a package which contains sources.</p>
939</html>"));
940 end SourcesPackage;
941
942 partial package SensorsPackage "Icon for packages containing sensors"
943 extends Modelica.Icons.Package;
944 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
945 -100},{100,100}}), graphics={
946 Ellipse(origin={0.0,-30.0},
947 fillColor={255,255,255},
948 extent={{-90.0,-90.0},{90.0,90.0}},
949 startAngle=20.0,
950 endAngle=160.0),
951 Ellipse(origin={0.0,-30.0},
952 fillColor={128,128,128},
953 pattern=LinePattern.None,
954 fillPattern=FillPattern.Solid,
955 extent={{-20.0,-20.0},{20.0,20.0}}),
956 Line(origin={0.0,-30.0},
957 points={{0.0,60.0},{0.0,90.0}}),
958 Ellipse(origin={-0.0,-30.0},
959 fillColor={64,64,64},
960 pattern=LinePattern.None,
961 fillPattern=FillPattern.Solid,
962 extent={{-10.0,-10.0},{10.0,10.0}}),
963 Polygon(
964 origin={-0.0,-30.0},
965 rotation=-35.0,
966 fillColor={64,64,64},
967 pattern=LinePattern.None,
968 fillPattern=FillPattern.Solid,
969 points={{-7.0,0.0},{-3.0,85.0},{0.0,90.0},{3.0,85.0},{7.0,0.0}})}),
970 Documentation(info="<html>
971<p>This icon indicates a package containing sensors.</p>
972</html>"));
973 end SensorsPackage;
974
975 partial package IconsPackage "Icon for packages containing icons"
976 extends Modelica.Icons.Package;
977 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
978 -100},{100,100}}), graphics={Polygon(
979 origin={-8.167,-17},
980 fillColor={128,128,128},
981 pattern=LinePattern.None,
982 fillPattern=FillPattern.Solid,
983 points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
984 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
985 -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
986 smooth=Smooth.Bezier,
987 lineColor={0,0,0}), Ellipse(
988 origin={-0.5,56.5},
989 fillColor={128,128,128},
990 pattern=LinePattern.None,
991 fillPattern=FillPattern.Solid,
992 extent={{-12.5,-12.5},{12.5,12.5}},
993 lineColor={0,0,0})}));
994 end IconsPackage;
995
996 partial package MaterialPropertiesPackage
997 "Icon for package containing property classes"
998 extends Modelica.Icons.Package;
999 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
1000 -100},{100,100}}), graphics={
1001 Ellipse(
1002 lineColor={102,102,102},
1003 fillColor={204,204,204},
1004 pattern=LinePattern.None,
1005 fillPattern=FillPattern.Sphere,
1006 extent={{-60.0,-60.0},{60.0,60.0}})}),
1007 Documentation(info="<html>
1008<p>This icon indicates a package that contains properties</p>
1009</html>"));
1010 end MaterialPropertiesPackage;
1011
1012 partial function Function "Icon for functions"
1013
1014 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}), graphics={
1015 Text(
1016 lineColor={0,0,255},
1017 extent={{-150,105},{150,145}},
1018 textString="%name"),
1019 Ellipse(
1020 lineColor= {108,88,49},
1021 fillColor= {255,215,136},
1022 fillPattern= FillPattern.Solid,
1023 extent= {{-100,-100},{100,100}}),
1024 Text(
1025 lineColor={108,88,49},
1026 extent={{-90.0,-90.0},{90.0,90.0}},
1027 textString="f")}),
1028 Documentation(info="<html>
1029<p>This icon indicates Modelica functions.</p>
1030</html>"));
1031 end Function;
1032
1033 partial record Record "Icon for records"
1034
1035 annotation (Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics={
1036 Text(
1037 lineColor={0,0,255},
1038 extent={{-150,60},{150,100}},
1039 textString="%name"),
1040 Rectangle(
1041 origin={0.0,-25.0},
1042 lineColor={64,64,64},
1043 fillColor={255,215,136},
1044 fillPattern=FillPattern.Solid,
1045 extent={{-100.0,-75.0},{100.0,75.0}},
1046 radius=25.0),
1047 Line(
1048 points={{-100.0,0.0},{100.0,0.0}},
1049 color={64,64,64}),
1050 Line(
1051 origin={0.0,-50.0},
1052 points={{-100.0,0.0},{100.0,0.0}},
1053 color={64,64,64}),
1054 Line(
1055 origin={0.0,-25.0},
1056 points={{0.0,75.0},{0.0,-75.0}},
1057 color={64,64,64})}), Documentation(info="<html>
1058<p>
1059This icon is indicates a record.
1060</p>
1061</html>"));
1062 end Record;
1063 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
1064 -100},{100,100}}), graphics={Polygon(
1065 origin={-8.167,-17},
1066 fillColor={128,128,128},
1067 pattern=LinePattern.None,
1068 fillPattern=FillPattern.Solid,
1069 points={{-15.833,20.0},{-15.833,30.0},{14.167,40.0},{24.167,20.0},{
1070 4.167,-30.0},{14.167,-30.0},{24.167,-30.0},{24.167,-40.0},{-5.833,
1071 -50.0},{-15.833,-30.0},{4.167,20.0},{-5.833,20.0}},
1072 smooth=Smooth.Bezier,
1073 lineColor={0,0,0}), Ellipse(
1074 origin={-0.5,56.5},
1075 fillColor={128,128,128},
1076 pattern=LinePattern.None,
1077 fillPattern=FillPattern.Solid,
1078 extent={{-12.5,-12.5},{12.5,12.5}},
1079 lineColor={0,0,0})}), Documentation(info="<html>
1080<p>This package contains definitions for the graphical layout of components which may be used in different libraries. The icons can be utilized by inheriting them in the desired class using &quot;extends&quot; or by directly copying the &quot;icon&quot; layer. </p>
1081
1082<h4>Main Authors:</h4>
1083
1084<dl>
1085<dt><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a></dt>
1086 <dd>Deutsches Zentrum fuer Luft und Raumfahrt e.V. (DLR)</dd>
1087 <dd>Oberpfaffenhofen</dd>
1088 <dd>Postfach 1116</dd>
1089 <dd>D-82230 Wessling</dd>
1090 <dd>email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a></dd>
1091<dt>Christian Kral</dt>
1092 <dd><a href=\"http://www.ait.ac.at/\">Austrian Institute of Technology, AIT</a></dd>
1093 <dd>Mobility Department</dd><dd>Giefinggasse 2</dd>
1094 <dd>1210 Vienna, Austria</dd>
1095 <dd>email: <a href=\"mailto:dr.christian.kral@gmail.com\">dr.christian.kral@gmail.com</a></dd>
1096<dt>Johan Andreasson</dt>
1097 <dd><a href=\"http://www.modelon.se/\">Modelon AB</a></dd>
1098 <dd>Ideon Science Park</dd>
1099 <dd>22370 Lund, Sweden</dd>
1100 <dd>email: <a href=\"mailto:johan.andreasson@modelon.se\">johan.andreasson@modelon.se</a></dd>
1101</dl>
1102
1103<p>Copyright &copy; 1998-2013, Modelica Association, DLR, AIT, and Modelon AB. </p>
1104<p><i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified under the terms of the <b>Modelica license</b>, see the license conditions and the accompanying <b>disclaimer</b> in <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a>.</i> </p>
1105</html>"));
1106 end Icons;
1107
1108 package SIunits
1109 "Library of type and unit definitions based on SI units according to ISO 31-1992"
1110 extends Modelica.Icons.Package;
1111
1112 package Conversions
1113 "Conversion functions to/from non SI units and type definitions of non SI units"
1114 extends Modelica.Icons.Package;
1115
1116 package NonSIunits "Type definitions of non SI units"
1117 extends Modelica.Icons.Package;
1118 annotation (Documentation(info="<HTML>
1119<p>
1120This package provides predefined types, such as <b>Angle_deg</b> (angle in
1121degree), <b>AngularVelocity_rpm</b> (angular velocity in revolutions per
1122minute) or <b>Temperature_degF</b> (temperature in degree Fahrenheit),
1123which are in common use but are not part of the international standard on
1124units according to ISO 31-1992 \"General principles concerning quantities,
1125units and symbols\" and ISO 1000-1992 \"SI units and recommendations for
1126the use of their multiples and of certain other units\".</p>
1127<p>If possible, the types in this package should not be used. Use instead
1128types of package Modelica.SIunits. For more information on units, see also
1129the book of Francois Cardarelli <b>Scientific Unit Conversion - A
1130Practical Guide to Metrication</b> (Springer 1997).</p>
1131<p>Some units, such as <b>Temperature_degC/Temp_C</b> are both defined in
1132Modelica.SIunits and in Modelica.Conversions.NonSIunits. The reason is that these
1133definitions have been placed erroneously in Modelica.SIunits although they
1134are not SIunits. For backward compatibility, these type definitions are
1135still kept in Modelica.SIunits.</p>
1136</html>"), Icon(coordinateSystem(extent={{-100,-100},{100,100}}), graphics={
1137 Text(
1138 origin={15.0,51.8518},
1139 extent={{-105.0,-86.8518},{75.0,-16.8518}},
1140 lineColor={0,0,0},
1141 textString="[km/h]")}));
1142 end NonSIunits;
1143 annotation ( Documentation(info="<HTML>
1144<p>This package provides conversion functions from the non SI Units
1145defined in package Modelica.SIunits.Conversions.NonSIunits to the
1146corresponding SI Units defined in package Modelica.SIunits and vice
1147versa. It is recommended to use these functions in the following
1148way (note, that all functions have one Real input and one Real output
1149argument):</p>
1150<pre>
1151 <b>import</b> SI = Modelica.SIunits;
1152 <b>import</b> Modelica.SIunits.Conversions.*;
1153 ...
1154 <b>parameter</b> SI.Temperature T = from_degC(25); // convert 25 degree Celsius to Kelvin
1155 <b>parameter</b> SI.Angle phi = from_deg(180); // convert 180 degree to radian
1156 <b>parameter</b> SI.AngularVelocity w = from_rpm(3600); // convert 3600 revolutions per minutes
1157 // to radian per seconds
1158</pre>
1159
1160</html>"));
1161 end Conversions;
1162
1163 type Angle = Real (
1164 final quantity="Angle",
1165 final unit="rad",
1166 displayUnit="deg");
1167
1168 type Time = Real (final quantity="Time", final unit="s");
1169
1170 type AngularVelocity = Real (
1171 final quantity="AngularVelocity",
1172 final unit="rad/s");
1173
1174 type AngularAcceleration = Real (final quantity="AngularAcceleration", final unit=
1175 "rad/s2");
1176
1177 type Frequency = Real (final quantity="Frequency", final unit="Hz");
1178
1179 type AngularFrequency = Real (final quantity="AngularFrequency", final unit=
1180 "rad/s");
1181
1182 type Power = Real (final quantity="Power", final unit="W");
1183
1184 type ElectricCurrent = Real (final quantity="ElectricCurrent", final unit="A");
1185
1186 type Current = ElectricCurrent;
1187
1188 type ElectricPotential = Real (final quantity="ElectricPotential", final unit=
1189 "V");
1190
1191 type Voltage = ElectricPotential;
1192
1193 type Inductance = Real (
1194 final quantity="Inductance",
1195 final unit="H");
1196
1197 type Resistance = Real (
1198 final quantity="Resistance",
1199 final unit="Ohm");
1200
1201 type ActivePower = Real (final quantity="Power", final unit="W");
1202
1203 type ApparentPower = Real (final quantity="Power", final unit="VA");
1204 annotation (Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,
1205 -100},{100,100}}), graphics={
1206 Line(
1207 points={{-66,78},{-66,-40}},
1208 color={64,64,64},
1209 smooth=Smooth.None),
1210 Ellipse(
1211 extent={{12,36},{68,-38}},
1212 lineColor={64,64,64},
1213 fillColor={175,175,175},
1214 fillPattern=FillPattern.Solid),
1215 Rectangle(
1216 extent={{-74,78},{-66,-40}},
1217 lineColor={64,64,64},
1218 fillColor={175,175,175},
1219 fillPattern=FillPattern.Solid),
1220 Polygon(
1221 points={{-66,-4},{-66,6},{-16,56},{-16,46},{-66,-4}},
1222 lineColor={64,64,64},
1223 smooth=Smooth.None,
1224 fillColor={175,175,175},
1225 fillPattern=FillPattern.Solid),
1226 Polygon(
1227 points={{-46,16},{-40,22},{-2,-40},{-10,-40},{-46,16}},
1228 lineColor={64,64,64},
1229 smooth=Smooth.None,
1230 fillColor={175,175,175},
1231 fillPattern=FillPattern.Solid),
1232 Ellipse(
1233 extent={{22,26},{58,-28}},
1234 lineColor={64,64,64},
1235 fillColor={255,255,255},
1236 fillPattern=FillPattern.Solid),
1237 Polygon(
1238 points={{68,2},{68,-46},{64,-60},{58,-68},{48,-72},{18,-72},{18,-64},
1239 {46,-64},{54,-60},{58,-54},{60,-46},{60,-26},{64,-20},{68,-6},{68,
1240 2}},
1241 lineColor={64,64,64},
1242 smooth=Smooth.Bezier,
1243 fillColor={175,175,175},
1244 fillPattern=FillPattern.Solid)}), Documentation(info="<html>
1245<p>This package provides predefined types, such as <i>Mass</i>,
1246<i>Angle</i>, <i>Time</i>, based on the international standard
1247on units, e.g.,
1248</p>
1249
1250<pre> <b>type</b> Angle = Real(<b>final</b> quantity = \"Angle\",
1251 <b>final</b> unit = \"rad\",
1252 displayUnit = \"deg\");
1253</pre>
1254
1255<p>
1256as well as conversion functions from non SI-units to SI-units
1257and vice versa in subpackage
1258<a href=\"modelica://Modelica.SIunits.Conversions\">Conversions</a>.
1259</p>
1260
1261<p>
1262For an introduction how units are used in the Modelica standard library
1263with package SIunits, have a look at:
1264<a href=\"modelica://Modelica.SIunits.UsersGuide.HowToUseSIunits\">How to use SIunits</a>.
1265</p>
1266
1267<p>
1268Copyright &copy; 1998-2013, Modelica Association and DLR.
1269</p>
1270<p>
1271<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
1272</p>
1273</html>", revisions="<html>
1274<ul>
1275<li><i>May 25, 2011</i> by Stefan Wischhusen:<br/>Added molar units for energy and enthalpy.</li>
1276<li><i>Jan. 27, 2010</i> by Christian Kral:<br/>Added complex units.</li>
1277<li><i>Dec. 14, 2005</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Add User&#39;;s Guide and removed &quot;min&quot; values for Resistance and Conductance.</li>
1278<li><i>October 21, 2002</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and <a href=\"http://www.robotic.dlr.de/Christian.Schweiger/\">Christian Schweiger</a>:<br/>Added new package <b>Conversions</b>. Corrected typo <i>Wavelenght</i>.</li>
1279<li><i>June 6, 2000</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Introduced the following new types<br/>type Temperature = ThermodynamicTemperature;<br/>types DerDensityByEnthalpy, DerDensityByPressure, DerDensityByTemperature, DerEnthalpyByPressure, DerEnergyByDensity, DerEnergyByPressure<br/>Attribute &quot;final&quot; removed from min and max values in order that these values can still be changed to narrow the allowed range of values.<br/>Quantity=&quot;Stress&quot; removed from type &quot;Stress&quot;, in order that a type &quot;Stress&quot; can be connected to a type &quot;Pressure&quot;.</li>
1280<li><i>Oct. 27, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>New types due to electrical library: Transconductance, InversePotential, Damping.</li>
1281<li><i>Sept. 18, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Renamed from SIunit to SIunits. Subpackages expanded, i.e., the SIunits package, does no longer contain subpackages.</li>
1282<li><i>Aug 12, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Type &quot;Pressure&quot; renamed to &quot;AbsolutePressure&quot; and introduced a new type &quot;Pressure&quot; which does not contain a minimum of zero in order to allow convenient handling of relative pressure. Redefined BulkModulus as an alias to AbsolutePressure instead of Stress, since needed in hydraulics.</li>
1283<li><i>June 29, 1999</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a>:<br/>Bug-fix: Double definition of &quot;Compressibility&quot; removed and appropriate &quot;extends Heat&quot; clause introduced in package SolidStatePhysics to incorporate ThermodynamicTemperature.</li>
1284<li><i>April 8, 1998</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and Astrid Jaschinski:<br/>Complete ISO 31 chapters realized.</li>
1285<li><i>Nov. 15, 1997</i> by <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> and <a href=\"http://www.control.lth.se/~hubertus/\">Hubertus Tummescheit</a>:<br/>Some chapters realized.</li>
1286</ul>
1287</html>"));
1288 end SIunits;
1289annotation (
1290preferredView="info",
1291version="3.2.1",
1292versionBuild=2,
1293versionDate="2013-08-14",
1294dateModified = "2013-08-14 08:44:41Z",
1295revisionId="$Id:: package.mo 6947 2013-08-23 07:41:37Z #$",
1296uses(Complex(version="3.2.1"), ModelicaServices(version="3.2.1")),
1297conversion(
1298 noneFromVersion="3.2",
1299 noneFromVersion="3.1",
1300 noneFromVersion="3.0.1",
1301 noneFromVersion="3.0",
1302 from(version="2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1303 from(version="2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1304 from(version="2.2.1", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos"),
1305 from(version="2.2.2", script="modelica://Modelica/Resources/Scripts/Dymola/ConvertModelica_from_2.2.2_to_3.0.mos")),
1306Icon(coordinateSystem(extent={{-100.0,-100.0},{100.0,100.0}}), graphics={
1307 Polygon(
1308 origin={-6.9888,20.048},
1309 fillColor={0,0,0},
1310 pattern=LinePattern.None,
1311 fillPattern=FillPattern.Solid,
1312 points={{-93.0112,10.3188},{-93.0112,10.3188},{-73.011,24.6},{-63.011,31.221},{-51.219,36.777},{-39.842,38.629},{-31.376,36.248},{-25.819,29.369},{-24.232,22.49},{-23.703,17.463},{-15.501,25.135},{-6.24,32.015},{3.02,36.777},{15.191,39.423},{27.097,37.306},{32.653,29.633},{35.035,20.108},{43.501,28.046},{54.085,35.19},{65.991,39.952},{77.897,39.688},{87.422,33.338},{91.126,21.696},{90.068,9.525},{86.099,-1.058},{79.749,-10.054},{71.283,-21.431},{62.816,-33.337},{60.964,-32.808},{70.489,-16.14},{77.368,-2.381},{81.072,10.054},{79.749,19.05},{72.605,24.342},{61.758,23.019},{49.587,14.817},{39.003,4.763},{29.214,-6.085},{21.012,-16.669},{13.339,-26.458},{5.401,-36.777},{-1.213,-46.037},{-6.24,-53.446},{-8.092,-52.387},{-0.684,-40.746},{5.401,-30.692},{12.81,-17.198},{19.424,-3.969},{23.658,7.938},{22.335,18.785},{16.514,23.283},{8.047,23.019},{-1.478,19.05},{-11.267,11.113},{-19.734,2.381},{-29.259,-8.202},{-38.519,-19.579},{-48.044,-31.221},{-56.511,-43.392},{-64.449,-55.298},{-72.386,-66.939},{-77.678,-74.612},{-79.53,-74.083},{-71.857,-61.383},{-62.861,-46.037},{-52.278,-28.046},{-44.869,-15.346},{-38.784,-2.117},{-35.344,8.731},{-36.403,19.844},{-42.488,23.813},{-52.013,22.49},{-60.744,16.933},{-68.947,10.054},{-76.884,2.646},{-93.0112,-12.1707},{-93.0112,-12.1707}},
1313 smooth=Smooth.Bezier),
1314 Ellipse(
1315 origin={40.8208,-37.7602},
1316 fillColor={161,0,4},
1317 pattern=LinePattern.None,
1318 fillPattern=FillPattern.Solid,
1319 extent={{-17.8562,-17.8563},{17.8563,17.8562}})}),
1320Documentation(info="<HTML>
1321<p>
1322Package <b>Modelica&reg;</b> is a <b>standardized</b> and <b>free</b> package
1323that is developed together with the Modelica&reg; language from the
1324Modelica Association, see
1325<a href=\"https://www.Modelica.org\">https://www.Modelica.org</a>.
1326It is also called <b>Modelica Standard Library</b>.
1327It provides model components in many domains that are based on
1328standardized interface definitions. Some typical examples are shown
1329in the next figure:
1330</p>
1331
1332<p>
1333<img src=\"modelica://Modelica/Resources/Images/UsersGuide/ModelicaLibraries.png\">
1334</p>
1335
1336<p>
1337For an introduction, have especially a look at:
1338</p>
1339<ul>
1340<li> <a href=\"modelica://Modelica.UsersGuide.Overview\">Overview</a>
1341 provides an overview of the Modelica Standard Library
1342 inside the <a href=\"modelica://Modelica.UsersGuide\">User's Guide</a>.</li>
1343<li><a href=\"modelica://Modelica.UsersGuide.ReleaseNotes\">Release Notes</a>
1344 summarizes the changes of new versions of this package.</li>
1345<li> <a href=\"modelica://Modelica.UsersGuide.Contact\">Contact</a>
1346 lists the contributors of the Modelica Standard Library.</li>
1347<li> The <b>Examples</b> packages in the various libraries, demonstrate
1348 how to use the components of the corresponding sublibrary.</li>
1349</ul>
1350
1351<p>
1352This version of the Modelica Standard Library consists of
1353</p>
1354<ul>
1355<li><b>1360</b> models and blocks, and</li>
1356<li><b>1280</b> functions</li>
1357</ul>
1358<p>
1359that are directly usable (= number of public, non-partial classes). It is fully compliant
1360to <a href=\"https://www.modelica.org/documents/ModelicaSpec32Revision2.pdf\">Modelica Specification Version 3.2 Revision 2</a>
1361and it has been tested with Modelica tools from different vendors.
1362</p>
1363
1364<p>
1365<b>Licensed by the Modelica Association under the Modelica License 2</b><br>
1366Copyright &copy; 1998-2013, ABB, AIT, T.&nbsp;B&ouml;drich, DLR, Dassault Syst&egrave;mes AB, Fraunhofer, A.Haumer, ITI, Modelon,
1367TU Hamburg-Harburg, Politecnico di Milano, XRG Simulation.
1368</p>
1369
1370<p>
1371<i>This Modelica package is <u>free</u> software and the use is completely at <u>your own risk</u>; it can be redistributed and/or modified under the terms of the Modelica License 2. For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"https://www.modelica.org/licenses/ModelicaLicense2\"> https://www.modelica.org/licenses/ModelicaLicense2</a>.</i>
1372</p>
1373
1374<p>
1375<b>Modelica&reg;</b> is a registered trademark of the Modelica Association.
1376</p>
1377</html>"));
1378end Modelica;
1379
1380package PowerSystems "Library for electrical power systems"
1381 extends Modelica.Icons.Package;
1382 import Modelica.Constants.pi;
1383 import SI = Modelica.SIunits;
1384 import PowerSystems.Basic.Types.SIpu "Per-Unit types for user interface";
1385 import PowerSystems.Basic.Types;
1386
1387 model System "System reference"
1388 parameter SI.Frequency f_nom=50 "nom frequency"
1389 annotation(Evaluate=true, Dialog(group="System"), choices(choice=50 "50 Hz", choice=60 "60 Hz"));
1390 parameter SI.Frequency f=f_nom
1391 "frequency (initial if fType_par = false (average))"
1392 annotation(Evaluate=true, Dialog(group="System"));
1393 parameter Boolean fType_par = true
1394 "= true, if system frequency defined by parameter f, else average frequency"
1395 annotation(Evaluate=true, Dialog(group="System"));
1396 parameter SI.Frequency f_lim[2]={0.5*f_nom, 2*f_nom}
1397 "limit frequencies (for average definition)"
1398 annotation(Evaluate=true, Dialog(group="System",enable=not fType_par));
1399 parameter SI.Angle alpha0=0 "phase angle"
1400 annotation(Evaluate=true, Dialog(group="System"));
1401 parameter String ref = "synchron" "reference frame (3-phase)"
1402 annotation(Evaluate=true, Dialog(group="System", enable=sim=="tr"), choices(
1403 choice="synchron",
1404 choice="inertial"));
1405 parameter String ini = "st" "transient or steady-state initialisation"
1406 annotation(Evaluate=true, Dialog(group="Mode", enable=sim=="tr"), choices(
1407 choice="tr" "transient",
1408 choice="st" "steady"));
1409 parameter String sim = "tr" "transient or steady-state simulation"
1410 annotation(Evaluate=true, Dialog(group="Mode"), choices(
1411 choice="tr" "transient",
1412 choice="st" "steady"));
1413 final parameter SI.AngularFrequency omega_nom=2*pi*f_nom
1414 "nom angular frequency" annotation(Evaluate=true);
1415 final parameter Types.AngularVelocity w_nom=2*pi*f_nom "nom r.p.m."
1416 annotation(Evaluate=true, Dialog(group="Nominal"));
1417 final parameter Boolean synRef=if transientSim then ref=="synchron" else true
1418 annotation(Evaluate=true);
1419
1420 final parameter Boolean steadyIni = ini=="st"
1421 "steady state initialisation of electric equations" annotation(Evaluate=true);
1422 final parameter Boolean transientSim = sim=="tr"
1423 "transient mode of electric equations" annotation(Evaluate=true);
1424 final parameter Boolean steadyIni_t = steadyIni and transientSim
1425 annotation(Evaluate=true);
1426 discrete SI.Time initime;
1427 SI.Angle theta(final start=0, final fixed=true, stateSelect=StateSelect.always);
1428 SI.AngularFrequency omega(final start=2*pi*f);
1429 /*
1430 Modelica.Blocks.Interfaces.RealInput omega_inp(min=0)
1431 "system ang frequency (optional, fType=sig)"
1432 annotation (extent=[90,-10; 110,10], rotation=-180);
1433
1434 Removed, since not input connector of inner/outer class not allowed in Modelica 3.
1435*/
1436 Interfaces.Frequency receiveFreq
1437 "receives weighted frequencies from generators"
1438 annotation (Placement(transformation(extent={{-96,64},{-64,96}}, rotation=0)));
1439 equation
1440 when initial() then
1441 initime = time;
1442 end when;
1443 if fType_par then
1444 omega = 2*pi*f;
1445 /*
1446 elseif fType == Types.FreqType.sig then
1447 omega = omega_inp;
1448 Removed, since input connector of inner/outer class not allowed in Modelica 3
1449 */
1450 else
1451 omega = if initial() then 2*pi*f else receiveFreq.w_H/receiveFreq.H;
1452 when (omega < 2*pi*f_lim[1]) or (omega > 2*pi*f_lim[2]) then
1453 terminate("FREQUENCY EXCEEDS BOUNDS!");
1454 end when;
1455 end if;
1456 der(theta) = omega;
1457 // set dummy values (to achieve balanced model)
1458 receiveFreq.h = 0.0;
1459 receiveFreq.w_h = 0.0;
1460 annotation (
1461 preferedView="info",
1462 defaultComponentName="system",
1463 defaultComponentPrefixes="inner",
1464 missingInnerMessage="No \"system\" component is defined.
1465 Drag PowerSystems.System into the top level of your model.",
1466 Window(
1467 x=0.13,
1468 y=0.1,
1469 width=0.81,
1470 height=0.83),
1471 Icon(coordinateSystem(
1472 preserveAspectRatio=false,
1473 extent={{-100,-100},{100,100}},
1474 grid={2,2}), graphics={
1475 Rectangle(
1476 extent={{-100,100},{100,-100}},
1477 lineColor={0,120,120},
1478 fillColor={255,255,255},
1479 fillPattern=FillPattern.Solid),
1480 Rectangle(
1481 extent={{-100,100},{100,60}},
1482 lineColor={0,120,120},
1483 fillColor={0,120,120},
1484 fillPattern=FillPattern.Solid),
1485 Text(
1486 extent={{-60,100},{100,60}},
1487 lineColor={215,215,215},
1488 textString = "%name"),
1489 Text(
1490 extent={{-100,50},{100,20}},
1491 lineColor={0,0,0},
1492 textString = "f_nom=%f_nom"),
1493 Text(
1494 extent={{-100,-20},{100,10}},
1495 lineColor={0,0,0},
1496 textString=
1497 "f par:%fType_par"),
1498 Text(
1499 extent={{-100,-30},{100,-60}},
1500 lineColor={0,120,120},
1501 textString=
1502 "%ref"),
1503 Text(
1504 extent={{-100,-70},{100,-100}},
1505 lineColor={176,0,0},
1506 textString = "ini:%ini sim:%sim")}),
1507 Diagram(coordinateSystem(
1508 preserveAspectRatio=false,
1509 extent={{-100,-100},{100,100}},
1510 grid={2,2}), graphics),
1511 Documentation(info="<html>
1512<p>The model <b>System</b> represents a global reference for the following purposes:</p>
1513<p>It allows the choice of </p>
1514<ul>
1515<li> nominal frequency (default 50 or 60 Hertz, but arbitrary positive choice allowed)
1516<li> system frequency or initial system frequency, depending on frequency type</li>
1517<li> frequency type: parameter, signal, or average (machine-dependent) system frequency</li>
1518<li> lower and upper limit-frequencies</li>
1519<li> common phase angle for AC-systems</li>
1520<li> synchronous or inertial reference frame for AC-3phase-systems</li>
1521<li> transient or steady-state initialisation and simulation modes<br>
1522 For 'transient' initialisation no specific initial equations are defined.<br>
1523 This case allows also to use Dymola's steady-state initialisation, that is DIFFERENT from ours.<br>
1524 <b>Note:</b> the parameter 'sim' only affects AC three-phase components.</li>
1525</ul>
1526<p>It provides</p>
1527<ul>
1528<li> the system angular-frequency omega<br>
1529 For frequency-type 'parameter' this is simply a parameter value.<br>
1530 For frequency-type 'signal' it is a positive input signal.<br>
1531 For frequency-type 'average' it is a weighted average over the relevant generator frequencies.
1532<li> the system angle theta by integration of
1533<pre> der(theta) = omega </pre><br>
1534 This angle allows the definition of a rotating electrical <b>coordinate system</b><br>
1535 for <b>AC three-phase models</b>.<br>
1536 Root-nodes defining coordinate-orientation will choose a reference angle theta_ref (connector-variable theta[2]) according to the parameter <tt>ref</tt>:<br><br>
1537 <tt>theta_ref = theta if ref = \"synchron\"</tt> (reference frame is synchronously rotating with theta).<br>
1538 <tt>theta_ref = 0 if ref = \"inertial\"</tt> (inertial reference frame, not rotating).<br>
1539
1540 where<br>
1541 <tt>theta = 1 :</tt> reference frame is synchronously rotating.<br>
1542 <tt>ref=0 :</tt> reference frame is at rest.<br>
1543 Note: Steady-state simulation is only possible for <tt>ref = \"synchron\"</tt>.<br><br>
1544 <tt>ref</tt> is determined by the parameter <tt>refFrame</tt> in the following way:
1545
1546 </li>
1547</ul>
1548<p><b>Note</b>: Each model using <b>System</b> must use it with an <b>inner</b> declaration and instance name <b>system</b> in order that it can be accessed from all objects in the model.<br>When dragging the 'System' from the package browser into the diagram layer, declaration and instance name are automatically generated.</p>
1549<p><a href=\"Spot3.UsersGuide.Overview\">up users guide</a></p>
1550</html>
1551"));
1552 end System;
1553
1554 package Examples
1555 extends Modelica.Icons.ExamplesPackage;
1556
1557 package Spot "Examples from Modelica Power Systems Library Spot"
1558 extends Modelica.Icons.ExamplesPackage;
1559
1560 package AC3ph "AC 3-phase components dqo"
1561 extends Modelica.Icons.ExamplesPackage;
1562
1563 model Transformer "Transformer"
1564
1565 inner PowerSystems.System system
1566 annotation (Placement(transformation(extent={{-80,60},{-60,80}}, rotation=
1567 0)));
1568 /*
1569 PowerSystems.Blocks.Signals.TransientPhasor transPh
1570 annotation (Placement(transformation(extent={{-100,10},{-80,
1571 30}}, rotation=0)));
1572 PowerSystems.AC3ph.Sources.Voltage voltage(scType_par=false)
1573 annotation (Placement(transformation(extent={{-80,-10},{-60,10}},
1574 rotation=0)));
1575 PowerSystems.AC3ph.Sensors.PVImeter meter1
1576 annotation (Placement(transformation(extent={{-50,-10},{-30,10}},
1577 rotation=0)));*/
1578 replaceable PowerSystems.AC3ph.Transformers.TrafoStray trafo(par(
1579 v_tc1={1,1.1},
1580 v_tc2={1,1.2},
1581 V_nom={1,10}),
1582 redeclare PowerSystems.AC3ph.Ports.Topology.Y top_p "Y",
1583 redeclare PowerSystems.AC3ph.Ports.Topology.Delta top_n "Delta")
1584 annotation (Placement(transformation(extent={{0,-10},
1585 {20,10}}, rotation=0)));
1586 /*
1587 PowerSystems.AC3ph.Sensors.PVImeter meter2(V_nom=10)
1588 annotation (Placement(transformation(extent={{50,-10},{70,10}}, rotation=
1589 0)));
1590 PowerSystems.AC3ph.ImpedancesYD.Resistor res(V_nom=10, r=100)
1591 annotation (Placement(transformation(
1592 extent={{80,-10},{100,10}}, rotation=0)));
1593 PowerSystems.Control.Relays.TapChangerRelay TapChanger(
1594 preset_1={0,1,2},
1595 preset_2={0,1,2},
1596 t_switch_1={0.9,1.9},
1597 t_switch_2={1.1,2.1})
1598 annotation (Placement(transformation(
1599 origin={10,60},
1600 extent={{-10,-10},{10,10}},
1601 rotation=270)));
1602 PowerSystems.AC3ph.Nodes.GroundOne grd annotation (Placement(transformation(
1603 extent={{-80,-10},{-100,10}}, rotation=0)));
1604
1605 equation
1606 connect(transPh.y, voltage.vPhasor)
1607 annotation (Line(points={{-80,20},{-64,20},
1608 {-64,10}}, color={0,0,127}));
1609 connect(voltage.term, meter1.term_p) annotation (Line(points={{-60,0},{-50,
1610 0}}, color={0,110,110}));
1611 connect(meter1.term_n, trafo.term_p)
1612 annotation (Line(points={{-30,0},{0,0}}, color={0,110,110}));
1613 connect(trafo.term_n, meter2.term_p)
1614 annotation (Line(points={{20,0},{50,0}}, color={0,110,110}));
1615 connect(meter2.term_n, res.term)
1616 annotation (Line(points={{70,0},{80,0}}, color={0,110,110}));
1617 connect(grd.term, voltage.neutral)
1618 annotation (Line(points={{-80,0},{-80,0}}, color={0,0,255}));
1619 connect(TapChanger.tap_p, trafo.tap_p)
1620 annotation (Line(points={{6,50},{6,10}}, color={255,127,0}));
1621 connect(TapChanger.tap_n, trafo.tap_n) annotation (Line(points={{14,50},{14,
1622 10}}, color={255,127,0}));
1623 annotation (
1624 Documentation(
1625 info="<html>
1626</html>
1627"), Diagram(coordinateSystem(
1628 preserveAspectRatio=false,
1629 extent={{-100,-100},{100,100}},
1630 grid={2,2}), graphics),
1631 Window(
1632 x=0.45,
1633 y=0.01,
1634 width=0.44,
1635 height=0.65),
1636 Icon(coordinateSystem(
1637 preserveAspectRatio=false,
1638 extent={{-100,-100},{100,100}},
1639 grid={2,2}), graphics),
1640 experiment(StopTime=3),
1641 experimentSetupOutput); */
1642 end Transformer;
1643 annotation (preferedView="info",
1644 Window(
1645 x=0.05,
1646 y=0.41,
1647 width=0.4,
1648 height=0.42,
1649 library=1,
1650 autolayout=1),
1651 Documentation(info="<html>
1652<p>This package contains small models for testing single components from ACdqo.
1653The replaceable component can be replaced by a user defined component of similar type.</p>
1654<p><a href=\"PowerSystems.UsersGuide.Examples\">up users guide</a></p>
1655</html>"),Icon(coordinateSystem(
1656 preserveAspectRatio=false,
1657 extent={{-100,-100},{100,100}},
1658 grid={2,2}), graphics),
1659 preferedView="info",
1660 Coordsys(
1661 extent=[-100, -100; 100, 100],
1662 grid=[2, 2],
1663 component=[20, 20]),
1664 Window(
1665 x=0.05,
1666 y=0.41,
1667 width=0.4,
1668 height=0.42,
1669 library=1,
1670 autolayout=1),
1671 Documentation(info="<html>
1672<pre>
1673Models for testing components from PowerSystems.AC3ph.
1674</pre>
1675</html>
1676"), Icon);
1677 end AC3ph;
1678 annotation (
1679 classOrder={"Data","*"},
1680 Documentation(info="<html>
1681<h3><font color=\"#000080\" size=5>Modelica Power Systems Library SPOT: Examples</font></h3>
1682<p><a href=\"PowerSystems.UsersGuide\">up users guide</a></p>
1683<p>Copyright &copy; 2004-2008, H.J. Wiesmann.</p>
1684<p><i>This Modelica package is free software and the use is completely at your own risk. It can be redistributed and/or modified under the terms of the Modelica License 2.<br>
1685For license conditions (including the disclaimer of warranty) see <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">Modelica.UsersGuide.ModelicaLicense2</a> or visit <a href=\"http://www.modelica.org/licenses/ModelicaLicense2\"> http://www.modelica.org/licenses/ModelicaLicense2</a>.</i><br></p>
1686<a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i></p>
1687</html>"));
1688 end Spot;
1689 end Examples;
1690
1691 package PhaseSystems "Phase systems used in power connectors"
1692 extends Modelica.Icons.Package;
1693 import SI = Modelica.SIunits;
1694 import Modelica.Constants.pi;
1695
1696 partial package PartialPhaseSystem "Base package of all phase systems"
1697 extends Modelica.Icons.Package;
1698 constant String phaseSystemName = "UnspecifiedPhaseSystem";
1699 constant Integer n "Number of independent voltage and current components";
1700 constant Integer m "Number of reference angles";
1701
1702 type Voltage = Real(unit = "V", quantity = "Voltage." + phaseSystemName)
1703 "voltage for connector";
1704 type Current = Real(unit = "A", quantity = "Current." + phaseSystemName)
1705 "current for connector";
1706 type ReferenceAngle "Reference angle for connector"
1707 extends SI.Angle;
1708
1709 function equalityConstraint
1710 input ReferenceAngle theta1[:];
1711 input ReferenceAngle theta2[:];
1712 output Real[0] residue "No constraints";
1713 algorithm
1714 for i in 1:size(theta1, 1) loop
1715 assert(abs(theta1[i] - theta2[i]) < Modelica.Constants.eps, "angles theta1 and theta2 not equal over connection!");
1716 end for;
1717 end equalityConstraint;
1718 end ReferenceAngle;
1719
1720 replaceable partial function j "Return vector rotated by 90 degrees"
1721 extends Modelica.Icons.Function;
1722 input Real x[n];
1723 output Real y[n];
1724 end j;
1725
1726 replaceable function jj "Vectorized version of j"
1727 input Real[:,:] xx "array of voltage or current vectors";
1728 output Real[size(xx,1),size(xx,2)] yy "array of rotated vectors";
1729 algorithm
1730 //yy := {j(xx[:,k]) for k in 1:size(xx,2)};
1731 // Note: Dymola 2013 fails to expand
1732 for k in 1:size(xx,2) loop
1733 yy[:,k] := j(xx[:,k]);
1734 end for;
1735 end jj;
1736
1737 replaceable partial function thetaRel
1738 "Return absolute angle of rotating system as offset to thetaRef"
1739 input SI.Angle theta[m];
1740 output SI.Angle thetaRel;
1741 end thetaRel;
1742
1743 replaceable partial function thetaRef
1744 "Return absolute angle of rotating reference system"
1745 input SI.Angle theta[m];
1746 output SI.Angle thetaRef;
1747 end thetaRef;
1748
1749 replaceable partial function phase "Return phase"
1750 extends Modelica.Icons.Function;
1751 input Real x[n];
1752 output SI.Angle phase;
1753 end phase;
1754
1755 replaceable partial function phaseVoltages
1756 "Return phase to neutral voltages"
1757 extends Modelica.Icons.Function;
1758 input SI.Voltage V "system voltage";
1759 input SI.Angle phi = 0 "phase angle";
1760 output SI.Voltage v[n] "phase to neutral voltages";
1761 end phaseVoltages;
1762
1763 replaceable partial function phaseCurrents "Return phase currents"
1764 extends Modelica.Icons.Function;
1765 input SI.Current I "system current";
1766 input SI.Angle phi = 0 "phase angle";
1767 output SI.Current i[n] "phase currents";
1768 end phaseCurrents;
1769
1770 replaceable partial function phasePowers "Return phase powers"
1771 extends Modelica.Icons.Function;
1772 input SI.ActivePower P "active system power";
1773 input SI.Angle phi = 0 "phase angle";
1774 output SI.Power p[n] "phase powers";
1775 end phasePowers;
1776
1777 replaceable partial function phasePowers_vi "Return phase powers"
1778 extends Modelica.Icons.Function;
1779 input SI.Voltage v[n] "phase voltages";
1780 input SI.Current i[n] "phase currents";
1781 output SI.Power p[n] "phase powers";
1782 end phasePowers_vi;
1783
1784 replaceable partial function systemVoltage
1785 "Return system voltage as function of phase voltages"
1786 extends Modelica.Icons.Function;
1787 input SI.Voltage v[n];
1788 output SI.Voltage V;
1789 end systemVoltage;
1790
1791 replaceable partial function systemCurrent
1792 "Return system current as function of phase currents"
1793 extends Modelica.Icons.Function;
1794 input SI.Current i[n];
1795 output SI.Current I;
1796 end systemCurrent;
1797
1798 replaceable partial function activePower
1799 "Return total power as function of phase powers"
1800 extends Modelica.Icons.Function;
1801 input SI.Voltage v[n] "phase voltages";
1802 input SI.Current i[n] "phase currents";
1803 output SI.ActivePower P "active system power";
1804 end activePower;
1805
1806 annotation (Icon(graphics));
1807 end PartialPhaseSystem;
1808
1809 package ThreePhase_dqo "AC system in dqo representation"
1810 extends PartialPhaseSystem(phaseSystemName="ThreePhase_dqo", n=3, m=2);
1811
1812 redeclare function j
1813 "Rotation(pi/2) of vector around {0,0,1} and projection on orth plane"
1814 extends Modelica.Icons.Function;
1815 input Real x[:];
1816 output Real y[size(x,1)];
1817 algorithm
1818 y := cat(1, {-x[2], x[1]}, zeros(size(x,1)-2));
1819 end j;
1820
1821 redeclare function jj "Vectorized version of j"
1822 input Real[:,:] xx "array of voltage or current vectors";
1823 output Real[size(xx,1),size(xx,2)] yy "array of rotated vectors";
1824 algorithm
1825 yy := cat(1, {-xx[2,:], xx[1,:]}, zeros(size(xx,1)-2, size(xx,2)));
1826 end jj;
1827
1828 redeclare function thetaRel
1829 "Return absolute angle of rotating system as offset to thetaRef"
1830 input SI.Angle theta[m];
1831 output SI.Angle thetaRel;
1832 algorithm
1833 thetaRel := theta[1];
1834 end thetaRel;
1835
1836 redeclare function thetaRef
1837 "Return absolute angle of rotating reference system"
1838 input SI.Angle theta[m];
1839 output SI.Angle thetaRef;
1840 algorithm
1841 thetaRef := theta[2];
1842 end thetaRef;
1843
1844 redeclare function phase "Return phase"
1845 extends Modelica.Icons.Function;
1846 input Real x[n];
1847 output SI.Angle phase;
1848 algorithm
1849 phase := atan2(x[2], x[1]);
1850 end phase;
1851
1852 redeclare function phaseVoltages "Return phase to neutral voltages"
1853 extends Modelica.Icons.Function;
1854 input SI.Voltage V "system voltage";
1855 input SI.Angle phi = 0 "phase angle";
1856 output SI.Voltage v[n] "phase to neutral voltages";
1857 protected
1858 Voltage neutral_v = 0;
1859 algorithm
1860 v := {V*cos(phi), V*sin(phi), sqrt(3)*neutral_v}/sqrt(3);
1861 end phaseVoltages;
1862
1863 redeclare function phaseCurrents "Return phase currents"
1864 extends Modelica.Icons.Function;
1865 input Current I "system current";
1866 input SI.Angle phi = 0 "phase angle";
1867 output SI.Current i[n] "phase currents";
1868 algorithm
1869 i := {I*cos(phi), I*sin(phi), 0};
1870 end phaseCurrents;
1871
1872 redeclare function phasePowers "Return phase powers"
1873 extends Modelica.Icons.Function;
1874 input SI.ActivePower P "active system power";
1875 input SI.Angle phi = 0 "phase angle";
1876 output SI.Power p[n] "phase powers";
1877 algorithm
1878 p := {P, P*tan(phi), 0};
1879 end phasePowers;
1880
1881 redeclare function phasePowers_vi "Return phase powers"
1882 extends Modelica.Icons.Function;
1883 input SI.Voltage v[n] "phase voltages";
1884 input SI.Current i[n] "phase currents";
1885 output SI.Power p[n] "phase powers";
1886 algorithm
1887 p := {v[1:2]*i[1:2], -j(v[1:2])*i[1:2], v[3]*i[3]};
1888 end phasePowers_vi;
1889
1890 redeclare function systemVoltage
1891 "Return system voltage as function of phase voltages"
1892 extends Modelica.Icons.Function;
1893 input SI.Voltage v[n];
1894 output SI.Voltage V;
1895 algorithm
1896 V := sqrt(v*v);
1897 end systemVoltage;
1898
1899 redeclare function systemCurrent
1900 "Return system current as function of phase currents"
1901 extends Modelica.Icons.Function;
1902 input SI.Current i[n];
1903 output SI.Current I;
1904 algorithm
1905 I := sqrt(i*i);
1906 end systemCurrent;
1907
1908 redeclare function activePower
1909 "Return total power as function of phase powers"
1910 extends Modelica.Icons.Function;
1911 input SI.Voltage v[n] "phase voltages";
1912 input SI.Current i[n] "phase currents";
1913 output SI.ActivePower P "active system power";
1914 algorithm
1915 P := v[1]*i[1];
1916 end activePower;
1917
1918 annotation (Icon(graphics={
1919 Line(
1920 points={{-70,28},{-58,48},{-38,68},{-22,48},{-10,28},{2,8},{22,-12},
1921 {40,8},{50,28}},
1922 color={95,95,95},
1923 smooth=Smooth.Bezier),
1924 Line(
1925 points={{-70,-54},{50,-54}},
1926 color={95,95,95},
1927 smooth=Smooth.None),
1928 Line(
1929 points={{-70,-78},{50,-78}},
1930 color={95,95,95},
1931 smooth=Smooth.None),
1932 Line(
1933 points={{-70,-28},{50,-28}},
1934 color={95,95,95},
1935 smooth=Smooth.None)}));
1936 end ThreePhase_dqo;
1937 annotation (Icon(graphics={Line(
1938 points={{-70,-52},{50,-52}},
1939 color={95,95,95},
1940 smooth=Smooth.None), Line(
1941 points={{-70,8},{-58,28},{-38,48},{-22,28},{-10,8},{2,-12},{22,-32},{
1942 40,-12},{50,8}},
1943 color={95,95,95},
1944 smooth=Smooth.Bezier)}));
1945 end PhaseSystems;
1946
1947 package AC3ph "AC three phase components from Spot ACdqo"
1948 extends Modelica.Icons.VariantsPackage;
1949
1950 package ImpedancesYD
1951 "Impedance and admittance one terminal, Y and Delta topology"
1952 extends Modelica.Icons.VariantsPackage;
1953
1954 model Resistor "Resistor, 3-phase dqo"
1955 extends Partials.ImpedYDBase(final f_nom=0, final stIni_en=false);
1956
1957 parameter SIpu.Resistance r=1 "resistance";
1958 protected
1959 final parameter SI.Resistance R=r*Basic.Precalculation.baseR(puUnits, V_nom, S_nom, top.scale);
1960
1961 equation
1962 R*i = v;
1963 annotation (
1964 defaultComponentName="resYD1",
1965 Window(
1966 x=0.45,
1967 y=0.01,
1968 width=0.44,
1969 height=0.65),
1970 Documentation(
1971 info="<html>
1972<p>Info see package ACdqo.ImpedancesYD.</p>
1973</html>
1974"), Icon(coordinateSystem(
1975 preserveAspectRatio=false,
1976 extent={{-100,-100},{100,100}},
1977 grid={2,2}), graphics={Rectangle(
1978 extent={{-80,30},{70,-30}},
1979 lineColor={0,0,0},
1980 lineThickness=0.5,
1981 fillColor={255,255,255})}),
1982 Diagram(coordinateSystem(
1983 preserveAspectRatio=false,
1984 extent={{-100,-100},{100,100}},
1985 grid={2,2}), graphics={
1986 Rectangle(
1987 extent={{-70,20},{30,13}},
1988 lineColor={0,0,255},
1989 lineThickness=0.5,
1990 fillColor={255,255,255},
1991 fillPattern=FillPattern.Solid),
1992 Rectangle(
1993 extent={{-70,3},{30,-4}},
1994 lineColor={0,0,255},
1995 lineThickness=0.5,
1996 fillColor={255,255,255},
1997 fillPattern=FillPattern.Solid),
1998 Rectangle(
1999 extent={{-70,-13},{30,-20}},
2000 lineColor={0,0,255},
2001 lineThickness=0.5,
2002 fillColor={255,255,255},
2003 fillPattern=FillPattern.Solid)}));
2004 end Resistor;
2005
2006 package Partials "Partial models"
2007 extends Modelica.Icons.BasesPackage;
2008
2009 partial model ImpedYDBase "One terminal impedance base, 3-phase dqo"
2010 extends Ports.YDport_p;
2011 extends Basic.Nominal.NominalAC;
2012
2013 parameter Boolean stIni_en=true
2014 "enable steady-state initial equation" annotation(evaluate=true);
2015 parameter SIpu.Resistance r_n=1 "resistance neutral to grd"
2016 annotation(Dialog(enable));
2017 protected
2018 final parameter Boolean steadyIni_t=system.steadyIni_t and stIni_en;
2019 final parameter SI.Resistance R_n=r_n*Basic.Precalculation.baseR(puUnits, V_nom, S_nom);
2020 SI.AngularFrequency[2] omega;
2021
2022 equation
2023 omega = der(term.theta);
2024 v_n = R_n*i_n "equation neutral to ground (if Y-topology)";
2025 annotation (
2026 Window(
2027 x=0.45,
2028 y=0.01,
2029 width=0.44,
2030 height=0.65),
2031 Documentation(
2032 info="<html>
2033<p>Y-topology: contains an equation for neutral to ground</p>
2034<p>Delta-topology: <tt>i[3] = 0</tt></p>
2035</html>"), Diagram(coordinateSystem(
2036 preserveAspectRatio=false,
2037 extent={{-100,-100},{100,100}},
2038 grid={2,2}), graphics={Rectangle(
2039 extent={{70,20},{76,-20}},
2040 lineColor={128,128,128},
2041 fillColor={128,128,128},
2042 fillPattern=FillPattern.Solid)}),
2043 Icon(coordinateSystem(
2044 preserveAspectRatio=false,
2045 extent={{-100,-100},{100,100}},
2046 grid={2,2}), graphics={Rectangle(
2047 extent={{70,30},{80,-30}},
2048 lineColor={135,135,135},
2049 lineThickness=0.5,
2050 fillColor={135,135,135},
2051 fillPattern=FillPattern.Solid)}));
2052 end ImpedYDBase;
2053 annotation ( Window(
2054 x=0.05,
2055 y=0.44,
2056 width=0.31,
2057 height=0.23,
2058 library=1,
2059 autolayout=1));
2060 end Partials;
2061 annotation (preferedView="info",
2062 Window(
2063 x=0.05,
2064 y=0.41,
2065 width=0.4,
2066 height=0.44,
2067 library=1,
2068 autolayout=1),
2069 Documentation(info="<html>
2070<p>Contains lumped impedance models for Y and Delta topology.</p>
2071<p>General relations see 'Impedances'.</p>
2072<p>All elements allow the choice between Y- and Delta-topology.<br>
2073The impedance parameters are defined 'as seen from the terminals', directly relating terminal voltage and terminal current. With this definition same parameters lead to same network properties, independent of topology. The necessary scaling is performed automatically.</p>
2074<p>In Delta-topology the conductor voltage is sqrt(3) higher, the current sqrt(3) lower,
2075compared to the terminal voltage and current. Therefore the impedance relating conductor current and voltage is a factor 3 larger, the admittance a factor 1/3 smaller than the impedance and admittance as seen from the terminal.</p>
2076<p>If impedance parameters are known for the WINDINGS, choose:</p>
2077<pre> input values impedance parameters = (winding values of impedance parameters)/3</pre>
2078<p>In dqo-representation the following relations hold between<br>
2079terminal-voltage term.v and -current term.i on the one hand<br>
2080and conductor-voltage v and -current i on the other:</p>
2081<p><b>Y-topology</b>:</p>
2082<pre>
2083 v = term.v - {0, 0, sqrt(3)*v_n}: voltage between terminal and neutral point
2084 term.i = i
2085 i_n = sqrt(3)*term.i[3]
2086</pre>
2087<p><b>Delta-topology</b>:</p>
2088<pre>
2089 v[1:2] = sqrt(3)*R30*term.v[1:2]: voltage between phase-terminals
2090 v[3] = 0
2091 term.i[1:2] = sqrt(3)*transpose(R30)*i[1:2]
2092 term.i[3] = 0
2093</pre>
2094<p>with <tt>R30 = rotation_30deg</tt><br>
2095(Alternative solutions corresponding to permuted phases are <tt>R-90</tt> and <tt>R150</tt> instead of <tt>R30</tt>).</p>
2096</html>"),
2097 Icon(coordinateSystem(
2098 preserveAspectRatio=false,
2099 extent={{-100,-100},{100,100}},
2100 grid={2,2}), graphics));
2101 end ImpedancesYD;
2102
2103 package Nodes "Nodes and adaptors"
2104 extends Modelica.Icons.VariantsPackage;
2105
2106 model GroundOne "Ground, one conductor"
2107
2108 Interfaces.Electric_p term "positive scalar terminal"
2109 annotation (Placement(transformation(extent={{
2110 -110,-10},{-90,10}}, rotation=0)));
2111
2112 equation
2113 term.v = 0;
2114 annotation (
2115 defaultComponentName="grd1",
2116 Window(
2117 x=0.45,
2118 y=0.01,
2119 width=0.44,
2120 height=0.65),
2121 Documentation(
2122 info="<html>
2123<p>Zero voltage on terminal.</p>
2124</html>
2125"), Icon(coordinateSystem(
2126 preserveAspectRatio=false,
2127 extent={{-100,-100},{100,100}},
2128 grid={2,2}), graphics={
2129 Text(
2130 extent={{-100,-90},{100,-130}},
2131 lineColor={0,0,0},
2132 textString=
2133 "%name"),
2134 Rectangle(
2135 extent={{-4,50},{4,-50}},
2136 lineColor={128,128,128},
2137 fillColor={160,160,164},
2138 fillPattern=FillPattern.Solid),
2139 Line(points={{-90,0},{-4,0}}, color={0,0,255})}),
2140 Diagram(coordinateSystem(
2141 preserveAspectRatio=false,
2142 extent={{-100,-100},{100,100}},
2143 grid={2,2}), graphics={Line(points={{-60,0},{-80,0}}, color={0,0,255}),
2144 Rectangle(
2145 extent={{-60,20},{-54,-20}},
2146 lineColor={128,128,128},
2147 fillColor={160,160,164},
2148 fillPattern=FillPattern.Solid)}));
2149 end GroundOne;
2150 annotation (preferedView="info",
2151 Window(
2152 x=0.05,
2153 y=0.41,
2154 width=0.4,
2155 height=0.32,
2156 library=1,
2157 autolayout=1),
2158 Documentation(info="<html>
2159</html>
2160"), Icon(coordinateSystem(
2161 preserveAspectRatio=false,
2162 extent={{-100,-100},{100,100}},
2163 grid={2,2}), graphics));
2164 end Nodes;
2165
2166 package Transformers "Transformers 3-phase"
2167 extends Modelica.Icons.VariantsPackage;
2168
2169 model TrafoStray "Ideal magnetic coupling transformer, 3-phase dqo"
2170 extends Partials.TrafoStrayBase;
2171
2172 initial equation
2173 if steadyIni_t then
2174 der(i1) = omega[1]*j_dqo(i1);
2175 end if;
2176
2177 equation
2178 i1 + i2 = zeros(3);
2179 if system.transientSim then
2180 diagonal({sum(L),sum(L),sum(L0)})*der(i1) + omega[2]*sum(L)*j_dqo(i1) + sum(R)
2181 *i1 = v1 - v2;
2182 else
2183 omega[2]*sum(L)*j_dqo(i1) + sum(R)*i1 = v1 - v2;
2184 end if;
2185 annotation (
2186 defaultComponentName="trafo",
2187 Window(
2188 x=0.45,
2189 y=0.01,
2190 width=0.44,
2191 height=0.65),
2192 Documentation(
2193 info="<html>
2194<p>Stray-impedance, but ideal magnetic coupling, i.e. zero magnetisation current.<br>
2195Delta topology: impedance is defined as winding-impedance (see info package Transformers).</p>
2196<p>SI-input: values for stray and coupling impedances are winding dependent.</p>
2197<pre>
2198 r[k] = R[k]
2199 x[k] = omega_nom*L[k]
2200 x0[k] = omega_nom*L0[k]
2201</pre>
2202<p>pu-input: values for stray and coupling impedances are <b>winding</b>-reduced to primary side.</p>
2203<pre>
2204 r[k] = R[k]/R_nom[k]
2205 x[k] = omega_nom*L[k]/R_nom[k]
2206 x0[k] = omega_nom*L0[k]/R_nom[k]
2207</pre>
2208<p>with</p>
2209<pre> R_nom[k] = V_nom[k]^2/S_nom, k = 1(primary), 2(secondary)</pre>
2210</html>"),
2211 Icon(coordinateSystem(
2212 preserveAspectRatio=false,
2213 extent={{-100,-100},{100,100}},
2214 grid={2,2}), graphics),
2215 Diagram(coordinateSystem(
2216 preserveAspectRatio=false,
2217 extent={{-100,-100},{100,100}},
2218 grid={2,2}), graphics));
2219 end TrafoStray;
2220
2221 package Partials "Partial models"
2222 extends Modelica.Icons.BasesPackage;
2223
2224 partial model TrafoIdealBase
2225 "Base for ideal transformer, 3-phase dqo"
2226
2227 /*
2228 extends Ports.YDportTrafo_p_n(
2229 w1(start=w1_set), w2(start=w2_set),
2230 final term_p(v(start={cos(system.alpha0),sin(system.alpha0),0}*par.V_nom[1])),
2231 final term_n(v(start={cos(system.alpha0),sin(system.alpha0),0}*par.V_nom[2])));
2232
2233 Start values not correct since no parameter expressions;
2234 Can be removed without having an effect on the model since
2235 if dynTC=true, w1,w2 are initialized in the initial equation section and
2236 otherwise, there is an algebraic equation for w1 and w2.
2237 */
2238 extends Ports.YDportTrafo_p_n(
2239 final term_p(v(start={cos(system.alpha0),sin(system.alpha0),0}*par.V_nom[1])),
2240 final term_n(v(start={cos(system.alpha0),sin(system.alpha0),0}*par.V_nom[2])));
2241
2242 parameter Boolean stIni_en=true
2243 "enable steady-state initial equation" annotation(evaluate=true, choices(__Dymola_checkBox=true));
2244 parameter Boolean dynTC=false "enable dynamic tap-changing" annotation(evaluate=true, choices(__Dymola_checkBox=true));
2245
2246 parameter Boolean use_tap_p = false
2247 "= true, if input tap_p is enabled"
2248 annotation(evaluate=true, choices(__Dymola_checkBox=true));
2249 parameter Boolean use_tap_n = false
2250 "= true, if input tap_n is enabled"
2251 annotation(evaluate=true, choices(__Dymola_checkBox=true));
2252
2253 Modelica.Blocks.Interfaces.IntegerInput tap_p if use_tap_p
2254 "1: index of voltage level"
2255 annotation (Placement(transformation(
2256 origin={-40,100},
2257 extent={{-10,-10},{10,10}},
2258 rotation=270)));
2259 Modelica.Blocks.Interfaces.IntegerInput tap_n if use_tap_n
2260 "2: index of voltage level"
2261 annotation (Placement(transformation(
2262 origin={40,100},
2263 extent={{-10,-10},{10,10}},
2264 rotation=270)));
2265
2266 replaceable parameter Parameters.TrafoIdeal par
2267 constrainedby Parameters.TrafoIdeal "trafo parameter"
2268 annotation (Placement(transformation(extent={
2269 {-80,60},{-60,80}}, rotation=0)));
2270 protected
2271 Modelica.Blocks.Interfaces.IntegerInput tap_p_internal
2272 "Needed to connect to conditional connector";
2273 Modelica.Blocks.Interfaces.IntegerInput tap_n_internal
2274 "Needed to connect to conditional connector";
2275
2276 outer System system;
2277 constant Real tc=0.01 "time constant tap-chg switching";
2278 final parameter Boolean steadyIni_t=system.steadyIni_t and stIni_en;
2279 final parameter SI.Voltage[2] V_base=Basic.Precalculation.baseTrafoV(par.puUnits, par.V_nom);
2280 final parameter SI.Resistance[2, 2] RL_base=Basic.Precalculation.baseTrafoRL(par.puUnits, par.V_nom, par.S_nom, 2*pi*par.f_nom);
2281 final parameter Real W_nom=par.V_nom[2]/par.V_nom[1]
2282 annotation(Evaluate=true);
2283 final parameter Real[:] W1=cat(1, {1}, par.v_tc1*V_base[1]/par.V_nom[1])*sqrt(scale[1])
2284 annotation(evaluate=true);
2285 final parameter Real[:] W2=cat(1, {1}, par.v_tc2*V_base[2]/par.V_nom[2])*W_nom*sqrt(scale[2])
2286 annotation(evaluate=true);
2287 final parameter SI.Resistance R_n1=par.r_n1*RL_base[1,1];
2288 final parameter SI.Resistance R_n2=par.r_n2*RL_base[2,1];
2289 SI.AngularFrequency[2] omega;
2290 Real w1_set=if not use_tap_p then W1[1] else W1[1 + tap_p_internal]
2291 "1: set voltage ratio to nominal primary";
2292 Real w2_set=if not use_tap_n then W2[1] else W2[1 + tap_n_internal]
2293 "2: set voltage ratio to nominal secondary";
2294
2295 initial equation
2296 if dynTC then
2297 w1 = w1_set;
2298 w2 = w2_set;
2299 end if;
2300
2301 equation
2302 connect(tap_p, tap_p_internal);
2303 connect(tap_n, tap_n_internal);
2304 if not use_tap_p then
2305 tap_p_internal = 0;
2306 end if;
2307 if not use_tap_n then
2308 tap_n_internal = 0;
2309 end if;
2310
2311 omega = der(term_p.theta);
2312 if system.transientSim and dynTC then
2313 der(w1) + (w1 - w1_set)/tc = 0;
2314 der(w2) + (w2 - w2_set)/tc = 0;
2315 else
2316 w1 = w1_set;
2317 w2 = w2_set;
2318 end if;
2319
2320 v_n1 = R_n1*i_n1
2321 "1: equation neutral to ground (relevant if Y-topology)";
2322 v_n2 = R_n2*i_n2
2323 "2: equation neutral to ground (relevant if Y-topology)";
2324 annotation (
2325 Window(
2326 x=0.45,
2327 y=0.01,
2328 width=0.44,
2329 height=0.65),
2330 Icon(coordinateSystem(
2331 preserveAspectRatio=false,
2332 extent={{-100,-100},{100,100}},
2333 grid={2,2}), graphics={
2334 Ellipse(
2335 extent={{-80,60},{40,-60}},
2336 lineColor={44,0,255},
2337 fillColor={255,255,255},
2338 fillPattern=FillPattern.Solid),
2339 Ellipse(
2340 extent={{-40,60},{80,-60}},
2341 lineColor={0,120,120},
2342 lineThickness=0.5,
2343 fillColor={255,255,255},
2344 fillPattern=FillPattern.Solid),
2345 Ellipse(
2346 extent={{-80,60},{40,-60}},
2347 lineColor={0,120,120},
2348 lineThickness=0.5),
2349 Text(
2350 extent={{-120,80},{-80,40}},
2351 lineColor={0,0,0},
2352 textString="1"),
2353 Text(
2354 extent={{80,80},{120,40}},
2355 lineColor={0,0,0},
2356 textString="2"),
2357 Line(
2358 points={{-80,0},{-40,0}},
2359 color={176,0,0},
2360 thickness=0.5),
2361 Line(
2362 points={{40,0},{80,0}},
2363 color={176,0,0},
2364 thickness=0.5)}),
2365 Diagram(coordinateSystem(
2366 preserveAspectRatio=false,
2367 extent={{-100,-100},{100,100}},
2368 grid={2,2}), graphics={
2369 Rectangle(
2370 extent={{-20,60},{-14,-60}},
2371 lineColor={128,128,128},
2372 fillColor={128,128,128},
2373 fillPattern=FillPattern.Solid),
2374 Rectangle(
2375 extent={{14,60},{20,-60}},
2376 lineColor={128,128,128},
2377 fillColor={128,128,128},
2378 fillPattern=FillPattern.Solid),
2379 Line(points={{-40,0},{-40,-80}}, color={0,0,255}),
2380 Line(points={{40,0},{40,-80}}, color={0,0,255}),
2381 Rectangle(
2382 extent={{-50,-80},{-30,-84}},
2383 lineColor={128,128,128},
2384 fillColor={128,128,128},
2385 fillPattern=FillPattern.Solid),
2386 Rectangle(
2387 extent={{30,-80},{50,-84}},
2388 lineColor={128,128,128},
2389 fillColor={128,128,128},
2390 fillPattern=FillPattern.Solid)}),
2391 Documentation(
2392 info="<html>
2393<p>Terminology (formal, the models are symmetric).<br>
2394&nbsp; - index 1 (term_p) \"primary\"<br>
2395&nbsp; - index 2 (term_n) \"secondary\"</p>
2396<p>Contains choice of topology (Delta or Y connection primary and secondary).<br>
2397Note that transformers with topology 'Delta-Y' and 'Y-Delta' exhibit a phase-shift
2398of the voltage signals Delta-side versus the signals Y-side of -30 deg.<br>
2399&nbsp; Delta (prim) - Y (sec): Y is 30 deg shifted versus Delta<br>
2400&nbsp; Y (prim) - Delta (sec): Delta is -30 deg shifted versus Y<br>
2401&nbsp; Setting the parameter <tt>sh = +-1</tt> shifts the secondary side by <tt>+-120 deg</tt>.</p>
2402<p>Transformer ratio.<br>
2403The winding ratio is determined indirectly by the choice of nominal voltages and the topology of both primary and secondary side.<br>
2404It may be &gt 1 or &lt 1.</p>
2405<p>Tap changers.<br>
2406For constant transformer ratio no tap changer input needed.<br>
2407For variable transformer ratio tap changer input needed.</p>
2408<p>The sequence of the parameters</p>
2409<pre> v_tc tc voltage levels v_tc[1], v_tc[2], v_tc[3], ...</pre>
2410<p>must be defined in accordance with the input-signals of </p>
2411<pre> tap index of tap voltage levels, v_tc[tap]</pre>
2412<p>Set <tt>dynTC = true</tt> if tap-index changes during simulation.</p>
2413</html>"));
2414 end TrafoIdealBase;
2415
2416 partial model TrafoStrayBase
2417 "Base for ideal magnetic coupling transformer, 3-phase dqo"
2418 extends TrafoIdealBase(redeclare replaceable parameter
2419 PowerSystems.AC3ph.Transformers.Parameters.TrafoStray par)
2420 annotation (extent=[-80,60; -60,80], Placement(transformation(extent={{
2421 -80,60},{-60,80}}, rotation=0)));
2422 protected
2423 final parameter SI.Resistance[2] R=par.r.*RL_base[:, 1];
2424 final parameter SI.Inductance[2] L=par.x.*RL_base[:, 2];
2425 final parameter SI.Inductance[2] L0=par.x0.*RL_base[:, 2];
2426 annotation (
2427 Window(
2428 x=0.45,
2429 y=0.01,
2430 width=0.44,
2431 height=0.65),
2432 Documentation(
2433 info="<html>
2434<p>Precalculation of coefficients for ideal magnetic coupling transformer</p>
2435</html>"), Icon(coordinateSystem(
2436 preserveAspectRatio=false,
2437 extent={{-100,-100},{100,100}},
2438 grid={2,2}), graphics={Rectangle(
2439 extent={{-10,62},{10,-62}},
2440 lineColor={215,215,215},
2441 fillColor={215,215,215},
2442 fillPattern=FillPattern.Solid)}),
2443 Diagram(coordinateSystem(
2444 preserveAspectRatio=false,
2445 extent={{-100,-100},{100,100}},
2446 grid={2,2}), graphics={Rectangle(
2447 extent={{-26,60},{-20,-60}},
2448 lineColor={215,215,215},
2449 fillColor={215,215,215},
2450 fillPattern=FillPattern.Solid), Rectangle(
2451 extent={{20,60},{26,-60}},
2452 lineColor={215,215,215},
2453 fillColor={215,215,215},
2454 fillPattern=FillPattern.Solid)}));
2455 end TrafoStrayBase;
2456 annotation ( Window(
2457 x=0.05,
2458 y=0.44,
2459 width=0.31,
2460 height=0.32,
2461 library=1,
2462 autolayout=1));
2463 end Partials;
2464
2465 package Parameters "Parameter data for interactive use"
2466 extends Modelica.Icons.MaterialPropertiesPackage;
2467
2468 record TrafoIdeal "Parameters for ideal transformer, 3-phase"
2469 parameter SIpu.Voltage[:] v_tc1=fill(1, 0) "1: v-levels tap-changer"
2470 annotation(Dialog(group="Options"));
2471 parameter SIpu.Voltage[:] v_tc2=fill(1, 0) "2: v-levels tap-changer"
2472 annotation(Dialog(group="Options"));
2473 extends Basic.Nominal.NominalDataTrafo;
2474 parameter SIpu.Resistance r_n1=1 "1: resistance neutral to grd (if Y)";
2475 parameter SIpu.Resistance r_n2=1 "2: resistance neutral to grd (if Y)";
2476 annotation (defaultComponentName="data",
2477 Window(
2478 x=0.45,
2479 y=0.01,
2480 width=0.44,
2481 height=0.65),
2482 Documentation(
2483 info="<html>
2484</html>"),
2485 Icon(coordinateSystem(
2486 preserveAspectRatio=false,
2487 extent={{-100,-100},{100,100}},
2488 grid={2,2}), graphics),
2489 Diagram(coordinateSystem(
2490 preserveAspectRatio=false,
2491 extent={{-100,-100},{100,100}},
2492 grid={2,2}), graphics));
2493 end TrafoIdeal;
2494
2495 record TrafoStray
2496 "Parameters for ideal magnetic coupling transformer, 3-phase"
2497 extends TrafoIdeal;
2498 parameter SIpu.Resistance[2] r={0.05,0.05} "{1,2}: resistance";
2499 parameter SIpu.Reactance[2] x={0.05,0.05} "{1,2}: stray reactance";
2500 parameter SIpu.Reactance[2] x0={x[1],x[2]}
2501 "{1,2}: stray reactance zero-comp";
2502
2503 annotation (defaultComponentName="data",
2504 Window(
2505 x=0.45,
2506 y=0.01,
2507 width=0.44,
2508 height=0.65),
2509 Documentation(
2510 info="<html>
2511</html>"),
2512 Icon(coordinateSystem(
2513 preserveAspectRatio=false,
2514 extent={{-100,-100},{100,100}},
2515 grid={2,2}), graphics),
2516 Diagram(coordinateSystem(
2517 preserveAspectRatio=false,
2518 extent={{-100,-100},{100,100}},
2519 grid={2,2}), graphics));
2520 end TrafoStray;
2521 annotation (preferedView="info",
2522 Window(
2523 x=0.05,
2524 y=0.41,
2525 width=0.4,
2526 height=0.38,
2527 library=1,
2528 autolayout=1),
2529 Documentation(info="<html>
2530<p>Records containing parameters of the corresponding components.</p>
2531</html>"),
2532 Icon(coordinateSystem(
2533 preserveAspectRatio=false,
2534 extent={{-100,-100},{100,100}},
2535 grid={2,2}), graphics));
2536 end Parameters;
2537 annotation (preferedView="info",
2538 Window(
2539 x=0.05,
2540 y=0.41,
2541 width=0.4,
2542 height=0.32,
2543 library=1,
2544 autolayout=1),
2545 Documentation(info="<html>
2546<p>Transformer models in different abstraction levels.</p>
2547<p>All transformers allow the choice between Y- and Delta-topology both at primary and secondary side.<br>
2548For Delta an additional phase-shift may be chosen in order to adapt to a given phase-numbering scheme.<br>
2549The impedance parameters are defined 'as seen from the terminals', directly relating terminal voltage and terminal current. With this definition same parameters lead to same network properties, independent of topology. The necessary scaling is performed automatically.</p>
2550<p>In Delta-topology the conductor voltage is sqrt(3) higher, the current sqrt(3) lower,
2551compared to the terminal voltage and current. Therefore the impedance relating conductor current and voltage is a factor 3 larger, the admittance a factor 1/3 smaller than the impedance and admittance as seen from the terminal.</p>
2552<p>If impedance parameters are given for the Deta-connected WINDINGS, choose:</p>
2553<pre> input values impedance parameters = 1/3 * (impedance parameters of windings)</pre>
2554<p>In the dqo-representation the following relations hold between terminal-voltage <tt>v_term</tt> and -current <tt>i_term</tt> on the one hand and conductor-voltage <tt>v_cond</tt> and -current <tt>i_cond</tt> on the other.</p>
2555<p>A) Y-topology.</p>
2556<pre>
2557 v_cond = v_term - {0, 0, sqrt(3)*v_n};
2558 i_term = i_cond;
2559 i_n = sqrt(3)*i_term[3];
2560</pre>
2561<p>where <tt>v_n</tt> denotes the voltage at the neutral point and <tt>i_n</tt> the current neutral to ground.</p>
2562<p>B) Delta-topology.</p>
2563<pre>
2564 v_cond[1:2] = sqrt(3)*R30*v_term[1:2];
2565 i_term[1:2] = sqrt(3)*transpose(R30)*i_cond[1:2];
2566 v_cond[3] = 0;
2567 i_term[3] = 0;
2568</pre>
2569<p>where <tt>R30</tt> denotes a rotation by 30deg in positive sense.<br>
2570(Alternative solutions corresponding to permuted phases are <tt>R-90</tt> and <tt>R150</tt> instead of <tt>R30</tt>).</p>
2571<p>The winding scaled voltage- and current-variables <tt>v</tt> and <tt>i</tt> are related to the corresponding conductor quantities through the relation:
2572<pre>
2573 v = v_cond/w
2574 i = i_cond*w
2575</pre>
2576The equations are written in winding-scaled form.</p>
2577</html>
2578"), Icon(coordinateSystem(
2579 preserveAspectRatio=false,
2580 extent={{-100,-100},{100,100}},
2581 grid={2,2}), graphics));
2582 end Transformers;
2583
2584 package Sensors "Sensors and meters 3-phase"
2585 extends Modelica.Icons.SensorsPackage;
2586
2587 model PVImeter "Power-voltage-current meter, 3-phase dqo"
2588 extends Partials.Meter2Base;
2589
2590 parameter Boolean av=false "time average power" annotation(evaluate=true,Dialog(group="Options"));
2591 parameter SI.Time tcst(min=1e-9)=1 "average time-constant"
2592 annotation(Evaluate=true, Dialog(group="Options",enable=av));
2593
2594 output SIpu.Power[3] p(each stateSelect=StateSelect.never);
2595 output SIpu.Power[3] p_av=pav if av;
2596 output SIpu.Voltage[3] v(each stateSelect=StateSelect.never);
2597 output SIpu.Voltage[2] vpp(each stateSelect=StateSelect.never);
2598 output SIpu.Current[3] i(each stateSelect=StateSelect.never);
2599
2600 output SIpu.Voltage[3] v_abc(each stateSelect=StateSelect.never)=transpose(Park)*v if abc;
2601 output SIpu.Voltage[3] vpp_abc(each stateSelect=StateSelect.never)=
2602 {v_abc[2],v_abc[3],v_abc[1]} - {v_abc[3],v_abc[1],v_abc[2]} if abc;
2603 output SIpu.Current[3] i_abc(each stateSelect=StateSelect.never)=transpose(Park)*i if abc;
2604
2605 output SIpu.Voltage v_norm(stateSelect=StateSelect.never)=sqrt(v*v) if phasor;
2606 output SI.Angle alpha_v(stateSelect=StateSelect.never)=atan2(Rot_dq[:,2]*v[1:2], Rot_dq[:,1]*v[1:2]) if phasor;
2607 output SIpu.Current i_norm(stateSelect=StateSelect.never)=sqrt(i*i) if phasor;
2608 output SI.Angle alpha_i(stateSelect=StateSelect.never)=atan2(Rot_dq[:,2]*i[1:2], Rot_dq[:,1]*i[1:2]) if phasor;
2609 output Real cos_phi(stateSelect=StateSelect.never)=cos(alpha_v - alpha_i) if phasor;
2610 protected
2611 outer System system;
2612 final parameter SI.Voltage V_base=Basic.Precalculation.baseV(puUnits, V_nom);
2613 final parameter SI.Current I_base=Basic.Precalculation.baseI(puUnits, V_nom, S_nom);
2614 SIpu.Power[3] pav;
2615
2616 initial equation
2617 if av then
2618 pav = p;
2619 end if;
2620
2621 equation
2622 v = term_p.v/V_base;
2623 vpp = sqrt(3)*{v[2],-v[1]};
2624 i = term_p.i/I_base;
2625 p = {v[1:2]*i[1:2], -j_dqo(v[1:2])*i[1:2], v[3]*i[3]};
2626 if av then
2627 der(pav) = (p - pav)/tcst;
2628 else
2629 pav = zeros(3);
2630 end if;
2631 annotation (defaultComponentName = "PVImeter1",
2632 Window(
2633 x=0.45,
2634 y=0.01,
2635 width=0.44,
2636 height=0.65),
2637 Icon(coordinateSystem(
2638 preserveAspectRatio=false,
2639 extent={{-100,-100},{100,100}},
2640 grid={2,2}), graphics={
2641 Rectangle(
2642 extent={{-20,24},{20,20}},
2643 lineColor={135,135,135},
2644 fillColor={175,175,175},
2645 fillPattern=FillPattern.Solid),
2646 Ellipse(
2647 extent={{-8,8},{8,-8}},
2648 lineColor={135,135,135},
2649 fillColor={175,175,175},
2650 fillPattern=FillPattern.Solid),
2651 Line(
2652 points={{0,0},{20,0}},
2653 color={0,100,100},
2654 thickness=0.5),
2655 Line(points={{-15,50},{15,64}}, color={135,135,135}),
2656 Line(points={{-15,40},{15,54}}, color={135,135,135}),
2657 Line(points={{-15,30},{15,44}}, color={135,135,135})}),
2658 Documentation(
2659 info="<html>
2660<p>'Meters' are intended as diagnostic instruments. They allow displaying signals in alternative representations, both in SI-units or in 'pu'.<br>
2661As they use time-dependent coordinate transforms, use them only when and where needed. Otherwise use 'Sensors'.</p>
2662<p>Output variables in the chosen reference system:</p>
2663<pre>
2664 p {AC active, AC reactive, DC} power term_p to term_n
2665 v voltage phase-to-ground dqo
2666 vpp voltage phase-to-phase dq
2667 i current dqo, term_p to term_n
2668</pre>
2669<p>Optional output variables:</p>
2670<pre>
2671 p_av power term_p to term_n, time tau average of p
2672 v_abc voltage phase-to-ground, abc-inertial system
2673 vpp_abc voltage phase-to-phase, abc-inertial system
2674 i_abc current term_p to term_n, abc-inertial system
2675 v_norm norm(v)
2676 i_norm norm(i)
2677 alpha_v phase(v)
2678 alpha_i phase(i)
2679 cos_phi cos(alpha_v - alpha_i)
2680</pre>
2681<p><i>Comment on the sign-definition of reactive power see</i> ACdqo.Sensors.</p>
2682</html>
2683"), Diagram(coordinateSystem(
2684 preserveAspectRatio=false,
2685 extent={{-100,-100},{100,100}},
2686 grid={2,2}), graphics));
2687 end PVImeter;
2688
2689 package Partials "Partial models"
2690 extends Modelica.Icons.BasesPackage;
2691
2692 partial model Sensor2Base "Sensor 2 terminal base, 3-phase dqo"
2693 extends Ports.Port_pn;
2694
2695 parameter Integer signalTrsf=0 "signal in which reference frame?"
2696 annotation(Evaluate=true,Dialog(group="Options"), choices(
2697 choice=0 "0: actual ref frame",
2698 choice=1 "1: dqo synchronous",
2699 choice=2 "2: alpha_beta_o",
2700 choice=3 "3: abc inertial"));
2701 protected
2702 function park = Basic.Transforms.park;
2703 function rot_dq = Basic.Transforms.rotation_dq;
2704
2705 equation
2706 term_p.v = term_n.v;
2707 annotation (
2708 Window(
2709 x=0.45,
2710 y=0.01,
2711 width=
2712 0.44,
2713 height=
2714 0.65),
2715 Documentation(
2716 info="<html>
2717</html>"),Icon(coordinateSystem(
2718 preserveAspectRatio=false,
2719 extent={{-100,-100},{100,100}},
2720 grid={2,2}), graphics={
2721 Ellipse(
2722 extent={{-70,70},{70,-70}},
2723 lineColor={255,255,255},
2724 fillColor={255,255,255},
2725 fillPattern=FillPattern.Solid),
2726 Line(points={{0,20},{0,90}}, color={135,135,135}),
2727 Line(
2728 points={{-90,0},{-20,0}},
2729 color={0,100,100},
2730 thickness=0.5),
2731 Line(
2732 points={{0,0},{90,0}},
2733 color={0,100,100},
2734 thickness=0.5),
2735 Line(
2736 points={{30,20},{70,0},{30,-20}},
2737 color={0,100,100},
2738 thickness=0.5),
2739 Ellipse(extent={{-20,20},{20,-20}}, lineColor={135,135,135})}),
2740 Diagram(coordinateSystem(
2741 preserveAspectRatio=false,
2742 extent={{-100,-100},{100,100}},
2743 grid={2,2}), graphics));
2744 end Sensor2Base;
2745
2746 partial model Meter2Base "Meter 2 terminal base, 3-phase dqo"
2747 extends Sensor2Base(final signalTrsf=0);
2748
2749 parameter Boolean abc=false "abc inertial"
2750 annotation(evaluate=true,Dialog(group="Options"));
2751 parameter Boolean phasor=false "phasor" annotation(evaluate=true,Dialog(group="Options"));
2752 extends Basic.Nominal.Nominal;
2753 protected
2754 Real[3,3] Park = park(term_p.theta[2]) if abc;
2755 Real[2,2] Rot_dq = rot_dq(term_p.theta[1]) if phasor;
2756 function atan2 = Modelica.Math.atan2;
2757 annotation (
2758 Window(
2759 x=
2760 0.45, y=
2761 0.01, width=
2762 0.44,
2763 height=
2764 0.65),
2765 Documentation(
2766 info="<html>
2767</html>"), Icon(coordinateSystem(
2768 preserveAspectRatio=false,
2769 extent={{-100,-100},{100,100}},
2770 grid={2,2}), graphics={Ellipse(extent={{-70,70},{70,-70}},
2771 lineColor={135,135,135})}),
2772 Diagram(coordinateSystem(
2773 preserveAspectRatio=false,
2774 extent={{-100,-100},{100,100}},
2775 grid={2,2}), graphics));
2776 end Meter2Base;
2777 annotation ( Window(
2778 x=0.05,
2779 y=0.44,
2780 width=0.31,
2781 height=0.23,
2782 library=1,
2783 autolayout=1));
2784 end Partials;
2785 annotation (preferedView="info",
2786 Window(
2787 x=0.05,
2788 y=0.41,
2789 width=0.4,
2790 height=0.32,
2791 library=1,
2792 autolayout=1),
2793 Documentation(info="<html>
2794<p>Sensors output terminal signals (voltage, current, power) in a defined reference system chosen by the user.</p>
2795<p>Meters allow choosing base-units for output variables.</p>
2796<p><i>Comment on the sign-definition of reactive power:</i></p>
2797<p>From a mathematical point of view, it would be desirable to define power in the following way:
2798<pre>
2799 p_active = v*i
2800 p_reactive = (J*v)*i
2801</pre>
2802<p>with</p>
2803<pre> J = [0,-1,0; 1,0,0; 0,0,0]</pre>
2804<p>the rotation of pi/2 in the positive sense.</p>
2805<p>This definition keeps all coordinate systems positively oriented.
2806The power-vector then can be interpreted as current-vector, normalised by voltage and transformed into a positively oriented coordinate system, whose first axis is given by the voltage vector <tt>v</tt>, and second axis by <tt>J*v</tt>.</p>
2807<p>From a practical point of view it is more convenient to use the inverse sign for reactive power, in order to obtain positive reactive power in the standard-situation of power-transfer
2808across an inductive line.
2809We adapt the sign-definition to this practical convention:</p>
2810<pre> p_reactive = -(J*v)*i</pre>
2811</html>
2812"), Icon(coordinateSystem(
2813 preserveAspectRatio=false,
2814 extent={{-100,-100},{100,100}},
2815 grid={2,2}), graphics));
2816 end Sensors;
2817
2818 package Sources "Voltage and Power Sources"
2819 extends Modelica.Icons.SourcesPackage;
2820
2821 model Voltage "Ideal voltage, 3-phase dqo"
2822 extends Partials.VoltageBase;
2823
2824 parameter SIpu.Voltage v0=1 "voltage" annotation(Dialog(enable=scType_par));
2825 parameter SI.Angle alpha0=0 "phase angle" annotation(Dialog(enable=scType_par));
2826 protected
2827 SI.Voltage V;
2828 SI.Angle alpha;
2829 SI.Angle phi;
2830
2831 equation
2832 if scType_par then
2833 V = v0*V_base;
2834 alpha = alpha0;
2835 else
2836 V = vPhasor_internal[1]*V_base;
2837 alpha = vPhasor_internal[2];
2838 end if;
2839 phi = term.theta[1] + alpha + system.alpha0;
2840 term.v = {V*cos(phi), V*sin(phi), sqrt(3)*neutral.v};
2841 annotation (defaultComponentName = "voltage1",
2842 Window(
2843 x=0.45,
2844 y=0.01,
2845 width=0.44,
2846 height=0.65),
2847 Documentation(
2848 info="<html>
2849<p>Voltage with constant amplitude and phase when 'vType' is 'parameter',<br>
2850with variable amplitude and phase when 'vType' is 'signal'.</p>
2851<p>Optional input:
2852<pre>
2853 omega angular frequency (choose fType == \"sig\")
2854 vPhasor {norm(v), phase(v)}, amplitude(v_abc)=sqrt(2/3)*vPhasor[1]
2855 vPhasor[1] in SI or pu, depending on choice of 'units'
2856 vPhasor[2] in rad
2857</pre></p>
2858</html>
2859"), Icon(coordinateSystem(
2860 preserveAspectRatio=false,
2861 extent={{-100,-100},{100,100}},
2862 grid={2,2}), graphics),
2863 Diagram(coordinateSystem(
2864 preserveAspectRatio=false,
2865 extent={{-100,-100},{100,100}},
2866 grid={2,2}), graphics));
2867 end Voltage;
2868
2869 package Partials "Partial models"
2870 extends Modelica.Icons.BasesPackage;
2871
2872 partial model SourceBase "Voltage base, 3-phase dqo"
2873 extends Ports.Port_n;
2874 extends Basic.Nominal.Nominal;
2875
2876 Interfaces.Electric_p neutral "(use for grounding)"
2877 annotation (Placement(transformation(extent={{-110,-10},{-90,10}},
2878 rotation=0)));
2879 protected
2880 outer System system;
2881 final parameter Real V_base=Basic.Precalculation.baseV(puUnits, V_nom);
2882 SI.Angle theta(stateSelect=StateSelect.prefer) "absolute angle";
2883
2884 equation
2885 Connections.potentialRoot(term.theta);
2886 if Connections.isRoot(term.theta) then
2887 term.theta = if system.synRef then {0, theta} else {theta, 0};
2888 end if;
2889
2890 sqrt(3)*term.i[3] + neutral.i = 0;
2891 annotation (
2892 Window(
2893 x=
2894 0.45, y=
2895 0.01, width=
2896 0.44,
2897 height=
2898 0.65),
2899 Documentation(
2900 info="<html>
2901<p>If the connector 'neutral' remains unconnected, then the source has an isolated neutral point. In all other cases connect 'neutral' to the desired circuit or ground.</p>
2902</html>"), Icon(coordinateSystem(
2903 preserveAspectRatio=false,
2904 extent={{-100,-100},{100,100}},
2905 grid={2,2}), graphics),
2906 Diagram(coordinateSystem(
2907 preserveAspectRatio=false,
2908 extent={{-100,-100},{100,100}},
2909 grid={2,2}), graphics));
2910 end SourceBase;
2911
2912 partial model VoltageBase "Voltage base, 3-phase dqo"
2913 extends SourceBase(final S_nom=1);
2914
2915 parameter Boolean fType_sys = true
2916 "= true, if source has system frequency" annotation(Evaluate=true, choices(__Dymola_checkBox=true));
2917 parameter Boolean fType_par = true
2918 "= true, if source has parameter frequency, otherwise defined by input omega"
2919 annotation(Evaluate=true, Dialog(enable=not fType_sys));
2920 parameter SI.Frequency f=system.f "frequency"
2921 annotation(Dialog(enable=fType_par));
2922
2923 parameter Boolean scType_par = true
2924 "= true: voltage defined by parameter otherwise by input signal"
2925 annotation(Evaluate=true, choices(__Dymola_checkBox=true));
2926
2927 Modelica.Blocks.Interfaces.RealInput omega(final unit="rad/s") if not fType_par
2928 "ang frequency"
2929 annotation (Placement(transformation(
2930 origin={-60,100},
2931 extent={{-10,-10},{10,10}},
2932 rotation=270)));
2933 Modelica.Blocks.Interfaces.RealInput[2] vPhasor if not scType_par
2934 "({abs(voltage), phase})"
2935 annotation (Placement(transformation(
2936 origin={60,100},
2937 extent={{-10,-10},{10,10}},
2938 rotation=270)));
2939 protected
2940 parameter Types.FreqType fType = if fType_sys then Types.FreqType.sys else
2941 if fType_par then Types.FreqType.par else Types.FreqType.sig
2942 "frequency type";
2943 Modelica.Blocks.Interfaces.RealInput omega_internal
2944 "Needed to connect to conditional connector";
2945 Modelica.Blocks.Interfaces.RealInput[2] vPhasor_internal
2946 "Needed to connect to conditional connector";
2947
2948 initial equation
2949 if fType == Types.FreqType.sig then
2950 theta = 0;
2951 end if;
2952
2953 equation
2954 connect(omega, omega_internal);
2955 connect(vPhasor, vPhasor_internal);
2956 if fType <> Types.FreqType.sig then
2957 omega_internal = 0.0;
2958 end if;
2959 if scType_par then
2960 vPhasor_internal = {0,0};
2961 end if;
2962
2963 if fType == Types.FreqType.sys then
2964 theta = system.theta;
2965 elseif fType == Types.FreqType.par then
2966 theta = 2*pi*f*(time - system.initime);
2967 elseif fType == Types.FreqType.sig then
2968 der(theta) = omega_internal;
2969 end if;
2970 annotation (
2971 Window(
2972 x=
2973 0.45, y=
2974 0.01, width=
2975 0.44,
2976 height=
2977 0.65),
2978 Documentation(
2979 info="<html>
2980</html>"), Icon(coordinateSystem(
2981 preserveAspectRatio=false,
2982 extent={{-100,-100},{100,100}},
2983 grid={2,2}), graphics={
2984 Ellipse(
2985 extent={{-70,-70},{70,70}},
2986 lineColor={0,100,100},
2987 lineThickness=0.5,
2988 fillColor={255,255,255},
2989 fillPattern=FillPattern.Solid),
2990 Line(
2991 points={{-70,0},{70,0}},
2992 color={176,0,0},
2993 thickness=0.5),
2994 Text(
2995 extent={{-50,30},{50,-70}},
2996 lineColor={176,0,0},
2997 lineThickness=0.5,
2998 fillColor={127,0,255},
2999 fillPattern=FillPattern.Solid,
3000 textString="~")}),
3001 Diagram(coordinateSystem(
3002 preserveAspectRatio=false,
3003 extent={{-100,-100},{100,100}},
3004 grid={2,2}), graphics));
3005 end VoltageBase;
3006 annotation ( Window(
3007 x=0.05,
3008 y=0.44,
3009 width=0.31,
3010 height=0.23,
3011 library=1,
3012 autolayout=1));
3013 end Partials;
3014 annotation (preferedView="info",
3015 Window(
3016 x=0.05,
3017 y=0.41,
3018 width=0.4,
3019 height=0.32,
3020 library=1,
3021 autolayout=1),
3022 Documentation(info="<html>
3023<p>The sources have optional inputs:</p>
3024<pre>
3025 vPhasor: voltage {norm, phase}
3026 omega: angular frequency
3027 pv: {active power, abs(voltage)} (only PVsource)
3028 p: {active power, rective power} (only PQsource)
3029</pre>
3030<p>To use signal inputs, choose parameters vType=signal and/or fType=signal.</p>
3031<p>General relations between voltage-norms, effective- and peak-values is shown in the table, both
3032relative to each other (pu, norm = 1) and as example (SI, 400 V).</p>
3033<table border=1 cellspacing=0 cellpadding=4>
3034<tr> <th></th> <th></th> <th><b>pu</b></th> <th><b>V</b></th> </tr>
3035<tr><td>Three-phase norm</td><td>|v_abc|</td><td><b>1</b></td><td><b>400</b></td></tr>
3036<tr><td>Single-phase amplitude</td><td>ampl (v_a), ..</td><td>sqrt(2/3)</td> <td>326</td> </tr>
3037<tr><td>Single-phase effective</td><td>eff (v_a), ..</td><td><b>1/sqrt(3)</b></td><td><b>230</b></td></tr>
3038<tr><td>Phase to phase amplitude</td><td>ampl (v_b - v_c), ..</td><td>sqrt(2)</td><td>565</td></tr>
3039<tr><td>Phase to phase effective</td><td>eff (v_b - v_c), ..</td><td><b>1</b></td><td><b>400</b></td></tr>
3040<tr><td>Three-phase norm</td><td>|v_dqo|</td><td><b>1</b></td><td><b>400</b></td> </tr>
3041<tr><td>Phase to phase dq-norm</td><td>|vpp_dq|</td><td>sqrt(2)</td><td>565</td></tr>
3042</table>
3043</html>
3044"), Icon(coordinateSystem(
3045 preserveAspectRatio=false,
3046 extent={{-100,-100},{100,100}},
3047 grid={2,2}), graphics));
3048 end Sources;
3049
3050 package Ports "AC three-phase ports dqo representation"
3051 extends Modelica.Icons.InterfacesPackage;
3052
3053 partial model PortBase "base model adapting Spot to PowerSystems"
3054 function j_dqo = PhaseSystems.ThreePhase_dqo.j;
3055 function jj_dqo = PhaseSystems.ThreePhase_dqo.jj;
3056 end PortBase;
3057
3058 connector ACdqo_p "AC terminal, 3-phase dqo ('positive')"
3059 extends Interfaces.Terminal(redeclare package PhaseSystem =
3060 PhaseSystems.ThreePhase_dqo);
3061 annotation (defaultComponentName = "term_p",
3062 Documentation(info="<html>
3063<p>AC connector with vector variables in dqo-representation, positive.</p>
3064</html>"),Window(
3065 x=0.45,
3066 y=0.01,
3067 width=0.44,
3068 height=0.65),
3069 Icon(coordinateSystem(
3070 preserveAspectRatio=false,
3071 extent={{-100,-100},{100,100}},
3072 grid={2,2}), graphics={Ellipse(
3073 extent={{-100,100},{100,-100}},
3074 lineColor={0,120,120},
3075 fillColor={0,120,120},
3076 fillPattern=FillPattern.Solid), Text(
3077 extent={{-60,60},{60,-60}},
3078 lineColor={255,255,255},
3079 textString="dqo")}),
3080 Diagram(coordinateSystem(
3081 preserveAspectRatio=false,
3082 extent={{-100,-100},{100,100}},
3083 grid={2,2}), graphics={
3084 Ellipse(
3085 extent={{0,50},{100,-50}},
3086 lineColor={0,120,120},
3087 fillColor={0,120,120},
3088 fillPattern=FillPattern.Solid),
3089 Text(
3090 extent={{12,40},{90,-40}},
3091 lineColor={255,255,255},
3092 pattern=LinePattern.None,
3093 textString="dqo"),
3094 Text(
3095 extent={{-120,120},{100,60}},
3096 lineColor={0,120,120},
3097 textString="%name")}));
3098 end ACdqo_p;
3099
3100 connector ACdqo_n "AC terminal, 3-phase dqo ('negative')"
3101 extends Interfaces.Terminal(redeclare package PhaseSystem =
3102 PhaseSystems.ThreePhase_dqo);
3103 annotation (defaultComponentName = "term_n",
3104 Documentation(info="<html>
3105<p>AC connector with vector variables in dqo-representation, negative.</p>
3106</html>"),Window(
3107 x=0.45,
3108 y=0.01,
3109 width=0.44,
3110 height=0.65),
3111 Icon(coordinateSystem(
3112 preserveAspectRatio=false,
3113 extent={{-100,-100},{100,100}},
3114 grid={2,2}), graphics={Ellipse(
3115 extent={{-100,100},{100,-100}},
3116 lineColor={0,120,120},
3117 fillColor={255,255,255},
3118 fillPattern=FillPattern.Solid), Text(
3119 extent={{-60,60},{60,-60}},
3120 lineColor={0,120,120},
3121 textString="dqo")}),
3122 Diagram(coordinateSystem(
3123 preserveAspectRatio=false,
3124 extent={{-100,-100},{100,100}},
3125 grid={2,2}), graphics={
3126 Ellipse(
3127 extent={{-100,50},{0,-50}},
3128 lineColor={0,120,120},
3129 fillColor={255,255,255},
3130 fillPattern=FillPattern.Solid),
3131 Text(
3132 extent={{-90,40},{-10,-40}},
3133 lineColor={0,120,120},
3134 textString="dqo"),
3135 Text(
3136 extent={{-100,120},{120,60}},
3137 lineColor={0,120,120},
3138 fillColor={0,100,100},
3139 fillPattern=FillPattern.Solid,
3140 textString="%name")}));
3141 end ACdqo_n;
3142
3143 partial model Port_p "AC one port 'positive', 3-phase"
3144 extends PortBase;
3145
3146 Ports.ACdqo_p term "positive terminal"
3147 annotation (Placement(transformation(extent={{-110,
3148 -10},{-90,10}}, rotation=0)));
3149 annotation (
3150 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
3151 {100,100}}), graphics={Text(
3152 extent={{-100,-90},{100,-130}},
3153 lineColor={0,0,0},
3154 textString="%name")}),
3155 Documentation(info="<html></html>"),
3156 Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
3157 -100},{100,100}}),
3158 graphics));
3159 end Port_p;
3160
3161 partial model Port_n "AC one port 'negative', 3-phase"
3162 extends PortBase;
3163
3164 Ports.ACdqo_n term "negative terminal"
3165 annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0)));
3166 annotation (
3167 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
3168 {100,100}}), graphics={Text(
3169 extent={{-100,-90},{100,-130}},
3170 lineColor={0,0,0},
3171 textString="%name")}),
3172 Documentation(info="<html></html>"),
3173 Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
3174 -100},{100,100}}),
3175 graphics));
3176 end Port_n;
3177
3178 partial model Port_p_n "AC two port, 3-phase"
3179 extends PortBase;
3180
3181 Ports.ACdqo_p term_p "positive terminal"
3182 annotation (Placement(transformation(extent={{-110,-10},{-90,10}}, rotation=0)));
3183 Ports.ACdqo_n term_n "negative terminal"
3184 annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=0)));
3185 equation
3186 Connections.branch(term_p.theta, term_n.theta);
3187 term_n.theta = term_p.theta;
3188 annotation (
3189 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
3190 graphics={Text(
3191 extent={{-100,-90},{100,-130}},
3192 lineColor={0,0,0},
3193 textString="%name")}),
3194 Documentation(info="<html>
3195</html>"),
3196 Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,
3197 100}}),
3198 graphics));
3199 end Port_p_n;
3200
3201 partial model Port_pn "AC two port 'current_in = current_out', 3-phase"
3202 extends Port_p_n;
3203
3204 equation
3205 term_p.i + term_n.i = zeros(3);
3206 annotation (
3207 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
3208 graphics),
3209 Documentation(info="<html>
3210</html>"),
3211 Diagram(graphics));
3212 end Port_pn;
3213
3214 partial model YDport_p "AC one port Y or Delta topology 'positive'"
3215 extends Port_p;
3216
3217 /*
3218 replaceable Topology.Y top "Y or Delta topology"
3219 annotation ( choices(
3220 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Y top "Y"),
3221 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Delta top "Delta")),
3222 Placement(transformation(extent={{30,-20},{70,20}}, rotation=0)));
3223*/
3224
3225 replaceable Topology.Y top(v_cond=v, i_cond=i, v_n=v_n)
3226 constrainedby Topology.TopologyBase(v_cond=v, i_cond=i, v_n=v_n)
3227 annotation ( choices(
3228 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Y top "Y"),
3229 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Delta top "Delta")),
3230 Placement(transformation(extent={{30,-20},{70,20}}, rotation=0)));
3231
3232 SI.Voltage[3] v "voltage conductor";
3233 SI.Current[3] i "current conductor";
3234 SI.Voltage[n_n] v_n "voltage neutral";
3235 SI.Current[n_n] i_n=top.i_n "current neutral to ground";
3236 protected
3237 final parameter Integer n_n=top.n_n
3238 annotation(evaluate=true);
3239
3240 equation
3241 term.v = top.v_term;
3242 term.i = top.i_term;
3243 annotation (
3244 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
3245 {100,100}}),
3246 graphics),
3247 Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,
3248 -100},{100,100}}),
3249 graphics),
3250 Documentation(info="<html>
3251<p>Defines Y- and Delta-topology transform of voltage and current variables.</p>
3252<p>Definitions</p>
3253<pre>
3254 v: voltage across conductor
3255 i: current through conductor
3256 v_n: voltage neutral point if Y-topology
3257 i_n: current neutral to ground if Y-topology
3258</pre>
3259<p>Relations Y-topology, (<tt>v, i</tt>: terminal to neutral point)</p>
3260<pre>
3261 v = term.v - {0, 0, sqrt(3)*v_n}
3262 term.i = i
3263 i_n = sqrt(3)*term.i[3]
3264</pre>
3265<p>Relations Delta-topology, (<tt>v, i</tt>: phase terminal to phase terminal)</p>
3266<pre>
3267 v[1:2] = sqrt(3)*Rot*term.v[1:2]
3268 v[3] = 0
3269 term.i[1:2] = sqrt(3)*transpose(Rot)*i[1:2]
3270 term.i[3] = 0
3271 with Rot = rotation_30deg
3272</pre>
3273</html>
3274"));
3275 end YDport_p;
3276
3277 partial model YDportTrafo_p_n
3278 "AC two port with Y or Delta topology for transformers"
3279 extends Port_p_n;
3280
3281 replaceable Topology.Y top_p(v_cond=v1*w1, i_cond=i1/w1, v_n=v_n1)
3282 constrainedby Topology.TopologyBase(v_cond=v1*w1, i_cond=i1/w1, v_n=v_n1)
3283 "p: Y or Delta topology"
3284 annotation ( choices(
3285 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Y top_p "Y"),
3286 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Delta top_p "Delta")),
3287 Placement(transformation(extent={{-80,-20},{-40,20}}, rotation=0)));
3288
3289 replaceable Topology.Y top_n(v_cond=v2*w2, i_cond=i2/w2, v_n=v_n2)
3290 constrainedby Topology.TopologyBase(v_cond=v2*w2, i_cond=i2/w2, v_n=v_n2)
3291 "n: Y or Delta topology"
3292 annotation ( choices(
3293 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Y top_n "Y"),
3294 choice(redeclare PowerSystems.AC3ph.Ports.Topology.Delta top_n "Delta")),
3295 Placement(transformation(extent={{80,-20},{40,20}}, rotation=0)));
3296
3297 SI.Voltage[3] v1 "voltage conductor";
3298 SI.Current[3] i1 "current conductor";
3299 SI.Voltage[n_n1] v_n1 "voltage neutral";
3300 SI.Current[n_n1] i_n1=top_p.i_n "current neutral to ground";
3301
3302 SI.Voltage[3] v2 "voltage conductor";
3303 SI.Current[3] i2 "current conductor";
3304 SI.Voltage[n_n2] v_n2 "voltage neutral";
3305 SI.Current[n_n2] i_n2=top_n.i_n "current neutral to ground";
3306
3307 protected
3308 constant Integer[2] scale={top_p.scale, top_n.scale};
3309 final parameter Integer n_n1=top_p.n_n
3310 annotation(evaluate=true);
3311 final parameter Integer n_n2=top_n.n_n
3312 annotation(evaluate=true);
3313 Real w1 "1: voltage ratio to nominal";
3314 Real w2 "2: voltage ratio to nominal";
3315
3316 equation
3317 term_p.v = top_p.v_term;
3318 term_p.i = top_p.i_term;
3319 term_n.v = top_n.v_term;
3320 term_n.i = top_n.i_term;
3321 annotation (
3322 Icon(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,100}}),
3323 graphics),
3324 Documentation(info="<html>
3325<p>Defines Y- and Delta-topology transform of voltage and current variables and contains additionally voltage and current scaling.</p>
3326<p>Below</p>
3327<pre> term, v, i, w</pre>
3328<p>denote either the 'primary' or 'secondary' side</p>
3329<pre>
3330 term_p, v1, i1, w1
3331 term_n, v2, i2, w2
3332</pre>
3333<p>Definitions</p>
3334<pre>
3335 v: scaled voltage across conductor
3336 i: scaled current through conductor
3337 v_n: voltage neutral point if Y-topology
3338 i_n: current neutral to ground if Y-topology
3339 w: voltage ratio to nominal (any value, but common for primary and secondary)
3340</pre>
3341<p>Relations Y-topology, (<tt>v, i</tt>: terminal to neutral point)</p>
3342<pre>
3343 v = (term.v - {0, 0, sqrt(3)*v_n})/w
3344 term.i = i/w
3345 i_n = sqrt(3)*term.i[3]
3346</pre>
3347<p>Relations Delta-topology, (<tt>v, i</tt>: phase terminal to phase terminal)</p>
3348<pre>
3349 v[1:2] = sqrt(3)*Rot*term.v[1:2]/w
3350 v[3] = 0
3351 term.i[1:2] = sqrt(3)*transpose(Rot)*i[1:2]/w
3352 term.i[3] = 0
3353 with Rot = rotation_30deg
3354</pre>
3355</html>
3356"), Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},{100,
3357 100}}),
3358 graphics));
3359 end YDportTrafo_p_n;
3360
3361 package Topology "Topology transforms "
3362 extends Modelica.Icons.BasesPackage;
3363
3364 partial model TopologyBase "Topology transform base"
3365
3366 parameter Integer n_n(min=0,max=1)=1 "1 for Y, 0 for Delta";
3367 parameter Integer sh(min=-1,max=1)=0 "(-1,0,+1)*120deg phase shift"
3368 annotation(Evaluate=true);
3369 SI.Voltage[3] v_term "terminal voltage";
3370 SI.Current[3] i_term "terminal current";
3371 input SI.Voltage[3] v_cond "conductor voltage";
3372 input SI.Current[3] i_cond "conductor current";
3373 input SI.Voltage[n_n] v_n(start=fill(0,n_n)) "voltage neutral";
3374 SI.Current[n_n] i_n(start=fill(0,n_n)) "current neutral to ground";
3375 protected
3376 constant Real s3=sqrt(3);
3377 annotation (
3378 defaultComponentName="Y",
3379 Window(
3380 x=0.45,
3381 y=0.01,
3382 width=0.44,
3383 height=0.65),
3384 Documentation(
3385 info="<html>
3386</html>
3387 "), Icon(coordinateSystem(
3388 preserveAspectRatio=false,
3389 extent={{-100,-100},{100,100}},
3390 grid={2,2}), graphics={Rectangle(
3391 extent={{-100,100},{100,-100}},
3392 lineColor={255,255,255},
3393 fillColor={255,255,255},
3394 fillPattern=FillPattern.Solid), Text(
3395 extent={{-100,-90},{100,-130}},
3396 lineColor={0,0,0},
3397 textString="%name")}),
3398 Diagram(coordinateSystem(
3399 preserveAspectRatio=false,
3400 extent={{-100,-100},{100,100}},
3401 grid={2,2}), graphics));
3402 end TopologyBase;
3403
3404 model Y "Y transform"
3405 extends TopologyBase(final n_n=1, final sh=0);
3406
3407 constant Integer scale=1 "for scaling of impedance values";
3408
3409 equation
3410 v_cond = v_term - {0, 0, s3*v_n[1]};
3411 i_term = i_cond;
3412 i_n[1] = s3*i_term[3];
3413 annotation (defaultComponentName="Y",
3414 Window(
3415 x=0.45,
3416 y=0.01,
3417 width=0.44,
3418 height=0.65),
3419 Documentation(
3420 info="<html>
3421<p><b>Structurally incomplete model</b>. Use only as component within appropriate complete model.<br>
3422Defines Y-topology transform of voltage and current variables.</p>
3423<p>Definitions</p>
3424<pre>
3425 v_term, i_term: terminal voltage and current
3426 v_cond, i_cond: voltage and current across conductor, (terminal to neutral point)
3427</pre>
3428<p>Relations, zero-component and neutral point (grounding)</p>
3429<pre>
3430 v_cond = v_term - {0, 0, sqrt(3)*v_n}
3431 i_term = i_cond
3432 i_n = sqrt(3)*i_term[3]
3433</pre>
3434<p>Note: parameter sh (phase shift) not used.</p>
3435</html>"),
3436 Icon(coordinateSystem(
3437 preserveAspectRatio=false,
3438 extent={{-100,-100},{100,100}},
3439 grid={2,2}), graphics={
3440 Line(
3441 points={{-60,0},{60,0}},
3442 color={255,0,0},
3443 thickness=0.5),
3444 Line(points={{60,0},{100,0}}, color={0,0,255}),
3445 Line(
3446 points={{-60,80},{10,80},{60,0},{10,-80},{-60,-80}},
3447 color={255,0,0},
3448 thickness=0.5),
3449 Line(points={{-100,80},{-60,80}}, color={0,0,255}),
3450 Line(points={{-100,0},{-60,0}}, color={0,0,255}),
3451 Line(points={{-100,-80},{-60,-80}}, color={0,0,255})}),
3452 Diagram(coordinateSystem(
3453 preserveAspectRatio=false,
3454 extent={{-100,-100},{100,100}},
3455 grid={2,2}), graphics={
3456 Line(points={{-88,80},{-60,80}}, color={0,0,255}),
3457 Line(points={{-90,0},{-60,0}}, color={0,0,255}),
3458 Line(points={{-90,-80},{-60,-80}}, color={0,0,255}),
3459 Line(
3460 points={{-60,80},{10,80},{60,0},{10,-80},{-60,-80}},
3461 color={255,0,0},
3462 thickness=0.5),
3463 Line(
3464 points={{-60,0},{60,0}},
3465 color={255,0,0},
3466 thickness=0.5),
3467 Line(points={{60,0},{90,0}}, color={0,0,255})}));
3468 end Y;
3469
3470 model Delta "Delta transform"
3471 extends TopologyBase(final n_n=0);
3472
3473 constant Integer scale=3 "for scaling of impedance values";
3474 protected
3475 final parameter Real[2,2] Rot=Basic.Transforms.rotation_dq(
3476 (1-4*sh)*pi/6);
3477
3478 equation
3479 v_cond[1:2] = s3*Rot*v_term[1:2];
3480 v_cond[3] = 0;
3481 i_term[1:2] = s3*transpose(Rot)*i_cond[1:2];
3482 i_term[3] = 0;
3483 annotation (structurallyIncomplete=true,defaultComponentName="Delta",
3484 Window(
3485 x=0.45,
3486 y=0.01,
3487 width=
3488 0.44,
3489 height=
3490 0.65),
3491 Documentation(
3492 info="<html>
3493<p><b>Structurally incomplete model</b>. Use only as component within appropriate complete model.<br>
3494Defines Delta-topology transform of voltage and current variables.</p>
3495<p>Definitions</p>
3496<pre>
3497 v_term, i_term: terminal voltage and current
3498 v_cond, i_cond: voltage and current across conductor, (phase terminal to phase terminal)
3499</pre>
3500<p>Relations, zero-component<br>
3501<tt>v_n</tt> and <tt>i_n</tt> are not defined, as there is no neutral point.</p>
3502<pre>
3503 v_cond[1:2] = sqrt(3)*Rot*v_term[1:2];
3504 v_cond[3] = 0
3505 i_term[1:2] = sqrt(3)*transpose(Rot)*i_cond[1:2];
3506 i_term[3] = 0
3507</pre>
3508<p>with <tt>Rot = rotation_30deg</tt></p>
3509</html>
3510"), Icon(coordinateSystem(
3511 preserveAspectRatio=false,
3512 extent={{-100,-100},{100,100}},
3513 grid={2,2}), graphics={
3514 Line(points={{-100,80},{80,80}}, color={0,0,255}),
3515 Line(points={{-100,0},{-60,0}}, color={0,0,255}),
3516 Line(points={{-100,-80},{80,-80}}, color={0,0,255}),
3517 Polygon(
3518 points={{-60,0},{80,80},{80,-80},{-60,0}},
3519 lineColor={255,0,0},
3520 lineThickness=0.5)}),
3521 Diagram(coordinateSystem(
3522 preserveAspectRatio=false,
3523 extent={{-100,-100},{100,100}},
3524 grid={2,2}), graphics={
3525 Line(points={{-90,80},{80,80}}, color={0,0,255}),
3526 Line(points={{-90,0},{-60,0}}, color={0,0,255}),
3527 Line(points={{-90,-80},{80,-80}}, color={0,0,255}),
3528 Polygon(
3529 points={{-60,0},{80,80},{80,-80},{-60,0}},
3530 lineColor={255,0,0},
3531 lineThickness=0.5)}));
3532 end Delta;
3533 annotation (preferedView="info",
3534 Window(
3535 x=0.05,
3536 y=0.41,
3537 width=0.4,
3538 height=0.32,
3539 library=1,
3540 autolayout=1),
3541 Documentation(info="<HTML>
3542<p>
3543Contains transforms for Y and Delta topology dqo.
3544</p>
3545</HTML>"),
3546 Icon(coordinateSystem(
3547 preserveAspectRatio=false,
3548 extent={{-100,-100},{100,100}},
3549 grid={2,2}), graphics));
3550 end Topology;
3551 annotation (preferedView="info",
3552 Window(
3553 x=0.05,
3554 y=0.03,
3555 width=0.4,
3556 height=0.38,
3557 library=1,
3558 autolayout=1),
3559 Documentation(info="<html>
3560<p>Electrical ports with connectors ACdqo:</p>
3561<p>The index notation <tt>_p_n</tt> and <tt>_pn</tt> is used for</p>
3562<pre>
3563 _p_n: no conservation of current
3564 _pn: with conservation of current
3565</pre>
3566</html>
3567"), Icon(coordinateSystem(
3568 preserveAspectRatio=false,
3569 extent={{-100,-100},{100,100}},
3570 grid={2,2}), graphics));
3571 end Ports;
3572 end AC3ph;
3573
3574 package Blocks "Blocks"
3575 extends Modelica.Icons.Package;
3576
3577 package Signals "Special signals"
3578 extends Modelica.Icons.VariantsPackage;
3579
3580 block TransientPhasor "Transient {norm, phase} of vector"
3581 extends Partials.MO(final n=2);
3582
3583 parameter SI.Time t_change=0.5 "time when change";
3584 parameter SI.Time t_duration=1 "transition duration";
3585 parameter Real a_ini=1 "initial norm |y|";
3586 parameter Real a_fin=1 "final norm |y|";
3587 parameter SI.Angle ph_ini=0 "initial phase (y)";
3588 parameter SI.Angle ph_fin=0 "final phase (y)";
3589 protected
3590 final parameter SI.Frequency coef=2*exp(1)/t_duration;
3591
3592 equation
3593 y = 0.5*({a_fin+a_ini, ph_fin+ph_ini} + {a_fin-a_ini, ph_fin-ph_ini}*tanh(coef*(time - t_change)));
3594 annotation (defaultComponentName = "transPh1",
3595 Window(
3596 x=0.45,
3597 y=0.01,
3598 width=0.44,
3599 height=0.65),
3600 Documentation(
3601 info="<html>
3602<p>The signal is a two-dimensional vector in polar representation.<br>
3603Norm and phase change from <tt>{a_ini, ph_ini}</tt> to <tt>{a_fin, ph_fin}</tt><br>
3604at time <tt>t_change</tt> with a transition duration <tt>t_duration</tt>.<br><br>
3605The transition function is a hyperbolic tangent for both norm and phase.</p>
3606</html>
3607"), Icon(coordinateSystem(
3608 preserveAspectRatio=false,
3609 extent={{-100,-100},{100,100}},
3610 grid={2,2}), graphics={
3611 Text(
3612 extent={{-100,100},{100,60}},
3613 lineColor={175,175,175},
3614 textString=
3615 "phasor"),
3616 Text(
3617 extent={{-110,-10},{10,-50}},
3618 lineColor={160,160,164},
3619 textString=
3620 "ini"),
3621 Text(
3622 extent={{-10,50},{110,10}},
3623 lineColor={160,160,164},
3624 textString=
3625 "fin"),
3626 Line(points={{-80,-60},{-64,-60},{-44,-58},{-34,-54},{-26,-48},{-20,
3627 -40},{-14,-30},{-8,-18},{-2,-6},{2,4},{8,18},{14,30},{20,40},{
3628 26,48},{34,54},{44,58},{64,60},{80,60}}, color={95,0,191})}),
3629 Diagram(coordinateSystem(
3630 preserveAspectRatio=false,
3631 extent={{-100,-100},{100,100}},
3632 grid={2,2}), graphics));
3633 end TransientPhasor;
3634 annotation (preferedView="info",
3635 Window(
3636 x=0.05,
3637 y=0.41,
3638 width=0.4,
3639 height=0.38,
3640 library=1,
3641 autolayout=1),
3642 Documentation(info="<html>
3643</html>"),
3644 Icon(coordinateSystem(
3645 preserveAspectRatio=false,
3646 extent={{-100,-100},{100,100}},
3647 grid={2,2}), graphics));
3648 end Signals;
3649
3650 package Partials "Partial models"
3651 extends Modelica.Icons.BasesPackage;
3652
3653 partial block MO
3654 extends PowerSystems.Basic.Icons.Block0;
3655
3656 Modelica.Blocks.Interfaces.RealOutput[n] y "output signal-vector"
3657 annotation (Placement(transformation(extent={{90,-10},{110,10}}, rotation=
3658 0)));
3659 parameter Integer n=1 "dim of output signal-vector";
3660 annotation (
3661 Icon(coordinateSystem(
3662 preserveAspectRatio=false,
3663 extent={{-100,-100},{100,100}},
3664 grid={2,2}), graphics),
3665 Window(
3666 x=0.55,
3667 y=0.01,
3668 width=0.44,
3669 height=0.65),
3670 Documentation(
3671 info="<html>
3672</html>"),Diagram(coordinateSystem(
3673 preserveAspectRatio=false,
3674 extent={{-100,-100},{100,100}},
3675 grid={2,2}), graphics));
3676 end MO;
3677 annotation (Documentation(info="<html>
3678</html>"));
3679 end Partials;
3680 annotation (preferedView="info",
3681 Window(
3682 x=0.05,
3683 y=0.03,
3684 width=0.4,
3685 height=0.27,
3686 library=1,
3687 autolayout=1),
3688 Documentation(info="<html>
3689<p><a href=\"Spot3.UsersGuide.Overview\">up users guide</a></p>
3690</html>"));
3691 end Blocks;
3692
3693 package Control "Control blocks"
3694 extends Modelica.Icons.Package;
3695
3696 package Relays "Relays"
3697 extends Modelica.Icons.VariantsPackage;
3698
3699 block TapChangerRelay "Relay for setting tap-changer "
3700 extends PowerSystems.Basic.Icons.Block0;
3701
3702 parameter Integer preset_1[:](min=0)={0}
3703 "1: index v-levels tap-chg, 0 is nom";
3704 parameter Integer preset_2[:](min=0)={0}
3705 "2: index v-levels tap-chg, 0 is nom";
3706 parameter SI.Time t_switch_1[:]={1} "1: switching times";
3707 parameter SI.Time t_switch_2[:]={1} "2:switching times";
3708 Modelica.Blocks.Interfaces.IntegerOutput tap_p
3709 "index of voltage level of tap changer 1"
3710 annotation (Placement(transformation(extent={{90,-50},{110,-30}},
3711 rotation=0)));
3712 Modelica.Blocks.Interfaces.IntegerOutput tap_n
3713 "index of voltage level of tap changer 2"
3714 annotation (Placement(transformation(extent={{90,30},{110,50}}, rotation=
3715 0)));
3716 protected
3717 Integer cnt_1(start=1,fixed=true);
3718 Integer cnt_2(start=1,fixed=true);
3719
3720 algorithm
3721 when time > t_switch_1[min(cnt_1, size(t_switch_1, 1))] then
3722 cnt_1 := cnt_1 + 1;
3723 tap_p := preset_1[min(cnt_1, size(preset_1, 1))];
3724 end when;
3725 when time > t_switch_2[min(cnt_2, size(t_switch_2, 1))] then
3726 cnt_2 := cnt_2 + 1;
3727 tap_n := preset_2[min(cnt_2, size(preset_2, 1))];
3728 end when;
3729 annotation (defaultComponentName = "tapRelay1",
3730 Window(
3731 x=0.01,
3732 y=0.01,
3733 width=0.44,
3734 height=0.65),
3735 Documentation(
3736 info="<html>
3737<p>The voltage level indices are pre-selected. They correspond to the index of the tap voltage levels
3738of the transformer model. Level 0 is nominal voltage.</p>
3739<p>The switching times can be chosen arbitrarily.</p>
3740</html>
3741"), Icon(coordinateSystem(
3742 preserveAspectRatio=false,
3743 extent={{-100,-100},{100,100}},
3744 grid={2,2}), graphics={
3745 Text(
3746 extent={{50,50},{70,30}},
3747 lineColor={255,128,0},
3748 textString=
3749 "2"),
3750 Text(
3751 extent={{50,-30},{70,-50}},
3752 lineColor={255,128,0},
3753 textString=
3754 "1"),
3755 Text(
3756 extent={{-80,20},{80,-20}},
3757 lineColor={128,128,128},
3758 textString=
3759 "tap")}),
3760 Diagram(coordinateSystem(
3761 preserveAspectRatio=false,
3762 extent={{-100,-100},{100,100}},
3763 grid={2,2}), graphics));
3764 end TapChangerRelay;
3765 annotation (preferedView="info",
3766 Window(
3767 x=0.05,
3768 y=0.41,
3769 width=0.4,
3770 height=0.38,
3771 library=1,
3772 autolayout=1),
3773 Documentation(info="<html>
3774</html>"),
3775 Icon(coordinateSystem(
3776 preserveAspectRatio=false,
3777 extent={{-100,-100},{100,100}},
3778 grid={2,2}), graphics));
3779 end Relays;
3780 annotation (preferedView="info",
3781 Window(
3782 x=0.05,
3783 y=0.03,
3784 width=0.4,
3785 height=0.27,
3786 library=1,
3787 autolayout=1),
3788 Documentation(info="<html>
3789<p><a href=\"Spot3.UsersGuide.Overview\">up users guide</a></p>
3790</html>
3791"));
3792 end Control;
3793
3794 package Basic "Basic utility classes"
3795 extends Modelica.Icons.BasesPackage;
3796
3797 package Nominal "Units and nominal values"
3798 extends Modelica.Icons.BasesPackage;
3799
3800 partial model Nominal "Units and nominal values"
3801
3802 parameter Boolean puUnits = true
3803 "= true, if scaled with nom. values (pu), else scaled with 1 (SI)"
3804 annotation(Evaluate=true, Dialog(group="Parameter Scaling"));
3805
3806 parameter SI.Voltage V_nom(final min=0)=1
3807 "nominal Voltage (= base for pu)"
3808 annotation(Evaluate=true, Dialog(enable=puUnits, group="Nominal"));
3809
3810 parameter SI.ApparentPower S_nom(final min=0)=1
3811 "nominal Power (= base for pu)"
3812 annotation(Evaluate=true, Dialog(enable=puUnits, group="Nominal"));
3813 annotation (
3814 Window(
3815 x=0.45,
3816 y=0.01,
3817 width=0.44,
3818 height=0.65),
3819 Documentation(info="<html>
3820<p>'Nominal' values that are used to define 'base'-values in the case where input is in 'pu'-units</p>
3821<p>The parameter 'units' allows choosing between SI ('Amp Volt') and pu ('per unit') for input-parameters of components and output-variables of meters.<br>
3822The default setting is 'pu'.</p>
3823<p>pu ('per unit'):</p>
3824<pre>
3825 V_base = V_nom
3826 S_base = S_nom
3827 R_base = V_nom*V_nom/S_nom
3828 I_base = S_nom/V_nom
3829</pre>
3830<p>SI ('Amp Volt'):</p>
3831<pre>
3832 V_base = 1
3833 S_base = 1
3834 R_base = 1
3835 I_base = 1
3836</pre>
3837<p>Note that the choice between SI and pu does <b>not</b> affect state- and connector variables.
3838These remain <b>always</b> in SI-units. It only affects input of parameter values and output variables.</p>
3839</html>
3840"), Icon(coordinateSystem(
3841 preserveAspectRatio=false,
3842 extent={{-100,-100},{100,100}},
3843 grid={2,2}), graphics));
3844 end Nominal;
3845
3846 partial model NominalAC "Units and nominal values AC"
3847 extends Nominal;
3848
3849 parameter SI.Frequency f_nom=system.f_nom "nominal frequency"
3850 annotation(Evaluate=true, Dialog(group="Nominal"), choices(choice=50 "50 Hz", choice=60 "60 Hz"));
3851 protected
3852 outer PowerSystems.System system;
3853 annotation (
3854 Window(
3855 x=0.45,
3856 y=0.01,
3857 width=0.44,
3858 height=0.65),
3859 Documentation(info="<html>
3860<p>Same as 'Nominal', but with additional parameter 'nominal frequency'.</p>
3861</html>
3862"), Icon(coordinateSystem(
3863 preserveAspectRatio=false,
3864 extent={{-100,-100},{100,100}},
3865 grid={2,2}), graphics));
3866 end NominalAC;
3867
3868 record NominalDataTrafo "Units and nominal data transformer"
3869 extends Modelica.Icons.Record;
3870
3871 final parameter Boolean puUnits = true
3872 "= true, if scaled with nom. values (pu), else scaled with 1 (SI)"
3873 annotation(Evaluate=true, Dialog(group="Parameter Scaling"));
3874 parameter SI.Voltage[:] V_nom(final min={0,0})={1,1}
3875 "{prim,sec} nom Voltage (= base of pu)"
3876 annotation(Evaluate=true, Dialog(group="Nominal"));
3877 parameter SI.ApparentPower S_nom(final min=0)=1
3878 "nominal Power (= base of pu)"
3879 annotation(Evaluate=true, Dialog(group="Nominal"));
3880 parameter SI.Frequency f_nom=system.f_nom "nominal frequency"
3881 annotation(Evaluate=true, Dialog(group="Nominal"), choices(choice=50 "50 Hz", choice=60 "60 Hz"));
3882 protected
3883 outer PowerSystems.System system;
3884 annotation (
3885 Window(
3886 x=0.45,
3887 y=0.01,
3888 width=0.44,
3889 height=0.65),
3890 Documentation(info="<html>
3891<p>'Nominal' values for transformers. Same as 'NominalAC, but with two components for voltage: {primary, secondary}. The winding ratio is indirectly defined through the voltage ratio.</p>
3892</html>"), Icon(coordinateSystem(
3893 preserveAspectRatio=false,
3894 extent={{-100,-100},{100,100}},
3895 grid={2,2}), graphics));
3896 end NominalDataTrafo;
3897 annotation (preferedView="info",
3898 Window(
3899 x=0.05,
3900 y=0.41,
3901 width=0.4,
3902 height=0.38,
3903 library=1,
3904 autolayout=1),
3905 Documentation(info="<html>
3906</html>
3907"), Icon(coordinateSystem(
3908 preserveAspectRatio=false,
3909 extent={{-100,-100},{100,100}},
3910 grid={2,2}), graphics));
3911 end Nominal;
3912
3913 package Precalculation "Precalculation functions"
3914 extends Modelica.Icons.Package;
3915
3916 function baseV "Base voltage"
3917 extends PowerSystems.Basic.Icons.Function;
3918
3919 input Boolean puUnits "= true if pu else SI units";
3920 input SI.Voltage V_nom "nom voltage";
3921 output SI.Voltage V_base "base voltage";
3922
3923 algorithm
3924 if puUnits then
3925 V_base := V_nom;
3926 else
3927 V_base := 1;
3928 end if;
3929 annotation(Documentation(info="<html>
3930<p>Calculates base-voltage depending on the choice of units.</p>
3931<p>\"pu\":
3932<pre>
3933 V_base = V_nom
3934</pre>
3935\"SI\":
3936<pre>
3937 V_base = 1
3938</pre></p>
3939</html>
3940"));
3941 end baseV;
3942
3943 function baseI "Base current"
3944 extends PowerSystems.Basic.Icons.Function;
3945
3946 input Boolean puUnits "= true if pu else SI units";
3947 input SI.Voltage V_nom "nom voltage";
3948 input SI.ApparentPower S_nom "apparent power";
3949 output SI.Current I_base "base current";
3950
3951 algorithm
3952 if puUnits then
3953 I_base := S_nom/V_nom;
3954 else
3955 I_base := 1;
3956 end if;
3957 annotation(Documentation(info="<html>
3958<p>Calculates base-current depending on the choice of units.</p>
3959<p>\"pu\":
3960<pre>
3961 I_base = S_nom/V_nom;
3962</pre>
3963\"SI\":
3964<pre>
3965 I_base = 1;
3966</pre></p>
3967</html>
3968"));
3969 end baseI;
3970
3971 function baseR "Base resistance"
3972 extends PowerSystems.Basic.Icons.Function;
3973
3974 input Boolean puUnits "= true if pu else SI units";
3975 input SI.Voltage V_nom "nom voltage";
3976 input SI.ApparentPower S_nom "apparent power";
3977 input Integer scale=1 "scaling factor topology (Y:1, Delta:3)";
3978 output SI.Resistance R_base "base resistance";
3979
3980 algorithm
3981 if puUnits then
3982 R_base := scale*V_nom*V_nom/S_nom;
3983 else
3984 R_base := scale;
3985 end if;
3986 annotation (Documentation(info="<html>
3987<p>Calculates base-resistance depending on the choice of units.</p>
3988<p>\"pu\":
3989<pre>
3990 R_base = V_nom*V_nom/S_nom
3991</pre>
3992\"SI\":
3993<pre>
3994 R_base = 1
3995</pre></p>
3996</html>
3997"));
3998 end baseR;
3999
4000 function baseTrafoV "Base voltage transformers"
4001 extends PowerSystems.Basic.Icons.Function;
4002
4003 input Boolean puUnits "= true if pu else SI units";
4004 input SI.Voltage[:] V_nom
4005 "nom voltage {prim, sec} or {prim, sec1, sec2}";
4006 output SI.Voltage[size(V_nom,1)] V_base
4007 "base voltage {prim,sec} or {prim, sec1, sec2}";
4008
4009 algorithm
4010 if puUnits then
4011 V_base := V_nom;
4012 else
4013 V_base := ones(size(V_nom,1));
4014 end if;
4015 annotation(Documentation(info="<html>
4016<p>Calculates transformer base-voltage depending on the choice of units.</p>
4017<p>\"pu\":
4018<pre>
4019 V_base[k] = V_nom[k], k=1,2
4020</pre>
4021\"SI\":
4022<pre>
4023 V_base[k] = 1, k=1,2
4024</pre></p>
4025</html>
4026"));
4027 end baseTrafoV;
4028
4029 function baseTrafoRL "Base resistance and inductance transformers"
4030 extends PowerSystems.Basic.Icons.Function;
4031
4032 input Boolean puUnits "= true if pu else SI units";
4033 input SI.Voltage[:] V_nom
4034 "nom voltage {prim, sec} or {prim, sec1, sec2}";
4035 input SI.ApparentPower S_nom "apparent power";
4036 input SI.AngularFrequency omega_nom "angular frequency";
4037 output Real[size(V_nom,1), 2] RL_base "base [prim res, prim ind; sec res, sec ind] or
4038 [prim res, prim ind; sec1 res, sec1 ind; sec2 res, sec2 ind]";
4039
4040 algorithm
4041 if puUnits then
4042 RL_base := fill(V_nom[1]^2/S_nom, size(V_nom,1), 1)*[1, 1/omega_nom];
4043 else
4044 RL_base := [(fill(V_nom[1],size(V_nom,1))./ V_nom).^2]*[1, 1/omega_nom];
4045 end if;
4046 annotation (Documentation(info="<html>
4047<p>Calculates transformer base-resistance and -inductance depending on the choice of units (first index: primary, secondary, second index: R, L).<br>
4048The secondary side is winding-reduced to the primary, as the equations are written in reduced form.</p>
4049<p>\"pu\":
4050<pre>
4051 RL_base = [V_nom[1]^2/S_nom ] * [1, 1/omega_nom]
4052 [(V_nom[2]^2/S_nom)/W_nom^2]
4053</pre>
4054\"SI\":
4055<pre>
4056 RL_base[k] = [1 ] * [1, 1/omega_nom]
4057 [1/W_nom^2]
4058</pre></p>
4059<p>The winding ratio <tt>W_nom</tt> is given by the nominal voltages:
4060<pre> W_nom = V_nom[2]/V_nom[1]</pre></p>
4061</html>"));
4062 end baseTrafoRL;
4063 annotation (preferedView="info",
4064 Window(
4065 x=0.05,
4066 y=0.44,
4067 width=0.31,
4068 height=0.23,
4069 library=1,
4070 autolayout=1),
4071 Documentation(info="<html>
4072<p>Functions needed for the determination of coefficient-matrices from a set of phenomenological input parameters.</p>
4073<p><a href=\"PowerSystems.UsersGuide.Introduction.Precalculation\">up users guide</a></p>
4074<p>The second part of this package has been written in honour of <b>I. M. Canay</b>, one of the important electrical engeneers of the 20th century. He understood, what he wrote, and his results were exact. The package is based on his ideas and formulated in full mathematical generality.</p>
4075<p>Literature:
4076<ul>
4077<li>Canay, I. M.: Modelling of Alternating-Current Machines Having Multiple Rotor Circuits.<br>
4078IEEE Transactions on Energy Conversion, Vol. 8, No. 2, June 1993.</li>
4079<li>Canay, I. M.: Determination of the Model Parameters of Machines from the Reactance Operators x_d(p), x_q(p).<br>
4080IEEE Transactions on Energy Conversion, Vol. 8, No. 2, June 1993.</li>
4081</ul></p>
4082</html>"));
4083 end Precalculation;
4084
4085 package Transforms "Transform functions"
4086 extends Modelica.Icons.Package;
4087
4088 function park "Park transform"
4089 extends PowerSystems.Basic.Icons.Function;
4090
4091 input Modelica.SIunits.Angle theta "transformation angle";
4092 output Real[3,3] P "Park transformation matrix";
4093 protected
4094 constant Real s13=sqrt(1/3);
4095 constant Real s23=sqrt(2/3);
4096 constant Real dph_b=2*Modelica.Constants.pi
4097 /3;
4098 constant Real dph_c=4*Modelica.Constants.pi
4099 /3;
4100 Real[3] c;
4101 Real[3] s;
4102
4103 algorithm
4104 c := cos({theta, theta - dph_b, theta - dph_c});
4105 s := sin({theta, theta - dph_b, theta - dph_c});
4106 P := transpose([s23*c, -s23*s, {s13, s13, s13}]);
4107 annotation (derivative = PowerSystems.Basic.Transforms.der_park,
4108 Documentation(info="<html>
4109<p>The function <tt>park</tt> calculates the matrix <tt>P</tt> that transforms abc variables into dqo variables with arbitrary angular orientation <tt>theta</tt>.<br>
4110<tt>P</tt> can be factorised into a constant, angle independent orthogonal matrix <tt>P0</tt> and an angle-dependent rotation <tt>R</tt></p>
4111<pre>
4112 P(theta) = R'(theta)*P0
4113</pre>
4114<p>Using the definition</p>
4115<pre>
4116 c_k = cos(theta - k*2*pi/3), k=0,1,2 (phases a, b, c)
4117 s_k = sin(theta - k*2*pi/3), k=0,1,2 (phases a, b, c)
4118</pre>
4119<p>it takes the form
4120<pre>
4121 [ c_0, c_1, c_2]
4122 P(theta) = sqrt(2/3)*[-s_0, -s_1,-s_2]
4123 [ w, w, w ]
4124</pre>
4125with
4126<pre>
4127 [ 1, -1/2, -1/2]
4128 P0 = P(0) = sqrt(2/3)*[ 0, sqrt(3)/2, -sqrt(3)/2]
4129 [ w, w, w]
4130</pre>
4131and
4132<pre>
4133 [c_0, -s_0, 0]
4134 R(theta) = [s_0, c_0, 0]
4135 [ 0, 0, 1]
4136</pre></p>
4137<p><a href=\"PowerSystems.UsersGuide.Introduction.Transforms\">up users guide</a></p>
4138</html>"));
4139 end park;
4140
4141 function der_park "Derivative of Park transform"
4142 extends PowerSystems.Basic.Icons.Function;
4143
4144 input Modelica.SIunits.Angle theta "transformation angle";
4145 input Modelica.SIunits.AngularFrequency omega "d/dt theta";
4146 output Real[3, 3] der_P "d/dt park";
4147 protected
4148 constant Real s23=sqrt(2/3);
4149 constant Real dph_b=2*Modelica.Constants.pi
4150 /3;
4151 constant Real dph_c=4*Modelica.Constants.pi
4152 /3;
4153 Real[3] c;
4154 Real[3] s;
4155 Real s23omega;
4156
4157 algorithm
4158 s23omega := s23*omega;
4159 c := cos({theta, theta - dph_b, theta - dph_c});
4160 s := sin({theta, theta - dph_b, theta - dph_c});
4161 der_P := transpose([-s23omega*s, -s23omega*c, {0, 0, 0}]);
4162 annotation(derivative(order=2) = PowerSystems.Basic.Transforms.der2_park,
4163 Documentation(info="<html>
4164<p>First derivative of function park(theta) with respect to time.</p>
4165</html>"));
4166 end der_park;
4167
4168 function der2_park "2nd derivative of Park transform"
4169 extends PowerSystems.Basic.Icons.Function;
4170
4171 input Modelica.SIunits.Angle theta "transformation angle";
4172 input Modelica.SIunits.AngularFrequency omega "d/dt theta";
4173 input Modelica.SIunits.AngularAcceleration omega_dot "d/dt omega";
4174 output Real[3, 3] der2_P "d2/dt2 park";
4175 protected
4176 constant Real s23=sqrt(2/3);
4177 constant Real dph_b=2*Modelica.Constants.pi
4178 /3;
4179 constant Real dph_c=4*Modelica.Constants.pi
4180 /3;
4181 Real[3] c;
4182 Real[3] s;
4183 Real s23omega_dot;
4184 Real s23omega2;
4185
4186 algorithm
4187 s23omega_dot := s23*omega_dot;
4188 s23omega2 := s23*omega*omega;
4189 c := cos({theta, theta - dph_b, theta - dph_c});
4190 s := sin({theta, theta - dph_b, theta - dph_c});
4191 der2_P := transpose([-s23omega_dot*s - s23omega2*c, -s23omega_dot*c + s23omega2*s, {0, 0, 0}]);
4192 annotation(Documentation(info="<html>
4193<p>Second derivative of function park(theta) with respect to time.</p>
4194</html>"));
4195 end der2_park;
4196
4197 function rotation_dq "Rotation matrix dq"
4198 extends PowerSystems.Basic.Icons.Function;
4199
4200 input Modelica.SIunits.Angle theta "rotation angle";
4201 output Real[2, 2] R_dq "rotation matrix";
4202 protected
4203 Real c;
4204 Real s;
4205
4206 algorithm
4207 c := cos(theta);
4208 s := sin(theta);
4209 R_dq := [c, -s; s, c];
4210 annotation (derivative = PowerSystems.Basic.Transforms.der_rotation_dq,
4211 Documentation(info="<html>
4212<p>The function <tt>rotation_dq</tt> calculates the matrix <tt>R_dq</tt> that is the restriction of <tt>R_dqo</tt> from dqo to dq.</p>
4213<p>The matrix <tt>R_dqo</tt> rotates dqo variables around the o-axis in dqo-space with arbitrary angle <tt>theta</tt>.
4214<p>It takes the form
4215<pre>
4216 [cos(theta), -sin(theta), 0]
4217 R_dqo(theta) = [sin(theta), cos(theta), 0]
4218 [ 0, 0, 1]
4219</pre>
4220and has the real eigenvector
4221<pre> {0, 0, 1}</pre>
4222in the dqo reference-frame.</p>
4223<p>Coefficient matrices of the form (symmetrical systems)
4224<pre>
4225 [x, 0, 0 ]
4226 X = [0, x, 0 ]
4227 [0, 0, xo]
4228</pre>
4229are invariant under transformations R_dqo</p>
4230<p>The connection between R_dqo and R_abc is the following
4231<pre> R_dqo = P0*R_abc*P0'.</pre>
4232with P0 the orthogonal transform 'Transforms.P0'.</p>
4233<p><a href=\"PowerSystems.UsersGuide.Introduction.Transforms\">up users guide</a></p>
4234</html>
4235"));
4236 end rotation_dq;
4237
4238 function der_rotation_dq "Derivative of rotation matrix dq"
4239 extends PowerSystems.Basic.Icons.Function;
4240
4241 input Modelica.SIunits.Angle theta;
4242 input Modelica.SIunits.AngularFrequency omega "d/dt theta";
4243 output Real[2, 2] der_R_dq "d/dt rotation_dq";
4244 protected
4245 Real dc;
4246 Real ds;
4247
4248 algorithm
4249 dc := -omega*sin(theta);
4250 ds := omega*cos(theta);
4251 der_R_dq := [dc, -ds; ds, dc];
4252 annotation(derivative(order=2) = PowerSystems.Basic.Transforms.der2_rotation_dq,
4253 Documentation(info="<html>
4254<p>First derivative of function rotation_dq(theta) with respect to time.</p>
4255</html>"));
4256 end der_rotation_dq;
4257
4258 function der2_rotation_dq "2nd derivative of rotation matrix dq"
4259 extends PowerSystems.Basic.Icons.Function;
4260
4261 input Modelica.SIunits.Angle theta;
4262 input Modelica.SIunits.AngularFrequency omega "d/dt theta";
4263 input Modelica.SIunits.AngularAcceleration omega_dot "d/dt omega";
4264 output Real[2, 2] der2_R_dq "d/2dt2 rotation_dq";
4265 protected
4266 Real c;
4267 Real s;
4268 Real d2c;
4269 Real d2s;
4270 Real omega2=omega*omega;
4271
4272 algorithm
4273 c := cos(theta);
4274 s := sin(theta);
4275 d2c := -omega_dot*s - omega2*c;
4276 d2s := omega_dot*c - omega2*s;
4277 der2_R_dq := [d2c, -d2s; d2s, d2c];
4278 annotation(Documentation(info="<html>
4279<p>Second derivative of function rotation_dq(theta) with respect to time.</p>
4280</html>"));
4281 end der2_rotation_dq;
4282 annotation (preferedView="info",
4283 Window(
4284 x=0.05,
4285 y=0.41,
4286 width=0.4,
4287 height=0.38,
4288 library=1,
4289 autolayout=1),
4290 Documentation(info="<html>
4291<p><a href=\"PowerSystems.UsersGuide.Introduction.Transforms\">up users guide</a></p>
4292</html>
4293"), Icon(coordinateSystem(
4294 preserveAspectRatio=false,
4295 extent={{-100,-100},{100,100}},
4296 grid={2,2}), graphics));
4297 end Transforms;
4298
4299 package Types
4300 extends Modelica.Icons.Package;
4301
4302 package SIpu "Additional types for power systems"
4303 extends Modelica.Icons.Package;
4304
4305 type Voltage = Real (final quantity="Voltage", unit="V/V");
4306
4307 type Current = Real (final quantity="Current", unit="A/A");
4308
4309 type Resistance = Real (
4310 final quantity="Resistance",
4311 unit="Ohm/(V.V/VA)",
4312 final min=0);
4313
4314 type Reactance = Real (final quantity="Reactance", unit="Ohm/(V.V/VA)");
4315
4316 type Power = Real (final quantity="Power", unit="W/W");
4317 annotation (
4318 Window(
4319 x=0.45,
4320 y=0.01,
4321 width=0.44,
4322 height=0.65,
4323 library=1,
4324 autolayout=1),
4325 Invisible=true,
4326 Documentation(info="<html>
4327</html>
4328"));
4329 end SIpu;
4330
4331 type FreqType = enumeration(
4332 par "parameter",
4333 sig "signal",
4334 sys "system") "Frequency type"
4335 annotation(Documentation(info="<html>
4336<p><pre>
4337 par: source has parameter frequency
4338 sig: source has signal frequency
4339 sys: source has system frequency
4340</pre></p>
4341</html>"));
4342
4343 type AngularVelocity = SI.AngularVelocity(displayUnit = "rpm");
4344 end Types;
4345
4346 package Icons "Icons"
4347 extends Modelica.Icons.Package;
4348
4349 partial block Block "Block icon"
4350
4351 annotation (
4352 Window(
4353 x=0.45,
4354 y=0.01,
4355 width=0.44,
4356 height=0.65),
4357 Documentation(info="
4358"), Icon(coordinateSystem(
4359 preserveAspectRatio=false,
4360 extent={{-100,-100},{100,100}},
4361 grid={2,2}), graphics={Rectangle(
4362 extent={{-80,60},{80,-60}},
4363 lineColor={0,0,127},
4364 fillColor={255,255,255},
4365 fillPattern=FillPattern.Solid)}));
4366 end Block;
4367
4368 partial block Block0 "Block icon 0"
4369 extends Block;
4370 annotation (
4371 Window(
4372 x=0.45,
4373 y=0.01,
4374 width=0.44,
4375 height=0.65),
4376 Documentation(info="
4377"), Icon(coordinateSystem(
4378 preserveAspectRatio=false,
4379 extent={{-100,-100},{100,100}},
4380 grid={2,2}), graphics={Text(
4381 extent={{-100,-80},{100,-120}},
4382 lineColor={0,0,0},
4383 textString=
4384 "%name")}));
4385 end Block0;
4386
4387 partial function Function "Function icon"
4388
4389 annotation (
4390 Icon(coordinateSystem(
4391 preserveAspectRatio=false,
4392 extent={{-100,-100},{100,100}},
4393 grid={2,2}), graphics={
4394 Ellipse(
4395 extent={{-100,60},{100,-60}},
4396 lineColor={255,85,85},
4397 fillColor={255,255,255},
4398 fillPattern=FillPattern.Solid),
4399 Text(
4400 extent={{-100,30},{100,-50}},
4401 lineColor={255,85,85},
4402 textString="f"),
4403 Text(
4404 extent={{-100,120},{100,80}},
4405 lineColor={0,0,0},
4406 textString="%name")}),
4407 Documentation(
4408 info="
4409"), Window(
4410 x=0.45,
4411 y=0.01,
4412 width=0.44,
4413 height=0.65),
4414 Diagram(coordinateSystem(
4415 preserveAspectRatio=false,
4416 extent={{-100,-100},{100,100}},
4417 grid={2,2}), graphics));
4418 end Function;
4419 annotation (preferedView="info",
4420 Window(
4421 x=0.05,
4422 y=0.41,
4423 width=0.4,
4424 height=0.32,
4425 library=1,
4426 autolayout=1),
4427 Documentation(info="<html>
4428</html>
4429"));
4430 end Icons;
4431 end Basic;
4432
4433 package Interfaces
4434 extends Modelica.Icons.InterfacesPackage;
4435
4436 connector Terminal "General power terminal"
4437 replaceable package PhaseSystem = PhaseSystems.PartialPhaseSystem
4438 "Phase system"
4439 annotation (choicesAllMatching=true);
4440 PhaseSystem.Voltage v[PhaseSystem.n] "voltage vector";
4441 flow PhaseSystem.Current i[PhaseSystem.n] "current vector";
4442 PhaseSystem.ReferenceAngle theta[PhaseSystem.m] if PhaseSystem.m > 0
4443 "optional vector of phase angles";
4444 end Terminal;
4445
4446 connector Electric_p "Electric terminal ('positive')"
4447 extends Modelica.Electrical.Analog.Interfaces.Pin;
4448 annotation (defaultComponentName = "term_p",
4449 Documentation(info="<html>
4450</html>
4451"), Window(
4452 x=0.45,
4453 y=0.01,
4454 width=0.44,
4455 height=0.65),
4456 Icon(coordinateSystem(
4457 preserveAspectRatio=false,
4458 extent={{-100,-100},{100,100}},
4459 grid={2,2}), graphics={Rectangle(
4460 extent={{-100,100},{100,-100}},
4461 lineColor={0,0,255},
4462 fillColor={0,0,255},
4463 fillPattern=FillPattern.Solid)}),
4464 Diagram(coordinateSystem(
4465 preserveAspectRatio=false,
4466 extent={{-100,-100},{100,100}},
4467 grid={2,2}), graphics={Rectangle(
4468 extent={{0,50},{100,-50}},
4469 lineColor={0,0,255},
4470 fillColor={0,0,255},
4471 fillPattern=FillPattern.Solid), Text(
4472 extent={{-120,120},{100,60}},
4473 lineColor={0,0,255},
4474 textString="%name")}));
4475 end Electric_p;
4476
4477 connector Frequency "Weighted frequency"
4478 flow SI.Time H "inertia constant";
4479 flow SI.Angle w_H "angular velocity, inertia-weighted";
4480 Real h "Dummy potential-variable to balance flow-variable H";
4481 Real w_h "Dummy potential-variable to balance flow-variable w_H";
4482
4483 annotation (defaultComponentName = "frequency",
4484 Icon(coordinateSystem(
4485 preserveAspectRatio=false,
4486 extent={{-100,-100},{100,100}},
4487 grid={2,2}), graphics={Ellipse(
4488 extent={{-80,80},{80,-80}},
4489 lineColor={120,0,120},
4490 fillColor={255,255,255},
4491 fillPattern=FillPattern.Solid), Text(
4492 extent={{-60,30},{60,-30}},
4493 lineColor={120,0,120},
4494 fillColor={255,255,255},
4495 fillPattern=FillPattern.Solid,
4496 textString="f")}),
4497 Diagram(coordinateSystem(
4498 preserveAspectRatio=false,
4499 extent={{-100,-100},{100,100}},
4500 grid={2,2}), graphics={Text(
4501 extent={{-120,120},{120,60}},
4502 lineColor={120,0,120},
4503 textString=
4504 "%name"), Ellipse(
4505 extent={{-40,40},{40,-40}},
4506 lineColor={120,0,120},
4507 fillColor={255,255,255},
4508 fillPattern=FillPattern.Solid)}),
4509 Window(
4510 x=0.45,
4511 y=0.01,
4512 width=0.44,
4513 height=0.65),
4514 Documentation(info="<html>
4515<p>System frequency reference.<br>
4516Used in 'System' for sending/receiving weighted frequency-data.</p>
4517<pre>
4518 H: weight, i.e. inertia constant of machine (dimension time)
4519 H_omega: weighted angular frequency H*omega
4520</pre>
4521</html>"));
4522 end Frequency;
4523 end Interfaces;
4524 annotation (preferedView="info",
4525 version="0.2.1",
4526 versionDate="2014-08-15",
4527 Documentation(info="<html>
4528<h3><font color=\"#000080\" size=5>Modelica PowerSystems library</font></h3>
4529<p>The library is intended to model electrical <b>power systems</b> at different <b>levels of detail</b> both in <b>transient</b> and <b>steady-state</b> mode.</p>
4530<p>The Users Guide to the library is <a href=\"PowerSystems.UsersGuide\"><b>here</b></a>.</p>
4531<p><br/>Copyright &copy; 2007-2013, Modelica Association. </p>
4532<p><i>This Modelica package is <b>Open Source</b> software; it can be redistributed and/or modified
4533under the terms of the <b>Modelica license, version 2.0, see the license conditions and
4534the accompanying disclaimer <a href=\"modelica://Modelica.UsersGuide.ModelicaLicense2\">here</a>.</b></i> </p>
4535<p><i>This work was in parts supported by the ITEA2 MODRIO project by funding of BMBF under contract
4536number ITEA 2 - 11004. Work on the predecessor PowerFlow library was in parts supported by
4537the ITEA2 EUROSYSLIB project by funding of BMBF under contract number ITEA 2 - 06020.
4538Work on the predecessor Spot library was in parts supported by the RealSim project
4539by funding of the IST Programme, Contract No. IST-1999-11979. </i></p>
4540<p/>
4541</html>
4542"),
4543 uses(Modelica(version="3.2.1")),
4544 Icon(graphics={
4545 Line(
4546 points={{-60,-16},{38,-16}},
4547 color={0,0,0},
4548 smooth=Smooth.None),
4549 Line(
4550 points={{-60,-16},{-60,-42}},
4551 color={0,0,0},
4552 smooth=Smooth.None),
4553 Line(
4554 points={{38,-16},{38,-42}},
4555 color={0,0,0},
4556 smooth=Smooth.None),
4557 Line(
4558 points={{-10,10},{-10,-16}},
4559 color={0,0,0},
4560 smooth=Smooth.None),
4561 Ellipse(extent={{-20,30},{0,10}}, lineColor={0,0,0}),
4562 Ellipse(extent={{-20,42},{0,22}}, lineColor={0,0,0}),
4563 Ellipse(extent={{-70,-42},{-50,-62}}, lineColor={0,0,0}),
4564 Ellipse(extent={{28,-42},{48,-62}}, lineColor={0,0,0}),
4565 Line(
4566 points={{-10,52},{-10,42}},
4567 color={0,0,0},
4568 smooth=Smooth.None)}));
4569end PowerSystems;
4570model PowerSystems_Examples_Spot_AC3ph_Transformer
4571 extends PowerSystems.Examples.Spot.AC3ph.Transformer;
4572 annotation(experiment(StopTime=3),uses(PowerSystems(version="0.2.1")));
4573end PowerSystems_Examples_Spot_AC3ph_Transformer;