Brake

model Brake "Brake based on Coulomb friction"
    extends Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2;
    extends Modelica.Thermal.HeatTransfer.Interfaces.PartialElementaryConditionalHeatPortWithoutT;

    parameter Real mue_pos[:,2] = [0,0.5] "[v, f] Positive sliding friction characteristic (v>=0)";
    parameter Real peak(final min = 1) = 1 "Peak for maximum value of mue at w==0 (mue0_max = peak*mue_pos[1,2])";
    parameter Real cgeo(final min = 0) = 1 "Geometry constant containing friction distribution assumption";
    parameter SI.Force fn_max(final min = 0, start = 1) "Maximum normal force";

    extends Translational.Interfaces.PartialFriction;

    SI.Position s "Absolute position of flange_a and of flange_b";
    SI.Force f "Brake friction force";
    SI.Velocity v "Absolute velocity of flange_a and flange_b";
    SI.Acceleration a "Absolute acceleration of flange_a and flange_b";
    Real mue0 "Friction coefficient for v=0 and forward sliding";
    SI.Force fn "Normal force (=fn_max*f_normalized)";
    Modelica.Blocks.Interfaces.RealInput f_normalized "Normalized force signal 0..1 (normal force = fn_max*f_normalized; brake is active if > 0)"
        annotation (Placement(transformation(
            origin = {0, 110},
            extent = {
                {20, -20}, 
                {-20, 20}},
            rotation = 90)));
