|
| 1 | +within OpenIPSL.Electrical.Sources; |
| 2 | +model CurrentSourceReImInput |
| 3 | + "Ideal current source with user defined real and imaginary parts of the current 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 absorbed by the Infinite bus"; |
| 8 | + Types.ReactivePower Q "Reactive Power absorbed by the Infinite bus"; |
| 9 | + OpenIPSL.Interfaces.PwPin p |
| 10 | + annotation (Placement(transformation(extent={{100,-10},{120,10}}))); |
| 11 | + Modelica.Blocks.Interfaces.RealInput iRe "Real Part of voltage phasor" |
| 12 | + annotation (Placement(transformation(extent={{-140,20},{-100,60}}))); |
| 13 | + Modelica.Blocks.Interfaces.RealInput iIm "Imaginary Part of Voltage Phasor" |
| 14 | + annotation (Placement(transformation(extent={{-140,-60},{-100,-20}}))); |
| 15 | +equation |
| 16 | + p.ir =iRe; |
| 17 | + p.ii =iIm; |
| 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(graphics={ Ellipse( |
| 23 | + extent={{-100,100},{100,-100}}, |
| 24 | + lineColor={0,0,0}, |
| 25 | + fillColor={213,255,170}, |
| 26 | + fillPattern=FillPattern.Solid), |
| 27 | + Text( |
| 28 | + extent={{-40,20},{40,-20}}, |
| 29 | + lineColor={0,0,0}, |
| 30 | + textString="%name"), |
| 31 | + Line(points={{-90,0},{-50,0}}, color={0,0,0}), |
| 32 | + Line(points={{50,0},{80,0}}, color={0,0,0}), |
| 33 | + Polygon( |
| 34 | + points={{70,10},{70,-10},{90,0},{70,10}}, |
| 35 | + lineColor={0,0,0}, |
| 36 | + fillColor={0,0,0}, |
| 37 | + fillPattern=FillPattern.Solid)}), Documentation(revisions="<html> |
| 38 | +<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"><tr> |
| 39 | +<td><p>Reference</p></td> |
| 40 | +<td><p>None.</p></td> |
| 41 | +</tr> |
| 42 | +<tr> |
| 43 | +<td><p>Last update</p></td> |
| 44 | +<td><p>2022-11-02 (First commit)</p></td> |
| 45 | +</tr> |
| 46 | +<tr> |
| 47 | +<td><p>Author</p></td> |
| 48 | +<td><p>Luigi Vanfretti, Rensselaer Polytechnic Institute</p></td> |
| 49 | +</tr> |
| 50 | +<tr> |
| 51 | +<td><p>Contact</p></td> |
| 52 | +<td><p>see <a href=\"modelica://OpenIPSL.UsersGuide.Contact\">UsersGuide.Contact</a></p></td> |
| 53 | +</tr> |
| 54 | +</table> |
| 55 | +</html>", info="<html> |
| 56 | +<p>This model allows the user to specify the voltage real and imaginary part 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 Modelica.Blocks.Sources with Real valued interfaces to be connected to the vRe and vIm real interfaces.</p> |
| 58 | +</html>")); |
| 59 | +end CurrentSourceReImInput; |
0 commit comments