From 2d101c98966b2c9ab3f36f052c7ee75c9d86929d Mon Sep 17 00:00:00 2001 From: Fernando Fachini <60016000+fachif@users.noreply.github.com> Date: Mon, 8 Jan 2024 09:22:25 -0500 Subject: [PATCH] Updated Models New Models of the Microgrid --- .../Electrical/Renewables/PSSE/AddOnBlocks.mo | 16 +- OpenIPSL/Examples/ModelPredictiveControl.mo | 5425 +++++++++++++++-- OpenIPSL/Examples/OpenCPS/Generators/G1.mo | 2 +- 3 files changed, 5064 insertions(+), 379 deletions(-) diff --git a/OpenIPSL/Electrical/Renewables/PSSE/AddOnBlocks.mo b/OpenIPSL/Electrical/Renewables/PSSE/AddOnBlocks.mo index 1777ccd9a..1330246b0 100644 --- a/OpenIPSL/Electrical/Renewables/PSSE/AddOnBlocks.mo +++ b/OpenIPSL/Electrical/Renewables/PSSE/AddOnBlocks.mo @@ -3,9 +3,10 @@ package AddOnBlocks "This package contains additional add ons that can be added to the original renewable models." model IrradianceToPower "PV Array Power Output from Irradiance." - parameter Modelica.Units.SI.ActivePower Ypv = 1000 "Rated capacity of the PV array"; - parameter Modelica.Units.SI.Temperature Tcstc = 25 "PV cell temperature under standard test conditions"; - parameter Real fpv = 0.9 "PV derating factor"; + parameter Modelica.Units.SI.ActivePower Ypv = 5 "Rated capacity of the PV array"; + parameter Modelica.Units.SI.ApparentPower Sb = 100 "System Apparent Power [MW]"; + parameter Modelica.Units.SI.Temperature Tcstc = 298.15 "PV cell temperature under standard test conditions"; + parameter Real fpv = 1 "PV derating factor"; parameter Real ap = -0.48 "Temperature coefficient of power"; parameter Modelica.Units.SI.RadiantEnergyFluenceRate Gtstc = 1000; @@ -14,9 +15,12 @@ package AddOnBlocks Modelica.Blocks.Interfaces.RealOutput Ppv annotation (Placement(transformation(extent={{100,-10},{120,10}}))); - Modelica.Blocks.Sources.CombiTimeTable SolarRadiation + Modelica.Blocks.Sources.CombiTimeTable SolarRadiation(table=[0.0,666.6667; + 10,666.6667; 10.1,666.6667; 20,666.6667; 20.01,333.334; 30,333.334; + 30.1,333.334; 40,333.334; 40.1,0; 50,0; 50.1,0; 60,0]) annotation (Placement(transformation(extent={{-80,40},{-60,60}}))); - Modelica.Blocks.Sources.CombiTimeTable SolarArrayTemperature + Modelica.Blocks.Sources.CombiTimeTable SolarArrayTemperature(table=[0.0, + 298.15; 60,298.15]) annotation (Placement(transformation(extent={{-80,-60},{-60,-40}}))); @@ -24,7 +28,7 @@ package AddOnBlocks equation - Ppv = Ypv*fpv*(SolarRadiation.y[1]/Gtstc)*(1 + ap*(SolarArrayTemperature.y[1] - Tcstc)); + Ppv = (Ypv/Sb)*fpv*(SolarRadiation.y[1]/Gtstc)*(1 + ap*(SolarArrayTemperature.y[1] - Tcstc)); annotation (Icon(coordinateSystem(preserveAspectRatio=false), graphics={ Rectangle(extent={{-100,100},{100,-100}}, lineColor={28,108,200}), diff --git a/OpenIPSL/Examples/ModelPredictiveControl.mo b/OpenIPSL/Examples/ModelPredictiveControl.mo index ceeed2a89..c2e663119 100644 --- a/OpenIPSL/Examples/ModelPredictiveControl.mo +++ b/OpenIPSL/Examples/ModelPredictiveControl.mo @@ -11246,6 +11246,7 @@ package ModelPredictiveControl parameter Boolean equivalentGRID = true; parameter Boolean equivalentsystem = false; + parameter Real set = 0; OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= powerFlow.powerflow.bus.A1) if not equivalentGRID @@ -11352,10 +11353,11 @@ package ModelPredictiveControl v_0=powerFlow.powerflow.bus.V3, angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID annotation (Placement(transformation(extent={{-20,48},{0,68}}))); - Electrical.Events.Breaker breaker(enableTrigger=false, + Electrical.Events.Breaker circuitbreaker( + enableTrigger=false, t_o=0.25, rc_enabled=true, - t_rc=10000) if not equivalentGRID annotation (Placement(transformation( + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( extent={{-4,-4},{4,4}}, rotation=90, origin={80,26}))); @@ -11587,6 +11589,11 @@ package ModelPredictiveControl annotation (Placement(transformation(extent={{184,10},{204,30}}))); Modelica.Blocks.Interfaces.RealOutput OUT25 annotation (Placement(transformation(extent={{184,-10},{204,10}}))); + + + Modelica.Blocks.Sources.BooleanConstant booleanConstant(k=if set == 0 then false + else true) + annotation (Placement(transformation(extent={{-210,30},{-190,50}}))); equation OUT1 = G2.gen.w; @@ -11641,10 +11648,10 @@ package ModelPredictiveControl annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); connect(L3.p, Bus4.p) annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); - connect(breaker.s, Bus5.p) - annotation (Line(points={{80,22},{80,16}},color={0,0,255})); - connect(breaker.r, L3.n) - annotation (Line(points={{80,30},{80,54.6}},color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, color={0,0,127})); connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, @@ -11773,9 +11780,11 @@ package ModelPredictiveControl "THIS ONE IS STABLE, CONTROLLABLE, OBSERVABLE!!!!!!!" extends Modelica.Icons.Example; - parameter Boolean equivalentGRID = false; + parameter Boolean equivalentGRID = true; parameter Boolean equivalentsystem = false; + parameter Real cbbb = 0; + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= powerFlow.powerflow.bus.A1) if not equivalentGRID annotation (Placement(transformation(extent={{-90,70},{-70,90}}))); @@ -11881,7 +11890,8 @@ package ModelPredictiveControl v_0=powerFlow.powerflow.bus.V3, angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID annotation (Placement(transformation(extent={{-20,48},{0,68}}))); - Electrical.Events.Breaker breaker(enableTrigger=false, + Electrical.Events.Breaker breaker( + enableTrigger=true, t_o=10, rc_enabled=true, t_rc=10000) if not equivalentGRID annotation (Placement(transformation( @@ -12087,6 +12097,11 @@ package ModelPredictiveControl Modelica.Blocks.Sources.CombiTimeTable combiTimeTable4(table=[0,0; 0.5, 0; 0.51,0.1; 5,0.1], smoothness=Modelica.Blocks.Types.Smoothness.ConstantSegments) annotation (Placement(transformation(extent={{-122,-120},{-102,-100}}))); + + Modelica.Blocks.Interfaces.BooleanInput Trigger1 + annotation (Placement(transformation(extent={{-126,8},{-86,48}}))); + initial equation + booleanexpression.y = if cbbb == 0 then false else true; equation OUT1 = G2.gen.w; @@ -12201,6 +12216,8 @@ package ModelPredictiveControl color={0,0,127})); connect(combiTimeTable2.y[1], PV.Qref) annotation (Line(points={{-101, -38},{-50,-38},{-50,-56},{-42,-56}}, color={0,0,127})); + connect(breaker.Trigger, Trigger1) annotation (Line(points={{75.2,28},{ + 75.2,36},{-80,36},{-80,28},{-106,28}}, color={255,0,255})); annotation(Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-140,-140},{140,140}}), graphics={ Rectangle( @@ -13633,6 +13650,9 @@ package ModelPredictiveControl parameter Boolean equivalentGRID = false; parameter Boolean equivalentsystem = false; + parameter Real set = 0; + + OpenIPSL.Electrical.Buses.Bus Bus1(v_0=powerFlow.powerflow.bus.V1, angle_0= powerFlow.powerflow.bus.A1) if not equivalentGRID @@ -13739,10 +13759,11 @@ package ModelPredictiveControl v_0=powerFlow.powerflow.bus.V3, angle_0=powerFlow.powerflow.bus.A3) if not equivalentGRID annotation (Placement(transformation(extent={{-20,48},{0,68}}))); - Electrical.Events.Breaker breaker(enableTrigger=false, - t_o=0.25, - rc_enabled=false, - t_rc=80.01) if not equivalentGRID annotation (Placement(transformation( + Electrical.Events.Breaker circuitbreaker( + enableTrigger=true, + t_o=0.55, + rc_enabled=true, + t_rc=1000) if not equivalentGRID annotation (Placement(transformation( extent={{-4,-4},{4,4}}, rotation=90, origin={80,26}))); @@ -13808,7 +13829,7 @@ package ModelPredictiveControl amplitude=0.01, f=1/260, phase=3.1415926535898, - startTime=1000) + startTime=5) annotation (Placement(transformation(extent={{70,-36},{80,-26}}))); Electrical.Buses.Bus Bus10(v_0=powerFlow.powerflow.bus.V10, angle_0=powerFlow.powerflow.bus.A10) @@ -13829,7 +13850,8 @@ package ModelPredictiveControl extent={{-10,-10},{10,10}}, rotation=180, origin={10,-90}))); - GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl PV( + GenerationUnits.PSSE.Solar_Units.SolarMPCLocalVQControl_ADD_ON + PV( V_b=480, P_0=powerFlow.powerflow.machines.PPV, enableP_0=true, @@ -13918,7 +13940,7 @@ package ModelPredictiveControl B=0) annotation (Placement(transformation(extent={{38,-94}, {50,-86}}))); Modelica.Blocks.Math.Add add - annotation (Placement(transformation(extent={{84,-18},{92,-10}}))); + annotation (Placement(transformation(extent={{84,-16},{92,-8}}))); Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection( active_sigma=0.0002, samplePeriod=0.02) annotation (Placement(transformation(extent={{64,-18},{76,-6}}))); @@ -13981,7 +14003,7 @@ package ModelPredictiveControl annotation (Placement(transformation(extent={{340,-100},{360,-80}}))); NonElectrical.Continuous.SimpleLag simpleLag1( K=1, - T=0.1, + T=0.001, y_start=powerFlow.powerflow.bus.A5) annotation (Placement(transformation(extent={{300,-120},{320,-100}}))); Modelica.Blocks.Interfaces.RealOutput OUT25 "Connector of Real output signal" @@ -14147,6 +14169,30 @@ package ModelPredictiveControl annotation (Placement(transformation(extent={{340,-40},{360,-20}}))); Modelica.Blocks.Interfaces.RealOutput OUT22 annotation (Placement(transformation(extent={{340,-60},{360,-40}}))); + Electrical.Renewables.PSSE.AddOnBlocks.IrradianceToPower + irradianceToPower( + Ypv(displayUnit="MW") = 3000000, + Sb(displayUnit="MV.A") = 100000000, + Tcstc(displayUnit="K") = 298.15, + fpv=1, + ap=-0.48, + Gtstc=1000) + annotation (Placement(transformation(extent={{44,-20},{34,-10}}))); + Electrical.Loads.NoiseInjections.WhiteNoiseInjection whiteNoiseInjection1( + active_sigma=0.0001, samplePeriod=1) + annotation (Placement(transformation(extent={{-6,-6},{6,6}}, + rotation=180, + origin={36,-30}))); + Modelica.Blocks.Math.Add add1 + annotation (Placement(transformation(extent={{-4,-4},{4,4}}, + rotation=180, + origin={18,-28}))); + Modelica.Blocks.MathBoolean.Or or1(nu=2) + annotation (Placement(transformation(extent={{-210,36},{-198,48}}))); + Modelica.Blocks.Interfaces.BooleanInput u + annotation (Placement(transformation(extent={{-272,-24},{-232,16}}))); + Modelica.Blocks.Sources.BooleanConstant booleanConstant(k= if set == 0 then false else true) + annotation (Placement(transformation(extent={{-252,40},{-232,60}}))); equation connect(T1.p, Bus2.p) @@ -14171,10 +14217,10 @@ package ModelPredictiveControl annotation (Line(points={{-10,68},{-10,80},{0,80}}, color={0,0,255})); connect(L3.p, Bus4.p) annotation (Line(points={{80,65.4},{80,80},{60,80}}, color={0,0,255})); - connect(breaker.s, Bus5.p) - annotation (Line(points={{80,22},{80,16}},color={0,0,255})); - connect(breaker.r, L3.n) - annotation (Line(points={{80,30},{80,54.6}},color={0,0,255})); + connect(circuitbreaker.s, Bus5.p) + annotation (Line(points={{80,22},{80,16}}, color={0,0,255})); + connect(circuitbreaker.r, L3.n) + annotation (Line(points={{80,30},{80,54.6}}, color={0,0,255})); connect(IN11.y, AddU1.u2) annotation (Line(points={{-95.4,4},{-82,4}}, color={0,0,127})); connect(IN1, AddU1.u1) annotation (Line(points={{-150,10},{-116,10},{-116,16}, @@ -14245,12 +14291,12 @@ package ModelPredictiveControl 10},{80,16}}, color={0,0,255})); connect(Bus7.p, L4.p) annotation (Line(points={{30,10},{34.3,10},{34.3,10},{38.6, 10}}, color={0,0,255})); - connect(add.y, Load2.u) annotation (Line(points={{92.4,-14},{97.15,-14}, + connect(add.y, Load2.u) annotation (Line(points={{92.4,-12},{97.15,-12}, {97.15,-14.5},{101.9,-14.5}}, color={0,0,127})); - connect(add.u2, sine.y) annotation (Line(points={{83.2,-16.4},{83.2,-22}, + connect(add.u2, sine.y) annotation (Line(points={{83.2,-14.4},{83.2,-22}, {80.5,-22},{80.5,-31}}, color={0,0,127})); connect(whiteNoiseInjection.y, add.u1) annotation (Line(points={{76.54, - -12.06},{79.87,-12.06},{79.87,-11.6},{83.2,-11.6}}, color={0,0, + -12.06},{79.87,-12.06},{79.87,-9.6},{83.2,-9.6}}, color={0,0, 127})); connect(simpleLag.y, OUT24) annotation (Line(points={{321,-90},{350,-90}}, color={0,0,127})); @@ -14370,6 +14416,18 @@ package ModelPredictiveControl annotation (Line(points={{281,-90},{298,-90}}, color={0,0,127})); connect(PRE25.y, simpleLag1.u) annotation (Line(points={{281,-110},{298,-110}}, color={0,0,127})); + connect(whiteNoiseInjection1.y, add1.u1) annotation (Line(points={{ + 29.46,-29.94},{30,-30.4},{22.8,-30.4}}, color={0,0,127})); + connect(irradianceToPower.Ppv, add1.u2) annotation (Line(points={{33.5, + -15},{22.8,-15},{22.8,-25.6}}, color={0,0,127})); + connect(add1.y, PV.IRR2POW) annotation (Line(points={{13.6,-28},{-50, + -28},{-50,-43},{-42,-43}}, color={0,0,127})); + connect(u, or1.u[1]) annotation (Line(points={{-252,-4},{-216,-4},{-216,40.95}, + {-210,40.95}}, color={255,0,255})); + connect(booleanConstant.y, or1.u[2]) annotation (Line(points={{-231,50},{-216, + 50},{-216,43.05},{-210,43.05}}, color={255,0,255})); + connect(or1.y, circuitbreaker.Trigger) annotation (Line(points={{-197.1,42},{75.2, + 42},{75.2,26}}, color={255,0,255})); annotation (Placement(transformation(extent={{140,-20},{160,0}})), Placement(transformation(extent={{140,-40},{160,-20}})), Placement(transformation(extent={{140,-60},{160,-40}})), @@ -16180,7 +16238,7 @@ package ModelPredictiveControl
Note the behavior of those variables before and after the connection of generator G2 to the main grid.