QuadraticSpeedDependentForce

model QuadraticSpeedDependentForce "Quadratic dependency of force versus speed"
    extends Modelica.Mechanics.Translational.Interfaces.PartialForce;

    parameter Modelica.SIunits.Force f_nominal "Nominal force (if negative, force is acting as load in positive direction of motion)";
    parameter Boolean ForceDirection = true "Same direction of force in both directions of motion";
    parameter Modelica.SIunits.Velocity v_nominal(min = Modelica.Constants.eps) "Nominal speed";
    Modelica.SIunits.Velocity v "Velocity of flange with respect to support (= der(s))";
equation
    if ForceDirection then 
        f = -f_nominal * (v / v_nominal) ^ 2;
    else 
        f = -f_nominal * smooth(1, if 0 <= v then (v / v_nominal) ^ 2 else -(v / v_nominal) ^ 2);
    end if;
    v = der(s);

    annotation (
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Line(
                    points = {
                        {-60, 50}, 
                        {-60, -40}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {-75, -30}, 
                        {75, -30}},
                    color = {192, 192, 192}), 
                Line(
                    points = {
                        {-60, -30}, 
                        {-40, -28}, 
                        {-20, -22}, 
                        {0, -10}, 
                        {20, 6}, 
                        {40, 26}, 
                        {58, 52}},
                    color = {0, 0, 127},
                    smooth = Smooth.Bezier)}),
        Documentation(info = "<html>\n<p>\nModel of force, quadratic dependent on velocity of flange.<br>\nParameter ForceDirection chooses whether direction of force is the same in both directions of movement or not.\n</p>\n</html>"));
end QuadraticSpeedDependentForce;