Skip to content

Commit 3ff1273

Browse files
committed
Add a new elevation z to contact
The elevation gets automatically propagated via the connects
1 parent e73f920 commit 3ff1273

17 files changed

Lines changed: 42 additions & 2 deletions

File tree

OpenHPL/ElectroMech/BaseClasses/BaseValve.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ equation
3434
Vdot = mdot/data.rho;
3535
dp*(C_v_*max(epsilon, u^alpha))^2 = Vdot*abs(Vdot) "Valve equation for pressure drop";
3636
dp = i.p - o.p "Link the pressure drop to the ports";
37+
o.z = i.z "Elevation propagation: no height change across valve";
3738
annotation (preferredView="info", Documentation(info="<html>
3839
<p>
3940
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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -210,6 +210,7 @@ equation
210210
p_tr2 = o.p;
211211
i.mdot+o.mdot=0;
212212
mdot=i.mdot;
213+
o.z = i.z "Elevation propagation: no height change across turbine";
213214

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

OpenHPL/ElectroMech/Turbines/Pelton.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -54,6 +54,7 @@ equation
5454
// Flow rate connectors
5555
i.mdot+o.mdot=0;
5656
mdot=i.mdot;
57+
o.z = i.z "Elevation propagation: no height change across turbine";
5758

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

OpenHPL/Interfaces/Contact.mo

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,20 @@ connector Contact "Water flow connector"
33
SI.Pressure p "Contact pressure";
44
//SI.Temperature T "Contact temperature";
55
flow SI.MassFlowRate mdot "Mass flow rate through the contact";
6+
SI.Height z "Elevation at connection point";
67
annotation (
78
Documentation(info = "<html>
8-
<p>Contact is a basic water flow connector, which consists of water pressure and mass flow rate through the connector (positive if water is flowing into connector and negative if flowing out).</p>
9+
<p>Contact is a basic water flow connector, which consists of water pressure, mass flow rate,
10+
and elevation at the connector (positive if water is flowing into connector and negative if flowing out).</p>
11+
12+
<h5>Variables</h5>
13+
<ul>
14+
<li><code>p</code> &ndash; Pressure (potential variable, equated across connections)</li>
15+
<li><code>mdot</code> &ndash; Mass flow rate (flow variable, summed to zero across connections)</li>
16+
<li><code>z</code> &ndash; Elevation (potential variable, equated across connections).
17+
Each component provides an equation relating its connector elevations,
18+
enabling automatic propagation of absolute elevation through the system.
19+
Source components (e.g., Reservoir) set the absolute reference elevation.</li>
20+
</ul>
921
</html>"));
1022
end Contact;

OpenHPL/Waterway/BendPipe.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ equation
2323
o.p = i.p - dp "Pressure of the output connector";
2424
i.mdot + o.mdot = 0 "Mass balance";
2525
mdot = i.mdot "Flow direction";
26+
o.z = i.z "Elevation propagation: no height change across bend";
2627
annotation (preferredView="info",
2728
Documentation(info="<html>
2829
<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 & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -153,6 +153,7 @@ equation
153153
p_o = o.p;
154154
i.mdot+o.mdot=0;
155155
mdot = i.mdot;
156+
o.z = i.z - H "Elevation propagation: outlet is H below inlet";
156157
annotation (preferredView="info", Documentation(info="<html>
157158
<p>Two of the draft tubes are modeled using <em>Momentum balance</em>.
158159
They are:</p>

OpenHPL/Waterway/Fitting.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,7 @@ equation
5353
o.p = i.p - dp "Pressure of the output connector";
5454
i.mdot+o.mdot = 0 "Mass balance";
5555
mdot = i.mdot "Flow direction";
56+
o.z = i.z "Elevation propagation: no height change across fitting";
5657
annotation (preferredView="info",
5758
Documentation(info="<html>
5859
<p>Various possibilities of the fittings for the pipes with different diameters

OpenHPL/Waterway/Gate.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,7 @@ equation
5151
mdot = Vdot * data.rho "Mass flow rate through the gate";
5252
i.p = h_0 * data.g * data.rho + data.p_a "Inlet water pressure";
5353
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";
5455
annotation (
5556
preferredView="info",
5657
Documentation(info="<html>

OpenHPL/Waterway/Gate_HR.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@ equation
5050
mdot = Vdot * data.rho "Mass flow rate through the gate";
5151
i.p = h_i * data.g * data.rho + data.p_a "Inlet water pressure";
5252
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";
5354
annotation (
5455
preferredView="info",
5556
Documentation(info="<html>

OpenHPL/Waterway/OpenChannel.mo

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ equation
3939
// presurre boundaries
4040
i.p = h[1] * data.g * data.rho + data.p_a;
4141
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]";
4243
annotation (preferredView="info",
4344
Documentation(info="<html>
4445
<p style=\"color: #ff0000;\"><em>Note: Currently under investigation for plausibility.</em></p>

0 commit comments

Comments
 (0)