Skip to content

Commit 596b48d

Browse files
authored
Merge pull request OpenIPSL#319 from OpenIPSL/IdealVSource
Ideal Current Source Model
2 parents 697d357 + 6e3449e commit 596b48d

4 files changed

Lines changed: 101 additions & 0 deletions

File tree

Lines changed: 59 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,59 @@
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;
Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1 +1,2 @@
11
VoltageSourceReImInput
2+
CurrentSourceReImInput
Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
within OpenIPSL.Tests.Sources;
2+
model CurrentSourceReImInputConstant
3+
"Test model for the VoltageSourceReImInput model with constant input"
4+
extends BaseClasses.SMIB;
5+
Modelica.Blocks.Sources.Constant vRe(k=1)
6+
annotation (Placement(transformation(extent={{-96,14},{-84,26}})));
7+
Modelica.Blocks.Sources.Constant vIm(k=0)
8+
annotation (Placement(transformation(extent={{-96,-26},{-84,-14}})));
9+
Electrical.Sources.CurrentSourceReImInput iSource
10+
annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
11+
equation
12+
connect(iSource.p, GEN1.p)
13+
annotation (Line(points={{-39,0},{-30,0}}, color={0,0,255}));
14+
connect(iSource.iRe, vRe.y) annotation (Line(points={{-62,4},{-72,4},{-72,20},{-83.4,20}},
15+
color={0,0,127}));
16+
connect(iSource.iIm, vIm.y) annotation (Line(points={{-62,-4},{-72,-4},{-72,-20},{-83.4,-20}},
17+
color={0,0,127}));
18+
annotation (experiment(StopTime=10, __Dymola_Algorithm="Dassl"),
19+
Documentation(info="<html>
20+
<p>This model shows how to use the component in <code>Electrical.Sources.CurrentSourceReImInput</code> with user specified <strong>constant real and imaginary parts</strong> of the current phasor of the source.</p>
21+
</html>", revisions="<html>
22+
<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"><tr>
23+
<td><p>Reference</p></td>
24+
<td><p>None.</p></td>
25+
</tr>
26+
<tr>
27+
<td><p>Last update</p></td>
28+
<td><p>2022-11-02 (First commit)</p></td>
29+
</tr>
30+
<tr>
31+
<td><p>Author</p></td>
32+
<td><p>Luigi Vanfretti, Rensselaer Polytechnic Institute</p></td>
33+
</tr>
34+
<tr>
35+
<td><p>Contact</p></td>
36+
<td><p>see <a href=\"modelica://OpenIPSL.UsersGuide.Contact\">UsersGuide.Contact</a></p></td>
37+
</tr>
38+
</table>
39+
</html>"));
40+
end CurrentSourceReImInputConstant;

OpenIPSL/Tests/Sources/package.order

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,4 @@ VoltageSourceReImInputConstant
22
VoltageSourceReImInputVaryReal
33
VoltageSourceReImInputVaryImag
44
VoltageSourceReImInputVaryRealAndImag
5+
CurrentSourceReImInputConstant

0 commit comments

Comments
 (0)