Skip to content

Commit 6e65837

Browse files
committed
Add documentation and change name.
1 parent ec1a1e0 commit 6e65837

2 files changed

Lines changed: 12 additions & 5 deletions

File tree

OpenHPL/Examples/VolumeFlowSource.mo

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ model VolumeFlowSource "Example demonstrating the use of VolumeFlowSource"
44
OpenHPL.Waterway.Reservoir tail1 annotation (Placement(transformation(extent={{60,30},{40,50}})));
55
inner OpenHPL.Data data(SteadyState = true) annotation (Placement(transformation(extent={{-100,80},{-80,100}})));
66
OpenHPL.Waterway.VolumeFlowSource volumeFlowConstant(fixElevation = true) annotation (Placement(transformation(extent={{-50,30},{-30,50}})));
7-
Waterway.Pipe pipe1(H=0, useInitialEquation=false) annotation (Placement(transformation(extent={{-10,30},{10,50}})));
8-
Waterway.Pipe pipe2(H=0, useInitialEquation=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
7+
Waterway.Pipe pipe1(H=0, useInitialFlow=false) annotation (Placement(transformation(extent={{-10,30},{10,50}})));
8+
Waterway.Pipe pipe2(H=0, useInitialFlow=false) annotation (Placement(transformation(extent={{-10,-10},{10,10}})));
99
OpenHPL.Waterway.Reservoir tail2 annotation (Placement(transformation(extent={{60,-10},{40,10}})));
1010
OpenHPL.Waterway.VolumeFlowSource volumeFlowInput(useInput=true, useFilter=false, fixElevation = true) annotation (Placement(transformation(extent={{-48,-10},{-28,10}})));
1111
Modelica.Blocks.Sources.Sine sine(f = 0.01, offset = 1) annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
@@ -14,7 +14,7 @@ model VolumeFlowSource "Example demonstrating the use of VolumeFlowSource"
1414
1.468578339; 62,1.445258141; 63,1.381029367; 64,1.308333635; 65,1.429936647; 66,1.324193954; 67,1.215524554; 68,1.132795691; 69,1.039966226; 70,0.957139969; 71,0.881121516; 72,0.764806509; 73,0.679720461; 74,1.153712869; 75,1.617045045; 76,1.342065096; 77,1.21108222; 78,1.097126365; 79,0.956687152; 80,0.846820831; 81,0.726776063; 82,0.637088716; 83,0.566960931; 84,0; 85,0.081746899; 86,0.287258357; 87,0.440648884; 88,0.623197138; 89,0.745818675; 90,0.877141893; 91,1.14376235; 92,1.091307402;
1515
93,1.166081309; 94,1.204966307; 95,1.155335188; 96,1.090149403; 97,1.023901701; 98,0.955312788; 99,0.895717919; 100,0.781589091; 101,0.711237729; 102,0.642216742; 103,0.592425168; 104,0.53075856; 105,0.470919639; 106,0.424907953; 107,0.379154414; 108,0.341206133; 109,0.313439339; 110,0.291419089; 111,0.282484144], extrapolation=Modelica.Blocks.Types.Extrapolation.HoldLastPoint)
1616
annotation (Placement(transformation(extent={{-80,-50},{-60,-30}})));
17-
Waterway.Pipe pipe3(H=0, useInitialEquation=false) annotation (Placement(transformation(extent={{-10,-50},{10,-30}})));
17+
Waterway.Pipe pipe3(H=0, useInitialFlow=false) annotation (Placement(transformation(extent={{-10,-50},{10,-30}})));
1818
Waterway.Reservoir tail3 annotation (Placement(transformation(extent={{60,-50},{40,-30}})));
1919
Waterway.VolumeFlowSource volumeFlowFiltered(useInput=true, useFilter=true, fixElevation = true) annotation (Placement(transformation(extent={{-48,-50},{-28,-30}})));
2020
equation

OpenHPL/Waterway/Pipe.mo

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ model Pipe "Model of a pipe"
3232
// Steady state:
3333
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
3434
parameter SI.VolumeFlowRate Vdot_0=data.Vdot_0 "Initial flow rate of the pipe" annotation (Dialog(group="Initialization"));
35-
parameter Boolean useInitialEquation=true "If false, skip initial equation for flow (e.g., when flow is imposed by a source)"
35+
parameter Boolean useInitialFlow=true "If false, skip initial equation for flow (e.g., when flow is imposed by a source)"
3636
annotation (Dialog(group="Initialization"), choices(checkBox=true));
3737

3838
SI.Velocity v "Average Water velocity";
@@ -58,7 +58,7 @@ protected
5858
parameter Modelica.Units.NonSI.Angle_deg phi = Modelica.Units.Conversions.to_deg(Modelica.Math.atan((abs(D_i-D_o)/(2*L)))) "Cone half angle";
5959

6060
initial equation
61-
if useInitialEquation then
61+
if useInitialFlow then
6262
if SteadyState then
6363
der(mdot) = 0;
6464
else
@@ -138,6 +138,13 @@ These are then converted using: p_eps = D_h·3.097·e<sup>(-0.118/n)</sup> empir
138138
<p>The conversions are simplified for hydropower applications assuming fully turbulent flow,
139139
so they depend only on fixed pipe dimensions and the chosen friction coefficient.</p>
140140
141+
<h5>Initialization</h5>
142+
<p>By default, the pipe provides an initial equation for the flow rate: either <code>der(mdot) = 0</code>
143+
(steady state) or <code>Vdot = Vdot_0</code>. When the pipe is connected to a component that already
144+
imposes the flow (e.g., <code>VolumeFlowSource</code>), these initial equations become redundant and may
145+
cause an over-determined initialization problem in some tools (e.g., Dymola). Set
146+
<code>useInitialFlow = false</code> to disable the initial equation in such cases.</p>
147+
141148
<h5>More Information</h5>
142149
<p>More info about the pipe model can be found in
143150
<a href=\"modelica://OpenHPL.UsersGuide.References\">[Vytvytskyi2017]</a>

0 commit comments

Comments
 (0)