PressureCompensator

model PressureCompensator
    parameter Modelica.SIunits.Pressure pDifferential = 800000 "Differential pressure";

    extends HydraulicsByFluidon.Components.Valves.Base.PartialPressureFlowValve;

    HydraulicsByFluidon.Interfaces.FluidPort fluidPortX(p(start = environment.pAmbient, nominal = 100000)) "Hydraulic port X"
        annotation (Placement(transformation(extent = {
            {-110, 10}, 
            {-90, -10}})));
equation
    if forwardFluidProperties then 
        fluidPortX.fluidTemperature = fluidPortA.fluidTemperature;
        fluidPortX.fluidId = fluidPortA.fluidId;
        fluidPortX.proportionUndissolvedAir = fluidPortA.proportionUndissolvedAir;
        fluidPortX.polytropicExponent = fluidPortA.polytropicExponent;
    end if;
    ssU = max(0, min(1, pDifferential - (pB - fluidPortX.p)));
    fluidPortX.mFlow = 0;

    annotation (
        Icon(
            coordinateSystem(
                extent = {
                    {-100, -100}, 
                    {100, 100}},
                preserveAspectRatio = false),
            graphics = {
                Rectangle(
                    origin = {0, -20},
                    fillColor = {255, 255, 255},
                    fillPattern = FillPattern.Solid,
                    extent = {
                        {-40, 40}, 
                        {40, -40}}), 
                Line(
                    origin = {0, -30},
                    points = {
                        {0, 30}, 
                        {0, -30}}), 
                Polygon(
                    origin = {0, 20},
                    fillPattern = FillPattern.Solid,
                    points = {
                        {0, 0}, 
                        {-5, -20}, 
                        {5, -20}, 
                        {0, 0}}), 
                Line(
                    origin = {0, 20},
                    points = {
                        {0, -120}, 
                        {0, 80}}), 
                Line(
                    origin = {-100, 0},
                    points = {
                        {0, 0}, 
                        {60, 0}}), 
                Line(
                    origin = {0, 20},
                    rotation = 180,
                    points = {
                        {0, 0}, 
                        {-40, -40}, 
                        {-80, -40}, 
                        {-80, 20}, 
                        {-40, 20}},
                    pattern = LinePattern.Dash), 
                Line(
                    origin = {-40, -40},
                    points = {
                        {0, 0}, 
                        {-4, -20}, 
                        {-12, 20}, 
                        {-20, -20}, 
                        {-28, 20}, 
                        {-36, -20}, 
                        {-44, 20}, 
                        {-48, 0}})}),
        Documentation(info = "<html>\n            <p>\n                The component PressureCompensator is a partial physical model of a 2-way pressure compensator with signal based\n                dynamics of the spool. The flow characteristic of fully opened valve is given by parameters <var>Nominal volume flow</var> and \n                <var>Nominal pressure difference</var>.\n            </p>\n            <p>\n                <center><img src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Valves/PressureValves/pressurecompensator.png\"></center>\n            </p>\n            <p>\n                The valve controls a differential pressure between an externally supplied measuring point (port X) and pressure at port B. \n                The controlled pressure difference is given by <var>Differential pressure</var>, the valve dynamics by <var>Response time of valve spool</var>.\n            </p>\n            <p>\n                Internally a variable resistor is adjusted with (<i>pDifferential</i> - (<i>fluidPortB.p</i> - <i>fluidPortX.p</i>)) * <var>Feedback factor</var>)) as input.\n                <var>Feedback factor</var> is used to influence the accuracy of the pressure compensator.\n            </p>\n            <p>\n                These valves are used for load pressure independent regulation of flow rates of consumers. In combination with manually actuated or proportional \n                throttle, pressure compensators can be used for the load-independent lifting and lowering of variable loads at the same velocities. \n                They act thereby as pressure compensated flow control valves.\n            </p>\n            <p>\n                Another typical application are LS-systems where they are used to compensate the influence of different load pressures of several actuators.\n            </p>\n            </html>"));
end PressureCompensator;