From 850450661cea2449e8b5e4b534821bcce1b15883 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Wed, 11 Feb 2026 14:37:17 +0100 Subject: [PATCH 01/37] Added base class TorqueEquation --- OpenHPLTest/TorqueEquation.mo | 32 -------------------------------- 1 file changed, 32 deletions(-) diff --git a/OpenHPLTest/TorqueEquation.mo b/OpenHPLTest/TorqueEquation.mo index ed03c8b1..dec90663 100644 --- a/OpenHPLTest/TorqueEquation.mo +++ b/OpenHPLTest/TorqueEquation.mo @@ -2,36 +2,4 @@ within OpenHPLTest; package TorqueEquation extends Modelica.Icons.ExamplesPackage; - import SI = Modelica.Units.SI; - // - - model TorqueElement - extends OpenHPL.Icons.ElectroMech; - extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; - equation - - end TorqueElement; - - model TorqueTest - extends Modelica.Icons.Example; - // - parameter SI.Torque shaftTorque0 = 1.e+03; - SI.Torque shaftTorque; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation( - Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation( - Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}}))); - equation - if (time > 0.1 and time < 0.4) then - shaftTorque = shaftTorque0; - elseif (time > 0.5 and time < 0.8) then - shaftTorque = -shaftTorque0; - else - shaftTorque = 0.0; - end if; - annotation( - Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}}))); -end TorqueTest; end TorqueEquation; From 4bba4003a211d7ecb358edb377d4141ea6fe538d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 17 Feb 2026 12:46:59 +0100 Subject: [PATCH 02/37] Added f_grid - grid frequency to Data, corrected reference speed for normalization of speed (to p.u.) in Power2Torque and TorqueEquation. Added test case for TorqueEquation in OpenHPLTest --- OpenHPLTest/TorqueEquation.mo | 32 ++++++++++++++++++++++++++++++++ 1 file changed, 32 insertions(+) diff --git a/OpenHPLTest/TorqueEquation.mo b/OpenHPLTest/TorqueEquation.mo index dec90663..ed03c8b1 100644 --- a/OpenHPLTest/TorqueEquation.mo +++ b/OpenHPLTest/TorqueEquation.mo @@ -2,4 +2,36 @@ within OpenHPLTest; package TorqueEquation extends Modelica.Icons.ExamplesPackage; + import SI = Modelica.Units.SI; + // + + model TorqueElement + extends OpenHPL.Icons.ElectroMech; + extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; + equation + + end TorqueElement; + + model TorqueTest + extends Modelica.Icons.Example; + // + parameter SI.Torque shaftTorque0 = 1.e+03; + SI.Torque shaftTorque; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}}))); + TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation( + Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}}))); + TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation( + Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}}))); + equation + if (time > 0.1 and time < 0.4) then + shaftTorque = shaftTorque0; + elseif (time > 0.5 and time < 0.8) then + shaftTorque = -shaftTorque0; + else + shaftTorque = 0.0; + end if; + annotation( + Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}}))); +end TorqueTest; end TorqueEquation; From 5ddb132d8237142d340c24a825c786896f42fe61 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Wed, 11 Feb 2026 14:18:02 +0100 Subject: [PATCH 03/37] First version of turbine model based on empirical data --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 26 ++++++ OpenHPL/ElectroMech/Turbines/package.order | 1 + OpenHPL/Functions/TurbineLookUp.mo | 79 +++++++++++++++++++ OpenHPL/Functions/WeightedControlPoints.mo | 46 +++++++++++ OpenHPL/Functions/deCasteljau.mo | 31 ++++++++ OpenHPL/Functions/package.order | 3 + OpenHPL/Types/HillChart.mo | 14 ++++ OpenHPL/Types/TurbineData.mo | 28 +++++++ OpenHPL/Types/package.order | 2 + 9 files changed, 230 insertions(+) create mode 100644 OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo create mode 100644 OpenHPL/Functions/TurbineLookUp.mo create mode 100644 OpenHPL/Functions/WeightedControlPoints.mo create mode 100644 OpenHPL/Functions/deCasteljau.mo create mode 100644 OpenHPL/Types/HillChart.mo create mode 100644 OpenHPL/Types/TurbineData.mo diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo new file mode 100644 index 00000000..9f724d5c --- /dev/null +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -0,0 +1,26 @@ +within OpenHPL.ElectroMech.Turbines; + +model EmpiricalTurbine + extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation(torque.y=Tt,speedSensor.w=2*nrps*C.pi); + extends OpenHPL.Interfaces.TurbineContacts(u_t=opening); + extends OpenHPL.Icons.Turbine; + // + parameter Boolean SteadyState = false "If true, starts in steady state" annotation( + Dialog(group = "Initialization")); + parameter OpenHPL.Types.HillChart hillChart; + parameter OpenHPL.Types.TurbineData turbineData; + SI.Length Ht "Turbine head"; + SI.VolumeFlowRate Qt "Turbine flow rate"; + + SI.Torque Tt "Turbine torque"; +protected + Real opening; + SI.Frequency nrps "Rotational speed (in rotations per seconds)"; +equation + Ht = (i.p - o.p)/(data.rho*data.g); + i.mdot + o.mdot = 0; + i.mdot = Qt*data.rho; + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, hillChart); +annotation( + Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.")); +end EmpiricalTurbine; diff --git a/OpenHPL/ElectroMech/Turbines/package.order b/OpenHPL/ElectroMech/Turbines/package.order index 66a526c9..82b07e82 100644 --- a/OpenHPL/ElectroMech/Turbines/package.order +++ b/OpenHPL/ElectroMech/Turbines/package.order @@ -1,3 +1,4 @@ Turbine Francis Pelton +EmpiricalTurbine diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo new file mode 100644 index 00000000..d5eea1dc --- /dev/null +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -0,0 +1,79 @@ +within OpenHPL.Functions; + +function TurbineLookUp + extends Modelica.Icons.Function; + // + input SI.Length Ht; + input SI.Frequency nrps; + input Real opening; + input OpenHPL.Types.TurbineData td "Turbine data"; + input OpenHPL.Types.HillChart hc "Hill chart"; + output SI.VolumeFlowRate Qt "Discharge"; + output SI.Torque Tt "Hydraulic torque"; +protected + constant Real phi = (1 + sqrt(5))/2 "Golden ratio"; + constant Real resphi = 2 - phi "Reciprocal of golden ratio (0.618...)"; + constant Real eps = 1.0e-08; + constant Integer nitr = 99; + Real a "Current left bound"; + Real b "Current right bound"; + Real t1 "First interior point"; + Real t2 "Second interior point"; + Real f1 "Function value at x1"; + Real f2 "Function value at x2"; + Real x_min "Current estimate of minimum location"; + Real f_min "Current estimate of minimum value"; + Real controlPoints[hc.nPoints, hc.nDim]; + Real[hc.nDim] cP1; + Real[hc.nDim] cP2; + Real target; + Real err; + Integer itr; +algorithm + controlPoints:=WeightedControlPoints(opening,hc); + target:=((nrps*td.Dn)/sqrt(Ht*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g)); + a:=0; + b:=1; + itr:=0; + err:=1.e+10; + t1 := a + resphi*(b - a); + cP1 := deCasteljau(t1, hc.nDim, controlPoints); + f1 := sqrt((cP1[1] - target)^2); + t2 := b - resphi*(b - a); + cP2 := deCasteljau(t2, hc.nDim, controlPoints); + f2 := sqrt((cP2[1] - target)^2); + while ((err > eps) and (itr < nitr)) loop + if f1 < f2 then +// Minimum is in [a, x2] + b := t2; + t2 := t1; + f2 := f1; + t1 := a + resphi*(b - a); + cP1 :=deCasteljau(t1, hc.nDim, controlPoints); + f1 := sqrt((cP1[1] - target)^2); + else +// Minimum is in [x1, b] + a := t1; + t1 := t2; + f1 := f2; + t2 := b - resphi*(b - a); + cP2 := deCasteljau(t2, hc.nDim, controlPoints); + f2 := sqrt((cP2[1] - target)^2); + end if; + itr := itr + 1; + err := min(f1, f2); + end while; + Qt := (cP1[2] + cP2[2])*0.5*(td.Qbep*sqrt(Ht/td.Hbep)); + Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); + +annotation( + Documentation(info = " +

Compute the physical discharge and torque based on the speed [nrps] head [Ht] and opening. The algorithm is briely summarized below. +

    +
  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. +
  3. Use golden section search to find the correct position along the speed curve
  4. +
  5. Compute physcal discharge and torqu based on normalized unit data and the turbine information
  6. +

")); + + +end TurbineLookUp; diff --git a/OpenHPL/Functions/WeightedControlPoints.mo b/OpenHPL/Functions/WeightedControlPoints.mo new file mode 100644 index 00000000..07f9f5cf --- /dev/null +++ b/OpenHPL/Functions/WeightedControlPoints.mo @@ -0,0 +1,46 @@ +within OpenHPL.Functions; + +function WeightedControlPoints +extends Modelica.Icons.Function; + /* + */ + input Real opening; + input OpenHPL.Types.HillChart hc "Hill chart"; + output Real data[hc.nPoints, hc.nDim]; +protected + Real td[hc.nPoints, hc.nDim]; + Real beta; + Integer i; + +algorithm +//if (opening >= hc.opening[1] and opening <= hc.opening[hc.nPoints]) then + i:=1; + while (i < hc.nCurves ) loop + if (opening < hc.opening[i]) then +// Defined as closed guide vanes + for j in 1:hc.nPoints loop + td[j,1] := hc.data[1, j, 1]; + td[j,2] := 0.0; +// Torque set to zero. Must be corrected in the future + td[j,3] := 0.0 ; + end for; + break; + elseif ( (hc.opening[i] <= opening) and (opening <= hc.opening[i+1]) ) then + beta:=(opening-hc.opening[i])/(hc.opening[i+1]-hc.opening[i]); + for j in 1:hc.nPoints loop + for k in 1:hc.nDim loop + td[j,k] := (1.-beta)*hc.data[i, j, k]+ beta*hc.data[i+1, j, k] ; + end for; + end for; + break; + else + i:=i+1; + end if; + end while; + + data:=td; +annotation( + Documentation(info = "Compute an intermediate turbine characteristics based on linear interpolation of the two closest curves. The turbine opening is used as argument for finding the closest curves. Assumes that the opening in the HillChart data is monotonously increasing. If data at small opening is missing, the flow and speed data for the first curve is used and the torque is set to zero.")); + + +end WeightedControlPoints; diff --git a/OpenHPL/Functions/deCasteljau.mo b/OpenHPL/Functions/deCasteljau.mo new file mode 100644 index 00000000..ce9fca4f --- /dev/null +++ b/OpenHPL/Functions/deCasteljau.mo @@ -0,0 +1,31 @@ +within OpenHPL.Functions; + +function deCasteljau + extends Modelica.Icons.Function; + input Real t "Parameter between 0 and 1"; + input Integer ndim "Dimensional space"; + input Real[:, ndim] controlPoints "Array of control points [n,ndim]"; + output Real[ndim] point "Computed point on the curve"; +protected + Integer n = size(controlPoints, 1); + Real temp[n, ndim]; +algorithm +// Initialize temp with control points + temp := controlPoints; +// Perform De Casteljau iterations + for r in 1:n - 1 loop + for i in 1:n - r loop + for k in 1:ndim loop + temp[i, k] := (1 - t)*temp[i, k] + t*temp[i + 1, k]; + end for; + end for; + end for; +// The first element now contains the point on the curve +for k in 1:ndim loop + point[k] := temp[1, k]; +end for; +annotation( + Documentation(info = "Implementation of Bezier curve evaluation using the deCasteljau algorithm.
At the moment only one single Bezier curve per parameter dimension is assumed, but the order of the curve is arbritray, but define by the number of control points (e.g. curve order = number of control points - 1).
")); + + +end deCasteljau; diff --git a/OpenHPL/Functions/package.order b/OpenHPL/Functions/package.order index 597543b5..94dad78b 100644 --- a/OpenHPL/Functions/package.order +++ b/OpenHPL/Functions/package.order @@ -2,3 +2,6 @@ Fitting DarcyFriction manningVelocity KP07 +deCasteljau +WeightedControlPoints +TurbineLookUp diff --git a/OpenHPL/Types/HillChart.mo b/OpenHPL/Types/HillChart.mo new file mode 100644 index 00000000..a94abc2e --- /dev/null +++ b/OpenHPL/Types/HillChart.mo @@ -0,0 +1,14 @@ +within OpenHPL.Types; + +record HillChart + extends Modelica.Icons.Record; + parameter Integer nCurves; + parameter Integer nPoints; + parameter Integer nDim "parameter space, currently 3"; + parameter Real opening[nCurves]; + parameter Real data[nCurves, nPoints, nDim]; + + annotation( + Documentation(info = "
This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for
a number of normalized openings. 

The HillChart record contains three integer values:
1) nCurves - number of Bezier curves
2) nPoints - number of Bezier control points (order of curve +1)
3) nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).

The data itself is contained in two multidimensional arrays
opening[nCurves] - gives the opening $$\in [0,1]$$ for each curve. It is assumed that the array is sorted from smallest to larges value.
data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED) 
")); + +end HillChart; diff --git a/OpenHPL/Types/TurbineData.mo b/OpenHPL/Types/TurbineData.mo new file mode 100644 index 00000000..126fd2aa --- /dev/null +++ b/OpenHPL/Types/TurbineData.mo @@ -0,0 +1,28 @@ +within OpenHPL.Types; + +record TurbineData + extends Modelica.Icons.Record; + // + parameter SI.Length Dn "Nominal diameter"; + parameter SI.Frequency nrps "Best efficiency rotational speed"; + parameter SI.Length Hbep "Best efficiency head"; + parameter SI.VolumeFlowRate Qbep "Best efficiency discharge"; + parameter SI.Torque Tbep "Best efficiency shaft torque"; + parameter Real openingBep "Best efficiency opening"; + parameter SI.Acceleration g; + parameter SI.Density rho; + + annotation( + Documentation(info = "Data record with key turbine information. Used together with the normalized turbine characteristics to calculate physical values.

+ + + + + + + + + +
VariableDescription
Dn [m]Nominal diameter
nrps [1/s]Best efficiency rotational speed
Hbep [m]Best efficiency head
Qbep [m³/s]Best efficiency discharge
Tbep [Nm]Best efficiency torque
openingBep [-]Normalize best efficiency opening (must be between 0 and 1)
")); + +end TurbineData; diff --git a/OpenHPL/Types/package.order b/OpenHPL/Types/package.order index 5071474e..c72b84bd 100644 --- a/OpenHPL/Types/package.order +++ b/OpenHPL/Types/package.order @@ -5,3 +5,5 @@ FrictionMethod FrictionSpec Lambda SurgeTank +HillChart +TurbineData From d9adf2d55b6f12dd3b62cf12eff92fd21395595a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Thu, 26 Feb 2026 16:39:14 +0100 Subject: [PATCH 04/37] Updated Empirical turbine and added tests package under OpenHPLTest --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 4 +- OpenHPL/Functions/TurbineLookUp.mo | 2 +- OpenHPL/Functions/WeightedControlPoints.mo | 2 +- OpenHPL/Types/ReactionTurbines.mo | 13 ++ ...HillChart.mo => TurbineCharacteristics.mo} | 4 +- OpenHPL/Types/package.order | 3 +- OpenHPLTest/EmpiricalTurbine.mo | 190 ++++++++++++++++++ OpenHPLTest/package.order | 1 + 8 files changed, 212 insertions(+), 7 deletions(-) create mode 100644 OpenHPL/Types/ReactionTurbines.mo rename OpenHPL/Types/{HillChart.mo => TurbineCharacteristics.mo} (95%) create mode 100644 OpenHPLTest/EmpiricalTurbine.mo diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 9f724d5c..e44bc174 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -7,7 +7,7 @@ model EmpiricalTurbine // parameter Boolean SteadyState = false "If true, starts in steady state" annotation( Dialog(group = "Initialization")); - parameter OpenHPL.Types.HillChart hillChart; + parameter OpenHPL.Types.TurbineCharacteristics turbineCharacteristics; parameter OpenHPL.Types.TurbineData turbineData; SI.Length Ht "Turbine head"; SI.VolumeFlowRate Qt "Turbine flow rate"; @@ -20,7 +20,7 @@ equation Ht = (i.p - o.p)/(data.rho*data.g); i.mdot + o.mdot = 0; i.mdot = Qt*data.rho; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, hillChart); + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); annotation( Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.")); end EmpiricalTurbine; diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index d5eea1dc..c7e13a4b 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -7,7 +7,7 @@ function TurbineLookUp input SI.Frequency nrps; input Real opening; input OpenHPL.Types.TurbineData td "Turbine data"; - input OpenHPL.Types.HillChart hc "Hill chart"; + input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; output SI.VolumeFlowRate Qt "Discharge"; output SI.Torque Tt "Hydraulic torque"; protected diff --git a/OpenHPL/Functions/WeightedControlPoints.mo b/OpenHPL/Functions/WeightedControlPoints.mo index 07f9f5cf..9eca9b77 100644 --- a/OpenHPL/Functions/WeightedControlPoints.mo +++ b/OpenHPL/Functions/WeightedControlPoints.mo @@ -5,7 +5,7 @@ extends Modelica.Icons.Function; /* */ input Real opening; - input OpenHPL.Types.HillChart hc "Hill chart"; + input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; output Real data[hc.nPoints, hc.nDim]; protected Real td[hc.nPoints, hc.nDim]; diff --git a/OpenHPL/Types/ReactionTurbines.mo b/OpenHPL/Types/ReactionTurbines.mo new file mode 100644 index 00000000..90bccdbe --- /dev/null +++ b/OpenHPL/Types/ReactionTurbines.mo @@ -0,0 +1,13 @@ +within OpenHPL.Types; + +record ReactionTurbines "Collection of empirical turbine characteristics for use together with the EmpiricalTurbine model" + extends Modelica.Icons.Record; + protected + parameter Real oA[5]={0.10,0.25,0.50,0.75,1.00}; + parameter Real cP1[5,4,3]={{{ 0.00,0.27,0.45 },{ 0.58,0.33,0.42 },{ 1.04,0.16,0.11 },{ 1.43,-0.13,-0.42 }},{{ 0.00,0.64,1.17 },{ 0.70,0.74,1.04 },{ 1.13,0.31,0.13 },{ 1.43,-0.17,-0.50 }},{{ 0.00,1.25,2.27 },{ 0.90,1.30,1.71 },{ 1.29,0.53,-0.05 },{ 1.43,-0.18,-0.52 }},{{ 0.00,1.71,2.95 },{ 1.05,1.71,1.99 },{ 1.31,0.63,-0.17 },{ 1.44,-0.16,-0.53 }},{{ 0.00,2.10,3.41 },{ 1.15,1.98,2.04 },{ 1.31,0.76,-0.18 },{ 1.45,-0.13,-0.54 }}}; + + parameter Real cP2[5,4,3]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + public + TurbineCharacteristics turbine1(nCurves = 5, nDim = 3, nPoints = 4, opening = oA, data = cPoints) "N_QE=0.07"; + TurbineCharacteristics turbine2(nCurves = 5, nDim = 3, nPoints = 4, opening = oA, data = cPoints) "N_EQ=0.20"; +end ReactionTurbines; diff --git a/OpenHPL/Types/HillChart.mo b/OpenHPL/Types/TurbineCharacteristics.mo similarity index 95% rename from OpenHPL/Types/HillChart.mo rename to OpenHPL/Types/TurbineCharacteristics.mo index a94abc2e..7814a95b 100644 --- a/OpenHPL/Types/HillChart.mo +++ b/OpenHPL/Types/TurbineCharacteristics.mo @@ -1,6 +1,6 @@ within OpenHPL.Types; -record HillChart +record TurbineCharacteristics extends Modelica.Icons.Record; parameter Integer nCurves; parameter Integer nPoints; @@ -11,4 +11,4 @@ record HillChart annotation( Documentation(info = "
This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for
a number of normalized openings. 

The HillChart record contains three integer values:
1) nCurves - number of Bezier curves
2) nPoints - number of Bezier control points (order of curve +1)
3) nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).

The data itself is contained in two multidimensional arrays
opening[nCurves] - gives the opening $$\in [0,1]$$ for each curve. It is assumed that the array is sorted from smallest to larges value.
data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED) 
")); -end HillChart; +end TurbineCharacteristics; diff --git a/OpenHPL/Types/package.order b/OpenHPL/Types/package.order index c72b84bd..c2651149 100644 --- a/OpenHPL/Types/package.order +++ b/OpenHPL/Types/package.order @@ -5,5 +5,6 @@ FrictionMethod FrictionSpec Lambda SurgeTank -HillChart TurbineData +TurbineCharacteristics +ReactionTurbines diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo new file mode 100644 index 00000000..e3ba4b0d --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -0,0 +1,190 @@ +within OpenHPLTest; + +package EmpiricalTurbine + extends Modelica.Icons.ExamplesPackage; + + package TestBasicFunctions + extends Modelica.Icons.ExamplesPackage; + // + model Test01_BezierCurve + extends Modelica.Icons.Example; + Real[ndim] curvePoint; + protected + constant Integer ndim=3; + parameter Real controlPoints[6, ndim]={{ 0.00,1.46,2.60 },{ 0.53,1.45,2.33 },{ 0.77,1.19,1.80 },{ 1.63,0.86,-0.58 },{ 1.13,0.24,0.31 },{ 1.43,-0.17,-0.52 }}; + equation + curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); + annotation( + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001)); +end Test01_BezierCurve; + // + model Test02_ControlPoints + extends Modelica.Icons.Example; + // + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + + Real cPoints1[NP, ND],cPoints2[NP, ND],cPoints3[NP, ND]; + Real[ND] curvePoint1,curvePoint2,curvePoint3; + equation + + cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); + curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND,cPoints1); + + + cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); + curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND,cPoints2); + + + cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); + curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND,cPoints3); + + annotation( + Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve."), + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); +end Test02_ControlPoints; + end TestBasicFunctions; + + package TurbineTest + extends Modelica.Icons.ExamplesPackage; + import SI=Modelica.Units.SI; + + model Test01_TurbineLookUp + extends Modelica.Icons.Example; + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + public + Real opening; + SI.Length Ht "Turbine head"; + SI.VolumeFlowRate Qt "Turbine flow rate"; + SI.Frequency nrps "Rotational speed"; + SI.Torque Tt "Turbine torque"; + + equation + Ht=425.0; + nrps=1.0e-03+8.33*time*1.4; + opening = 0.6; + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, td, tc); + annotation( + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001)); +end Test01_TurbineLookUp; + // + model Test02_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); + + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + + public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + + end Test02_Turbin; + + // + model Test03_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); + + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + + public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + + end Test03_Turbin; + + + + // + model Test04_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); + + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + + public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + + equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + + end Test04_Turbin; + + end TurbineTest; +end EmpiricalTurbine; diff --git a/OpenHPLTest/package.order b/OpenHPLTest/package.order index 640cf656..7ba9e01d 100644 --- a/OpenHPLTest/package.order +++ b/OpenHPLTest/package.order @@ -71,3 +71,4 @@ HPSTSimple HPSTAirCushion HPSTSharpOrifice HPSTThrottleValve +EmpiricalTurbine From 905812061c2f69f2a4521303c4afe11396078f34 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Thu, 26 Feb 2026 21:32:26 +0100 Subject: [PATCH 05/37] Some updates to the turbine testing --- OpenHPLTest/EmpiricalTurbine.mo | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo index e3ba4b0d..c947568c 100644 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -15,7 +15,8 @@ package EmpiricalTurbine equation curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); annotation( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001)); + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), + Documentation(info = "Basic test of evaluation of Bezier curve using deCasteljau algorithm.


")); end Test01_BezierCurve; // model Test02_ControlPoints @@ -79,7 +80,8 @@ end Test02_ControlPoints; opening = 0.6; (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, td, tc); annotation( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001)); + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), + Documentation(info = "Basic test of Empirical turbine mode. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.")); end Test01_TurbineLookUp; // model Test02_Turbin @@ -101,7 +103,7 @@ end Test01_TurbineLookUp; Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); @@ -113,7 +115,9 @@ end Test01_TurbineLookUp; connect(const.y, turbine.u_t) annotation( Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - end Test02_Turbin; + annotation( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.

")); +end Test02_Turbin; // model Test03_Turbin @@ -187,4 +191,4 @@ end Test01_TurbineLookUp; end Test04_Turbin; end TurbineTest; -end EmpiricalTurbine; +end EmpiricalTurbine; \ No newline at end of file From 4ba3ede55ce7bc6e5b486a45a7e55840c53f9b91 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 27 Feb 2026 11:59:44 +0100 Subject: [PATCH 06/37] Continued testing of empirical turbine model --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 4 +- OpenHPL/Functions/TurbineLookUp.mo | 3 +- OpenHPL/Types/TurbineCharacteristics.mo | 2 +- OpenHPLTest/EmpiricalTurbine.mo | 333 +++++++++--------- 4 files changed, 170 insertions(+), 172 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index e44bc174..3d5b441c 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -17,10 +17,10 @@ protected Real opening; SI.Frequency nrps "Rotational speed (in rotations per seconds)"; equation - Ht = (i.p - o.p)/(data.rho*data.g); + Ht = abs(i.p - o.p)/(data.rho*data.g); i.mdot + o.mdot = 0; i.mdot = Qt*data.rho; (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); annotation( - Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.")); + Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.
In this intial release, the turbine characteristics and tubine data must be constructed separately passed to the model. This may change in future releases.
")); end EmpiricalTurbine; diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index c7e13a4b..528d5ebc 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -31,7 +31,8 @@ protected Integer itr; algorithm controlPoints:=WeightedControlPoints(opening,hc); - target:=((nrps*td.Dn)/sqrt(Ht*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g)); + // Modelica.Utilities.Streams.print("Ht = " + String(Ht)); + target:=((nrps*td.Dn)/sqrt(max(abs(Ht),eps)*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g)); a:=0; b:=1; itr:=0; diff --git a/OpenHPL/Types/TurbineCharacteristics.mo b/OpenHPL/Types/TurbineCharacteristics.mo index 7814a95b..8999d8b1 100644 --- a/OpenHPL/Types/TurbineCharacteristics.mo +++ b/OpenHPL/Types/TurbineCharacteristics.mo @@ -9,6 +9,6 @@ record TurbineCharacteristics parameter Real data[nCurves, nPoints, nDim]; annotation( - Documentation(info = "
This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for
a number of normalized openings. 

The HillChart record contains three integer values:
1) nCurves - number of Bezier curves
2) nPoints - number of Bezier control points (order of curve +1)
3) nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).

The data itself is contained in two multidimensional arrays
opening[nCurves] - gives the opening $$\in [0,1]$$ for each curve. It is assumed that the array is sorted from smallest to larges value.
data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED) 
")); + Documentation(info = "
This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for
a number of normalized openings. 

The HillChart record contains three integer values:
1) nCurves - number of Bezier curves
2) nPoints - number of Bezier control points (order of curve +1)
3) nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).

The data itself is contained in two multidimensional arrays
opening[nCurves] - gives the opening $$\\in [0,1]$$ for each curve. It is assumed that the array is sorted from smallest to larges value.
data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED) 
")); end TurbineCharacteristics; diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo index c947568c..918ab5d1 100644 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -6,189 +6,186 @@ package EmpiricalTurbine package TestBasicFunctions extends Modelica.Icons.ExamplesPackage; // + model Test01_BezierCurve - extends Modelica.Icons.Example; + extends Modelica.Icons.Example; Real[ndim] curvePoint; - protected - constant Integer ndim=3; - parameter Real controlPoints[6, ndim]={{ 0.00,1.46,2.60 },{ 0.53,1.45,2.33 },{ 0.77,1.19,1.80 },{ 1.63,0.86,-0.58 },{ 1.13,0.24,0.31 },{ 1.43,-0.17,-0.52 }}; - equation - curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); - annotation( + protected + constant Integer ndim = 3; + parameter Real controlPoints[6, ndim] = {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}; + equation + curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); + annotation( experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), - Documentation(info = "Basic test of evaluation of Bezier curve using deCasteljau algorithm.


")); -end Test01_BezierCurve; + Documentation(info = "Basic test of evaluation of Bezier curve using deCasteljau algorithm.
Parametric curve plot of curvePoint[1] againts curvPoint[2] should show a smooth trajectory of QED vs nED.