equation
    a = der(v);
    f = if locked then sa * unitForce else if free then 0 else cgeo * fn * (if startForward then Modelica.Math.Vectors.interpolate(mue_pos[:,1], mue_pos[:,2], v, 1) else if startBackward then -Modelica.Math.Vectors.interpolate(mue_pos[:,1], mue_pos[:,2], -v, 1) else if pre(mode) == Forward then Modelica.Math.Vectors.interpolate(mue_pos[:,1], mue_pos[:,2], v, 1) else -Modelica.Math.Vectors.interpolate(mue_pos[:,1], mue_pos[:,2], -v, 1));
    s = s_a;
    s = s_b;
    v = der(s);
    a_relfric = a;
    f0 = mue0 * cgeo * fn;
    f0_max = peak * f0;
    fn = fn_max * f_normalized;
    free = fn <= 0;
    lossPower = f * v_relfric;
    mue0 = Modelica.Math.Vectors.interpolate(mue_pos[:,1], mue_pos[:,2], 0, 1);
    v_relfric = v;
    flange_a.f + flange_b.f - f = 0;

    annotation (
        Documentation(info = "<html>\n<p>\nThis component models a <strong>brake</strong>, i.e., a component where a frictional\nforce is acting between the housing and a flange and a controlled normal\nforce presses the flange to the housing in order to increase friction.\nThe normal force fn has to be provided as input signal f_normalized in a normalized form\n(0 &le; f_normalized &le; 1),\nfn = fn_max*f_normalized, where fn_max has to be provided as parameter.\nFriction in the brake is modelled in the following way:\n</p>\n<p>\nWhen the absolute velocity \"v\" is not zero, the friction force\nis a function of the velocity dependent friction coefficient  mue(v) , of\nthe normal force \"fn\", and of a geometry constant \"cgeo\" which takes into\naccount the geometry of the device and the assumptions on the friction\ndistributions:\n</p>\n<pre>\n        frictional_force = <strong>cgeo</strong> * <strong>mue</strong>(v) * <strong>fn</strong>\n</pre>\n<p>\n   Typical values of coefficients of friction:\n</p>\n<pre>\n      dry operation   :  <strong>mue</strong> = 0.2 .. 0.4\n      operating in oil:  <strong>mue</strong> = 0.05 .. 0.1\n</pre>\n<p>\n    The positive part of the friction characteristic <strong>mue</strong>(v),\n    v >= 0, is defined via table mue_pos (first column = v,\n    second column = mue). Currently, only linear interpolation in\n    the table is supported.\n</p>\n<p>\n   When the absolute velocity becomes zero, the elements\n   connected by the friction element become stuck, i.e., the absolute\n   position remains constant. In this phase the friction force is\n   calculated from a force balance due to the requirement, that\n   the absolute acceleration shall be zero.  The elements begin\n   to slide when the friction force exceeds a threshold value,\n   called the  maximum static friction force, computed via:\n</p>\n<pre>\n       frictional_force = <strong>peak</strong> * <strong>cgeo</strong> * <strong>mue</strong>(w=0) * <strong>fn</strong>   (<strong>peak</strong> >= 1)\n</pre>\n<p>\nThis procedure is implemented in a \"clean\" way by state events and\nleads to continuous/discrete systems of equations if friction elements\nare dynamically coupled. The method is described in:\n</p>\n<dl>\n<dt>Otter M., Elmqvist H., and Mattsson S.E. (1999):</dt>\n<dd><strong>Hybrid Modeling in Modelica based on the Synchronous\n    Data Flow Principle</strong>. CACSD'99, Aug. 22.-26, Hawaii.</dd>\n</dl>\n<p>\nMore precise friction models take into account the elasticity of the\nmaterial when the two elements are \"stuck\", as well as other effects,\nlike hysteresis. This has the advantage that the friction element can\nbe completely described by a differential equation without events. The\ndrawback is that the system becomes stiff (about 10-20 times slower\nsimulation) and that more material constants have to be supplied which\nrequires more sophisticated identification. For more details, see the\nfollowing references, especially (Armstrong and Canudas de Wit 1996):\n</p>\n<dl>\n<dt>Armstrong B. (1991):</dt>\n<dd><strong>Control of Machines with Friction</strong>. Kluwer Academic\n    Press, Boston MA.<br><br></dd>\n<dt>Armstrong B., and Canudas de Wit C. (1996):</dt>\n<dd><strong>Friction Modeling and Compensation.</strong>\n    The Control Handbook, edited by W.S.Levine, CRC Press,\n    pp. 1369-1382.<br><br></dd>\n<dt>Canudas de Wit C., Olsson H., &Aring;str&ouml;m K.J., and Lischinsky P. (1995):</dt>\n<dd><strong>A new model for control of systems with friction.</strong>\n    IEEE Transactions on Automatic Control, Vol. 40, No. 3, pp. 419-425.<br><br></dd>\n</dl>\n</html>"),
        Icon(
            coordinateSystem(
                preserveAspectRatio = true,
                extent = {
                    {-100, -100}, 
                    {100, 100}}),
            graphics = {
                Rectangle(
                    extent = {
                        {-90, 10}, 
                        {90, -10}},
                    lineColor = {0, 127, 0},
                    fillColor = {160, 215, 160},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {0, -30}, 
                        {10, -50}, 
                        {-10, -50}, 
                        {0, -30}},
                    lineColor = {0, 0, 127},
                    fillColor = {0, 0, 127},
                    fillPattern = FillPattern.Solid), 
                Polygon(
                    points = {
                        {10, 50}, 
                        {-10, 50}, 
                        {0, 30}, 
                        {10, 50}},
                    lineColor = {0, 0, 127},
                    fillColor = {0, 0, 127},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {0, 90}, 
                        {0, 50}},
                    color = {0, 0, 127}), 
                Rectangle(
                    extent = {
                        {20, 28}, 
                        {30, 22}},
                    lineColor = {175, 190, 175},
                    fillColor = {175, 190, 175},
                    fillPattern = FillPattern.Solid), 
                Rectangle(
                    extent = {
                        {20, -22}, 
                        {30, -28}},
                    lineColor = {175, 190, 175},
                    fillColor = {175, 190, 175},
                    fillPattern = FillPattern.Solid), 
                Rectangle(
                    extent = {
                        {30, 28}, 
                        {36, -102}},
                    lineColor = {175, 190, 175},
                    fillColor = {175, 190, 175},
                    fillPattern = FillPattern.Solid), 
                Rectangle(
                    extent = {
                        {14, -96}, 
                        {30, -102}},
                    lineColor = {175, 190, 175},
                    fillColor = {175, 190, 175},
                    fillPattern = FillPattern.Solid), 
                Line(
                    points = {
                        {0, -50}, 
                        {0, -60}, 
                        {-40, -50}, 
                        {-40, 48}, 
                        {0, 60}, 
                        {0, 90}},
                    color = {0, 0, 127}), 
                Text(
                    extent = {
                        {-150, -120}, 
                        {150, -160}},
                    textString = "%name",
                    lineColor = {0, 0, 255}), 
                Line(
                    visible = useHeatPort,
                    points = {
                        {-100, -102}, 
                        {-100, -16}, 
                        {0, -16}},
                    color = {191, 0, 0},
                    pattern = LinePattern.Dot), 
                Rectangle(
                    extent = {
                        {-20, 30}, 
                        {20, 20}},
                    fillPattern = FillPattern.Solid), 
                Rectangle(
                    extent = {
                        {-20, -20}, 
                        {20, -30}},
                    fillPattern = FillPattern.Solid)}));
end Brake;