Skip to content

Commit c35a1c5

Browse files
committed
Equation of Tainter Gate implementation after Bollrich2019
1 parent 19fe6e3 commit c35a1c5

File tree

10 files changed

+213
-124
lines changed

10 files changed

+213
-124
lines changed

OpenHPL/Examples/Gate.mo

Lines changed: 94 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,94 @@
1+
within OpenHPL.Examples;
2+
model Gate "Usage of the tainter gate"
3+
extends Modelica.Icons.Example;
4+
inner Data data(SteadyState = true, Vdot_0 = 75) annotation (
5+
Placement(transformation(extent = {{-100, 80}, {-80, 100}})));
6+
Modelica.Blocks.Sources.Ramp gateOpening(
7+
height=0,
8+
duration=1000,
9+
offset=1,
10+
startTime=500) annotation (Placement(transformation(extent={{-90,-10},{-70,10}})));
11+
Waterway.Reservoir upstream(
12+
h_0=5,
13+
constantLevel=true,
14+
L=10,
15+
W=10) annotation (Placement(transformation(extent={{-40,38},{-20,58}})));
16+
Waterway.Reservoir downstream(
17+
h_0=4,
18+
constantLevel=false,
19+
useLevel=true,
20+
L=10,
21+
W=10) annotation (Placement(transformation(
22+
extent={{-10,10},{10,-10}},
23+
rotation=180,
24+
origin={30,48})));
25+
Waterway.Gate_HR gate_HR(W=16.5, T=5.6) annotation (Placement(transformation(extent={{-10,38},{10,58}})));
26+
Modelica.Blocks.Sources.Ramp level(
27+
height=4.89,
28+
duration=1000,
29+
offset=0.01,
30+
startTime=500) annotation (Placement(transformation(extent={{80,38},{60,58}})));
31+
Waterway.Reservoir upstream1(
32+
h_0=5,
33+
constantLevel=true,
34+
L=10,
35+
W=10) annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
36+
Waterway.Reservoir downstream1(
37+
h_0=4,
38+
constantLevel=false,
39+
useLevel=true,
40+
L=10,
41+
W=10) annotation (Placement(transformation(
42+
extent={{-10,10},{10,-10}},
43+
rotation=180,
44+
origin={32,0})));
45+
Waterway.Gate gate(
46+
sluice=false,
47+
b=16.5,
48+
r=8.5,
49+
h_h=5.6) annotation (Placement(transformation(extent={{-8,-10},{12,10}})));
50+
Modelica.Blocks.Sources.Ramp level1(
51+
height=4.89,
52+
duration=1000,
53+
offset=0.01,
54+
startTime=500) annotation (Placement(transformation(extent={{82,-10},{62,10}})));
55+
Waterway.Reservoir upstream2(
56+
h_0=5,
57+
constantLevel=true,
58+
L=10,
59+
W=10) annotation (Placement(transformation(extent={{-40,-50},{-20,-30}})));
60+
Waterway.Reservoir downstream2(
61+
h_0=4,
62+
constantLevel=false,
63+
useLevel=true,
64+
L=10,
65+
W=10) annotation (Placement(transformation(
66+
extent={{-10,10},{10,-10}},
67+
rotation=180,
68+
origin={30,-40})));
69+
Waterway.Gate gate_sluice(
70+
sluice=true,
71+
b=16.5,
72+
r=8.5,
73+
h_h=5.6) annotation (Placement(transformation(extent={{-10,-50},{10,-30}})));
74+
Modelica.Blocks.Sources.Ramp level2(
75+
height=4.89,
76+
duration=1000,
77+
offset=0.01,
78+
startTime=500) annotation (Placement(transformation(extent={{80,-50},{60,-30}})));
79+
equation
80+
connect(upstream.o, gate_HR.i) annotation (Line(points={{-20,48},{-10,48}}, color={0,128,255}));
81+
connect(gate_HR.o, downstream.o) annotation (Line(points={{10,48},{20,48}}, color={0,128,255}));
82+
connect(gateOpening.y, gate_HR.B) annotation (Line(points={{-69,0},{-44,0},{-44,70},{0,70},{0,60}}, color={0,0,127}));
83+
connect(level.y, downstream.level) annotation (Line(points={{59,48},{50,48},{50,54},{42,54}}, color={0,0,127}));
84+
connect(upstream1.o, gate.i) annotation (Line(points={{-20,0},{-8,0}}, color={0,128,255}));
85+
connect(gate.o, downstream1.o) annotation (Line(points={{12,0},{22,0}}, color={0,128,255}));
86+
connect(level1.y, downstream1.level) annotation (Line(points={{61,0},{52,0},{52,6},{44,6}}, color={0,0,127}));
87+
connect(gateOpening.y, gate.a) annotation (Line(points={{-69,0},{-44,0},{-44,22},{2,22},{2,12}}, color={0,0,127}));
88+
connect(upstream2.o, gate_sluice.i) annotation (Line(points={{-20,-40},{-10,-40}}, color={0,128,255}));
89+
connect(gate_sluice.o, downstream2.o) annotation (Line(points={{10,-40},{20,-40}}, color={0,128,255}));
90+
connect(level2.y, downstream2.level) annotation (Line(points={{59,-40},{50,-40},{50,-34},{42,-34}}, color={0,0,127}));
91+
connect(gateOpening.y, gate_sluice.a) annotation (Line(points={{-69,0},{-44,0},{-44,-18},{0,-18},{0,-28}}, color={0,0,127}));
92+
annotation (
93+
experiment(StopTime=2000, Interval=0.4));
94+
end Gate;

