From 6387f1503b8edd62664411892c0e47cf8ecb2474 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Mon, 24 Aug 2026 12:57:25 +0200 Subject: [PATCH 1/4] Unit fixes. --- OpenHPL/ElectroMech/PowerSystem/Grid.mo | 2 +- OpenHPL/Examples/OpenChannel.mo | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/OpenHPL/ElectroMech/PowerSystem/Grid.mo b/OpenHPL/ElectroMech/PowerSystem/Grid.mo index 210c57df..7ab5891c 100644 --- a/OpenHPL/ElectroMech/PowerSystem/Grid.mo +++ b/OpenHPL/ElectroMech/PowerSystem/Grid.mo @@ -5,7 +5,7 @@ model Grid "Model of a mechanical grid equivalent" parameter SI.Power Pgrid=1000000000 "Active power capacity of the grid" annotation (Dialog(group="Electrical")); parameter Boolean useLambda=false "If checked, specify Lambda, otherwise the droop Rgrid is used" annotation (choices(checkBox = true), Dialog(group="Electrical")); - parameter Types.Lambda Lambda=Pgrid/(Rgrid*data.f_0) "Network Power-Frequency Characteristic (bias factor)" + parameter Types.Lambda Lambda=Pgrid/(Rgrid*data.f_0*data.f_grid) "Network Power-Frequency Characteristic (bias factor)" annotation (Dialog(group="Electrical",enable=useLambda)); parameter SI.PerUnit Rgrid=0.1 "Equivalent droop setting of the grid" annotation (Dialog(group="Electrical",enable=not useLambda)); diff --git a/OpenHPL/Examples/OpenChannel.mo b/OpenHPL/Examples/OpenChannel.mo index aabcd596..c088dccd 100644 --- a/OpenHPL/Examples/OpenChannel.mo +++ b/OpenHPL/Examples/OpenChannel.mo @@ -1,5 +1,4 @@ within OpenHPL.Examples; - model OpenChannel "Model of a hydropower system with open channel model" extends Modelica.Icons.Example; Waterway.Reservoir reservoir(h_0 = 5, fixElevation = true, z_0 = 10) annotation( @@ -8,7 +7,7 @@ model OpenChannel "Model of a hydropower system with open channel model" Placement(transformation(extent = {{-40, -10}, {-20, 10}}))); Waterway.Reservoir tail(h_0 = 5) annotation( Placement(transformation(origin = {70, 0}, extent = {{-10, 10}, {10, -10}}, rotation = 180))); - inner Data data(SteadyState = false, Vdot_0 = 0, f_0(displayUnit = "Hz")) annotation( + inner Data data(SteadyState = false, Vdot_0 = 0) annotation( Placement(transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}))); Waterway.OpenChannel openChannel(H = 2, useSections = true, N = 10) annotation( Placement(transformation(extent = {{-10, -10}, {10, 10}}))); From 30964db1b51f1805e254b1ed214d8d9ca5cc4520 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Wed, 5 Aug 2026 12:31:23 +0200 Subject: [PATCH 2/4] Add v4.0.0 release notes and conversion script --- .../ConvertOpenHPL_from_3.0.x_to_4.0.0.mos | 48 +++++++++++++++++++ OpenHPL/UsersGuide/ReleaseNotes/package.order | 1 + OpenHPL/UsersGuide/ReleaseNotes/v400.mo | 38 +++++++++++++++ OpenHPL/package.mo | 5 +- OpenHPLTest/package.mo | 2 +- 5 files changed, 91 insertions(+), 3 deletions(-) create mode 100644 OpenHPL/Resources/Scripts/ConvertOpenHPL_from_3.0.x_to_4.0.0.mos create mode 100644 OpenHPL/UsersGuide/ReleaseNotes/v400.mo diff --git a/OpenHPL/Resources/Scripts/ConvertOpenHPL_from_3.0.x_to_4.0.0.mos b/OpenHPL/Resources/Scripts/ConvertOpenHPL_from_3.0.x_to_4.0.0.mos new file mode 100644 index 00000000..cdabe1c5 --- /dev/null +++ b/OpenHPL/Resources/Scripts/ConvertOpenHPL_from_3.0.x_to_4.0.0.mos @@ -0,0 +1,48 @@ +// OpenHPL library conversion script +// Intended use: referenced by OpenHPL.package conversion annotation. +// Scope: deterministic class-path migrations from v3.0.x to v4.0.0. + +convertClass("OpenHPL.Examples.WithOpenIPSL.DetailedGenFrancis", "OpenHPL.Examples.WithOpenIPSL.DetailedGen"); +convertClass("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancis", "OpenHPL.Examples.WithOpenIPSL.SimpleGen"); +convertClass("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancisTG", "OpenHPL.Examples.WithOpenIPSL.SimpleGenTG"); + +convertClass("OpenHPL.Waterway.RunOff_zones", "OpenHPL.Waterway.RunOff"); +convertClass("OpenHPL.Waterway.RunOff_zones_input", "OpenHPL.Waterway.RunOff"); + +// Modifier conversions for class migrations. +// The old class name is used in convertModifiers according to Modelica conversion rules. +convertModifiers("OpenHPL.Examples.WithOpenIPSL.DetailedGenFrancis", + {"vertical=true"}, + {"slanted=true"}); +convertModifiers("OpenHPL.Examples.WithOpenIPSL.DetailedGenFrancis", + {"vertical=false"}, + {"slanted=false"}); + +convertModifiers("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancis", + {"vertical=true"}, + {"slanted=true"}); +convertModifiers("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancis", + {"vertical=false"}, + {"slanted=false"}); + +convertModifiers("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancisTG", + {"vertical=true"}, + {"slanted=true"}); +convertModifiers("OpenHPL.Examples.WithOpenIPSL.SimpleGenFrancisTG", + {"vertical=false"}, + {"slanted=false"}); + +convertModifiers("OpenHPL.Waterway.RunOff_zones_input", + {"precC=0.6e-3/86400"}, + {"PERC=%precC%"}); +convertModifiers("OpenHPL.Waterway.RunOff_zones_input", + {"precC"}, + {"PERC=%precC%"}); + +// Messages for semantic changes that are not safely auto-convertible: +// - Data.f_0 changed from SI.Frequency (Hz) to per-unit speed. +// - Connector elevation propagation is now required for models extending TwoContacts. +convertMessage("OpenHPL.Data", + "OpenHPL conversion note: parameter f_0 semantics changed from Hz to per-unit. Review old assignments and convert as f_0 = f_Hz / f_grid."); +convertMessage("OpenHPL.Interfaces.TwoContacts", + "OpenHPL conversion note: connector elevation support was introduced. Custom models extending TwoContacts must provide an elevation relation, e.g., o.elevation.z = i.elevation.z - H."); diff --git a/OpenHPL/UsersGuide/ReleaseNotes/package.order b/OpenHPL/UsersGuide/ReleaseNotes/package.order index 4df6edd0..26178da5 100644 --- a/OpenHPL/UsersGuide/ReleaseNotes/package.order +++ b/OpenHPL/UsersGuide/ReleaseNotes/package.order @@ -1,3 +1,4 @@ +v400 v301 v300 v201 diff --git a/OpenHPL/UsersGuide/ReleaseNotes/v400.mo b/OpenHPL/UsersGuide/ReleaseNotes/v400.mo new file mode 100644 index 00000000..d65383ce --- /dev/null +++ b/OpenHPL/UsersGuide/ReleaseNotes/v400.mo @@ -0,0 +1,38 @@ +within OpenHPL.UsersGuide.ReleaseNotes; +class v400 "Version 4.0.0 (2026-08-24)" + extends Modelica.Icons.ReleaseNotes; + annotation (Documentation(info=" +

