diff --git a/OpenHPL/Waterway/BendPipe.mo b/OpenHPL/Waterway/BendPipe.mo
index ea3ce82..6086982 100644
--- a/OpenHPL/Waterway/BendPipe.mo
+++ b/OpenHPL/Waterway/BendPipe.mo
@@ -8,15 +8,22 @@ model BendPipe "Bend in pipes"
Dialog(group = "Manufacturer's design"));
/* geometrical parameters for fitting */
parameter SI.Diameter D_i = 3 "Pipe diameter of the inlet (LHS)" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = D_i "Pipe diameter of the outlet (RHS)" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 7.07 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = A_i "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
SI.Velocity v(start=Modelica.Constants.eps) "Water velocity";
- SI.Area A = pi*D_i^2/4 "Cross section area";
+ SI.Area A "Cross section area";
SI.Pressure dp "Pressure drop of fitting";
SI.MassFlowRate mdot "Mass flow rate";
extends OpenHPL.Interfaces.TwoContacts;
equation
+ A = if use_A then (if mdot >= 0 then A_i else A_o) else pi * D_i ^ 2 / 4;
v = mdot / data.rho / A;
dp = K_L * 0.5 * data.rho * v^2;
// Connections
diff --git a/OpenHPL/Waterway/DraftTube.mo b/OpenHPL/Waterway/DraftTube.mo
index 97f0d44..d7544e6 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 = D_);
import Modelica.Constants.pi;
parameter Types.DraftTube DraftTubeType = OpenHPL.Types.DraftTube.ConicalDiffuser "Types of draft tube" annotation (
Dialog(group = "Draft tube types"));
@@ -13,9 +13,15 @@ model DraftTube "Model of a draft tube for reaction turbines"
parameter SI.Length L = 7.017 "Centerline/slant length (conical diffuser). Inclination is derived from H and L." annotation (
Dialog(group = "Geometry",enable=DraftTubeType == OpenHPL.Types.DraftTube.ConicalDiffuser));
parameter SI.Diameter D_i = 4 "Diameter of the inlet side" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = 4.978 "Diameter of the outlet side" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 12.57 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = 19.46 "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
parameter SI.Length L_m = 4 "Length of main section (Moody spreading pipe)" annotation (
Dialog(group = "Geometry",enable=DraftTubeType == OpenHPL.Types.DraftTube.MoodySpreadingPipe));
@@ -35,12 +41,12 @@ model DraftTube "Model of a draft tube for reaction turbines"
// parameter Boolean TempUse = data.TempUse "If checked - the water temperature is not constant" annotation (Dialog(group = "Initialization"));
// parameter SI.Temperature T_0 = data.T_0 "Initial water temperature in the pipe" annotation (Dialog(group = "Initialization", enable = TempUse));
- /* variables */
- SI.Diameter D_ = 0.5 * (D_i + D_o) "Average diameter";
- SI.Area A_i = D_i ^ 2 * pi / 4 "Inlet cross-section area of draft tube";
- SI.Area A_o = D_o ^ 2 * pi / 4 "Outlet cross-section area of draft tube";
- SI.Area A_ = D_ ^ 2 * pi / 4 "Average cross-section area of conical diffuser";
+ protected
+ parameter SI.Diameter D_ = if use_A then sqrt(4 * A_ / pi) else 0.5 * (D_i_ + D_o_) "Average diameter";
+ parameter SI.Area A_ = if use_A then (A_i + A_o) / 2 else D_ ^ 2 * pi / 4 "Average cross-section area of conical diffuser";
+
+ /* variables */
SI.Mass m "Mass of water inside conical diffuser";
SI.Mass m_m "Mass of water inside Main section Moody spreading pipes";
SI.Mass m_b "Mass of water inside Branch section Moody spreading pipes";
@@ -79,6 +85,9 @@ model DraftTube "Model of a draft tube for reaction turbines"
// connectors
extends OpenHPL.Interfaces.TwoContacts;
+protected
+ parameter SI.Diameter D_i_ = if use_A then sqrt(4 * A_i / pi) else D_i;
+ parameter SI.Diameter D_o_ = if use_A then sqrt(4 * A_o / pi) else D_o;
initial equation
if SteadyState then
der(M) = 0;
@@ -88,7 +97,7 @@ initial equation
//n.T = p.T;
end if;
equation
- assert(D_i > 0 and D_o > 0, "DraftTube diameters D_i and D_o must be > 0.", AssertionLevel.error);
+ assert(D_i_ > 0 and D_o_ > 0, "DraftTube areas or diameters must be > 0.", AssertionLevel.error);
der(M) = Mdot + F "Momentum balance";
if DraftTubeType == OpenHPL.Types.DraftTube.ConicalDiffuser then
@@ -98,7 +107,7 @@ equation
M = m*v;
m = data.rho*V "Mass of water inside the draft tube";
m_m=0;m_b=0; // Unimportant for conical diffuser
- V = pi*H/12*(D_i^2+D_o^2+D_i*D_o) "Volume of water inside the draft tube";
+ V = pi*H/12*(D_i_^2+D_o_^2+D_i_*D_o_) "Volume of water inside the draft tube";
v = Vdot/A_;
Vdot_b = 0; // Unimportant for conical diffuser
v_m=0;v_b=0; // Unimportant for conical diffuser
@@ -111,7 +120,7 @@ equation
F_p = p_i * A_i - p_o * A_o;
F_f = Functions.DarcyFriction.Friction(v, D_, L, data.rho, data.mu, p_eps)+1/2*data.rho*v*abs(v)*A_i*phi_d;
F_fm=0;F_fb=0;
- phi_d = 0.23*(1-D_i/D_o)^2;
+ phi_d = 0.23*(1-D_i_/D_o_)^2;
phi_d_o=0; // Unimportant for conical diffuser
F_g = m*data.g*cos_theta;
@@ -131,8 +140,8 @@ equation
F_p = p_i*A_i-2*p_o*A_o*cos_theta_moody_by_2;
F_g = m_m*data.g+2*m_b*data.g*cos_theta_moody_by_2;
F_f = F_fm+2*F_fb*cos_theta_moody_by_2+data.rho*v_m*abs(v_m)*A_i*phi_d;
- F_fm = Functions.DarcyFriction.Friction(v_m, D_i, L_m, data.rho, data.mu, p_eps);
- F_fb = Functions.DarcyFriction.Friction(v_b, D_o, L_b, data.rho, data.mu, p_eps);
+ F_fm = Functions.DarcyFriction.Friction(v_m, D_i_, L_m, data.rho, data.mu, p_eps);
+ F_fb = Functions.DarcyFriction.Friction(v_b, D_o_, L_b, data.rho, data.mu, p_eps);
phi_d = 1+(v_b/v_m)^2-2*v_b/v_m*cos_theta_moody-phi_d_o*(v_b/v_m)^2;
@@ -159,8 +168,8 @@ equation
Two draft tube variants are modeled using momentum balance.
Parameterization:
-- Conical diffuser: use
H, L, D_i, and D_o. The inclination is derived internally from the slope ratio H/L.
-- Moody spreading pipe: use
L_m, L_b, D_i, D_o, and theta_moody.
+- Conical diffuser: use
H, L, and inlet/outlet diameters D_i/D_o or areas A_i/A_o. The inclination is derived internally from the slope ratio H/L.
+- Moody spreading pipe: use
L_m, L_b, inlet/outlet diameters D_i/D_o or areas A_i/A_o, and theta_moody.
They are:
diff --git a/OpenHPL/Waterway/Fitting.mo b/OpenHPL/Waterway/Fitting.mo
index b256690..084039f 100644
--- a/OpenHPL/Waterway/Fitting.mo
+++ b/OpenHPL/Waterway/Fitting.mo
@@ -7,11 +7,21 @@ model Fitting "Different pipes fitting"
parameter Types.Fitting fit_type=OpenHPL.Types.Fitting.Square "Type of pipe fitting";
/* geometrical parameters for fitting */
parameter SI.Diameter D_i = 5.8 "Pipe diameter of the inlet (LHS)" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = 3.3 "Pipe diameter of the outlet (RHS)" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 26.42 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = 8.55 "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+protected
+ parameter SI.Diameter D_i_ = if use_A then sqrt(4 * A_i / pi) else D_i;
+ parameter SI.Diameter D_o_ = if use_A then sqrt(4 * A_o / pi) else D_o;
+public
parameter Modelica.Units.NonSI.Angle_deg theta=45 "If Tapered fitting: angle of the tapered reduction/expansion" annotation (Dialog(group="Geometry", enable=fit_type == OpenHPL.Types.Fitting.Tapered));
- parameter SI.Length L(max = 5 * D_o) = 1 "If Thick Orifice: length of the thick orifice, condition L/D_2<=5. If this condition is not satisfied (L is longer) then use Square Reduction followed by Square Expansion" annotation (
+ parameter SI.Length L(max = 5 * D_o_) = 1 "If Thick Orifice: length of the thick orifice, condition L/D_2<=5. If this condition is not satisfied (L is longer) then use Square Reduction followed by Square Expansion" annotation (
Dialog(group = "Geometry", enable=fit_type == OpenHPL.Types.Fitting.ThickOrifice));
/* variables */
SI.Velocity v(start=Modelica.Constants.eps) "Water velocity";
@@ -26,28 +36,28 @@ equation
if v>=0 then
phi =Functions.Fitting.FittingPhi(
v,
- D_i,
- D_o,
+ D_i_,
+ D_o_,
L,
theta,
data.rho,
data.mu,
data.p_eps,
fit_type);
- A = pi * D_i^2 / 4;
+ A = if use_A then A_i else pi * D_i^2 / 4;
dp = phi * 0.5 * data.rho * v^2;
else
phi =Functions.Fitting.FittingPhi(
v,
- D_o,
- D_i,
+ D_o_,
+ D_i_,
L,
theta,
data.rho,
data.mu,
data.p_eps,
fit_type);
- A = pi * D_o^2 / 4;
+ A = if use_A then A_o else pi * D_o^2 / 4;
dp = - phi * 0.5 * data.rho * v^2;
end if;
o.p = i.p - dp "Pressure of the output connector";
@@ -56,7 +66,7 @@ equation
o.elevation.z = i.elevation.z "Elevation propagation: no height change across fitting";
annotation (preferredView="info",
Documentation(info="
- Various possibilities of the fittings for the pipes with different diameters
+
Various possibilities of the fittings for the pipes with different diameters or cross-sectional areas
and also the orifices in the pipe.
Here, the pressure drop due to these constrictions is defined.
diff --git a/OpenHPL/Waterway/Penstock.mo b/OpenHPL/Waterway/Penstock.mo
index 828c326..bbdb8ad 100644
--- a/OpenHPL/Waterway/Penstock.mo
+++ b/OpenHPL/Waterway/Penstock.mo
@@ -10,14 +10,22 @@ model Penstock "Model of the penstock with elastic walls and compressible water.
parameter SI.Length L = 600 "length of the pipe, m" annotation (
Dialog(group = "Geometry"));
parameter SI.Diameter D_i = 3.3 "Diametr from the input side of the pipe" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = D_i "Diametr from the output side of the pipe" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 8.55 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = A_i "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Diameter D_i_ = if use_A then sqrt(4 * A_i / pi) else D_i;
+ parameter SI.Diameter D_o_ = if use_A then sqrt(4 * A_o / pi) else D_o;
parameter SI.VolumeFlowRate Vdot_0 = 20 "Initial volume flow rate" annotation (
Dialog(group = "Initialization"));
parameter Integer N = 20 "Number of segments" annotation (
Dialog(group = "Discretization"));
- SI.Diameter dD = 0.5 * (D_i + D_o), D[N] = linspace(D_i + dD / 2, D_o - dD / 2, N), D_[N + 1] = linspace(D_i, D_o, N + 1);
+ SI.Diameter dD = 0.5 * (D_i_ + D_o_), D[N] = linspace(D_i_ + dD / 2, D_o_ - dD / 2, N), D_[N + 1] = linspace(D_i_, D_o_, N + 1);
SI.Area A[N] = D .^ 2 * pi / 4, A_[N + 1] = D_ .^ 2 * pi / 4, A_m[N - 2], A_m_end, A_m_first;
SI.Pressure p_i, p_o, p_[N - 1], dp = data.rho * data.g * H / N, p_m[N - 2];
SI.Length dx = L / N, Per_m[N - 2];
diff --git a/OpenHPL/Waterway/PenstockKP.mo b/OpenHPL/Waterway/PenstockKP.mo
index 3d46396..eae77d1 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 (
@@ -10,9 +10,17 @@ model PenstockKP "Detailed model of the pipe. Could have elastic walls and compr
parameter SI.Length L = 600 "length of the pipe" annotation (
Dialog(group = "Geometry"));
parameter SI.Diameter D_i = 3.3 "Diametr from the inlet side of the pipe" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = D_i "Diametr from the outlet side of the pipe" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 8.55 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = A_i "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Diameter D_i_ = if use_A then sqrt(4 * A_i / pi) else D_i;
+ parameter SI.Diameter D_o_ = if use_A then sqrt(4 * A_o / pi) else D_o;
// condition of steady state
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
// staedy state values for flow rate in all segments of the pipe
@@ -30,7 +38,7 @@ model PenstockKP "Detailed model of the pipe. Could have elastic walls and compr
choices(checkBox = true),
Dialog(group = "Properties"));
// variables
- SI.Diameter dD = (D_i - D_o) / N "step in diameter change", D[N] = linspace(D_i + dD / 2, D_o - dD / 2, N) "centered diameter vector in atm. p.", D_[N + 1] = linspace(D_i, D_o, N + 1) "boundary diameter vector in atm. p.";
+ SI.Diameter dD = (D_i_ - D_o_) / N "step in diameter change", D[N] = linspace(D_i_ + dD / 2, D_o_ - dD / 2, N) "centered diameter vector in atm. p.", D_[N + 1] = linspace(D_i_, D_o_, N + 1) "boundary diameter vector in atm. p.";
SI.Area A_atm[N] = D .* D * pi / 4 "centered cross are vector in atm. p.", A_atm_[N + 1] = D_ .* D_ * pi / 4 "boundary cross are vector in atm. p.", A[N] "centered cross are vector", A_[N, 4] "boundary cross are vector", _A_atm[N, 4] "boundary cross are matrix in atm. p.";
SI.Pressure p_p[N] "centered pressure", dp = data.rho * data.g * H / N "initial p. step", p_i "Inlet pressure (LHS)", p_o "Outlet Pressure (RHS)", p_[N, 4] "boundary p. matrix";
SI.Length dx = L / N "length step", dh = H / N "height step";
@@ -167,7 +175,7 @@ c = √(Ap/(Apatm ρatm βtot
Parameters
User specifies:
-- Geometry: length
L, height difference H, inlet/outlet diameters D_i/D_o,
+ - Geometry: length
L, height difference H, inlet/outlet diameters D_i/D_o or areas A_i/A_o,
roughness p_eps
- Discretization: number of cells
N
- Model fidelity:
PipeElasticity checkbox to enable/disable elastic walls
diff --git a/OpenHPL/Waterway/Pipe.mo b/OpenHPL/Waterway/Pipe.mo
index 2600893..d9a2d81 100644
--- a/OpenHPL/Waterway/Pipe.mo
+++ b/OpenHPL/Waterway/Pipe.mo
@@ -3,17 +3,24 @@ 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_);
// Geometrical parameters of the pipe:
parameter SI.Length H = 0 "Height difference from the inlet to the outlet" annotation (
Dialog(group = "Geometry"));
parameter SI.Length L = 1000 "Length of the pipe" annotation (
Dialog(group = "Geometry"));
- parameter SI.Diameter D_i = 1.0 "Diameter of the inlet side" annotation (
- Dialog(group = "Geometry"));
+ parameter SI.Diameter D_i = 1 "Diameter of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=not use_A));
parameter SI.Diameter D_o = D_i "Diameter of the outlet side" annotation (
- Dialog(group = "Geometry"));
+ Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A_i = 0.785 "Area of the inlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+ parameter SI.Area A_o = A_i "Area of the outlet side" annotation (
+ Dialog(group = "Geometry", enable=use_A));
+
// Steady state:
parameter Boolean SteadyState=data.SteadyState "If true, starts in steady state" annotation (Dialog(group="Initialization"));
@@ -30,13 +37,15 @@ 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.Diameter D_i_ = if use_A then sqrt(4 * A_i / C.pi) else D_i "Equivalent inlet diameter";
+ parameter SI.Diameter D_o_ = if use_A then sqrt(4 * A_o / C.pi) else D_o "Equivalent outlet diameter";
+ parameter SI.Diameter D_ = if use_A then sqrt(4 * A_ / C.pi) else (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 SI.Area A_ = if use_A then (A_i + A_o) / 2 else 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";
- 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";
+ 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";
initial equation
if useInitialFlow then
diff --git a/OpenHPL/Waterway/SurgeTank.mo b/OpenHPL/Waterway/SurgeTank.mo
index 5c3cc3b..b7cda65 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"));
@@ -12,14 +12,22 @@ model SurgeTank "Model of the surge tank/shaft"
parameter SI.Length L = H "Length of the surge shaft"
annotation (Dialog(group = "Geometry"));
parameter SI.Diameter D = 3 "Diameter of the surge shaft"
- annotation (Dialog(group = "Geometry"));
+ annotation (Dialog(group = "Geometry", enable=not use_A));
+ parameter Boolean use_A = false "Use areas instead of diameters" annotation (
+ Dialog(group = "Geometry"), choices(checkBox=true));
+ parameter SI.Area A = 7.07 "Cross-sectional area of the surge shaft"
+ annotation (Dialog(group = "Geometry", enable=use_A));
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));
+ Dialog(group = "Geometry", enable=not use_A and SurgeTankType == OpenHPL.Types.SurgeTank.STSharpOrifice));
+ parameter SI.Area A_so = 7.07 "Area of sharp orifice" annotation (
+ Dialog(group = "Geometry", enable=use_A and SurgeTankType == OpenHPL.Types.SurgeTank.STSharpOrifice));
parameter SI.Diameter D_t = D "If Throttle value type: Diameter of throat" annotation (
- Dialog(group = "Geometry",enable=SurgeTankType == OpenHPL.Types.SurgeTank.STThrottleValve));
+ Dialog(group = "Geometry", enable=not use_A and SurgeTankType == OpenHPL.Types.SurgeTank.STThrottleValve));
+ parameter SI.Area A_t = 7.07 "Area of throttle throat" annotation (
+ Dialog(group = "Geometry", enable=use_A and SurgeTankType == OpenHPL.Types.SurgeTank.STThrottleValve));
parameter SI.Length L_t = L "If Throttle value type: Length of throat" annotation (
Dialog(group = "Geometry",enable=SurgeTankType == OpenHPL.Types.SurgeTank.STThrottleValve));
@@ -39,8 +47,6 @@ model SurgeTank "Model of the surge tank/shaft"
SI.Momentum M "Water momentum";
SI.Force Mdot "Difference in influent and effulent momentum";
SI.Force F "Total force acting in the surge tank";
- SI.Area A = (C.pi*D ^ 2) / 4 "Cross sectional area of the surge tank";
- SI.Area A_t = (C.pi*D_t ^ 2) / 4 "Cross sectional area of the throttle valve surge tank";
SI.Length l = h / cos_theta "Length of water in the surge tank";
Real cos_theta = H / L "Slope ratio";
SI.Velocity v "Water velocity";
@@ -61,6 +67,9 @@ model SurgeTank "Model of the surge tank/shaft"
protected
SI.MassFlowRate mdot_creek "Creek mass flow rate (zero when creek connector is absent)";
+ parameter SI.Diameter D_ = if use_A then sqrt(4 * A / C.pi) else D;
+ parameter SI.Diameter D_so_ = if use_A then sqrt(4 * A_so / C.pi) else D_so;
+ parameter SI.Diameter D_t_ = if use_A then sqrt(4 * A_t / C.pi) else D_t;
initial equation
if SteadyState then
@@ -92,7 +101,7 @@ equation
m = data.rho * A * l;
M = m * v;
p_t = data.p_a;
- F_f = Functions.DarcyFriction.Friction(v, D, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
+ F_f = Functions.DarcyFriction.Friction(v, D_, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
phiSO = 0;
F_p = (p_b - p_t) * A;
elseif SurgeTankType == OpenHPL.Types.SurgeTank.STAirCushion then
@@ -100,7 +109,7 @@ equation
m = data.rho * A * l + m_a;
M = m * v;
p_t = p_ac * ((L - h_0 / cos_theta) / (L - l)) ^ data.gamma_air;
- F_f = Functions.DarcyFriction.Friction(v, D, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
+ F_f = Functions.DarcyFriction.Friction(v, D_, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
phiSO = 0;
F_p = (p_b - p_t) * A;
elseif SurgeTankType == OpenHPL.Types.SurgeTank.STSharpOrifice then
@@ -108,19 +117,19 @@ equation
m = data.rho * A * l;
M = m * v;
p_t = data.p_a;
- F_f = Functions.DarcyFriction.Friction(v, D, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
+ F_f = Functions.DarcyFriction.Friction(v, D_, l, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(v) * v;
F_p = (p_b - p_t) * A;
if v >= 0 then
- phiSO = Functions.Fitting.FittingPhi(v, D, D_so, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.SharpOrifice);
+ phiSO = Functions.Fitting.FittingPhi(v, D_, D_so_, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.SharpOrifice);
else
- phiSO = Functions.Fitting.FittingPhi(v, D_so, D, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.SharpOrifice);
+ phiSO = Functions.Fitting.FittingPhi(v, D_so_, D_, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.SharpOrifice);
end if;
elseif SurgeTankType == OpenHPL.Types.SurgeTank.STThrottleValve then
if l <= L_t then
v = Vdot / A_t;
m = data.rho * A_t * l;
M = m * v;
- F_f = Functions.DarcyFriction.Friction(v, D_t, l, data.rho, data.mu, p_eps) + A_t * phiSO * 0.5 * data.rho * abs(v) * v;
+ F_f = Functions.DarcyFriction.Friction(v, D_t_, l, data.rho, data.mu, p_eps) + A_t * phiSO * 0.5 * data.rho * abs(v) * v;
phiSO = 0;
F_p = (p_b - p_t) * A_t;
else
@@ -128,11 +137,11 @@ equation
m = data.rho * (A_t * L_t + A * (l - L_t));
M = m * v;
if v > 0 then
- F_f = Functions.DarcyFriction.Friction(Vdot/A_t, D_t, L_t, data.rho, data.mu, p_eps) + Functions.DarcyFriction.Friction(Vdot/A, D, l - L_t, data.rho, data.mu, p_eps) + A_t * phiSO * 0.5 * data.rho * abs(Vdot/A_t) * Vdot/A_t;
- phiSO = Functions.Fitting.FittingPhi(Vdot/A_t, D_t, D, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.Square);
+ F_f = Functions.DarcyFriction.Friction(Vdot/A_t, D_t_, L_t, data.rho, data.mu, p_eps) + Functions.DarcyFriction.Friction(Vdot/A, D_, l - L_t, data.rho, data.mu, p_eps) + A_t * phiSO * 0.5 * data.rho * abs(Vdot/A_t) * Vdot/A_t;
+ phiSO = Functions.Fitting.FittingPhi(Vdot/A_t, D_t_, D_, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.Square);
elseif v < 0 then
- F_f = Functions.DarcyFriction.Friction(Vdot/A_t, D_t, L_t, data.rho, data.mu, p_eps) + Functions.DarcyFriction.Friction(Vdot/A, D, l - L_t, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(Vdot/A) * Vdot/A;
- phiSO = Functions.Fitting.FittingPhi(Vdot/A, D, D_t, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.Square);
+ F_f = Functions.DarcyFriction.Friction(Vdot/A_t, D_t_, L_t, data.rho, data.mu, p_eps) + Functions.DarcyFriction.Friction(Vdot/A, D_, l - L_t, data.rho, data.mu, p_eps) + A * phiSO * 0.5 * data.rho * abs(Vdot/A) * Vdot/A;
+ phiSO = Functions.Fitting.FittingPhi(Vdot/A, D_, D_t_, L, 90, data.rho, data.mu, p_eps, OpenHPL.Types.Fitting.Square);
else
F_f = 0;
phiSO = 0;
@@ -213,7 +222,8 @@ $$ z_\\mathrm{creek} = z_\\mathrm{o} + H_\\mathrm{creek} $$
Parameters and Initialization
-Required geometry parameters: length L, height H, diameter D,
+
Required geometry parameters: length L, height H, shaft diameter D or area A,
+and, for restricted configurations, orifice/throat diameters Dso/Dt or areas Aso/At,
roughness pε, and atmospheric pressure patm. Initialize with flow rate V̇0
and water height h0. Option for steady-state initialization is available.
"));