OpenHPL/Examples/TainterGate.mo

Lines changed: 0 additions & 38 deletions
This file was deleted.

OpenHPL/Examples/TainterGate3.mo

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
within OpenHPL.Examples;
2+
model TainterGate3 "Usage of the tainter gate"
3+
extends Modelica.Icons.Example;
4+
inner Data data(SteadyState = true, Vdot_0 = 75) annotation (
5+
Placement(transformation(extent = {{-100, 80}, {-80, 100}})));
6+
Modelica.Blocks.Sources.Ramp gateOpening(
7+
height=0,
8+
duration=1000,
9+
offset=0.4,
10+
startTime=500) annotation (Placement(transformation(extent={{-40,30},{-20,50}})));
11+
Waterway.Reservoir upstream(
12+
h_0=5.6,
13+
constantLevel=true,
14+
L=10,
15+
W=10) annotation (Placement(transformation(extent={{-40,-20},{-20,0}})));
16+
Waterway.Reservoir downstream(
17+
h_0=2.8,
18+
constantLevel=false,
19+
useLevel=true,
20+
L=10,
21+
W=10) annotation (Placement(transformation(
22+
extent={{-10,10},{10,-10}},
23+
rotation=180,
24+
origin={30,-10})));
25+
Waterway.Gate tainterGate3_1(
26+
sluice=true,
27+
r=8.5,
28+
h_h=5.55,
29+
b=5.9) annotation (Placement(transformation(extent={{-10,-20},{10,0}})));
30+
Modelica.Blocks.Sources.Ramp downstream_level(
31+
height=4,
32+
duration=1000,
33+
offset=0,
34+
startTime=500) annotation (Placement(transformation(extent={{80,-20},{60,0}})));
35+
equation
36+
connect(upstream.o, tainterGate3_1.i) annotation (Line(points={{-20,-10},{-10,-10}}, color={0,128,255}));
37+
connect(tainterGate3_1.o, downstream.o) annotation (Line(points={{10,-10},{20,-10}}, color={0,128,255}));
38+
connect(tainterGate3_1.a, gateOpening.y) annotation (Line(points={{0,2},{-2,2},{-2,42},{-19,42},{-19,40}}, color={0,0,127}));
39+
connect(downstream.level, downstream_level.y) annotation (Line(points={{42,-4},{54,-4},{54,-10},{59,-10}}, color={0,0,127}));
40+
annotation (
41+
experiment(StopTime=2000, Interval=0.4));
42+
end TainterGate3;

OpenHPL/Examples/package.order

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,5 +7,6 @@ DetailedGen
77
DetailedGenFrancis
88
PowerSystemSimple
99
VolumeFlowSource
10-
TainterGate
10+
Gate
1111
WithOpenIPSL
12+
TainterGate3
Lines changed: 21 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,30 @@
11
within OpenHPL.Icons;
2-
partial class TainterGate "Icon of a tainter gate"
2+
partial class Gate "Icons for the gate"
33
annotation (Icon(graphics={
44
Rectangle(
5-
extent={{-100,-2},{-46,-72}},
5+
extent={{-46,-60},{100,-72}},
6+
lineColor={28,108,200},
7+
fillColor={28,108,200},
8+
fillPattern=FillPattern.Solid),
9+
Rectangle(
10+
visible = sluice,
11+
extent={{-46,0},{-4,-60}},
12+
lineColor={28,108,200},
13+
fillColor={28,108,200},
14+
fillPattern=FillPattern.Solid),
15+
Rectangle(
16+
visible = sluice,
17+
extent={{-4,20},{4,-60}},
18+
lineColor={0,0,0},
19+
fillColor={175,175,175},
20+
fillPattern=FillPattern.Solid),
21+
Rectangle(
22+
extent={{-100,0},{-46,-72}},
623
lineColor={28,108,200},
724
fillColor={28,108,200},
825
fillPattern=FillPattern.Solid),
926
Ellipse(
27+
visible = not sluice,
1028
extent={{-60,140},{220,-140}},
1129
lineColor={135,135,135},
1230
startAngle=155,
@@ -18,11 +36,6 @@ partial class TainterGate "Icon of a tainter gate"
1836
lineColor={0,0,0},
1937
fillColor={215,215,215},
2038
fillPattern=FillPattern.Forward),
21-
Rectangle(
22-
extent={{-46,-60},{100,-72}},
23-
lineColor={28,108,200},
24-
fillColor={28,108,200},
25-
fillPattern=FillPattern.Solid),
2639
Rectangle(extent={{-100,100},{100,-100}}, lineColor={0,0,0}),
2740
Text(
2841
lineColor={28,108,200},
@@ -38,4 +51,4 @@ partial class TainterGate "Icon of a tainter gate"
3851
points={{0,-6},{0,100}},
3952
color={0,0,0},
4053
pattern=LinePattern.Dash)}));
41-
end TainterGate;
54+
end Gate;

