model Bend "Bend"
outer HydraulicsByFluidon.Media.Environment environment;
parameter Modelica.SIunits.Length Diameter = 0.032 "Diameter";
parameter Modelica.SIunits.Angle BendAngle(min = 0.005555555555556 * (15 * Modelica.Constants.pi), max = 0.005555555555556 * (180 * Modelica.Constants.pi)) = 0.5 * Modelica.Constants.pi "Bend angle";
parameter Modelica.SIunits.Length BendRadius(min = 1e-4) = 0.1 "Bend radius";
parameter Modelica.SIunits.DimensionlessRatio relRoughness = 1e-6 "Relative roughness";
parameter Modelica.SIunits.Volume deadVolume(final min = 1e-9) = 1e-6 "Dead volume at ports";
parameter Boolean forwardFluidProperties = true "Forward fluid properties between ports"
annotation (
Dialog(tab = "Fluid Properties"),
choices(checkBox = true));
HydraulicsByFluidon.Interfaces.FluidPort fluidPortA(p(start = 101325, nominal = 100000)) "Hydraulic port A"
annotation (Placement(transformation(extent = {
{-110, -10},
{-90, 10}})));
HydraulicsByFluidon.Interfaces.FluidPort fluidPortB(p(start = 101325, nominal = 100000)) "Hydraulic port B"
annotation (Placement(transformation(extent = {
{-10, 110},
{10, 90}})));
HydraulicsByFluidon.Components.Lines.Base.SimpleBend simpleBend(forwardFluidProperties = false, Diameter = Diameter, BendAngle = BendAngle, BendRadius = BendRadius, relRoughness = relRoughness) annotation (Placement(
visible = true,
transformation(
origin = {-3, 3},
extent = {
{-12, -10},
{12, 10}},
rotation = 0)));
HydraulicsByFluidon.Components.Volumes.Volume volumeB(capacity = deadVolume) annotation (Placement(
visible = true,
transformation(
origin = {0, 70},
extent = {
{-10, -10},
{10, 10}},
rotation = 0)));
HydraulicsByFluidon.Components.Volumes.Volume volumeA(capacity = deadVolume) annotation (Placement(
visible = true,
transformation(
origin = {-70, 0},
extent = {
{-10, -10},
{10, 10}},
rotation = 0)));
Modelica.SIunits.AbsolutePressure pA(start = environment.pAmbient, nominal = 100000) "Pressure at port A";
Modelica.SIunits.AbsolutePressure pB(start = environment.pAmbient, nominal = 100000) "Pressure at port B";
parameter Boolean enableZetaOutput = false "Enable zeta output"
annotation (choices(checkBox = true));
Modelica.Blocks.Interfaces.RealOutput Zeta if enableZetaOutput "Zeta"
annotation (Placement(transformation(
origin = {40, 0},
extent = {
{-10, -10},
{10, 10}},
rotation = 0)));
parameter Boolean enableReOutput = false "Enable Re output"
annotation (choices(checkBox = true));
Modelica.Blocks.Interfaces.RealOutput Re if enableReOutput "Re"
annotation (Placement(transformation(
origin = {40, 40},
extent = {
{-10, -10},
{10, 10}},
rotation = 0)));
equation
if enableReOutput then
Re = simpleBend.re;
end if;
if enableZetaOutput then
Zeta = simpleBend.zetaKr * simpleBend.lambda;
end if;
if forwardFluidProperties then
fluidPortA.fluidTemperature = fluidPortB.fluidTemperature;
fluidPortA.fluidId = fluidPortB.fluidId;
fluidPortA.proportionUndissolvedAir = fluidPortB.proportionUndissolvedAir;
fluidPortA.polytropicExponent = fluidPortB.polytropicExponent;
end if;
connect(fluidPortA,volumeA.fluidPort) annotation (Line(
points = {
{-100, 0},
{-70, 0}},
color = {0, 93, 152}));
connect(volumeA.fluidPort,simpleBend.fluidPortA) annotation (Line(
points = {
{-70, 0},
{-18, 0}},
color = {0, 93, 152}));
connect(volumeB.fluidPort,fluidPortB) annotation (Line(
points = {
{0, 70},
{0, 100}},
color = {0, 93, 152}));
connect(simpleBend.fluidPortB,volumeB.fluidPort) annotation (Line(
points = {
{0, 14},
{0, 70}},
color = {0, 93, 152}));
volumeA.p = pA;
volumeB.p = pB;
annotation (
Icon(
coordinateSystem(
extent = {
{-100, -40},
{40, 100}},
initialScale = 0.1),
graphics = {
Polygon(
origin = {-30, 30},
fillColor = {255, 255, 255},
fillPattern = FillPattern.Solid,
points = {
{-60, -1},
{-60, 0},
{-59, 0},
{-52, 0},
{-38, 4},
{-26, 10},
{-18, 16},
{-12, 24},
{-6, 34},
{-2, 44},
{0, 52},
{0, 59},
{0, 60},
{1, 60},
{59, 60},
{60, 60},
{60, 59},
{60, 52},
{58, 38},
{56, 28},
{52, 16},
{48, 8},
{42, -4},
{36, -12},
{30, -20},
{22, -28},
{12, -36},
{0, -44},
{-12, -50},
{-22, -54},
{-36, -58},
{-50, -60},
{-59, -60},
{-60, -60},
{-60, -59},
{-60, -1}},
smooth = Smooth.Bezier)}),
Documentation(info = "<html>\n <p>\n The component Bend is a valid model for <var>Bend angle</var> between 15° and 180°.\n </p>\n <p>\n <center><img align=\"middle\" src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Lines/BendSketch.png\"></center>\n </p>\n <p>\n <b>Please consider:</b> The component was modeled in order to consider the pressure losses of well rounded bends. However, the use of \n the component can lead to extremely long simulation times, since a small stepsize must be selected due to \n the low resistance of an elbow.\n </p>\n <p>\n Formulas are taken from W. Wagner, Strömung und Druckverlust, 7. Auflage 2012.\n </p></html>"));
end Bend;