Skip to content

Commit

Permalink
#3253 Add the 2015 version of the IEC WPP models
Browse files Browse the repository at this point in the history
Signed-off-by: GARBAY Louis <garbaylou@gm0winl417.bureau.si.interne>
  • Loading branch information
GARBAY Louis committed Jun 18, 2024
1 parent f3a4524 commit 505e3b6
Show file tree
Hide file tree
Showing 102 changed files with 14,495 additions and 704 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
within Dynawo.Electrical.Controls.IEC.BaseClasses;

/*
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* See AUTHORS.txt
* All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of Dynawo, an hybrid C++/Modelica open source suite of simulation tools for power systems.
*/

model BaseWPPControl
extends Dynawo.Electrical.Controls.IEC.Parameters.PControlParameters;
extends Dynawo.Electrical.Controls.IEC.Parameters.QControlParameters;

//Nominal parameters
parameter Types.ApparentPowerModule SNom "Nominal converter apparent power in MVA";
parameter Types.Time tS "Integration time step in s";

//PControl parameters
parameter Types.PerUnit DPRefMaxPu "Maximum positive ramp rate for PD power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPRefMinPu "Minimum negative ramp rate for PD power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPwpRefMaxPu "Maximum positive ramp rate for WP power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPwpRefMinPu "Minimum negative ramp rate for WP power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit Kiwpp "Power PI controller integration gain in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit Kpwpp "Power PI controller proportional gain in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit KwppRef "Power reference gain in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PKiwppMaxPu "Maximum active power reference from integration in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PKiwppMinPu "Minimum active power reference from integration in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PRefMaxPu "Maximum PD power reference in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PRefMinPu "Minimum PD power reference in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));

//QControl parameters
parameter Types.PerUnit DXRefMaxPu "Maximum positive ramp rate for WT reactive power or voltage reference in pu/s (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit DXRefMinPu "Minimum negative ramp rate for WT reactive power or voltage reference in pu/s (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit Kiwpx "Reactive power or voltage PI controller integral gain in pu/s (base SNom)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit Kpwpx "Reactive power or voltage PI controller proportional gain in pu (base SNom)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit KwpqRef "Reactive power reference gain in pu (base SNom)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit Kwpqu "Voltage controller cross coupling gain in pu (base SNom)" annotation(
Dialog(tab = "QControlWP"));
parameter Integer MwpqMode "Control mode (0 : reactive power reference, 1 : power factor reference, 2 : UQ static, 3 : voltage control)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.Time tUqFilt "Time constant for the UQ static mode in s" annotation(
Dialog(tab = "QControlWP"));
parameter Types.VoltageModulePu UwpqDipPu "Voltage threshold for UVRT detection in pu (base UNom)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit XRefMaxPu "Maximum WT reactive power or voltage reference in pu (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "QControlWP"));
parameter Types.PerUnit XRefMinPu "Minimum WT reactive power or voltage reference in pu (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "QControlWP"));