What's Changed

+

This new version of OpenHPL is a non-backwards compatible release based on the Modelica Standard Library version 4.0.0 which contains a series of improvements and bug fixes.

+

This releases is non-backwards compatible with earlier versions of OpenHPL. This means it contains changes to the names of classes, parameters, variables, connectors, and more. A conversion-script is provided that takes care of some of the changes but not all. Users will have to check their existing models that were based on older versions of OpenHPL.

+

💥 BREAKING CHANGES

+ +

🚀 Features

+ +

🐛 Bug Fixes

+ +
Full Changelog
+

v3.0.1...v4.0.0

+")); +end v400; diff --git a/OpenHPL/package.mo b/OpenHPL/package.mo index 0976986b..ebe4f03e 100644 --- a/OpenHPL/package.mo +++ b/OpenHPL/package.mo @@ -4,8 +4,9 @@ package OpenHPL "Open-source hydropower library" import Modelica.Units.SI; annotation ( - version="3.x.x-dev", - versionDate="2026-xx-xx", + version="4.0.0", + versionDate="2026-08-24", + conversion(from(version={"3.0.0","3.0.1"}, script="modelica://OpenHPL/Resources/Scripts/ConvertOpenHPL_from_3.0.x_to_4.0.0.mos")), Protection(access = Access.packageDuplicate), uses(OpenIPSL(version="3.0.0"), Modelica(version="4.0.0")), preferredView="info", diff --git a/OpenHPLTest/package.mo b/OpenHPLTest/package.mo index e9099d6e..a98d994b 100644 --- a/OpenHPLTest/package.mo +++ b/OpenHPLTest/package.mo @@ -6,6 +6,6 @@ package OpenHPLTest "Test library for OpenHPL" annotation (uses( Modelica(version="4.0.0"), - OpenHPL(version="3.0.0"), + OpenHPL(version="4.0.0"), OpenIPSL(version="3.0.0"))); end OpenHPLTest; From ec9bd3d50f5d3906520a173b2360347d6ebffb78 Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Mon, 24 Aug 2026 12:45:31 +0200 Subject: [PATCH 3/4] Fixing white space with ttws --- OpenHPL/Data.mo | 2 +- .../ElectroMech/Turbines/EmpiricalTurbine.mo | 4 ++-- OpenHPL/ElectroMech/Turbines/Turbine.mo | 2 +- OpenHPL/Examples/BranchingPipes.mo | 4 ++-- OpenHPL/Examples/DetailedTurbine.mo | 2 +- OpenHPL/Examples/Gate.mo | 2 +- OpenHPL/Examples/OpenChannel.mo | 2 +- OpenHPL/Examples/Pipes.mo | 2 +- OpenHPL/Examples/SimpleGen.mo | 2 +- OpenHPL/Examples/SimpleGenFrancis.mo | 4 ++-- OpenHPL/Examples/SimpleTurbine.mo | 2 +- OpenHPL/Examples/SimpleValve.mo | 2 +- OpenHPL/Examples/SimpleValveWithCreek.mo | 24 +++++++++---------- OpenHPL/Examples/VolumeFlowSource.mo | 6 ++--- OpenHPL/Examples/WithOpenIPSL/DetailedGen.mo | 2 +- OpenHPL/Examples/WithOpenIPSL/SimpleGen.mo | 10 ++++---- OpenHPL/Examples/WithOpenIPSL/SimpleGenTG.mo | 6 ++--- OpenHPL/Icons/Reservoir.mo | 2 +- OpenHPL/Icons/Surge.mo | 2 +- OpenHPL/Interfaces/Contact.mo | 2 +- OpenHPL/Interfaces/package.mo | 2 +- OpenHPL/UsersGuide/ReleaseNotes/v201.mo | 2 +- OpenHPL/UsersGuide/ReleaseNotes/v301.mo | 2 +- OpenHPL/Waterway/DraftTube.mo | 2 +- OpenHPL/Waterway/Gate_HR.mo | 2 +- OpenHPL/Waterway/PenstockKP.mo | 2 +- OpenHPL/Waterway/Pipe.mo | 10 ++++---- OpenHPL/Waterway/Reservoir.mo | 2 +- OpenHPL/Waterway/SurgeTank.mo | 8 +++---- OpenHPL/Waterway/VolumeFlowSource.mo | 4 ++-- OpenHPLTest/Archive/HPSimplePenstockPelton.mo | 6 ++--- .../Test02_ControlPoints.mo | 7 +++--- .../Test03_DistanceFunction.mo | 6 ++--- .../TurbineTest/Test01_Turbine.mo | 20 ++++++++-------- .../TurbineTest/Test05_Turbine.mo | 10 ++++---- .../EmpiricalTurbine/TurbineTest/Test_All.mo | 18 +++++++------- .../EmpiricalTurbine/TurbineTest/package.mo | 6 +---- OpenHPLTest/EmpiricalTurbine/package.mo | 2 -- OpenHPLTest/TestPipe/Test03.mo | 4 ++-- OpenHPLTest/TestPipe/package.mo | 4 ---- 40 files changed, 95 insertions(+), 108 deletions(-) diff --git a/OpenHPL/Data.mo b/OpenHPL/Data.mo index e04ede01..d82dbc15 100644 --- a/OpenHPL/Data.mo +++ b/OpenHPL/Data.mo @@ -38,7 +38,7 @@ record Data "Provides a data set of most common used settings" annotation (Dialog(group = "Waterway properties")); parameter SI.Compressibility beta_total = 1 / (rho*1000^2) "Total compressibility" annotation (Dialog(group = "Waterway properties")); - parameter SI.Frequency f_grid=50 "Grid frequency" annotation (Dialog(group = "System properties")); + parameter SI.Frequency f_grid=50 "Grid frequency" annotation (Dialog(group = "System properties")); parameter Boolean SteadyState=false "If checked, simulation starts in steady state" annotation (choices(checkBox = true), Dialog(group="Initialization")); parameter SI.VolumeFlowRate Vdot_0 = 0 "Initial volume flow rate through the system" diff --git a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo index b83905a6..c96d93f2 100644 --- a/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo +++ b/OpenHPL/ElectroMech/Turbines/EmpiricalTurbine.mo @@ -1,14 +1,14 @@ 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")=1000000 "Nominal power" annotation (Dialog(group = "Nominal values")); + parameter SI.Power P_n(displayUnit="MW")=1000000 "Nominal power" annotation (Dialog(group = "Nominal values")); extends OpenHPL.ElectroMech.BaseClasses.TorqueEquation; extends OpenHPL.Interfaces.TurbineContacts; extends Interfaces.TwoContacts; extends OpenHPL.Icons.Turbine; SI.VolumeFlowRate Vdot "Turbine flow rate"; - Modelica.Blocks.Sources.RealExpression turbineTorque(y=Tt) "Connection between compute hydraulic torque and driving torque in class TorqueEquation" annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); + Modelica.Blocks.Sources.RealExpression turbineTorque(y=Tt) "Connection between compute hydraulic torque and driving torque in class TorqueEquation" annotation (Placement(transformation(extent={{-70,-10},{-50,10}}))); Modelica.Blocks.Sources.RealExpression turbinePower(y=Tt*speedSensor.w) annotation (Placement(transformation(extent={{-50,20},{-80,40}}))); Modelica.Blocks.Math.Feedback lossCorrection annotation (Placement(transformation(extent={{-50,70},{-30,90}}))); diff --git a/OpenHPL/ElectroMech/Turbines/Turbine.mo b/OpenHPL/ElectroMech/Turbines/Turbine.mo index d7c56911..a3ea3658 100644 --- a/OpenHPL/ElectroMech/Turbines/Turbine.mo +++ b/OpenHPL/ElectroMech/Turbines/Turbine.mo @@ -92,7 +92,7 @@ in the Efficiency data group:

  • Constant efficiency (ConstEfficiency = true, default): The hydraulic efficiency is fixed at the value given by eta_h - (default 0.9). This is suitable for quick studies where a single + (default 0.9). This is suitable for quick studies where a single representative efficiency value is sufficient.
  • Variable efficiency table (ConstEfficiency = false): Efficiency varies with guide-vane opening according to a lookup table stored diff --git a/OpenHPL/Examples/BranchingPipes.mo b/OpenHPL/Examples/BranchingPipes.mo index e2672e00..dfcf5d5f 100644 --- a/OpenHPL/Examples/BranchingPipes.mo +++ b/OpenHPL/Examples/BranchingPipes.mo @@ -1,7 +1,7 @@ within OpenHPL.Examples; model BranchingPipes "Model of branching pipes" extends Modelica.Icons.Example; - Waterway.Reservoir reservoir(fixElevation = true, z_0 = 3) annotation ( + Waterway.Reservoir reservoir(fixElevation = true, z_0 = 3) annotation ( Placement(transformation(extent = {{-80, -10}, {-60, 10}}))); Waterway.Pipe mainPipe(D_i = 6, H = 1, L = 100) annotation ( Placement(transformation(extent = {{-52, -10}, {-32, 10}}))); @@ -30,4 +30,4 @@ equation Line(points = {{50, 0}, {60, 0}}, color = {0, 128, 255})); annotation ( experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4)); -end BranchingPipes; \ No newline at end of file +end BranchingPipes; diff --git a/OpenHPL/Examples/DetailedTurbine.mo b/OpenHPL/Examples/DetailedTurbine.mo index 101dce93..ad1c30bc 100644 --- a/OpenHPL/Examples/DetailedTurbine.mo +++ b/OpenHPL/Examples/DetailedTurbine.mo @@ -3,4 +3,4 @@ model DetailedTurbine "Hydropower system using KP scheme based penstock" extends SimpleTurbine( redeclare Waterway.PenstockKP penstock); annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2)); -end DetailedTurbine; \ No newline at end of file +end DetailedTurbine; diff --git a/OpenHPL/Examples/Gate.mo b/OpenHPL/Examples/Gate.mo index 0ff45bbd..ead53672 100644 --- a/OpenHPL/Examples/Gate.mo +++ b/OpenHPL/Examples/Gate.mo @@ -91,4 +91,4 @@ equation connect(upstream2.level, up_level.y) annotation (Line(points={{-42,-44},{-52,-44},{-52,0},{-59,0}}, color={0,0,127})); annotation ( experiment(StopTime=2000, Interval=0.4)); -end Gate; \ No newline at end of file +end Gate; diff --git a/OpenHPL/Examples/OpenChannel.mo b/OpenHPL/Examples/OpenChannel.mo index c088dccd..3800264a 100644 --- a/OpenHPL/Examples/OpenChannel.mo +++ b/OpenHPL/Examples/OpenChannel.mo @@ -24,4 +24,4 @@ equation Line(points = {{40, 0}, {60, 0}}, color = {0, 128, 255})); annotation( experiment(StopTime = 10000)); -end OpenChannel; \ No newline at end of file +end OpenChannel; diff --git a/OpenHPL/Examples/Pipes.mo b/OpenHPL/Examples/Pipes.mo index 4d35ef0d..127a7f43 100644 --- a/OpenHPL/Examples/Pipes.mo +++ b/OpenHPL/Examples/Pipes.mo @@ -36,4 +36,4 @@ equation connect(pipeContracting.o, Downstream.o) annotation (Line(points={{10,-20},{30,-20},{30,0},{40,0}}, color={0,128,255})); annotation ( experiment(StartTime = 0, StopTime = 100, Tolerance = 1e-06, Interval = 0.02)); -end Pipes; \ No newline at end of file +end Pipes; diff --git a/OpenHPL/Examples/SimpleGen.mo b/OpenHPL/Examples/SimpleGen.mo index 69a33d94..28508086 100644 --- a/OpenHPL/Examples/SimpleGen.mo +++ b/OpenHPL/Examples/SimpleGen.mo @@ -11,4 +11,4 @@ equation points={{30,60},{30,10}}, color={0,0,0})); annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2)); -end SimpleGen; \ No newline at end of file +end SimpleGen; diff --git a/OpenHPL/Examples/SimpleGenFrancis.mo b/OpenHPL/Examples/SimpleGenFrancis.mo index cb702a5c..243913b2 100644 --- a/OpenHPL/Examples/SimpleGenFrancis.mo +++ b/OpenHPL/Examples/SimpleGenFrancis.mo @@ -57,7 +57,7 @@ model SimpleGenFrancis "Model of a hydropower system with Francis turbine model" annotation (Placement(transformation( origin={30,0}, extent={{-10,-10},{10,10}}))); - inner OpenHPL.Data data(SteadyState = false) annotation (Placement(transformation( + inner OpenHPL.Data data(SteadyState = false) annotation (Placement(transformation( origin={-90,90}, extent={{-10,-10},{10,10}}))); Waterway.Fitting fitting( @@ -87,4 +87,4 @@ equation connect(penstock.o, fitting.i) annotation ( Line(points={{-20,0},{-12,0}}, color = {28, 108, 200})); annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2)); -end SimpleGenFrancis; \ No newline at end of file +end SimpleGenFrancis; diff --git a/OpenHPL/Examples/SimpleTurbine.mo b/OpenHPL/Examples/SimpleTurbine.mo index 78e47bb1..3c86528c 100644 --- a/OpenHPL/Examples/SimpleTurbine.mo +++ b/OpenHPL/Examples/SimpleTurbine.mo @@ -46,4 +46,4 @@ equation connect(surgeTank.o, penstock.i) annotation (Line(points={{-20,30},{-10,30}}, color={28,108,200})); connect(discharge.o, tail.o) annotation (Line(points={{70,0},{80,0}}, color={28,108,200})); annotation (experiment(StopTime = 1000, StartTime = 0, Tolerance = 1e-06, Interval = 2)); -end SimpleTurbine; \ No newline at end of file +end SimpleTurbine; diff --git a/OpenHPL/Examples/SimpleValve.mo b/OpenHPL/Examples/SimpleValve.mo index 6dffa1ab..6fdd883e 100644 --- a/OpenHPL/Examples/SimpleValve.mo +++ b/OpenHPL/Examples/SimpleValve.mo @@ -52,4 +52,4 @@ Simple model of a water way with only a valve component. This can be used to investigate the effect of different opening and closing times in the waterway.

    ")); -end SimpleValve; \ No newline at end of file +end SimpleValve; diff --git a/OpenHPL/Examples/SimpleValveWithCreek.mo b/OpenHPL/Examples/SimpleValveWithCreek.mo index 5582e888..967cc163 100644 --- a/OpenHPL/Examples/SimpleValveWithCreek.mo +++ b/OpenHPL/Examples/SimpleValveWithCreek.mo @@ -5,24 +5,24 @@ model SimpleValveWithCreek Waterway.Reservoir reservoir(h_0 = 10, constantLevel = false, fixElevation = true, z_0 = 110) annotation( Placement(transformation(origin = {-90, 30}, extent = {{-10, -10}, {10, 10}}))); Modelica.Blocks.Sources.Ramp control(duration = 30, height = 0.5, offset = 0, startTime = 500e6) annotation( - Placement(transformation(origin={-10,0}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin={-10,0}, extent = {{-10, -10}, {10, 10}}))); Waterway.Pipe tunnel1(H = 10, D_i = 5) annotation( Placement(transformation(extent = {{-70, 20}, {-50, 40}}))); Waterway.Pipe discharge(H = 0.5, L = 600, D_i = 5) annotation( - Placement(transformation(origin={0,-50}, extent = {{50, 20}, {70, 40}}))); + Placement(transformation(origin={0,-50}, extent = {{50, 20}, {70, 40}}))); Waterway.Reservoir tail(h_0 = 5) annotation( Placement(transformation(origin = {90, -20}, extent = {{-10, 10}, {10, -10}}, rotation = 180))); replaceable Waterway.Pipe penstock(D_i = 3, D_o = 3, H = 80, L = 200, slanted = true) constrainedby Interfaces.TwoContacts annotation( - Placement(transformation(origin={60,30}, extent = {{-10, -10}, {10, 10}}))); + Placement(transformation(origin={60,30}, extent = {{-10, -10}, {10, 10}}))); Waterway.SurgeTank creekIntake(H = 25, L = 30, h_0 = 20) annotation( Placement(transformation(origin = {-30, 30}, extent = {{-10, -10}, {10, 10}}))); inner Data data(Vdot_0 = 0) annotation( Placement(transformation(origin = {-90, 90}, extent = {{-10, -10}, {10, 10}}))); Waterway.Valve valve(ValveCapacity = false, C_v = 1) annotation( - Placement(transformation(origin={0,-50}, extent = {{20, 20}, {40, 40}}))); + Placement(transformation(origin={0,-50}, extent = {{20, 20}, {40, 40}}))); OpenHPL.Waterway.Pipe tunnel2(D_i = 5, H = 10) annotation( - Placement(transformation(origin={58,0}, extent = {{-70, 20}, {-50, 40}}))); + Placement(transformation(origin={58,0}, extent = {{-70, 20}, {-50, 40}}))); OpenHPL.Waterway.SurgeTank surgeTank(H = 35, L = 40, h_0 = 30) annotation( Placement(transformation(origin = {30, 30}, extent = {{-10, -10}, {10, 10}}))); Waterway.VolumeFlowSource volumeFlowSource annotation( @@ -33,19 +33,19 @@ equation connect(tunnel1.o, creekIntake.i) annotation( Line(points = {{-50, 30}, {-40, 30}}, color = {28, 108, 200})); connect(valve.o, discharge.i) annotation( - Line(points={{40,-20},{50,-20}}, color = {0, 128, 255})); + Line(points={{40,-20},{50,-20}}, color = {0, 128, 255})); connect(control.y, valve.opening) annotation( - Line(points={{1,0},{30,0},{30,-12}}, color = {0, 0, 127})); + Line(points={{1,0},{30,0},{30,-12}}, color = {0, 0, 127})); connect(creekIntake.o, tunnel2.i) annotation( - Line(points={{-20,30},{-12,30}}, color = {0, 128, 255})); + Line(points={{-20,30},{-12,30}}, color = {0, 128, 255})); connect(tunnel2.o, surgeTank.i) annotation( - Line(points={{8,30},{20,30}}, color = {0, 128, 255})); + Line(points={{8,30},{20,30}}, color = {0, 128, 255})); connect(surgeTank.o, penstock.i) annotation( - Line(points={{40,30},{50,30}}, color = {0, 128, 255})); + Line(points={{40,30},{50,30}}, color = {0, 128, 255})); connect(volumeFlowSource.o, creekIntake.creek) annotation( Line(points = {{-42, 60}, {-30, 60}, {-30, 40}}, color = {0, 128, 255})); connect(discharge.o, tail.o) annotation( - Line(points={{70,-20},{80,-20}}, color = {0, 128, 255})); + Line(points={{70,-20},{80,-20}}, color = {0, 128, 255})); connect(penstock.o, valve.i) annotation (Line(points={{70,30},{80,30},{80,10}, {8,10},{8,-20},{20,-20}}, color={0,128,255})); annotation( @@ -56,4 +56,4 @@ Simple model of a water way with one creek intake. This can be used to investigate the effects of a creek intake.

    ")); -end SimpleValveWithCreek; \ No newline at end of file +end SimpleValveWithCreek; diff --git a/OpenHPL/Examples/VolumeFlowSource.mo b/OpenHPL/Examples/VolumeFlowSource.mo index 141c03bd..5fc6e620 100644 --- a/OpenHPL/Examples/VolumeFlowSource.mo +++ b/OpenHPL/Examples/VolumeFlowSource.mo @@ -2,8 +2,8 @@ within OpenHPL.Examples; model VolumeFlowSource "Example demonstrating the use of VolumeFlowSource" extends Modelica.Icons.Example; OpenHPL.Waterway.Reservoir tail1 annotation (Placement(transformation(extent={{60,30},{40,50}}))); - inner OpenHPL.Data data(SteadyState = true) annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); - OpenHPL.Waterway.VolumeFlowSource volumeFlowConstant(fixElevation = true) annotation (Placement(transformation(extent={{-50,30},{-30,50}}))); + inner OpenHPL.Data data(SteadyState = true) annotation (Placement(transformation(extent={{-100,80},{-80,100}}))); + OpenHPL.Waterway.VolumeFlowSource volumeFlowConstant(fixElevation = true) annotation (Placement(transformation(extent={{-50,30},{-30,50}}))); Waterway.Pipe pipe1(H=0, useInitialFlow=false) annotation (Placement(transformation(extent={{-10,30},{10,50}}))); Waterway.Pipe pipe2(H=0, useInitialFlow=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}}))); OpenHPL.Waterway.Reservoir tail2 annotation (Placement(transformation(extent={{60,-10},{40,10}}))); @@ -28,4 +28,4 @@ equation color={0,128,255})); connect(volumeFlowFiltered.outFlow, logdata.y[1]) annotation (Line(points={{-50,-40},{-59,-40}}, color={0,0,127})); annotation (experiment(StopTime=120)); -end VolumeFlowSource; \ No newline at end of file +end VolumeFlowSource; diff --git a/OpenHPL/Examples/WithOpenIPSL/DetailedGen.mo b/OpenHPL/Examples/WithOpenIPSL/DetailedGen.mo index c5becfe3..6f682173 100644 --- a/OpenHPL/Examples/WithOpenIPSL/DetailedGen.mo +++ b/OpenHPL/Examples/WithOpenIPSL/DetailedGen.mo @@ -1,6 +1,6 @@ within OpenHPL.Examples.WithOpenIPSL; model DetailedGen - extends SimpleGen( redeclare Waterway.PenstockKP penstock( + extends SimpleGen( redeclare Waterway.PenstockKP penstock( slanted=true, H=428.5, D_i=3), data(SteadyState=false)); diff --git a/OpenHPL/Examples/WithOpenIPSL/SimpleGen.mo b/OpenHPL/Examples/WithOpenIPSL/SimpleGen.mo index 71b5ed5e..44dbfc2b 100644 --- a/OpenHPL/Examples/WithOpenIPSL/SimpleGen.mo +++ b/OpenHPL/Examples/WithOpenIPSL/SimpleGen.mo @@ -4,7 +4,7 @@ model SimpleGen "Synergy with OpenIPSL library(generator)" extends OpenIPSL.Tests.BaseClasses.MachineTestBase(pwLine2(displayPF=true), pwLine1(displayPF=true)); OpenHPL.Waterway.Reservoir reservoir(h_0=48, fixElevation=true, - z_0=500) annotation (Placement(transformation( + z_0=500) annotation (Placement(transformation( origin={-80,-80}, extent={{-10,-10},{10,10}}))); OpenHPL.Waterway.Pipe intake(H=23, D_i=3) @@ -26,7 +26,7 @@ model SimpleGen "Synergy with OpenIPSL library(generator)" OpenHPL.Waterway.SurgeTank surgeTank(h_0=70.939) annotation (Placement(transformation( origin={-30,-80}, extent={{-10,-10},{10,10}}))); - ElectroMech.Turbines.Turbine turbine( + ElectroMech.Turbines.Turbine turbine( H_n=460, Vdot_n=24.3, Pmax(displayUnit="MW") = 125000000, @@ -48,8 +48,8 @@ model SimpleGen "Synergy with OpenIPSL library(generator)" ra=0.001, w(fixed=true), x1d=0.302) annotation (Placement(transformation(extent={{-40,-10},{-20,10}}))); - OpenHPL.Controllers.Governor governor(Pn=103, Y_gv_ref = 0.1) - annotation (Placement(transformation(origin={0,-40}, extent = {{-10, -10}, {10, 10}}))); + OpenHPL.Controllers.Governor governor(Pn=103, Y_gv_ref = 0.1) + annotation (Placement(transformation(origin={0,-40}, extent = {{-10, -10}, {10, 10}}))); //(a = 7.862E-25, c = 1.108E-08, d = -5.344E-02, b = -1.010E-16) Modelica.Blocks.Math.Gain fpu_to_fSI(k=SysData.fn) annotation (Placement(transformation( origin={-60,-52}, @@ -65,7 +65,7 @@ equation connect(governor.Y_gv, turbine.u_t) annotation ( Line(points={{11,-40},{24,-40},{24,-68}}, color = {0, 0, 127})); connect(governor.P_ref, power.y) annotation ( - Line(points={{-12,-36},{-27.2,-36}}, color = {0, 0, 127})); + Line(points={{-12,-36},{-27.2,-36}}, color = {0, 0, 127})); connect(generator.vf, generator.vf0) annotation (Line(points={{-42,5},{-46,5},{-46,14},{-38,14},{-38,11}}, color={0,0,127})); connect(generator.p, bus1.p) annotation (Line(points={{-20,0},{0,0}}, color={0,0,255})); connect(discharge.o, tail.o) annotation (Line(points={{68,-80},{74,-80}}, color={28,108,200})); diff --git a/OpenHPL/Examples/WithOpenIPSL/SimpleGenTG.mo b/OpenHPL/Examples/WithOpenIPSL/SimpleGenTG.mo index 1cd21157..1cce62c5 100644 --- a/OpenHPL/Examples/WithOpenIPSL/SimpleGenTG.mo +++ b/OpenHPL/Examples/WithOpenIPSL/SimpleGenTG.mo @@ -4,12 +4,12 @@ model SimpleGenTG "Synergy with OpenIPSL library(generator)" extends OpenIPSL.Tests.BaseClasses.MachineTestBase(pwLine2(displayPF=true), pwLine1(displayPF=true)); OpenHPL.Waterway.Reservoir reservoir(h_0=48, fixElevation=true, - z_0=500) annotation (Placement(transformation( + z_0=500) annotation (Placement(transformation( origin={-80,-80}, extent={{-10,-10},{10,10}}))); OpenHPL.Waterway.Pipe intake(H=23, D_i=3, - useInitialFlow=false) annotation (Placement(transformation(extent={{-66,-90},{-46,-70}}))); + useInitialFlow=false) annotation (Placement(transformation(extent={{-66,-90},{-46,-70}}))); OpenHPL.Waterway.Pipe discharge(L=600, H=0.5) annotation (Placement(transformation(extent={{48,-90},{68,-70}}))); OpenHPL.Waterway.Reservoir tail(h_0=5) annotation (Placement(transformation( origin={84,-80}, @@ -27,7 +27,7 @@ model SimpleGenTG "Synergy with OpenIPSL library(generator)" OpenHPL.Waterway.SurgeTank surgeTank(h_0=70.939) annotation (Placement(transformation( origin={-30,-80}, extent={{-10,-10},{10,10}}))); - ElectroMech.Turbines.Turbine turbine( + ElectroMech.Turbines.Turbine turbine( H_n=460, Vdot_n=24.3, Pmax(displayUnit="MW") = 125000000, diff --git a/OpenHPL/Icons/Reservoir.mo b/OpenHPL/Icons/Reservoir.mo index 80e0dd5d..95f42606 100644 --- a/OpenHPL/Icons/Reservoir.mo +++ b/OpenHPL/Icons/Reservoir.mo @@ -32,4 +32,4 @@ partial class Reservoir "Reservoir icon" extent = {{-100, 20}, {100, -20}}, textString = DynamicSelect("(level)", "("+String(h_abs_ds, format=".1f") + ")"), textStyle = {TextStyle.Italic})})); -end Reservoir; \ No newline at end of file +end Reservoir; diff --git a/OpenHPL/Icons/Surge.mo b/OpenHPL/Icons/Surge.mo index 4751c3e1..330befdb 100644 --- a/OpenHPL/Icons/Surge.mo +++ b/OpenHPL/Icons/Surge.mo @@ -82,4 +82,4 @@ partial class Surge "Surge tank/shaft icon" } ) ); -end Surge; \ No newline at end of file +end Surge; diff --git a/OpenHPL/Interfaces/Contact.mo b/OpenHPL/Interfaces/Contact.mo index ba9bdf0c..621ae580 100644 --- a/OpenHPL/Interfaces/Contact.mo +++ b/OpenHPL/Interfaces/Contact.mo @@ -28,4 +28,4 @@ arbitrary topologies including parallel pipes and loops.
  • textColor = {0, 85, 255}, extent = {{-100, 100}, {100, -100}}, textString = DynamicSelect("", if showElevation then String(elevation.z) else ""))})); -end Contact; \ No newline at end of file +end Contact; diff --git a/OpenHPL/Interfaces/package.mo b/OpenHPL/Interfaces/package.mo index 48cf0099..26185930 100644 --- a/OpenHPL/Interfaces/package.mo +++ b/OpenHPL/Interfaces/package.mo @@ -50,7 +50,7 @@ input and output connectors, additionally. This model is used for turbine modell
     partial model TurbineContacts \"Model of turbine connectors\"
       extends TwoContacts;
    -  input Modelica.Blocks.Interfaces.RealInput u_t  \"[Guide vane|nozzle] opening of the turbine\" ;
    +  input Modelica.Blocks.Interfaces.RealInput u_t \"[Guide vane|nozzle] opening of the turbine\" ;
       Modelica.Blocks.Interfaces.RealOutput P_out \"Mechanical Output power\" ;
     end TurbineContacts;
     
    diff --git a/OpenHPL/UsersGuide/ReleaseNotes/v201.mo b/OpenHPL/UsersGuide/ReleaseNotes/v201.mo index a5d50053..e6a9975c 100644 --- a/OpenHPL/UsersGuide/ReleaseNotes/v201.mo +++ b/OpenHPL/UsersGuide/ReleaseNotes/v201.mo @@ -5,7 +5,7 @@ class v201 "Version 2.0.1 (2023-03-10)"

    What's Changed

    This version of OpenHPL is -backwards compatible with +backwards compatible with Version 2.0.0 which contains a series of bug fixes specifically aimed to make it more compliant with the OpenModelica tool. diff --git a/OpenHPL/UsersGuide/ReleaseNotes/v301.mo b/OpenHPL/UsersGuide/ReleaseNotes/v301.mo index 1e31df91..c1a45504 100644 --- a/OpenHPL/UsersGuide/ReleaseNotes/v301.mo +++ b/OpenHPL/UsersGuide/ReleaseNotes/v301.mo @@ -5,7 +5,7 @@ class v301 "Version 3.0.1 (2026-02-05)"

    What's Changed

    This version of OpenHPL is -backwards compatible with +backwards compatible with Version 3.0.0 which contains a series of bug fixes to help with initialisation.

    diff --git a/OpenHPL/Waterway/DraftTube.mo b/OpenHPL/Waterway/DraftTube.mo index 3243350f..97f0d442 100644 --- a/OpenHPL/Waterway/DraftTube.mo +++ b/OpenHPL/Waterway/DraftTube.mo @@ -2,7 +2,7 @@ within OpenHPL.Waterway; model DraftTube "Model of a draft tube for reaction turbines" outer Data data "Using standard data set"; extends OpenHPL.Icons.DraftTube; - extends Types.FrictionSpec( final D_h = 0.5 * (D_i + D_o)); + extends Types.FrictionSpec( final D_h = 0.5 * (D_i + D_o)); import Modelica.Constants.pi; parameter Types.DraftTube DraftTubeType = OpenHPL.Types.DraftTube.ConicalDiffuser "Types of draft tube" annotation ( Dialog(group = "Draft tube types")); diff --git a/OpenHPL/Waterway/Gate_HR.mo b/OpenHPL/Waterway/Gate_HR.mo index cbdab038..f3b323c0 100644 --- a/OpenHPL/Waterway/Gate_HR.mo +++ b/OpenHPL/Waterway/Gate_HR.mo @@ -38,7 +38,7 @@ equation mdot = i.mdot "Inlet direction for mdot"; Vdot_free = sqrt(2*data.g)* W * T^TE * B^BE * h_i^HE "Free flow condition"; Vdot_partial = sqrt(2*data.g)* W * T^TE * B^BE * (3*(h_i-h_o))^HE "Partially submerged"; - Vdot_full = sqrt(2*data.g*(h_i-h_o))* W * B "Fully submerged"; + Vdot_full = sqrt(2*data.g*(h_i-h_o))* W * B "Fully submerged"; Cdx = Cd * Vdot_partial/Vdot_full; if H_ratio <= 0.67 then Vdot=Cd * Vdot_free "Free flow condition"; diff --git a/OpenHPL/Waterway/PenstockKP.mo b/OpenHPL/Waterway/PenstockKP.mo index 93243ce6..3d463961 100644 --- a/OpenHPL/Waterway/PenstockKP.mo +++ b/OpenHPL/Waterway/PenstockKP.mo @@ -2,7 +2,7 @@ within OpenHPL.Waterway; model PenstockKP "Detailed model of the pipe. Could have elastic walls and compressible water. KP scheme" outer OpenHPL.Data data "Using standard data set"; extends OpenHPL.Icons.Pipe( slanted=true); - extends Types.FrictionSpec( final D_h = (D_i + D_o) / 2); + extends Types.FrictionSpec( final D_h = (D_i + D_o) / 2); import Modelica.Constants.pi; // geometrical parameters of the pipe parameter SI.Height H = 420 "Height difference from the inlet to the outlet of the pipe" annotation ( diff --git a/OpenHPL/Waterway/Pipe.mo b/OpenHPL/Waterway/Pipe.mo index 0541e561..26008938 100644 --- a/OpenHPL/Waterway/Pipe.mo +++ b/OpenHPL/Waterway/Pipe.mo @@ -3,7 +3,7 @@ model Pipe "Model of a pipe" outer Data data "Using standard data set"; extends OpenHPL.Icons.Pipe; extends OpenHPL.Interfaces.TwoContacts; - extends Types.FrictionSpec( final D_h = (D_i + D_o) / 2); + extends Types.FrictionSpec( final D_h = (D_i + D_o) / 2); // Geometrical parameters of the pipe: parameter SI.Length H = 0 "Height difference from the inlet to the outlet" annotation ( @@ -30,9 +30,9 @@ model Pipe "Model of a pipe" SI.VolumeFlowRate Vdot "Volume flow rate"; protected - parameter SI.Diameter D_ = ( D_i + D_o) / 2 "Average diameter"; - - parameter SI.Area A_ = D_ ^ 2 * C.pi / 4 "Average cross-sectional area"; + parameter SI.Diameter D_ = ( D_i + D_o) / 2 "Average diameter"; + + parameter SI.Area A_ = D_ ^ 2 * C.pi / 4 "Average cross-sectional area"; parameter Real delta=2*(D_i-D_o)/(D_i+D_o) "Contraction factor"; parameter Real cf=1+2*delta^2 "Conical pipe function"; parameter Real cos_theta = H / L "Slope ratio"; @@ -47,7 +47,7 @@ initial equation end if; end if; algorithm - assert( phi < 1.0, "Change in pipe diameter is too large. (angle= "+String(phi)+" )",AssertionLevel.warning); + assert( phi < 1.0, "Change in pipe diameter is too large. (angle= "+String(phi)+" )",AssertionLevel.warning); equation Vdot = mdot / data.rho "Volumetric flow rate through the pipe"; diff --git a/OpenHPL/Waterway/Reservoir.mo b/OpenHPL/Waterway/Reservoir.mo index 0b3b92ec..2d49f5fa 100644 --- a/OpenHPL/Waterway/Reservoir.mo +++ b/OpenHPL/Waterway/Reservoir.mo @@ -127,4 +127,4 @@ the mass and momentum balances are:

    patm and po are atmospheric and outlet pressures, and Ff,r is the friction term (typically small for large reservoirs).

    ")); -end Reservoir; \ No newline at end of file +end Reservoir; diff --git a/OpenHPL/Waterway/SurgeTank.mo b/OpenHPL/Waterway/SurgeTank.mo index daacf04a..5c3cc3be 100644 --- a/OpenHPL/Waterway/SurgeTank.mo +++ b/OpenHPL/Waterway/SurgeTank.mo @@ -3,7 +3,7 @@ model SurgeTank "Model of the surge tank/shaft" outer Data data "Using standard data set"; extends OpenHPL.Icons.Surge(h_ds=h, H_ds=H, h_abs_ds=h_abs, show=data.showElevation); extends OpenHPL.Interfaces.TwoContacts; - extends Types.FrictionSpec( final D_h = D); + extends Types.FrictionSpec( final D_h = D); parameter Types.SurgeTank SurgeTankType = OpenHPL.Types.SurgeTank.STSimple "Types of surge tank" annotation (Dialog(group = "Surge tank types")); @@ -13,10 +13,9 @@ model SurgeTank "Model of the surge tank/shaft" annotation (Dialog(group = "Geometry")); parameter SI.Diameter D = 3 "Diameter of the surge shaft" annotation (Dialog(group = "Geometry")); - parameter SI.Position H_creek=H "Position of the creek intake above the surge tank base" + parameter SI.Position H_creek=H "Position of the creek intake above the surge tank base" annotation (Dialog(group = "Geometry")); - parameter SI.Diameter D_so = D "If Sharp orifice type: Diameter of sharp orifice" annotation ( Dialog(group = "Geometry",enable=SurgeTankType == OpenHPL.Types.SurgeTank.STSharpOrifice)); parameter SI.Diameter D_t = D "If Throttle value type: Diameter of throat" annotation ( @@ -31,7 +30,7 @@ model SurgeTank "Model of the surge tank/shaft" Dialog(group = "Initialization")); parameter SI.Pressure p_ac = 4*data.p_a "Initial pressure of air-cushion inside the surge tank" annotation ( Dialog(group = "Initialization",enable=SurgeTankType == OpenHPL.Types.SurgeTank.STAirCushion)); - parameter SI.Temperature T_ac(displayUnit="degC")=298.15 "Initial air-cushion temperature" + parameter SI.Temperature T_ac(displayUnit="degC")=298.15 "Initial air-cushion temperature" annotation (Dialog(group = "Initialization", enable=SurgeTankType == OpenHPL.Types.SurgeTank.STAirCushion)); SI.Mass m "Water mass"; @@ -163,7 +162,6 @@ connecting the conduit, surge volume, and penstock. Four different surge tank co

    -
    Mass and Momentum Balances

    All surge tank types are modeled using mass and momentum balance equations:

    diff --git a/OpenHPL/Waterway/VolumeFlowSource.mo b/OpenHPL/Waterway/VolumeFlowSource.mo index e1e8f100..7314627f 100644 --- a/OpenHPL/Waterway/VolumeFlowSource.mo +++ b/OpenHPL/Waterway/VolumeFlowSource.mo @@ -15,7 +15,7 @@ model VolumeFlowSource "Volume flow source (either fixed or variable)" annotation (Dialog(group="Geometry"), choices(checkBox=true)); parameter SI.Position z_0=0 "Elevation of the outlet connection" annotation (Dialog(group="Geometry", enable=fixElevation)); - Interfaces.Contact_o o(showElevation = data.showElevation) "Outlet flow connector" + Interfaces.Contact_o o(showElevation = data.showElevation) "Outlet flow connector" annotation (Placement(transformation(extent={{90,-10},{110,10}}))); Modelica.Blocks.Interfaces.RealInput outFlow if useInput "Conditional input for defining the outlet flow [m3/s]" annotation (Placement(transformation(extent={{-140,-20},{-100,20}}))); @@ -71,4 +71,4 @@ or via the input connector inFlow. In addition the input can be passed through a first order filter which is sometimes necessary for numerical reasons depending on the nature of the input data stream. ")); -end VolumeFlowSource; \ No newline at end of file +end VolumeFlowSource; diff --git a/OpenHPLTest/Archive/HPSimplePenstockPelton.mo b/OpenHPLTest/Archive/HPSimplePenstockPelton.mo index 59a1c995..7d685dcf 100644 --- a/OpenHPLTest/Archive/HPSimplePenstockPelton.mo +++ b/OpenHPLTest/Archive/HPSimplePenstockPelton.mo @@ -32,9 +32,9 @@ model HPSimplePenstockPelton "HP system model with Pelton turbine" OpenHPL.ElectroMech.Generators.SynchGen unit(np=5) annotation (Placement(transformation(extent={{0,-4},{20,16}}))); equation connect(unit.P_in, turbine.P_out) annotation ( - Line(points={{10,18},{10,45},{14,45}}, color = {0, 0, 127})); + Line(points={{10,18},{10,45},{14,45}}, color = {0, 0, 127})); connect(unit.w_out, turbine.w_in) annotation ( - Line(points={{21,12},{21,20},{-2,20},{-2,26}}, color = {0, 0, 127})); + Line(points={{21,12},{21,20},{-2,20},{-2,26}}, color = {0, 0, 127})); connect(reservoir.n, intake.p) annotation ( Line(points={{-82,62},{-77.95,62},{-77.95,60},{-72,60}}, color = {28, 108, 200})); connect(intake.n, surgeTank.p) annotation ( @@ -48,7 +48,7 @@ equation connect(turbine.n, discharge.p) annotation ( Line(points={{20,34},{20,34},{30,34}}, color = {28, 108, 200})); connect(control.y, turbine.u_t) annotation ( - Line(points={{1,84},{2,84},{2,46}}, color = {0, 0, 127})); + Line(points={{1,84},{2,84},{2,46}}, color = {0, 0, 127})); annotation ( experiment(StopTime = 2000, StartTime = 0, Tolerance = 0.0001, Interval = 0.4)); end HPSimplePenstockPelton; diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo index c3b70c29..4570ddbd 100644 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test02_ControlPoints.mo @@ -9,8 +9,7 @@ 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.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; @@ -26,8 +25,8 @@ protected public Real cPoints1[NP, ND], cPoints2[NP, ND], cPoints3[NP, ND]; Real[ND] curvePoint1; - Real[ND] curvePoint2; - Real[ND] curvePoint3; + Real[ND] curvePoint2; + Real[ND] curvePoint3; equation cPoints1 = OpenHPL.Functions.WeightedControlPoints(0.20, tc); curvePoint1 = OpenHPL.Functions.deCasteljau(time, ND, cPoints1); diff --git a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo index 7bcf75ae..c31b4088 100644 --- a/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo +++ b/OpenHPLTest/EmpiricalTurbine/TestBasicFunctions/Test03_DistanceFunction.mo @@ -9,11 +9,11 @@ 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.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 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; @@ -21,7 +21,7 @@ protected 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; diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo index 45cc9d0f..e4dcb229 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test01_Turbine.mo @@ -2,25 +2,25 @@ within OpenHPLTest.EmpiricalTurbine.TurbineTest; model Test01_Turbine extends Modelica.Icons.Example; inner OpenHPL.Data data annotation ( - Placement(transformation(origin={-80,80}, extent = {{-10, -10}, {10, 10}}))); + 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={-50,10}, 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={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={-30,80}, 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={-30,80}, extent = {{-10, -10}, {10, 10}}))); equation connect(overvann.o, turbine.i) annotation( - Line(points={{-40,10},{-18,10},{-18,0},{-10,0}}, 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={{10,0},{34,0},{34,-10},{40,-10}}, 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={{-19,80},{-8,80},{-8,12}}, 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.

    diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo index db37db32..c12d0ab1 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test05_Turbine.mo @@ -13,19 +13,19 @@ model Test05_Turbine 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( + 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( + 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( + 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( + 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); diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/Test_All.mo index 654ba1ce..55d08c07 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,80}, 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,60}, 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,40}, 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,20}, 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,0}, 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,-20}, 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,-40}, 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,-60}, 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,-80}, extent = {{-20, -20}, {20, 20}}))); + Placement(transformation(origin={-60,-80}, extent = {{-20, -20}, {20, 20}}))); equation // annotation( diff --git a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo index d8210d6b..49b3c8a3 100644 --- a/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo +++ b/OpenHPLTest/EmpiricalTurbine/TurbineTest/package.mo @@ -1,16 +1,12 @@ within OpenHPLTest.EmpiricalTurbine; package TurbineTest extends Modelica.Icons.ExamplesPackage; - import Modelica.Units.SI; - - + import Modelica.Units.SI; // - // - // // diff --git a/OpenHPLTest/EmpiricalTurbine/package.mo b/OpenHPLTest/EmpiricalTurbine/package.mo index c186e192..807a134c 100644 --- a/OpenHPLTest/EmpiricalTurbine/package.mo +++ b/OpenHPLTest/EmpiricalTurbine/package.mo @@ -2,6 +2,4 @@ within OpenHPLTest; package EmpiricalTurbine extends Modelica.Icons.ExamplesPackage; - - end EmpiricalTurbine; diff --git a/OpenHPLTest/TestPipe/Test03.mo b/OpenHPLTest/TestPipe/Test03.mo index cd4bb21f..2f3ccddd 100644 --- a/OpenHPLTest/TestPipe/Test03.mo +++ b/OpenHPLTest/TestPipe/Test03.mo @@ -7,13 +7,13 @@ model Test03 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 ( + 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 ( + 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}}))); diff --git a/OpenHPLTest/TestPipe/package.mo b/OpenHPLTest/TestPipe/package.mo index 36e1c480..c5ee70f0 100644 --- a/OpenHPLTest/TestPipe/package.mo +++ b/OpenHPLTest/TestPipe/package.mo @@ -2,8 +2,4 @@ within OpenHPLTest; package TestPipe extends Modelica.Icons.ExamplesPackage; - - - - end TestPipe; From fa16ce6225091e939f1d2bd069a4c9765c68010f Mon Sep 17 00:00:00 2001 From: Dietmar Winkler Date: Mon, 24 Aug 2026 13:04:25 +0200 Subject: [PATCH 4/4] Fix annotation. --- OpenHPL/Waterway/ReservoirChannel.mo | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/OpenHPL/Waterway/ReservoirChannel.mo b/OpenHPL/Waterway/ReservoirChannel.mo index 06564597..74d479c4 100644 --- a/OpenHPL/Waterway/ReservoirChannel.mo +++ b/OpenHPL/Waterway/ReservoirChannel.mo @@ -43,8 +43,8 @@ equation o.elevation.z = 0 "Default elevation if this becomes root"; end if; end if; - annotation ( - Documentation(preferredView="info", info=" + annotation (preferredView="info", + Documentation( info="

    Reservoir Channel Model

    A more detailed reservoir model based on the open channel model, where the channel bed is assumed to be flat (no slope).