Show
Ignore:
Timestamp:
05/25/08 13:11:28 (6 months ago)
Author:
otter
Message:

maintenance/3.0_ImprovedFriction/Modelica:
New, much simplified method without state machine to describe friction in Rotational and Translational library. The efficiency will be usually enhanced because less event iterations. Since no state machine any longer, inconsistent friction states, due to initialization and/or impulses are no longer possible.
Release notes updated.

Files:
1 modified

Legend:

Unmodified
Added
Removed
  • branches/maintenance/3.0_ImprovedFriction/Modelica/Mechanics/Translational.mo

    r1119 r1130  
    898898            Text( 
    899899              extent={{-98,-68},{102,-94}}, 
    900               textString="positive force => spool moves in positive direction ", 
     900              textString="positive force => spool moves in positive direction ",  
     901 
    901902              lineColor={0,0,255}), 
    902903            Text( 
     
    19901991 
    19911992    // Friction force 
    1992       f = if locked then sa*unitForce else  
    1993          (if startForward then          Modelica.Math.tempInterpol1( v, f_pos, 2) else  
    1994           if startBackward then        -Modelica.Math.tempInterpol1(-v, f_pos, 2) else  
    1995           if pre(mode) == Forward then  Modelica.Math.tempInterpol1( v, f_pos, 2) else  
    1996                                        -Modelica.Math.tempInterpol1(-v, f_pos, 2)); 
     1993       f = if mode == Locked then sa*unitForce else  
     1994           if mode == Free then      0 else  
     1995           if mode == Forward then  Math.tempInterpol1( v, f_pos, 2) else  
     1996                                   -Math.tempInterpol1(-v, f_pos, 2); 
     1997 
    19971998    end SupportFriction; 
    19981999 
     
    21792180      free = fn <= 0; 
    21802181 
    2181       // friction force 
    2182       f = if locked then sa*unitForce else  
    2183           if free then   0 else  
    2184           cgeo*fn*(if startForward then          Modelica.Math.tempInterpol1( v, mue_pos, 2) else  
    2185                    if startBackward then        -Modelica.Math.tempInterpol1(-v, mue_pos, 2) else  
    2186                    if pre(mode) == Forward then  Modelica.Math.tempInterpol1( v, mue_pos, 2) else  
    2187                                                 -Modelica.Math.tempInterpol1(-v, mue_pos, 2)); 
     2182    // friction force 
     2183      f = if mode == Locked then  sa*unitForce else  
     2184          if mode == Free then 0 else  
     2185          cgeo*fn*(if mode == Forward then  Math.tempInterpol1( v, mue_pos, 2) else  
     2186                                           -Math.tempInterpol1(-v, mue_pos, 2)); 
    21882187    end Brake; 
    21892188 
     
    26272626              textString="Length L", 
    26282627              lineColor={0,0,255})})); 
     2628 
    26292629    encapsulated partial model PartialFrictionWithStop 
    26302630        "Base model of Coulomb friction elements with stop" 
     
    26582658      Real sa(unit="1") 
    26592659          "Path parameter of friction characteristic f = f(a_relfric)"; 
    2660       Boolean startForward(start=false, fixed=true) 
    2661           "= true, if v_rel=0 and start of forward sliding or v_rel > v_small"; 
    2662       Boolean startBackward(start=false, fixed=true) 
    2663           "= true, if v_rel=0 and start of backward sliding or v_rel < -v_small"; 
    2664       Boolean locked(start=false) "true, if v_rel=0 and not sliding"; 
     2660 
    26652661      extends PartialRigid(s(start=0, stateSelect = StateSelect.always)); 
    2666       constant Integer Unknown=3 "Value of mode is not known"; 
    2667       constant Integer Free=2 "Element is not active"; 
    2668       constant Integer Forward=1 "v_rel > 0 (forward sliding)"; 
    2669       constant Integer Stuck=0 
    2670           "v_rel = 0 (forward sliding, locked or backward sliding)"; 
    2671       constant Integer Backward=-1 "v_rel < 0 (backward sliding)"; 
    2672       Integer mode( 
    2673         final min=Backward, 
    2674         final max=Unknown, 
    2675         start=Unknown, fixed=true); 
     2662 
     2663      constant Integer Free=2 "Element is not active" annotation(HideResult=true); 
     2664      constant Integer Forward=1 "Forward sliding" annotation(HideResult=true); 
     2665      constant Integer Locked=0 "Locked (no relative motion)" annotation(HideResult=true); 
     2666      constant Integer Backward=-1 "Backward sliding" annotation(HideResult=true); 
     2667      Integer mode(final max=2, final min=-1, start=Free) 
     2668          "Mode of friction element: 2: free, 1: forward sliding, 0: Locked, -1: Backward sliding"; 
    26762669      protected 
     2670      constant SI.Velocity v_eps = 1e-8 
     2671          "If newFrictionDescription: defines region around zero, where the friction state is determined by acceleration, otherwise by v"; 
    26772672      constant SI.Acceleration unitAcceleration = 1 annotation(HideResult=true); 
    26782673      constant SI.Force unitForce = 1 annotation(HideResult=true); 
     
    26802675          "Value of sa when start of forward sliding at w=0"; 
    26812676    equation 
    2682     /* Friction characteristic 
    2683    (locked is introduced to help the Modelica translator determining 
    2684    the different structural configurations,  
    2685    if for each configuration special code shall be generated) 
    2686 */ 
    2687       startForward  = pre(mode) == Stuck and sa >  f0_max/unitForce and s < (smax - L/2) or  
    2688         pre(mode) == Backward and v_relfric >  v_small or initial() and v_relfric > 0; 
    2689       startBackward = pre(mode) == Stuck and sa < -f0_max/unitForce and s > (smin + L/2) or  
    2690         pre(mode) == Forward  and v_relfric < -v_small or initial() and v_relfric < 0; 
    2691       locked = not free and  
    2692         not (pre(mode) == Forward or startForward or pre(mode) == Backward or startBackward); 
    2693       a_relfric/unitAcceleration = if locked then               0 else  
    2694                                    if free then                 sa else  
    2695                                    if startForward then         sa - sa0 else  
    2696                                    if startBackward then        sa + sa0 else  
    2697                                    if pre(mode) == Forward then sa - sa0 else  
    2698                                                                 sa + sa0; 
    2699     /* Friction torque has to be defined in a subclass. Example for a clutch: 
    2700    f = if locked then sa else  
    2701        if free then   0 else  
    2702        cgeo*fn*(if startForward then          Math.tempInterpol1( v_relfric, mue_pos, 2) else  
    2703                 if startBackward then        -Math.tempInterpol1(-v_relfric, mue_pos, 2) else  
    2704                 if pre(mode) == Forward then  Math.tempInterpol1( v_relfric, mue_pos, 2) else  
    2705                                              -Math.tempInterpol1(-v_relfric, mue_pos, 2)); 
    2706 */ 
    2707     // finite state machine to determine configuration 
    2708       mode = if free then Free else  
    2709         (if (pre(mode) == Forward  or pre(mode) == Free or startForward)  and v_relfric > 0 and s < (smax - L/2) then  
    2710            Forward else  
    2711          if (pre(mode) == Backward or pre(mode) == Free or startBackward) and v_relfric < 0 and s > (smin + L/2) then  
    2712            Backward else  
    2713            Stuck); 
     2677    /* Friction characteristic */ 
     2678       mode = if free then Free else  
     2679              if v_relfric >  v_eps and s < (smax - L/2) then Forward else  
     2680              if v_relfric < -v_eps and s > (smin + L/2) then Backward else  
     2681              if sa >  f0_max/unitForce and s < (smax - L/2) then Forward else  
     2682              if sa < -f0_max/unitForce and s > (smin + L/2) then Backward else Locked; 
     2683 
     2684       a_relfric = unitAcceleration*(if mode == Locked then  0 else  
     2685                                     if mode == Free then    sa else  
     2686                                     if mode == Forward then sa - sa0 else sa + sa0); 
    27142687    end PartialFrictionWithStop; 
     2688 
    27152689    equation 
    27162690      // Constant auxiliary variables 
     
    27182692      f0_max = f0*1.001; 
    27192693      free = f0 <= 0 and F_prop <= 0 and s > smin + L/2 and s < smax - L/2; 
     2694 
    27202695      // Velocity and acceleration of flanges 
    27212696      v = der(s); 
     
    27232698      v_relfric = v; 
    27242699      a_relfric = a; 
     2700 
    27252701    // Equilibrium of forces 
    27262702      0 = flange_a.f + flange_b.f - f - m*der(v); 
     2703 
    27272704    // Friction force 
    2728       f = if locked then sa*unitForce else  
    2729           if free then   0 else  
    2730                         (if startForward then         F_prop*v + F_Coulomb + F_Stribeck else  
    2731                          if startBackward then        F_prop*v - F_Coulomb - F_Stribeck else  
    2732                          if pre(mode) == Forward then F_prop*v + F_Coulomb + F_Stribeck*exp(-fexp*abs(v)) else  
    2733                                                       F_prop*v - F_Coulomb - F_Stribeck*exp(-fexp*abs(v))); 
     2705       f = if mode == Locked then  sa*unitForce else  
     2706           if mode == Free then    0 else  
     2707           if mode == Forward then F_prop*v + F_Coulomb + F_Stribeck*exp(-fexp*abs(v)) else  
     2708                                   F_prop*v - F_Coulomb - F_Stribeck*exp(-fexp*abs(v)); 
     2709 
    27342710    // Define events for hard stops and reinitiliaze the state variables velocity v and position s 
    27352711    algorithm 
     
    35613537            preserveAspectRatio=true, 
    35623538            extent={{-100,-100},{100,100}}, 
    3563             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3539            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    35643540              Text( 
    35653541              extent={{80,-28},{114,-62}}, 
     
    35933569            preserveAspectRatio=true, 
    35943570            extent={{-100,-100},{100,100}}, 
    3595             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3571            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    35963572              Text( 
    35973573              extent={{80,-28},{111,-61}}, 
     
    36273603            preserveAspectRatio=true, 
    36283604            extent={{-100,-100},{100,100}}, 
    3629             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3605            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    36303606              Text( 
    36313607              extent={{80,-28},{115,-60}}, 
     
    46814657</html> 
    46824658")); 
    4683     //extends Translational.Interfaces.PartialRigid; 
    4684       parameter SI.Velocity v_small=1e-3 
    4685         "Relative velocity near to zero (see model info text)"  
    4686          annotation(Dialog(tab="Advanced")); 
     4659 
    46874660    // Equations to define the following variables have to be defined in subclasses 
    46884661      SI.Velocity v_relfric "Relative velocity between frictional surfaces"; 
     
    46974670      Real sa(unit="1") 
    46984671        "Path parameter of friction characteristic f = f(a_relfric)"; 
    4699       Boolean startForward(start=false, fixed=true) 
    4700         "true, if v_rel=0 and start of forward sliding"; 
    4701       Boolean startBackward(start=false, fixed=true) 
    4702         "true, if v_rel=0 and start of backward sliding"; 
    4703       Boolean locked(start=false) "true, if v_rel=0 and not sliding"; 
    4704       constant Integer Unknown=3 "Value of mode is not known"; 
    4705       constant Integer Free=2 "Element is not active"; 
    4706       constant Integer Forward=1 "v_rel > 0 (forward sliding)"; 
    4707       constant Integer Stuck=0 
    4708         "v_rel = 0 (forward sliding, locked or backward sliding)"; 
    4709       constant Integer Backward=-1 "v_rel < 0 (backward sliding)"; 
    4710       Integer mode( 
    4711         final min=Backward, 
    4712         final max=Unknown, 
    4713         start=Unknown, fixed=true); 
     4672 
     4673      constant Integer Free=2 "Element is not active" annotation(HideResult=true); 
     4674      constant Integer Forward=1 "Forward sliding" annotation(HideResult=true); 
     4675      constant Integer Locked=0 "Locked (no relative motion)" annotation(HideResult=true); 
     4676      constant Integer Backward=-1 "Backward sliding" annotation(HideResult=true); 
     4677      Integer mode(final max=2, final min=-1, start=Free) 
     4678        "Mode of friction element: 2: free, 1: forward sliding, 0: Locked, -1: Backward sliding"; 
     4679 
    47144680    protected 
     4681      constant SI.Velocity v_eps = 1e-8 
     4682        "If newFrictionDescription: defines region around zero, where the friction state is determined by acceleration, otherwise by v"; 
    47154683      constant SI.Acceleration unitAcceleration = 1 annotation(HideResult=true); 
    47164684      constant SI.Force unitForce = 1 annotation(HideResult=true); 
     
    47184686        "Value of sa when start of forward sliding at w=0"; 
    47194687    equation 
    4720     /* Friction characteristic 
    4721    (locked is introduced to help the Modelica translator determining 
    4722    the different structural configurations,  
    4723    if for each configuration special code shall be generated) 
    4724 */ 
    4725       startForward  = pre(mode) == Stuck and sa >  f0_max/unitForce or  
    4726         pre(mode) == Backward and v_relfric >  v_small or initial() and v_relfric > 0; 
    4727       startBackward = pre(mode) == Stuck and sa < -f0_max/unitForce or  
    4728         pre(mode) == Forward  and v_relfric < -v_small or initial() and v_relfric < 0; 
    4729       locked = not free and  
    4730         not (pre(mode) == Forward or startForward or pre(mode) == Backward or startBackward); 
    4731       a_relfric/unitAcceleration = if locked then               0 else  
    4732                                    if free then                 sa else  
    4733                                    if startForward then         sa - sa0 else  
    4734                                    if startBackward then        sa + sa0 else  
    4735                                    if pre(mode) == Forward then sa - sa0 else  
    4736                                                                 sa + sa0; 
    4737     /* Friction torque has to be defined in a subclass. Example for a clutch: 
    4738    f = if locked then sa else  
    4739        if free then   0 else  
    4740        cgeo*fn*(if startForward then          Math.tempInterpol1( v_relfric, mue_pos, 2) else  
    4741                 if startBackward then        -Math.tempInterpol1(-v_relfric, mue_pos, 2) else  
    4742                 if pre(mode) == Forward then  Math.tempInterpol1( v_relfric, mue_pos, 2) else  
    4743                                              -Math.tempInterpol1(-v_relfric, mue_pos, 2)); 
    4744 */ 
    4745     // finite state machine to determine configuration 
    4746       mode = if free then Free else  
    4747         (if (pre(mode) == Forward  or pre(mode) == Free or startForward)  and v_relfric > 0 then  
    4748            Forward else  
    4749          if (pre(mode) == Backward or pre(mode) == Free or startBackward) and v_relfric < 0 then  
    4750            Backward else  
    4751            Stuck); 
     4688       mode = if free then Free else  
     4689              if v_relfric >  v_eps then Forward else  
     4690              if v_relfric < -v_eps then Backward else  
     4691              if sa >  f0_max/unitForce then Forward else  
     4692              if sa < -f0_max/unitForce then Backward else Locked; 
     4693 
     4694       a_relfric = unitAcceleration*(if mode == Locked then  0 else  
     4695                                     if mode == Free then    sa else  
     4696                                     if mode == Forward then sa - sa0 else sa + sa0); 
     4697 
     4698       /* Friction force has to be defined in a subclass. Example: 
     4699      f = if mode == Locked then sa*unitForce else  
     4700          if mode == Free   then 0 else  
     4701            cgeo*fn*(if mode==Forward then  Math.tempInterpol1( v_relfric, mue_pos, 2) 
     4702                                      else -Math.tempInterpol1(-v_relfric, mue_pos, 2)); 
     4703   */ 
    47524704    end PartialFriction; 
    47534705