Skip to content

Commit

Permalink
Merge from solar_models
Browse files Browse the repository at this point in the history
  • Loading branch information
Tin Rabuzin committed May 30, 2021
2 parents 950ceed + 4c42ca8 commit 4b969d6
Show file tree
Hide file tree
Showing 26 changed files with 319 additions and 627 deletions.
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
within OpenIPSL.Electrical.Solar.PowerFactory.DigSILENT.Auxiliary;
within OpenIPSL.Electrical.Solar.PowerFactory.DIgSILENT.Auxiliary;

model ActivePowerController
model ActivePowerController "Controller for the active power of a PV plant"
parameter Real K = 0.005 "Gain of the PI-Controller";
parameter SI.Time T=0.03 "Integration Time Constant of the PI controller";
parameter Types.Time T=0.03 "Integration Time Constant of the PI controller";
parameter Real yo_min "Minimum d-axis current";
parameter Real yo_max "Maximum d-axis current";
parameter SI.PerUnit id0 "Initial d-axis current";
parameter Types.PerUnit id0 "Initial d-axis current";
Modelica.Blocks.Interfaces.RealInput yi annotation(
Placement(visible = true, transformation(origin = {-160, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-100, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput yo annotation(
Placement(visible = true, transformation(origin = {170, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput pred annotation(
Placement(visible = true, transformation(origin = {-160, 70}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-100, 70}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Placement(visible = true, transformation(origin = {-160, 70}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-100, 60}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Continuous.LimIntegrator I(initType = Modelica.Blocks.Types.Init.InitialOutput,k = K / T, limitsAtInit = false,outMax = yo_max, outMin = yo_min, y_start = id0) if with_I annotation(
Placement(visible = true, transformation(origin = {-88, -20}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Sources.Constant disable(k = 0) if not with_I annotation(
Expand All @@ -30,7 +30,7 @@ model ActivePowerController
Placement(visible = true, transformation(origin = {60, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Nonlinear.Limiter limiter1(limitsAtInit = true, uMax = yo_max, uMin = yo_min) annotation(
Placement(visible = true, transformation(origin = {44, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
//protected
//protected
Modelica.Blocks.Interfaces.RealOutput yo1 annotation(
Placement(visible = true, transformation(origin = {78, -6}, extent = {{-10, -10}, {10, 10}}, rotation = 0), iconTransformation(origin = {88, -22}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput yo2 annotation(
Expand Down Expand Up @@ -75,7 +75,7 @@ equation
Line(points = {{78, -6}, {56, -6}, {56, -6}, {56, -6}}, color = {0, 0, 127}));
annotation(
Diagram(coordinateSystem(extent = {{-160, -160}, {160, 160}}), graphics = {Rectangle(origin = {24, 67}, pattern = LinePattern.Dash, extent = {{-94, 39}, {94, -39}}), Text(origin = {-27, 113}, extent = {{-47, 7}, {47, -7}}, textString = "Tracking yo1", horizontalAlignment = TextAlignment.Left), Line(origin = {-12, 70}, points = {{-6, 0}, {6, 0}, {6, 0}}, color = {255, 0, 0})}),
Icon(graphics = {Rectangle( lineColor = {0, 0, 127}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Line(origin = {50.106, -52.0451}, points = {{-80, -40}, {-80, -20}, {-6, 30}}, color = {0, 0, 127}), Polygon(origin = {50, -84}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{-80, 90}, {-88, 68}, {-72, 68}, {-80, 90}}), Line(origin = {50.175, -93.8248}, points = {{-80, 78}, {-80, 0}}, color = {192, 192, 192}), Line(origin = {40.2612, -7.74434}, points = {{-80, -80}, {30, -80}}, color = {192, 192, 192}), Polygon(origin = {2, -8}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{90, -80}, {68, -72}, {68, -88}, {90, -80}}), Text(origin = {18, -50.9032}, lineColor = {192, 192, 192}, extent = {{0, 2.90323}, {34, -27.0968}}, textString = "PI"), Text(origin = {6, 89}, extent = {{-56, 9}, {56, -9}}, textString = "Active Power Control"), Text(origin = {-50, 70}, extent = {{-30, 10}, {30, -10}}, textString = "pred"), Text(origin = {-58, 2}, extent = {{-30, 10}, {30, -10}}, textString = "yi"), Text(origin = {82, 2}, extent = {{-30, 10}, {30, -10}}, textString = "yo")}),
Icon(graphics = {Rectangle(lineColor = {118, 18, 62}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, -100}, {100, 100}}), Line(origin = {50.106, -52.0451}, points = {{-80, -40}, {-80, -20}, {-6, 30}}, color = {0, 0, 127}), Polygon(origin = {50, -84}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{-80, 90}, {-88, 68}, {-72, 68}, {-80, 90}}), Line(origin = {50.175, -93.8248}, points = {{-80, 78}, {-80, 0}}, color = {192, 192, 192}), Line(origin = {40.2612, -7.74434}, points = {{-80, -80}, {30, -80}}, color = {192, 192, 192}), Polygon(origin = {2, -8}, lineColor = {192, 192, 192}, fillColor = {192, 192, 192}, fillPattern = FillPattern.Solid, points = {{90, -80}, {68, -72}, {68, -88}, {90, -80}}), Text(origin = {18, -50.9032}, lineColor = {192, 192, 192}, extent = {{0, 2.90323}, {34, -27.0968}}, textString = "PI"), Text(origin = {-50, 60}, extent = {{-30, 10}, {30, -10}}, textString = "pred"), Text(origin = {-58, 2}, extent = {{-30, 10}, {30, -10}}, textString = "yi"), Text(origin = {82, 2}, extent = {{-30, 10}, {30, -10}}, textString = "yo"), Text(origin = {0, -10}, lineColor = {0, 0, 255}, extent = {{-100, 150}, {100, 110}}, textString = "%name")}),
Documentation(info = "<html>
<p>
This is essentially a PI controller whose output is reduced during the activation of FRT. PI from Modelica Standard Library was not used due to the specific implementation in PowerFactory which this model follows.
Expand All @@ -95,7 +95,7 @@ This is essentially a PI controller whose output is reduced during the activatio
</tr>
<tr>
<td><p>Author</p></td>
<td><p>Tin Rabuzin, KTH Royal Institute of Technology</p></td>
<td><p><a href=\"https://github.com/tinrabuzin\">@tinrabuzin</a></p></td>
</tr>
<tr>
<td><p>Contact</p></td>
Expand All @@ -105,10 +105,6 @@ This is essentially a PI controller whose output is reduced during the activatio
<td><p>Model Verification</p></td>
<td><p>This model has not been verified against PowerFactory.</p></td>
</tr>
<tr>
<td><p>Description</p></td>
<td><p></p></td>
</tr>
</table>
</html>"));
end ActivePowerController;
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
within OpenIPSL.Electrical.Solar.PowerFactory.DigSILENT.Auxiliary;
within OpenIPSL.Electrical.Solar.PowerFactory.DIgSILENT.Auxiliary;

model ReactivePowerSupport
parameter SI.PerUnit iq_max "Maximum d-axis current";
parameter SI.PerUnit iq_min "Minimum d-axis current";
model ReactivePowerSupport "Reactive power support for FRT"
parameter Types.PerUnit iq_max "Maximum d-axis current";
parameter Types.PerUnit iq_min "Minimum d-axis current";
parameter Boolean i_EEG "Selection of the FRT Charateristic";
parameter SI.PerUnit Deadband "Deadband for dynamic AC voltage support";
parameter Types.PerUnit Deadband "Deadband for dynamic AC voltage support";
parameter Real K_FRT "Gain for dynamic AC voltage supports";
parameter SI.PerUnit i0 "Initial reactive current";
parameter Types.PerUnit i0 "Initial reactive current";
Modelica.Blocks.Interfaces.RealInput duac annotation(
Placement(visible = true, transformation(origin = {-200, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-80, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealOutput iq annotation(
Expand All @@ -21,7 +21,7 @@ model ReactivePowerSupport
Placement(visible = true, transformation(origin = {-30, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Logical.GreaterEqualThreshold greaterEqualThreshold(threshold = 0) annotation(
Placement(visible = true, transformation(origin = {-70, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Abs abs1 annotation(
Modelica.Blocks.Math.Abs abs annotation(
Placement(visible = true, transformation(origin = {-110, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Nonlinear.DeadZone deadZone(deadZoneAtInit = true, uMax = Deadband, uMin = -Deadband) annotation(
Placement(visible = true, transformation(origin = {-158, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Expand All @@ -44,13 +44,13 @@ equation
Line(points = {{71, 0}, {86, 0}}, color = {255, 0, 255}));
connect(limiter.y, iq) annotation(
Line(points = {{193, 0}, {199, 0}, {199, 0}, {209, 0}}, color = {0, 0, 127}));
connect(greaterEqualThreshold.u, abs1.y) annotation(
connect(greaterEqualThreshold.u, abs.y) annotation(
Line(points = {{-82, 0}, {-100, 0}, {-100, 0}, {-98, 0}}, color = {0, 0, 127}));
connect(greaterEqualThreshold.y, picdro.condition) annotation(
Line(points = {{-59, 0}, {-41, 0}, {-41, 0}, {-39, 0}}, color = {255, 0, 255}));
connect(duac, deadZone.u) annotation(
Line(points = {{-200, 0}, {-172, 0}, {-172, 0}, {-170, 0}}, color = {0, 0, 127}));
connect(deadZone.y, abs1.u) annotation(
connect(deadZone.y, abs.u) annotation(
Line(points = {{-146, 0}, {-122, 0}, {-122, 0}, {-122, 0}}, color = {0, 0, 127}));
connect(FRT_characteristic_selection.y, add.u1) annotation(
Line(points = {{110, 0}, {120, 0}, {120, 6}, {128, 6}, {128, 6}}, color = {0, 0, 127}));
Expand Down Expand Up @@ -80,5 +80,36 @@ equation
Line(points = {{-38, -80}, {-176, -80}, {-176, 0}, {-200, 0}, {-200, 0}}, color = {0, 0, 127}));
annotation(
Diagram(coordinateSystem(extent = {{-200, -120}, {200, 120}}), graphics = {Rectangle(origin = {-92.8493, 0.111888}, pattern = LinePattern.Dash, extent = {{-85.0493, 19.7918}, {85.0493, -19.7918}}), Text(origin = {-67, 27}, extent = {{-55, 5}, {55, -5}}, textString = "Voltage deadband with delay"), Rectangle(origin = {-92.8493, 0.111888}, pattern = LinePattern.Dash, extent = {{-85.0493, 19.7918}, {85.0493, -19.7918}}), Rectangle(origin = {-34.5559, 68.6529}, pattern = LinePattern.Dash, extent = {{-42.6785, 15.9659}, {42.6785, -15.9659}}), Rectangle(origin = {-30.0177, -79.8509}, pattern = LinePattern.Dash, extent = {{-29.8565, 19.5166}, {29.8565, -19.5166}}), Text(origin = {-35, 90}, extent = {{-43, 4}, {43, -4}}, textString = "Transmission Code 2007"), Text(origin = {-21, -56}, extent = {{-21, 4}, {21, -4}}, textString = "SDLWindV")}),
Icon(graphics = {Rectangle(origin = {-0.01, 0}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-99.99, 100}, {99.99, -100}}), Text(origin = {3, 84}, extent = {{-83, 12}, {83, -12}}, textString = "Reactive Power Support"), Text(origin = {-33, 2}, extent = {{-83, 12}, {83, -12}}, textString = "duac"), Text(origin = {73, 2}, extent = {{-83, 12}, {83, -12}}, textString = "iq")}));
Icon(graphics = {Rectangle(origin = {-0.01, 0}, lineColor = {118, 18, 62}, fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-99.99, 100}, {99.99, -100}}), Text(origin = {-33, 2}, extent = {{-83, 12}, {83, -12}}, textString = "duac"), Text(origin = {73, 2}, extent = {{-83, 12}, {83, -12}}, textString = "iq"), Text(origin = {0, -10}, lineColor = {0, 0, 255}, extent = {{-100, 150}, {100, 110}}, textString = "%name")}),
Documentation(info = "<html>
<p>
Reactive power support for the DIgSILENT PV model.
</p>
</html>", revisions = "<html>
<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"><tr>
<td><p>Model Name</p></td>
<td><p>N/A</p></td>
</tr>
<tr>
<td><p>Reference</p></td>
<td><p>PowerFactory Implementation in Templates</p></td>
</tr>
<tr>
<td><p>Last update</p></td>
<td><p>January 2021</p></td>
</tr>
<tr>
<td><p>Author</p></td>
<td><p><a href=\"https://github.com/tinrabuzin\">@tinrabuzin</a></p></td>
</tr>
<tr>
<td><p>Contact</p></td>
<td><p>see <a href=\"modelica://OpenIPSL.UsersGuide.Contact\">UsersGuide.Contact</a></p></td>
</tr>
<tr>
<td><p>Model Verification</p></td>
<td><p>This model has not been verified against PowerFactory.</p></td>
</tr>
</table>
</html>"));
end ReactivePowerSupport;
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
within OpenIPSL.Electrical.Solar.PowerFactory.DigSILENT.Auxiliary;
within OpenIPSL.Electrical.Solar.PowerFactory.DIgSILENT.Auxiliary;

model SLDWindV
parameter SI.PerUnit Deadband "Deadband for dynamic AC voltage support";
model SLDWindV "Dynamic support during faults"
parameter Types.PerUnit Deadband "Deadband for dynamic AC voltage support";
parameter Real K_FRT "Gain for dynamic AC voltage supports";
Modelica.Blocks.Math.Add add1(k1 = -1, k2 = 1) annotation(
Modelica.Blocks.Math.Add add(k1 = -1, k2 = 1) annotation(
Placement(visible = true, transformation(origin = {-10, 40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Gain gain1(k = K_FRT) annotation(
Modelica.Blocks.Math.Gain gain(k = K_FRT) annotation(
Placement(visible = true, transformation(origin = {80, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Product product annotation(
Placement(visible = true, transformation(origin = {40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Expand All @@ -22,28 +22,59 @@ model SLDWindV
Modelica.Blocks.Nonlinear.Limiter limiter(limitsAtInit = true, uMax = Modelica.Constants.inf, uMin = Deadband) annotation(
Placement(visible = true, transformation(origin = {-30, -30}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
equation
connect(product.y, gain1.u) annotation(
connect(product.y, gain.u) annotation(
Line(points = {{51, 0}, {68, 0}}, color = {0, 0, 127}));
connect(duac_abs.u, duac) annotation(
Line(points = {{-72, 0}, {-100, 0}}, color = {0, 0, 127}));
connect(gain1.y, diq) annotation(
connect(gain.y, diq) annotation(
Line(points = {{91, 0}, {110, 0}}, color = {0, 0, 127}));
connect(add1.u1, const.y) annotation(
connect(add.u1, const.y) annotation(
Line(points = {{-22, 46}, {-35, 46}, {-35, 50}, {-48, 50}}, color = {0, 0, 127}));
connect(add1.u2, duac_abs.y) annotation(
connect(add.u2, duac_abs.y) annotation(
Line(points = {{-22, 34}, {-40, 34}, {-40, 0}, {-48, 0}, {-48, 0}}, color = {0, 0, 127}));
connect(division.u2, limiter.y) annotation(
Line(points = {{-14, -36}, {-18, -36}, {-18, -30}}, color = {0, 0, 127}));
connect(division.u1, duac) annotation(
Line(points = {{-14, -24}, {-18, -24}, {-18, -14}, {-78, -14}, {-78, 0}, {-100, 0}}, color = {0, 0, 127}));
connect(division.y, product.u2) annotation(
Line(points = {{9, -30}, {20, -30}, {20, -6}, {28, -6}}, color = {0, 0, 127}));
connect(product.u1, add1.y) annotation(
connect(product.u1, add.y) annotation(
Line(points = {{28, 6}, {20, 6}, {20, 40}, {2, 40}, {2, 40}}, color = {0, 0, 127}));
connect(limiter.u, duac_abs.y) annotation(
Line(points = {{-42, -30}, {-46, -30}, {-46, 0}, {-48, 0}, {-48, 0}}, color = {0, 0, 127}));

annotation(
Diagram,
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {73, 2}, extent = {{-83, 12}, {83, -12}}, textString = "diq"), Text(origin = {-33, 2}, extent = {{-83, 12}, {83, -12}}, textString = "duac"), Text(origin = {3, 84}, extent = {{-83, 12}, {83, -12}}, textString = "SLDWindV")}));
Icon(graphics = {Rectangle(lineColor = {118, 18, 62},fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {73, 2}, extent = {{-83, 12}, {83, -12}}, textString = "diq"), Text(origin = {-33, 2}, extent = {{-83, 12}, {83, -12}}, textString = "duac"), Text(origin = {0, -10}, lineColor = {0, 0, 255}, extent = {{-100, 150}, {100, 110}}, textString = "%name")}),
Documentation(info = "<html>
<p>
A fault ride through implementation for reactive power support.
</p>
</html>", revisions = "<html>
<table cellspacing=\"1\" cellpadding=\"1\" border=\"1\"><tr>
<td><p>Model Name</p></td>
<td><p>SLDWindV</p></td>
</tr>
<tr>
<td><p>Reference</p></td>
<td><p>PowerFactory Implementation in Templates</p></td>
</tr>
<tr>
<td><p>Last update</p></td>
<td><p>January 2021</p></td>
</tr>
<tr>
<td><p>Author</p></td>
<td><p><a href=\"https://github.com/tinrabuzin\">@tinrabuzin</a></p></td>
</tr>
<tr>
<td><p>Contact</p></td>
<td><p>see <a href=\"modelica://OpenIPSL.UsersGuide.Contact\">UsersGuide.Contact</a></p></td>
</tr>
<tr>
<td><p>Model Verification</p></td>
<td><p>This model has not been verified against PowerFactory.</p></td>
</tr>
</table>
</html>"));
end SLDWindV;
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
within OpenIPSL.Electrical.Solar.PowerFactory.DigSILENT;
within OpenIPSL.Electrical.Solar.PowerFactory.DIgSILENT;
package Auxiliary
extends Modelica.Icons.Package;

Expand Down
Loading

0 comments on commit 4b969d6

Please sign in to comment.