|
| 1 | +within OpenIPSL.Electrical.Sources; |
| 2 | +model VoltageSourceReImInput |
| 3 | + "Ideal voltage source with user defined real and imaginary parts of the voltage phasor" |
| 4 | + extends OpenIPSL.Electrical.Essentials.pfComponent(enableS_b=true); |
| 5 | + Types.Angle angle "Bus voltage angle"; |
| 6 | + Types.Voltage v "Bus voltage magnitude"; |
| 7 | + Types.ActivePower P "Active power"; |
| 8 | + Types.ReactivePower Q "Reactive power"; |
| 9 | + OpenIPSL.Interfaces.PwPin p |
| 10 | + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); |
| 11 | + Modelica.Blocks.Interfaces.RealInput vRe "Real part of voltage phasor" |
| 12 | + annotation (Placement(transformation(extent={{-140,20},{-100,60}}))); |
| 13 | + Modelica.Blocks.Interfaces.RealInput vIm "Imaginary part of voltage Phasor" |
| 14 | + annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}))); |
| 15 | +equation |
| 16 | + p.vr = vRe; |
| 17 | + p.vi = vIm; |
| 18 | + v = sqrt(p.vr^2 + p.vi^2); |
| 19 | + angle = atan2(p.vi, p.vr); |
| 20 | + P = -(p.vr*p.ir + p.vi*p.ii)*S_b; |
| 21 | + Q = -(p.vr*p.ii - p.vi*p.ir)*S_b; |
| 22 | + annotation(Icon( |
| 23 | + graphics={ Ellipse( |
| 24 | + extent={{-100,100},{100,-100}}, |
| 25 | + lineColor={0,0,0}, |
| 26 | + fillColor={213,255,170}, |
| 27 | + fillPattern=FillPattern.Solid),Line( |
| 28 | + points={{-20,20},{-50,40},{-80,0}}, |
| 29 | + color={0,0,0}, |
| 30 | + thickness=0.5), Line( |
| 31 | + points={{20,-20},{50,-40},{80,0}}, |
| 32 | + color={0,0,0}, |
| 33 | + thickness=0.5),Text( |
| 34 | + extent={{-40,20},{40,-20}}, |
| 35 | + lineColor={0,0,0}, |
| 36 | + textString="%name")}), Documentation(revisions="<html> |
| 37 | +<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"><tr> |
| 38 | +<td><p>Reference</p></td> |
| 39 | +<td><p>None.</p></td> |
| 40 | +</tr> |
| 41 | +<tr> |
| 42 | +<td><p>Last update</p></td> |
| 43 | +<td><p>2022-11-01 (First commit)</p></td> |
| 44 | +</tr> |
| 45 | +<tr> |
| 46 | +<td><p>Author</p></td> |
| 47 | +<td><p>Luigi Vanfretti, Rensselaer Polytechnic Institute</p></td> |
| 48 | +</tr> |
| 49 | +<tr> |
| 50 | +<td><p>Contact</p></td> |
| 51 | +<td><p>see <a href=\"modelica://OpenIPSL.UsersGuide.Contact\">UsersGuide.Contact</a></p></td> |
| 52 | +</tr> |
| 53 | +</table> |
| 54 | +</html>", info="<html> |
| 55 | +<p>This model allows the user to specify the voltage real and imaginary part |
| 56 | +of the voltage phasor of an ideal voltage source.</p> |
| 57 | +<p>The value of each part of the phasor have to be provided through sources from |
| 58 | +<code>Modelica.Blocks.Sources</code> with Real valued interfaces to be connected to |
| 59 | +the <code>vRe</code> and <code>vIm</code> real interfaces.</p> |
| 60 | +</html>")); |
| 61 | +end VoltageSourceReImInput; |
0 commit comments