")); + end Test01_BezierCurve; + // + model Test02_ControlPoints - extends Modelica.Icons.Example; - // + extends Modelica.Icons.Example; + // protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public - - Real cPoints1[NP, ND],cPoints2[NP, ND],cPoints3[NP, ND]; - Real[ND] curvePoint1,curvePoint2,curvePoint3; - equation - - cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); - curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND,cPoints1); - - - cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); - curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND,cPoints2); - - - cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); - curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND,cPoints3); - - annotation( - Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve."), - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); -end Test02_ControlPoints; + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + Real cPoints1[NP, ND], cPoints2[NP, ND], cPoints3[NP, ND]; + Real[ND] curvePoint1, curvePoint2, curvePoint3; + equation + cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); + curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND, cPoints1); + cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); + curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND, cPoints2); + cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); + curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND, cPoints3); + annotation( + Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve.
Computes three curve trajectories as weighted intermediate curves. Parametrci curve plot of curvePoints1[1] against  curvePoints1[2] and similar for curvePonts2 and curvePoints3 should show smooth curves 2D curves.
"), + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); + end Test02_ControlPoints; end TestBasicFunctions; package TurbineTest extends Modelica.Icons.ExamplesPackage; - import SI=Modelica.Units.SI; - + import SI = Modelica.Units.SI; + model Test01_TurbineLookUp - extends Modelica.Icons.Example; + extends Modelica.Icons.Example; protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = 9.81, rho = 997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public public - Real opening; - SI.Length Ht "Turbine head"; - SI.VolumeFlowRate Qt "Turbine flow rate"; - SI.Frequency nrps "Rotational speed"; - SI.Torque Tt "Turbine torque"; - - equation - Ht=425.0; - nrps=1.0e-03+8.33*time*1.4; - opening = 0.6; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, td, tc); - annotation( + Real opening; + SI.Length Ht "Turbine head"; + SI.VolumeFlowRate Qt "Turbine flow rate"; + SI.Frequency nrps "Rotational speed"; + SI.Torque Tt "Turbine torque"; + equation + Ht = 425.0; + nrps = 1.0e-03 + 8.33*time*1.4; + opening = 0.6; + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, td, tc); + annotation( experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), - Documentation(info = "Basic test of Empirical turbine mode. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.")); -end Test01_TurbineLookUp; - // - model Test02_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); - + Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); + end Test01_TurbineLookUp; + + // + + model Test02_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - - public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - equation - connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - - annotation( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.

")); -end Test02_Turbin; - - // - model Test03_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); - + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( + Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + annotation( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-06, Interval = 0.001)); + end Test02_Turbin; + + // + + model Test03_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation( + Placement(transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}))); + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( + Placement(transformation(origin = {-82, 62}, extent = {{-10, -10}, {10, 10}}))); protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - - public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - equation - connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - - end Test03_Turbin; - - - - // - model Test04_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); - + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, tunnel.i) annotation( + Line(points = {{-70, 32}, {-54, 32}}, color = {0, 128, 255})); + connect(tunnel.o, turbine.i) annotation( + Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); + annotation( + experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.01), + Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway.")); + end Test03_Turbin; + + // + + model Test04_Turbin + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95,Tbep=1.718E+06, openingBep = 0.601,g=9.81,rho=997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - - public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - - equation - connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - - end Test04_Turbin; - + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = 9.81, rho = 997.0); + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + end Test04_Turbin; end TurbineTest; -end EmpiricalTurbine; \ No newline at end of file +end EmpiricalTurbine; From 0b3b720c3c4436557579597ebb73b2a00c7141f1 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 27 Feb 2026 13:01:42 +0100 Subject: [PATCH 07/37] Continue to update testing. Currently there are numerical issues with the pipe + turbine model. --- OpenHPLTest/EmpiricalTurbine.mo | 112 ++++++++++++++++++-------------- 1 file changed, 63 insertions(+), 49 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo index 918ab5d1..e3b66565 100644 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -51,18 +51,34 @@ package EmpiricalTurbine package TurbineTest extends Modelica.Icons.ExamplesPackage; import SI = Modelica.Units.SI; - - model Test01_TurbineLookUp + + partial model AbstractTurbineTest extends Modelica.Icons.Example; - protected - constant Integer NC = 5; + inner OpenHPL.Data data annotation( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + protected + constant Integer NC = 11; + constant Integer NP = 6; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.014, 0.030, 0.050, 0.100, 0.200, 0.300, 0.400, 0.500, 0.601, 0.800, 1.000}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.07, 0.07}, {0.30, 0.10, 0.07}, {0.54, -0.07, -0.03}, {0.92, 0.25, 0.13}, {1.13, -0.11, -0.17}, {1.43, -0.06, -0.31}}, {{0.00, 0.11, 0.15}, {0.32, 0.15, 0.17}, {0.51, -0.06, -0.09}, {1.00, 0.35, 0.35}, {1.11, -0.12, -0.30}, {1.43, -0.09, -0.31}}, {{0.00, 0.15, 0.23}, {0.34, 0.21, 0.24}, {0.47, -0.08, -0.01}, {1.07, 0.46, 0.35}, {1.09, -0.15, -0.24}, {1.43, -0.11, -0.37}}, {{0.00, 0.27, 0.45}, {0.37, 0.30, 0.40}, {0.40, 0.05, 0.30}, {1.38, 0.60, 0.26}, {0.97, -0.19, -0.17}, {1.43, -0.13, -0.42}}, {{0.00, 0.51, 0.92}, {0.40, 0.53, 0.80}, {0.45, 0.31, 0.83}, {1.48, 0.75, 0.14}, {0.99, -0.14, -0.06}, {1.44, -0.17, -0.49}}, {{0.00, 0.77, 1.41}, {0.44, 0.79, 1.23}, {0.51, 0.56, 1.29}, {1.62, 0.82, -0.14}, {0.99, -0.05, 0.11}, {1.43, -0.18, -0.51}}, {{0.00, 1.01, 1.87}, {0.48, 1.05, 1.70}, {0.56, 0.74, 1.46}, {1.68, 0.84, -0.35}, {1.03, 0.06, 0.23}, {1.43, -0.19, -0.53}}, {{0.00, 1.25, 2.27}, {0.52, 1.26, 1.99}, {0.63, 1.00, 1.84}, {1.70, 0.83, -0.64}, {1.08, 0.17, 0.35}, {1.43, -0.18, -0.52}}, {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}, {{0.00, 1.79, 3.06}, {0.55, 1.78, 2.77}, {0.99, 1.43, 1.67}, {1.53, 0.94, -0.59}, {1.20, 0.31, 0.28}, {1.45, -0.16, -0.54}}, {{0.00, 2.10, 3.41}, {0.59, 2.02, 2.99}, {1.05, 1.63, 1.56}, {1.53, 1.04, -0.47}, {1.22, 0.40, 0.24}, {1.45, -0.13, -0.54}}}; + /* + constant Integer NC = 5; constant Integer NP = 4; constant Integer ND = 3; parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = 9.81, rho = 997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public + */ + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); + public + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( + Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); + + + end AbstractTurbineTest; + + model Test01_TurbineLookUp + extends AbstractTurbineTest; public Real opening; SI.Length Ht "Turbine head"; @@ -73,7 +89,7 @@ package EmpiricalTurbine Ht = 425.0; nrps = 1.0e-03 + 8.33*time*1.4; opening = 0.6; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, td, tc); + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, tc); annotation( experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); @@ -82,19 +98,7 @@ package EmpiricalTurbine // model Test02_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( - Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); + extends AbstractTurbineTest; OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( @@ -118,21 +122,11 @@ package EmpiricalTurbine // model Test03_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); + extends AbstractTurbineTest; + + public OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation( Placement(transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}))); - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( - Placement(transformation(origin = {-82, 62}, extent = {{-10, -10}, {10, 10}}))); - protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); @@ -159,26 +153,18 @@ package EmpiricalTurbine // model Test04_Turbin - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-46, 62}, extent = {{-10, -10}, {10, 10}}))); - protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - parameter OpenHPL.Types.TurbineData td(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = 9.81, rho = 997.0); - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public + extends AbstractTurbineTest; + public OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = td, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( + Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( + Placement(transformation(origin = {-80, 44}, extent = {{-12, 24}, {6, 6}}))); equation connect(overvann.o, turbine.i) annotation( Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); @@ -186,6 +172,34 @@ package EmpiricalTurbine Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); connect(ramp.y, turbine.u_t) annotation( Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - end Test04_Turbin; + annotation( + experiment(StartTime = 0, StopTime = 15, Tolerance = 1e-06, Interval = 0.01)); +end Test04_Turbin; + // + model Test05_Turbin + extends AbstractTurbineTest; + // + public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( + Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation( + Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); + + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + equation + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, tunnel.i) annotation( + Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); + connect(tunnel.o, turbine.i) annotation( + Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); + end Test05_Turbin; end TurbineTest; end EmpiricalTurbine; From fb04bb82ba999bd7a9f3f6260a60dca68faf1ccc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 27 Feb 2026 13:10:45 +0100 Subject: [PATCH 08/37] Updated annotation string in TurbineLookUp to solve Github error issue. --- OpenHPL/Functions/TurbineLookUp.mo | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index 528d5ebc..788ac523 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -31,7 +31,7 @@ protected Integer itr; algorithm controlPoints:=WeightedControlPoints(opening,hc); - // Modelica.Utilities.Streams.print("Ht = " + String(Ht)); + // Added the: max(abs(Ht),eps) due to errors when initializing the model. target:=((nrps*td.Dn)/sqrt(max(abs(Ht),eps)*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g)); a:=0; b:=1; @@ -68,13 +68,7 @@ algorithm Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); annotation( - Documentation(info = " -

Compute the physical discharge and torque based on the speed [nrps] head [Ht] and opening. The algorithm is briely summarized below. -

    -
  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. -
  3. Use golden section search to find the correct position along the speed curve
  4. -
  5. Compute physcal discharge and torqu based on normalized unit data and the turbine information
  6. -

")); + Documentation(info = " 

TurbineLookUp:

Compute the physical discharge and torque based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that n is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves

")); end TurbineLookUp; From f6be212708eb58d4baa75b0a5246501566c4ae43 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 27 Feb 2026 15:19:33 +0100 Subject: [PATCH 09/37] Correcting documentation string to avoid GitHub check error --- OpenHPL/Functions/TurbineLookUp.mo | 2 +- OpenHPL/Functions/deCasteljau.mo | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index 788ac523..b3be2930 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -68,7 +68,7 @@ algorithm Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); annotation( - Documentation(info = " 

TurbineLookUp:

Compute the physical discharge and torque based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that n is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves

")); + Documentation(info = "

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves.

")); end TurbineLookUp; diff --git a/OpenHPL/Functions/deCasteljau.mo b/OpenHPL/Functions/deCasteljau.mo index ce9fca4f..fc18a271 100644 --- a/OpenHPL/Functions/deCasteljau.mo +++ b/OpenHPL/Functions/deCasteljau.mo @@ -25,7 +25,7 @@ for k in 1:ndim loop point[k] := temp[1, k]; end for; annotation( - Documentation(info = "Implementation of Bezier curve evaluation using the deCasteljau algorithm.
At the moment only one single Bezier curve per parameter dimension is assumed, but the order of the curve is arbritray, but define by the number of control points (e.g. curve order = number of control points - 1).
")); + Documentation(info = "Implementation of Bezier curve evaluation using the deCasteljau algorithm.
At the moment only one single Bezier curve per parameter dimension is assumed, but the order of the curve is arbritray, but define by the number of control points (e.g. curve order = number of control points - 1).")); end deCasteljau; From 1e72d4238be458c9273386781c9301947a9ffc25 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 27 Feb 2026 15:27:07 +0100 Subject: [PATCH 10/37] Correcting documentation string to avoid GitHub check error --- OpenHPL/Functions/TurbineLookUp.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index b3be2930..f1d7686c 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -68,7 +68,7 @@ algorithm Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); annotation( - Documentation(info = "

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves.

")); + Documentation(info ="

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves.

