Skip to content
Merged
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
3 changes: 3 additions & 0 deletions OpenHPL/ElectroMech/Turbines/Francis.mo
Original file line number Diff line number Diff line change
Expand Up @@ -60,6 +60,7 @@ model Francis "Model of the Francis turbine"
SI.Area A_1 "Runner inlet cross section", A_0 "Turbine inlet cross section", A_v "Guide vane cross section", A_2 "Runner outlet cross section";
SI.EnergyFlowRate Wdot_s "Shaft power", Wdot_ft "Total runner losses", W_t1 "Euler first term", W_t2 "Euler second term", Wdot_ft_s "Shock losses", Wdot_ft_w "Whirl losses", Wdot_ft_l "Friction losses", Wdot_t "Total power";
SI.VolumeFlowRate Vdot "Flow rate";
SI.MassFlowRate mdot "Mass flow rate";
SI.AngularVelocity w=w_in "Angular velocity";
SI.Velocity u_2 "Outlet reference velocity", c_m2 "Outlet meridional velocity", c_m1 "Inlet meridional velocity", u_1 "Inlet reference velocity", c_u1 "Inlet tangential velocity";
Modelica.Units.NonSI.Angle_deg beta1 "Inlet blade angle";
Expand Down Expand Up @@ -202,6 +203,8 @@ equation
coef = Wdot_s / Wdot_t;
// connectors
p_tr2 = o.p;
i.mdot+o.mdot=0;
mdot=i.mdot;
// output mechanical power
P_out = Wdot_s;
annotation (
Expand Down
4 changes: 4 additions & 0 deletions OpenHPL/ElectroMech/Turbines/Pelton.mo
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ model Pelton "Model of the Pelton turbine"
SI.Area A_1, A_0 = pi * D_0 ^ 2 / 4;
SI.EnergyFlowRate Wdot_s "Shaft power";
SI.VolumeFlowRate Vdot "Flow rate";
SI.MassFlowRate mdot "Mass flow rate";
SI.Velocity v_R, v_1;
SI.AngularVelocity w=w_in "Angular velocity";
Real cos_b = Modelica.Math.cos(Modelica.Units.Conversions.from_deg(beta));
Expand Down Expand Up @@ -45,6 +46,9 @@ equation
p_tr1 = i.p;
// + dp_n;
p_tr2 = o.p;
// Flow rate connectors
i.mdot+o.mdot=0;
mdot=i.mdot;
// output mechanical power
P_out = Wdot_s;
annotation (
Expand Down
3 changes: 3 additions & 0 deletions OpenHPL/ElectroMech/Turbines/Turbine.mo
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ model Turbine "Simple turbine model with mechanical connectors"
extends OpenHPL.Interfaces.TurbineContacts;

SI.Pressure dp "Turbine pressure drop";
SI.MassFlowRate mdot "Turbine pressure drop";
SI.EnergyFlowRate Kdot_i_tr "Kinetic energy flow";
SI.VolumeFlowRate Vdot "Flow rate";
Real C_v_ "Guide vane 'valve capacity'";
Expand All @@ -46,6 +47,8 @@ equation
"Define guide vane 'valve capacity' base on the Nominal turbine parameters";
dp = Vdot ^ 2 * data.p_a / (C_v_ * max(1e-6, u_t)) ^ 2 "Turbine valve equation for pressure drop";
dp = i.p - o.p "Link the pressure drop to the ports";
i.mdot+o.mdot=0 "Mass balance";
mdot = i.mdot "Flow direction";
Kdot_i_tr = dp * Vdot "Turbine energy balance";
if ConstEfficiency then
Wdot_s = eta_h * Kdot_i_tr;
Expand Down
20 changes: 0 additions & 20 deletions OpenHPL/Interfaces/ContactNode.mo

This file was deleted.

14 changes: 0 additions & 14 deletions OpenHPL/Interfaces/ContactPort.mo

This file was deleted.

2 changes: 1 addition & 1 deletion OpenHPL/Interfaces/TurbineContacts.mo
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
within OpenHPL.Interfaces;
partial model TurbineContacts "Model of turbine connectors"
extends Interfaces.ContactPort;
extends Interfaces.TwoContacts;
parameter Boolean enable_P_out = false "If checked, get a connector for the output power"
annotation (choices(checkBox = true), Dialog(group="Outputs",tab="I/O"));
input Modelica.Blocks.Interfaces.RealInput u_t "[Guide vane|nozzle] opening of the turbine" annotation (Placement(transformation(
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
within OpenHPL.Interfaces;
partial model TwoContact "Model of two connectors"
partial model TwoContacts "Model of two connectors"
Contact_i i "Inlet contact (positive design flow direction is from i to o)"
annotation (
Placement(transformation(extent={{-110,-10},{-90,10}})));
Expand All @@ -12,4 +12,4 @@ partial model TwoContact "Model of two connectors"
Can be used in cases where model is needed inlet and outlet Contacts, but do not need
any specification about mass flow rate and pressures between these Contacts.</p>
</html>"));
end TwoContact;
end TwoContacts;
4 changes: 1 addition & 3 deletions OpenHPL/Interfaces/package.order
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
Contact
Contact_i
Contact_o
TwoContact
ContactPort
ContactNode
TurbineContacts
TwoContacts
7 changes: 5 additions & 2 deletions OpenHPL/Waterway/BendPipe.mo
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,15 @@ model BendPipe "Bend in pipes"
SI.Velocity v(start=Modelica.Constants.eps) "Water velocity";
SI.Area A = pi*D_i^2/4 "Cross section area";
SI.Pressure dp "Pressure drop of fitting";
/* Connector */
extends OpenHPL.Interfaces.ContactPort;
SI.MassFlowRate mdot "Pressure drop of fitting";
extends OpenHPL.Interfaces.TwoContacts;
equation
v = mdot / data.rho / A;
dp = K_L * 0.5 * data.rho * v^2;
// Connections
o.p = i.p - dp "Pressure of the output connector";
i.mdot + o.mdot = 0 "Mass balance";
mdot = i.mdot "Flow direction";
annotation (
Documentation(info="<html>
<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>
Expand Down
5 changes: 4 additions & 1 deletion OpenHPL/Waterway/DraftTube.mo
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@ model DraftTube "Model of a draft tube for reaction turbines"
SI.Pressure p_i "Inlet pressure";
SI.Pressure p_o "Outlet pressure";
SI.Pressure dp = p_o-p_i "Pressure drop in and out of draft tube";
SI.MassFlowRate mdot "Mass flow rate";
Real phi_d "Generalized friction factor for draft tube";
Real phi_d_o "Initial generalized friction factor for Moody spreading pipes";

Expand All @@ -81,7 +82,7 @@ model DraftTube "Model of a draft tube for reaction turbines"
theta_moody/2)) "Calculating cos_theta_moody_by_2";

// connectors
extends OpenHPL.Interfaces.ContactPort;
extends OpenHPL.Interfaces.TwoContacts;
initial equation
if SteadyState then
der(M) = 0;
Expand Down Expand Up @@ -150,6 +151,8 @@ equation
// connector
p_i = i.p;
p_o = o.p;
i.mdot+o.mdot=0;
mdot = i.mdot;
annotation (Documentation(info="<html>
<p>Two of the draft tubes are modeled using <em>Momentum balance</em>.
They are:</p>
Expand Down
5 changes: 4 additions & 1 deletion OpenHPL/Waterway/Fitting.mo
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ model Fitting "Different pipes fitting"
SI.Velocity v(start=Modelica.Constants.eps) "Water velocity";
SI.Area A "Cross section area";
SI.Pressure dp "Pressure drop of fitting";
SI.MassFlowRate mdot "Mass flow rate";
Real phi "Dimensionless factor based on the type of fitting ";
/* Connector */
extends OpenHPL.Interfaces.ContactPort;
extends OpenHPL.Interfaces.TwoContacts;
equation
v = mdot / data.rho / A;
if v>=0 then
Expand Down Expand Up @@ -50,6 +51,8 @@ equation
dp = - phi * 0.5 * data.rho * v^2;
end if;
o.p = i.p - dp "Pressure of the output connector";
i.mdot+o.mdot = 0 "Mass balance";
mdot = i.mdot "Flow direction";
annotation (
Documentation(info="<html>
<p>Various possibilities of the fittings for the pipes with different diameters
Expand Down
2 changes: 1 addition & 1 deletion OpenHPL/Waterway/OpenChannel.mo
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ model OpenChannel "Open channel model (use KP scheme)"
SI.VolumeFlowRate Vdot_i "Inlet flow rate";
SI.Height h[N] "Water level in each unit of the channel";
// connector
extends OpenHPL.Interfaces.TwoContact;
extends OpenHPL.Interfaces.TwoContacts;
// using open channel example from KP method class
Internal.KPOpenChannel openChannel(
N=N,
Expand Down
2 changes: 1 addition & 1 deletion OpenHPL/Waterway/Penstock.mo
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ model Penstock "Model of the penstock with elastic walls and compressible water.
SI.Density rho_m[N - 2], rho_m_end, rho_m_first;
SI.Velocity v_exp[N];
SI.VolumeFlowRate V_p_out[N - 2], V_p_out_end;
extends OpenHPL.Interfaces.TwoContact;
extends OpenHPL.Interfaces.TwoContacts;
initial equation
mdot_R = data.rho * Vdot_0;
mdot_V = data.rho * Vdot_0;
Expand Down
2 changes: 1 addition & 1 deletion OpenHPL/Waterway/PenstockKP.mo
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ model PenstockKP "Detailed model of the pipe. Could have elastic walls and compr
SI.VolumeFlowRate Vdot[N] "centered volumetric flow";
SI.Force F_f[N] "centered friction force vector";
Real theta = 1.3 "parameter for slope limiter";
extends OpenHPL.Interfaces.TwoContact;
extends OpenHPL.Interfaces.TwoContacts;
public
Functions.KP07.KPmethod KP(N = N, U = U, dx = dx, theta = theta, B = zeros(N + 4), S_ = S_, F_ = F_, lam1 = lam1, lam2 = lam2, boundary = [p_i, 0; p_o, 0], boundaryCon = [true, false; true, false]);
// specify all variables which is needed for using KP method for solve PDE
Expand Down
8 changes: 6 additions & 2 deletions OpenHPL/Waterway/Pipe.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within OpenHPL.Waterway;
model Pipe "Model of a pipe"
outer Data data "Using standard data set";
extends OpenHPL.Icons.Pipe;
extends OpenHPL.Interfaces.ContactPort;
extends OpenHPL.Interfaces.TwoContacts;

// Geometrical parameters of the pipe:
parameter SI.Length H = 25 "Height difference from the inlet to the outlet" annotation (
Expand Down Expand Up @@ -35,6 +35,7 @@ model Pipe "Model of a pipe"
SI.Pressure p_i "Inlet pressure";
SI.Pressure p_o "Outlet pressure";
SI.Pressure dp=p_o-p_i "Pressure difference across the pipe";
SI.MassFlowRate mdot "Mass flow rate";
SI.VolumeFlowRate Vdot(start = Vdot_0) "Volume flow rate";

/* TBD:
Expand Down Expand Up @@ -71,8 +72,11 @@ equation
- F_f - F_taper
+ m * data.g * cos_theta
"Momentum balance including tapering loss";
p_i = i.p "Inlet pressure";
// Connnections
p_i = i.p "Inlet pressure";
p_o = o.p "Outlet pressure";
i.mdot+o.mdot = 0 "Mass balance";
mdot = i.mdot "Inlet direction for mdot";

/* TBD:
// possible temperature variation implementation. Not finished...
Expand Down
7 changes: 5 additions & 2 deletions OpenHPL/Waterway/SurgeTank.mo
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ within OpenHPL.Waterway;
model SurgeTank "Model of the surge tank/shaft"
outer Data data "Using standard data set";
extends OpenHPL.Icons.Surge(lds=l, Lds=L);
extends OpenHPL.Interfaces.ContactNode;
extends OpenHPL.Interfaces.TwoContacts;
import Modelica.Constants.pi;

parameter Types.SurgeTank SurgeTankType = OpenHPL.Types.SurgeTank.STSimple "Types of surge tank" annotation (
Expand Down Expand Up @@ -39,6 +39,7 @@ model SurgeTank "Model of the surge tank/shaft"
//parameter SI.Temperature T_i = data.T_i "Initial water temperature in the pipe" annotation (Dialog(group = "Initialization", enable = TempUse));
// variables
SI.Mass m "Water mass";
SI.MassFlowRate mdot "Mass flow rate";
SI.Mass m_a = p_ac*A*(L-h_0/cos_theta)*data.M_a/(Modelica.Constants.R*T_ac) "Air mass inside surge tank";
SI.Momentum M "Water momentum";
SI.Force Mdot "Difference in influent and effulent momentum";
Expand Down Expand Up @@ -129,7 +130,9 @@ equation
mdot = data.rho * Vdot;
Mdot = mdot * v;
F = F_p - F_f - F_g;
p_b = p_n "Linking bottom node pressure to connector";
p_b = i.p "Linking bottom node pressure to connector";
i.p = o.p "Inlet and outlet pressure equality";
mdot = i.mdot+o.mdot "Mass balance";
F_g = m * data.g * cos_theta;
annotation (
Documentation(info="<html>
Expand Down