ModelingOfFriction

class ModelingOfFriction "Modeling of Friction"
    extends Modelica.Icons.Information;

    annotation (Documentation(info = "<html>\n<p>\nSeveral elements of this library model <strong>Coulomb friction</strong> with the method proposed in:\n</p>\n\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\n<p>\nThe friction equations are defined in base model\n<a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialFriction\">Interfaces.PartialFriction</a>.\nHere are some explanations:\n</p>\n\n<p>\nAssume first the most simplest friction problem: A block sliding on a surface.\nThe friction force \"f\" acts between the block surface and the environment surface and shall be a\nlinear function of the relative velocity \"v\" between the two surfaces.\nWhen the relative velocity becomes zero, the two surfaces are stuck to each other and the friction force is no longer\na function of \"v\". The element starts sliding again if the friction force becomes larger than the maximum\nstatic friction force \"f0\". This element could be defined with a parameterized curve description\nleading to the following equations:\n</p>\n\n<blockquote><pre>forward  = s &gt; 1;\nbackward = s &lt; -1;\nv = if forward then s-1 elseif backward then s+1 else 0;\nf = if forward  then  f0+f1*(s-1) elseif\n       backward then -f0+f1*(s+1) else f0*s;\n</pre></blockquote>\n\n<p>\nThis model completely describes the simplified friction element in\na declarative way. Unfortunately, currently it is not known how to transform such\nan element description automatically in a form which can be simulated:\n</p>\n\n<p>\nThe block is described by the following equation:\n</p>\n\n<blockquote><pre>\nm*der(v) = u - f\n</pre></blockquote>\n\n<p>\nNote, that \"m\" is the mass of the block and \"u(t)\" is the given driving force.\nIf the element is in its \"forward sliding\" mode, that is s &ge; 1, this model is described by:\n</p>\n\n<blockquote><pre>\nm*der(v) = u - f\n       v = s - 1\n       f = f_0 + f_1*(s-1)\n</pre></blockquote>\n\n<p>\nwhich can be easily transformed into state space form with \"v\" as the state.\nIf the block becomes stuck, that is -1 &le; s &le; 1, the equation \"v=0\" becomes\nactive and therefore \"v\" can no longer be a state, that is an index\nchange takes place. Besides the difficulty to handle the variable state change,\nthere is a more serious problem:\n</p>\n\n<p>\nAssume that the block is stuck and that \"s\" becomes greater than one. Before the event occurs, s &le; 1\nand v = 0; at the event instant s &gt; 1 because this relation is the event triggering condition. The element\nswitches into the forward sliding mode where \"v\" is a state which is initialized with its last value \"v=0\".\nSince \"v\" is a state, \"s\" is computed from \"v\" via \"s := v+1\", resulting in \"s=1\", that is the relation\n\"s &gt; 1\" becomes false and the element switches back into the stuck mode. In other words, it is never possible to\nswitch into the forward sliding mode. Taking numerical errors into account, the situation is even worse.\n</p>\n\n<p>\nThe key to the solution is the observation that \"v=0\" in the stuck mode and when forward sliding starts, but\n\"der(v) &gt; 0\" when sliding starts and der(v) = 0 in the stuck mode. Since the friction characteristic\nat zero velocity is no functional relationship, again a parameterized curve description\nwith a new curve parameter \"s_a\" has to be used leading to the following equations (note: at zero velocity):\n</p>\n\n<blockquote><pre>\nstartFor  = sa &gt; 1;\nstartBack = sa &lt; -1;\n        a = der(v);\n        a = if startFor then sa-1 elseif startBack then sa+1 else 0;\n        f = if startFor then f0   elseif startBack then  -f0 else f0*sa;\n</pre></blockquote>\n\n<p>\nAt zero velocity, these equations and the equation of the block form a mixed continuous/discrete set of\nequations which has to be solved at event instants (e.g. by a fix point iteration),\nWhen switching from sliding to stuck mode, the velocity is small or zero. Since the derivative of the constraint\nequation der(v) = 0 is fulfilled in the stuck mode, the velocity remains small even if v = 0 is not explicitly\ntaken into account. The approach to use the acceleration der(v) = 0 as \"constraint\" instead of \"v = 0\",\nis often used in multi-body software. The benefit is that the velocity \"v\" remains a state in all switching\nconfigurations (there is a small, linear drift, but the friction element would have to stay stuck several days\nbefore the drift becomes too large). Consequently, \"v\" is small but may have any sign when switching\nfrom stuck to sliding mode; if the friction element starts to slide, say in the forward direction, one has\nto wait until the velocity is really positive, before switching to forward mode (note, that even for\nexact calculation without numerical errors a \"waiting\" phase is necessary, because \"v=0\" when sliding starts).\nSince \"der(v) > 0\", this will occur after a small time period. This \"waiting\" procedure can be\ndescribed by a state machine. Collecting all the pieces together, finally results in the following equations\nof a simple friction element:\n</p>\n\n<blockquote><pre>\n// part of mixed system of equations\nstartFor  = pre(mode) == Stuck and sa &gt; 1;\nstartBack = pre(mode) == Stuck and sa  &lt; -1;\n        a = der(v);\n        a = if pre(mode) == Forward  or startFor  then  sa - 1    elseif\n               pre(mode) == Backward or startBack then  sa + 1    else 0;\n        f = if pre(mode) == Forward or startFor   then  f0 + f1*v elseif\n               pre(mode) == Backward or startBack then -f0 + f1*v else f0*sa;\n\n// state machine to determine configuration\nmode = if (pre(mode) == Forward  or startFor)  and v&gt;0 then Forward  elseif\n          (pre(mode) == Backward or startBack) and v&lt;0 then Backward else Stuck;\n</pre></blockquote>\n\n<p>\nThe above approach to model a simplified friction element is slightly generalized in model\n<a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialFriction\">Interfaces.PartialFriction</a>:\n</p>\n\n<ul>\n<li> The sliding friction force has a nonlinear characteristic instead a linear one,\n     by interpolation in a table of f(v) values.</li>\n<li> There may be a jump in the friction force when going from stuck to sliding mode\n     (described with parameter peak).</li>\n</ul>\n</html>"));
end ModelingOfFriction;