")); end TurbineLookUp; From b10791d59fdb8f454fe58f6b2c32bb308f9c2d6c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Sun, 1 Mar 2026 21:37:05 +0100 Subject: [PATCH 11/37] Updating testing --- OpenHPLTest/EmpiricalTurbine.mo | 30 +++++++++++++++++++----------- 1 file changed, 19 insertions(+), 11 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo index e3b66565..e9e1c212 100644 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -3,6 +3,12 @@ within OpenHPLTest; package EmpiricalTurbine extends Modelica.Icons.ExamplesPackage; + class Information + extends Modelica.Icons.Information; + annotation( + Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
The Homotopy analysis method is ")); + end Information; + package TestBasicFunctions extends Modelica.Icons.ExamplesPackage; // @@ -97,7 +103,7 @@ package EmpiricalTurbine // - model Test02_Turbin + model Test02_Turbine extends AbstractTurbineTest; OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); @@ -117,11 +123,11 @@ package EmpiricalTurbine annotation( Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-06, Interval = 0.001)); - end Test02_Turbin; + end Test02_Turbine; // - model Test03_Turbin + model Test03_Turbine extends AbstractTurbineTest; public @@ -146,13 +152,15 @@ package EmpiricalTurbine connect(tunnel.o, turbine.i) annotation( Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); annotation( - experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.01), - Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway.")); - end Test03_Turbin; + experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.1), + Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), + __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", + __OpenModelica_simulationFlags(lv = "LOG_STDOUT,LOG_ASSERT,LOG_STATS", s = "dassl", noHomotopyOnFirstTry = "()",homMaxNewtonSteps= "50",homMaxTries="30",variableFilter = ".*")); + end Test03_Turbine; // - model Test04_Turbin + model Test04_Turbine extends AbstractTurbineTest; public OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( @@ -174,9 +182,9 @@ package EmpiricalTurbine Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); annotation( experiment(StartTime = 0, StopTime = 15, Tolerance = 1e-06, Interval = 0.01)); -end Test04_Turbin; +end Test04_Turbine; // - model Test05_Turbin + model Test05_Turbine extends AbstractTurbineTest; // public @@ -200,6 +208,6 @@ end Test04_Turbin; Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); connect(tunnel.o, turbine.i) annotation( Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); - end Test05_Turbin; + end Test05_Turbine; end TurbineTest; -end EmpiricalTurbine; +end EmpiricalTurbine; \ No newline at end of file From b36ca6565d9a0e13a56b17f42d2f8cdaf9b80fb6 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 3 Mar 2026 10:57:21 +0100 Subject: [PATCH 12/37] Continue to resolve issue with convegence for EmpiricalTurbine model --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 2 +- OpenHPLTest/EmpiricalTurbine.mo | 6 +++--- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 3d5b441c..c522548e 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -9,7 +9,7 @@ model EmpiricalTurbine Dialog(group = "Initialization")); parameter OpenHPL.Types.TurbineCharacteristics turbineCharacteristics; parameter OpenHPL.Types.TurbineData turbineData; - SI.Length Ht "Turbine head"; + SI.Length Ht(start=100) "Turbine head"; SI.VolumeFlowRate Qt "Turbine flow rate"; SI.Torque Tt "Turbine torque"; diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo index e9e1c212..f4403f84 100644 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ b/OpenHPLTest/EmpiricalTurbine.mo @@ -6,7 +6,7 @@ package EmpiricalTurbine class Information extends Modelica.Icons.Information; annotation( - Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
The Homotopy analysis method is ")); + Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the dassl solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); end Information; package TestBasicFunctions @@ -152,7 +152,7 @@ package EmpiricalTurbine connect(tunnel.o, turbine.i) annotation( Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); annotation( - experiment(StartTime = 0, StopTime = 10, Tolerance = 1e-06, Interval = 0.1), + experiment(StartTime = 0, StopTime = 10.0, Tolerance = 1e-06, Interval = 0.2000), Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", __OpenModelica_simulationFlags(lv = "LOG_STDOUT,LOG_ASSERT,LOG_STATS", s = "dassl", noHomotopyOnFirstTry = "()",homMaxNewtonSteps= "50",homMaxTries="30",variableFilter = ".*")); @@ -210,4 +210,4 @@ end Test04_Turbine; Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); end Test05_Turbine; end TurbineTest; -end EmpiricalTurbine; \ No newline at end of file +end EmpiricalTurbine; From cc7baa1cc4afad31276a10ff1387d0025b6489b6 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Tue, 3 Mar 2026 16:03:02 +0100 Subject: [PATCH 13/37] Rearrange all test models and archive the old ones --- .../CaseStudingValentynasCase.mo | 2 +- .../{ => Archive}/HPAllTypeFittingsTest.mo | 2 +- OpenHPLTest/{ => Archive}/HPBjarneBorresen.mo | 2 +- OpenHPLTest/{ => Archive}/HPDraftTube.mo | 2 +- .../{ => Archive}/HPElasticKPPenstock.mo | 2 +- .../HPElasticKPPenstockANDIntake.mo | 2 +- .../HPElasticKPPenstockCompres.mo | 2 +- .../HPElasticKPPenstockFrancis.mo | 2 +- .../HPElasticKPPenstockFrancisGov.mo | 2 +- .../HPElasticKPPenstockHalfSurgeD.mo | 2 +- .../HPElasticKPPenstockWithoutSurge.mo | 2 +- OpenHPLTest/{ => Archive}/HPLinTest.mo | 2 +- OpenHPLTest/{ => Archive}/HPLiniarization.mo | 2 +- OpenHPLTest/{ => Archive}/HPLiniarization2.mo | 2 +- OpenHPLTest/{ => Archive}/HPLiniarization3.mo | 2 +- OpenHPLTest/{ => Archive}/HPLiniarization4.mo | 2 +- .../{ => Archive}/HPLiniarizationFranGen.mo | 2 +- .../{ => Archive}/HPLiniarizationGenIPSL.mo | 2 +- .../{ => Archive}/HPLiniarizationGenIPSLKP.mo | 2 +- .../{ => Archive}/HPLiniarizationKP.mo | 2 +- .../{ => Archive}/HPLiniarizationKPFran.mo | 2 +- OpenHPLTest/{ => Archive}/HPModel.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelDEA.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelKPLin.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelKPLinPI.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelLin.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelLinPI.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelManLin.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelObserv.mo | 2 +- OpenHPLTest/{ => Archive}/HPModelObservSim.mo | 2 +- OpenHPLTest/{ => Archive}/HPSTAirCushion.mo | 2 +- OpenHPLTest/{ => Archive}/HPSTSharpOrifice.mo | 2 +- OpenHPLTest/{ => Archive}/HPSTSimple.mo | 2 +- .../{ => Archive}/HPSTThrottleValve.mo | 2 +- .../{ => Archive}/HPSimpleElasticPenstock.mo | 2 +- .../HPSimpleElasticPenstockWithoutSurge.mo | 2 +- .../HPSimplePenstockAutoRefGate.mo | 2 +- .../{ => Archive}/HPSimplePenstockControl.mo | 2 +- .../{ => Archive}/HPSimplePenstockFrancis.mo | 2 +- .../{ => Archive}/HPSimplePenstockFrancis2.mo | 2 +- .../HPSimplePenstockFrancisGenIPSL.mo | 2 +- .../HPSimplePenstockFrancisGenIPSLGov.mo | 2 +- .../HPSimplePenstockFrancisGenIPSLInfBus.mo | 2 +- .../HPSimplePenstockFrancisGener.mo | 2 +- .../HPSimplePenstockGeneratorTest.mo | 2 +- .../HPSimplePenstockOpenChannel.mo | 2 +- .../{ => Archive}/HPSimplePenstockPelton.mo | 2 +- .../{ => Archive}/HPSimplePenstockResKP.mo | 2 +- .../{ => Archive}/HPSquareFittingsTest.mo | 2 +- .../{ => Archive}/HPTaperedFittingsTest.mo | 2 +- .../HydroCordModeKPlFrancisDraftTube.mo | 2 +- OpenHPLTest/{ => Archive}/HydroCordModel.mo | 2 +- OpenHPLTest/{ => Archive}/HydroCordModel2.mo | 2 +- .../{ => Archive}/HydroCordModelDraftTube.mo | 2 +- .../{ => Archive}/HydroCordModelDraftTube2.mo | 2 +- .../{ => Archive}/HydroCordModelDraftTube3.mo | 2 +- .../{ => Archive}/HydroCordModelFrancis.mo | 2 +- .../{ => Archive}/HydroCordModelFrancis2.mo | 2 +- .../HydroCordModelFrancisDraftTube.mo | 2 +- OpenHPLTest/{ => Archive}/HydroCordModelKP.mo | 2 +- .../{ => Archive}/HydroCordModelKP2.mo | 2 +- .../HydroCordModelKPDraftTube.mo | 2 +- .../{ => Archive}/HydroCordModelKPFran.mo | 2 +- .../{ => Archive}/HydroCordModelKPFran2.mo | 2 +- .../{ => Archive}/HydroCordModelKPall.mo | 2 +- OpenHPLTest/{ => Archive}/Reservoir.mo | 2 +- .../{ => Archive}/TestFitingSimpleHP.mo | 2 +- OpenHPLTest/{ => Archive}/TestMCB.mo | 2 +- OpenHPLTest/{ => Archive}/TestRunoff.mo | 2 +- .../{ => Archive}/TorpaHPPAirCushionTest.mo | 2 +- .../{ => Archive}/TorpaHPPAirCushionTest2.mo | 2 +- OpenHPLTest/Archive/package.mo | 6 + OpenHPLTest/Archive/package.order | 72 ++++++ OpenHPLTest/EmpiricalTurbine.mo | 213 ------------------ OpenHPLTest/EmpiricalTurbine/Information.mo | 6 + .../TestBasicFunctions/Test01_BezierCurve.mo | 13 ++ .../Test02_ControlPoints.mo | 27 +++ .../TestBasicFunctions/package.mo | 9 + .../TestBasicFunctions/package.order | 2 + .../TurbineTest/AbstractTurbineTest.mo | 24 ++ .../TurbineTest/Test01_TurbineLookUp.mo | 18 ++ .../TurbineTest/Test02_Turbine.mo | 22 ++ .../TurbineTest/Test03_Turbine.mo | 37 +++ .../TurbineTest/Test04_Turbine.mo | 24 ++ .../TurbineTest/Test05_Turbine.mo | 26 +++ .../EmpiricalTurbine/TurbineTest/package.mo | 17 ++ .../TurbineTest/package.order | 6 + OpenHPLTest/EmpiricalTurbine/package.mo | 7 + OpenHPLTest/EmpiricalTurbine/package.order | 3 + OpenHPLTest/TestPipe.mo | 105 --------- OpenHPLTest/TestPipe/AbstractTest.mo | 17 ++ OpenHPLTest/TestPipe/Test01.mo | 26 +++ OpenHPLTest/TestPipe/Test02.mo | 6 + OpenHPLTest/TestPipe/Test03.mo | 50 ++++ OpenHPLTest/TestPipe/package.mo | 9 + OpenHPLTest/TestPipe/package.order | 4 + OpenHPLTest/TorqueEquation.mo | 37 --- OpenHPLTest/TorqueEquation/TorqueElement.mo | 7 + OpenHPLTest/TorqueEquation/TorqueTest.mo | 23 ++ OpenHPLTest/TorqueEquation/package.mo | 8 + OpenHPLTest/TorqueEquation/package.order | 2 + OpenHPLTest/package.mo | 1 + OpenHPLTest/package.order | 74 +----- 103 files changed, 545 insertions(+), 498 deletions(-) rename OpenHPLTest/{ => Archive}/CaseStudingValentynasCase.mo (99%) rename OpenHPLTest/{ => Archive}/HPAllTypeFittingsTest.mo (99%) rename OpenHPLTest/{ => Archive}/HPBjarneBorresen.mo (99%) rename OpenHPLTest/{ => Archive}/HPDraftTube.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstock.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockANDIntake.mo (98%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockCompres.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockFrancis.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockFrancisGov.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockHalfSurgeD.mo (99%) rename OpenHPLTest/{ => Archive}/HPElasticKPPenstockWithoutSurge.mo (99%) rename OpenHPLTest/{ => Archive}/HPLinTest.mo (89%) rename OpenHPLTest/{ => Archive}/HPLiniarization.mo (98%) rename OpenHPLTest/{ => Archive}/HPLiniarization2.mo (98%) rename OpenHPLTest/{ => Archive}/HPLiniarization3.mo (98%) rename OpenHPLTest/{ => Archive}/HPLiniarization4.mo (98%) rename OpenHPLTest/{ => Archive}/HPLiniarizationFranGen.mo (99%) rename OpenHPLTest/{ => Archive}/HPLiniarizationGenIPSL.mo (99%) rename OpenHPLTest/{ => Archive}/HPLiniarizationGenIPSLKP.mo (99%) rename OpenHPLTest/{ => Archive}/HPLiniarizationKP.mo (98%) rename OpenHPLTest/{ => Archive}/HPLiniarizationKPFran.mo (99%) rename OpenHPLTest/{ => Archive}/HPModel.mo (98%) rename OpenHPLTest/{ => Archive}/HPModelDEA.mo (98%) rename OpenHPLTest/{ => Archive}/HPModelKPLin.mo (99%) rename OpenHPLTest/{ => Archive}/HPModelKPLinPI.mo (94%) rename OpenHPLTest/{ => Archive}/HPModelLin.mo (97%) rename OpenHPLTest/{ => Archive}/HPModelLinPI.mo (96%) rename OpenHPLTest/{ => Archive}/HPModelManLin.mo (99%) rename OpenHPLTest/{ => Archive}/HPModelObserv.mo (98%) rename OpenHPLTest/{ => Archive}/HPModelObservSim.mo (99%) rename OpenHPLTest/{ => Archive}/HPSTAirCushion.mo (98%) rename OpenHPLTest/{ => Archive}/HPSTSharpOrifice.mo (98%) rename OpenHPLTest/{ => Archive}/HPSTSimple.mo (98%) rename OpenHPLTest/{ => Archive}/HPSTThrottleValve.mo (98%) rename OpenHPLTest/{ => Archive}/HPSimpleElasticPenstock.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimpleElasticPenstockWithoutSurge.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockAutoRefGate.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockControl.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancis.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancis2.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancisGenIPSL.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancisGenIPSLGov.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancisGenIPSLInfBus.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockFrancisGener.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockGeneratorTest.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockOpenChannel.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockPelton.mo (99%) rename OpenHPLTest/{ => Archive}/HPSimplePenstockResKP.mo (99%) rename OpenHPLTest/{ => Archive}/HPSquareFittingsTest.mo (99%) rename OpenHPLTest/{ => Archive}/HPTaperedFittingsTest.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModeKPlFrancisDraftTube.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModel.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModel2.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelDraftTube.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelDraftTube2.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelDraftTube3.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelFrancis.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelFrancis2.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelFrancisDraftTube.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKP.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKP2.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKPDraftTube.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKPFran.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKPFran2.mo (99%) rename OpenHPLTest/{ => Archive}/HydroCordModelKPall.mo (99%) rename OpenHPLTest/{ => Archive}/Reservoir.mo (98%) rename OpenHPLTest/{ => Archive}/TestFitingSimpleHP.mo (99%) rename OpenHPLTest/{ => Archive}/TestMCB.mo (98%) rename OpenHPLTest/{ => Archive}/TestRunoff.mo (98%) rename OpenHPLTest/{ => Archive}/TorpaHPPAirCushionTest.mo (98%) rename OpenHPLTest/{ => Archive}/TorpaHPPAirCushionTest2.mo (98%) create mode 100644 OpenHPLTest/Archive/package.mo create mode 100644 OpenHPLTest/Archive/package.order delete mode 100644 OpenHPLTest/EmpiricalTurbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/Information.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test01_BezierCurve.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order create mode 100644 OpenHPLTest/EmpiricalTurbine/package.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/package.order delete mode 100644 OpenHPLTest/TestPipe.mo create mode 100644 OpenHPLTest/TestPipe/AbstractTest.mo create mode 100644 OpenHPLTest/TestPipe/Test01.mo create mode 100644 OpenHPLTest/TestPipe/Test02.mo create mode 100644 OpenHPLTest/TestPipe/Test03.mo create mode 100644 OpenHPLTest/TestPipe/package.mo create mode 100644 OpenHPLTest/TestPipe/package.order delete mode 100644 OpenHPLTest/TorqueEquation.mo create mode 100644 OpenHPLTest/TorqueEquation/TorqueElement.mo create mode 100644 OpenHPLTest/TorqueEquation/TorqueTest.mo create mode 100644 OpenHPLTest/TorqueEquation/package.mo create mode 100644 OpenHPLTest/TorqueEquation/package.order diff --git a/OpenHPLTest/CaseStudingValentynasCase.mo b/OpenHPLTest/Archive/CaseStudingValentynasCase.mo similarity index 99% rename from OpenHPLTest/CaseStudingValentynasCase.mo rename to OpenHPLTest/Archive/CaseStudingValentynasCase.mo index 7ecbc23e..390702c1 100644 --- a/OpenHPLTest/CaseStudingValentynasCase.mo +++ b/OpenHPLTest/Archive/CaseStudingValentynasCase.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model CaseStudingValentynasCase "HP system model for Valentyna's Master case" extends Modelica.Icons.Example; Real coef2, coef3; diff --git a/OpenHPLTest/HPAllTypeFittingsTest.mo b/OpenHPLTest/Archive/HPAllTypeFittingsTest.mo similarity index 99% rename from OpenHPLTest/HPAllTypeFittingsTest.mo rename to OpenHPLTest/Archive/HPAllTypeFittingsTest.mo index 9d2f8085..bd14769b 100644 --- a/OpenHPLTest/HPAllTypeFittingsTest.mo +++ b/OpenHPLTest/Archive/HPAllTypeFittingsTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPAllTypeFittingsTest "Test for comparing fitting behaviour" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir headWater(h_0=10) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); diff --git a/OpenHPLTest/HPBjarneBorresen.mo b/OpenHPLTest/Archive/HPBjarneBorresen.mo similarity index 99% rename from OpenHPLTest/HPBjarneBorresen.mo rename to OpenHPLTest/Archive/HPBjarneBorresen.mo index 95f2c922..63cd8674 100644 --- a/OpenHPLTest/HPBjarneBorresen.mo +++ b/OpenHPLTest/Archive/HPBjarneBorresen.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPBjarneBorresen "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=503 - 499.5) annotation (Placement(transformation( diff --git a/OpenHPLTest/HPDraftTube.mo b/OpenHPLTest/Archive/HPDraftTube.mo similarity index 99% rename from OpenHPLTest/HPDraftTube.mo rename to OpenHPLTest/Archive/HPDraftTube.mo index f37bc71e..08ab2b87 100644 --- a/OpenHPLTest/HPDraftTube.mo +++ b/OpenHPLTest/Archive/HPDraftTube.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPDraftTube "Testing the draft tube models." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation( diff --git a/OpenHPLTest/HPElasticKPPenstock.mo b/OpenHPLTest/Archive/HPElasticKPPenstock.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstock.mo rename to OpenHPLTest/Archive/HPElasticKPPenstock.mo index 09254060..1d679479 100644 --- a/OpenHPLTest/HPElasticKPPenstock.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstock.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstock "Model of HP system with elastic penctock (KP), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockANDIntake.mo b/OpenHPLTest/Archive/HPElasticKPPenstockANDIntake.mo similarity index 98% rename from OpenHPLTest/HPElasticKPPenstockANDIntake.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockANDIntake.mo index 8be46e7f..2035172c 100644 --- a/OpenHPLTest/HPElasticKPPenstockANDIntake.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockANDIntake.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockANDIntake "Model of HP system with elastic penctock and intake (KP), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockCompres.mo b/OpenHPLTest/Archive/HPElasticKPPenstockCompres.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstockCompres.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockCompres.mo index abd0a97d..ff017de4 100644 --- a/OpenHPLTest/HPElasticKPPenstockCompres.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockCompres.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockCompres "Model of HP system with elastic penctock (KP), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockFrancis.mo b/OpenHPLTest/Archive/HPElasticKPPenstockFrancis.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstockFrancis.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockFrancis.mo index 4efb54b0..043b82c3 100644 --- a/OpenHPLTest/HPElasticKPPenstockFrancis.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockFrancis.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockFrancis "HP system model with Francis turbine and elastic penstock" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockFrancisGov.mo b/OpenHPLTest/Archive/HPElasticKPPenstockFrancisGov.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstockFrancisGov.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockFrancisGov.mo index 3a015b89..ac90399d 100644 --- a/OpenHPLTest/HPElasticKPPenstockFrancisGov.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockFrancisGov.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockFrancisGov "HP system model with Francis turbine and elastic penstock and governor" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockHalfSurgeD.mo b/OpenHPLTest/Archive/HPElasticKPPenstockHalfSurgeD.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstockHalfSurgeD.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockHalfSurgeD.mo index 06ab2333..6531026d 100644 --- a/OpenHPLTest/HPElasticKPPenstockHalfSurgeD.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockHalfSurgeD.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockHalfSurgeD "Similar to previous HP system, but with twice reduced surge tank diameter" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-92,66}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPElasticKPPenstockWithoutSurge.mo b/OpenHPLTest/Archive/HPElasticKPPenstockWithoutSurge.mo similarity index 99% rename from OpenHPLTest/HPElasticKPPenstockWithoutSurge.mo rename to OpenHPLTest/Archive/HPElasticKPPenstockWithoutSurge.mo index 336cf0db..a330329f 100644 --- a/OpenHPLTest/HPElasticKPPenstockWithoutSurge.mo +++ b/OpenHPLTest/Archive/HPElasticKPPenstockWithoutSurge.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPElasticKPPenstockWithoutSurge "Model of HP system without surge tank and with elastic penctock (KP), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-90,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPLinTest.mo b/OpenHPLTest/Archive/HPLinTest.mo similarity index 89% rename from OpenHPLTest/HPLinTest.mo rename to OpenHPLTest/Archive/HPLinTest.mo index 98f0b135..1898ab44 100644 --- a/OpenHPLTest/HPLinTest.mo +++ b/OpenHPLTest/Archive/HPLinTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLinTest extends Modelica.Icons.Example; OpenHPLTest.HPLiniarizationKPFran hpl; diff --git a/OpenHPLTest/HPLiniarization.mo b/OpenHPLTest/Archive/HPLiniarization.mo similarity index 98% rename from OpenHPLTest/HPLiniarization.mo rename to OpenHPLTest/Archive/HPLiniarization.mo index 495e5d2d..60ac7873 100644 --- a/OpenHPLTest/HPLiniarization.mo +++ b/OpenHPLTest/Archive/HPLiniarization.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarization "Simple HP system model for liniarization" extends Modelica.Icons.Example; input Real u(start = 0.7493); diff --git a/OpenHPLTest/HPLiniarization2.mo b/OpenHPLTest/Archive/HPLiniarization2.mo similarity index 98% rename from OpenHPLTest/HPLiniarization2.mo rename to OpenHPLTest/Archive/HPLiniarization2.mo index 2e054e60..fdef2e97 100644 --- a/OpenHPLTest/HPLiniarization2.mo +++ b/OpenHPLTest/Archive/HPLiniarization2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarization2 "Simple HP system model for liniarization" extends Modelica.Icons.Example; input Real u(start = 0.7493); diff --git a/OpenHPLTest/HPLiniarization3.mo b/OpenHPLTest/Archive/HPLiniarization3.mo similarity index 98% rename from OpenHPLTest/HPLiniarization3.mo rename to OpenHPLTest/Archive/HPLiniarization3.mo index ff54ef46..f6da8719 100644 --- a/OpenHPLTest/HPLiniarization3.mo +++ b/OpenHPLTest/Archive/HPLiniarization3.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarization3 "Simple HP system model for liniarization" extends Modelica.Icons.Example; input Real u(start = 0.7493); diff --git a/OpenHPLTest/HPLiniarization4.mo b/OpenHPLTest/Archive/HPLiniarization4.mo similarity index 98% rename from OpenHPLTest/HPLiniarization4.mo rename to OpenHPLTest/Archive/HPLiniarization4.mo index 479564ac..1c0b5bf1 100644 --- a/OpenHPLTest/HPLiniarization4.mo +++ b/OpenHPLTest/Archive/HPLiniarization4.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarization4 "Simple HP system model for liniarization" extends Modelica.Icons.Example; input Real u(start = 0.7493); diff --git a/OpenHPLTest/HPLiniarizationFranGen.mo b/OpenHPLTest/Archive/HPLiniarizationFranGen.mo similarity index 99% rename from OpenHPLTest/HPLiniarizationFranGen.mo rename to OpenHPLTest/Archive/HPLiniarizationFranGen.mo index 9a8b9587..952ad3af 100644 --- a/OpenHPLTest/HPLiniarizationFranGen.mo +++ b/OpenHPLTest/Archive/HPLiniarizationFranGen.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarizationFranGen "HP system model for liniarization with Francis turbine + generator" extends Modelica.Icons.Example; OpenHPL.Waterway.Pipe intake(H=23, Vdot_0=18.5952) annotation (Placement(transformation(extent={{-72,50},{-52,70}}))); diff --git a/OpenHPLTest/HPLiniarizationGenIPSL.mo b/OpenHPLTest/Archive/HPLiniarizationGenIPSL.mo similarity index 99% rename from OpenHPLTest/HPLiniarizationGenIPSL.mo rename to OpenHPLTest/Archive/HPLiniarizationGenIPSL.mo index 07592790..6fa548c1 100644 --- a/OpenHPLTest/HPLiniarizationGenIPSL.mo +++ b/OpenHPLTest/Archive/HPLiniarizationGenIPSL.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarizationGenIPSL "Synergy with OpenIPSL library(generator + governor)" extends Modelica.Icons.Example; input Real u = 0.574; diff --git a/OpenHPLTest/HPLiniarizationGenIPSLKP.mo b/OpenHPLTest/Archive/HPLiniarizationGenIPSLKP.mo similarity index 99% rename from OpenHPLTest/HPLiniarizationGenIPSLKP.mo rename to OpenHPLTest/Archive/HPLiniarizationGenIPSLKP.mo index 20e1ebbb..51c28f36 100644 --- a/OpenHPLTest/HPLiniarizationGenIPSLKP.mo +++ b/OpenHPLTest/Archive/HPLiniarizationGenIPSLKP.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarizationGenIPSLKP "Synergy with OpenIPSL library(generator + governor)" extends Modelica.Icons.Example; input Real u = 0.574; diff --git a/OpenHPLTest/HPLiniarizationKP.mo b/OpenHPLTest/Archive/HPLiniarizationKP.mo similarity index 98% rename from OpenHPLTest/HPLiniarizationKP.mo rename to OpenHPLTest/Archive/HPLiniarizationKP.mo index ea5b4c19..01bb6f88 100644 --- a/OpenHPLTest/HPLiniarizationKP.mo +++ b/OpenHPLTest/Archive/HPLiniarizationKP.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarizationKP "HP system model for liniarization with elastic penstock (KP)" extends Modelica.Icons.Example; input Real u(start = 0.7493); diff --git a/OpenHPLTest/HPLiniarizationKPFran.mo b/OpenHPLTest/Archive/HPLiniarizationKPFran.mo similarity index 99% rename from OpenHPLTest/HPLiniarizationKPFran.mo rename to OpenHPLTest/Archive/HPLiniarizationKPFran.mo index f3ce3f4e..6c5bf64f 100644 --- a/OpenHPLTest/HPLiniarizationKPFran.mo +++ b/OpenHPLTest/Archive/HPLiniarizationKPFran.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPLiniarizationKPFran "HP system model for liniarization with elastic penstock (KP) + Francis turbine + generator" extends Modelica.Icons.Example; input Real u; diff --git a/OpenHPLTest/HPModel.mo b/OpenHPLTest/Archive/HPModel.mo similarity index 98% rename from OpenHPLTest/HPModel.mo rename to OpenHPLTest/Archive/HPModel.mo index 8a919861..9019ac5d 100644 --- a/OpenHPLTest/HPModel.mo +++ b/OpenHPLTest/Archive/HPModel.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModel inner OpenHPL.Data data; import Modelica.Constants.pi; diff --git a/OpenHPLTest/HPModelDEA.mo b/OpenHPLTest/Archive/HPModelDEA.mo similarity index 98% rename from OpenHPLTest/HPModelDEA.mo rename to OpenHPLTest/Archive/HPModelDEA.mo index 783195e9..b3807100 100644 --- a/OpenHPLTest/HPModelDEA.mo +++ b/OpenHPLTest/Archive/HPModelDEA.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelDEA inner OpenHPL.Data data; import Modelica.Constants.pi; diff --git a/OpenHPLTest/HPModelKPLin.mo b/OpenHPLTest/Archive/HPModelKPLin.mo similarity index 99% rename from OpenHPLTest/HPModelKPLin.mo rename to OpenHPLTest/Archive/HPModelKPLin.mo index 38d595fb..339b634f 100644 --- a/OpenHPLTest/HPModelKPLin.mo +++ b/OpenHPLTest/Archive/HPModelKPLin.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelKPLin parameter Integer n = 24; // states diff --git a/OpenHPLTest/HPModelKPLinPI.mo b/OpenHPLTest/Archive/HPModelKPLinPI.mo similarity index 94% rename from OpenHPLTest/HPModelKPLinPI.mo rename to OpenHPLTest/Archive/HPModelKPLinPI.mo index 4d615265..bb64ebc2 100644 --- a/OpenHPLTest/HPModelKPLinPI.mo +++ b/OpenHPLTest/Archive/HPModelKPLinPI.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelKPLinPI HPLiniarizationKP hpKP; parameter Real Kp = 0.1; diff --git a/OpenHPLTest/HPModelLin.mo b/OpenHPLTest/Archive/HPModelLin.mo similarity index 97% rename from OpenHPLTest/HPModelLin.mo rename to OpenHPLTest/Archive/HPModelLin.mo index 3c9b2192..f1a15071 100644 --- a/OpenHPLTest/HPModelLin.mo +++ b/OpenHPLTest/Archive/HPModelLin.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelLin parameter Integer n = 5; // states diff --git a/OpenHPLTest/HPModelLinPI.mo b/OpenHPLTest/Archive/HPModelLinPI.mo similarity index 96% rename from OpenHPLTest/HPModelLinPI.mo rename to OpenHPLTest/Archive/HPModelLinPI.mo index 27e738f1..732479fe 100644 --- a/OpenHPLTest/HPModelLinPI.mo +++ b/OpenHPLTest/Archive/HPModelLinPI.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelLinPI HPModelLin hplin; HPLiniarization hp; diff --git a/OpenHPLTest/HPModelManLin.mo b/OpenHPLTest/Archive/HPModelManLin.mo similarity index 99% rename from OpenHPLTest/HPModelManLin.mo rename to OpenHPLTest/Archive/HPModelManLin.mo index 8ab8ee30..db5d9c15 100644 --- a/OpenHPLTest/HPModelManLin.mo +++ b/OpenHPLTest/Archive/HPModelManLin.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelManLin inner OpenHPL.Data data; import Modelica.Constants.pi; diff --git a/OpenHPLTest/HPModelObserv.mo b/OpenHPLTest/Archive/HPModelObserv.mo similarity index 98% rename from OpenHPLTest/HPModelObserv.mo rename to OpenHPLTest/Archive/HPModelObserv.mo index b206326f..e4343237 100644 --- a/OpenHPLTest/HPModelObserv.mo +++ b/OpenHPLTest/Archive/HPModelObserv.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelObserv inner OpenHPL.Data data; import Modelica.Constants.pi; diff --git a/OpenHPLTest/HPModelObservSim.mo b/OpenHPLTest/Archive/HPModelObservSim.mo similarity index 99% rename from OpenHPLTest/HPModelObservSim.mo rename to OpenHPLTest/Archive/HPModelObservSim.mo index e35742a2..97281c1c 100644 --- a/OpenHPLTest/HPModelObservSim.mo +++ b/OpenHPLTest/Archive/HPModelObservSim.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPModelObservSim inner OpenHPL.Data data; //HPModel hpmod; diff --git a/OpenHPLTest/HPSTAirCushion.mo b/OpenHPLTest/Archive/HPSTAirCushion.mo similarity index 98% rename from OpenHPLTest/HPSTAirCushion.mo rename to OpenHPLTest/Archive/HPSTAirCushion.mo index 670e204d..c17d1509 100644 --- a/OpenHPLTest/HPSTAirCushion.mo +++ b/OpenHPLTest/Archive/HPSTAirCushion.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSTAirCushion "Model of waterway of the HP system with simplified models for conduits, turbine, etc." extends Modelica.Icons.Example; diff --git a/OpenHPLTest/HPSTSharpOrifice.mo b/OpenHPLTest/Archive/HPSTSharpOrifice.mo similarity index 98% rename from OpenHPLTest/HPSTSharpOrifice.mo rename to OpenHPLTest/Archive/HPSTSharpOrifice.mo index f38a2669..28fbf710 100644 --- a/OpenHPLTest/HPSTSharpOrifice.mo +++ b/OpenHPLTest/Archive/HPSTSharpOrifice.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSTSharpOrifice "Model of waterway of the HP system with simplified models for conduits, turbine, etc." extends Modelica.Icons.Example; diff --git a/OpenHPLTest/HPSTSimple.mo b/OpenHPLTest/Archive/HPSTSimple.mo similarity index 98% rename from OpenHPLTest/HPSTSimple.mo rename to OpenHPLTest/Archive/HPSTSimple.mo index fcc49e91..027548f6 100644 --- a/OpenHPLTest/HPSTSimple.mo +++ b/OpenHPLTest/Archive/HPSTSimple.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSTSimple "Model of waterway of the HP system with simplified models for conduits, turbine, etc." extends Modelica.Icons.Example; diff --git a/OpenHPLTest/HPSTThrottleValve.mo b/OpenHPLTest/Archive/HPSTThrottleValve.mo similarity index 98% rename from OpenHPLTest/HPSTThrottleValve.mo rename to OpenHPLTest/Archive/HPSTThrottleValve.mo index 550bf706..ee73a0fa 100644 --- a/OpenHPLTest/HPSTThrottleValve.mo +++ b/OpenHPLTest/Archive/HPSTThrottleValve.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSTThrottleValve "Model of waterway of the HP system with simplified models for conduits, turbine, etc." extends Modelica.Icons.Example; diff --git a/OpenHPLTest/HPSimpleElasticPenstock.mo b/OpenHPLTest/Archive/HPSimpleElasticPenstock.mo similarity index 99% rename from OpenHPLTest/HPSimpleElasticPenstock.mo rename to OpenHPLTest/Archive/HPSimpleElasticPenstock.mo index d3bb7b36..e8e57fa9 100644 --- a/OpenHPLTest/HPSimpleElasticPenstock.mo +++ b/OpenHPLTest/Archive/HPSimpleElasticPenstock.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimpleElasticPenstock "Model of HP system with elastic penctock (StagardGrid), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-90,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimpleElasticPenstockWithoutSurge.mo b/OpenHPLTest/Archive/HPSimpleElasticPenstockWithoutSurge.mo similarity index 99% rename from OpenHPLTest/HPSimpleElasticPenstockWithoutSurge.mo rename to OpenHPLTest/Archive/HPSimpleElasticPenstockWithoutSurge.mo index bbdb6a1a..d98e4031 100644 --- a/OpenHPLTest/HPSimpleElasticPenstockWithoutSurge.mo +++ b/OpenHPLTest/Archive/HPSimpleElasticPenstockWithoutSurge.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimpleElasticPenstockWithoutSurge "Model of HP system without surge tank and with elastic penctock (StagardGrid), but simplified models for turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-90,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockAutoRefGate.mo b/OpenHPLTest/Archive/HPSimplePenstockAutoRefGate.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockAutoRefGate.mo rename to OpenHPLTest/Archive/HPSimplePenstockAutoRefGate.mo index 044a05e8..4e8cb1bf 100644 --- a/OpenHPLTest/HPSimplePenstockAutoRefGate.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockAutoRefGate.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockAutoRefGate extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockControl.mo b/OpenHPLTest/Archive/HPSimplePenstockControl.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockControl.mo rename to OpenHPLTest/Archive/HPSimplePenstockControl.mo index 42429447..09960d14 100644 --- a/OpenHPLTest/HPSimplePenstockControl.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockControl.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockControl "Model of HP system with governor" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockFrancis.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancis.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancis.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancis.mo index 58048617..2b7595f9 100644 --- a/OpenHPLTest/HPSimplePenstockFrancis.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancis.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancis "HP system model with Francis turbine" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockFrancis2.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancis2.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancis2.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancis2.mo index 349da0eb..a64de900 100644 --- a/OpenHPLTest/HPSimplePenstockFrancis2.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancis2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancis2 "HP system model with Francis turbine and generator" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockFrancisGenIPSL.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSL.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancisGenIPSL.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSL.mo index 502ff3e0..0b09cce1 100644 --- a/OpenHPLTest/HPSimplePenstockFrancisGenIPSL.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSL.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancisGenIPSL "Synergy with OpenIPSL library(generator)" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation( diff --git a/OpenHPLTest/HPSimplePenstockFrancisGenIPSLGov.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLGov.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancisGenIPSLGov.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLGov.mo index 14ff923e..b5802f39 100644 --- a/OpenHPLTest/HPSimplePenstockFrancisGenIPSLGov.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLGov.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancisGenIPSLGov "Synergy with OpenIPSL library(generator + governor)" //input Real u; extends Modelica.Icons.Example; diff --git a/OpenHPLTest/HPSimplePenstockFrancisGenIPSLInfBus.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLInfBus.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancisGenIPSLInfBus.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLInfBus.mo index 279c8eac..43fd7c08 100644 --- a/OpenHPLTest/HPSimplePenstockFrancisGenIPSLInfBus.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancisGenIPSLInfBus.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancisGenIPSLInfBus "Synergy with OpenIPSL library(generator + infinitBus)" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockFrancisGener.mo b/OpenHPLTest/Archive/HPSimplePenstockFrancisGener.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockFrancisGener.mo rename to OpenHPLTest/Archive/HPSimplePenstockFrancisGener.mo index fb7615aa..e8742f41 100644 --- a/OpenHPLTest/HPSimplePenstockFrancisGener.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockFrancisGener.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockFrancisGener "HP system model with Francis turbine and generator" extends Modelica.Icons.Example; Real coef; diff --git a/OpenHPLTest/HPSimplePenstockGeneratorTest.mo b/OpenHPLTest/Archive/HPSimplePenstockGeneratorTest.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockGeneratorTest.mo rename to OpenHPLTest/Archive/HPSimplePenstockGeneratorTest.mo index bf592de2..1df4d921 100644 --- a/OpenHPLTest/HPSimplePenstockGeneratorTest.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockGeneratorTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockGeneratorTest "Generator testing for HP" extends Modelica.Icons.Example; import Modelica.Constants.pi; diff --git a/OpenHPLTest/HPSimplePenstockOpenChannel.mo b/OpenHPLTest/Archive/HPSimplePenstockOpenChannel.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockOpenChannel.mo rename to OpenHPLTest/Archive/HPSimplePenstockOpenChannel.mo index f4a73bd4..ce087571 100644 --- a/OpenHPLTest/HPSimplePenstockOpenChannel.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockOpenChannel.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockOpenChannel "testing open channel" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir annotation (Placement(transformation(origin={-90,44}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockPelton.mo b/OpenHPLTest/Archive/HPSimplePenstockPelton.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockPelton.mo rename to OpenHPLTest/Archive/HPSimplePenstockPelton.mo index fe009b57..59a1c995 100644 --- a/OpenHPLTest/HPSimplePenstockPelton.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockPelton.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockPelton "HP system model with Pelton turbine" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation(origin={-92,62}, extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/HPSimplePenstockResKP.mo b/OpenHPLTest/Archive/HPSimplePenstockResKP.mo similarity index 99% rename from OpenHPLTest/HPSimplePenstockResKP.mo rename to OpenHPLTest/Archive/HPSimplePenstockResKP.mo index 6a4b43c4..86804900 100644 --- a/OpenHPLTest/HPSimplePenstockResKP.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockResKP.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSimplePenstockResKP "Model of HP system with using reservoir model based on open channel" extends Modelica.Icons.Example; Modelica.Blocks.Sources.Ramp control(duration = 1, height = -0.04615, offset = 0.7493, startTime = 600) annotation ( diff --git a/OpenHPLTest/HPSquareFittingsTest.mo b/OpenHPLTest/Archive/HPSquareFittingsTest.mo similarity index 99% rename from OpenHPLTest/HPSquareFittingsTest.mo rename to OpenHPLTest/Archive/HPSquareFittingsTest.mo index 33c36554..dd68655f 100644 --- a/OpenHPLTest/HPSquareFittingsTest.mo +++ b/OpenHPLTest/Archive/HPSquareFittingsTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPSquareFittingsTest "Test for comparing fitting behaviour" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir headWater(h_0=10) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); diff --git a/OpenHPLTest/HPTaperedFittingsTest.mo b/OpenHPLTest/Archive/HPTaperedFittingsTest.mo similarity index 99% rename from OpenHPLTest/HPTaperedFittingsTest.mo rename to OpenHPLTest/Archive/HPTaperedFittingsTest.mo index 49da5508..616ff3d3 100644 --- a/OpenHPLTest/HPTaperedFittingsTest.mo +++ b/OpenHPLTest/Archive/HPTaperedFittingsTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HPTaperedFittingsTest "Test for comparing fitting behaviour" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir headWater(h_0=10) annotation (Placement(transformation(extent={{-100,-10},{-80,10}}))); diff --git a/OpenHPLTest/HydroCordModeKPlFrancisDraftTube.mo b/OpenHPLTest/Archive/HydroCordModeKPlFrancisDraftTube.mo similarity index 99% rename from OpenHPLTest/HydroCordModeKPlFrancisDraftTube.mo rename to OpenHPLTest/Archive/HydroCordModeKPlFrancisDraftTube.mo index 97c781c0..1be28e9e 100644 --- a/OpenHPLTest/HydroCordModeKPlFrancisDraftTube.mo +++ b/OpenHPLTest/Archive/HydroCordModeKPlFrancisDraftTube.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModeKPlFrancisDraftTube "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModel.mo b/OpenHPLTest/Archive/HydroCordModel.mo similarity index 99% rename from OpenHPLTest/HydroCordModel.mo rename to OpenHPLTest/Archive/HydroCordModel.mo index f4f1d2be..9a95090b 100644 --- a/OpenHPLTest/HydroCordModel.mo +++ b/OpenHPLTest/Archive/HydroCordModel.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModel "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=418.5 - 372, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModel2.mo b/OpenHPLTest/Archive/HydroCordModel2.mo similarity index 99% rename from OpenHPLTest/HydroCordModel2.mo rename to OpenHPLTest/Archive/HydroCordModel2.mo index d99c27c1..e8cdeb31 100644 --- a/OpenHPLTest/HydroCordModel2.mo +++ b/OpenHPLTest/Archive/HydroCordModel2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModel2 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=418.5 - 372, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelDraftTube.mo b/OpenHPLTest/Archive/HydroCordModelDraftTube.mo similarity index 99% rename from OpenHPLTest/HydroCordModelDraftTube.mo rename to OpenHPLTest/Archive/HydroCordModelDraftTube.mo index 0de73552..efc25d2b 100644 --- a/OpenHPLTest/HydroCordModelDraftTube.mo +++ b/OpenHPLTest/Archive/HydroCordModelDraftTube.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelDraftTube "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=418.5 - 372, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelDraftTube2.mo b/OpenHPLTest/Archive/HydroCordModelDraftTube2.mo similarity index 99% rename from OpenHPLTest/HydroCordModelDraftTube2.mo rename to OpenHPLTest/Archive/HydroCordModelDraftTube2.mo index 42eca688..b3b46f33 100644 --- a/OpenHPLTest/HydroCordModelDraftTube2.mo +++ b/OpenHPLTest/Archive/HydroCordModelDraftTube2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelDraftTube2 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=418.5 - 372, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelDraftTube3.mo b/OpenHPLTest/Archive/HydroCordModelDraftTube3.mo similarity index 99% rename from OpenHPLTest/HydroCordModelDraftTube3.mo rename to OpenHPLTest/Archive/HydroCordModelDraftTube3.mo index 0b5d7d3c..064e3cab 100644 --- a/OpenHPLTest/HydroCordModelDraftTube3.mo +++ b/OpenHPLTest/Archive/HydroCordModelDraftTube3.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelDraftTube3 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=418.5 - 372, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelFrancis.mo b/OpenHPLTest/Archive/HydroCordModelFrancis.mo similarity index 99% rename from OpenHPLTest/HydroCordModelFrancis.mo rename to OpenHPLTest/Archive/HydroCordModelFrancis.mo index b2c3e2a3..d19ceecc 100644 --- a/OpenHPLTest/HydroCordModelFrancis.mo +++ b/OpenHPLTest/Archive/HydroCordModelFrancis.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelFrancis "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelFrancis2.mo b/OpenHPLTest/Archive/HydroCordModelFrancis2.mo similarity index 99% rename from OpenHPLTest/HydroCordModelFrancis2.mo rename to OpenHPLTest/Archive/HydroCordModelFrancis2.mo index 652ac883..12945b86 100644 --- a/OpenHPLTest/HydroCordModelFrancis2.mo +++ b/OpenHPLTest/Archive/HydroCordModelFrancis2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelFrancis2 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelFrancisDraftTube.mo b/OpenHPLTest/Archive/HydroCordModelFrancisDraftTube.mo similarity index 99% rename from OpenHPLTest/HydroCordModelFrancisDraftTube.mo rename to OpenHPLTest/Archive/HydroCordModelFrancisDraftTube.mo index 0fa4c107..881125f7 100644 --- a/OpenHPLTest/HydroCordModelFrancisDraftTube.mo +++ b/OpenHPLTest/Archive/HydroCordModelFrancisDraftTube.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelFrancisDraftTube "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKP.mo b/OpenHPLTest/Archive/HydroCordModelKP.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKP.mo rename to OpenHPLTest/Archive/HydroCordModelKP.mo index b0098b0f..e1c156c8 100644 --- a/OpenHPLTest/HydroCordModelKP.mo +++ b/OpenHPLTest/Archive/HydroCordModelKP.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKP "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKP2.mo b/OpenHPLTest/Archive/HydroCordModelKP2.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKP2.mo rename to OpenHPLTest/Archive/HydroCordModelKP2.mo index 1f59bc93..078061e1 100644 --- a/OpenHPLTest/HydroCordModelKP2.mo +++ b/OpenHPLTest/Archive/HydroCordModelKP2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKP2 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKPDraftTube.mo b/OpenHPLTest/Archive/HydroCordModelKPDraftTube.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKPDraftTube.mo rename to OpenHPLTest/Archive/HydroCordModelKPDraftTube.mo index be2c542b..041bf70f 100644 --- a/OpenHPLTest/HydroCordModelKPDraftTube.mo +++ b/OpenHPLTest/Archive/HydroCordModelKPDraftTube.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKPDraftTube "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKPFran.mo b/OpenHPLTest/Archive/HydroCordModelKPFran.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKPFran.mo rename to OpenHPLTest/Archive/HydroCordModelKPFran.mo index 9bcb478e..ec9782c7 100644 --- a/OpenHPLTest/HydroCordModelKPFran.mo +++ b/OpenHPLTest/Archive/HydroCordModelKPFran.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKPFran "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKPFran2.mo b/OpenHPLTest/Archive/HydroCordModelKPFran2.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKPFran2.mo rename to OpenHPLTest/Archive/HydroCordModelKPFran2.mo index 801e69b5..a8e597d3 100644 --- a/OpenHPLTest/HydroCordModelKPFran2.mo +++ b/OpenHPLTest/Archive/HydroCordModelKPFran2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKPFran2 "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=46.5, UseInFlow=false) annotation (Placement(transformation( diff --git a/OpenHPLTest/HydroCordModelKPall.mo b/OpenHPLTest/Archive/HydroCordModelKPall.mo similarity index 99% rename from OpenHPLTest/HydroCordModelKPall.mo rename to OpenHPLTest/Archive/HydroCordModelKPall.mo index 350211c0..10476fe0 100644 --- a/OpenHPLTest/HydroCordModelKPall.mo +++ b/OpenHPLTest/Archive/HydroCordModelKPall.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model HydroCordModelKPall "Model of HP system with simplified models for penstock, turbine, etc." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir( diff --git a/OpenHPLTest/Reservoir.mo b/OpenHPLTest/Archive/Reservoir.mo similarity index 98% rename from OpenHPLTest/Reservoir.mo rename to OpenHPLTest/Archive/Reservoir.mo index 79567fb6..40c92c8e 100644 --- a/OpenHPLTest/Reservoir.mo +++ b/OpenHPLTest/Archive/Reservoir.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model Reservoir extends Modelica.Icons.Example; diff --git a/OpenHPLTest/TestFitingSimpleHP.mo b/OpenHPLTest/Archive/TestFitingSimpleHP.mo similarity index 99% rename from OpenHPLTest/TestFitingSimpleHP.mo rename to OpenHPLTest/Archive/TestFitingSimpleHP.mo index c4bc0f69..4159b96b 100644 --- a/OpenHPLTest/TestFitingSimpleHP.mo +++ b/OpenHPLTest/Archive/TestFitingSimpleHP.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model TestFitingSimpleHP "Model of HP system with pipe fitting" extends Modelica.Icons.Example; OpenHPL.Waterway.Pipe conduit( diff --git a/OpenHPLTest/TestMCB.mo b/OpenHPLTest/Archive/TestMCB.mo similarity index 98% rename from OpenHPLTest/TestMCB.mo rename to OpenHPLTest/Archive/TestMCB.mo index 815e545f..a1a8c4c3 100644 --- a/OpenHPLTest/TestMCB.mo +++ b/OpenHPLTest/Archive/TestMCB.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model TestMCB "Testing the operation of the MCB" extends Modelica.Icons.Example; OpenHPL.ElectroMech.PowerSystem.MCB mCB(deltaSpeed=0.01) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); diff --git a/OpenHPLTest/TestRunoff.mo b/OpenHPLTest/Archive/TestRunoff.mo similarity index 98% rename from OpenHPLTest/TestRunoff.mo rename to OpenHPLTest/Archive/TestRunoff.mo index 8b0d168a..6675db71 100644 --- a/OpenHPLTest/TestRunoff.mo +++ b/OpenHPLTest/Archive/TestRunoff.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model TestRunoff extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir1( diff --git a/OpenHPLTest/TorpaHPPAirCushionTest.mo b/OpenHPLTest/Archive/TorpaHPPAirCushionTest.mo similarity index 98% rename from OpenHPLTest/TorpaHPPAirCushionTest.mo rename to OpenHPLTest/Archive/TorpaHPPAirCushionTest.mo index cf5accaa..0ef78702 100644 --- a/OpenHPLTest/TorpaHPPAirCushionTest.mo +++ b/OpenHPLTest/Archive/TorpaHPPAirCushionTest.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model TorpaHPPAirCushionTest "Test case for air cushion surge tank from Torpa hydro power plant." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=200) diff --git a/OpenHPLTest/TorpaHPPAirCushionTest2.mo b/OpenHPLTest/Archive/TorpaHPPAirCushionTest2.mo similarity index 98% rename from OpenHPLTest/TorpaHPPAirCushionTest2.mo rename to OpenHPLTest/Archive/TorpaHPPAirCushionTest2.mo index 7ec55bd6..3076bdee 100644 --- a/OpenHPLTest/TorpaHPPAirCushionTest2.mo +++ b/OpenHPLTest/Archive/TorpaHPPAirCushionTest2.mo @@ -1,4 +1,4 @@ -within OpenHPLTest; +within OpenHPLTest.Archive; model TorpaHPPAirCushionTest2 "Test case for air cushion surge tank from Torpa hydro power plant." extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir reservoir(h_0=48) annotation (Placement(transformation( diff --git a/OpenHPLTest/Archive/package.mo b/OpenHPLTest/Archive/package.mo new file mode 100644 index 00000000..501102de --- /dev/null +++ b/OpenHPLTest/Archive/package.mo @@ -0,0 +1,6 @@ +within OpenHPLTest; +package Archive + extends Modelica.Icons.ExamplesPackage; + + extends Modelica.Icons.ObsoleteModel; +end Archive; diff --git a/OpenHPLTest/Archive/package.order b/OpenHPLTest/Archive/package.order new file mode 100644 index 00000000..8aaed842 --- /dev/null +++ b/OpenHPLTest/Archive/package.order @@ -0,0 +1,72 @@ +CaseStudingValentynasCase +HPAllTypeFittingsTest +HPBjarneBorresen +HPDraftTube +HPElasticKPPenstock +HPElasticKPPenstockANDIntake +HPElasticKPPenstockCompres +HPElasticKPPenstockFrancis +HPElasticKPPenstockFrancisGov +HPElasticKPPenstockHalfSurgeD +HPElasticKPPenstockWithoutSurge +HPLiniarization +HPLiniarization2 +HPLiniarization3 +HPLiniarization4 +HPLiniarizationFranGen +HPLiniarizationGenIPSL +HPLiniarizationGenIPSLKP +HPLiniarizationKP +HPLiniarizationKPFran +HPLinTest +HPModel +HPModelDEA +HPModelKPLin +HPModelKPLinPI +HPModelLin +HPModelLinPI +HPModelManLin +HPModelObserv +HPModelObservSim +HPSimpleElasticPenstock +HPSimpleElasticPenstockWithoutSurge +HPSimplePenstockAutoRefGate +HPSimplePenstockControl +HPSimplePenstockFrancis +HPSimplePenstockFrancis2 +HPSimplePenstockFrancisGener +HPSimplePenstockFrancisGenIPSL +HPSimplePenstockFrancisGenIPSLGov +HPSimplePenstockFrancisGenIPSLInfBus +HPSimplePenstockGeneratorTest +HPSimplePenstockOpenChannel +HPSimplePenstockPelton +HPSimplePenstockResKP +HPSquareFittingsTest +HPSTAirCushion +HPSTSharpOrifice +HPSTSimple +HPSTThrottleValve +HPTaperedFittingsTest +HydroCordModeKPlFrancisDraftTube +HydroCordModel +HydroCordModel2 +HydroCordModelDraftTube +HydroCordModelDraftTube2 +HydroCordModelDraftTube3 +HydroCordModelFrancis +HydroCordModelFrancis2 +HydroCordModelFrancisDraftTube +HydroCordModelKP +HydroCordModelKP2 +HydroCordModelKPall +HydroCordModelKPDraftTube +HydroCordModelKPFran +HydroCordModelKPFran2 +OpenChannel +Reservoir +TestFitingSimpleHP +TestMCB +TestRunoff +TorpaHPPAirCushionTest +TorpaHPPAirCushionTest2 diff --git a/OpenHPLTest/EmpiricalTurbine.mo b/OpenHPLTest/EmpiricalTurbine.mo deleted file mode 100644 index f4403f84..00000000 --- a/OpenHPLTest/EmpiricalTurbine.mo +++ /dev/null @@ -1,213 +0,0 @@ -within OpenHPLTest; - -package EmpiricalTurbine - extends Modelica.Icons.ExamplesPackage; - - class Information - extends Modelica.Icons.Information; - annotation( - Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the dassl solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); - end Information; - - package TestBasicFunctions - extends Modelica.Icons.ExamplesPackage; - // - - model Test01_BezierCurve - extends Modelica.Icons.Example; - Real[ndim] curvePoint; - protected - constant Integer ndim = 3; - parameter Real controlPoints[6, ndim] = {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}; - equation - curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); - annotation( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), - Documentation(info = "Basic test of evaluation of Bezier curve using deCasteljau algorithm.
Parametric curve plot of curvePoint[1] againts curvPoint[2] should show a smooth trajectory of QED vs nED.


")); - end Test01_BezierCurve; - - // - - model Test02_ControlPoints - extends Modelica.Icons.Example; - // - protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public - Real cPoints1[NP, ND], cPoints2[NP, ND], cPoints3[NP, ND]; - Real[ND] curvePoint1, curvePoint2, curvePoint3; - equation - cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); - curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND, cPoints1); - cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); - curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND, cPoints2); - cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); - curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND, cPoints3); - annotation( - Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve.
Computes three curve trajectories as weighted intermediate curves. Parametrci curve plot of curvePoints1[1] against  curvePoints1[2] and similar for curvePonts2 and curvePoints3 should show smooth curves 2D curves.
"), - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); - end Test02_ControlPoints; - end TestBasicFunctions; - - package TurbineTest - extends Modelica.Icons.ExamplesPackage; - import SI = Modelica.Units.SI; - - partial model AbstractTurbineTest - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - protected - constant Integer NC = 11; - constant Integer NP = 6; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.014, 0.030, 0.050, 0.100, 0.200, 0.300, 0.400, 0.500, 0.601, 0.800, 1.000}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.07, 0.07}, {0.30, 0.10, 0.07}, {0.54, -0.07, -0.03}, {0.92, 0.25, 0.13}, {1.13, -0.11, -0.17}, {1.43, -0.06, -0.31}}, {{0.00, 0.11, 0.15}, {0.32, 0.15, 0.17}, {0.51, -0.06, -0.09}, {1.00, 0.35, 0.35}, {1.11, -0.12, -0.30}, {1.43, -0.09, -0.31}}, {{0.00, 0.15, 0.23}, {0.34, 0.21, 0.24}, {0.47, -0.08, -0.01}, {1.07, 0.46, 0.35}, {1.09, -0.15, -0.24}, {1.43, -0.11, -0.37}}, {{0.00, 0.27, 0.45}, {0.37, 0.30, 0.40}, {0.40, 0.05, 0.30}, {1.38, 0.60, 0.26}, {0.97, -0.19, -0.17}, {1.43, -0.13, -0.42}}, {{0.00, 0.51, 0.92}, {0.40, 0.53, 0.80}, {0.45, 0.31, 0.83}, {1.48, 0.75, 0.14}, {0.99, -0.14, -0.06}, {1.44, -0.17, -0.49}}, {{0.00, 0.77, 1.41}, {0.44, 0.79, 1.23}, {0.51, 0.56, 1.29}, {1.62, 0.82, -0.14}, {0.99, -0.05, 0.11}, {1.43, -0.18, -0.51}}, {{0.00, 1.01, 1.87}, {0.48, 1.05, 1.70}, {0.56, 0.74, 1.46}, {1.68, 0.84, -0.35}, {1.03, 0.06, 0.23}, {1.43, -0.19, -0.53}}, {{0.00, 1.25, 2.27}, {0.52, 1.26, 1.99}, {0.63, 1.00, 1.84}, {1.70, 0.83, -0.64}, {1.08, 0.17, 0.35}, {1.43, -0.18, -0.52}}, {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}, {{0.00, 1.79, 3.06}, {0.55, 1.78, 2.77}, {0.99, 1.43, 1.67}, {1.53, 0.94, -0.59}, {1.20, 0.31, 0.28}, {1.45, -0.16, -0.54}}, {{0.00, 2.10, 3.41}, {0.59, 2.02, 2.99}, {1.05, 1.63, 1.56}, {1.53, 1.04, -0.47}, {1.22, 0.40, 0.24}, {1.45, -0.13, -0.54}}}; - /* - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - */ - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); - public - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( - Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); - - - end AbstractTurbineTest; - - model Test01_TurbineLookUp - extends AbstractTurbineTest; - public - Real opening; - SI.Length Ht "Turbine head"; - SI.VolumeFlowRate Qt "Turbine flow rate"; - SI.Frequency nrps "Rotational speed"; - SI.Torque Tt "Turbine torque"; - equation - Ht = 425.0; - nrps = 1.0e-03 + 8.33*time*1.4; - opening = 0.6; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, tc); - annotation( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), - Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); - end Test01_TurbineLookUp; - - // - - model Test02_Turbine - extends AbstractTurbineTest; - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - equation - connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - annotation( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), - experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-06, Interval = 0.001)); - end Test02_Turbine; - - // - - model Test03_Turbine - extends AbstractTurbineTest; - - public - OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation( - Placement(transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}))); - - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - equation - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, tunnel.i) annotation( - Line(points = {{-70, 32}, {-54, 32}}, color = {0, 128, 255})); - connect(tunnel.o, turbine.i) annotation( - Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); - annotation( - experiment(StartTime = 0, StopTime = 10.0, Tolerance = 1e-06, Interval = 0.2000), - Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), - __OpenModelica_commandLineOptions = "--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", - __OpenModelica_simulationFlags(lv = "LOG_STDOUT,LOG_ASSERT,LOG_STATS", s = "dassl", noHomotopyOnFirstTry = "()",homMaxNewtonSteps= "50",homMaxTries="30",variableFilter = ".*")); - end Test03_Turbine; - - // - - model Test04_Turbine - extends AbstractTurbineTest; - public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation( - Placement(transformation(origin = {-80, 44}, extent = {{-12, 24}, {6, 6}}))); - equation - connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - annotation( - experiment(StartTime = 0, StopTime = 15, Tolerance = 1e-06, Interval = 0.01)); -end Test04_Turbine; - // - model Test05_Turbine - extends AbstractTurbineTest; - // - public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation( - Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation( - Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); - - Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - equation - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, tunnel.i) annotation( - Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); - connect(tunnel.o, turbine.i) annotation( - Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); - end Test05_Turbine; - end TurbineTest; -end EmpiricalTurbine; diff --git a/OpenHPLTest/EmpiricalTurbine/Information.mo b/OpenHPLTest/EmpiricalTurbine/Information.mo new file mode 100644 index 00000000..cf1e5a60 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/Information.mo @@ -0,0 +1,6 @@ +within OpenHPLTest.EmpiricalTurbine; +class Information +extends Modelica.Icons.Information; + annotation ( + Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the dassl solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); +end Information; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test01_BezierCurve.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test01_BezierCurve.mo new file mode 100644 index 00000000..1bccb13c --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test01_BezierCurve.mo @@ -0,0 +1,13 @@ +within OpenHPLTest.EmpiricalTurbine.TestBasicFunctions; +model Test01_BezierCurve + extends Modelica.Icons.Example; + Real[ndim] curvePoint; +protected + constant Integer ndim = 3; + parameter Real controlPoints[6, ndim] = {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}; +equation + curvePoint = OpenHPL.Functions.deCasteljau(time, ndim, controlPoints); + annotation ( + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), + Documentation(info = "Basic test of evaluation of Bezier curve using deCasteljau algorithm.
Parametric curve plot of curvePoint[1] againts curvPoint[2] should show a smooth trajectory of QED vs nED.


")); +end Test01_BezierCurve; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo new file mode 100644 index 00000000..754e3356 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo @@ -0,0 +1,27 @@ +within OpenHPLTest.EmpiricalTurbine.TestBasicFunctions; +model Test02_ControlPoints + extends Modelica.Icons.Example; + // +protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); +public + Real cPoints1[NP, ND], cPoints2[NP, ND], cPoints3[NP, ND]; + Real[ND] curvePoint1; + Real[ND] curvePoint2; + Real[ND] curvePoint3; +equation + cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); + curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND, cPoints1); + cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); + curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND, cPoints2); + cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); + curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND, cPoints3); + annotation ( + Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve.
Computes three curve trajectories as weighted intermediate curves. Parametrci curve plot of curvePoints1[1] against  curvePoints1[2] and similar for curvePonts2 and curvePoints3 should show smooth curves 2D curves.
"), + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); +end Test02_ControlPoints; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo new file mode 100644 index 00000000..2d071fd9 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo @@ -0,0 +1,9 @@ +within OpenHPLTest.EmpiricalTurbine; +package TestBasicFunctions + extends Modelica.Icons.ExamplesPackage; + // + + + // + +end TestBasicFunctions; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order new file mode 100644 index 00000000..9aa35a04 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order @@ -0,0 +1,2 @@ +Test01_BezierCurve +Test02_ControlPoints diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo new file mode 100644 index 00000000..f4f675bc --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo @@ -0,0 +1,24 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +partial model AbstractTurbineTest + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); +protected + constant Integer NC = 11; + constant Integer NP = 6; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.014, 0.030, 0.050, 0.100, 0.200, 0.300, 0.400, 0.500, 0.601, 0.800, 1.000}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.07, 0.07}, {0.30, 0.10, 0.07}, {0.54, -0.07, -0.03}, {0.92, 0.25, 0.13}, {1.13, -0.11, -0.17}, {1.43, -0.06, -0.31}}, {{0.00, 0.11, 0.15}, {0.32, 0.15, 0.17}, {0.51, -0.06, -0.09}, {1.00, 0.35, 0.35}, {1.11, -0.12, -0.30}, {1.43, -0.09, -0.31}}, {{0.00, 0.15, 0.23}, {0.34, 0.21, 0.24}, {0.47, -0.08, -0.01}, {1.07, 0.46, 0.35}, {1.09, -0.15, -0.24}, {1.43, -0.11, -0.37}}, {{0.00, 0.27, 0.45}, {0.37, 0.30, 0.40}, {0.40, 0.05, 0.30}, {1.38, 0.60, 0.26}, {0.97, -0.19, -0.17}, {1.43, -0.13, -0.42}}, {{0.00, 0.51, 0.92}, {0.40, 0.53, 0.80}, {0.45, 0.31, 0.83}, {1.48, 0.75, 0.14}, {0.99, -0.14, -0.06}, {1.44, -0.17, -0.49}}, {{0.00, 0.77, 1.41}, {0.44, 0.79, 1.23}, {0.51, 0.56, 1.29}, {1.62, 0.82, -0.14}, {0.99, -0.05, 0.11}, {1.43, -0.18, -0.51}}, {{0.00, 1.01, 1.87}, {0.48, 1.05, 1.70}, {0.56, 0.74, 1.46}, {1.68, 0.84, -0.35}, {1.03, 0.06, 0.23}, {1.43, -0.19, -0.53}}, {{0.00, 1.25, 2.27}, {0.52, 1.26, 1.99}, {0.63, 1.00, 1.84}, {1.70, 0.83, -0.64}, {1.08, 0.17, 0.35}, {1.43, -0.18, -0.52}}, {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}, {{0.00, 1.79, 3.06}, {0.55, 1.78, 2.77}, {0.99, 1.43, 1.67}, {1.53, 0.94, -0.59}, {1.20, 0.31, 0.28}, {1.45, -0.16, -0.54}}, {{0.00, 2.10, 3.41}, {0.59, 2.02, 2.99}, {1.05, 1.63, 1.56}, {1.53, 1.04, -0.47}, {1.22, 0.40, 0.24}, {1.45, -0.13, -0.54}}}; + /* + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + */ + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); +public + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( + Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); + +end AbstractTurbineTest; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo new file mode 100644 index 00000000..7d03fe4f --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo @@ -0,0 +1,18 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +model Test01_TurbineLookUp + extends AbstractTurbineTest; +public + Real opening; + SI.Length Ht "Turbine head"; + SI.VolumeFlowRate Qt "Turbine flow rate"; + SI.Frequency nrps "Rotational speed"; + SI.Torque Tt "Turbine torque"; +equation + Ht = 425.0; + nrps = 1.0e-03 + 8.33*time*1.4; + opening = 0.6; + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, tc); + annotation ( + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), + Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); +end Test01_TurbineLookUp; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo new file mode 100644 index 00000000..2a89add1 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo @@ -0,0 +1,22 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +model Test02_Turbine +extends AbstractTurbineTest; + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); +equation + connect(overvann.o, turbine.i) annotation ( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation ( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation ( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + annotation ( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-06, Interval = 0.001)); +end Test02_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo new file mode 100644 index 00000000..d541f952 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -0,0 +1,37 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +model Test03_Turbine + extends AbstractTurbineTest; + +public + OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( + Placement(transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}))); + + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( + Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); +equation + connect(turbine.o, undervann.o) annotation ( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation ( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, tunnel.i) annotation ( + Line(points = {{-70, 32}, {-54, 32}}, color = {0, 128, 255})); + connect(tunnel.o, turbine.i) annotation ( + Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); + annotation ( + experiment(StartTime = 0, StopTime = 10.0, Tolerance = 1e-06, Interval = 0.2000), + Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), + __OpenModelica_commandLineOptions="--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", + __OpenModelica_simulationFlags( + lv="LOG_STDOUT,LOG_ASSERT,LOG_STATS", + s="dassl", + noHomotopyOnFirstTry="()", + homMaxNewtonSteps="50", + homMaxTries="30", + variableFilter=".*")); +end Test03_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo new file mode 100644 index 00000000..5a3be680 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -0,0 +1,24 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +model Test04_Turbine + extends AbstractTurbineTest; +public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( + Placement(transformation(origin = {-80, 44}, extent = {{-12, 24}, {6, 6}}))); +equation + connect(overvann.o, turbine.i) annotation ( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation ( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation ( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); +annotation ( + experiment(StartTime = 0, StopTime = 15, Tolerance = 1e-06, Interval = 0.01)); +end Test04_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo new file mode 100644 index 00000000..d78e99c4 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -0,0 +1,26 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; +model Test05_Turbine + extends AbstractTurbineTest; + // +public + OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( + Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( + Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); + + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation ( + Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); +equation + connect(turbine.o, undervann.o) annotation ( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation ( + Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); +connect(overvann.o, tunnel.i) annotation ( + Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); +connect(tunnel.o, turbine.i) annotation ( + Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); +end Test05_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo new file mode 100644 index 00000000..d8210d6b --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo @@ -0,0 +1,17 @@ +within OpenHPLTest.EmpiricalTurbine; +package TurbineTest + extends Modelica.Icons.ExamplesPackage; + import Modelica.Units.SI; + + + + // + + + // + + + // + + // +end TurbineTest; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order new file mode 100644 index 00000000..871b47d9 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -0,0 +1,6 @@ +AbstractTurbineTest +Test01_TurbineLookUp +Test02_Turbine +Test03_Turbine +Test04_Turbine +Test05_Turbine diff --git a/OpenHPLTest/EmpiricalTurbine/package.mo b/OpenHPLTest/EmpiricalTurbine/package.mo new file mode 100644 index 00000000..c186e192 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/package.mo @@ -0,0 +1,7 @@ +within OpenHPLTest; +package EmpiricalTurbine + extends Modelica.Icons.ExamplesPackage; + + + +end EmpiricalTurbine; diff --git a/OpenHPLTest/EmpiricalTurbine/package.order b/OpenHPLTest/EmpiricalTurbine/package.order new file mode 100644 index 00000000..dc6141d7 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/package.order @@ -0,0 +1,3 @@ +Information +TestBasicFunctions +TurbineTest diff --git a/OpenHPLTest/TestPipe.mo b/OpenHPLTest/TestPipe.mo deleted file mode 100644 index 1148e236..00000000 --- a/OpenHPLTest/TestPipe.mo +++ /dev/null @@ -1,105 +0,0 @@ -within OpenHPLTest; - -package TestPipe - extends Modelica.Icons.ExamplesPackage; - - partial model AbstractTest - extends Modelica.Icons.Example; - // - inner OpenHPL.Data data(Vdot_0 = 0.0, p_a = 0.0, p_eps = 0.0) annotation( - Placement(transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}))); - // - parameter Modelica.Units.SI.Length Ln = 1000.; - parameter Modelica.Units.SI.Length Dn = sqrt(A*4/Modelica.Constants.pi); - Real error; - OpenHPL.Waterway.Reservoir Upstream(h_0 = 100, constantLevel = true) annotation( - Placement(transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir Downstream(constantLevel = true, h_0 = 0) annotation( - Placement(transformation(origin = {70, 10}, extent = {{10, -10}, {-10, 10}}))); - protected - constant Modelica.Units.SI.Area A = 0.1; - end AbstractTest; - - model Test01 - extends AbstractTest; - OpenHPL.Waterway.Pipe pipe1(H = 0, L = Ln, D_i = 0.8*Dn, D_o = 1.2*Dn) annotation( - Placement(transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe2(H = 0, L = Ln, D_i = Dn, D_o = Dn) annotation( - Placement(transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe3(H = 0, L = Ln, D_i = 1.2*Dn, D_o = 0.8*Dn) annotation( - Placement(transformation(extent = {{-10, -10}, {10, 10}}))); - equation - error=sqrt((pipe1.mdot-pipe2.mdot)^2 + (pipe2.mdot-pipe3.mdot)^2 + (pipe3.mdot-pipe1.mdot)^2); - connect(Upstream.o, pipe1.i) annotation( - Line(points = {{-40, 30}, {-20, 30}, {-20, 60}, {-10, 60}}, color = {0, 128, 255})); - connect(pipe2.i, Upstream.o) annotation( - Line(points = {{-10, 30}, {-40, 30}}, color = {0, 128, 255})); - connect(Upstream.o, pipe3.i) annotation( - Line(points = {{-40, 30}, {-20, 30}, {-20, 0}, {-10, 0}}, color = {0, 128, 255})); - connect(pipe1.o, Downstream.o) annotation( - Line(points = {{10, 60}, {50, 60}, {50, 10}, {60, 10}}, color = {0, 128, 255})); - connect(pipe2.o, Downstream.o) annotation( - Line(points = {{10, 30}, {50, 30}, {50, 10}, {60, 10}}, color = {0, 128, 255})); - connect(pipe3.o, Downstream.o) annotation( - Line(points = {{10, 0}, {50, 0}, {50, 10}, {60, 10}}, color = {0, 128, 255})); - annotation( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); -end Test01; - - model Test02 - extends OpenHPLTest.TestPipe.Test01(data(SteadyState = true)); - equation - - end Test02; - - model Test03 - extends AbstractTest(data(SteadyState = true)); - - OpenHPL.Waterway.Pipe pipe1(H = 0, L = Ln, D_i = Dn) annotation( - Placement(transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe2(H = 0, L = Ln, D_i = Dn) annotation( - Placement(transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe3(H = 0, L = Ln, D_i = Dn) annotation( Placement(transformation(extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Valve valve1(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation( - Placement(transformation(origin = {30, 60}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Valve valve2(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation( - Placement(transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Valve valve3(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation( - Placement(transformation(origin = {30, 0}, extent = {{-10, 10}, {10, -10}}))); - Modelica.Blocks.Sources.Ramp ramp1(height = 1, duration = 5, offset = 0, startTime = 2) annotation( - Placement(transformation(origin = {80, 80}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - Modelica.Blocks.Sources.Ramp ramp2(duration = 5, height = 0.5, offset = 0.5, startTime = 2) annotation( - Placement(transformation(origin = {80, 50}, extent = {{10, -10}, {-10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp3(duration = 5, height = -1, offset = 1, startTime = 2) annotation( - Placement(transformation(origin = {80, -20}, extent = {{10, -10}, {-10, 10}}))); - equation - error=sqrt((pipe1.mdot-pipe2.mdot)^2 + (pipe2.mdot-pipe3.mdot)^2 + (pipe3.mdot-pipe1.mdot)^2); - connect(pipe1.o, valve1.i) annotation( - Line(points = {{10, 60}, {20, 60}}, color = {0, 128, 255})); - connect(pipe2.o, valve2.i) annotation( - Line(points = {{10, 30}, {20, 30}}, color = {0, 128, 255})); - connect(pipe3.o, valve3.i) annotation( - Line(points = {{10, 0}, {20, 0}}, color = {0, 128, 255})); - connect(ramp1.y, valve1.opening) annotation( - Line(points = {{69, 80}, {30, 80}, {30, 68}}, color = {0, 0, 127})); - connect(valve1.o, Downstream.o) annotation( - Line(points = {{40, 60}, {52, 60}, {52, 10}, {62, 10}}, color = {0, 128, 255})); - connect(valve2.o, Downstream.o) annotation( - Line(points = {{40, 30}, {52, 30}, {52, 10}, {62, 10}}, color = {0, 128, 255})); - connect(ramp3.y, valve3.opening) annotation( - Line(points = {{69, -20}, {30, -20}, {30, -8}}, color = {0, 0, 127})); - connect(valve3.o, Downstream.o) annotation( - Line(points = {{40, 0}, {52, 0}, {52, 10}, {62, 10}}, color = {0, 128, 255})); - connect(valve2.opening, ramp2.y) annotation( - Line(points = {{30, 38}, {30, 50}, {70, 50}}, color = {0, 0, 127})); - connect(Upstream.o, pipe2.i) annotation( - Line(points = {{-40, 30}, {-10, 30}}, color = {0, 128, 255})); - connect(Upstream.o, pipe1.i) annotation( - Line(points = {{-40, 30}, {-20, 30}, {-20, 60}, {-10, 60}}, color = {0, 128, 255})); - connect(Upstream.o, pipe3.i) annotation( - Line(points = {{-40, 30}, {-20, 30}, {-20, 0}, {-10, 0}}, color = {0, 128, 255})); - annotation( - experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); -end Test03; - -end TestPipe; \ No newline at end of file diff --git a/OpenHPLTest/TestPipe/AbstractTest.mo b/OpenHPLTest/TestPipe/AbstractTest.mo new file mode 100644 index 00000000..1f0f7c18 --- /dev/null +++ b/OpenHPLTest/TestPipe/AbstractTest.mo @@ -0,0 +1,17 @@ +within OpenHPLTest.TestPipe; +partial model AbstractTest + extends Modelica.Icons.Example; + // + inner OpenHPL.Data data(Vdot_0 = 0.0, p_a = 0.0, p_eps = 0.0) annotation ( + Placement(transformation(origin = {-70, 70}, extent = {{-10, -10}, {10, 10}}))); + // + parameter Modelica.Units.SI.Length Ln = 1000.; + parameter Modelica.Units.SI.Length Dn = sqrt(A*4/Modelica.Constants.pi); + Real error; + OpenHPL.Waterway.Reservoir Upstream(h_0 = 100, constantLevel = true) annotation ( + Placement(transformation(origin = {-50, 30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir Downstream(constantLevel = true, h_0 = 0) annotation ( + Placement(transformation(origin = {70, 10}, extent = {{10, -10}, {-10, 10}}))); +protected + constant Modelica.Units.SI.Area A = 0.1; +end AbstractTest; diff --git a/OpenHPLTest/TestPipe/Test01.mo b/OpenHPLTest/TestPipe/Test01.mo new file mode 100644 index 00000000..76af1da9 --- /dev/null +++ b/OpenHPLTest/TestPipe/Test01.mo @@ -0,0 +1,26 @@ +within OpenHPLTest.TestPipe; +model Test01 + extends AbstractTest; + OpenHPL.Waterway.Pipe pipe1(H = 0, L = Ln, D_i = 0.8*Dn, D_o = 1.2*Dn) annotation ( + Placement(transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe2(H = 0, L = Ln, D_i = Dn, D_o = Dn) annotation ( + Placement(transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe3(H = 0, L = Ln, D_i = 1.2*Dn, D_o = 0.8*Dn) annotation ( + Placement(transformation(extent = {{-10, -10}, {10, 10}}))); +equation + error=sqrt((pipe1.mdot-pipe2.mdot)^2 + (pipe2.mdot-pipe3.mdot)^2 + (pipe3.mdot-pipe1.mdot)^2); +connect(Upstream.o, pipe1.i) annotation ( + Line(points = {{-40, 30}, {-20, 30}, {-20, 60}, {-10, 60}}, color = {0, 128, 255})); +connect(pipe2.i, Upstream.o) annotation ( + Line(points = {{-10, 30}, {-40, 30}}, color = {0, 128, 255})); +connect(Upstream.o, pipe3.i) annotation ( + Line(points = {{-40, 30}, {-20, 30}, {-20, 0}, {-10, 0}}, color = {0, 128, 255})); +connect(pipe1.o, Downstream.o) annotation ( + Line(points = {{10, 60}, {50, 60}, {50, 10}, {60, 10}}, color = {0, 128, 255})); +connect(pipe2.o, Downstream.o) annotation ( + Line(points = {{10, 30}, {50, 30}, {50, 10}, {60, 10}}, color = {0, 128, 255})); +connect(pipe3.o, Downstream.o) annotation ( + Line(points = {{10, 0}, {50, 0}, {50, 10}, {60, 10}}, color = {0, 128, 255})); +annotation ( + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); +end Test01; diff --git a/OpenHPLTest/TestPipe/Test02.mo b/OpenHPLTest/TestPipe/Test02.mo new file mode 100644 index 00000000..024ff015 --- /dev/null +++ b/OpenHPLTest/TestPipe/Test02.mo @@ -0,0 +1,6 @@ +within OpenHPLTest.TestPipe; +model Test02 + extends OpenHPLTest.TestPipe.Test01(data(SteadyState=true)); +equation + +end Test02; diff --git a/OpenHPLTest/TestPipe/Test03.mo b/OpenHPLTest/TestPipe/Test03.mo new file mode 100644 index 00000000..cd4bb21f --- /dev/null +++ b/OpenHPLTest/TestPipe/Test03.mo @@ -0,0 +1,50 @@ +within OpenHPLTest.TestPipe; +model Test03 + extends AbstractTest(data(SteadyState = true)); + + OpenHPL.Waterway.Pipe pipe1(H = 0, L = Ln, D_i = Dn) annotation ( + Placement(transformation(origin = {0, 60}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe2(H = 0, L = Ln, D_i = Dn) annotation ( + Placement(transformation(origin = {0, 30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe3(H = 0, L = Ln, D_i = Dn) annotation ( Placement(transformation(extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Valve valve1(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation ( + Placement(transformation(origin = {30, 60}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Valve valve2(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation ( + Placement(transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Valve valve3(ValveCapacity = false, H_n = 100, Vdot_n = 1) annotation ( + Placement(transformation(origin = {30, 0}, extent = {{-10, 10}, {10, -10}}))); + Modelica.Blocks.Sources.Ramp ramp1(height = 1, duration = 5, offset = 0, startTime = 2) annotation ( + Placement(transformation(origin = {80, 80}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + Modelica.Blocks.Sources.Ramp ramp2(duration = 5, height = 0.5, offset = 0.5, startTime = 2) annotation ( + Placement(transformation(origin = {80, 50}, extent = {{10, -10}, {-10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp3(duration = 5, height = -1, offset = 1, startTime = 2) annotation ( + Placement(transformation(origin = {80, -20}, extent = {{10, -10}, {-10, 10}}))); +equation +error=sqrt((pipe1.mdot-pipe2.mdot)^2 + (pipe2.mdot-pipe3.mdot)^2 + (pipe3.mdot-pipe1.mdot)^2); +connect(pipe1.o, valve1.i) annotation ( + Line(points = {{10, 60}, {20, 60}}, color = {0, 128, 255})); +connect(pipe2.o, valve2.i) annotation ( + Line(points = {{10, 30}, {20, 30}}, color = {0, 128, 255})); +connect(pipe3.o, valve3.i) annotation ( + Line(points = {{10, 0}, {20, 0}}, color = {0, 128, 255})); +connect(ramp1.y, valve1.opening) annotation ( + Line(points = {{69, 80}, {30, 80}, {30, 68}}, color = {0, 0, 127})); +connect(valve1.o, Downstream.o) annotation ( + Line(points = {{40, 60}, {52, 60}, {52, 10}, {62, 10}}, color = {0, 128, 255})); +connect(valve2.o, Downstream.o) annotation ( + Line(points = {{40, 30}, {52, 30}, {52, 10}, {62, 10}}, color = {0, 128, 255})); +connect(ramp3.y, valve3.opening) annotation ( + Line(points = {{69, -20}, {30, -20}, {30, -8}}, color = {0, 0, 127})); +connect(valve3.o, Downstream.o) annotation ( + Line(points = {{40, 0}, {52, 0}, {52, 10}, {62, 10}}, color = {0, 128, 255})); +connect(valve2.opening, ramp2.y) annotation ( + Line(points = {{30, 38}, {30, 50}, {70, 50}}, color = {0, 0, 127})); +connect(Upstream.o, pipe2.i) annotation ( + Line(points = {{-40, 30}, {-10, 30}}, color = {0, 128, 255})); +connect(Upstream.o, pipe1.i) annotation ( + Line(points = {{-40, 30}, {-20, 30}, {-20, 60}, {-10, 60}}, color = {0, 128, 255})); +connect(Upstream.o, pipe3.i) annotation ( + Line(points = {{-40, 30}, {-20, 30}, {-20, 0}, {-10, 0}}, color = {0, 128, 255})); +annotation ( + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); +end Test03; diff --git a/OpenHPLTest/TestPipe/package.mo b/OpenHPLTest/TestPipe/package.mo new file mode 100644 index 00000000..36e1c480 --- /dev/null +++ b/OpenHPLTest/TestPipe/package.mo @@ -0,0 +1,9 @@ +within OpenHPLTest; +package TestPipe + extends Modelica.Icons.ExamplesPackage; + + + + + +end TestPipe; diff --git a/OpenHPLTest/TestPipe/package.order b/OpenHPLTest/TestPipe/package.order new file mode 100644 index 00000000..fcf8ae36 --- /dev/null +++ b/OpenHPLTest/TestPipe/package.order @@ -0,0 +1,4 @@ +AbstractTest +Test01 +Test02 +Test03 diff --git a/OpenHPLTest/TorqueEquation.mo b/OpenHPLTest/TorqueEquation.mo deleted file mode 100644 index ed03c8b1..00000000 --- a/OpenHPLTest/TorqueEquation.mo +++ /dev/null @@ -1,37 +0,0 @@ -within OpenHPLTest; - -package TorqueEquation - extends Modelica.Icons.ExamplesPackage; - import SI = Modelica.Units.SI; - // - - model TorqueElement - extends OpenHPL.Icons.ElectroMech; - extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; - equation - - end TorqueElement; - - model TorqueTest - extends Modelica.Icons.Example; - // - parameter SI.Torque shaftTorque0 = 1.e+03; - SI.Torque shaftTorque; - inner OpenHPL.Data data annotation( - Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation( - Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation( - Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}}))); - equation - if (time > 0.1 and time < 0.4) then - shaftTorque = shaftTorque0; - elseif (time > 0.5 and time < 0.8) then - shaftTorque = -shaftTorque0; - else - shaftTorque = 0.0; - end if; - annotation( - Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}}))); -end TorqueTest; -end TorqueEquation; diff --git a/OpenHPLTest/TorqueEquation/TorqueElement.mo b/OpenHPLTest/TorqueEquation/TorqueElement.mo new file mode 100644 index 00000000..5b247266 --- /dev/null +++ b/OpenHPLTest/TorqueEquation/TorqueElement.mo @@ -0,0 +1,7 @@ +within OpenHPLTest.TorqueEquation; +model TorqueElement + extends OpenHPL.Icons.ElectroMech; + extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; +equation + +end TorqueElement; diff --git a/OpenHPLTest/TorqueEquation/TorqueTest.mo b/OpenHPLTest/TorqueEquation/TorqueTest.mo new file mode 100644 index 00000000..b364afb2 --- /dev/null +++ b/OpenHPLTest/TorqueEquation/TorqueTest.mo @@ -0,0 +1,23 @@ +within OpenHPLTest.TorqueEquation; +model TorqueTest + extends Modelica.Icons.Example; + // + parameter SI.Torque shaftTorque0 = 1.e+03; + SI.Torque shaftTorque; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}}))); + TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation ( + Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}}))); + TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation ( + Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}}))); +equation + if (time > 0.1 and time < 0.4) then + shaftTorque = shaftTorque0; + elseif (time > 0.5 and time < 0.8) then + shaftTorque = -shaftTorque0; + else + shaftTorque = 0.0; + end if; +annotation ( + Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}}))); +end TorqueTest; diff --git a/OpenHPLTest/TorqueEquation/package.mo b/OpenHPLTest/TorqueEquation/package.mo new file mode 100644 index 00000000..d6edd2d7 --- /dev/null +++ b/OpenHPLTest/TorqueEquation/package.mo @@ -0,0 +1,8 @@ +within OpenHPLTest; +package TorqueEquation + extends Modelica.Icons.ExamplesPackage; + import Modelica.Units.SI; + // + + +end TorqueEquation; diff --git a/OpenHPLTest/TorqueEquation/package.order b/OpenHPLTest/TorqueEquation/package.order new file mode 100644 index 00000000..cad0b912 --- /dev/null +++ b/OpenHPLTest/TorqueEquation/package.order @@ -0,0 +1,2 @@ +TorqueElement +TorqueTest diff --git a/OpenHPLTest/package.mo b/OpenHPLTest/package.mo index bf26e7bd..e9099d6e 100644 --- a/OpenHPLTest/package.mo +++ b/OpenHPLTest/package.mo @@ -3,6 +3,7 @@ package OpenHPLTest "Test library for OpenHPL" extends Modelica.Icons.ExamplesPackage; extends Modelica.Icons.UnderConstruction; + annotation (uses( Modelica(version="4.0.0"), OpenHPL(version="3.0.0"), diff --git a/OpenHPLTest/package.order b/OpenHPLTest/package.order index 7ba9e01d..24d43dbb 100644 --- a/OpenHPLTest/package.order +++ b/OpenHPLTest/package.order @@ -1,74 +1,4 @@ +EmpiricalTurbine TestPipe TorqueEquation -Reservoir -TestMCB -TorpaHPPAirCushionTest -TorpaHPPAirCushionTest2 -HPTaperedFittingsTest -HPSquareFittingsTest -HPAllTypeFittingsTest -HPSimpleElasticPenstock -HPSimpleElasticPenstockWithoutSurge -HPElasticKPPenstock -HPElasticKPPenstockCompres -HPElasticKPPenstockWithoutSurge -HPElasticKPPenstockANDIntake -HPElasticKPPenstockHalfSurgeD -TestFitingSimpleHP -HPSimplePenstockControl -HPSimplePenstockAutoRefGate -HPSimplePenstockResKP -HPSimplePenstockOpenChannel -HPSimplePenstockGeneratorTest -HPSimplePenstockFrancis -HPSimplePenstockFrancisGener -HPSimplePenstockFrancis2 -CaseStudingValentynasCase -HPSimplePenstockPelton -TestRunoff -HPElasticKPPenstockFrancis -HPElasticKPPenstockFrancisGov -HPLiniarization -HPLiniarizationKP -HPLiniarizationFranGen -HPLiniarizationKPFran -HPLinTest -HPSimplePenstockFrancisGenIPSL -HPSimplePenstockFrancisGenIPSLGov -HPSimplePenstockFrancisGenIPSLInfBus -HPLiniarizationGenIPSL -HPLiniarizationGenIPSLKP -HPModel -HPModelDEA -HPBjarneBorresen -HPModelLin -HPModelLinPI -HPModelKPLin -HPModelObserv -HPModelKPLinPI -HPModelObservSim -HPLiniarization2 -HPModelManLin -HPLiniarization3 -HPLiniarization4 -HydroCordModel -HydroCordModelKP -HydroCordModelFrancis -HydroCordModelKPall -HydroCordModelFrancis2 -HydroCordModelKP2 -HydroCordModel2 -HydroCordModelKPFran -HydroCordModelKPFran2 -HydroCordModelDraftTube -HydroCordModelDraftTube2 -HydroCordModelKPDraftTube -HydroCordModelFrancisDraftTube -HydroCordModeKPlFrancisDraftTube -HydroCordModelDraftTube3 -HPDraftTube -HPSTSimple -HPSTAirCushion -HPSTSharpOrifice -HPSTThrottleValve -EmpiricalTurbine +Archive From 62aab1500e262a6e4f31eafbf3330d8716d1b6fe Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Tue, 3 Mar 2026 17:57:51 +0100 Subject: [PATCH 14/37] Adapting the models after rebase. --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 21 +++++++++---------- .../TurbineTest/Test02_Turbine.mo | 2 +- .../TurbineTest/Test03_Turbine.mo | 2 +- .../TurbineTest/Test04_Turbine.mo | 2 +- .../TurbineTest/Test05_Turbine.mo | 2 +- 5 files changed, 14 insertions(+), 15 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index c522548e..d14d1290 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -1,26 +1,25 @@ within OpenHPL.ElectroMech.Turbines; - model EmpiricalTurbine - extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation(torque.y=Tt,speedSensor.w=2*nrps*C.pi); - extends OpenHPL.Interfaces.TurbineContacts(u_t=opening); + extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; + extends OpenHPL.Interfaces.TurbineContacts; extends OpenHPL.Icons.Turbine; - // - parameter Boolean SteadyState = false "If true, starts in steady state" annotation( - Dialog(group = "Initialization")); + parameter OpenHPL.Types.TurbineCharacteristics turbineCharacteristics; parameter OpenHPL.Types.TurbineData turbineData; SI.Length Ht(start=100) "Turbine head"; SI.VolumeFlowRate Qt "Turbine flow rate"; - + SI.Torque Tt "Turbine torque"; + Modelica.Blocks.Sources.RealExpression realExpression(y=Tt) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); protected - Real opening; - SI.Frequency nrps "Rotational speed (in rotations per seconds)"; + Real opening=u_t; + SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; equation Ht = abs(i.p - o.p)/(data.rho*data.g); i.mdot + o.mdot = 0; i.mdot = Qt*data.rho; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); -annotation( + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); + connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); +annotation ( Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.
In this intial release, the turbine characteristics and tubine data must be constructed separately passed to the model. This may change in future releases.
")); end EmpiricalTurbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo index 2a89add1..e165044e 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo @@ -5,7 +5,7 @@ extends AbstractTurbineTest; Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo index d541f952..4669eee6 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -10,7 +10,7 @@ public Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo index 5a3be680..be9643b7 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -6,7 +6,7 @@ public Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index d78e99c4..c864abdc 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -7,7 +7,7 @@ public Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, SteadyState = false, enable_nomSpeed = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = true) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); From 7a9ffe18c7900a4187a95da687e531dfab73f7d4 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Tue, 3 Mar 2026 18:09:46 +0100 Subject: [PATCH 15/37] HTML fix HTML fixes HTML fix HTML fix HTML fix HTML fix --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 5 ++++- OpenHPL/Functions/TurbineLookUp.mo | 15 ++++++++++---- OpenHPL/Functions/WeightedControlPoints.mo | 20 ++++++++++--------- OpenHPL/Functions/deCasteljau.mo | 11 ++++++---- OpenHPL/Types/TurbineCharacteristics.mo | 19 +++++++++++++++--- OpenHPL/Types/TurbineData.mo | 15 ++++++++------ 6 files changed, 58 insertions(+), 27 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index d14d1290..e44b289a 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -21,5 +21,8 @@ equation (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( - Documentation(info = "Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.
In this intial release, the turbine characteristics and tubine data must be constructed separately passed to the model. This may change in future releases.
")); + Documentation(info = " +

Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.

+

In this intial release, the turbine characteristics and tubine data must be constructed separately passed to the model. This may change in future releases.

+")); end EmpiricalTurbine; diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index f1d7686c..02dab4ed 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -1,5 +1,4 @@ within OpenHPL.Functions; - function TurbineLookUp extends Modelica.Icons.Function; // @@ -68,7 +67,15 @@ algorithm Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); annotation( - Documentation(info ="

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], turbine head [Ht] and opening. The algorithm is briely summarized below.

  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. Use golden section search to find the correct position along the speed curve
  3. Compute physcal discharge and torque based on normalized unit data and the turbine information
At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the parametric value and is not able to handle s-shaped curves.

")); - - + Documentation(info=" +

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], +turbine head [Ht] and opening. The algorithm is briely summarized below.

+
    +
  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. +
  3. Use golden section search to find the correct position along the speed curve
  4. +
  5. Compute physcal discharge and torque based on normalized unit data and the turbine information
  6. +
+

At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the +parametric value and is not able to handle s-shaped curves.

+")); end TurbineLookUp; diff --git a/OpenHPL/Functions/WeightedControlPoints.mo b/OpenHPL/Functions/WeightedControlPoints.mo index 9eca9b77..6447c2e3 100644 --- a/OpenHPL/Functions/WeightedControlPoints.mo +++ b/OpenHPL/Functions/WeightedControlPoints.mo @@ -1,5 +1,4 @@ within OpenHPL.Functions; - function WeightedControlPoints extends Modelica.Icons.Function; /* @@ -11,25 +10,25 @@ protected Real td[hc.nPoints, hc.nDim]; Real beta; Integer i; - + algorithm //if (opening >= hc.opening[1] and opening <= hc.opening[hc.nPoints]) then i:=1; - while (i < hc.nCurves ) loop + while (i < hc.nCurves) loop if (opening < hc.opening[i]) then // Defined as closed guide vanes for j in 1:hc.nPoints loop td[j,1] := hc.data[1, j, 1]; td[j,2] := 0.0; // Torque set to zero. Must be corrected in the future - td[j,3] := 0.0 ; + td[j,3] := 0.0; end for; break; - elseif ( (hc.opening[i] <= opening) and (opening <= hc.opening[i+1]) ) then + elseif ( (hc.opening[i] <= opening) and (opening <= hc.opening[i+1])) then beta:=(opening-hc.opening[i])/(hc.opening[i+1]-hc.opening[i]); for j in 1:hc.nPoints loop for k in 1:hc.nDim loop - td[j,k] := (1.-beta)*hc.data[i, j, k]+ beta*hc.data[i+1, j, k] ; + td[j,k] := (1.-beta)*hc.data[i, j, k]+ beta*hc.data[i+1, j, k]; end for; end for; break; @@ -37,10 +36,13 @@ algorithm i:=i+1; end if; end while; - + data:=td; annotation( - Documentation(info = "Compute an intermediate turbine characteristics based on linear interpolation of the two closest curves. The turbine opening is used as argument for finding the closest curves. Assumes that the opening in the HillChart data is monotonously increasing. If data at small opening is missing, the flow and speed data for the first curve is used and the torque is set to zero.")); - + Documentation(info=" +

Compute an intermediate turbine characteristics based on linear interpolation of the two closest curves. +The turbine opening is used as argument for finding the closest curves. Assumes that the opening in the HillChart data is monotonously increasing. +If data at small opening is missing, the flow and speed data for the first curve is used and the torque is set to zero.

+")); end WeightedControlPoints; diff --git a/OpenHPL/Functions/deCasteljau.mo b/OpenHPL/Functions/deCasteljau.mo index fc18a271..d573e69b 100644 --- a/OpenHPL/Functions/deCasteljau.mo +++ b/OpenHPL/Functions/deCasteljau.mo @@ -1,5 +1,4 @@ within OpenHPL.Functions; - function deCasteljau extends Modelica.Icons.Function; input Real t "Parameter between 0 and 1"; @@ -25,7 +24,11 @@ for k in 1:ndim loop point[k] := temp[1, k]; end for; annotation( - Documentation(info = "Implementation of Bezier curve evaluation using the deCasteljau algorithm.
At the moment only one single Bezier curve per parameter dimension is assumed, but the order of the curve is arbritray, but define by the number of control points (e.g. curve order = number of control points - 1).")); - - +Documentation(info = " +

+Implementation of Bezier curve evaluation using the deCasteljau algorithm.

+

At the moment only one single Bezier curve per parameter dimension is assumed, +but the order of the curve is arbritray, but define by the number of control points +(e.g., curve order = number of control points - 1).

+")); end deCasteljau; diff --git a/OpenHPL/Types/TurbineCharacteristics.mo b/OpenHPL/Types/TurbineCharacteristics.mo index 8999d8b1..a06a69d0 100644 --- a/OpenHPL/Types/TurbineCharacteristics.mo +++ b/OpenHPL/Types/TurbineCharacteristics.mo @@ -1,5 +1,4 @@ within OpenHPL.Types; - record TurbineCharacteristics extends Modelica.Icons.Record; parameter Integer nCurves; @@ -7,8 +6,22 @@ record TurbineCharacteristics parameter Integer nDim "parameter space, currently 3"; parameter Real opening[nCurves]; parameter Real data[nCurves, nPoints, nDim]; - + annotation( - Documentation(info = "
This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for
a number of normalized openings. 

The HillChart record contains three integer values:
1) nCurves - number of Bezier curves
2) nPoints - number of Bezier control points (order of curve +1)
3) nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).

The data itself is contained in two multidimensional arrays
opening[nCurves] - gives the opening $$\\in [0,1]$$ for each curve. It is assumed that the array is sorted from smallest to larges value.
data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED) 
")); + Documentation(info=" +

