From f4308a68ca2d8d0e6806625afdb6ca6070fcb917 Mon Sep 17 00:00:00 2001 From: boerrebj Date: Mon, 19 Jun 2023 15:11:38 +0200 Subject: [PATCH 1/3] Changed TurbineContacts Ref #52 --- OpenHPL/ElectroMech/Turbines/Francis.mo | 2 +- OpenHPL/ElectroMech/Turbines/Pelton.mo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/Francis.mo b/OpenHPL/ElectroMech/Turbines/Francis.mo index fe22681f..631c2d70 100644 --- a/OpenHPL/ElectroMech/Turbines/Francis.mo +++ b/OpenHPL/ElectroMech/Turbines/Francis.mo @@ -78,7 +78,7 @@ model Francis "Model of the Francis turbine" Real W_t2_n "Euler second term, nominal", W_t1_n "Euler first term, nominal", Wdot_t_n "Total power, nominal", cot_a1_n "Cotant nominal alpha", Vdot_n_ = Vdot_n / 0.99 "Flow rate for fully open guide vane", d_n(start = 0.67) "Nominal servo term", theta_n "Servo angle for fully open guide vane"; SI.Angle alpha1_n "Nominal inlet guide vane angle"; // connectors - extends OpenHPL.Interfaces.TurbineContacts; + extends OpenHPL.Interfaces.TurbineContacts2; Modelica.Blocks.Interfaces.RealInput w_in "Input angular velocity from the generator" annotation ( Placement(transformation(origin={-120,-80}, extent={{-20,-20}, {20,20}}))); diff --git a/OpenHPL/ElectroMech/Turbines/Pelton.mo b/OpenHPL/ElectroMech/Turbines/Pelton.mo index 2f0a1b3c..6223aa43 100644 --- a/OpenHPL/ElectroMech/Turbines/Pelton.mo +++ b/OpenHPL/ElectroMech/Turbines/Pelton.mo @@ -20,7 +20,7 @@ model Pelton "Model of the Pelton turbine" SI.AngularVelocity w=w_in "Angular velocity"; Real cos_b = Modelica.Math.cos(Modelica.Units.Conversions.from_deg(beta)); // connectors - extends OpenHPL.Interfaces.TurbineContacts; + extends OpenHPL.Interfaces.TurbineContacts2; Modelica.Blocks.Interfaces.RealInput w_in "Input angular velocity from the generator" annotation ( Placement(transformation(origin={-120,-80}, extent={{-20,-20}, {20,20}}))); From 05f0f0ea7489484a2fc48ac1659afd40c485a841 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Mon, 19 Jun 2023 15:19:39 +0200 Subject: [PATCH 2/3] Renamed Contacts2 to Contacts ref #52 --- OpenHPL/ElectroMech/Turbines/Francis.mo | 2 +- OpenHPL/ElectroMech/Turbines/Pelton.mo | 2 +- OpenHPL/ElectroMech/Turbines/Turbine.mo | 2 +- OpenHPL/Interfaces/TurbineContacts.mo | 18 ++++++++++++++---- OpenHPL/Interfaces/TurbineContacts2.mo | 18 ------------------ OpenHPL/Interfaces/package.order | 1 - 6 files changed, 17 insertions(+), 26 deletions(-) delete mode 100644 OpenHPL/Interfaces/TurbineContacts2.mo diff --git a/OpenHPL/ElectroMech/Turbines/Francis.mo b/OpenHPL/ElectroMech/Turbines/Francis.mo index 631c2d70..fe22681f 100644 --- a/OpenHPL/ElectroMech/Turbines/Francis.mo +++ b/OpenHPL/ElectroMech/Turbines/Francis.mo @@ -78,7 +78,7 @@ model Francis "Model of the Francis turbine" Real W_t2_n "Euler second term, nominal", W_t1_n "Euler first term, nominal", Wdot_t_n "Total power, nominal", cot_a1_n "Cotant nominal alpha", Vdot_n_ = Vdot_n / 0.99 "Flow rate for fully open guide vane", d_n(start = 0.67) "Nominal servo term", theta_n "Servo angle for fully open guide vane"; SI.Angle alpha1_n "Nominal inlet guide vane angle"; // connectors - extends OpenHPL.Interfaces.TurbineContacts2; + extends OpenHPL.Interfaces.TurbineContacts; Modelica.Blocks.Interfaces.RealInput w_in "Input angular velocity from the generator" annotation ( Placement(transformation(origin={-120,-80}, extent={{-20,-20}, {20,20}}))); diff --git a/OpenHPL/ElectroMech/Turbines/Pelton.mo b/OpenHPL/ElectroMech/Turbines/Pelton.mo index 6223aa43..2f0a1b3c 100644 --- a/OpenHPL/ElectroMech/Turbines/Pelton.mo +++ b/OpenHPL/ElectroMech/Turbines/Pelton.mo @@ -20,7 +20,7 @@ model Pelton "Model of the Pelton turbine" SI.AngularVelocity w=w_in "Angular velocity"; Real cos_b = Modelica.Math.cos(Modelica.Units.Conversions.from_deg(beta)); // connectors - extends OpenHPL.Interfaces.TurbineContacts2; + extends OpenHPL.Interfaces.TurbineContacts; Modelica.Blocks.Interfaces.RealInput w_in "Input angular velocity from the generator" annotation ( Placement(transformation(origin={-120,-80}, extent={{-20,-20}, {20,20}}))); diff --git a/OpenHPL/ElectroMech/Turbines/Turbine.mo b/OpenHPL/ElectroMech/Turbines/Turbine.mo index 39a99c69..223671fd 100644 --- a/OpenHPL/ElectroMech/Turbines/Turbine.mo +++ b/OpenHPL/ElectroMech/Turbines/Turbine.mo @@ -28,7 +28,7 @@ model Turbine "Simple turbine model with mechanical connectors" annotation (Dialog(tab = "Advanced"), choices(checkBox = true)); extends BaseClasses.Power2Torque(power(y=Wdot_s)); - extends OpenHPL.Interfaces.TurbineContacts2; + extends OpenHPL.Interfaces.TurbineContacts; SI.Pressure dp "Turbine pressure drop"; SI.EnergyFlowRate Kdot_i_tr "Kinetic energy flow"; diff --git a/OpenHPL/Interfaces/TurbineContacts.mo b/OpenHPL/Interfaces/TurbineContacts.mo index 57c6c306..a4cd0e5b 100644 --- a/OpenHPL/Interfaces/TurbineContacts.mo +++ b/OpenHPL/Interfaces/TurbineContacts.mo @@ -1,8 +1,18 @@ within OpenHPL.Interfaces; partial model TurbineContacts "Model of turbine connectors" extends Interfaces.ContactPort; - input Modelica.Blocks.Interfaces.RealInput u_t "[Guide vane|nozzle] opening of the turbine" annotation ( - Placement(transformation(extent = {{-20, -20}, {20, 20}}, rotation = -90, origin={0,120}))); - Modelica.Blocks.Interfaces.RealOutput P_out(unit="W") "Mechanical Output power" annotation ( - Placement(transformation(origin={0,-110}, extent={{-10,-10},{10,10}}, rotation = 270))); + parameter Boolean enable_P_out = false "If checked, get a connector for the output power" + annotation (choices(checkBox = true), Dialog(group="Outputs",tab="I/O")); + input Modelica.Blocks.Interfaces.RealInput u_t "[Guide vane|nozzle] opening of the turbine" annotation (Placement(transformation( + extent={{-20,-20},{20,20}}, + rotation=-90, + origin={-80,120}), iconTransformation( + extent={{-20,-20},{20,20}}, + rotation=-90, + origin={-80,120}))); + Modelica.Blocks.Interfaces.RealOutput P_out(unit="W") if enable_P_out "Mechanical Output power" annotation ( + Placement(transformation(origin={40,110}, extent={{-10,-10},{10,10}}, rotation=90), iconTransformation( + extent={{-10,-10},{10,10}}, + rotation=90, + origin={40,110}))); end TurbineContacts; diff --git a/OpenHPL/Interfaces/TurbineContacts2.mo b/OpenHPL/Interfaces/TurbineContacts2.mo deleted file mode 100644 index 70838e27..00000000 --- a/OpenHPL/Interfaces/TurbineContacts2.mo +++ /dev/null @@ -1,18 +0,0 @@ -within OpenHPL.Interfaces; -partial model TurbineContacts2 "Model of turbine connectors" - extends Interfaces.ContactPort; - parameter Boolean enable_P_out = false "If checked, get a connector for the output power" - annotation (choices(checkBox = true), Dialog(group="Outputs",tab="I/O")); - input Modelica.Blocks.Interfaces.RealInput u_t "[Guide vane|nozzle] opening of the turbine" annotation (Placement(transformation( - extent={{-20,-20},{20,20}}, - rotation=-90, - origin={-80,120}), iconTransformation( - extent={{-20,-20},{20,20}}, - rotation=-90, - origin={-80,120}))); - Modelica.Blocks.Interfaces.RealOutput P_out(unit="W") if enable_P_out "Mechanical Output power" annotation ( - Placement(transformation(origin={40,110}, extent={{-10,-10},{10,10}}, rotation=90), iconTransformation( - extent={{-10,-10},{10,10}}, - rotation=90, - origin={40,110}))); -end TurbineContacts2; diff --git a/OpenHPL/Interfaces/package.order b/OpenHPL/Interfaces/package.order index 7d93531d..51a499e5 100644 --- a/OpenHPL/Interfaces/package.order +++ b/OpenHPL/Interfaces/package.order @@ -5,4 +5,3 @@ TwoContact ContactPort ContactNode TurbineContacts -TurbineContacts2 From af40a31411fc9d566169632fc35d46fde807bfdb Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Mon, 19 Jun 2023 15:30:28 +0200 Subject: [PATCH 3/3] Adapt example to new contacts class --- OpenHPL/Examples/SimpleGenFrancis.mo | 9 ++++++--- OpenHPL/Tests/HPSimplePenstockPelton.mo | 9 +++++---- 2 files changed, 11 insertions(+), 7 deletions(-) diff --git a/OpenHPL/Examples/SimpleGenFrancis.mo b/OpenHPL/Examples/SimpleGenFrancis.mo index 7d9e8996..4c07624f 100644 --- a/OpenHPL/Examples/SimpleGenFrancis.mo +++ b/OpenHPL/Examples/SimpleGenFrancis.mo @@ -52,7 +52,9 @@ model SimpleGenFrancis "Model of a hydropower system with Francis turbine model" u_end_=2.4, u_start_=2.28, w_1_=0.2, - w_v_=0.2) annotation (Placement(transformation( + w_v_=0.2, + enable_P_out=true) + annotation (Placement(transformation( origin={30,0}, extent={{-10,-10},{10,10}}))); inner OpenHPL.Data data(Vdot_0=4.54) annotation (Placement(transformation( @@ -66,7 +68,8 @@ equation connect(generator.w_out, turbine.w_in) annotation ( Line(points={{19,-24},{12,-24},{12,-8},{18,-8}}, color = {0, 0, 127})); connect(turbine.P_out, generator.P_in) annotation ( - Line(points={{30,-11},{30,-18}}, color = {0, 0, 127})); + Line(points={{34,11},{34,18},{30,18},{30,-18}}, + color = {0, 0, 127})); connect(reservoir.o, intake.i) annotation ( Line(points={{-80,50},{-70,50}}, color = {28, 108, 200})); connect(surgeTank.i, intake.o) annotation ( @@ -76,7 +79,7 @@ equation connect(turbine.o, discharge.i) annotation ( Line(points={{40,0},{50,0}}, color = {28, 108, 200})); connect(control.y, turbine.u_t) annotation ( - Line(points={{39,30},{30,30},{30,12}}, color = {0, 0, 127})); + Line(points={{39,30},{22,30},{22,12}}, color = {0, 0, 127})); connect(turbine.i, fitting.o) annotation ( Line(points={{20,0},{8,0}}, color = {28, 108, 200})); connect(tail.o, discharge.o) annotation ( diff --git a/OpenHPL/Tests/HPSimplePenstockPelton.mo b/OpenHPL/Tests/HPSimplePenstockPelton.mo index b3d99bd5..4be89fd8 100644 --- a/OpenHPL/Tests/HPSimplePenstockPelton.mo +++ b/OpenHPL/Tests/HPSimplePenstockPelton.mo @@ -29,15 +29,16 @@ model HPSimplePenstockPelton "HP system model with Pelton turbine" inner OpenHPL.Data data annotation (Placement(transformation( origin={-90,92}, extent={{-10,-10},{10,10}}))); - ElectroMech.Turbines.Pelton turbine(R=1.74/2, D_0=1) annotation (Placement(transformation( + ElectroMech.Turbines.Pelton turbine(R=1.74/2, D_0=1, + enable_P_out=true) annotation (Placement(transformation( origin={10,34}, extent={{-10,-10},{10,10}}))); OpenHPL.ElectroMech.Generators.SynchGen aggregate(np=5) annotation (Placement(transformation(extent={{0,-4},{20,16}}))); equation connect(aggregate.P_in, turbine.P_out) annotation ( - Line(points={{4,16},{4,19},{10,19},{10,23}}, color = {0, 0, 127})); + Line(points={{10,18},{10,45},{14,45}}, color = {0, 0, 127})); connect(aggregate.w_out, turbine.w_in) annotation ( - Line(points={{16,16},{16,20},{14,20},{14,23.8}}, color = {0, 0, 127})); + Line(points={{21,12},{21,20},{-2,20},{-2,26}}, color = {0, 0, 127})); connect(reservoir.n, intake.p) annotation ( Line(points={{-82,62},{-77.95,62},{-77.95,60},{-72,60}}, color = {28, 108, 200})); connect(intake.n, surgeTank.p) annotation ( @@ -51,7 +52,7 @@ equation connect(turbine.n, discharge.p) annotation ( Line(points={{20,34},{20,34},{30,34}}, color = {28, 108, 200})); connect(control.y, turbine.u_t) annotation ( - Line(points={{1,84},{10,84},{10,46}}, color = {0, 0, 127})); + Line(points={{1,84},{2,84},{2,46}}, color = {0, 0, 127})); annotation ( experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4)); end HPSimplePenstockPelton;