| 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 | |
| 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)); |
| 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"; |
| 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); |
| 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 | |
| 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}), |
| 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}), |
| 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}), |
| 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 | |
| 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 | */ |