From 03bc83677261caf5ce6aa11ee59ffe1de50621c8 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Thu, 19 Feb 2026 15:10:08 +0100 Subject: [PATCH 1/3] Adding the Efficiency Tables We use a new "type" from which custom tables can be created such that they are available via drop down in the turbine parameter dialogue. --- OpenHPL/ElectroMech/Turbines/Turbine.mo | 9 +++++---- OpenHPL/Types/Efficiency.mo | 11 +++++++++++ OpenHPL/Types/package.order | 1 + 3 files changed, 17 insertions(+), 4 deletions(-) create mode 100644 OpenHPL/Types/Efficiency.mo diff --git a/OpenHPL/ElectroMech/Turbines/Turbine.mo b/OpenHPL/ElectroMech/Turbines/Turbine.mo index fca2559..72ebc59 100644 --- a/OpenHPL/ElectroMech/Turbines/Turbine.mo +++ b/OpenHPL/ElectroMech/Turbines/Turbine.mo @@ -11,13 +11,14 @@ model Turbine "Simple turbine model with mechanical connectors" annotation (Dialog(group = "Efficiency data"), choices(checkBox = true)); parameter SI.Efficiency eta_h = 0.9 "Hydraulic efficiency" annotation (Dialog(group = "Efficiency data", enable = ConstEfficiency)); - parameter Real lookup_table[:, :] = [0, 0.4; 0.2, 0.7; 0.5, 0.9; 0.95, 0.95; 1.0, 0.93] - "Look-up table for the turbine/valve efficiency, described by a table matrix, where the first column is a pu value of the guide vane opening, and the second column is a pu value of the turbine efficiency." - annotation (Dialog(group = "Efficiency data", enable = not ConstEfficiency)); + replaceable parameter Types.Efficiency VarEfficiency constrainedby Types.Efficiency + "Look-up table for the turbine efficiency, described by a table matrix, + where the first column is a pu value of the opening, and the second column is a pu value of the turbine efficiency." + annotation(choicesAllMatching=true, Dialog(group = "Efficiency data", enable = not ConstEfficiency)); Modelica.Blocks.Math.Feedback lossCorrection annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); Modelica.Blocks.Tables.CombiTable1Dv efficiencyCurve( - table=lookup_table, + table=VarEfficiency.EffTable, smoothness=Modelica.Blocks.Types.Smoothness.ContinuousDerivative, extrapolation=Modelica.Blocks.Types.Extrapolation.LastTwoPoints) "Efficiency curve of the turbine" diff --git a/OpenHPL/Types/Efficiency.mo b/OpenHPL/Types/Efficiency.mo new file mode 100644 index 0000000..fb5359b --- /dev/null +++ b/OpenHPL/Types/Efficiency.mo @@ -0,0 +1,11 @@ +within OpenHPL.Types; +record Efficiency "Example record for efficiency curve" + extends Modelica.Icons.Record; + parameter SI.PerUnit EffTable[:,:] = + [0.0, 0.1; + 0.2, 0.7; + 0.5, 0.9; + 0.95, 0.95; + 1.0, 0.93] + "Opening of the nozzle or guide vane vs efficieny (can be hydraulic or overall depending on application)."; +end Efficiency; diff --git a/OpenHPL/Types/package.order b/OpenHPL/Types/package.order index 1f93386..d23f790 100644 --- a/OpenHPL/Types/package.order +++ b/OpenHPL/Types/package.order @@ -1,4 +1,5 @@ DraftTube +Efficiency Fitting FrictionMethod Lambda From 6f4c5ca73ff8be13f2320335d30935c782e584e9 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 20 Feb 2026 12:42:33 +0100 Subject: [PATCH 2/3] Added documentation. --- OpenHPL/ElectroMech/Turbines/Turbine.mo | 62 +++++++++++++++++++++++-- 1 file changed, 58 insertions(+), 4 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/Turbine.mo b/OpenHPL/ElectroMech/Turbines/Turbine.mo index 72ebc59..8f57e3a 100644 --- a/OpenHPL/ElectroMech/Turbines/Turbine.mo +++ b/OpenHPL/ElectroMech/Turbines/Turbine.mo @@ -81,12 +81,66 @@ or it will be calculated from the nominal turbine net head H_n and
Usage
-

Besides hydraulic input and output, there are inputs as the control signal for the valve +

Besides hydraulic input and output, there are inputs as the control signal for the opening and also output as the turbine shaft power.

-
More Information
-

More info about the model can be found in: Resources/Report/Report.docx -and [Vytvytskyi2019].

+
Efficiency Options
+ +

Two modes are available, controlled by the Boolean parameter ConstEfficiency +in the Efficiency data group:

+ + + +
Defining a Custom Efficiency Record
+ +

To supply turbine-specific efficiency data, create a new record that extends +OpenHPL.Types.Efficiency and override EffTable. +The table must have exactly two columns:

+ +
    +
  1. Guide-vane opening in per-unit (0 = fully closed, 1 = fully open).
  2. +
  3. Corresponding turbine efficiency in per-unit (0 = no conversion, 1 = lossless).
  4. +
+ +

Rows must be sorted in ascending order of the first column. +Extrapolation beyond the defined range uses the slope of the last two points +(Modelica.Blocks.Types.Extrapolation.LastTwoPoints), and the curve is +interpolated with a continuous derivative +(Modelica.Blocks.Types.Smoothness.ContinuousDerivative).

+ +

Example record:

+
+record MyTurbineEfficiency
+  extends OpenHPL.Types.Efficiency(
+    EffTable = [0.00, 0.00;
+                0.20, 0.72;
+                0.50, 0.91;
+                0.80, 0.94;
+                1.00, 0.91]);
+end MyTurbineEfficiency;
+
+ +

Place this record in your own package (or directly in the model), then in the +Efficiency data group of the Turbine:

+
    +
  1. Uncheck ConstEfficiency.
  2. +
  3. Set VarEfficiency to redeclare MyTurbineEfficiency VarEfficiency + (or use the drop-down in the parameter dialog, which lists all records compatible with + Types.Efficiency).
  4. +
+ +

The base record Types.Efficiency +already contains a representative default table that can be used as a starting point +when no measured data are available.

"), Icon(graphics={Text( visible=enable_P_out, extent={{30,100},{50,80}}, From 53fc0319c8066dbdcbf50b0987b46cbd93042862 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 20 Feb 2026 13:24:40 +0100 Subject: [PATCH 3/3] Make the table lookup absolute --- OpenHPL/ElectroMech/Turbines/Turbine.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenHPL/ElectroMech/Turbines/Turbine.mo b/OpenHPL/ElectroMech/Turbines/Turbine.mo index 8f57e3a..d7c5691 100644 --- a/OpenHPL/ElectroMech/Turbines/Turbine.mo +++ b/OpenHPL/ElectroMech/Turbines/Turbine.mo @@ -11,7 +11,7 @@ model Turbine "Simple turbine model with mechanical connectors" annotation (Dialog(group = "Efficiency data"), choices(checkBox = true)); parameter SI.Efficiency eta_h = 0.9 "Hydraulic efficiency" annotation (Dialog(group = "Efficiency data", enable = ConstEfficiency)); - replaceable parameter Types.Efficiency VarEfficiency constrainedby Types.Efficiency + replaceable parameter OpenHPL.Types.Efficiency VarEfficiency constrainedby OpenHPL.Types.Efficiency "Look-up table for the turbine efficiency, described by a table matrix, where the first column is a pu value of the opening, and the second column is a pu value of the turbine efficiency." annotation(choicesAllMatching=true, Dialog(group = "Efficiency data", enable = not ConstEfficiency));