OpenHPL/Icons/package.order

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,11 +7,11 @@ Surge
77
Fitting
88
DraftTube
99
OpenChannel
10+
Gate
1011
ElectroMech
1112
Turbine
1213
Generator
1314
Pylon
1415
RunOff
1516
Method
1617
Governor
17-
TainterGate
Lines changed: 48 additions & 33 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,54 @@
11
within OpenHPL.Waterway;
2-
model TainterGate3 "Model of a tainter gate based on [Bollrich2019]"
2+
model Gate "Model of a sluice or tainter gate based on [Bollrich2019]"
33
outer Data data "Using standard class with system parameters";
4-
extends Icons.TainterGate;
4+
extends Icons.Gate;
55
extends OpenHPL.Interfaces.ContactPort;
6-
7-
// parameter SI.Height b_max "Maxium opening of the gate";
8-
// parameter SI.Height b_min = 0 "Minimum opening of the gate";
9-
parameter SI.Length r "Radius of the gate arm";
10-
parameter SI.Height a "Height of the hinge above gate bottom";
11-
parameter SI.Height b "Width of the gate";
12-
parameter Real Cc_[3] = {1,2,3} "Polinomial factors of contraction coefficient Cc {linear,quadratic,cube}";
13-
SI.Height h_i "Inlet water level";
14-
SI.Height h_o "Outlet water level";
15-
Real alpha = h_o/(Cc*u);
16-
Real beta = h_i/h_o;
17-
Real gamma = (h_o/(Cc*u))^2 - (h_o/h_i)^2 "Loss factor";
18-
Real psi = (1/beta)^2 - 1 + (gamma^2*(beta-1))/(psi_x1 + psi_x2) "Head-loss parameter";
19-
Real psi_ = (1/beta)^2 - 1 + (gamma^2*(beta-1))/(psi_x1 - psi_x2) "Neg Head-loss parameter";
20-
Real psi_x1 = gamma*beta-2*(alpha-1);
21-
Real psi_x2 = sqrt((2*(alpha-1)-gamma*beta)^2 - gamma^2*(beta^2-1));
22-
23-
SI.Angle theta = C.pi/2 - asin((a-u)/r) "Flow angle of the gate";
24-
Real Cc = Cc_[3]*theta^3 + Cc_[2]*theta^2 + Cc_[1]*theta + 1.002282138151680 "Contraction coefficient";
25-
SI.VolumeFlowRate Vdot,Vdot_gamma "Volume flow rate through the gate";
26-
27-
Modelica.Blocks.Interfaces.RealInput u "Opening of the gate [m]" annotation (Placement(transformation(
6+
import Modelica.Units.Conversions.to_deg;
7+
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));
8+
parameter SI.Height b "Width of the gate" annotation (Dialog(group="Common"));
9+
parameter SI.Length r "Radius of the gate arm" annotation (Dialog(enable=not sluice, group="Radial/Tainter"));
10+
parameter SI.Height h_h "Height of the hinge above gate bottom" annotation (Dialog(group="Radial/Tainter", enable=not sluice));
11+
SI.Height h_0 "Inlet water level";
12+
SI.Height h_2 "Outlet water level";
13+
SI.Height h_2_limit "Limit of free flow";
14+
SI.Area A = a*b "Area of the physical gate opening";
15+
SI.VolumeFlowRate Vdot "Volume flow rate through the gate";
16+
Real mu_A "Discharge coefficient";
17+
Real psi "Contraction coefficient";
18+
//Real psi90 "Contraction coefficient for vertical gate";
19+
Real chi "Back-up coefficient";
20+
SI.Angle alpha = C.pi/2 - asin((h_h-a)/r) "Edge angle of the gate";
21+
Real x,y,z;
22+
Real h0_a = h_0/a;
23+
Real h2_a = h_2/a;
24+
Modelica.Blocks.Interfaces.RealInput a "Opening of the gate [m]" annotation (Placement(transformation(
2825
extent={{-20,-20},{20,20}},
2926
rotation=270,
3027
origin={0,120})));
3128
equation
32-
Vdot = b*h_o * sqrt((2*data.g*max(0,(h_i - h_o)))/(psi + 1 - (h_o/h_i)^2)) "Calculated flow";
33-
Vdot_gamma = b*h_o * sqrt((2*data.g*max(0,(h_i - h_o)))/(gamma + 1 - (h_o/h_i)^2)) "Calculated flow";
29+
mu_A = psi/sqrt(1+psi*a/h_0);
30+
if sluice then
31+
psi = 1 / (1+ 0.64 * sqrt(1-(a/h_0)^2));
32+
else
33+
psi = 1.3 - 0.8 * sqrt(1 - ((to_deg(alpha)-205)/220)^2) "Normally only valid for a/h_0 --> 0";
34+
end if;
35+
x = (1-2*psi*a/h_0*(1-psi*a/max(C.small,h_2)))^2;
36+
y = x+z-1;
37+
z = (h_2/h_0)^2;
38+
39+
h_2_limit = a*psi/2*(sqrt(1+16/(psi*(1+psi*a/h_0)) * (h_0/a))-1);
40+
41+
if h_2 >= h_2_limit then
42+
chi = sqrt((1+psi*a/h_0) * ((1-2*psi*a/h_0 * (1-psi*a/h_2))-
43+
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";
44+
else
45+
chi = 1 "Free flow";
46+
end if;
47+
48+
Vdot = chi * mu_A * A * sqrt(2*data.g*h_0) "Volume flow rate through the gate";
3449
mdot = Vdot * data.rho "Mass flow rate through the gate";
35-
i.p = h_i * data.g * data.rho + data.p_a "Inlet water pressure";
36-
o.p = h_o * data.g * data.rho + data.p_a "Outlet water pressure";
50+
i.p = h_0 * data.g * data.rho + data.p_a "Inlet water pressure";
51+
o.p = h_2 * data.g * data.rho + data.p_a "Outlet water pressure";
3752
annotation (Documentation(info="<html>
3853
<h4>Implementation</h4>
3954
<p>
@@ -85,9 +100,9 @@ $$Q_A = \\chi \\cdot \\mu_A \\cdot A \\cdot \\sqrt{2g\\cdot h_0} \\tag{8.29} $$
85100
86101
With
87102
<dl>
88-
<dd>Back-up factor</dd>
103+
<dd>Back-up coefficient</dd>
89104
<dt> $$ \\chi = \\sqrt{
90-
\\left(
105+
\\left(
91106
1 + \\frac{\\psi\\cdot a}{h_0}
92107
\\right) \\cdot
93108
\\left\\{
@@ -105,8 +120,8 @@ With
105120
\\right)
106121
\\right]^2
107122
+
108-
\\left(
109-
\\frac{h_2}{h_0}
123+
\\left(
124+
\\frac{h_2}{h_0}
110125
\\right)^2
111126
- 1
112127
}
@@ -123,4 +138,4 @@ $$ \\frac{h_2^*}{a} = \\frac{\\psi}{2} \\cdot \\left( \\sqrt{ 1 + \\frac{16}{\\p
123138
So when \\(\\frac{h_2}{a} \\geq \\frac{h_2^*}{a}\\) then we have back-up flow.
124139
</p>
125140
</html>"));
126-
end TainterGate3;
141+
end Gate;
Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
within OpenHPL.Waterway;
2-
model TainterGate "Model of a tainter gate (HEC-RAS)"
2+
model Gate_HR "Model of a tainter gate (HEC-RAS)"
33
outer Data data "Using standard class with system parameters";
4-
extends Icons.TainterGate;
4+
extends Icons.Gate;
55
extends OpenHPL.Interfaces.ContactPort;
66

77
parameter SI.Height W "Width of the gated spillway"
@@ -84,4 +84,4 @@ $$Q = C_{dx} A \\sqrt{2gH} \\tag{3}$$
8484
The use of <code>Cdx</code> is different to the implementaion as done in HEC-RAS. This was done in order to have a smoother transition from the partially to fully submerged region.
8585
</p>
8686
</html>"));
87-
end TainterGate;
87+
end Gate_HR;

0 commit comments

Comments
 (0)