root/branches/maintenance/2.2.2/Modelica/Electrical/MultiPhase.mo

Revision 705, 91.8 kB (checked in by AHaumer, 13 months ago)
  • Property svn:eol-style set to native
  • Property svn:keywords set to Author Date Id Revision
Line 
1within Modelica.Electrical;
2
3
4package MultiPhase "Library for electrical components with 2, 3 or more phases" 
5  extends Modelica.Icons.Library2;
6  annotation (
7    version="1.3.1", versionDate="2007-08-12",
8    classOrder={"Examples", "*"},
9    preferedView="info", Documentation(info="<HTML>
10<p>
11This package contains packages for electrical multiphase components, based on Modelica.Electrical.Analog:
12<ul>
13<li>Basic: basic components (resistor, capacitor, inductor, ...)</li>
14<li>Ideal: ideal elements (switches, diode, transformer, ...)</li>
15<li>Sensors: sensors to measure potentials, voltages, and currents</li>
16<li>Sources: time-dependend and controlled voltage and current sources</li>
17</ul>
18This package is intended to be used the same way as Modelica.Electrical.Analog
19but to make design of multiphase models easier.<br>
20The package is based on the plug: a composite connector containing m pins.<br>
21It is possible to connect plugs to plugs or single pins of a plug to single pins.<br>
22Potentials may be accessed as <tt>plug.pin[].v</tt>, currents may be accessed as <tt>plug.pin[].i</tt>.
23</p>
24<p>
25Further development:
26<ul>
27<li>temperature-dependent resistor</li>
28<li>lines (m-phase models)</li>
29</ul>
30</p>
31<dl>
32<p>
33  <dt><b>Main Author:</b></dt>
34  <dd>
35  <a href=\"http://www.haumer.at/\">Anton Haumer</a><br>
36  Technical Consulting & Electrical Engineering<br>
37  A-3423 St.Andrae-Woerdern<br>Austria<br>
38  email: <a href=\"mailto:a.haumer@haumer.at\">a.haumer@haumer.at</a>
39  </dd>
40</p>
41</dl>
42<p>
43Copyright &copy; 1998-2007, Modelica Association and Anton Haumer.
44</p>
45<p>
46<i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified
47under the terms of the <b>Modelica license</b>, see the license conditions
48and the accompanying <b>disclaimer</b> 
49<a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i>
50</p><br>
51</HTML>", revisions="<html>
52  <ul>
53  <li>v1.0 2004/10/01 Anton Haumer</li>
54  <li>v1.1 2006/01/12 Anton Haumer<br>
55      added Sensors.PowerSensor</li>
56  <li>v1.2 2006/07/05 Anton Haumer<br>
57      removed annotation from pin of Interfaces.Plug<br>
58      corrected usage of resistance/conductance</li>
59  <li>v1.3.0 2007/01/23 Anton Haumer<br>
60      improved some icons</li>
61  <li>v1.3.1 2007/08/12 Anton Haumer<br>
62      improved documentation</li>
63  </ul>
64</html>"),
65    Icon(
66      Ellipse(extent=[-60,10; 40,-90], style(color=3, rgbcolor={0,0,255})),
67      Ellipse(extent=[-40,-14; -20,-34], style(
68          color=3,
69          rgbcolor={0,0,255},
70          fillColor=3,
71          rgbfillColor={0,0,255})),
72      Ellipse(extent=[0,-14; 20,-34], style(
73          color=3,
74          rgbcolor={0,0,255},
75          fillColor=3,
76          rgbfillColor={0,0,255})),
77      Ellipse(extent=[-20,-54; 0,-74], style(
78          color=3,
79          rgbcolor={0,0,255},
80          fillColor=3,
81          rgbfillColor={0,0,255}))));
82 
83  package Basic "Basic components for electrical multiphase models" 
84    extends Modelica.Icons.Library2;
85    annotation (Documentation(info="<HTML>
86<p>
87This package contains basic analog electrical multiphase components.
88</p>
89
90</HTML>", revisions="<html>
91<dl>
92<p>
93  <dt><b>Main Authors:</b></dt>
94  <dd>
95  <a href=\"http://www.haumer.at/\">Anton Haumer</a><br>
96  Technical Consulting & Electrical Engineering<br>
97  A-3423 St.Andrae-Woerdern<br>Austria<br>
98  email: <a href=\"mailto:a.haumer@haumer.at\">a.haumer@haumer.at</a>
99  </dd>
100</p>
101<p>
102  <dt><b>Release Notes:</b></dt>
103  <dd>
104  <ul>
105  <li> v1.0 2004/10/01 Anton Haumer</li>
106  </ul>
107  </dd>
108<p>
109  <dt><b>Copyright:</b></dt>
110  <dd>Copyright &copy; 1998-2006, Modelica Association and Anton Haumer.<br>
111  <i>The Modelica package is <b>free</b> software; it can be redistributed and/or modified
112  under the terms of the <b>Modelica license</b>, see the license conditions
113  and the accompanying <b>disclaimer</b> in the documentation of package
114  Modelica in file \"Modelica/package.mo\".</i></dd>
115</p>
116</dl>
117</html>"), Icon(
118        Rectangle(extent=[-80,-10; 60,-70],  style(
119            color=3,
120            fillColor=7,
121            fillPattern=1)),
122        Line(points=[60,-40; 80,-40]),
123        Line(points=[-100,-40; -80,-40])));
124   
125    model Star "Star-connection" 
126      parameter Integer m(final min=1) = 3 "number of phases";
127      Interfaces.PositivePlug plug_p(final m=m) 
128        annotation (extent=[-110, -10; -90, 10]);
129      Modelica.Electrical.Analog.Interfaces.NegativePin pin_n
130        annotation (extent=[90, -10; 110, 10]);
131      annotation (Icon(
132          Text(extent=[-150,60; 150,120],  string="%name"),
133          Line(points=[80, 0; 0, 0], style(thickness=2, fillPattern=1)),
134          Line(points=[0, 0; -39, 68], style(thickness=2, fillPattern=1)),
135          Line(points=[0, 0; -38, -69], style(thickness=2, fillPattern=1)),
136          Text(extent=[-100,-110; 100,-70],   string="m=%m",
137            style(color=0, rgbcolor={0,0,0})),
138          Line(points=[-90,0; -40,0], style(color=3, rgbcolor={0,0,255})),
139          Line(points=[80,0; 90,0], style(color=3, rgbcolor={0,0,255}))),
140          Documentation(
141            info="<HTML>
142<p>
143Connects all pins of plug_p to pin_n, thus establishing a so-called star-connection.
144</p>
145</HTML>"));
146     
147    equation 
148      for j in 1:m loop
149        connect(plug_p.pin[j],pin_n);
150      end for;
151    end Star;
152   
153    model Delta "Delta (polygon) connection" 
154      parameter Integer m(final min=2) = 3 "number of phases";
155      Interfaces.PositivePlug plug_p(final m=m) 
156        annotation (extent=[-110, -10; -90, 10]);
157      Interfaces.NegativePlug plug_n(final m=m) 
158        annotation (extent=[90, -10; 110, 10]);
159      annotation (Icon(
160          Text(extent=[-150,60; 150,120],  string="%name",
161            style(color=3, rgbcolor={0,0,255})),
162          Line(points=[-40, 68; -40, -70; 79, 0; -40, 68; -40, 67], style(
163                thickness=2, fillPattern=1)),
164          Text(extent=[-100,-110; 100,-70],   string="m=%m",
165            style(color=0, rgbcolor={0,0,0})),
166          Line(points=[-90,0; -40,0], style(color=3, rgbcolor={0,0,255})),
167          Line(points=[80,0; 90,0], style(color=3, rgbcolor={0,0,255}))),
168          Documentation(
169            info="<HTML>
170<p>
171Connects in a cyclic way plug_n.pin[j] to plug_p.pin[j+1],
172thus establishing a so-called delta (or polygon) connection
173when used in parallel to another component.
174</p>
175</HTML>"));
176     
177    equation 
178      for j in 1:m loop
179        if j<m then
180          connect(plug_n.pin[j],plug_p.pin [j+1]);
181        else
182          connect(plug_n.pin[j],plug_p.pin [1]);
183        end if;
184      end for;
185    end Delta;
186   
187    model PlugToPin_p "Connect one (positive) Pin" 
188      parameter Integer m(final min=1) = 3 "number of phases";
189      parameter Integer k(
190        final min=1,
191        final max=m) = 1 "phase index";
192      Interfaces.PositivePlug plug_p(final m=m) 
193        annotation (extent=[-30,-10; -10,10]);
194      Modelica.Electrical.Analog.Interfaces.PositivePin pin_p
195        annotation (extent=[10,-10; 30,10]);
196      annotation (
197        Icon(
198          Text(extent=[-150,100; 150,40],string="%name"),
199          Text(extent=[-100,-60; 100,-100],string="k = %k",
200            style(color=0, rgbcolor={0,0,0})),
201          Line(points=[-20,20; 40,20; 40,-20; -20,-20], style(
202              color=0,
203              rgbcolor={0,0,0},
204              fillColor=30,
205              rgbfillColor={215,215,215},
206              fillPattern=1)),
207          Rectangle(extent=[-20,20; 40,-20], style(
208              pattern=0,
209              fillColor=30,
210              rgbfillColor={215,215,215},
211              fillPattern=1)),
212          Ellipse(extent=[-40,20; 0,-20], style(
213              color=0,
214              rgbcolor={0,0,0},
215              fillColor=30,
216              rgbfillColor={215,215,215},
217              fillPattern=1)),
218          Line(points=[-20,20; 40,20; 40,-20; -20,-20], style(
219              color=0,
220              rgbcolor={0,0,0},
221              fillColor=30,
222              rgbfillColor={215,215,215},
223              fillPattern=1))),
224        Documentation(info="<HTML>
225<p>
226Connects pin <i>k</i> of plug_p to pin_p, leaving the other pins of plug_p unconnected.
227</p>
228</HTML>"),
229        Diagram);
230    equation 
231      pin_p.v = plug_p.pin[k].v;
232      for j in 1:m loop
233        plug_p.pin[j].i = if j == k then -pin_p.i else 0;
234      end for;
235    end PlugToPin_p;
236   
237    model PlugToPin_n "Connect one (negative) Pin" 
238      parameter Integer m(final min=1) = 3 "number of phases";
239      parameter Integer k(
240        final min=1,
241        final max=m) = 1 "phase index";
242      Interfaces.NegativePlug plug_n(final m=m) 
243        annotation (extent=[-30,-10; -10,10]);
244      Modelica.Electrical.Analog.Interfaces.NegativePin pin_n
245        annotation (extent=[10,-10; 30,10]);
246      annotation (Icon(
247          Text(extent=[-150,100; 150,40],string="%name"),
248          Text(extent=[-100,-60; 100,-100],string="k = %k",
249            style(color=0, rgbcolor={0,0,0})),
250          Line(points=[-20,20; 40,20; 40,-20; -20,-20], style(
251              color=0,
252              rgbcolor={0,0,0},
253              fillColor=30,
254              rgbfillColor={215,215,215},
255              fillPattern=1)),
256          Rectangle(extent=[-20,20; 40,-20], style(
257              pattern=0,
258              fillColor=30,
259              rgbfillColor={215,215,215},
260              fillPattern=1)),
261          Ellipse(extent=[-40,20; 0,-20], style(
262              color=0,
263              rgbcolor={0,0,0},
264              fillColor=30,
265              rgbfillColor={215,215,215},
266              fillPattern=1)),
267          Line(points=[-20,20; 40,20; 40,-20; -20,-20], style(
268              color=0,
269              rgbcolor={0,0,0},
270              fillColor=30,
271              rgbfillColor={215,215,215},
272              fillPattern=1))),
273           Documentation(info="<HTML>
274<p>
275Connects pin <i>k</i> of plug_n to pin_n, leaving the other pins of plug_n unconnected.
276</p>
277</HTML>"),
278        Diagram);
279    equation 
280      pin_n.v = plug_n.pin[k].v;
281      for j in 1:m loop
282        plug_n.pin[j].i = if j == k then -pin_n.i else 0;
283      end for;
284    end PlugToPin_n;
285   
286    model Resistor "Ideal linear electrical resistors" 
287      extends Interfaces.TwoPlug;
288      parameter Modelica.SIunits.Resistance R[m]=fill(1, m) "Resistance";
289      Modelica.Electrical.Analog.Basic.Resistor resistor[m](final R=R) 
290        annotation (extent=[-10, -10; 10, 10]);
291      annotation (
292        Icon(
293          Rectangle(extent=[-70, 30; 70, -30], style(
294              color=3,
295              fillColor=7,
296              fillPattern=1)),
297          Line(points=[-90, 0; -70, 0]),
298          Line(points=[70, 0; 90, 0]),
299          Text(extent=[-150,40; 150,100],   string="%name"),
300          Text(extent=[-100,-100; 100,-60],   string="m=%m",
301            style(color=0, rgbcolor={0,0,0}))),
302        Documentation(info="<HTML>
303<p>
304Contains m resistors (Modelica.Electrical.Analog.Basic.Resistor)
305</p>
306</HTML>"),
307        Diagram);
308    equation 
309      connect(resistor.p, plug_p.pin) 
310        annotation (points=[-10, 0; -100, 0], style(color=3));
311      connect(resistor.n, plug_n.pin) 
312        annotation (points=[10, 0; 100, 0], style(color=3));
313    end Resistor;
314   
315    model Conductor "Ideal linear electrical conductors" 
316      extends Interfaces.TwoPlug;
317      parameter Modelica.SIunits.Conductance G[m]=fill(1, m) "Conductance";
318      Modelica.Electrical.Analog.Basic.Conductor conductor[m](final G=G) 
319        annotation (extent=[-10, -10; 10, 10]);
320      annotation (
321        Icon(
322          Rectangle(extent=[-70, 30; 70, -30], style(
323              color=3,
324              fillColor=7,
325              fillPattern=1)),
326          Line(points=[-90, 0; -70, 0]),
327          Line(points=[70, 0; 90, 0]),
328          Text(extent=[-150, 40; 150, 100], string="%name"),
329          Text(extent=[-100,-100; 100,-60],   string="m=%m",
330            style(color=0, rgbcolor={0,0,0}))),
331        Documentation(info="<HTML>
332<p>
333Contains m conductors (Modelica.Electrical.Analog.Basic.Conductor)
334</p>
335</HTML>"),
336        Diagram);
337    equation 
338      connect(plug_p.pin, conductor.p) 
339        annotation (points=[-100, 0; -10, 0], style(color=3));
340      connect(plug_n.pin, conductor.n) 
341        annotation (points=[100, 0; 10, 0], style(color=3));
342    end Conductor;
343   
344    model Capacitor "Ideal linear electrical capacitors" 
345      extends Interfaces.TwoPlug;
346      parameter Modelica.SIunits.Capacitance C[m]=fill(1, m) "Capacitance";
347      Modelica.Electrical.Analog.Basic.Capacitor capacitor[m](final C=C) 
348        annotation (extent=[-10, -10; 10, 10]);
349      annotation (
350        Icon(
351          Text(extent=[-150, 40; 150, 100], string="%name"),
352          Line(points=[-14, 28; -14, -28], style(thickness=2)),
353          Line(points=[14, 28; 14, -28], style(thickness=2)),
354          Line(points=[-90, 0; -14, 0]),
355          Line(points=[14, 0; 90, 0]),
356          Text(extent=[-100,-100; 100,-60],   string="m=%m",
357            style(color=0, rgbcolor={0,0,0}))),
358        Documentation(info="<HTML>
359<p>
360Contains m capacitors (Modelica.Electrical.Analog.Basic.Capacitor)
361</p>
362</HTML>"),
363        Diagram);
364    equation 
365      connect(capacitor.p, plug_p.pin) 
366        annotation (points=[-10, 0; -100, 0], style(color=3));
367      connect(capacitor.n, plug_n.pin) 
368        annotation (points=[10, 0; 100, 0], style(color=3));
369    end Capacitor;
370   
371    model Inductor "Ideal linear electrical inductors" 
372      extends Interfaces.TwoPlug;
373      parameter Modelica.SIunits.Inductance L[m]=fill(1, m) "Inductance";
374      Modelica.Electrical.Analog.Basic.Inductor inductor[m](final L=L) 
375        annotation (extent=[-10, -10; 10, 10]);
376      annotation (
377        Icon(
378          Ellipse(extent=[-60, -15; -30, 15]),
379          Ellipse(extent=[-30, -15; 0, 15]),
380          Ellipse(extent=[0, -15; 30, 15]),
381          Ellipse(extent=[30, -15; 60, 15]),
382          Rectangle(extent=[-60, -30; 60, 0], style(color=7, fillColor=7)),
383          Line(points=[60, 0; 90, 0]),
384          Line(points=[-90, 0; -60, 0]),
385          Text(extent=[-150, 40; 150, 100], string="%name"),
386          Text(extent=[-100,-100; 100,-60],   string="m=%m",
387            style(color=0, rgbcolor={0,0,0}))),
388        Documentation(info="<HTML>
389<p>
390Contains m inductors (Modelica.Electrical.Analog.Basic.Inductor)
391</p>
392</HTML>"),
393        Diagram);
394    equation 
395      connect(inductor.p, plug_p.pin) 
396        annotation (points=[-10, 0; -100, 0], style(color=3));
397      connect(inductor.n, plug_n.pin) 
398        annotation (points=[10, 0; 100, 0], style(color=3));
399    end Inductor;
400   
401    model SaturatingInductor "Simple model of inductors with saturation" 
402      extends Interfaces.TwoPlug;
403      parameter Modelica.SIunits.Current Inom[m]=fill(1,m) "Nominal current";
404      parameter Modelica.SIunits.Inductance Lnom[m]=fill(1,m) 
405        "Nominal inductance at Nominal current";
406      parameter Modelica.SIunits.Inductance Lzer[m]={2*Lnom[j] for j in 1:m} 
407        "Inductance near current=0";
408      parameter Modelica.SIunits.Inductance Linf[m]={Lnom[j]/2 for j in 1:m} 
409        "Inductance at large currents";
410      Modelica.Electrical.Analog.Basic.SaturatingInductor saturatingInductor[m](
411        final Inom=Inom,
412        final Lnom=Lnom,
413        final Lzer=Lzer,
414        final Linf=Linf) 
415        annotation (extent=[-10,-10; 10,10]);
416      annotation (Icon(
417          Ellipse(extent=[-60,-15; -30,15]),
418          Ellipse(extent=[-30,-15; 0,15]),
419          Ellipse(extent=[0,-15; 30,15]),
420          Ellipse(extent=[30,-15; 60,15]),
421          Rectangle(extent=[-60,-20; 60,0],   style(color=7, fillColor=7)),
422          Line(points=[60,0; 90,0]),
423          Line(points=[-90,0; -60,0]),
424          Rectangle(extent=[-60,-10; 60,-20], style(
425              color=3,
426              rgbcolor={0,0,255},
427              gradient=3,
428              fillColor=3,
429              rgbfillColor={0,0,255})),
430          Text(extent=[-150,40; 150,100],   string="%name"),
431          Text(extent=[-100,-100; 100,-60],   string="m=%m",
432            style(color=0, rgbcolor={0,0,0}))),
433          Documentation(
434            info="<HTML>
435<p>
436Contains m saturating inductors (Modelica.Electrical.Analog.Basic.SaturatingInductor)
437</p>
438<p>
439<b>Attention!!!</b><br>
440Each element of the array of saturatingInductors is only dependent on the current flowing through this element.
441</p>
442</HTML>"));
443    equation 
444      connect(saturatingInductor.p, plug_p.pin) 
445        annotation (points=[-10,0; -100,0], style(color=3, rgbcolor={0,0,255}));
446      connect(saturatingInductor.n, plug_n.pin) 
447        annotation (points=[10,0; 100,0], style(color=3, rgbcolor={0,0,255}));
448    end SaturatingInductor;
449   
450    model Transformer "Multiphase Transformer" 
451      extends Interfaces.FourPlug;
452      parameter Modelica.SIunits.Inductance L1[m]=fill(1, m) 
453        "Primary inductance";
454      parameter Modelica.SIunits.Inductance L2[m]=fill(1, m) 
455        "Secondary inductance";
456      parameter Modelica.SIunits.Inductance M[m]=fill(1, m) 
457        "Coupling inductance";
458      Modelica.Electrical.Analog.Basic.Transformer transformer[m](
459        final L1=L1,
460        final L2=L2,
461        final M=M) annotation (extent=[-10, -10; 10, 10]);
462      annotation (
463        Icon(
464          Ellipse(extent=[-45, -50; -20, -25]),
465          Ellipse(extent=[-45, -25; -20, 0]),
466          Ellipse(extent=[-45, 0; -20, 25]),
467          Ellipse(extent=[-45, 25; -20, 50]),
468          Rectangle(extent=[-72, -60; -33, 60], style(color=7, fillColor=7)),
469          Line(points=[-90, 50; -32, 50]),
470          Line(points=[-90, -50; -32, -50]),
471          Ellipse(extent=[20, -50; 45, -25]),
472          Ellipse(extent=[20, -25; 45, 0]),
473          Ellipse(extent=[20, 0; 45, 25]),
474          Ellipse(extent=[20, 25; 45, 50]),
475          Rectangle(extent=[33, -60; 72, 60], style(color=7, fillColor=7)),
476          Line(points=[32, 50; 90, 50]),
477          Line(points=[32, -50; 90, -50]),
478          Text(extent=[-100, 20; -58, -20], string="L1"),
479          Text(extent=[60, 20; 100, -20], string="L2"),
480          Text(extent=[-20, 20; 20, -20], string="M"),
481          Text(extent=[-80,-100; 80,-60], string="m=%m",
482            style(color=0, rgbcolor={0,0,0})),
483          Text(extent=[-100,50; 100,110], string="%name")),
484        Documentation(info="<HTML>
485<p>
486Contains m transformers (Modelica.Electrical.Analog.Basic.Transformer)
487</p>
488</HTML>"),
489        Diagram);
490    equation 
491     
492      connect(plug_p1.pin, transformer.p1) annotation (points=[-100, 100; -10,
493            100; -10, 5], style(
494          color=3,
495          fillColor=7,
496          fillPattern=1));
497      connect(plug_p2.pin, transformer.p2) annotation (points=[100, 100; 10,
498            100; 10, 5], style(
499          color=3,
500          fillColor=7,
501          fillPattern=1));
502      connect(plug_n1.pin, transformer.n1)