This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for +a number of normalized openings.

+

The HillChart record contains three integer values:

+
    +
  1. nCurves - number of Bezier curves
  2. +
  3. nPoints - number of Bezier control points (order of curve +1)
  4. +
  5. nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).
  6. +
+

The data itself is contained in two multidimensional arrays:

+
    +
  • opening[nCurves] - gives the opening \\(\\in [0,1]\\) for each curve. It is assumed that the array is sorted from smallest to larges value.
  • +
  • data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED).
  • +
+")); end TurbineCharacteristics; diff --git a/OpenHPL/Types/TurbineData.mo b/OpenHPL/Types/TurbineData.mo index 126fd2aa..bfac7d09 100644 --- a/OpenHPL/Types/TurbineData.mo +++ b/OpenHPL/Types/TurbineData.mo @@ -1,5 +1,4 @@ within OpenHPL.Types; - record TurbineData extends Modelica.Icons.Record; // @@ -11,11 +10,15 @@ record TurbineData parameter Real openingBep "Best efficiency opening"; parameter SI.Acceleration g; parameter SI.Density rho; - + annotation( - Documentation(info = "Data record with key turbine information. Used together with the normalized turbine characteristics to calculate physical values.

+ Documentation(info = " +

Data record with key turbine information. Used together with the normalized turbine characteristics to calculate physical values.

+
+ - + + @@ -23,6 +26,6 @@ record TurbineData -
VariableDescription
Dn [m]Nominal diameter
nrps [1/s]Best efficiency rotational speed
Hbep [m]Best efficiency head
Tbep [Nm]Best efficiency torque
openingBep [-]Normalize best efficiency opening (must be between 0 and 1)
")); - +")); + end TurbineData; From 8217c57c3732b0d15544e553a5897a735727ea92 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 17 Mar 2026 16:39:48 +0100 Subject: [PATCH 16/37] Testing alternative TurbineLookUp function --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 4 +- OpenHPL/Functions/TurbineLookUp.mo | 3 +- OpenHPL/Functions/TurbineLookUp2.mo | 27 +++++++++++++ OpenHPL/Functions/package.order | 1 + .../Test02_ControlPoints.mo | 22 +++++++++-- .../Test03_DistanceFunction.mo | 39 +++++++++++++++++++ .../TestBasicFunctions/package.mo | 2 +- .../TestBasicFunctions/package.order | 1 + .../TurbineTest/AbstractTurbineTest.mo | 24 +++++++++++- .../TurbineTest/Test01_TurbineLookUp.mo | 2 +- .../TurbineTest/Test03_Turbine.mo | 2 +- .../TurbineTest/Test04_Turbine.mo | 2 +- 12 files changed, 116 insertions(+), 13 deletions(-) create mode 100644 OpenHPL/Functions/TurbineLookUp2.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index e44b289a..d92c1efd 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -6,7 +6,7 @@ model EmpiricalTurbine parameter OpenHPL.Types.TurbineCharacteristics turbineCharacteristics; parameter OpenHPL.Types.TurbineData turbineData; - SI.Length Ht(start=100) "Turbine head"; + SI.Length Ht(start=10) "Turbine head"; SI.VolumeFlowRate Qt "Turbine flow rate"; SI.Torque Tt "Turbine torque"; @@ -18,7 +18,7 @@ equation Ht = abs(i.p - o.p)/(data.rho*data.g); i.mdot + o.mdot = 0; i.mdot = Qt*data.rho; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, turbineCharacteristics); + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp2(Ht, nrps, opening, turbineData, turbineCharacteristics); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( Documentation(info = " diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo index 02dab4ed..46f1b205 100644 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ b/OpenHPL/Functions/TurbineLookUp.mo @@ -65,7 +65,8 @@ algorithm end while; Qt := (cP1[2] + cP2[2])*0.5*(td.Qbep*sqrt(Ht/td.Hbep)); Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); - + Modelica.Utilities.Streams.print(String(Ht) + "\t" + String(nrps)+ "\t" + String(itr),"TurbineLookUp.log"); + annotation( Documentation(info="

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], diff --git a/OpenHPL/Functions/TurbineLookUp2.mo b/OpenHPL/Functions/TurbineLookUp2.mo new file mode 100644 index 00000000..1a4ded5b --- /dev/null +++ b/OpenHPL/Functions/TurbineLookUp2.mo @@ -0,0 +1,27 @@ +within OpenHPL.Functions; + +function TurbineLookUp2 +extends Modelica.Icons.Function; + // + input SI.Length Ht; + input SI.Frequency nrps; + input Real opening; + input OpenHPL.Types.TurbineData td "Turbine data"; + input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; + output SI.VolumeFlowRate Qt "Discharge"; + output SI.Torque Tt "Hydraulic torque"; +protected + constant Real eps = 1.0e-08; + Real controlPoints[hc.nPoints, hc.nDim]; + Real[hc.nDim] cP; + Real t; + Integer itr; +algorithm + controlPoints:=WeightedControlPoints(opening,hc); + // Added the: max(abs(Ht),eps) due to errors when initializing the model. + t:=((nrps*td.Dn)/sqrt(max(abs(Ht),eps)*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g))*(1/(2*sqrt(2))); + cP := deCasteljau(t, hc.nDim, controlPoints); + Qt := cP[2]*(td.Qbep*sqrt(Ht/td.Hbep)); + Tt := cP[3]*(td.Tbep*(Ht/td.Hbep)); + +end TurbineLookUp2; diff --git a/OpenHPL/Functions/package.order b/OpenHPL/Functions/package.order index 94dad78b..c53fb47d 100644 --- a/OpenHPL/Functions/package.order +++ b/OpenHPL/Functions/package.order @@ -5,3 +5,4 @@ KP07 deCasteljau WeightedControlPoints TurbineLookUp +TurbineLookUp2 diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo index 754e3356..c3b70c29 100644 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo @@ -3,11 +3,25 @@ model Test02_ControlPoints extends Modelica.Icons.Example; // protected +/* constant Integer NC = 5; constant Integer NP = 4; constant Integer ND = 3; parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.83, 0.00, -0.35}}}; + + + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.48,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.55,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.60,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + */ + constant Integer NC = 4; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); public Real cPoints1[NP, ND], cPoints2[NP, ND], cPoints3[NP, ND]; @@ -15,11 +29,11 @@ public Real[ND] curvePoint2; Real[ND] curvePoint3; equation - cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.3, tc); + cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.20, tc); curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND, cPoints1); - cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.5, tc); + cPoints2 = OpenHPL.Functions.WeightedControlPoints(0.50, tc); curvePoint2 = OpenHPL.Functions.deCasteljau(time, ND, cPoints2); - cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.67, tc); + cPoints3 = OpenHPL.Functions.WeightedControlPoints(0.90, tc); curvePoint3 = OpenHPL.Functions.deCasteljau(time, ND, cPoints3); annotation ( Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve.

Computes three curve trajectories as weighted intermediate curves. Parametrci curve plot of curvePoints1[1] against  curvePoints1[2] and similar for curvePonts2 and curvePoints3 should show smooth curves 2D curves.
"), diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo new file mode 100644 index 00000000..7bcf75ae --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo @@ -0,0 +1,39 @@ +within OpenHPLTest.EmpiricalTurbine.TestBasicFunctions; + +model Test03_DistanceFunction + extends Modelica.Icons.Example; +protected + /* + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.58, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.73, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.83, 0.00, -0.35}}}; + + constant Integer NC = 3; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.00, 0.50, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.00, 0.00}, {0.40, 0.00, -0.05}, {0.80, 0.00, -0.10}, {1.20, 0.00, -0.15}}, {{0.00, 0.50, 0.50}, {0.40, 0.50, 0.45}, {0.80, 0.50, 0.40}, {1.20, 0.50, 0.35}}, {{0.00, 1.00, 1.00}, {0.40, 1.00, 0.95}, {0.80, 1.00, 0.90}, {1.20, 1.00, 0.85}}}; + */ + constant Integer NC = 4; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; + + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); +public + parameter Real opening=0.67; + Real cPoints[NP, ND]; + Real[ND] curvePoint; + Real distance; +equation + cPoints = OpenHPL.Functions.WeightedControlPoints(opening, tc); + curvePoint = OpenHPL.Functions.deCasteljau(time, ND, cPoints); + distance=sqrt((1.1-curvePoint[1])^2); + annotation ( + Documentation(info = "Test basic functions for finding intermediate control points and evaluate Bezier curve.
Computes three curve trajectories as weighted intermediate curves. Parametrci curve plot of curvePoints1[1] against  curvePoints1[2] and similar for curvePonts2 and curvePoints3 should show smooth curves 2D curves.
"), + experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.002)); + +end Test03_DistanceFunction; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo index 2d071fd9..6d1a2254 100644 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo @@ -2,7 +2,7 @@ within OpenHPLTest.EmpiricalTurbine; package TestBasicFunctions extends Modelica.Icons.ExamplesPackage; // - + // diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order index 9aa35a04..bcdf343e 100644 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.order @@ -1,2 +1,3 @@ Test01_BezierCurve Test02_ControlPoints +Test03_DistanceFunction diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo index f4f675bc..b43d1ae7 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo @@ -4,18 +4,38 @@ partial model AbstractTurbineTest inner OpenHPL.Data data annotation ( Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); protected +/* constant Integer NC = 11; constant Integer NP = 6; constant Integer ND = 3; parameter Real openingArray[NC] = {0.014, 0.030, 0.050, 0.100, 0.200, 0.300, 0.400, 0.500, 0.601, 0.800, 1.000}; parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.07, 0.07}, {0.30, 0.10, 0.07}, {0.54, -0.07, -0.03}, {0.92, 0.25, 0.13}, {1.13, -0.11, -0.17}, {1.43, -0.06, -0.31}}, {{0.00, 0.11, 0.15}, {0.32, 0.15, 0.17}, {0.51, -0.06, -0.09}, {1.00, 0.35, 0.35}, {1.11, -0.12, -0.30}, {1.43, -0.09, -0.31}}, {{0.00, 0.15, 0.23}, {0.34, 0.21, 0.24}, {0.47, -0.08, -0.01}, {1.07, 0.46, 0.35}, {1.09, -0.15, -0.24}, {1.43, -0.11, -0.37}}, {{0.00, 0.27, 0.45}, {0.37, 0.30, 0.40}, {0.40, 0.05, 0.30}, {1.38, 0.60, 0.26}, {0.97, -0.19, -0.17}, {1.43, -0.13, -0.42}}, {{0.00, 0.51, 0.92}, {0.40, 0.53, 0.80}, {0.45, 0.31, 0.83}, {1.48, 0.75, 0.14}, {0.99, -0.14, -0.06}, {1.44, -0.17, -0.49}}, {{0.00, 0.77, 1.41}, {0.44, 0.79, 1.23}, {0.51, 0.56, 1.29}, {1.62, 0.82, -0.14}, {0.99, -0.05, 0.11}, {1.43, -0.18, -0.51}}, {{0.00, 1.01, 1.87}, {0.48, 1.05, 1.70}, {0.56, 0.74, 1.46}, {1.68, 0.84, -0.35}, {1.03, 0.06, 0.23}, {1.43, -0.19, -0.53}}, {{0.00, 1.25, 2.27}, {0.52, 1.26, 1.99}, {0.63, 1.00, 1.84}, {1.70, 0.83, -0.64}, {1.08, 0.17, 0.35}, {1.43, -0.18, -0.52}}, {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}, {{0.00, 1.79, 3.06}, {0.55, 1.78, 2.77}, {0.99, 1.43, 1.67}, {1.53, 0.94, -0.59}, {1.20, 0.31, 0.28}, {1.45, -0.16, -0.54}}, {{0.00, 2.10, 3.41}, {0.59, 2.02, 2.99}, {1.05, 1.63, 1.56}, {1.53, 1.04, -0.47}, {1.22, 0.40, 0.24}, {1.45, -0.13, -0.54}}}; - /* + constant Integer NC = 5; constant Integer NP = 4; constant Integer ND = 3; parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - */ + + constant Integer NC = 3; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC] = {0.00, 0.50, 1.00}; + parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.00, 0.00}, {0.40, 0.00, -0.05}, {0.80, 0.00, -0.10}, {1.20, 0.00, -0.15}}, {{0.00, 0.50, 0.50}, {0.40, 0.50, 0.45}, {0.80, 0.50, 0.40}, {1.20, 0.50, 0.35}}, {{0.00, 1.00, 1.00}, {0.40, 1.00, 0.95}, {0.80, 1.00, 0.90}, {1.20, 1.00, 0.85}}}; + + protected + constant Integer NC = 5; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.48,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.55,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.60,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; + */ + constant Integer NC = 4; + constant Integer NP = 4; + constant Integer ND = 3; + parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; + parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); public parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo index 7d03fe4f..769983a2 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo @@ -11,7 +11,7 @@ equation Ht = 425.0; nrps = 1.0e-03 + 8.33*time*1.4; opening = 0.6; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp(Ht, nrps, opening, turbineData, tc); + (Qt, Tt) = OpenHPL.Functions.TurbineLookUp2(Ht, nrps, opening, turbineData, tc); annotation ( experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo index 4669eee6..e5f96595 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -24,7 +24,7 @@ equation connect(tunnel.o, turbine.i) annotation ( Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); annotation ( - experiment(StartTime = 0, StopTime = 10.0, Tolerance = 1e-06, Interval = 0.2000), + experiment(StartTime = 0, StopTime = 20.0, Tolerance = 1e-06, Interval = 0.02000), Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), __OpenModelica_commandLineOptions="--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", __OpenModelica_simulationFlags( diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo index be9643b7..f36081bb 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -6,7 +6,7 @@ public Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 1.0, enable_f = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); From c592cb4b63ee9739b4bdc54d3d45b35379b9c312 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Wed, 18 Mar 2026 16:42:30 +0100 Subject: [PATCH 17/37] Updated testing of EmpiricalTurbine --- .../TurbineTest/AbstractTurbineTest.mo | 17 ++++++++++------ .../TurbineTest/Test02_Turbine.mo | 2 +- .../TurbineTest/Test03_Turbine.mo | 10 +++++++--- .../TurbineTest/Test04_Turbine.mo | 2 +- .../TurbineTest/Test05_Turbine.mo | 10 ++++++---- .../TurbineTest/TestXX_Turbine.mo | 20 +++++++++++++++++++ .../TurbineTest/package.order | 1 + 7 files changed, 47 insertions(+), 15 deletions(-) create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo index b43d1ae7..84057f6c 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo @@ -29,16 +29,21 @@ protected constant Integer ND = 3; parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.48,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.55,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.60,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - */ - constant Integer NC = 4; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; + parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; + protected + */ + constant Integer NC = 4; + constant Integer NP = 4; + constant Integer ND = 3; + + parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; + parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); public parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( - Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}})));annotation( + Icon(graphics = {Text(origin = {0, 110}, extent = {{-100, 30}, {100, -30}}, textString = "%name")})); end AbstractTurbineTest; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo index e165044e..af233a92 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo @@ -18,5 +18,5 @@ equation Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); annotation ( Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), - experiment(StartTime = 0, StopTime = 20, Tolerance = 1e-06, Interval = 0.001)); + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); end Test02_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo index e5f96595..53893e5f 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -10,7 +10,7 @@ public Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); @@ -24,8 +24,11 @@ equation connect(tunnel.o, turbine.i) annotation ( Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); annotation ( - experiment(StartTime = 0, StopTime = 20.0, Tolerance = 1e-06, Interval = 0.02000), - Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway."), + experiment(StartTime = 0, StopTime = 50.0, Tolerance = 1e-06, Interval = 0.02000), + Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway.")); + + /* + , __OpenModelica_commandLineOptions="--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", __OpenModelica_simulationFlags( lv="LOG_STDOUT,LOG_ASSERT,LOG_STATS", @@ -34,4 +37,5 @@ equation homMaxNewtonSteps="50", homMaxTries="30", variableFilter=".*")); + */ end Test03_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo index f36081bb..f7cfc039 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -20,5 +20,5 @@ equation connect(ramp.y, turbine.u_t) annotation ( Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); annotation ( - experiment(StartTime = 0, StopTime = 15, Tolerance = 1e-06, Interval = 0.01)); + experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.01)); end Test04_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index c864abdc..8d50f6e2 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -7,20 +7,22 @@ public Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc,enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0.1) annotation ( + Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); equation connect(turbine.o, undervann.o) annotation ( Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); connect(ramp.y, turbine.u_t) annotation ( Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); -connect(overvann.o, tunnel.i) annotation ( + connect(overvann.o, tunnel.i) annotation ( Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); -connect(tunnel.o, turbine.i) annotation ( + connect(tunnel.o, turbine.i) annotation ( Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); +annotation( + experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001)); end Test05_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo new file mode 100644 index 00000000..cd180a0f --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo @@ -0,0 +1,20 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model TestXX_Turbine + extends Modelica.Icons.Example; + // + Test02_Turbine test02_Turbine annotation( + Placement(transformation(origin = {-58, 82}, extent = {{-10, -10}, {10, 10}}))); + Test03_Turbine test03_Turbine annotation( + Placement(transformation(origin = {46, 80}, extent = {{-10, -10}, {10, 10}}))); + Test04_Turbine test04_Turbine annotation( + Placement(transformation(origin = {-58, 24}, extent = {{-10, -10}, {10, 10}}))); + /**/ + Test05_Turbine test05_Turbine annotation( + Placement(transformation(origin = {50, 24}, extent = {{-10, -10}, {10, 10}}))); + +equation + +annotation( + experiment(StartTime = 0, StopTime = 12, Tolerance = 1e-06, Interval = 0.005)); +end TestXX_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order index 871b47d9..26a2ba34 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -4,3 +4,4 @@ Test02_Turbine Test03_Turbine Test04_Turbine Test05_Turbine +TestXX_Turbine From 2b486797277dc2d3b1a3ca773f6b7ce128a05cb5 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 21 Apr 2026 14:22:48 +0200 Subject: [PATCH 18/37] Empirical turbine model for reaction turbines. Includes throtling effect --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 51 +- OpenHPL/Functions/TurbineLookUp.mo | 82 -- OpenHPL/Functions/TurbineLookUp2.mo | 27 - OpenHPL/Functions/WeightedControlPoints.mo | 48 -- OpenHPL/Functions/deCasteljau.mo | 34 - OpenHPL/Functions/package.order | 4 - OpenHPL/Resources/Images/EmpiricalTurbine.svg | 787 ++++++++++++++++++ OpenHPL/Types/ReactionTurbines.mo | 13 - OpenHPL/Types/TurbineCharacteristics.mo | 27 - OpenHPL/Types/TurbineData.mo | 31 - OpenHPL/Types/package.order | 3 - .../TestBasicFunctions/package.mo | 9 - .../TurbineTest/AbstractTurbineTest.mo | 49 -- .../TurbineTest/Test01_Turbine.mo | 28 + .../TurbineTest/Test01_TurbineLookUp.mo | 18 - .../TurbineTest/Test02_Turbine.mo | 20 +- .../TurbineTest/Test03_Turbine.mo | 42 +- .../TurbineTest/Test04_Turbine.mo | 35 +- .../TurbineTest/Test05_Turbine.mo | 35 +- .../TurbineTest/Test06_Turbine.mo | 53 ++ .../TurbineTest/Test07_Turbine.mo | 53 ++ .../TurbineTest/TestXX_Turbine.mo | 20 - .../Test_Turbine_Charactersistics.mo | 31 + .../TurbineTest/package.order | 7 +- OpenHPLTest/EmpiricalTurbine/package.order | 1 - 25 files changed, 1035 insertions(+), 473 deletions(-) delete mode 100644 OpenHPL/Functions/TurbineLookUp.mo delete mode 100644 OpenHPL/Functions/TurbineLookUp2.mo delete mode 100644 OpenHPL/Functions/WeightedControlPoints.mo delete mode 100644 OpenHPL/Functions/deCasteljau.mo create mode 100644 OpenHPL/Resources/Images/EmpiricalTurbine.svg delete mode 100644 OpenHPL/Types/ReactionTurbines.mo delete mode 100644 OpenHPL/Types/TurbineCharacteristics.mo delete mode 100644 OpenHPL/Types/TurbineData.mo delete mode 100644 OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo delete mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo delete mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo delete mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index d92c1efd..633a9a96 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -1,28 +1,49 @@ within OpenHPL.ElectroMech.Turbines; model EmpiricalTurbine - extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; + parameter SI.Height H_n = 100 "Nominal net head" annotation (Dialog(group = "Nominal values")); + parameter SI.Power P_n (displayUnit = "MW")= 1.e+06 "Nominal power" annotation (Dialog(group = "Nominal values")); + extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; extends OpenHPL.Interfaces.TurbineContacts; extends OpenHPL.Icons.Turbine; - parameter OpenHPL.Types.TurbineCharacteristics turbineCharacteristics; - parameter OpenHPL.Types.TurbineData turbineData; - SI.Length Ht(start=10) "Turbine head"; - SI.VolumeFlowRate Qt "Turbine flow rate"; - + SI.VolumeFlowRate Vdot "Turbine flow rate"; + SI.Pressure dp "Pressure drop"; SI.Torque Tt "Turbine torque"; Modelica.Blocks.Sources.RealExpression realExpression(y=Tt) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); -protected - Real opening=u_t; + + protected + constant Real eps=1.0e-08; + parameter SI.Density rho=data.rho; + parameter SI.Acceleration g=data.g; + constant Real eta0=0.90 "Full load efficiency. Hard coded at the moment. Can be parametrized in the future"; + parameter SI.VolumeFlowRate Vdot_n=P_n/(eta0*rho*g*H_n) "Nominal discharge"; + parameter SI.Torque Tt_n=P_n/(2*C.pi*nrps_n) "Noninal turbine torque"; + + parameter Real NQE=4.0*H_n^(-2./3.) "Specific speed based on empirical relartion"; + parameter Real kappa=1.351-0.857*NQE; + parameter Real nRA=1.5+NQE*5 "Normalized runaway speed us function of specific speed"; + parameter Real dQdn=0.4222+0.3179*Modelica.Math.log(NQE); + parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; + parameter Real Ct =Vdot_n/sqrt(H_n*g*rho) "Nominal turbine coefficient"; + constant Real alpha=1.5; + constant Real beta=3.5; + constant Real epsilon = 5.0e-5 "Constant to ensure robust expression for dp vs flow. Trial and error to find suitable value."; equation - Ht = abs(i.p - o.p)/(data.rho*data.g); i.mdot + o.mdot = 0; - i.mdot = Qt*data.rho; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp2(Ht, nrps, opening, turbineData, turbineCharacteristics); + i.mdot = Vdot*rho; + dp = i.p - o.p; + + Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; + Tt=Tt_n*(dp/(H_n*(rho*g)))*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( - Documentation(info = " -

