Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .CI/checkHTMLDoc/checkTags.py
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
VOID_TAGS = ('area', 'base', 'br', 'col', 'embed', 'hr', 'img', 'input', 'keygen', 'link', 'menuitem', 'meta', 'param', 'source', 'track', 'wbr')

# Tags that should not be used
AVOIDABLE_TAGS = ('b', 'i', 'h1', 'h2', 'h3', 'h6', 'figure', 'figcaption')
AVOIDABLE_TAGS = ('b', 'i', 'h1', 'h2', 'h3', 'h6')

def _checkFileTags(file_name):
"""
Expand Down
94 changes: 94 additions & 0 deletions OpenHPL/Examples/Gate.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
within OpenHPL.Examples;
model Gate "Usage of the tainter gate"
extends Modelica.Icons.Example;
inner Data data(SteadyState = true, Vdot_0 = 75) annotation (
Placement(transformation(extent = {{-100, 80}, {-80, 100}})));
Modelica.Blocks.Sources.Ramp gateOpening(
height=0,
duration=1000,
offset=1,
startTime=500) annotation (Placement(transformation(extent={{-40,70},{-20,90}})));
Waterway.Reservoir upstream(
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(extent={{-40,40},{-20,60}})));
Waterway.Reservoir downstream(
h_0=4,
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={30,50})));
Waterway.Gate_HR gate_HR(W=16.5, T=5.6) annotation (Placement(transformation(extent={{-10,40},{10,60}})));
Modelica.Blocks.Sources.Ramp down_level(
height=0,
duration=1000,
offset=3,
startTime=500) annotation (Placement(transformation(extent={{80,-10},{60,10}})));
Waterway.Reservoir upstream1(
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
Waterway.Reservoir downstream1(
h_0=4,
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={30,0})));
Waterway.Gate gate(
sluice=false,
b=16.5,
r=8.5,
h_h=5.6) annotation (Placement(transformation(extent={{-8,-10},{12,10}})));
Waterway.Reservoir upstream2(
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
Waterway.Reservoir downstream2(
h_0=4,
constantLevel=false,
useLevel=true,
L=10,
W=10) annotation (Placement(transformation(
extent={{-10,10},{10,-10}},
rotation=180,
origin={30,-50})));
Waterway.Gate gate_sluice(
sluice=true,
b=16.5,
r=8.5,
h_h=5.6) annotation (Placement(transformation(extent={{-10,-60},{10,-40}})));
Modelica.Blocks.Sources.Ramp up_level(
height=0,
duration=1000,
offset=5,
startTime=500) annotation (Placement(transformation(extent={{-80,-10},{-60,10}})));
equation
connect(upstream.o, gate_HR.i) annotation (Line(points={{-20,50},{-10,50}}, color={0,128,255}));
connect(gate_HR.o, downstream.o) annotation (Line(points={{10,50},{20,50}}, color={0,128,255}));
connect(gateOpening.y, gate_HR.B) annotation (Line(points={{-19,80},{0,80},{0,62}}, color={0,0,127}));
connect(down_level.y, downstream.level) annotation (Line(points={{59,0},{54,0},{54,56},{42,56}}, color={0,0,127}));
connect(upstream1.o, gate.i) annotation (Line(points={{-20,0},{-8,0}}, color={0,128,255}));
connect(gate.o, downstream1.o) annotation (Line(points={{12,0},{20,0}}, color={0,128,255}));
connect(gateOpening.y, gate.a) annotation (Line(points={{-19,80},{-14,80},{-14,22},{2,22},{2,12}},
color={0,0,127}));
connect(upstream2.o, gate_sluice.i) annotation (Line(points={{-20,-50},{-10,-50}}, color={0,128,255}));
connect(gate_sluice.o, downstream2.o) annotation (Line(points={{10,-50},{20,-50}}, color={0,128,255}));
connect(gateOpening.y, gate_sluice.a) annotation (Line(points={{-19,80},{-14,80},{-14,-28},{0,-28},{0,-38}},
color={0,0,127}));
connect(downstream1.level, down_level.y) annotation (Line(points={{42,6},{54,6},{54,0},{59,0}}, color={0,0,127}));
connect(downstream2.level, down_level.y) annotation (Line(points={{42,-44},{54,-44},{54,0},{59,0}}, color={0,0,127}));
connect(up_level.y, upstream.level) annotation (Line(points={{-59,0},{-52,0},{-52,56},{-42,56}}, color={0,0,127}));
connect(upstream1.level, up_level.y) annotation (Line(points={{-42,6},{-52,6},{-52,0},{-59,0}}, color={0,0,127}));
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;
1 change: 1 addition & 0 deletions OpenHPL/Examples/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,5 @@ DetailedGen
DetailedGenFrancis
PowerSystemSimple
VolumeFlowSource
Gate
WithOpenIPSL
55 changes: 55 additions & 0 deletions OpenHPL/Icons/Gate.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
within OpenHPL.Icons;
partial class Gate "Icons for the gate"
parameter Boolean sluice=false "if true, gate is of type sluice gate, otherwise it is a radial/tainter gate type" annotation (Dialog(group="Type"), choices(checkBox=true));
annotation (Icon(graphics={
Rectangle(
extent={{-46,-60},{100,-72}},
lineColor={28,108,200},
fillColor={28,108,200},
fillPattern=FillPattern.Solid),
Rectangle(
visible = sluice,
extent={{-46,0},{-4,-60}},
lineColor={28,108,200},
fillColor={28,108,200},
fillPattern=FillPattern.Solid),
Rectangle(
visible = sluice,
extent={{-4,20},{4,-60}},
lineColor={0,0,0},
fillColor={175,175,175},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-100,0},{-46,-72}},
lineColor={28,108,200},
fillColor={28,108,200},
fillPattern=FillPattern.Solid),
Ellipse(
visible = not sluice,
extent={{-60,140},{220,-140}},
lineColor={135,135,135},
startAngle=155,
endAngle=196,
fillColor={175,175,175},
fillPattern=FillPattern.Solid),
Rectangle(
extent={{-100,-72},{100,-80}},
lineColor={0,0,0},
fillColor={215,215,215},
fillPattern=FillPattern.Forward),
Rectangle(extent={{-100,100},{100,-100}}, lineColor={0,0,0}),
Text(
lineColor={28,108,200},
extent={{-90,100},{90,60}},
textString="%name",
textStyle={TextStyle.Bold}),
Ellipse(
extent={{-2,-4},{2,-8}},
lineColor={0,0,0},
fillColor={0,0,0},
fillPattern=FillPattern.Solid),
Line(
points={{0,-6},{0,100}},
color={0,0,0},
pattern=LinePattern.Dash)}));
end Gate;
1 change: 1 addition & 0 deletions OpenHPL/Icons/package.order
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Surge
Fitting
DraftTube
OpenChannel
Gate
ElectroMech
Turbine
Generator
Expand Down
Binary file added OpenHPL/Resources/Images/TainterGate-backedup.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OpenHPL/Resources/Images/TainterGate-freeflow.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file added OpenHPL/Resources/Images/TainterGate.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
5 changes: 5 additions & 0 deletions OpenHPL/UsersGuide/References.mo
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,11 @@ model References "References"
extends Modelica.Icons.References;
annotation (Documentation(info="<html>
<dl>
<dt>[Bollrich2019]</dt>
<dd><p>Gerhard Bollrich: &quot;Technische Hydromechanik 1 (eBook)&quot;,
Book, Beuth Verlag GmbH, 2019,
8th Edition, ISBN 978-3-410-29170-1.</p>
</dd>
<dt>[Hinna2021]</dt>
<dd><p>Jonas Tveit Hinna:
&quot;Modelica model of transient pipe flow in hydraulic laboratory systems using the method of characteristics&quot;,
Expand Down
153 changes: 153 additions & 0 deletions OpenHPL/Waterway/Gate.mo
Original file line number Diff line number Diff line change
@@ -0,0 +1,153 @@
within OpenHPL.Waterway;
model Gate "Model of a sluice or tainter gate based on [Bollrich2019]"
outer Data data "Using standard class with system parameters";
extends Icons.Gate;
extends OpenHPL.Interfaces.ContactPort;
import Modelica.Units.Conversions.to_deg;
parameter SI.Height b "Width of the gate" annotation (Dialog(group="Common"));
parameter SI.Length r "Radius of the gate arm" annotation (Dialog(enable=not sluice, group="Radial/Tainter"));
parameter SI.Height h_h "Height of the hinge above gate bottom" annotation (Dialog(group="Radial/Tainter", enable=not sluice));
SI.Height h_0 "Inlet water level";
SI.Height h_2 "Outlet water level";
SI.Height h_2_limit "Limit of free flow";
SI.Area A = a*b "Area of the physical gate opening";
SI.VolumeFlowRate Vdot "Volume flow rate through the gate";
Real mu_A "Discharge coefficient";
Real psi "Contraction coefficient";
//Real psi90 "Contraction coefficient for vertical gate";
Real chi "Back-up coefficient";
SI.Angle alpha = C.pi/2 - asin((h_h-a)/r) "Edge angle of the gate";
Real x,y,z;
Real h0_a = h_0/a;
Real h2_a = h_2/a;
Modelica.Blocks.Interfaces.RealInput a "Opening of the gate [m]" annotation (Placement(transformation(
extent={{-20,-20},{20,20}},
rotation=270,
origin={0,120})));
equation
mu_A = psi/sqrt(1+psi*a/h_0);
if sluice then
psi = 1 / (1+ 0.64 * sqrt(1-(a/h_0)^2)) "Sluice gate, i.e. alpha = 90 deg";
else
psi = 1.3 - 0.8 * sqrt(1 - ((to_deg(alpha)-205)/220)^2) "Normally only valid for a/h_0 --> 0";
end if;
x = (1-2*psi*a/h_0*(1-psi*a/max(C.small,h_2)))^2;
y = x+z-1;
z = (h_2/h_0)^2;

h_2_limit = a*psi/2*(sqrt(1+16/(psi*(1+psi*a/h_0)) * (h_0/a))-1);

if h_2 >= h_2_limit then
chi = sqrt((1+psi*a/h_0) * ((1-2*psi*a/h_0 * (1-psi*a/h_2))-
sqrt((1-2*psi*a/h_0*(1-psi*a/max(C.small,h_2)))^2 + (h_2/h_0)^2 - 1))) "Backed-up flow";
else
chi = 1 "Free flow";
end if;

Vdot = chi * mu_A * A * sqrt(2*data.g*h_0) "Volume flow rate through the gate";
mdot = Vdot * data.rho "Mass flow rate through the gate";
i.p = h_0 * data.g * data.rho + data.p_a "Inlet water pressure";
o.p = h_2 * data.g * data.rho + data.p_a "Outlet water pressure";
annotation (Documentation(info="<html>
<h4>Implementation</h4>
<p>
The calculation of the flow through the gate is approximated for two different regions and is based
on <a href=\"modelica://OpenHPL.UsersGuide.References\">[Bollrich2019]</a>.
Equation numbers and figure numbers given below are in sync with the numbers of <a href=\"modelica://OpenHPL.UsersGuide.References\">[Bollrich2019]</a>.
</p>
<h5>Free flowing</h5>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
<tr>
<td>
<img src=\"modelica://OpenHPL/Resources/Images/TainterGate-freeflow.png\"
alt=\"TainterGate free flow\">
</td>
</tr>
<caption align=\"bottom\"><strong>Fig. 8.13:</strong> Free flow through the tainter gate (source:
<a href=\"modelica://OpenHPL.UsersGuide.References\">[Bollrich2019]</a>, page 376)</caption>
</table>
<p>
The free flow can be calculated with:

$$Q_A = \\mu_A \\cdot A \\cdot \\sqrt{2g\\cdot h_0} \\tag{8.24} $$
(valid for gate opening higher than the downstream water level)
</p>
<p>
With
</p>
<dl><dd>Opening area</dd>
<dt> $$ A = a\\cdot b $$ </dt>
<dd>Discharge coefficient</dd>
<dt> $$ \\mu_A = \\frac{\\psi}{\\sqrt{1+\\frac{\\psi\\cdot a}{h_0}}} \\tag{8.23}$$ </dt>
<dd>Contraction coefficient sluice gate (\\(\\alpha=90^\\circ\\))</dd>
<dt> $$ \\psi_{90^\\circ}= \\frac{1}{1+0.64\\cdot \\sqrt{1-(a/h_0)^2}} \\tag{8.25}$$ </dt>
<dd>Contraction coefficient radial gate (for \\(a/h_0 \\rightarrow 0\\))</dd>
<dt> $$ \\psi_0(\\alpha)= 1.3 -0.8\\cdot\\sqrt{1-\\left(\\frac{\\alpha -205^\\circ}{220^\\circ}\\right)^2} \\tag{8.25a}$$ </dt>
<dd> The edge angle \\(\\alpha\\) of the gate </dd>
<dt> $$ \\alpha = \\left( \\frac{\\pi}{2} - \\arcsin(\\frac{h_h-a}{r})\\right) \\cdot \\frac{180^\\circ}{\\pi} $$ </dt>
</dl>
<blockquote>
With:
<ul>
<li> \\(a \\ldots\\) Vertical gate opening </li>
<li> \\(h_h \\ldots\\) Height of the hinge above gate bottom\"</li>
<li> \\(r \\ldots\\) Radius of the gate arm </li>
</ul>
</blockquote>

<h5>Backed-up discharge</h5>
<table border=\"0\" cellspacing=\"0\" cellpadding=\"2\">
<tr>
<td>
<img src=\"modelica://OpenHPL/Resources/Images/TainterGate-backedup.png\"
alt=\"TainterGate backed-up flow\">
</td>
</tr>
<caption align=\"bottom\"><strong>Fig. 8.16:</strong> Backed-up flow through the tainter gate (source:
<a href=\"modelica://OpenHPL.UsersGuide.References\">[Bollrich2019]</a>, page 379)</caption>
</table>
<p>
$$Q_A = \\chi \\cdot \\mu_A \\cdot A \\cdot \\sqrt{2g\\cdot h_0} \\tag{8.29} $$

With
</p>
<dl>
<dd>Back-up coefficient</dd>
<dt> $$ \\chi = \\sqrt{
\\left(
1 + \\frac{\\psi\\cdot a}{h_0}
\\right) \\cdot
\\left\\{
\\left[
1 - 2\\cdot\\frac{\\psi\\cdot a}{h_0} \\cdot
\\left(
1-\\frac{\\psi\\cdot a}{h_2}
\\right)
\\right]
- \\sqrt{
\\left[
1 - 2 \\cdot \\frac{\\psi\\cdot a}{h_0} \\cdot
\\left(
1-\\frac{\\psi\\cdot a}{h_2}
\\right)
\\right]^2
+
\\left(
\\frac{h_2}{h_0}
\\right)^2
- 1
}
\\right\\}
} \\tag{8.28}$$ </dt>
</dl>

<h5>Boundary between free and backed-up flow</h5>
<p>
The boundary of the height of the water level \\(h_2\\) behind the gate from which on the calculation switches to the backed-up flow (8.29) can be derived from:

$$ \\frac{h_2^*}{a} = \\frac{\\psi}{2} \\cdot \\left( \\sqrt{ 1 + \\frac{16}{\\psi\\cdot\\left(1+\\frac{\\psi\\cdot a}{h_0}\\right)}\\cdot\\frac{h_0}{a}} - 1 \\right) \\tag{8.26}$$

So when \\(\\frac{h_2}{a} \\geq \\frac{h_2^*}{a}\\) then we have back-up flow.
</p>
</html>"));
end Gate;
Loading