Skip to content

Commit 06309dd

Browse files
committed
Move z equation from initial to regular equation section
1 parent e050eef commit 06309dd

16 files changed

Lines changed: 16 additions & 32 deletions

OpenHPL/ElectroMech/BaseClasses/BaseValve.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -28,14 +28,13 @@ protected
2828
annotation (Placement(transformation(origin = {0, 70}, extent = {{-10, -10}, {10, 10}}, rotation = 270), iconTransformation(extent = {{-20, -20}, {20, 20}}, rotation = 270, origin = {0, 80})));
2929
constant Real epsilon = 5.0e-5 "Constant to ensure robust expression for dp vs flow. Trial and error to find suitable value.";
3030

31-
initial equation
32-
o.z = i.z "Elevation propagation: no height change across valve";
3331
equation
3432
i.mdot + o.mdot = 0;
3533
mdot = i.mdot;
3634
Vdot = mdot/data.rho;
3735
dp*(C_v_*max(epsilon, u^alpha))^2 = Vdot*abs(Vdot) "Valve equation for pressure drop";
3836
dp = i.p - o.p "Link the pressure drop to the ports";
37+
o.z = i.z "Elevation propagation: no height change across valve";
3938
annotation (preferredView="info", Documentation(info="<html>
4039
<p>
4140
This is a partial, simple model of hydraulic valve. &nbsp;</p><p>This model is based on the energy balance of a valve.

OpenHPL/ElectroMech/Turbines/Francis.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -88,8 +88,6 @@ protected
8888
extent={{-10,-10},{10,10}},
8989
rotation=90,
9090
origin={40,90})));
91-
initial equation
92-
o.z = i.z "Elevation propagation: no height change across turbine";
9391
equation
9492
// design algorithm for runner
9593
if GivenData then
@@ -212,6 +210,7 @@ equation
212210
p_tr2 = o.p;
213211
i.mdot+o.mdot=0;
214212
mdot=i.mdot;
213+
o.z = i.z "Elevation propagation: no height change across turbine";
215214

216215
connect(p_out, P_out) annotation (Line(points={{40,90},{40,110}}, color={0,0,127}));
217216
annotation (preferredView="info",

OpenHPL/ElectroMech/Turbines/Pelton.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ protected
3030
extent={{-10,-10},{10,10}},
3131
rotation=90,
3232
origin={40,90})));
33-
initial equation
34-
o.z = i.z "Elevation propagation: no height change across turbine";
3533
equation
3634
// Condition for inlet water compressibility
3735
if not CompElas then
@@ -56,6 +54,7 @@ equation
5654
// Flow rate connectors
5755
i.mdot+o.mdot=0;
5856
mdot=i.mdot;
57+
o.z = i.z "Elevation propagation: no height change across turbine";
5958