Turbine model based on normalized, empirical turbine characteristics and turbine data for the best efficiency point.

-

In this intial release, the turbine characteristics and tubine data must be constructed separately passed to the model. This may change in future releases.

-")); + Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominale power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. + +

+ +

+

Figure: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

+ +

")); end EmpiricalTurbine; diff --git a/OpenHPL/Functions/TurbineLookUp.mo b/OpenHPL/Functions/TurbineLookUp.mo deleted file mode 100644 index 46f1b205..00000000 --- a/OpenHPL/Functions/TurbineLookUp.mo +++ /dev/null @@ -1,82 +0,0 @@ -within OpenHPL.Functions; -function TurbineLookUp - extends Modelica.Icons.Function; - // - input SI.Length Ht; - input SI.Frequency nrps; - input Real opening; - input OpenHPL.Types.TurbineData td "Turbine data"; - input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; - output SI.VolumeFlowRate Qt "Discharge"; - output SI.Torque Tt "Hydraulic torque"; -protected - constant Real phi = (1 + sqrt(5))/2 "Golden ratio"; - constant Real resphi = 2 - phi "Reciprocal of golden ratio (0.618...)"; - constant Real eps = 1.0e-08; - constant Integer nitr = 99; - Real a "Current left bound"; - Real b "Current right bound"; - Real t1 "First interior point"; - Real t2 "Second interior point"; - Real f1 "Function value at x1"; - Real f2 "Function value at x2"; - Real x_min "Current estimate of minimum location"; - Real f_min "Current estimate of minimum value"; - Real controlPoints[hc.nPoints, hc.nDim]; - Real[hc.nDim] cP1; - Real[hc.nDim] cP2; - Real target; - Real err; - Integer itr; -algorithm - controlPoints:=WeightedControlPoints(opening,hc); - // Added the: max(abs(Ht),eps) due to errors when initializing the model. - target:=((nrps*td.Dn)/sqrt(max(abs(Ht),eps)*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g)); - a:=0; - b:=1; - itr:=0; - err:=1.e+10; - t1 := a + resphi*(b - a); - cP1 := deCasteljau(t1, hc.nDim, controlPoints); - f1 := sqrt((cP1[1] - target)^2); - t2 := b - resphi*(b - a); - cP2 := deCasteljau(t2, hc.nDim, controlPoints); - f2 := sqrt((cP2[1] - target)^2); - while ((err > eps) and (itr < nitr)) loop - if f1 < f2 then -// Minimum is in [a, x2] - b := t2; - t2 := t1; - f2 := f1; - t1 := a + resphi*(b - a); - cP1 :=deCasteljau(t1, hc.nDim, controlPoints); - f1 := sqrt((cP1[1] - target)^2); - else -// Minimum is in [x1, b] - a := t1; - t1 := t2; - f1 := f2; - t2 := b - resphi*(b - a); - cP2 := deCasteljau(t2, hc.nDim, controlPoints); - f2 := sqrt((cP2[1] - target)^2); - end if; - itr := itr + 1; - err := min(f1, f2); - end while; - Qt := (cP1[2] + cP2[2])*0.5*(td.Qbep*sqrt(Ht/td.Hbep)); - Tt := (cP1[3] + cP2[3])*0.5*(td.Tbep*(Ht/td.Hbep)); - Modelica.Utilities.Streams.print(String(Ht) + "\t" + String(nrps)+ "\t" + String(itr),"TurbineLookUp.log"); - -annotation( - Documentation(info=" -

