model PipeWithoutCapacity
import HydraulicsByFluidon.Media.Base.FluidInterface;
import HydraulicsByFluidon.Tools.Pipes;
import SI = Modelica.SIunits;
parameter SI.Length diameter(displayUnit = "mm") = 0.032 "inner diameter"
annotation (Dialog(group = "Geometry"));
parameter SI.Length length = 1 "pipe length"
annotation (Dialog(group = "Geometry"));
parameter SI.Length deltaH = 0 "height difference"
annotation (Dialog(group = "Geometry"));
parameter SI.DimensionlessRatio relRoughness = 1e-6 "inner surface relative roughness"
annotation (Dialog(group = "Geometry"));
extends HydraulicsByFluidon.Components.Base.HydTwoPortVertical;
Real reynoldsNo;
Real lambda;
protected
outer HydraulicsByFluidon.Media.Environment environment;
parameter SI.Area area = Modelica.Constants.pi * diameter ^ 2 * (0.25);
parameter Real fricConstant = 0.5 * length / (area ^ 2 * diameter);
Real inductivity = length / area;
Real dpOffset;
Real dpFric;
Real rho;
Real eta;
Real inductivityCorrection;
equation
fluidPortB.mFlow + fluidPortA.mFlow = 0;
dpFric = Pipes.calcDpFric(relRoughness, fluidPortA.mFlow, rho, eta, fricConstant, diameter);
dpOffset = deltaH * environment.g * rho;
eta = rho * (0.5) * (FluidInterface.calcNu(fluidPortA.fluidId, fluidPortA.p, fluidPortA.fluidTemperature) + FluidInterface.calcNu(fluidPortB.fluidId, fluidPortB.p, fluidPortB.fluidTemperature));
lambda = Pipes.calcLambda(relRoughness, reynoldsNo);
rho = 0.5 * (FluidInterface.calcRho(fluidPortA.fluidId, fluidPortA.p, fluidPortA.fluidTemperature) + FluidInterface.calcRho(fluidPortB.fluidId, fluidPortB.p, fluidPortB.fluidTemperature));
reynoldsNo = abs(4 * fluidPortB.mFlow / (eta * Modelica.Constants.pi * diameter));
inductivityCorrection = if noEvent(reynoldsNo < 2320) then 1.333333333333333 else 1;
der(fluidPortA.mFlow) = (fluidPortA.p - (fluidPortB.p + dpOffset) - dpFric) / (inductivity * inductivityCorrection);
annotation (
defaultComponentName = "pipe",
Icon(
coordinateSystem(initialScale = 0.1),
graphics = {
Text(
origin = {200, -40},
lineColor = {0, 0, 255},
extent = {
{-160, 120},
{175, 80}},
textString = "%name",
horizontalAlignment = TextAlignment.Left),
Polygon(
origin = {21, 68},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid,
points = {
{-39, 20},
{-45, 18},
{-50, 14.55},
{-51, 12},
{-51, -148},
{9, -148},
{9, 12},
{8, 14.55},
{3, 18},
{-3, 20},
{-15, 22},
{-27, 22},
{-39, 20}}),
Ellipse(
origin = {15, -86},
fillColor = {200, 200, 200},
fillPattern = FillPattern.Solid,
extent = {
{-45, 16},
{15, -4}},
endAngle = 360),
Text(
origin = {0, -40},
lineColor = {0, 0, 255},
fillColor = {0, 0, 255},
extent = {
{-78, -20},
{78, 20}},
textString = "A"),
Text(
origin = {0, 60},
lineColor = {0, 0, 255},
fillColor = {0, 0, 255},
extent = {
{-78, -20},
{78, 20}},
textString = "B")}),
Documentation(info = "<html>\n <p>\n Pipe model with resistive and inductive properties.\n </p> \n <p>\n The pressure drop calculation is based on the assumption \n of quasi-steady friction. For turbulent flow through hydraulically \n rough pipes, the relative surface roughness (relRoughness) is taken into account. \n Geodetic pressure offset due to height differences between the pipe\n ports is considered in the simulation. The height difference deltaH is measured as the \n vertical distance between port B and port A of the pipe.\n </p>\n <p>\n The calculated inductance depends on the flow regime (laminar or turbulent). The laminar inductance\n exceeds the turbulent one by a factor of 4/3.\n </p>\n <p>\n If the parameter flowInitialization is activated, the initial mass flow rate will be calculated based on\n the potential difference between the two ports. If the check mark is not set, the initial flow rate will\n be zero even if a potential difference is present.\n </p>\n <p>\n <b>Please note</b>: almost in every case it is necessary to add volumes at both ports.\n </p>\n </html>"));
end PipeWithoutCapacity;