6059
connect(p_out, P_out) annotation (Line(points={{40,90},{40,110}}, color={0,0,127}));
6160
annotation (preferredView="info",

OpenHPL/Waterway/BendPipe.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,15 +16,14 @@ model BendPipe "Bend in pipes"
1616
SI.Pressure dp "Pressure drop of fitting";
1717
SI.MassFlowRate mdot "Mass flow rate";
1818
extends OpenHPL.Interfaces.TwoContacts;
19-
initial equation
20-
o.z = i.z "Elevation propagation: no height change across bend";
2119
equation
2220
v = mdot / data.rho / A;
2321
dp = K_L * 0.5 * data.rho * v^2;
2422
// Connections
2523
o.p = i.p - dp "Pressure of the output connector";
2624
i.mdot + o.mdot = 0 "Mass balance";
2725
mdot = i.mdot "Flow direction";
26+
o.z = i.z "Elevation propagation: no height change across bend";
2827
annotation (preferredView="info",
2928
Documentation(info="<html>
3029
<p>Usually minor head losses in pipes are considered to be due to fittings, diffusers, nozzles, bend in pipes, etc. We are more interested in head loss due to bend pipes for this model.</p>

OpenHPL/Waterway/DraftTube.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,6 @@ initial equation
9191
Vdot = Vdot_0;
9292
//n.T = p.T;
9393
end if;
94-
o.z = i.z - H "Elevation propagation: outlet is H below inlet";
9594
equation
9695
der(M) = Mdot + F "Momentum balance";
9796
if DraftTubeType == OpenHPL.Types.DraftTube.ConicalDiffuser then
@@ -154,6 +153,7 @@ equation
154153
p_o = o.p;
155154
i.mdot+o.mdot=0;
156155
mdot = i.mdot;
156+
o.z = i.z - H "Elevation propagation: outlet is H below inlet";
157157
annotation (preferredView="info", Documentation(info="<html>
158158
<p>Two of the draft tubes are modeled using <em>Momentum balance</em>.
159159
They are:</p>

OpenHPL/Waterway/Fitting.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ model Fitting "Different pipes fitting"
2121
Real phi "Dimensionless factor based on the type of fitting ";
2222
/* Connector */
2323
extends OpenHPL.Interfaces.TwoContacts;
24-
initial equation
25-
o.z = i.z "Elevation propagation: no height change across fitting";
2624
equation
2725
v = mdot / data.rho / A;
2826
if v>=0 then
@@ -55,6 +53,7 @@ equation
5553
o.p = i.p - dp "Pressure of the output connector";
5654
i.mdot+o.mdot = 0 "Mass balance";
5755
mdot = i.mdot "Flow direction";
56+
o.z = i.z "Elevation propagation: no height change across fitting";
5857
annotation (preferredView="info",
5958
Documentation(info="<html>
6059
<p>Various possibilities of the fittings for the pipes with different diameters

OpenHPL/Waterway/Gate.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,6 @@ model Gate "Model of a sluice or tainter gate based on [Bollrich2019]"
2525
extent={{-20,-20},{20,20}},
2626
rotation=270,
2727
origin={0,120})));
28-
initial equation
29-
o.z = i.z "Elevation propagation: gate at same elevation";
3028
equation
3129
mu_A = psi/sqrt(1+psi*a/h_0);
3230
if sluice then
@@ -53,6 +51,7 @@ equation
5351
mdot = Vdot * data.rho "Mass flow rate through the gate";
5452
i.p = h_0 * data.g * data.rho + data.p_a "Inlet water pressure";
5553
o.p = h_2 * data.g * data.rho + data.p_a "Outlet water pressure";
54+
o.z = i.z "Elevation propagation: gate at same elevation";
5655
annotation (
5756
preferredView="info",
5857
Documentation(info="<html>

OpenHPL/Waterway/Gate_HR.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,6 @@ protected
3333
SI.VolumeFlowRate Vdot_full "Fully submerged base volume flow rate through the gate";
3434
Real Cdx "Discharge coefficient tuned for a smooth transition between partially and fully submerged";
3535

36-
initial equation
37-
o.z = i.z "Elevation propagation: gate at same elevation";
3836
equation
3937
i.mdot+o.mdot = 0 "Mass balance";
4038
mdot = i.mdot "Inlet direction for mdot";
@@ -52,6 +50,7 @@ equation
5250
mdot = Vdot * data.rho "Mass flow rate through the gate";
5351
i.p = h_i * data.g * data.rho + data.p_a "Inlet water pressure";
5452
o.p = h_o * data.g * data.rho + data.p_a "Outlet water pressure";
53+
o.z = i.z "Elevation propagation: gate at same elevation";
5554
annotation (
5655
preferredView="info",
5756
Documentation(info="<html>

OpenHPL/Waterway/OpenChannel.mo

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,8 +30,6 @@ model OpenChannel "Open channel model (use KP scheme)"
3030
boundaryValues=[h_0[1] + H[1],Vdot_i/W; h_0[N] + H[2],Vdot_o/W],
3131
boundaryCondition=BoundaryCondition,
3232
SteadyState=SteadyState) annotation (Placement(transformation(extent={{-10,-8},{10,12}})));
33-
initial equation
34-
o.z = i.z - (H[1] - H[2]) "Elevation propagation: channel bed drops from H[1] to H[2]";
3533
equation
3634
// define a vector of the water depth in the channel
3735
h = openChannel.h;
@@ -41,6 +39,7 @@ equation
4139
// presurre boundaries
4240
i.p = h[1] * data.g * data.rho + data.p_a;
4341
o.p = h[N] * data.g * data.rho + data.p_a;
42+
o.z = i.z - (H[1] - H[2]) "Elevation propagation: channel bed drops from H[1] to H[2]";
4443
annotation (preferredView="info",
4544
Documentation(info="<html>
4645
<p style=\"color: #ff0000;\"><em>Note: Currently under investigation for plausibility.</em></p>

OpenHPL/Waterway/Penstock.mo

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ initial equation
3333
mdot_V = data.rho * Vdot_0;
3434
mdot = data.rho * Vdot_0 * ones(N - 2);
3535
p_ = p_i + dp:dp:p_i + dp * (N - 1);
36-
o.z = i.z - H "Outlet elevation is H below inlet";
3736
equation
3837
// Pipe flow rate
3938
mdot_R = i.mdot;
@@ -84,6 +83,7 @@ equation
8483
// volumetric flow rates for all cells
8584
V_p_out = mdot ./ rho_m;
8685
V_p_out_end = mdot_V / (data.rho * (1 + data.beta * (p_o - data.p_a)));
86+
o.z = i.z - H "Outlet elevation is H below inlet";
8787
annotation (preferredView="info",
8888
Documentation(info="<html><head></head><body><p>This is a more detaied model of the pipe that can be use for proper modeling of penstock. (This model does not work well. Instead PenstockKP model can be used.)</p><p>The model for the penstock with the elastic walls and compressible water with simple discretization method (Staggered grid). The geometry of the penstock is described due to figure:</p>
8989
<p><img src=\"modelica://OpenHPL/Resources/Images/pipe.svg\"></p>

0 commit comments

Comments
 (0)