Compute the physical discharge (Q) and torque (T) based on the turbine speed [nrps], -turbine head [Ht] and opening. The algorithm is briely summarized below.

-
    -
  1. Find the actual charateristic curve by weighted interpolation of the two closest curves
  2. -
  3. Use golden section search to find the correct position along the speed curve
  4. -
  5. Compute physcal discharge and torque based on normalized unit data and the turbine information
  6. -
-

At the moment the algorithm assumes that \\(n_{ED}\\) is monotonously increasing as function of the -parametric value and is not able to handle s-shaped curves.

-")); -end TurbineLookUp; diff --git a/OpenHPL/Functions/TurbineLookUp2.mo b/OpenHPL/Functions/TurbineLookUp2.mo deleted file mode 100644 index 1a4ded5b..00000000 --- a/OpenHPL/Functions/TurbineLookUp2.mo +++ /dev/null @@ -1,27 +0,0 @@ -within OpenHPL.Functions; - -function TurbineLookUp2 -extends Modelica.Icons.Function; - // - input SI.Length Ht; - input SI.Frequency nrps; - input Real opening; - input OpenHPL.Types.TurbineData td "Turbine data"; - input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; - output SI.VolumeFlowRate Qt "Discharge"; - output SI.Torque Tt "Hydraulic torque"; -protected - constant Real eps = 1.0e-08; - Real controlPoints[hc.nPoints, hc.nDim]; - Real[hc.nDim] cP; - Real t; - Integer itr; -algorithm - controlPoints:=WeightedControlPoints(opening,hc); - // Added the: max(abs(Ht),eps) due to errors when initializing the model. - t:=((nrps*td.Dn)/sqrt(max(abs(Ht),eps)*td.g))/((td.nrps*td.Dn)/sqrt(td.Hbep*td.g))*(1/(2*sqrt(2))); - cP := deCasteljau(t, hc.nDim, controlPoints); - Qt := cP[2]*(td.Qbep*sqrt(Ht/td.Hbep)); - Tt := cP[3]*(td.Tbep*(Ht/td.Hbep)); - -end TurbineLookUp2; diff --git a/OpenHPL/Functions/WeightedControlPoints.mo b/OpenHPL/Functions/WeightedControlPoints.mo deleted file mode 100644 index 6447c2e3..00000000 --- a/OpenHPL/Functions/WeightedControlPoints.mo +++ /dev/null @@ -1,48 +0,0 @@ -within OpenHPL.Functions; -function WeightedControlPoints -extends Modelica.Icons.Function; - /* - */ - input Real opening; - input OpenHPL.Types.TurbineCharacteristics hc "Turbine characteristics"; - output Real data[hc.nPoints, hc.nDim]; -protected - Real td[hc.nPoints, hc.nDim]; - Real beta; - Integer i; - -algorithm -//if (opening >= hc.opening[1] and opening <= hc.opening[hc.nPoints]) then - i:=1; - while (i < hc.nCurves) loop - if (opening < hc.opening[i]) then -// Defined as closed guide vanes - for j in 1:hc.nPoints loop - td[j,1] := hc.data[1, j, 1]; - td[j,2] := 0.0; -// Torque set to zero. Must be corrected in the future - td[j,3] := 0.0; - end for; - break; - elseif ( (hc.opening[i] <= opening) and (opening <= hc.opening[i+1])) then - beta:=(opening-hc.opening[i])/(hc.opening[i+1]-hc.opening[i]); - for j in 1:hc.nPoints loop - for k in 1:hc.nDim loop - td[j,k] := (1.-beta)*hc.data[i, j, k]+ beta*hc.data[i+1, j, k]; - end for; - end for; - break; - else - i:=i+1; - end if; - end while; - - data:=td; -annotation( - Documentation(info=" -

Compute an intermediate turbine characteristics based on linear interpolation of the two closest curves. -The turbine opening is used as argument for finding the closest curves. Assumes that the opening in the HillChart data is monotonously increasing. -If data at small opening is missing, the flow and speed data for the first curve is used and the torque is set to zero.

-")); - -end WeightedControlPoints; diff --git a/OpenHPL/Functions/deCasteljau.mo b/OpenHPL/Functions/deCasteljau.mo deleted file mode 100644 index d573e69b..00000000 --- a/OpenHPL/Functions/deCasteljau.mo +++ /dev/null @@ -1,34 +0,0 @@ -within OpenHPL.Functions; -function deCasteljau - extends Modelica.Icons.Function; - input Real t "Parameter between 0 and 1"; - input Integer ndim "Dimensional space"; - input Real[:, ndim] controlPoints "Array of control points [n,ndim]"; - output Real[ndim] point "Computed point on the curve"; -protected - Integer n = size(controlPoints, 1); - Real temp[n, ndim]; -algorithm -// Initialize temp with control points - temp := controlPoints; -// Perform De Casteljau iterations - for r in 1:n - 1 loop - for i in 1:n - r loop - for k in 1:ndim loop - temp[i, k] := (1 - t)*temp[i, k] + t*temp[i + 1, k]; - end for; - end for; - end for; -// The first element now contains the point on the curve -for k in 1:ndim loop - point[k] := temp[1, k]; -end for; -annotation( -Documentation(info = " -

-Implementation of Bezier curve evaluation using the deCasteljau algorithm.

-

At the moment only one single Bezier curve per parameter dimension is assumed, -but the order of the curve is arbritray, but define by the number of control points -(e.g., curve order = number of control points - 1).

-")); -end deCasteljau; diff --git a/OpenHPL/Functions/package.order b/OpenHPL/Functions/package.order index c53fb47d..597543b5 100644 --- a/OpenHPL/Functions/package.order +++ b/OpenHPL/Functions/package.order @@ -2,7 +2,3 @@ Fitting DarcyFriction manningVelocity KP07 -deCasteljau -WeightedControlPoints -TurbineLookUp -TurbineLookUp2 diff --git a/OpenHPL/Resources/Images/EmpiricalTurbine.svg b/OpenHPL/Resources/Images/EmpiricalTurbine.svg new file mode 100644 index 00000000..996ea3b8 --- /dev/null +++ b/OpenHPL/Resources/Images/EmpiricalTurbine.svg @@ -0,0 +1,787 @@ + + +Plot Document +Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Turbine discharge Vdot + + + + + + + + + + + + + + + + + + + + + +Volumetric flow rate + + + + + + + + + + + + + + + + + + + + + + + + + + + +-0.5 + + + + + + + + + + + + + + + + + + +0 + + + + + + + + + + + + + + + + + + +0.5 + + + + + + + + + + + + + + + + + + +1 + + + + + + + + + + + + + + + + + + +1.5 + + + + + + + + + + + + + + + + + + +2 + + + + + + + + + + + + + + + + + + +2.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + +Relative speed + + + + + + + + + + + + + + + + + + + + + + + + + + + +0 + + + + + + + + + + + + + + + + + + +0.5 + + + + + + + + + + + + + + + + + + +1 + + + + + + + + + + + + + + + + + + +1.5 + + + + + + + + + + + + + + + + + + +2 + + + + + + + + + + + + + + + + + + +2.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/OpenHPL/Types/ReactionTurbines.mo b/OpenHPL/Types/ReactionTurbines.mo deleted file mode 100644 index 90bccdbe..00000000 --- a/OpenHPL/Types/ReactionTurbines.mo +++ /dev/null @@ -1,13 +0,0 @@ -within OpenHPL.Types; - -record ReactionTurbines "Collection of empirical turbine characteristics for use together with the EmpiricalTurbine model" - extends Modelica.Icons.Record; - protected - parameter Real oA[5]={0.10,0.25,0.50,0.75,1.00}; - parameter Real cP1[5,4,3]={{{ 0.00,0.27,0.45 },{ 0.58,0.33,0.42 },{ 1.04,0.16,0.11 },{ 1.43,-0.13,-0.42 }},{{ 0.00,0.64,1.17 },{ 0.70,0.74,1.04 },{ 1.13,0.31,0.13 },{ 1.43,-0.17,-0.50 }},{{ 0.00,1.25,2.27 },{ 0.90,1.30,1.71 },{ 1.29,0.53,-0.05 },{ 1.43,-0.18,-0.52 }},{{ 0.00,1.71,2.95 },{ 1.05,1.71,1.99 },{ 1.31,0.63,-0.17 },{ 1.44,-0.16,-0.53 }},{{ 0.00,2.10,3.41 },{ 1.15,1.98,2.04 },{ 1.31,0.76,-0.18 },{ 1.45,-0.13,-0.54 }}}; - - parameter Real cP2[5,4,3]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.57,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.72,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.82,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - public - TurbineCharacteristics turbine1(nCurves = 5, nDim = 3, nPoints = 4, opening = oA, data = cPoints) "N_QE=0.07"; - TurbineCharacteristics turbine2(nCurves = 5, nDim = 3, nPoints = 4, opening = oA, data = cPoints) "N_EQ=0.20"; -end ReactionTurbines; diff --git a/OpenHPL/Types/TurbineCharacteristics.mo b/OpenHPL/Types/TurbineCharacteristics.mo deleted file mode 100644 index a06a69d0..00000000 --- a/OpenHPL/Types/TurbineCharacteristics.mo +++ /dev/null @@ -1,27 +0,0 @@ -within OpenHPL.Types; -record TurbineCharacteristics - extends Modelica.Icons.Record; - parameter Integer nCurves; - parameter Integer nPoints; - parameter Integer nDim "parameter space, currently 3"; - parameter Real opening[nCurves]; - parameter Real data[nCurves, nPoints, nDim]; - - annotation( - Documentation(info=" -

This data record is based on the first version of the empirical turbine model, where normalized data for nED, QED and TED are given for -a number of normalized openings.

-

The HillChart record contains three integer values:

