Changeset 1130 for branches/maintenance
- Timestamp:
- 05/25/08 13:11:28 (6 months ago)
- Location:
- branches/maintenance/3.0_ImprovedFriction/Modelica
- Files:
-
- 3 modified
-
Mechanics/Rotational.mo (modified) (15 diffs)
-
Mechanics/Translational.mo (modified) (14 diffs)
-
package.mo (modified) (1 diff)
Legend:
- Unmodified
- Added
- Removed
-
branches/maintenance/3.0_ImprovedFriction/Modelica/Mechanics/Rotational.mo
r1119 r1130 669 669 smooth=Smooth.None)); 670 670 end FirstGrounded; 671 672 model SimpleFriction "Demonstration of BearingFriction element" 673 extends Modelica.Icons.Example; 674 675 Components.Inertia inertia( 676 J=2, 677 phi(fixed=true, start=0), 678 w(fixed=true, start=0)) 679 annotation (Placement(transformation(extent={{20,20},{40,40}}))); 680 Sources.Torque torque 681 annotation (Placement(transformation(extent={{-20,20},{0,40}}))); 682 annotation (Diagram(coordinateSystem(preserveAspectRatio=true, extent={{ 683 -100,-100},{100,100}}), graphics)); 684 Blocks.Sources.Sine sine(freqHz=2, amplitude=1.5) 685 annotation (Placement(transformation(extent={{-60,20},{-40,40}}))); 686 Components.BearingFriction bearingFriction(tau_pos=[0,1; 1,2], peak=1.1) 687 annotation (Placement(transformation(extent={{60,20},{80,40}}))); 688 equation 689 connect(torque.flange, inertia.flange_a) annotation (Line( 690 points={{0,30},{20,30}}, 691 color={0,0,0}, 692 smooth=Smooth.None)); 693 connect(sine.y, torque.tau) annotation (Line( 694 points={{-39,30},{-22,30}}, 695 color={0,0,127}, 696 smooth=Smooth.None)); 697 connect(inertia.flange_b, bearingFriction.flange_a) annotation (Line( 698 points={{40,30},{60,30}}, 699 color={0,0,0}, 700 smooth=Smooth.None)); 701 end SimpleFriction; 671 702 672 703 model Friction "Drive train with clutch and brake" … … 2282 2313 2283 2314 // Friction torque 2284 tau = if locked then sa*unitTorque else (if startForward then 2285 Modelica.Math.tempInterpol1(w, tau_pos, 2) else if startBackward then - 2286 Modelica.Math.tempInterpol1(-w, tau_pos, 2) else if pre(mode) == Forward then 2287 Modelica.Math.tempInterpol1(w, tau_pos, 2) else - 2288 Modelica.Math.tempInterpol1(-w, tau_pos, 2)); 2315 tau = if mode == Locked then sa*unitTorque else 2316 if mode == Free then 0 else 2317 if mode == Forward then Modelica.Math.tempInterpol1( w, tau_pos, 2) else 2318 -Modelica.Math.tempInterpol1(-w, tau_pos, 2); 2289 2319 end BearingFriction; 2290 2320 … … 2366 2396 fillPattern=FillPattern.Solid), 2367 2397 Line(points={{0,90},{80,70},{80,-40},{70,-40}}, color={0,0,127}), 2368 Line(points={{0,90},{-80,70},{-80,-40},{-70,-40}}, color={0,0,127}), 2398 Line(points={{0,90},{-80,70},{-80,-40},{-70,-40}}, color={0,0,127}), 2399 2369 2400 Text( 2370 2401 extent={{-150,-180},{150,-140}}, … … 2484 2515 2485 2516 // friction torque 2486 tau = if locked then sa*unitTorque else if free then 0 else cgeo*fn*(if startForward then 2487 Modelica.Math.tempInterpol1(w, mue_pos, 2) else if startBackward then 2488 -Modelica.Math.tempInterpol1(-w, mue_pos, 2) else if pre(mode) == 2489 Forward then Modelica.Math.tempInterpol1(w, mue_pos, 2) else - 2490 Modelica.Math.tempInterpol1(-w, mue_pos, 2)); 2517 tau = if mode == Locked then sa*unitTorque else 2518 if mode == Free then 0 else 2519 cgeo*fn*(if mode==Forward then Modelica.Math.tempInterpol1( w, mue_pos, 2) else 2520 -Modelica.Math.tempInterpol1(-w, mue_pos, 2)); 2491 2521 end Brake; 2492 2522 … … 2665 2695 2666 2696 // friction torque 2667 tau = if locked then sa*unitTorque else if free then 0 else cgeo*fn*(if startForward then 2668 Modelica.Math.tempInterpol1(w_rel, mue_pos, 2) else if 2669 startBackward then -Modelica.Math.tempInterpol1(-w_rel, mue_pos, 2) else 2670 if pre(mode) == Forward then Modelica.Math.tempInterpol1(w_rel, mue_pos, 2671 2) else -Modelica.Math.tempInterpol1(-w_rel, mue_pos, 2)); 2697 tau = if mode == Locked then sa*unitTorque else 2698 if mode == Free then 0 else 2699 cgeo*fn*(if mode==Forward then Modelica.Math.tempInterpol1( w_rel, mue_pos, 2) else 2700 -Modelica.Math.tempInterpol1(-w_rel, mue_pos, 2)); 2672 2701 end Clutch; 2673 2702 … … 2683 2712 "Geometry constant containing friction distribution assumption"; 2684 2713 parameter SI.Force fn_max(final min=0, start=1) "Maximum normal force"; 2685 parameter SI.AngularVelocity w_small=1e102686 "Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)"2687 annotation(Dialog(tab="Advanced"));2688 2714 2689 2715 Real u "normalized force input signal (0..1)"; 2690 SI.Force fn "Normal force (fn=fn_max*inPort.signal)"; 2691 Boolean startForward 2692 "true, if w_rel=0 and start of forward sliding or w_rel > w_small"; 2693 Boolean locked "true, if w_rel=0 and not sliding"; 2694 Boolean stuck(final start=false) "w_rel=0 (forward sliding or locked)"; 2695 2716 SI.Force fn "Normal force (fn=fn_max*u)"; 2717 Boolean locked(start=false) "true, if locked"; 2718 Boolean free "true, if not active (no friction)"; 2696 2719 protected 2697 2720 SI.Torque tau0 "Friction torque for w=0 and sliding"; 2698 2721 SI.Torque tau0_max "Maximum friction torque for w=0 and locked"; 2699 2722 Real mue0 "Friction coefficient for w=0 and sliding"; 2700 Boolean free "true, if frictional element is not active";2701 2723 Real sa(final unit="1") 2702 2724 "path parameter of tau = f(a_rel) Friction characteristic"; 2725 constant SI.AngularVelocity w_eps = 1e-8 2726 "If newFrictionDescription: defines region around zero, where the friction state is determined by acceleration, otherwise by w"; 2703 2727 constant Real eps0=1.0e-4 "Relative hysteresis epsilon"; 2704 2728 SI.Torque tau0_max_low "lowest value for tau0_max"; … … 2706 2730 constant SI.AngularAcceleration unitAngularAcceleration = 1; 2707 2731 constant SI.Torque unitTorque = 1; 2732 Real sa0 = (tau0_max + (tau0_max - tau0))/unitTorque 2733 "Value of sa when start of forward sliding at w=0"; 2708 2734 public 2709 2735 Modelica.Blocks.Interfaces.RealInput f_normalized … … 2860 2886 tau0_max = if free then tau0_max_low else peak2*tau0; 2861 2887 2862 /* Friction characteristic 2863 (locked is introduced to help the Modelica translator determining 2864 the different structural configurations, if for each configuration 2865 special code shall be generated) 2866 */ 2867 startForward = pre(stuck) and (sa > tau0_max/unitTorque or pre(startForward) and sa > 2868 tau0/unitTorque or w_rel > w_small) or initial() and (w_rel > 0); 2869 locked = pre(stuck) and not startForward; 2870 2871 // acceleration and friction torque 2872 a_rel = unitAngularAcceleration* (if locked then 0 else sa - tau0/unitTorque); 2873 tau = if locked then sa*unitTorque else (if free then 0 else cgeo*fn* 2874 Modelica.Math.tempInterpol1(w_rel, mue_pos, 2)); 2875 2876 // Determine configuration 2877 stuck = locked or w_rel <= 0; 2888 /* Friction characteristic */ 2889 locked = if w_rel > w_eps then false else 2890 if sa > tau0_max/unitTorque then false else true; 2891 2892 a_rel = unitAngularAcceleration*(if locked then 0 else sa - sa0); 2893 2894 tau = if locked then sa*unitTorque else if free then 0 else 2895 cgeo*fn*Math.tempInterpol1(w_rel, mue_pos, 2); 2878 2896 end OneWayClutch; 2879 2897 … … 3001 3019 SI.Torque tauLossMin "Torque loss for negative speed"; 3002 3020 3003 Boolean tau_aPos(start=true) 3004 "true, if torque of flange_a is not negative"; 3005 Boolean startForward(start=false) "true, if starting to roll forward"; 3006 Boolean startBackward(start=false) "true, if starting to roll backward"; 3007 Boolean locked(start=false) "true, if gear is locked"; 3021 Boolean tau_aPos(start=true) "true, if torque of flange_a is >= 0"; 3008 3022 3009 3023 Boolean ideal "true, if losses are neglected"; 3010 3024 3011 constant Integer Unknown=3 "Value of mode is not known"; 3012 constant Integer Free=2 "Element is not active"; 3013 constant Integer Forward=1 "w_a > 0 (forward rolling)"; 3014 constant Integer Stuck=0 3015 "w_a = 0 (forward rolling, locked or backward rolling)"; 3016 constant Integer Backward=-1 "w_a < 0 (backward rolling)"; 3017 Integer mode( 3018 final min=Backward, 3019 final max=Unknown, 3020 start=Free, 3021 fixed=true); 3025 constant Integer Free=2 "Element is not active" annotation(HideResult=true); 3026 constant Integer Forward=1 "Forward sliding" annotation(HideResult=true); 3027 constant Integer Locked=0 "Locked (no relative motion)" annotation(HideResult=true); 3028 constant Integer Backward=-1 "Backward sliding" annotation(HideResult=true); 3029 Integer mode(final max=2, final min=-1, start=Free) 3030 "Mode of friction element: 2: free, 1: forward sliding, 0: Locked, -1: Backward sliding"; 3022 3031 3023 3032 annotation ( … … 3203 3212 3204 3213 protected 3214 constant SI.AngularVelocity w_eps = 1e-8 3215 "Defines region around zero, where the friction state is determined by acceleration, otherwise by w_a"; 3205 3216 constant SI.AngularAcceleration unitAngularAcceleration = 1; 3206 3217 constant SI.Torque unitTorque = 1; 3207 function equal "Compare whether two Real matrices are identical"3208 3209 extends Modelica.Icons.Function;3210 input Real A[:, :];3211 input Real B[:, :];3212 input Real eps=Modelica.Constants.eps3213 "two numbers r1, r2 are identical if abs(r1-r2) <= eps";3214 output Boolean result;3215 algorithm3216 result := false;3217 if size(A, 1) == size(B, 1) and size(A, 2) == size(B, 2) then3218 result := true;3219 for i in 1:size(A, 1) loop3220 for j in 1:size(A, 2) loop3221 if abs(A[i, j] - B[i, j]) >= eps then3222 result := false;3223 end if;3224 end for;3225 end for;3226 end if;3227 annotation (Documentation(info="<HTML>3228 <p>3229 The function call3230 </p>3231 <pre> equal(A1, A2);3232 </pre>3233 <p>3234 returns <b>true</b>, if the two Real matrices A1 and A2 have the3235 same dimensions and the same elements. Otherwise the function3236 returns <b>false</b>. Two elements r1 and r2 of A1 and A2 respectively3237 are checked on equality by the test 'eps >= abs(r1-r2)', where 'eps'3238 can be provided as third argument of the function (the default is3239 Modelica.Constants.eps).3240 </p>3241 </HTML>"));3242 end equal;3243 3218 equation 3244 3219 assert(abs(ratio) > 0, 3245 3220 "Error in initialization of LossyGear: ratio may not be zero"); 3246 3221 3247 ideal = equal(lossTable, [0, 1, 1, 0, 0]);3222 ideal = Modelica.Math.Matrices.isEqual(lossTable, [0, 1, 1, 0, 0], Modelica.Constants.eps); 3248 3223 3249 3224 interpolation_result = if ideal then [1, 1, 0, 0] else … … 3275 3250 tauLossMin = if tau_aPos then quadrant4 else quadrant3; 3276 3251 3277 // Determine rolling/stuck mode when w_rel = 0 3278 startForward = pre(mode) == Stuck and sa > tauLossMax/unitTorque or initial() and w_a 3279 > 0; 3280 startBackward = pre(mode) == Stuck and sa < tauLossMin/unitTorque or initial() and w_a 3281 < 0; 3282 locked = not (ideal or pre(mode) == Forward or startForward or pre(mode) 3283 == Backward or startBackward); 3284 3285 /* Parameterized curve description a_a = f1(sa), tauLoss = f2(sa) 3286 In comparison to Modelica.Mechanics.Rotational.FrictionBase it is possible 3287 to simplify the following expression as mode == Stuck is assured in case 3288 of startForward or startBackward */ 3289 tauLoss = if ideal then 0 else (if locked then sa*unitTorque else (if (startForward or 3290 pre(mode) == Forward) then tauLossMax else tauLossMin)); 3291 3292 a_a = unitAngularAcceleration*(if locked then 0 else sa - tauLoss/unitTorque); 3293 3294 /* Finite state machine to fix configuration after the computation above 3295 The above equations are only dependent on pre(mode) and not on the actual 3296 value of mode. This prevents loops. So mode can be determined in one step. */ 3297 mode = if ideal then Free else (if (pre(mode) == Forward or startForward) 3298 and w_a > 0 then Forward else if (pre(mode) == Backward or startBackward) 3299 and w_a < 0 then Backward else Stuck); 3252 // Determine mode of friction element 3253 mode = if ideal then Free else 3254 if w_a > w_eps then Forward else 3255 if w_a < -w_eps then Backward else 3256 if sa > tauLossMax/unitTorque then Forward else 3257 if sa < tauLossMin/unitTorque then Backward else Locked; 3258 3259 tauLoss = if ideal then 0 else 3260 if mode == Free then 0 else 3261 if mode == Locked then sa*unitTorque else 3262 if mode == Forward then tauLossMax else tauLossMin; 3263 3264 a_a = unitAngularAcceleration*(if mode==Locked then 0 else sa - tauLoss/unitTorque); 3300 3265 end LossyGear; 3301 3266 … … 3579 3544 fillColor={192,192,192}), 3580 3545 Polygon( 3581 points={{-60,10},{-60,20},{-40,40},{-40,-40},{-60,-20},{-60,10}}, 3546 points={{-60,10},{-60,20},{-40,40},{-40,-40},{-60,-20},{-60,10}}, 3547 3582 3548 lineColor={0,0,0}, 3583 3549 fillPattern=FillPattern.HorizontalCylinder, … … 6236 6202 </p> 6237 6203 </html>")); 6238 // parameter SI.AngularVelocity w_small=1 "Relative angular velocity near to zero (see model info text)"; 6239 parameter SI.AngularVelocity w_small=1.0e10 6240 "Relative angular velocity near to zero if jumps due to a reinit(..) of the velocity can occur (set to low value only if such impulses can occur)" 6241 annotation(Dialog(tab="Advanced")); 6204 6242 6205 // Equations to define the following variables have to be defined in subclasses 6243 6206 SI.AngularVelocity w_relfric … … 6250 6213 SI.Torque tau0_max "Maximum friction torque for w=0 and locked"; 6251 6214 Boolean free "true, if frictional element is not active"; 6215 6252 6216 // Equations to define the following variables are given in this class 6253 6217 Real sa(final unit="1") 6254 6218 "Path parameter of friction characteristic tau = f(a_relfric)"; 6255 Boolean startForward(start=false, fixed=true) 6256 "true, if w_rel=0 and start of forward sliding"; 6257 Boolean startBackward(start=false, fixed=true) 6258 "true, if w_rel=0 and start of backward sliding"; 6259 Boolean locked(start=false) "true, if w_rel=0 and not sliding"; 6260 constant Integer Unknown=3 "Value of mode is not known"; 6261 constant Integer Free=2 "Element is not active"; 6262 constant Integer Forward=1 "w_rel > 0 (forward sliding)"; 6263 constant Integer Stuck=0 6264 "w_rel = 0 (forward sliding, locked or backward sliding)"; 6265 constant Integer Backward=-1 "w_rel < 0 (backward sliding)"; 6266 Integer mode( 6267 final min=Backward, 6268 final max=Unknown, 6269 start=Unknown, fixed=true); 6219 6220 constant Integer Free=2 "Element is not active" annotation(HideResult=true); 6221 constant Integer Forward=1 "Forward sliding" annotation(HideResult=true); 6222 constant Integer Locked=0 "Locked (no relative motion)" annotation(HideResult=true); 6223 constant Integer Backward=-1 "Backward sliding" annotation(HideResult=true); 6224 Integer mode(final max=2, final min=-1, start=Free) 6225 "Mode of friction element: 2: free, 1: forward sliding, 0: Locked, -1: Backward sliding"; 6226 6270 6227 protected 6228 constant SI.AngularVelocity w_eps = 1e-8 6229 "If newFrictionDescription: defines region around zero, where the friction state is determined by acceleration, otherwise by w"; 6271 6230 constant SI.AngularAcceleration unitAngularAcceleration = 1 annotation(HideResult=true); 6272 6231 constant SI.Torque unitTorque = 1 annotation(HideResult=true); … … 6274 6233 "Value of sa when start of forward sliding at w=0"; 6275 6234 equation 6276 /* Friction characteristic 6277 locked is introduced to help the Modelica translator determining 6278 the different structural configurations, 6279 if for each configuration special code shall be generated) 6280 */ 6281 startForward = pre(mode) == Stuck and sa > tau0_max/unitTorque or 6282 pre(mode) == Backward and w_relfric > w_small or initial() and w_relfric > 0; 6283 startBackward = pre(mode) == Stuck and sa < -tau0_max/unitTorque or 6284 pre(mode) == Forward and w_relfric < -w_small or initial() and w_relfric < 0; 6285 locked = not free and 6286 not (pre(mode) == Forward or startForward or pre(mode) == Backward or startBackward); 6287 a_relfric/unitAngularAcceleration = if locked then 0 else 6288 if free then sa else 6289 if startForward then sa - sa0 else 6290 if startBackward then sa + sa0 else 6291 if pre(mode) == Forward then sa - sa0 else 6292 sa + sa0; 6293 /* Friction torque has to be defined in a subclass. Example for a clutch: 6294 tau = if locked then sa else 6295 if free then 0 else 6296 cgeo*fn*(if startForward then Math.tempInterpol1( w_relfric, mue_pos, 2) else 6297 if startBackward then -Math.tempInterpol1(-w_relfric, mue_pos, 2) else 6298 if pre(mode) == Forward then Math.tempInterpol1( w_relfric, mue_pos, 2) else 6299 -Math.tempInterpol1(-w_relfric, mue_pos, 2)); 6300 */ 6301 // finite state machine to determine configuration 6302 mode = if free then Free else 6303 (if (pre(mode) == Forward or pre(mode) == Free or startForward) and w_relfric > 0 then 6304 Forward else 6305 if (pre(mode) == Backward or pre(mode) == Free or startBackward) and w_relfric < 0 then 6306 Backward else 6307 Stuck); 6235 mode = if free then Free else 6236 if w_relfric > w_eps then Forward else 6237 if w_relfric < -w_eps then Backward else 6238 if sa > tau0_max/unitTorque then Forward else 6239 if sa < -tau0_max/unitTorque then Backward else Locked; 6240 6241 a_relfric = unitAngularAcceleration*(if mode == Locked then 0 else 6242 if mode == Free then sa else 6243 if mode == Forward then sa - sa0 else sa + sa0); 6244 6245 /* Friction torque has to be defined in a subclass. Example for a clutch: 6246 tau = if mode == Locked then sa*unitTorque else 6247 if mode == Free then 0 else 6248 cgeo*fn*(if mode==Forward then Math.tempInterpol1(w_relfric, mue_pos, 2) 6249 else -Math.tempInterpol1(-w_relfric, mue_pos, 2)); 6250 */ 6308 6251 end PartialFriction; 6309 6252 -
branches/maintenance/3.0_ImprovedFriction/Modelica/Mechanics/Translational.mo
r1119 r1130 898 898 Text( 899 899 extent={{-98,-68},{102,-94}}, 900 textString="positive force => spool moves in positive direction ", 900 textString="positive force => spool moves in positive direction ", 901 901 902 lineColor={0,0,255}), 902 903 Text( … … 1990 1991 1991 1992 // Friction force 1992 f = if locked thensa*unitForce else1993 (if startForward then Modelica.Math.tempInterpol1( v, f_pos, 2)else1994 if startBackward then -Modelica.Math.tempInterpol1(-v, f_pos, 2) else1995 if pre(mode) == Forward then Modelica.Math.tempInterpol1( v, f_pos, 2) else1996 -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 1997 1998 end SupportFriction; 1998 1999 … … 2179 2180 free = fn <= 0; 2180 2181 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)); 2188 2187 end Brake; 2189 2188 … … 2627 2626 textString="Length L", 2628 2627 lineColor={0,0,255})})); 2628 2629 2629 encapsulated partial model PartialFrictionWithStop 2630 2630 "Base model of Coulomb friction elements with stop" … … 2658 2658 Real sa(unit="1") 2659 2659 "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 2665 2661 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"; 2676 2669 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"; 2677 2672 constant SI.Acceleration unitAcceleration = 1 annotation(HideResult=true); 2678 2673 constant SI.Force unitForce = 1 annotation(HideResult=true); … … 2680 2675 "Value of sa when start of forward sliding at w=0"; 2681 2676 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); 2714 2687 end PartialFrictionWithStop; 2688 2715 2689 equation 2716 2690 // Constant auxiliary variables … … 2718 2692 f0_max = f0*1.001; 2719 2693 free = f0 <= 0 and F_prop <= 0 and s > smin + L/2 and s < smax - L/2; 2694 2720 2695 // Velocity and acceleration of flanges 2721 2696 v = der(s); … … 2723 2698 v_relfric = v; 2724 2699 a_relfric = a; 2700 2725 2701 // Equilibrium of forces 2726 2702 0 = flange_a.f + flange_b.f - f - m*der(v); 2703 2727 2704 // 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 2734 2710 // Define events for hard stops and reinitiliaze the state variables velocity v and position s 2735 2711 algorithm … … 3561 3537 preserveAspectRatio=true, 3562 3538 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}), 3564 3540 Text( 3565 3541 extent={{80,-28},{114,-62}}, … … 3593 3569 preserveAspectRatio=true, 3594 3570 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}), 3596 3572 Text( 3597 3573 extent={{80,-28},{111,-61}}, … … 3627 3603 preserveAspectRatio=true, 3628 3604 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}), 3630 3606 Text( 3631 3607 extent={{80,-28},{115,-60}}, … … 4681 4657 </html>