//Input variables
Modelica.ComplexBlocks.Interfaces.ComplexInput iPu(re(start = -i0Pu.re * SystemBase.SnRef / SNom), im(start = -i0Pu.im * SystemBase.SnRef / SNom)) "Complex current at grid terminal in pu (base UNom, SNom) (generator convention)" annotation(
Placement(visible = true, transformation(origin = {-200, -60}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -50}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput omegaRefPu(start = SystemBase.omegaRef0Pu) "Grid angular frequency in pu (base omegaNom)" annotation(
Placement(visible = true, transformation(origin = {-200, -100}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Interfaces.RealInput PWPRefPu(start = -P0Pu * SystemBase.SnRef / SNom) "Reference active power in pu (base SNom) (generator convention)" annotation(
Placement(visible = true, transformation(origin = {-200, 86}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, 90}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.ComplexBlocks.Interfaces.ComplexInput uPu(re(start = u0Pu.re), im(start = u0Pu.im)) "Complex voltage at grid terminal in pu (base UNom)" annotation(
Placement(visible = true, transformation(origin = {-200, 0}, extent = {{-20, -20}, {20, 20}}, rotation = 0), iconTransformation(origin = {-110, -10}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

Modelica.Blocks.Interfaces.RealOutput y(start = -P0Pu * SystemBase.SnRef / SNom) annotation(
Placement(visible = false, transformation(origin = {-8, -56}, extent = {{-4, -4}, {4, 4}}, rotation = 0)));

//Initial parameters
parameter Types.ComplexCurrentPu i0Pu "Initial complex current at grid terminal in pu (base UNom, SnRef) (receptor convention)" annotation(
Dialog(group="Initialization"));
parameter Types.ActivePowerPu P0Pu "Initial active power at grid terminal in pu (base SnRef) (receptor convention)" annotation(
Dialog(tab = "Operating point"));
parameter Types.ReactivePowerPu Q0Pu "Initial reactive power at grid terminal in pu (base SnRef) (receptor convention)" annotation(
Dialog(tab = "Operating point"));
parameter Types.VoltageModulePu U0Pu "Initial voltage amplitude at grid terminal in pu (base UNom)" annotation(
Dialog(tab = "Operating point"));
parameter Types.ComplexVoltagePu u0Pu "Initial complex voltage at grid terminal in pu (base UNom)" annotation(
Dialog(group="Initialization"));
parameter Types.Angle UPhase0 "Initial voltage angle at grid terminal in rad" annotation(
Dialog(tab = "Operating point"));
parameter Types.PerUnit X0Pu "Initial reactive power or voltage reference at grid terminal in pu (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "Operating point"));
parameter Types.PerUnit XWT0Pu "Initial reactive power or voltage reference at grid terminal in pu (base SNom or UNom) (generator convention)" annotation(
Dialog(tab = "Operating point"));

equation

annotation(
preferredView = "diagram",
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {-65, 110}, extent = {{-35, 26}, {167, -132}}, textString = "WP control and"), Text(origin = {-68, 58}, extent = {{-36, 28}, {172, -140}}, textString = "communication"), Text(origin = {-23, -64}, extent = {{-41, 26}, {87, -6}}, textString = "module")}),
Diagram(coordinateSystem(extent = {{-180, -120}, {180, 120}})));
end BaseWPPControl;
Original file line number Diff line number Diff line change
@@ -0,0 +1,81 @@
within Dynawo.Electrical.Controls.IEC.BaseClasses;

/*
* Copyright (c) 2024, RTE (http://www.rte-france.com)
* See AUTHORS.txt
* All rights reserved.
* This Source Code Form is subject to the terms of the Mozilla Public
* License, v. 2.0. If a copy of the MPL was not distributed with this
* file, you can obtain one at http://mozilla.org/MPL/2.0/.
* SPDX-License-Identifier: MPL-2.0
*
* This file is part of Dynawo, an hybrid C++/Modelica open source suite of simulation tools for power systems.
*/

model BaseWPPPControl
extends Dynawo.Electrical.Controls.IEC.Parameters.PControlParameters;

//Nominal parameter
parameter Types.ApparentPowerModule SNom "Nominal converter apparent power in MVA";
parameter Types.Time tS "Integration time step in s";

//PControl parameters
parameter Types.PerUnit DPRefMaxPu "Maximum positive ramp rate for PD power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPRefMinPu "Minimum negative ramp rate for PD power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPwpRefMaxPu "Maximum positive ramp rate for WP power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit DPwpRefMinPu "Minimum negative ramp rate for WP power reference in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit Kiwpp "Power PI controller integration gain in pu/s (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit Kpwpp "Power PI controller proportional gain in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.PerUnit KwppRef "Power reference gain in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PKiwppMaxPu "Maximum active power reference from integration in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PKiwppMinPu "Minimum active power reference from integration in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PRefMaxPu "Maximum PD power reference in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));
parameter Types.ActivePowerPu PRefMinPu "Minimum PD power reference in pu (base SNom)" annotation(
Dialog(tab = "PControlWP"));

Modelica.Blocks.Tables.CombiTable1Ds combiTable1Ds(table = TablePwpBiasfwpFiltCom) annotation(
Placement(visible = true, transformation(origin = {-102, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Feedback feedback annotation(
Placement(visible = true, transformation(origin = {-40, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Gain gain(k = KwppRef) annotation(
Placement(visible = true, transformation(origin = {10, 80}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Gain gain1(k = Kpwpp) annotation(
Placement(visible = true, transformation(origin = {50, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Modelica.Blocks.Math.Add3 add31 annotation(
Placement(visible = true, transformation(origin = {90, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Dynawo.NonElectrical.Blocks.Continuous.AntiWindupIntegrator antiWindupIntegrator(DyMax = DPRefMaxPu, DyMin = DPRefMinPu, Y0 = (KwppRef - 1) * P0Pu * SystemBase.SnRef / SNom, YMax = PKiwppMaxPu, YMin = PKiwppMinPu, tI = if Kiwpp > 1e-5 then 1 / Kiwpp else 1 / Modelica.Constants.eps) annotation(
Placement(visible = true, transformation(origin = {50, -40}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));
Dynawo.NonElectrical.Blocks.Continuous.AbsLimRateLimFeedthroughFreezeLimDetection absLimRateLimFeedthroughFreezeLimDetection(DyMax = 999, DyMin = -999, U0 = -P0Pu * SystemBase.SnRef / SNom, Y0 = -P0Pu * SystemBase.SnRef / SNom, YMax = PRefMaxPu, YMin = PRefMinPu, tS = tS) annotation(
Placement(visible = true, transformation(origin = {130, 0}, extent = {{-10, 10}, {10, -10}}, rotation = 0)));
Dynawo.NonElectrical.Blocks.NonLinear.RampLimiter rampLimiter(DuMax = DPwpRefMaxPu, DuMin = DPwpRefMinPu, Y0 = -P0Pu * SystemBase.SnRef / SNom, tS = tS) annotation(
Placement(visible = true, transformation(origin = {-130, 0}, extent = {{-10, -10}, {10, 10}}, rotation = 0)));

//Initial parameter
parameter Types.ActivePowerPu P0Pu "Initial active power at grid terminal in pu (base SnRef) (receptor convention)" annotation(
Dialog(tab = "Operating point"));

equation
connect(gain1.y, add31.u2) annotation(
Line(points = {{62, 0}, {78, 0}}, color = {0, 0, 127}));
connect(gain.y, add31.u1) annotation(
Line(points = {{22, 80}, {70, 80}, {70, 8}, {78, 8}}, color = {0, 0, 127}));
connect(antiWindupIntegrator.y, add31.u3) annotation(
Line(points = {{62, -40}, {70, -40}, {70, -8}, {78, -8}}, color = {0, 0, 127}));
connect(add31.y, absLimRateLimFeedthroughFreezeLimDetection.u) annotation(
Line(points = {{102, 0}, {120, 0}}, color = {0, 0, 127}));

annotation(
preferredView = "diagram",
Diagram(coordinateSystem(extent = {{-160, -100}, {160, 100}})),
Icon(graphics = {Rectangle(fillColor = {255, 255, 255}, fillPattern = FillPattern.Solid, extent = {{-100, 100}, {100, -100}}), Text(origin = {44, 50}, extent = {{-86, 52}, {-2, 6}}, textString = "WP"), Text(origin = {-10, 26}, extent = {{-94, 60}, {116, -54}}, textString = "PControl"), Text(origin = {22, -66}, extent = {{-94, 60}, {48, 12}}, textString = "Module")}));
end BaseWPPPControl;
Loading

0 comments on commit 505e3b6

Please sign in to comment.