-
    -
  1. nCurves - number of Bezier curves
  2. -
  3. nPoints - number of Bezier control points (order of curve +1)
  4. -
  5. nDim - parameter space (currently assumed to be 3. (Model may/will (?) fail for other values).
  6. -
-

The data itself is contained in two multidimensional arrays:

-
    -
  • opening[nCurves] - gives the opening \\(\\in [0,1]\\) for each curve. It is assumed that the array is sorted from smallest to larges value.
  • -
  • data[nCurves, nPoints, nDim] - gives the Bezier control points for each curve and each parameter (nED,QED,TED).
  • -
-")); - -end TurbineCharacteristics; diff --git a/OpenHPL/Types/TurbineData.mo b/OpenHPL/Types/TurbineData.mo deleted file mode 100644 index bfac7d09..00000000 --- a/OpenHPL/Types/TurbineData.mo +++ /dev/null @@ -1,31 +0,0 @@ -within OpenHPL.Types; -record TurbineData - extends Modelica.Icons.Record; - // - parameter SI.Length Dn "Nominal diameter"; - parameter SI.Frequency nrps "Best efficiency rotational speed"; - parameter SI.Length Hbep "Best efficiency head"; - parameter SI.VolumeFlowRate Qbep "Best efficiency discharge"; - parameter SI.Torque Tbep "Best efficiency shaft torque"; - parameter Real openingBep "Best efficiency opening"; - parameter SI.Acceleration g; - parameter SI.Density rho; - - annotation( - Documentation(info = " -

Data record with key turbine information. Used together with the normalized turbine characteristics to calculate physical values.

- - - - - - - - - - - - -
VariableDescription
Dn [m]Nominal diameter
nrps [1/s]Best efficiency rotational speed
Hbep [m]Best efficiency head
Qbep [m³/s]Best efficiency discharge
Tbep [Nm]Best efficiency torque
openingBep [-]Normalize best efficiency opening (must be between 0 and 1)
")); - -end TurbineData; diff --git a/OpenHPL/Types/package.order b/OpenHPL/Types/package.order index c2651149..5071474e 100644 --- a/OpenHPL/Types/package.order +++ b/OpenHPL/Types/package.order @@ -5,6 +5,3 @@ FrictionMethod FrictionSpec Lambda SurgeTank -TurbineData -TurbineCharacteristics -ReactionTurbines diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo deleted file mode 100644 index 6d1a2254..00000000 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/package.mo +++ /dev/null @@ -1,9 +0,0 @@ -within OpenHPLTest.EmpiricalTurbine; -package TestBasicFunctions - extends Modelica.Icons.ExamplesPackage; - // - - - // - -end TestBasicFunctions; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo deleted file mode 100644 index 84057f6c..00000000 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/AbstractTurbineTest.mo +++ /dev/null @@ -1,49 +0,0 @@ -within OpenHPLTest.EmpiricalTurbine.TurbineTest; -partial model AbstractTurbineTest - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); -protected -/* - constant Integer NC = 11; - constant Integer NP = 6; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.014, 0.030, 0.050, 0.100, 0.200, 0.300, 0.400, 0.500, 0.601, 0.800, 1.000}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.07, 0.07}, {0.30, 0.10, 0.07}, {0.54, -0.07, -0.03}, {0.92, 0.25, 0.13}, {1.13, -0.11, -0.17}, {1.43, -0.06, -0.31}}, {{0.00, 0.11, 0.15}, {0.32, 0.15, 0.17}, {0.51, -0.06, -0.09}, {1.00, 0.35, 0.35}, {1.11, -0.12, -0.30}, {1.43, -0.09, -0.31}}, {{0.00, 0.15, 0.23}, {0.34, 0.21, 0.24}, {0.47, -0.08, -0.01}, {1.07, 0.46, 0.35}, {1.09, -0.15, -0.24}, {1.43, -0.11, -0.37}}, {{0.00, 0.27, 0.45}, {0.37, 0.30, 0.40}, {0.40, 0.05, 0.30}, {1.38, 0.60, 0.26}, {0.97, -0.19, -0.17}, {1.43, -0.13, -0.42}}, {{0.00, 0.51, 0.92}, {0.40, 0.53, 0.80}, {0.45, 0.31, 0.83}, {1.48, 0.75, 0.14}, {0.99, -0.14, -0.06}, {1.44, -0.17, -0.49}}, {{0.00, 0.77, 1.41}, {0.44, 0.79, 1.23}, {0.51, 0.56, 1.29}, {1.62, 0.82, -0.14}, {0.99, -0.05, 0.11}, {1.43, -0.18, -0.51}}, {{0.00, 1.01, 1.87}, {0.48, 1.05, 1.70}, {0.56, 0.74, 1.46}, {1.68, 0.84, -0.35}, {1.03, 0.06, 0.23}, {1.43, -0.19, -0.53}}, {{0.00, 1.25, 2.27}, {0.52, 1.26, 1.99}, {0.63, 1.00, 1.84}, {1.70, 0.83, -0.64}, {1.08, 0.17, 0.35}, {1.43, -0.18, -0.52}}, {{0.00, 1.46, 2.60}, {0.53, 1.45, 2.33}, {0.77, 1.19, 1.80}, {1.63, 0.86, -0.58}, {1.13, 0.24, 0.31}, {1.43, -0.17, -0.52}}, {{0.00, 1.79, 3.06}, {0.55, 1.78, 2.77}, {0.99, 1.43, 1.67}, {1.53, 0.94, -0.59}, {1.20, 0.31, 0.28}, {1.45, -0.16, -0.54}}, {{0.00, 2.10, 3.41}, {0.59, 2.02, 2.99}, {1.05, 1.63, 1.56}, {1.53, 1.04, -0.47}, {1.22, 0.40, 0.24}, {1.45, -0.13, -0.54}}}; - - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.10, 0.25, 0.50, 0.75, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.18, 0.26}, {0.41, 0.10, 0.17}, {1.04, 0.31, 0.25}, {1.32, -0.04, -0.21}}, {{0.00, 0.44, 0.73}, {0.43, 0.37, 0.67}, {1.27, 0.55, 0.29}, {1.38, 0.00, -0.19}}, {{0.00, 0.91, 1.55}, {0.59, 0.89, 1.33}, {1.57, 0.79, 0.19}, {1.51, 0.00, -0.29}}, {{0.00, 1.30, 2.11}, {0.78, 1.33, 1.77}, {1.72, 0.92, -0.12}, {1.58, 0.00, -0.28}}, {{0.00, 1.57, 2.41}, {0.92, 1.63, 1.91}, {1.82, 1.02, -0.30}, {1.63, 0.00, -0.35}}}; - - constant Integer NC = 3; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC] = {0.00, 0.50, 1.00}; - parameter Real controlPoints[NC, NP, ND] = {{{0.00, 0.00, 0.00}, {0.40, 0.00, -0.05}, {0.80, 0.00, -0.10}, {1.20, 0.00, -0.15}}, {{0.00, 0.50, 0.50}, {0.40, 0.50, 0.45}, {0.80, 0.50, 0.40}, {1.20, 0.50, 0.35}}, {{0.00, 1.00, 1.00}, {0.40, 1.00, 0.95}, {0.80, 1.00, 0.90}, {1.20, 1.00, 0.85}}}; - - protected - constant Integer NC = 5; - constant Integer NP = 4; - constant Integer ND = 3; - parameter Real openingArray[NC]={0.10,0.25,0.50,0.75,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.18,0.26 },{ 0.41,0.10,0.17 },{ 1.04,0.31,0.25 },{ 1.32,-0.04,-0.21 }},{{ 0.00,0.44,0.73 },{ 0.43,0.37,0.67 },{ 1.27,0.55,0.29 },{ 1.38,0.00,-0.19 }},{{ 0.00,0.91,1.55 },{ 0.59,0.89,1.33 },{ 1.48,0.79,0.19 },{ 1.51,0.00,-0.29 }},{{ 0.00,1.30,2.11 },{ 0.78,1.33,1.77 },{ 1.55,0.92,-0.12 },{ 1.58,0.00,-0.28 }},{{ 0.00,1.57,2.41 },{ 0.92,1.63,1.91 },{ 1.60,1.02,-0.30 },{ 1.63,0.00,-0.35 }}}; - parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; - - protected - */ - constant Integer NC = 4; - constant Integer NP = 4; - constant Integer ND = 3; - - parameter Real openingArray[NC]={0.00,0.33,0.67,1.00}; - parameter Real controlPoints[NC,NP,ND]={{{ 0.00,0.00,0.00 },{ 0.94,0.00,-0.19 },{ 1.89,0.00,-0.38 },{ 2.83,0.00,-0.57 }},{{ 0.00,0.70,1.10 },{ 1.09,0.77,1.06 },{ 1.67,-0.43,-2.94 },{ 2.83,-0.15,-2.39 }},{{ 0.00,1.40,2.20 },{ 1.35,1.43,1.50 },{ 1.30,-0.66,-4.88 },{ 2.83,-0.31,-4.79 }},{{ 0.00,2.10,3.30 },{ 1.59,1.98,1.39 },{ 0.96,-0.71,-6.03 },{ 2.83,-0.47,-7.19 }}}; - parameter OpenHPL.Types.TurbineCharacteristics tc(nCurves = NC, nPoints = NP, nDim = ND, opening = openingArray, data = controlPoints); -public - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( - Placement(transformation(origin = {-82, 54}, extent = {{-10, -10}, {10, 10}})));annotation( - Icon(graphics = {Text(origin = {0, 110}, extent = {{-100, 30}, {100, -30}}, textString = "%name")})); - -end AbstractTurbineTest; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo new file mode 100644 index 00000000..2821e300 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo @@ -0,0 +1,28 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model Test01_Turbine + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=100; + + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( + Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0 ) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0) annotation( + Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); +equation + connect(overvann.o, turbine.i) annotation( + Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); + annotation ( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); + +end Test01_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo deleted file mode 100644 index 769983a2..00000000 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_TurbineLookUp.mo +++ /dev/null @@ -1,18 +0,0 @@ -within OpenHPLTest.EmpiricalTurbine.TurbineTest; -model Test01_TurbineLookUp - extends AbstractTurbineTest; -public - Real opening; - SI.Length Ht "Turbine head"; - SI.VolumeFlowRate Qt "Turbine flow rate"; - SI.Frequency nrps "Rotational speed"; - SI.Torque Tt "Turbine torque"; -equation - Ht = 425.0; - nrps = 1.0e-03 + 8.33*time*1.4; - opening = 0.6; - (Qt, Tt) = OpenHPL.Functions.TurbineLookUp2(Ht, nrps, opening, turbineData, tc); - annotation ( - experiment(StartTime = 0, StopTime = 1, Tolerance = 1e-06, Interval = 0.001), - Documentation(info = "Basic test of  the turbine lookup function. The head is kept constant, the speed is a linear function of time, and the flow and torque is computed from the model.
Running the model the turbine flow Qt or turbine torque Tt can be ploted as function of time.
")); -end Test01_TurbineLookUp; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo index af233a92..a980ebfd 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo @@ -1,22 +1,8 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test02_Turbine -extends AbstractTurbineTest; - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); -equation - connect(overvann.o, turbine.i) annotation ( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation ( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation ( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - annotation ( +extends Test01_Turbine(Hn=300, turbin(p=14)); +annotation ( Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); + end Test02_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo index 53893e5f..b5e2a69f 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -1,41 +1,7 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test03_Turbine - extends AbstractTurbineTest; - -public - OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( - Placement(transformation(origin = {-44, 32}, extent = {{-10, -10}, {10, 10}}))); - - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( - Placement(transformation(origin = {-80, 32}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = 0.603) annotation ( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); -equation - connect(turbine.o, undervann.o) annotation ( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation ( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, tunnel.i) annotation ( - Line(points = {{-70, 32}, {-54, 32}}, color = {0, 128, 255})); - connect(tunnel.o, turbine.i) annotation ( - Line(points = {{-34, 32}, {-24, 32}, {-24, 12}, {2, 12}}, color = {0, 128, 255})); - annotation ( - experiment(StartTime = 0, StopTime = 50.0, Tolerance = 1e-06, Interval = 0.02000), - Documentation(info = "Generic test with penstock and emprical turbine model. The opening is kept fixed and the unit is allowed to speed up to runaway.")); - - /* - , - __OpenModelica_commandLineOptions="--matchingAlgorithm=PFPlusExt --indexReductionMethod=dynamicStateSelection -d=initialization,NLSanalyticJacobian", - __OpenModelica_simulationFlags( - lv="LOG_STDOUT,LOG_ASSERT,LOG_STATS", - s="dassl", - noHomotopyOnFirstTry="()", - homMaxNewtonSteps="50", - homMaxTries="30", - variableFilter=".*")); - */ + extends Test01_Turbine(Hn=600, turbin(p=8)); +annotation ( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); end Test03_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo index f7cfc039..94e70992 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -1,24 +1,27 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test04_Turbine - extends AbstractTurbineTest; -public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=600; + parameter Real opening=0.2; + // + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( + Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc, enable_nomSpeed = false, f_0 = 0.2, enable_f = true) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0, useH = false, J = 2e3 ) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - parameter OpenHPL.Types.TurbineData turbineData(Dn = 1.59, nrps = 8.33, Hbep = 425.0, Qbep = 23.95, Tbep = 1.718E+06, openingBep = 0.601, g = data.g, rho = data.rho) annotation ( - Placement(transformation(origin = {-80, 44}, extent = {{-12, 24}, {6, 6}}))); + Modelica.Blocks.Sources.Constant const(k = opening) annotation( + Placement(transformation(origin = {-18, 68}, extent = {{-10, -10}, {10, 10}}))); equation - connect(overvann.o, turbine.i) annotation ( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(turbine.o, undervann.o) annotation ( + connect(turbine.o, undervann.o) annotation( Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation ( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); -annotation ( - experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.01)); + connect(overvann.o, turbine.i) annotation( + Line(points = {{-72, 12}, {2, 12}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{-6, 68}, {4, 68}, {4, 24}}, color = {0, 0, 127})); + annotation( + experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001), + Icon(graphics = {Text(extent = {{-150, 90}, {150, -90}}, textString = "%name")})); end Test04_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index 8d50f6e2..a132d625 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -1,28 +1,27 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test05_Turbine - extends AbstractTurbineTest; + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=600; + parameter Real opening=0.2; // -public - OpenHPL.Waterway.Reservoir overvann(h_0 = 425.0, constantLevel = true) annotation ( + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine(turbineData = turbineData, turbineCharacteristics = tc,enable_nomSpeed = false, enable_f = true, f_0 = 0.2) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0, useH = false, J = 2e3 ) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe tunnel(H = 0, L = 2000, p_eps_input(displayUnit = "mm") = 1e-4, D_i = 4.6, SteadyState = true, Vdot_0 = 20.5) annotation ( - Placement(transformation(origin = {-42, 12}, extent = {{-10, -10}, {10, 10}}))); - - Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 2) annotation ( - Placement(transformation(origin = {52, 72}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + Modelica.Blocks.Sources.Constant const(k = opening) annotation( + Placement(transformation(origin = {-18, 68}, extent = {{-10, -10}, {10, 10}}))); equation - connect(turbine.o, undervann.o) annotation ( + connect(turbine.o, undervann.o) annotation( Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation ( - Line(points = {{41, 72}, {4, 72}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, tunnel.i) annotation ( - Line(points = {{-72, 12}, {-52, 12}}, color = {0, 128, 255})); - connect(tunnel.o, turbine.i) annotation ( - Line(points = {{-32, 12}, {2, 12}}, color = {0, 128, 255})); -annotation( - experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001)); + connect(overvann.o, turbine.i) annotation( + Line(points = {{-72, 12}, {2, 12}}, color = {0, 128, 255})); + connect(const.y, turbine.u_t) annotation( + Line(points = {{-6, 68}, {4, 68}, {4, 24}}, color = {0, 0, 127})); + annotation( + experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001), + Icon(graphics = {Text(extent = {{-150, 90}, {150, -90}}, textString = "%name")})); end Test05_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo new file mode 100644 index 00000000..cc368b30 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo @@ -0,0 +1,53 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model Test06_Turbine + extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=500; + Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; + Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; + + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( + Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false ) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 5) annotation( + Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167, SteadyState = false, Vdot_0 = 2.0) annotation( + Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( + Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( + Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); + OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000, SteadyState = false, Vdot_0 = 2.0) annotation( + Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( + Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); +equation + Ht1 = turbine.dp/(data.rho*data.g); + Ht2 = turb2.dp/(data.rho*data.g); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, pipe.i) annotation( + Line(points = {{-70, 26}, {-60, 26}, {-60, 18}, {-48, 18}}, color = {0, 128, 255})); + connect(pipe.o, turbine.i) annotation( + Line(points = {{-28, 18}, {-20, 18}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(ov2.o, pipe2.i) annotation( + Line(points = {{-70, -30}, {-46, -30}}, color = {0, 128, 255})); + connect(turb2.o, uv2.o) annotation( + Line(points = {{14, -42}, {26, -42}, {26, -74}, {60, -74}}, color = {0, 128, 255})); + connect(pipe2.o, turb2.i) annotation( + Line(points = {{-26, -30}, {-22, -30}, {-22, -42}, {-6, -42}}, color = {0, 128, 255})); + connect(ramp.y, turb2.u_t) annotation( + Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); + annotation ( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); + + +end Test06_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo new file mode 100644 index 00000000..1aa3a449 --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo @@ -0,0 +1,53 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model Test07_Turbine +extends Modelica.Icons.Example; + inner OpenHPL.Data data annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=500; + Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; + Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; + + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( + Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false ) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 5) annotation( + Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167, SteadyState = true) annotation( + Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( + Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( + Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); + OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000, SteadyState = true) annotation( + Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( + Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); +equation + Ht1 = turbine.dp/(data.rho*data.g); + Ht2 = turb2.dp/(data.rho*data.g); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, pipe.i) annotation( + Line(points = {{-70, 26}, {-60, 26}, {-60, 18}, {-48, 18}}, color = {0, 128, 255})); + connect(pipe.o, turbine.i) annotation( + Line(points = {{-28, 18}, {-20, 18}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(ov2.o, pipe2.i) annotation( + Line(points = {{-70, -30}, {-46, -30}}, color = {0, 128, 255})); + connect(turb2.o, uv2.o) annotation( + Line(points = {{14, -42}, {26, -42}, {26, -74}, {60, -74}}, color = {0, 128, 255})); + connect(pipe2.o, turb2.i) annotation( + Line(points = {{-26, -30}, {-22, -30}, {-22, -42}, {-6, -42}}, color = {0, 128, 255})); + connect(ramp.y, turb2.u_t) annotation( + Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); + annotation ( + Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); + + +end Test07_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo deleted file mode 100644 index cd180a0f..00000000 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/TestXX_Turbine.mo +++ /dev/null @@ -1,20 +0,0 @@ -within OpenHPLTest.EmpiricalTurbine.TurbineTest; - -model TestXX_Turbine - extends Modelica.Icons.Example; - // - Test02_Turbine test02_Turbine annotation( - Placement(transformation(origin = {-58, 82}, extent = {{-10, -10}, {10, 10}}))); - Test03_Turbine test03_Turbine annotation( - Placement(transformation(origin = {46, 80}, extent = {{-10, -10}, {10, 10}}))); - Test04_Turbine test04_Turbine annotation( - Placement(transformation(origin = {-58, 24}, extent = {{-10, -10}, {10, 10}}))); - /**/ - Test05_Turbine test05_Turbine annotation( - Placement(transformation(origin = {50, 24}, extent = {{-10, -10}, {10, 10}}))); - -equation - -annotation( - experiment(StartTime = 0, StopTime = 12, Tolerance = 1e-06, Interval = 0.005)); -end TestXX_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo new file mode 100644 index 00000000..678deb9d --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -0,0 +1,31 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model Test_Turbine_Charactersistics + extends Modelica.Icons.Example; + // + Test05_Turbine t01(opening=0.1) annotation( + Placement(transformation(origin = {-60, 82}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t02(opening=0.2) annotation( + Placement(transformation(origin = {-2, 82}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t03(opening=0.3) annotation( + Placement(transformation(origin = {46, 84}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t04(opening=0.4) annotation( + Placement(transformation(origin = {-56, 50}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t05(opening=0.5) annotation( + Placement(transformation(origin = {-2, 46}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t06(opening=0.6) annotation( + Placement(transformation(origin = {50, 50}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t07(opening=0.7) annotation( + Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t08(opening=0.8) annotation( + Placement(transformation(origin = {-8, 6}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t09(opening=0.9) annotation( + Placement(transformation(origin = {48, 8}, extent = {{-10, -10}, {10, 10}}))); + Test05_Turbine t10(opening=1.0) annotation( + Placement(transformation(origin = {-58, -28}, extent = {{-10, -10}, {10, 10}}))); + +equation + +annotation( + experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005)); +end Test_Turbine_Charactersistics; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order index 26a2ba34..49f8cc53 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -1,7 +1,8 @@ -AbstractTurbineTest -Test01_TurbineLookUp Test02_Turbine Test03_Turbine Test04_Turbine Test05_Turbine -TestXX_Turbine +Test01_Turbine +Test_Turbine_Charactersistics +Test06_Turbine +Test07_Turbine diff --git a/OpenHPLTest/EmpiricalTurbine/package.order b/OpenHPLTest/EmpiricalTurbine/package.order index dc6141d7..15fb2fe1 100644 --- a/OpenHPLTest/EmpiricalTurbine/package.order +++ b/OpenHPLTest/EmpiricalTurbine/package.order @@ -1,3 +1,2 @@ Information -TestBasicFunctions TurbineTest From bf13cda2c1f69b33dc227c55c793b74b6df9fe0f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 5 May 2026 12:03:36 +0200 Subject: [PATCH 19/37] Added test at varying head --- .../EmpiricalTurbine/TurbineTest/Test_All.mo | 23 ++++++++++++++++ .../Test_Turbine_Charactersistics.mo | 26 ++++++++++--------- .../TurbineTest/package.order | 1 + 3 files changed, 38 insertions(+), 12 deletions(-) create mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo new file mode 100644 index 00000000..0f80ae5c --- /dev/null +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo @@ -0,0 +1,23 @@ +within OpenHPLTest.EmpiricalTurbine.TurbineTest; + +model Test_All +extends Modelica.Icons.Example; +// +Test_Turbine_Charactersistics T1(Hn=100) annotation( + Placement(transformation(origin = {-60, 90}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T2(Hn=200) annotation( + Placement(transformation(origin = {-60, 70}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T3(Hn=300) annotation( + Placement(transformation(origin = {-60, 50}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T4(Hn=400) annotation( + Placement(transformation(origin = {-60, 30}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T5(Hn=500) annotation( + Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); + +Test_Turbine_Charactersistics T6(Hn=600) annotation( + Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); +equation +// +annotation( + experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005)); +end Test_All; \ No newline at end of file diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo index 678deb9d..2797bf83 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -3,29 +3,31 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test_Turbine_Charactersistics extends Modelica.Icons.Example; // - Test05_Turbine t01(opening=0.1) annotation( + parameter Modelica.Units.SI.Height Hn=600; + Test05_Turbine t01(opening=0.1,Hn=Hn) annotation( Placement(transformation(origin = {-60, 82}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t02(opening=0.2) annotation( + Test05_Turbine t02(opening=0.2,Hn=Hn) annotation( Placement(transformation(origin = {-2, 82}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t03(opening=0.3) annotation( + Test05_Turbine t03(opening=0.3,Hn=Hn) annotation( Placement(transformation(origin = {46, 84}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t04(opening=0.4) annotation( + Test05_Turbine t04(opening=0.4,Hn=Hn) annotation( Placement(transformation(origin = {-56, 50}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t05(opening=0.5) annotation( + Test05_Turbine t05(opening=0.5,Hn=Hn) annotation( Placement(transformation(origin = {-2, 46}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t06(opening=0.6) annotation( + Test05_Turbine t06(opening=0.6,Hn=Hn) annotation( Placement(transformation(origin = {50, 50}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t07(opening=0.7) annotation( + Test05_Turbine t07(opening=0.7,Hn=Hn) annotation( Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t08(opening=0.8) annotation( + Test05_Turbine t08(opening=0.8,Hn=Hn) annotation( Placement(transformation(origin = {-8, 6}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t09(opening=0.9) annotation( + Test05_Turbine t09(opening=0.9,Hn=Hn) annotation( Placement(transformation(origin = {48, 8}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t10(opening=1.0) annotation( + Test05_Turbine t10(opening=1.0,Hn=Hn) annotation( Placement(transformation(origin = {-58, -28}, extent = {{-10, -10}, {10, 10}}))); equation annotation( - experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005)); -end Test_Turbine_Charactersistics; + experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005), + Icon(graphics = {Text(origin = {142, 45}, extent = {{-142, 91}, {142, -91}}, textString = "H=%Hn")})); +end Test_Turbine_Charactersistics; \ No newline at end of file diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order index 49f8cc53..a49187f6 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -6,3 +6,4 @@ Test01_Turbine Test_Turbine_Charactersistics Test06_Turbine Test07_Turbine +Test_All From 4264350cd52567b2d8ed9d402877281d59e6619d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Tue, 5 May 2026 17:56:41 +0200 Subject: [PATCH 20/37] Update Test_All.mo --- OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo index 0f80ae5c..f4121049 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo @@ -15,9 +15,9 @@ Test_Turbine_Charactersistics T5(Hn=500) annotation( Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); Test_Turbine_Charactersistics T6(Hn=600) annotation( - Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); equation // annotation( experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005)); -end Test_All; \ No newline at end of file +end Test_All; From 22f8ca27811b2ab088a5b1e9074365f4ca6a37b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Thu, 7 May 2026 16:34:14 +0200 Subject: [PATCH 21/37] Adding test points for low head --- .../EmpiricalTurbine/TurbineTest/Test_All.mo | 19 ++++++++++++------- .../Test_Turbine_Charactersistics.mo | 4 ++-- 2 files changed, 14 insertions(+), 9 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo index f4121049..df91ba63 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo @@ -3,18 +3,23 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test_All extends Modelica.Icons.Example; // -Test_Turbine_Charactersistics T1(Hn=100) annotation( +Test_Turbine_Charactersistics T1(Hn=25) annotation( Placement(transformation(origin = {-60, 90}, extent = {{-10, -10}, {10, 10}}))); -Test_Turbine_Charactersistics T2(Hn=200) annotation( +Test_Turbine_Charactersistics T2(Hn=50) annotation( Placement(transformation(origin = {-60, 70}, extent = {{-10, -10}, {10, 10}}))); -Test_Turbine_Charactersistics T3(Hn=300) annotation( +Test_Turbine_Charactersistics T3(Hn=75) annotation( Placement(transformation(origin = {-60, 50}, extent = {{-10, -10}, {10, 10}}))); -Test_Turbine_Charactersistics T4(Hn=400) annotation( +Test_Turbine_Charactersistics T4(Hn=100) annotation( Placement(transformation(origin = {-60, 30}, extent = {{-10, -10}, {10, 10}}))); -Test_Turbine_Charactersistics T5(Hn=500) annotation( +Test_Turbine_Charactersistics T5(Hn=200) annotation( Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); - -Test_Turbine_Charactersistics T6(Hn=600) annotation( +Test_Turbine_Charactersistics T6(Hn=300) annotation( + Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T7(Hn=400) annotation( + Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T8(Hn=500) annotation( + Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); +Test_Turbine_Charactersistics T9(Hn=600) annotation( Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); equation // diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo index 2797bf83..23b17d2a 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -20,7 +20,7 @@ model Test_Turbine_Charactersistics Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); Test05_Turbine t08(opening=0.8,Hn=Hn) annotation( Placement(transformation(origin = {-8, 6}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t09(opening=0.9,Hn=Hn) annotation( + Test05_Turbine t09(opening=0.9,Hn=Hn) annotation( Placement(transformation(origin = {48, 8}, extent = {{-10, -10}, {10, 10}}))); Test05_Turbine t10(opening=1.0,Hn=Hn) annotation( Placement(transformation(origin = {-58, -28}, extent = {{-10, -10}, {10, 10}}))); @@ -30,4 +30,4 @@ equation annotation( experiment(StartTime = 0, StopTime = 50, Tolerance = 1e-06, Interval = 0.005), Icon(graphics = {Text(origin = {142, 45}, extent = {{-142, 91}, {142, -91}}, textString = "H=%Hn")})); -end Test_Turbine_Charactersistics; \ No newline at end of file +end Test_Turbine_Charactersistics; From 5d76277b41e5a23e2e97f1831884b473446dcb11 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Mon, 18 May 2026 16:39:07 +0200 Subject: [PATCH 22/37] Continue testing --- .../EmpiricalTurbine/TurbineTest/Test_All.mo | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo index df91ba63..fbe9b6a9 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo @@ -4,23 +4,23 @@ model Test_All extends Modelica.Icons.Example; // Test_Turbine_Charactersistics T1(Hn=25) annotation( - Placement(transformation(origin = {-60, 90}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, 90}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T2(Hn=50) annotation( - Placement(transformation(origin = {-60, 70}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, 70}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T3(Hn=75) annotation( - Placement(transformation(origin = {-60, 50}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, 50}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T4(Hn=100) annotation( - Placement(transformation(origin = {-60, 30}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, 30}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T5(Hn=200) annotation( - Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, 10}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T6(Hn=300) annotation( - Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, -10}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T7(Hn=400) annotation( - Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, -30}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T8(Hn=500) annotation( - Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, -50}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T9(Hn=600) annotation( - Placement(transformation(origin = {-60, -10}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin = {-60, -70}, extent = {{-20, -20}, {20, 20}}))); equation // annotation( From 887cbaaf0e25f2dd4e40d393469a7e49f7ffc819 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 29 May 2026 10:57:22 +0200 Subject: [PATCH 23/37] Small tuning of EmpiricalTurbine --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 6 +++--- .../TurbineTest/Test_Turbine_Charactersistics.mo | 2 +- 2 files changed, 4 insertions(+), 4 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 633a9a96..bb6ac5b1 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -20,8 +20,8 @@ model EmpiricalTurbine parameter SI.Torque Tt_n=P_n/(2*C.pi*nrps_n) "Noninal turbine torque"; parameter Real NQE=4.0*H_n^(-2./3.) "Specific speed based on empirical relartion"; - parameter Real kappa=1.351-0.857*NQE; - parameter Real nRA=1.5+NQE*5 "Normalized runaway speed us function of specific speed"; + parameter Real kappa=max(1.351-0.857*NQE,1.05); + parameter Real nRA=min(1.5+NQE*5,2.6) "Normalized runaway speed us function of specific speed"; parameter Real dQdn=0.4222+0.3179*Modelica.Math.log(NQE); parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; @@ -35,7 +35,7 @@ equation dp = i.p - o.p; Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; - Tt=Tt_n*(dp/(H_n*(rho*g)))*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); + Tt=Tt_n*(1-0.1*(dp/(H_n*(rho*g)))^2)*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominale power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo index 23b17d2a..b8084618 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -3,7 +3,7 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test_Turbine_Charactersistics extends Modelica.Icons.Example; // - parameter Modelica.Units.SI.Height Hn=600; + parameter Modelica.Units.SI.Height Hn=300; Test05_Turbine t01(opening=0.1,Hn=Hn) annotation( Placement(transformation(origin = {-60, 82}, extent = {{-10, -10}, {10, 10}}))); Test05_Turbine t02(opening=0.2,Hn=Hn) annotation( From 027ae1be1877d5b89aa605342fff4a9b3330dfb9 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Fri, 29 May 2026 14:53:01 +0200 Subject: [PATCH 24/37] Corrected empty tag in documentation --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index bb6ac5b1..42d2a2c3 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -44,6 +44,5 @@ annotation (

Figure: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

- -

")); +")); end EmpiricalTurbine; From 998aaf5503a0ad2b70e575065ec984fedfe6d5cb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Wed, 24 Jun 2026 16:03:11 +0200 Subject: [PATCH 25/37] Continue tweaking torque model (not yet completed) --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 42d2a2c3..f500748c 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -38,7 +38,7 @@ equation Tt=Tt_n*(1-0.1*(dp/(H_n*(rho*g)))^2)*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( - Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominale power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. + Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominale power P_n.
All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases.

From 467a4d54179463e0b1628ec0b90a3ba2ba6101ed Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Bjarne=20B=C3=B8rresen?= Date: Wed, 24 Jun 2026 21:56:49 +0200 Subject: [PATCH 26/37] Corrected doc --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index f500748c..8975c08e 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -38,8 +38,7 @@ equation Tt=Tt_n*(1-0.1*(dp/(H_n*(rho*g)))^2)*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( - Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominale power P_n.
All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. - + Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n.All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases.

From 23631d327ff15d615d70fd85bad4e1f8c9bdb0e5 Mon Sep 17 00:00:00 2001 From: boerrebj Date: Thu, 25 Jun 2026 08:30:19 +0200 Subject: [PATCH 27/37] Tuning torque equation slightly more --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 13 +- .../Resources/Images/EmpiricalTurbine02.svg | 5353 +++++++++++++++++ 2 files changed, 5362 insertions(+), 4 deletions(-) create mode 100644 OpenHPL/Resources/Images/EmpiricalTurbine02.svg diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 8975c08e..bca7c775 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -25,9 +25,10 @@ model EmpiricalTurbine parameter Real dQdn=0.4222+0.3179*Modelica.Math.log(NQE); parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; - parameter Real Ct =Vdot_n/sqrt(H_n*g*rho) "Nominal turbine coefficient"; + parameter Real Ct =Vdot_n/sqrt(H_n*g*rho) "Nominal turbine discharge coefficient"; constant Real alpha=1.5; constant Real beta=3.5; + constant Real tau_1=0.1 "First parameter in empirical torque equation"; constant Real epsilon = 5.0e-5 "Constant to ensure robust expression for dp vs flow. Trial and error to find suitable value."; equation i.mdot + o.mdot = 0; @@ -35,13 +36,17 @@ equation dp = i.p - o.p; Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; - Tt=Tt_n*(1-0.1*(dp/(H_n*(rho*g)))^2)*(Vdot/Vdot_n)*(1-(nrps/(nrps_n*nRA*1.2))^5); + Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(rho*g)))^2)*(1-(nrps/(nrps_n*nRA))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation ( - Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n.All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. + Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

-

Figure: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

+

Figure 1: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

+

+ +

+

Figure 2: Variation as function of head of the turbine characteristisc. Discharge as function of speed (pu).

")); end EmpiricalTurbine; diff --git a/OpenHPL/Resources/Images/EmpiricalTurbine02.svg b/OpenHPL/Resources/Images/EmpiricalTurbine02.svg new file mode 100644 index 00000000..1d7944bd --- /dev/null +++ b/OpenHPL/Resources/Images/EmpiricalTurbine02.svg @@ -0,0 +1,5353 @@ + + + + + + + + 2026-06-25T08:27:44.038440 + image/svg+xml + + + Matplotlib v3.10.9, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From a0af79185c4956b9d1c2a4fbf9a72c09fa0efb7c Mon Sep 17 00:00:00 2001 From: boerrebj Date: Thu, 25 Jun 2026 09:53:13 +0200 Subject: [PATCH 28/37] Correcting documentation string --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 10 ++-------- 1 file changed, 2 insertions(+), 8 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index bca7c775..2e8fe7a9 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -38,15 +38,9 @@ equation Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(rho*g)))^2)*(1-(nrps/(nrps_n*nRA))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); -annotation ( - Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated. -

- -

+annotation (Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

Figure 1: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

-

- -

+

Figure 2: Variation as function of head of the turbine characteristisc. Discharge as function of speed (pu).

")); end EmpiricalTurbine; From 724bbcec3727aaec4d56532a6d84df6111a7e0f6 Mon Sep 17 00:00:00 2001 From: boerrebj Date: Thu, 25 Jun 2026 09:58:25 +0200 Subject: [PATCH 29/37] Correcting documentation string --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 2e8fe7a9..e4dbbd67 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -38,9 +38,11 @@ equation Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(rho*g)))^2)*(1-(nrps/(nrps_n*nRA))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); -annotation (Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

+annotation (Documentation(info = " +

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

+

Figure 1: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

-

+

Figure 2: Variation as function of head of the turbine characteristisc. Discharge as function of speed (pu).

")); end EmpiricalTurbine; From 3508913f9e100fa5a7b2d314246d8b98d917e8fa Mon Sep 17 00:00:00 2001 From: boerrebj Date: Tue, 7 Jul 2026 09:55:04 +0200 Subject: [PATCH 30/37] Small correction of documentation --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 4 ++-- .../Images/{EmpiricalTurbine.svg => EmpiricalTurbine01.svg} | 0 2 files changed, 2 insertions(+), 2 deletions(-) rename OpenHPL/Resources/Images/{EmpiricalTurbine.svg => EmpiricalTurbine01.svg} (100%) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index e4dbbd67..7b3d5da5 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -40,9 +40,9 @@ equation connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation (Documentation(info = "

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

-

+

Figure 1: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

-

Figure 2: Variation as function of head of the turbine characteristisc. Discharge as function of speed (pu).

+

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristisc. Discharge as function of speed (pu).

")); end EmpiricalTurbine; diff --git a/OpenHPL/Resources/Images/EmpiricalTurbine.svg b/OpenHPL/Resources/Images/EmpiricalTurbine01.svg similarity index 100% rename from OpenHPL/Resources/Images/EmpiricalTurbine.svg rename to OpenHPL/Resources/Images/EmpiricalTurbine01.svg From 7f8d97897d2afe4eac15648504bd8d083c98bc5c Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 17 Jul 2026 09:54:43 +0200 Subject: [PATCH 31/37] Fixes spelling. --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 18 +++++++++--------- OpenHPLTest/EmpiricalTurbine/Information.mo | 7 ++++--- 2 files changed, 13 insertions(+), 12 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 7b3d5da5..f895529c 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -7,7 +7,7 @@ model EmpiricalTurbine extends OpenHPL.Icons.Turbine; SI.VolumeFlowRate Vdot "Turbine flow rate"; - SI.Pressure dp "Pressure drop"; + SI.Pressure dp "Pressure drop"; SI.Torque Tt "Turbine torque"; Modelica.Blocks.Sources.RealExpression realExpression(y=Tt) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); @@ -17,11 +17,11 @@ model EmpiricalTurbine parameter SI.Acceleration g=data.g; constant Real eta0=0.90 "Full load efficiency. Hard coded at the moment. Can be parametrized in the future"; parameter SI.VolumeFlowRate Vdot_n=P_n/(eta0*rho*g*H_n) "Nominal discharge"; - parameter SI.Torque Tt_n=P_n/(2*C.pi*nrps_n) "Noninal turbine torque"; - - parameter Real NQE=4.0*H_n^(-2./3.) "Specific speed based on empirical relartion"; + parameter SI.Torque Tt_n=P_n/(2*C.pi*nrps_n) "Nominal turbine torque"; + + parameter Real NQE=4.0*H_n^(-2./3.) "Specific speed based on empirical relation"; parameter Real kappa=max(1.351-0.857*NQE,1.05); - parameter Real nRA=min(1.5+NQE*5,2.6) "Normalized runaway speed us function of specific speed"; + parameter Real nRA=min(1.5+NQE*5,2.6) "Normalized runaway speed as function of specific speed"; parameter Real dQdn=0.4222+0.3179*Modelica.Math.log(NQE); parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; @@ -34,15 +34,15 @@ equation i.mdot + o.mdot = 0; i.mdot = Vdot*rho; dp = i.p - o.p; - + Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(rho*g)))^2)*(1-(nrps/(nrps_n*nRA))^5); connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); annotation (Documentation(info = " -

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throtling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

+

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throttling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

-

Figure 1: Example of throtling effect for a high head Francis unit. Discharge as function of speed (pu).

+

Figure 1: Example of throttling effect for a high head Francis unit. Discharge as function of speed [pu].

-

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristisc. Discharge as function of speed (pu).

+

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristics. Discharge as function of speed [pu].

")); end EmpiricalTurbine; diff --git a/OpenHPLTest/EmpiricalTurbine/Information.mo b/OpenHPLTest/EmpiricalTurbine/Information.mo index cf1e5a60..d01f3e70 100644 --- a/OpenHPLTest/EmpiricalTurbine/Information.mo +++ b/OpenHPLTest/EmpiricalTurbine/Information.mo @@ -1,6 +1,7 @@ within OpenHPLTest.EmpiricalTurbine; class Information -extends Modelica.Icons.Information; + extends Modelica.Icons.Information; annotation ( - Documentation(info = "The EmpiricalTurbine test package contains a series of test models for documeting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blening function (to find intermediate curves)
  • TurbineTetst - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are som robustness issues with the model. In the default configuration Test03_Turbine have issues with convergens at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resovle this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the dassl solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); -end Information; + Documentation( + info = "The EmpiricalTurbine test package contains a series of test models for documenting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blending function (to find intermediate curves)
  • TurbineTests - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are some robustness issues with the model. In the default configuration Test03_Turbine have issues with convergence at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resolve this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the DASSL solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); +end Information; \ No newline at end of file From 4aec41cdb9243a37019910b93ab0b49f07db3562 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 17 Jul 2026 12:38:41 +0200 Subject: [PATCH 32/37] Clean up of Empircal Turbine. --- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 29 +- .../Resources/Images/EmpiricalTurbine01.svg | 3177 +++- .../Resources/Images/EmpiricalTurbine02.svg | 12504 +++++++++------- 3 files changed, 9554 insertions(+), 6156 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index f895529c..61f7a095 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -1,7 +1,7 @@ within OpenHPL.ElectroMech.Turbines; model EmpiricalTurbine parameter SI.Height H_n = 100 "Nominal net head" annotation (Dialog(group = "Nominal values")); - parameter SI.Power P_n (displayUnit = "MW")= 1.e+06 "Nominal power" annotation (Dialog(group = "Nominal values")); + parameter SI.Power P_n( displayUnit = "MW")= 1.e+06 "Nominal power" annotation (Dialog(group = "Nominal values")); extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; extends OpenHPL.Interfaces.TurbineContacts; extends OpenHPL.Icons.Turbine; @@ -12,37 +12,34 @@ model EmpiricalTurbine Modelica.Blocks.Sources.RealExpression realExpression(y=Tt) annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); protected - constant Real eps=1.0e-08; - parameter SI.Density rho=data.rho; - parameter SI.Acceleration g=data.g; constant Real eta0=0.90 "Full load efficiency. Hard coded at the moment. Can be parametrized in the future"; - parameter SI.VolumeFlowRate Vdot_n=P_n/(eta0*rho*g*H_n) "Nominal discharge"; + parameter SI.VolumeFlowRate Vdot_n=P_n/(eta0*data.rho*data.g*H_n) "Nominal discharge"; parameter SI.Torque Tt_n=P_n/(2*C.pi*nrps_n) "Nominal turbine torque"; - parameter Real NQE=4.0*H_n^(-2./3.) "Specific speed based on empirical relation"; parameter Real kappa=max(1.351-0.857*NQE,1.05); parameter Real nRA=min(1.5+NQE*5,2.6) "Normalized runaway speed as function of specific speed"; parameter Real dQdn=0.4222+0.3179*Modelica.Math.log(NQE); parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; - parameter Real Ct =Vdot_n/sqrt(H_n*g*rho) "Nominal turbine discharge coefficient"; + parameter Real Ct =Vdot_n/sqrt(H_n*data.g*data.rho) "Nominal turbine discharge coefficient"; constant Real alpha=1.5; constant Real beta=3.5; constant Real tau_1=0.1 "First parameter in empirical torque equation"; constant Real epsilon = 5.0e-5 "Constant to ensure robust expression for dp vs flow. Trial and error to find suitable value."; + equation i.mdot + o.mdot = 0; - i.mdot = Vdot*rho; + i.mdot = Vdot*data.rho; dp = i.p - o.p; - Vdot*abs(Vdot)= dp*(Ct*max(epsilon, abs(u_t)^alpha)*(1+dQdn*(max(nrps/(nrps_n*nRA),epsilon)^beta)))^2; - Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(rho*g)))^2)*(1-(nrps/(nrps_n*nRA))^5); + Tt=Tt_n*(Vdot/Vdot_n)*(1-tau_1*(dp/(H_n*(data.rho*data.g)))^2)*(1-(nrps/(nrps_n*nRA))^5); + connect(realExpression.y, torque.tau) annotation (Line(points={{-49,0},{-37.2,0}}, color={0,0,127})); -annotation (Documentation(info = " +annotation (Documentation(info="

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throttling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

-

-

Figure 1: Example of throttling effect for a high head Francis unit. Discharge as function of speed [pu].

-

-

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristics. Discharge as function of speed [pu].

-")); +

+

Figure 1: Example of throttling effect for a high head Francis unit. Discharge as function of speed [pu].

+

+

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristics. Discharge as function of speed [pu].

+")); end EmpiricalTurbine; diff --git a/OpenHPL/Resources/Images/EmpiricalTurbine01.svg b/OpenHPL/Resources/Images/EmpiricalTurbine01.svg index 996ea3b8..c3cb2855 100644 --- a/OpenHPL/Resources/Images/EmpiricalTurbine01.svg +++ b/OpenHPL/Resources/Images/EmpiricalTurbine01.svg @@ -1,787 +1,2390 @@ - - -Plot Document -Generated with Qt - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Turbine discharge Vdot - - - - - - - - - - - - - - - - - - - - - -Volumetric flow rate - - - - - - - - - - - - - - - - - - - - - - - - - - - --0.5 - - - - - - - - - - - - - - - - - - -0 - - - - - - - - - - - - - - - - - - -0.5 - - - - - - - - - - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - -1.5 - - - - - - - - - - - - - - - - - - -2 - - - - - - - - - - - - - - - - - - -2.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -Relative speed - - - - - - - - - - - - - - - - - - - - - - - - - - - -0 - - - - - - - - - - - - - - - - - - -0.5 - - - - - - - - - - - - - - - - - - -1 - - - - - - - - - - - - - - - - - - -1.5 - - - - - - - - - - - - - - - - - - -2 - - - - - - - - - - - - - - - - - - -2.5 - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + Plot Document + Generated with Qt + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Turbine discharge Vdot + + + + + + + + + Volumetric flow rate + + + + + + + + + + + -0.5 + + + + + + + + 0 + + + + + + + + 0.5 + + + + + + + + 1 + + + + + + + + 1.5 + + + + + + + + 2 + + + + + + + + 2.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Relative speed + + + + + + + + + + + 0 + + + + + + + + 0.5 + + + + + + + + 1 + + + + + + + + 1.5 + + + + + + + + 2 + + + + + + + + 2.5 + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + Plot Document + + + + diff --git a/OpenHPL/Resources/Images/EmpiricalTurbine02.svg b/OpenHPL/Resources/Images/EmpiricalTurbine02.svg index 1d7944bd..66360c46 100644 --- a/OpenHPL/Resources/Images/EmpiricalTurbine02.svg +++ b/OpenHPL/Resources/Images/EmpiricalTurbine02.svg @@ -1,5353 +1,7151 @@ - - - - - - - - 2026-06-25T08:27:44.038440 - image/svg+xml - - - Matplotlib v3.10.9, https://matplotlib.org/ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - + + + + + + + + 2026-06-25T08:27:44.038440 + image/svg+xml + + + Matplotlib v3.10.9, https://matplotlib.org/ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + From bfbf78bc426625f385fd4ed38eeb25fab4e88eca Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 17 Jul 2026 12:38:29 +0200 Subject: [PATCH 33/37] Clean up of Test models --- OpenHPLTest/EmpiricalTurbine/Information.mo | 58 ++++++++++++++++++- .../TurbineTest/Test01_Turbine.mo | 29 +++++----- .../TurbineTest/Test02_Turbine.mo | 7 ++- .../TurbineTest/Test03_Turbine.mo | 7 ++- .../TurbineTest/Test04_Turbine.mo | 29 ++-------- .../TurbineTest/Test05_Turbine.mo | 29 ++-------- .../TurbineTest/Test06_Turbine.mo | 16 +++-- .../TurbineTest/Test07_Turbine.mo | 50 +--------------- .../EmpiricalTurbine/TurbineTest/Test_All.mo | 18 +++--- .../Test_Turbine_Charactersistics.mo | 2 +- .../TurbineTest/package.order | 4 +- 11 files changed, 115 insertions(+), 134 deletions(-) diff --git a/OpenHPLTest/EmpiricalTurbine/Information.mo b/OpenHPLTest/EmpiricalTurbine/Information.mo index d01f3e70..465e6a34 100644 --- a/OpenHPLTest/EmpiricalTurbine/Information.mo +++ b/OpenHPLTest/EmpiricalTurbine/Information.mo @@ -2,6 +2,60 @@ within OpenHPLTest.EmpiricalTurbine; class Information extends Modelica.Icons.Information; annotation ( + DocumentationClass=true, Documentation( - info = "The EmpiricalTurbine test package contains a series of test models for documenting and validating the implementation of the EmpiricalTurbine model.
There are two sub-packages:
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blending function (to find intermediate curves)
  • TurbineTests - collection of gradually more complex test cases using the EmpiricalTurbine model
At the moment there are some robustness issues with the model. In the default configuration Test03_Turbine have issues with convergence at time t=0.34 with the message
Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.
The following documents testing and investigations to resolve this.
In particular it is important to understand some of the following topics and how different implementations may impact the robustness of the models.
Some observations:
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
Additional comments:
In general convergence issues can either be related to \"stiff\" problems or singularities or discontinuous functions (or gradients). Running Test03 with the DASSL solver, with startTime=0 and stopTime=1 and varying time step gives the following result.
Time stepComments
0.005Convergence issues from t=0.26500 (nonlinear system 82)
0.01Convergence issues from t=0.34000
0.02Convergence issues from t=0.34000
0.05Convergence issues from t=0.683162
0.10Convergence issues from t=0.683162
0.20Convergence issues from t=0.683162

Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.")); -end Information; \ No newline at end of file + info=" +

The EmpiricalTurbine test package contains a series of test models for documenting and validating the implementation of the EmpiricalTurbine model.

+

There are two sub-packages:

+
    +
  • TestBasicFunctions - testing of the Bezier spline algorithm, the search algorithm and the blending function (to find intermediate curves)
  • +
  • TurbineTests - collection of gradually more complex test cases using the EmpiricalTurbine model
  • +
+

At the moment there are some robustness issues with the model. In the default configuration Test03_Turbine have issues with convergence at time t=0.34 with the message

+

Homotopy solver Newton iteration: Maximum number of iterations reached at time 0.340000, but no root found.

+

The following documents testing and investigations to resolve this.

+

In particular it is important to understand some of the following topics

+ +

and how different implementations may impact the robustness of the models.

Some observations:

+
    +
  • Turbine model with only upstream and downstream reservoir and constant opening works fine (Test02).
  • +
  • Turbine model with upstream and downstream reservoir and ramping opening works fine (Test04).
  • +
  • Turbine model with rigid water pipe and constant opening works shows clear convergence issues (Test03).
  • +
+


Additional comments:


In general convergence issues can either be related to "stiff" problems or singularities or discontinuous functions (or gradients). Running Test03 with the DASSL solver, with startTime=0 and stopTime=1 and varying time step gives the following result.

+ + + + + + + + + + + + + + + + + + + + + + + + + + + + +

Time step

Comments

0.005

Convergence issues from t=0.26500 (nonlinear system 82)

0.01

Convergence issues from t=0.34000

0.02

Convergence issues from t=0.34000

0.05

Convergence issues from t=0.683162

0.10

Convergence issues from t=0.683162

0.20

Convergence issues from t=0.683162

+



Normally, for stiff problems, reducing the time step should improve the convergence. This seems not to be the case here.

+")); +end Information; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo index 2821e300..45cc9d0f 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo @@ -1,28 +1,31 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; - model Test01_Turbine extends Modelica.Icons.Example; inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - parameter Modelica.Units.SI.Height Hn=100; - + Placement(transformation(origin={-80,80}, extent = {{-10, -10}, {10, 10}}))); + parameter SI.Height Hn=100; + parameter Real opening=0.2; + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( - Placement(transformation(origin = {-46, 28}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin={-50,10}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0 ) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin={50,-10}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18, enable_f = true, f_0 = 0) annotation ( + Placement(transformation( extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 0) annotation( - Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin={-30,80}, extent = {{-10, -10}, {10, 10}}))); equation connect(overvann.o, turbine.i) annotation( - Line(points = {{-36, 28}, {-20, 28}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + Line(points={{-40,10},{-18,10},{-18,0},{-10,0}}, color = {0, 128, 255})); connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + Line(points={{10,0},{34,0},{34,-10},{40,-10}}, color = {0, 128, 255})); connect(ramp.y, turbine.u_t) annotation( - Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); + Line(points={{-19,80},{-8,80},{-8,12}}, color = {0, 0, 127})); annotation ( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + Documentation(info=" +

Basic test of EpiricalTurbine model. Opening is kept constant.

+

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

+"), experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); end Test01_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo index a980ebfd..4ca842a6 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test02_Turbine.mo @@ -1,8 +1,11 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test02_Turbine -extends Test01_Turbine(Hn=300, turbin(p=14)); +extends Test01_Turbine(Hn=300, turbine(p=14)); annotation ( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + Documentation(info=" +

Basic test of EpiricalTurbine model. Opening is kept constant.

+

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

+"), experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); end Test02_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo index b5e2a69f..d46ce322 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test03_Turbine.mo @@ -1,7 +1,10 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test03_Turbine - extends Test01_Turbine(Hn=600, turbin(p=8)); + extends Test01_Turbine(Hn=600, turbine(p=8)); annotation ( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + Documentation(info=" +

Basic test of EpiricalTurbine model. Opening is kept constant.

+

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

+"), experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); end Test03_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo index 94e70992..a9a6ee05 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test04_Turbine.mo @@ -1,27 +1,8 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test04_Turbine - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - parameter Modelica.Units.SI.Height Hn=600; - parameter Real opening=0.2; - // - OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( - Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0, useH = false, J = 2e3 ) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = opening) annotation( - Placement(transformation(origin = {-18, 68}, extent = {{-10, -10}, {10, 10}}))); -equation - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(overvann.o, turbine.i) annotation( - Line(points = {{-72, 12}, {2, 12}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{-6, 68}, {4, 68}, {4, 24}}, color = {0, 0, 127})); - annotation( - experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001), - Icon(graphics = {Text(extent = {{-150, 90}, {150, -90}}, textString = "%name")})); + extends Modelica.Icons.Example; + extends Test01_Turbine( + Hn=600, + turbine(J=2e3), + ramp(offset=opening, startTime=1e6)); end Test04_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index a132d625..1db6ab51 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -1,27 +1,8 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test05_Turbine - extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - parameter Modelica.Units.SI.Height Hn=600; - parameter Real opening=0.2; - // - OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( - Placement(transformation(origin = {-82, 12}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0.0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = false, enable_f = true, f_0 = 0, useH = false, J = 2e3 ) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Constant const(k = opening) annotation( - Placement(transformation(origin = {-18, 68}, extent = {{-10, -10}, {10, 10}}))); -equation - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(overvann.o, turbine.i) annotation( - Line(points = {{-72, 12}, {2, 12}}, color = {0, 128, 255})); - connect(const.y, turbine.u_t) annotation( - Line(points = {{-6, 68}, {4, 68}, {4, 24}}, color = {0, 0, 127})); - annotation( - experiment(StartTime = 0, StopTime = 25, Tolerance = 1e-06, Interval = 0.001), - Icon(graphics = {Text(extent = {{-150, 90}, {150, -90}}, textString = "%name")})); + extends Modelica.Icons.Example; + extends Test01_Turbine( + Hn=600, + turbine(J=2e3), + ramp(offset=opening, startTime=1e6)); end Test05_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo index cc368b30..9aa13391 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo @@ -2,27 +2,28 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test06_Turbine extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation ( + inner OpenHPL.Data data(SteadyState=false, Vdot_0=2) + annotation ( Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); parameter Modelica.Units.SI.Height Hn=500; Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; - + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false ) annotation ( + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false) annotation ( Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 5) annotation( Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167, SteadyState = false, Vdot_0 = 2.0) annotation( + OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167) annotation( Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); - OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000, SteadyState = false, Vdot_0 = 2.0) annotation( + OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000) annotation( Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); @@ -46,7 +47,10 @@ equation connect(ramp.y, turb2.u_t) annotation( Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); annotation ( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), + Documentation(info=" +

Basic test of EpiricalTurbine model. Opening is kept constant.

+

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

+"), experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo index 1aa3a449..2843106c 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo @@ -1,53 +1,5 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; - model Test07_Turbine -extends Modelica.Icons.Example; - inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - parameter Modelica.Units.SI.Height Hn=500; - Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; - Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; - - OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( - Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false ) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = 1, duration = 10, offset = 0, startTime = 5) annotation( - Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167, SteadyState = true) annotation( - Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( - Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( - Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); - OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000, SteadyState = true) annotation( - Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( - Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); -equation - Ht1 = turbine.dp/(data.rho*data.g); - Ht2 = turb2.dp/(data.rho*data.g); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation( - Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, pipe.i) annotation( - Line(points = {{-70, 26}, {-60, 26}, {-60, 18}, {-48, 18}}, color = {0, 128, 255})); - connect(pipe.o, turbine.i) annotation( - Line(points = {{-28, 18}, {-20, 18}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(ov2.o, pipe2.i) annotation( - Line(points = {{-70, -30}, {-46, -30}}, color = {0, 128, 255})); - connect(turb2.o, uv2.o) annotation( - Line(points = {{14, -42}, {26, -42}, {26, -74}, {60, -74}}, color = {0, 128, 255})); - connect(pipe2.o, turb2.i) annotation( - Line(points = {{-26, -30}, {-22, -30}, {-22, -42}, {-6, -42}}, color = {0, 128, 255})); - connect(ramp.y, turb2.u_t) annotation( - Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); - annotation ( - Documentation(info = "Basic test of EpiricalTurbine model. Opening is kept constant.
Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

"), - experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); - + extends Test06_Turbine(data(SteadyState=true, Vdot_0=0), ramp(height=1, offset=0)); end Test07_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo index fbe9b6a9..654ba1ce 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo @@ -4,23 +4,23 @@ model Test_All extends Modelica.Icons.Example; // Test_Turbine_Charactersistics T1(Hn=25) annotation( - Placement(transformation(origin = {-60, 90}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,80}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T2(Hn=50) annotation( - Placement(transformation(origin = {-60, 70}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,60}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T3(Hn=75) annotation( - Placement(transformation(origin = {-60, 50}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,40}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T4(Hn=100) annotation( - Placement(transformation(origin = {-60, 30}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,20}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T5(Hn=200) annotation( - Placement(transformation(origin = {-60, 10}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,0}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T6(Hn=300) annotation( - Placement(transformation(origin = {-60, -10}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,-20}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T7(Hn=400) annotation( - Placement(transformation(origin = {-60, -30}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,-40}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T8(Hn=500) annotation( - Placement(transformation(origin = {-60, -50}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,-60}, extent = {{-20, -20}, {20, 20}}))); Test_Turbine_Charactersistics T9(Hn=600) annotation( - Placement(transformation(origin = {-60, -70}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,-80}, extent = {{-20, -20}, {20, 20}}))); equation // annotation( diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo index b8084618..8849b149 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -24,7 +24,7 @@ model Test_Turbine_Charactersistics Placement(transformation(origin = {48, 8}, extent = {{-10, -10}, {10, 10}}))); Test05_Turbine t10(opening=1.0,Hn=Hn) annotation( Placement(transformation(origin = {-58, -28}, extent = {{-10, -10}, {10, 10}}))); - + equation annotation( diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order index a49187f6..18936558 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -1,9 +1,9 @@ +Test01_Turbine Test02_Turbine Test03_Turbine Test04_Turbine Test05_Turbine -Test01_Turbine -Test_Turbine_Charactersistics Test06_Turbine Test07_Turbine +Test_Turbine_Charactersistics Test_All From 7b245798eb1e70c46c554f3c8c4ab69cda2c5d28 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Fri, 17 Jul 2026 13:11:28 +0200 Subject: [PATCH 34/37] Fix HTML tags --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 61f7a095..318c44e6 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -38,8 +38,8 @@ equation annotation (Documentation(info="

Simplified empirical turbine model for single-regulated reaction turbine (Francis and propeller turbine). The turbine is specified by giving the nominal head H_n and nominal power P_n. All remaining values are determined from empirical relations. The throttling effect of high head Francis turbines is included in the model. However, the exact characteristics should be treated with caution and will need more empirical tuning in future releases. In particular the speed rise and runaway curve is not fully validated.

-

Figure 1: Example of throttling effect for a high head Francis unit. Discharge as function of speed [pu].

+

Figure 1: Example of throttling effect for a high head Francis unit. Discharge as function of speed [pu].

-

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristics. Discharge as function of speed [pu].

+

Figure 2: Variation of turbine characteristics as function of head of the turbine characteristics. Discharge as function of speed [pu].

")); end EmpiricalTurbine; From 0732d7960e91566feca86b12a09eddb7e39ac571 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Thu, 13 Aug 2026 12:26:06 +0200 Subject: [PATCH 35/37] Removing duplicate test model and rearranging the rest. --- .../TurbineTest/Test05_Turbine.mo | 58 +++++++++++++++++-- .../TurbineTest/Test06_Turbine.mo | 54 +---------------- .../TurbineTest/Test07_Turbine.mo | 5 -- .../Test_Turbine_Charactersistics.mo | 20 +++---- .../TurbineTest/package.order | 1 - 5 files changed, 64 insertions(+), 74 deletions(-) delete mode 100644 OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index 1db6ab51..db37db32 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -1,8 +1,56 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; + model Test05_Turbine - extends Modelica.Icons.Example; - extends Test01_Turbine( - Hn=600, - turbine(J=2e3), - ramp(offset=opening, startTime=1e6)); + extends Modelica.Icons.Example; + inner OpenHPL.Data data(SteadyState=false, Vdot_0=2) + annotation ( + Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); + parameter Modelica.Units.SI.Height Hn=500; + Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; + Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; + + OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( + Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( + Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); + OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false) annotation ( + Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); + Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 5) annotation( + Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167) annotation( + Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( + Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( + Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); + OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000) annotation( + Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( + Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); +equation + Ht1 = turbine.dp/(data.rho*data.g); + Ht2 = turb2.dp/(data.rho*data.g); + connect(turbine.o, undervann.o) annotation( + Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); + connect(ramp.y, turbine.u_t) annotation( + Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); + connect(overvann.o, pipe.i) annotation( + Line(points = {{-70, 26}, {-60, 26}, {-60, 18}, {-48, 18}}, color = {0, 128, 255})); + connect(pipe.o, turbine.i) annotation( + Line(points = {{-28, 18}, {-20, 18}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); + connect(ov2.o, pipe2.i) annotation( + Line(points = {{-70, -30}, {-46, -30}}, color = {0, 128, 255})); + connect(turb2.o, uv2.o) annotation( + Line(points = {{14, -42}, {26, -42}, {26, -74}, {60, -74}}, color = {0, 128, 255})); + connect(pipe2.o, turb2.i) annotation( + Line(points = {{-26, -30}, {-22, -30}, {-22, -42}, {-6, -42}}, color = {0, 128, 255})); + connect(ramp.y, turb2.u_t) annotation( + Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); + annotation ( + Documentation(info=" +

Basic test of EpiricalTurbine model. Opening is kept constant.

+

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

+"), + experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); + end Test05_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo index 9aa13391..17decb01 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test06_Turbine.mo @@ -1,57 +1,5 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; - model Test06_Turbine - extends Modelica.Icons.Example; - inner OpenHPL.Data data(SteadyState=false, Vdot_0=2) - annotation ( - Placement(transformation(origin = {-84, 82}, extent = {{-10, -10}, {10, 10}}))); - parameter Modelica.Units.SI.Height Hn=500; - Modelica.Units.SI.Height Ht1 "Turbine1 pressure head"; - Modelica.Units.SI.Height Ht2 "Turbine2 pressure head"; - - OpenHPL.Waterway.Reservoir overvann(h_0 = Hn, constantLevel = true) annotation ( - Placement(transformation(origin = {-80, 26}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir undervann(h_0 = 0, constantLevel = true) annotation ( - Placement(transformation(origin = {72, -16}, extent = {{10, -10}, {-10, 10}}, rotation = -0))); - OpenHPL.ElectroMech.Turbines.EmpiricalTurbine turbine( H_n = Hn, P_n = 1e7, p = 18,enable_nomSpeed = true, enable_f = true, f_0 = 1, fixed_iniSpeed = false) annotation ( - Placement(transformation(origin = {12, 12}, extent = {{-10, -10}, {10, 10}}))); - Modelica.Blocks.Sources.Ramp ramp(height = -1, duration = 10, offset = 1, startTime = 5) annotation( - Placement(transformation(origin = {-26, 76}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Pipe pipe(H = 0, L = 1000, D_i = 1.128379167) annotation( - Placement(transformation(origin = {-38, 18}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir ov2(constantLevel = true, h_0 = Hn) annotation( - Placement(transformation(origin = {-80, -30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.Waterway.Reservoir uv2(constantLevel = true, h_0 = 0) annotation( - Placement(transformation(origin = {70, -74}, extent = {{10, -10}, {-10, 10}}))); - OpenHPL.Waterway.Pipe pipe2(D_i = 1.128379167, H = 0, L = 1000) annotation( - Placement(transformation(origin = {-36, -30}, extent = {{-10, -10}, {10, 10}}))); - OpenHPL.ElectroMech.Turbines.Turbine turb2(ValveCapacity = false, H_n = Hn, Vdot_n = 2.15, f_0 = 1, enable_nomSpeed = true, enable_f = true) annotation( - Placement(transformation(origin = {4, -42}, extent = {{-10, -10}, {10, 10}}))); -equation - Ht1 = turbine.dp/(data.rho*data.g); - Ht2 = turb2.dp/(data.rho*data.g); - connect(turbine.o, undervann.o) annotation( - Line(points = {{22, 12}, {28, 12}, {28, -16}, {62, -16}}, color = {0, 128, 255})); - connect(ramp.y, turbine.u_t) annotation( - Line(points = {{-14, 76}, {4, 76}, {4, 24}}, color = {0, 0, 127})); - connect(overvann.o, pipe.i) annotation( - Line(points = {{-70, 26}, {-60, 26}, {-60, 18}, {-48, 18}}, color = {0, 128, 255})); - connect(pipe.o, turbine.i) annotation( - Line(points = {{-28, 18}, {-20, 18}, {-20, 12}, {2, 12}}, color = {0, 128, 255})); - connect(ov2.o, pipe2.i) annotation( - Line(points = {{-70, -30}, {-46, -30}}, color = {0, 128, 255})); - connect(turb2.o, uv2.o) annotation( - Line(points = {{14, -42}, {26, -42}, {26, -74}, {60, -74}}, color = {0, 128, 255})); - connect(pipe2.o, turb2.i) annotation( - Line(points = {{-26, -30}, {-22, -30}, {-22, -42}, {-6, -42}}, color = {0, 128, 255})); - connect(ramp.y, turb2.u_t) annotation( - Line(points = {{-14, 76}, {-12, 76}, {-12, -14}, {-4, -14}, {-4, -30}}, color = {0, 0, 127})); - annotation ( - Documentation(info=" -

Basic test of EpiricalTurbine model. Opening is kept constant.

-

Initial speed f_0 is set to 0.2 and the turbine is permitted to speed up as function of computed turbine torque Tt.

-"), - experiment(StartTime = 0, StopTime = 30, Tolerance = 1e-06, Interval = 0.001)); - + extends Test05_Turbine(data(SteadyState=true, Vdot_0=0), ramp(height=1, offset=0)); end Test06_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo deleted file mode 100644 index 2843106c..00000000 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test07_Turbine.mo +++ /dev/null @@ -1,5 +0,0 @@ -within OpenHPLTest.EmpiricalTurbine.TurbineTest; -model Test07_Turbine - extends Test06_Turbine(data(SteadyState=true, Vdot_0=0), ramp(height=1, offset=0)); - -end Test07_Turbine; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo index 8849b149..980a89e8 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_Turbine_Charactersistics.mo @@ -4,25 +4,25 @@ model Test_Turbine_Charactersistics extends Modelica.Icons.Example; // parameter Modelica.Units.SI.Height Hn=300; - Test05_Turbine t01(opening=0.1,Hn=Hn) annotation( + Test04_Turbine t01(opening=0.1,Hn=Hn) annotation( Placement(transformation(origin = {-60, 82}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t02(opening=0.2,Hn=Hn) annotation( + Test04_Turbine t02(opening=0.2,Hn=Hn) annotation( Placement(transformation(origin = {-2, 82}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t03(opening=0.3,Hn=Hn) annotation( + Test04_Turbine t03(opening=0.3,Hn=Hn) annotation( Placement(transformation(origin = {46, 84}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t04(opening=0.4,Hn=Hn) annotation( + Test04_Turbine t04(opening=0.4,Hn=Hn) annotation( Placement(transformation(origin = {-56, 50}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t05(opening=0.5,Hn=Hn) annotation( + Test04_Turbine t05(opening=0.5,Hn=Hn) annotation( Placement(transformation(origin = {-2, 46}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t06(opening=0.6,Hn=Hn) annotation( + Test04_Turbine t06(opening=0.6,Hn=Hn) annotation( Placement(transformation(origin = {50, 50}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t07(opening=0.7,Hn=Hn) annotation( + Test04_Turbine t07(opening=0.7,Hn=Hn) annotation( Placement(transformation(origin = {-60, 10}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t08(opening=0.8,Hn=Hn) annotation( + Test04_Turbine t08(opening=0.8,Hn=Hn) annotation( Placement(transformation(origin = {-8, 6}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t09(opening=0.9,Hn=Hn) annotation( + Test04_Turbine t09(opening=0.9,Hn=Hn) annotation( Placement(transformation(origin = {48, 8}, extent = {{-10, -10}, {10, 10}}))); - Test05_Turbine t10(opening=1.0,Hn=Hn) annotation( + Test04_Turbine t10(opening=1.0,Hn=Hn) annotation( Placement(transformation(origin = {-58, -28}, extent = {{-10, -10}, {10, 10}}))); equation diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order index 18936558..86bc57bb 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.order @@ -4,6 +4,5 @@ Test03_Turbine Test04_Turbine Test05_Turbine Test06_Turbine -Test07_Turbine Test_Turbine_Charactersistics Test_All From 2b25e8c20cdc772418238d350d10687c1fea3d2c Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Thu, 13 Aug 2026 12:31:03 +0200 Subject: [PATCH 36/37] Removing superfluous test package The TorqueEquation is already used in the examples. --- OpenHPLTest/TorqueEquation/TorqueElement.mo | 7 ------- OpenHPLTest/TorqueEquation/TorqueTest.mo | 23 --------------------- OpenHPLTest/TorqueEquation/package.mo | 8 ------- OpenHPLTest/TorqueEquation/package.order | 2 -- OpenHPLTest/package.order | 1 - 5 files changed, 41 deletions(-) delete mode 100644 OpenHPLTest/TorqueEquation/TorqueElement.mo delete mode 100644 OpenHPLTest/TorqueEquation/TorqueTest.mo delete mode 100644 OpenHPLTest/TorqueEquation/package.mo delete mode 100644 OpenHPLTest/TorqueEquation/package.order diff --git a/OpenHPLTest/TorqueEquation/TorqueElement.mo b/OpenHPLTest/TorqueEquation/TorqueElement.mo deleted file mode 100644 index 5b247266..00000000 --- a/OpenHPLTest/TorqueEquation/TorqueElement.mo +++ /dev/null @@ -1,7 +0,0 @@ -within OpenHPLTest.TorqueEquation; -model TorqueElement - extends OpenHPL.Icons.ElectroMech; - extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; -equation - -end TorqueElement; diff --git a/OpenHPLTest/TorqueEquation/TorqueTest.mo b/OpenHPLTest/TorqueEquation/TorqueTest.mo deleted file mode 100644 index b364afb2..00000000 --- a/OpenHPLTest/TorqueEquation/TorqueTest.mo +++ /dev/null @@ -1,23 +0,0 @@ -within OpenHPLTest.TorqueEquation; -model TorqueTest - extends Modelica.Icons.Example; - // - parameter SI.Torque shaftTorque0 = 1.e+03; - SI.Torque shaftTorque; - inner OpenHPL.Data data annotation ( - Placement(transformation(origin = {-52, 74}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te1(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 10) annotation ( - Placement(transformation(origin = {-30, 52}, extent = {{-10, -10}, {10, 10}}))); - TorqueElement te2(J = 10, f_0 = 0, torque(y = shaftTorque), enable_f = true, p = 22) annotation ( - Placement(transformation(origin = {-30, 24}, extent = {{-10, -10}, {10, 10}}))); -equation - if (time > 0.1 and time < 0.4) then - shaftTorque = shaftTorque0; - elseif (time > 0.5 and time < 0.8) then - shaftTorque = -shaftTorque0; - else - shaftTorque = 0.0; - end if; -annotation ( - Diagram(coordinateSystem(extent = {{-80, 80}, {-20, 0}}))); -end TorqueTest; diff --git a/OpenHPLTest/TorqueEquation/package.mo b/OpenHPLTest/TorqueEquation/package.mo deleted file mode 100644 index d6edd2d7..00000000 --- a/OpenHPLTest/TorqueEquation/package.mo +++ /dev/null @@ -1,8 +0,0 @@ -within OpenHPLTest; -package TorqueEquation - extends Modelica.Icons.ExamplesPackage; - import Modelica.Units.SI; - // - - -end TorqueEquation; diff --git a/OpenHPLTest/TorqueEquation/package.order b/OpenHPLTest/TorqueEquation/package.order deleted file mode 100644 index cad0b912..00000000 --- a/OpenHPLTest/TorqueEquation/package.order +++ /dev/null @@ -1,2 +0,0 @@ -TorqueElement -TorqueTest diff --git a/OpenHPLTest/package.order b/OpenHPLTest/package.order index 24d43dbb..6672a675 100644 --- a/OpenHPLTest/package.order +++ b/OpenHPLTest/package.order @@ -1,4 +1,3 @@ EmpiricalTurbine TestPipe -TorqueEquation Archive From 1057c1cb4d815c37be5bc1023dc4313420aa81b4 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Thu, 13 Aug 2026 13:26:41 +0200 Subject: [PATCH 37/37] Adding description to constants --- OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index 318c44e6..a6eb0c09 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -22,8 +22,8 @@ model EmpiricalTurbine parameter SI.Frequency nrps_n=2*data.f_grid/p "Nominal turbine speed [rps]"; SI.Frequency nrps=speedSensor.w/(2*C.pi) "Rotational speed (in revolutions per seconds)"; parameter Real Ct =Vdot_n/sqrt(H_n*data.g*data.rho) "Nominal turbine discharge coefficient"; - constant Real alpha=1.5; - constant Real beta=3.5; + constant Real alpha=1.5 "Empirical exponent for the guide-vane opening/discharge characteristic"; + constant Real beta=3.5 "Empirical exponent for the normalized speed/discharge characteristic"; constant Real tau_1=0.1 "First parameter in empirical torque equation"; constant Real epsilon = 5.0e-5 "Constant to ensure robust expression for dp vs flow. Trial and error to find suitable value.";