ThreeWayFlowControlValve

model ThreeWayFlowControlValve
    extends HydraulicsByFluidon.Components.Valves.Base.PartialPressureFlowValve;

    parameter Modelica.SIunits.Pressure PRVNominalPressureDifference = 10000 "Nominal pressure difference PRV";
    HydraulicsByFluidon.Interfaces.FluidPort fluidPortT(nominal = 100000, start = 101325) "Hydraulic port T"
        annotation (Placement(
            visible = true,
            transformation(
                extent = {
                    {70, 10}, 
                    {90, -10}},
                rotation = 0),
            iconTransformation(
                extent = {
                    {60, -70}, 
                    {80, -50}},
                rotation = 0)));
    HydraulicsByFluidon.Components.Valves.PressureValves.PropPRVstatic propPRV(Balanced = true, InputScaling = 1, NominalPressureDifference = PRVNominalPressureDifference, NominalVolumeFlow = NominalVolumeFlow, forwardFluidProperties = true) annotation (Placement(
        visible = true,
        transformation(
            origin = {40, -30},
            extent = {
                {-12, -10}, 
                {12, 10}},
            rotation = 0)));
protected
    Real dVI;
    Real VI;
equation
    connect(propPRV.fluidPortA,volumeA.fluidPort) annotation (Line(
        points = {
            {40, -40}, 
            {40, -70}, 
            {0, -70}},
        color = {0, 93, 152}));
    connect(propPRV.fluidPortB,fluidPortT) annotation (Line(
        points = {
            {40, -20}, 
            {40, 0}, 
            {80, 0}},
        color = {0, 93, 152}));
    der(dVI) * timeConst = VI - dVI;
    VI = pB - environment.pAmbient + NominalPressureDifference;
    ssU = 1;
    propPRV.Input = dVI;

    annotation (
        Icon(
            coordinateSystem(
                extent = {
                    {-100, -100}, 
                    {100, 100}},
                preserveAspectRatio = false),
            graphics = {
                Rectangle(
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid,
                    extent = {
                        {-50, -80}, 
                        {50, 80}}), 
                Line(
                    origin = {0, -10},
                    points = {
                        {0, 30}, 
                        {0, -30}}), 
                Polygon(
                    origin = {0, 60},
                    fillPattern = FillPattern.Solid,
                    points = {
                        {0, 0}, 
                        {-5, -20}, 
                        {5, -20}, 
                        {0, 0}}), 
                Line(
                    origin = {0, -20},
                    points = {
                        {0, 120}, 
                        {0, -80}}), 
                Line(
                    origin = {10, 0},
                    points = {
                        {20, -20}, 
                        {0, 0}, 
                        {20, 20}}), 
                Line(
                    origin = {-10, 0},
                    points = {
                        {-20, -20}, 
                        {0, 0}, 
                        {-20, 20}}), 
                Line(points = {
                    {0, 90}, 
                    {0, -90}}), 
                Line(points = {
                    {-15, -25}, 
                    {15, 25}}), 
                Polygon(
                    origin = {25, 41.7},
                    rotation = -31,
                    fillPattern = FillPattern.Solid,
                    points = {
                        {0, 0}, 
                        {-5, -20}, 
                        {5, -20}, 
                        {0, 0}}), 
                Line(points = {
                    {60, -60}, 
                    {0, -60}}), 
                Ellipse(
                    origin = {0, -60},
                    fillPattern = FillPattern.Solid,
                    extent = {
                        {-2.5, -2.5}, 
                        {2.5, 2.5}}), 
                Polygon(
                    origin = {50, -60},
                    rotation = 270,
                    fillPattern = FillPattern.Solid,
                    points = {
                        {0, 0}, 
                        {-5, -20}, 
                        {5, -20}, 
                        {0, 0}})}),
        Documentation(info = "<html>\n            <p>\n                The component ThreeWayFlowControlValve is a model of a 3-way flow control valve. \n                It maintains a largely constant outlet flow even at a variable (higher) inlet pressure.\n            </p>\n            <p>\n                <center><img src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Valves/FlowValves/ThreeWayFlowControlValve.png\"></center>\n            </p>\n            <p>\n                The 3-way flow control valve SR3 opens a discharge to the tank as soon as the set volume flow to the consumer is reached. \n                The set volume flow is largely independent of pressure fluctuations of the consumer or the supply pressure. \n            </p>\n            <p>\n                <center><img src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Valves/FlowValves/ThreeWayFlowControlValveSketch.png\"></center>\n            </p>\n            <p>\n                <var>Nominal volume flow</var> determines the set volume flow, <var>Nominal pressure difference</var> the pressure drop\n                of the meetring resistor.\n            </p>\n                <var>Nominal pressure difference PRV</var> describes the typical pressure deviation of pressure relief valve @ <var>Nominal volume flow</var>. \n                This pressure difference also determines the dependency of outlet flow on supply pressure.\n            <p>\n                The component ThreeWayFlowControlValve is not a model of a flow control valve according to its \n                physical structure. It merely represents the characteristic behavior of a flow control \n                valve. Therefore dynamic effects such as forces due to inertia will not be represented.\n            </p>\n            </html>"));
end ThreeWayFlowControlValve;