PropValve33LSTableAx

model PropValve33LSTableAx
    parameter Real inputMax = 10 "Input value for 100 % open"
        annotation (Dialog(group = "Control Parameters"));
    parameter Modelica.SIunits.AngularFrequency angFreq = 2 * Modelica.Constants.pi * 50 "Angular frequency"
        annotation (Dialog(group = "Control Parameters"));
    parameter Modelica.SIunits.DampingCoefficient damping = 0.7 "Damping"
        annotation (Dialog(group = "Control Parameters"));
    parameter Modelica.SIunits.TimeAging vMax = 100 "max. Velocity"
        annotation (Dialog(group = "Control Parameters"));
    parameter Modelica.SIunits.TimeAging vMin = -100 "min. Velocity"
        annotation (Dialog(group = "Control Parameters"));

    extends HydraulicsByFluidon.Components.Valves.Base.PartialValve33LSTableAx;
    extends HydraulicsByFluidon.Components.Valves.Base.PartialValveControlSignal_63;
    extends HydraulicsByFluidon.Components.Valves.Base.PartialValveProp_63;

    Modelica.SIunits.DimensionlessRatio Stroke(start = 0) "rel. Position of valve spool";
    Modelica.SIunits.TimeAging Velocity(start = 0) "rel. Velocity of valve spool";
    Modelica.Blocks.Nonlinear.Limiter limiter(limitsAtInit = true, strict = true, uMax = 1, uMin = -1);
equation
    if enableStrokeOut then 
        valveStrokeOut = Stroke;
    end if;
    if noEvent(vMax < Velocity) then 
        der(Stroke) = vMax;
    elseif noEvent(Velocity < vMin) then 
        der(Stroke) = vMin;
    else 
        der(Stroke) = Velocity;
    end if;
    ssLS = if noEvent(switchBand < Stroke) then portA.p else portT.p;
    gain1.u = Stroke;
    limiter.u = Input / inputMax;
    valveEdgePA.Input = Stroke;
    der(Velocity) = angFreq * (angFreq * (limiter.y - Stroke) - 2 * damping * Velocity);

    annotation (Documentation(info = "<html>\n            <p>\n                The component PropValve33LSTableAx is a model of a 3-way proportional valve where the stroke follows the input signal with a 2nd order delay.\n                In addition to PropValve33PT2TableAx, it has a fourth port (<i>LS</i>) connected to port A or port T, depending on the stroke.\n            </p>\n            <p>\n                <center><img src=\"modelica://HydraulicsByFluidon/Resources/Images/Components/Valves/DirectionalValves/LSDirectionalValves/PropValve33LS.png\"></center>\n            </p>\n            <p>\n                The parameterization of the valve is done by providing the <var>Flow coefficient alphaD</var> and a look-up \n                table of the <var>Cross-sectional area</var> as a function of the input signal. Each of the two meetering edges \n                is parameterised with a separate look-up table and a <var>Flow coefficient alphaD</var> given by the user. \n                Further information regarding the formatting of the look-up table can be found in the documentation of the \n                component <a href=\"modelica://HydraulicsByFluidon.Components.Resistors.ResistorTableAx\">ResistorTableAx</a>. \n                Unlike the Resistor component, the look-up table for valve edges is declared for the input range from -1 to 1.\n            </p>\n            <p>\n                For a positive and negative stroke, the cross-sectional area of the valve's meetering edge is given as a function \n                of the input signal through a look-up table starting from 0 to maximum area (the cross-sectional area of the valve \n                edge when it is completely open). The cross-sectional area must be given in m^2. The flow is then calculated based \n                on <var>Flow coefficient alphaD</var>, <var>Cross-sectional area</var>, density of the fluid and pressure difference \n                between the two edges of the valve, according to the formula given below:\n            </p>\n            <p>\n                <center><img align=\"middle\" src= \"modelica://HydraulicsByFluidon/Resources/Images/Components/Resistors/TurbulentFlow.png\"></center>\n            </p>\n            <p>\n                The valve stroke can be shifted by <var>Relative overlap general</var>. In accordance with common valve parameters a \n                negative overlap will open the valve edge. <var>Relative overlap general</var> is applied to all valve edges \n                simultaneously. If at least one of the edge-specific values, e. g. <var>Relative overlap PA</var> or \n                <var>-AT</var> is set to a value different from 0, then the <var>Relative overlap general</var> is \n                ignored and the individual overlaps are used.\n            </p>\n            <p>\n                Port LS is connected to port A if <var>Stroke</var> > <var>Relative stroke at which the LS port is switched</var>,\n                else port LS is connected to port T.\n                Pressure at port LS follows pressure at A or T with first order delay with </var>Time constant of LS signal</var>.\n            </p>\n            </html>"));
end PropValve33LSTableAx;