Changeset 1139

Show
Ignore:
Timestamp:
06/26/08 08:11:32 (4 months ago)
Author:
otter
Message:

Serious bugs in Translational.Components.SupportFriction/Brake fixed (sign of friction was wrong).
Additionally, introduced examples to test these two elements:
- Enhanced Translational.Examples.Friction
- New example Translational.Examples.Brake

Location:
branches/maintenance/3.0/Modelica
Files:
2 modified

Legend:

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

    r1129 r1139  
    55  import SI = Modelica.SIunits; 
    66  annotation ( 
    7   version="1.1.1", versionDate="2007-11-22" 
    8     , 
     7  version="1.1.1", versionDate="2007-11-22", 
    98    Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 
    109            100}}), graphics={ 
     
    159158 
    160159    annotation ( 
    161        
    162160      Documentation(info="<html> 
    163161<p> 
     
    169167</HTML> 
    170168")); 
     169 
    171170    model SignConvention "Examples for the used sign conventions." 
    172171      extends Modelica.Icons.Example; 
     
    277276      extends Modelica.Icons.Example; 
    278277      annotation ( 
    279          
    280278        Documentation(info="<html>  
    281279<p> 
     
    399397      extends Modelica.Icons.Example; 
    400398      annotation ( 
    401          
    402399        Documentation(info="<html> 
    403400<p> 
     
    437434              color={0,0,255})}), 
    438435        experiment(StopTime=1)); 
     436 
    439437      Translational.Components.Fixed fixed  
    440438                                 annotation (Placement(transformation(extent={{ 
     
    629627      extends Modelica.Icons.Example; 
    630628      annotation ( 
    631          
    632629        Documentation(info="<html> 
    633630<p> 
     
    658655            grid={2,2}), graphics), 
    659656        experiment(StopTime=1)); 
     657 
    660658      Translational.Components.Mass mass1( 
    661659        L=1, 
     
    730728      extends Modelica.Icons.Example; 
    731729      annotation ( 
    732          
    733730        Documentation(info="<html> 
    734731<p> 
     
    758755            grid={2,2}), graphics), 
    759756        experiment(StopTime=1)); 
     757 
    760758      Translational.Sensors.ForceSensor forceSensor  annotation (Placement( 
    761759            transformation(extent={{-20,40},{0,60}}, rotation=0))); 
     
    815813            grid={2,2}), graphics={ 
    816814            Text( 
    817               extent={{-56,-88},{62,-100}}, 
    818               textString="simulate 5 s", 
    819               lineColor={0,0,255}), 
    820             Text( 
    821815              extent={{-100,80},{-80,60}}, 
    822816              textString="1)", 
     
    825819              extent={{-100,20},{-80,0}}, 
    826820              textString="2)", 
    827               lineColor={0,0,255})}) 
    828         , 
     821              lineColor={0,0,255}), 
     822            Text( 
     823              extent={{-100,-40},{-80,-60}}, 
     824              lineColor={0,0,255}, 
     825              textString="3)")}), 
    829826        Documentation(info="<html> 
    830827<ol> 
    831 <li> Simulate and then plot Stop1.f as a function of Stop1.v 
     828<li> Simulate and then plot stop1.f as a function of stop1.v 
    832829     This gives the Stribeck curve.</li> 
    833 <li> This model gives an example for a hard stop. However there 
     830<li> The same model is also available by modeling the system with a Mass and 
     831     a SupportFriction model. The SupportFriction model defines the friction characteristic 
     832     with a table. The table is constructed with function 
     833     Examples.Utilities.GenerateStribeckFrictionTable(..) to generate the 
     834     same friction characteristic as with stop1. 
     835     The simulation results of stop1 and of model mass are therefore identical.</li> 
     836<li> Model stop2 gives an example for a hard stop. However there 
    834837     can arise some problems with the used modeling approach (use of 
    835      Reinit, convergence problems). In this case use the ElastoGap 
     838     <b>reinit</b>(..), convergence problems). In this case use the ElastoGap 
    836839     to model a stop (see example Preload).</li> 
    837840</ol> 
     
    848851        F_Coulomb=5, 
    849852        F_Stribeck=10, 
    850         fexp=2)                     annotation (Placement(transformation(extent= 
    851                {{60,60},{80,80}}, rotation=0))); 
     853        fexp=2)                     annotation (Placement(transformation(extent={{20,60}, 
     854                {40,80}},        rotation=0))); 
    852855      Translational.Sources.Force force  
    853                                  annotation (Placement(transformation(extent={{20,60}, 
    854                 {40,80}},        rotation=0))); 
     856                                 annotation (Placement(transformation(extent={{-20,60}, 
     857                {0,80}},         rotation=0))); 
    855858      Modelica.Blocks.Sources.Sine sineForce(amplitude=25, freqHz=0.25)  
    856859                                                                    annotation (Placement( 
    857             transformation(extent={{-20,60},{0,80}}, rotation=0))); 
     860            transformation(extent={{-60,60},{-40,80}}, 
     861                                                     rotation=0))); 
    858862      Modelica.Mechanics.Translational.Components.MassWithStopAndFriction stop2 
    859863        ( 
     
    864868        F_Stribeck=5, 
    865869        s(start=0, fixed=true), 
    866         v(start=-5, fixed=true), 
    867870        m=1, 
    868871        F_prop=1, 
    869         fexp=2)      annotation (Placement(transformation(extent={{60,0},{80,20}}, 
     872        fexp=2, 
     873        v(start=-5, fixed=true))  
     874                     annotation (Placement(transformation(extent={{42,-60},{62, 
     875                -40}}, 
    870876              rotation=0))); 
    871877      Translational.Components.Spring spring(s_rel0=1, c=500)  
    872878                                                    annotation (Placement( 
    873             transformation(extent={{20,0},{40,20}}, rotation=0))); 
     879            transformation(extent={{2,-60},{22,-40}}, 
     880                                                    rotation=0))); 
    874881      Translational.Components.Fixed fixed2(s0=-1.75)  
    875882                                           annotation (Placement(transformation( 
    876               extent={{-22,0},{-2,20}}, rotation=0))); 
    877     equation 
    878       connect(spring.flange_b, stop2.flange_a)  annotation (Line(points={{40,10}, 
    879               {60,10}}, color={0,191,0})); 
     883              extent={{-40,-60},{-20,-40}}, 
     884                                        rotation=0))); 
     885      Translational.Sources.Force force2  
     886                                 annotation (Placement(transformation(extent={{-22,0}, 
     887                {-2,20}},        rotation=0))); 
     888      Components.Mass mass( 
     889        m=1, 
     890        L=1, 
     891        s(fixed=true), 
     892        v(fixed=true)) 
     893        annotation (Placement(transformation(extent={{10,0},{30,20}}))); 
     894      Components.SupportFriction supportFriction(f_pos= 
     895            Examples.Utilities.GenerateStribeckFrictionTable( 
     896                F_prop=1,  
     897                F_Coulomb=5,  
     898                F_Stribeck=10,  
     899                fexp=2,  
     900                v_max=12,  
     901                nTable=50)) 
     902        annotation (Placement(transformation(extent={{40,0},{60,20}}))); 
     903    equation 
     904      connect(spring.flange_b, stop2.flange_a)  annotation (Line(points={{22,-50}, 
     905              {42,-50}},color={0,191,0})); 
    880906      connect(sineForce.y, force.f)  
    881         annotation (Line(points={{1,70},{18,70}}, color={0,0,127})); 
     907        annotation (Line(points={{-39,70},{-22,70}}, 
     908                                                  color={0,0,127})); 
    882909      connect(spring.flange_a, fixed2.flange) annotation (Line( 
    883           points={{20,10},{-12,10}}, 
     910          points={{2,-50},{-30,-50}}, 
    884911          color={0,127,0}, 
    885912          smooth=Smooth.None)); 
    886913      connect(force.flange, stop1.flange_a) annotation (Line( 
    887           points={{40,70},{60,70}}, 
    888           color={0,127,0}, 
     914          points={{0,70},{20,70}}, 
     915          color={0,127,0}, 
     916          smooth=Smooth.None)); 
     917      connect(force2.flange, mass.flange_a) annotation (Line( 
     918          points={{-2,10},{10,10}}, 
     919          color={0,127,0}, 
     920          smooth=Smooth.None)); 
     921      connect(mass.flange_b, supportFriction.flange_a) annotation (Line( 
     922          points={{30,10},{40,10}}, 
     923          color={0,127,0}, 
     924          smooth=Smooth.None)); 
     925      connect(sineForce.y, force2.f) annotation (Line( 
     926          points={{-39,70},{-30,70},{-30,10},{-24,10}}, 
     927          color={0,0,127}, 
    889928          smooth=Smooth.None)); 
    890929    end Friction; 
     
    895934 
    896935      annotation ( 
    897          
    898936        Diagram(coordinateSystem( 
    899937            preserveAspectRatio=true, 
     
    902940            Text( 
    903941              extent={{-98,-68},{102,-94}}, 
    904               textString="positive force => spool moves in positive direction ", 
     942              textString="positive force => spool moves in positive direction ",  
     943 
    905944              lineColor={0,0,255}), 
    906945            Text( 
     
    11761215          smooth=Smooth.None)); 
    11771216    end ElastoGap; 
     1217 
     1218    model Brake "Demonstrate braking of a translational moving mass" 
     1219      extends Modelica.Icons.Example; 
     1220 
     1221      annotation (Diagram(coordinateSystem( 
     1222              preserveAspectRatio=true, extent={{-100,-100},{100,100}}), graphics), 
     1223        experiment(StopTime=2), 
     1224        Documentation(info="<html> 
     1225<p> 
     1226This model consists of a mass with an initial velocity of 1 m/s. 
     1227After 0.1 s, a brake is activated and it is shown that the mass decelerates until 
     1228it arrives at rest and remains at rest. Two versions of this system are present, 
     1229one where the brake is implicitly grounded and one where it is explicitly grounded. 
     1230</p> 
     1231 
     1232</html>")); 
     1233      Modelica.Mechanics.Translational.Components.Brake brake(fn_max=1, useSupport= 
     1234            false)  
     1235        annotation (Placement(transformation(extent={{6,40},{26,20}}))); 
     1236      Modelica.Mechanics.Translational.Components.Mass mass1(m=1, 
     1237        s(fixed=true), 
     1238        v(start=1, fixed=true))  
     1239        annotation (Placement(transformation(extent={{-34,20},{-14,40}}))); 
     1240      Modelica.Blocks.Sources.Step step(startTime=0.1, height=2)  
     1241        annotation (Placement(transformation(extent={{-10,-10},{10,10}}, 
     1242            rotation=0, 
     1243            origin={-24,-10}))); 
     1244      Modelica.Mechanics.Translational.Components.Brake brake1( 
     1245                                                              fn_max=1, useSupport= 
     1246            true)  
     1247        annotation (Placement(transformation(extent={{6,-60},{26,-40}}))); 
     1248      Modelica.Mechanics.Translational.Components.Mass mass2(m=1, 
     1249        s(fixed=true), 
     1250        v(start=1, fixed=true))  
     1251        annotation (Placement(transformation(extent={{-34,-60},{-14,-40}}))); 
     1252      Modelica.Mechanics.Translational.Components.Fixed fixed  
     1253        annotation (Placement(transformation(extent={{6,-80},{26,-60}}))); 
     1254    equation 
     1255      connect(mass1.flange_b, brake.flange_a)  
     1256                                             annotation (Line( 
     1257          points={{-14,30},{6,30}}, 
     1258          color={0,127,0}, 
     1259          smooth=Smooth.None)); 
     1260      connect(step.y, brake.f_normalized) annotation (Line( 
     1261          points={{-13,-10},{16,-10},{16,19}}, 
     1262          color={0,0,127}, 
     1263          smooth=Smooth.None)); 
     1264      connect(mass2.flange_b, brake1.flange_a)  
     1265                                             annotation (Line( 
     1266          points={{-14,-50},{6,-50}}, 
     1267          color={0,127,0}, 
     1268          smooth=Smooth.None)); 
     1269      connect(step.y, brake1.f_normalized) annotation (Line( 
     1270          points={{-13,-10},{16,-10},{16,-39}}, 
     1271          color={0,0,127}, 
     1272          smooth=Smooth.None)); 
     1273      connect(fixed.flange, brake1.support) annotation (Line( 
     1274          points={{16,-70},{16,-60}}, 
     1275          color={0,127,0}, 
     1276          smooth=Smooth.None)); 
     1277    end Brake; 
     1278 
     1279    package Utilities "Utility classes used by the Example models" 
     1280      extends Modelica.Icons.Library; 
     1281      function GenerateStribeckFrictionTable 
     1282        "Generate stribeck friction table for example Friction for the SupportFriction" 
     1283         input Real F_prop(final unit="N.s/m", final min=0) 
     1284          "Velocity dependent friction coefficient"; 
     1285         input Modelica.SIunits.Force F_Coulomb 
     1286          "Constant friction: Coulomb force"; 
     1287         input Modelica.SIunits.Force F_Stribeck "Stribeck effect"; 
     1288         input Real fexp(final unit="s/m", final min=0) "Exponential decay"; 
     1289         input Real v_max "Generate table from v=0 ... v_max"; 
     1290         input Integer nTable(min=2)=100 "Number of table points"; 
     1291         output Real table[nTable,2] "Friction table"; 
     1292      algorithm 
     1293         for i in 1:nTable loop 
     1294            table[i,1] :=v_max*(i - 1)/(nTable - 1); 
     1295            table[i,2] :=F_Coulomb + F_prop*table[i, 1] + 
     1296                         F_Stribeck*exp(-fexp*table[i, 1]); 
     1297         end for; 
     1298        annotation (Documentation(info="<html> 
     1299<p> 
     1300Returns a table with the friction characteristic table[nTable,2] = [0, f1; ....; v_max, fn], where the first 
     1301column is the velocity v in the range 0..v_max and the second column is the friction force 
     1302according to the stribeck curve: 
     1303</p> 
     1304<pre> 
     1305  F_Coulomb + F_prop*v + F_Stribeck*exp(-fexp*v); 
     1306</pre> 
     1307 
     1308</html>")); 
     1309      end GenerateStribeckFrictionTable; 
     1310    end Utilities; 
    11781311  end Examples; 
    11791312 
     
    11951328 
    11961329      annotation ( 
    1197          
    11981330        Icon(coordinateSystem( 
    11991331            preserveAspectRatio=true, 
     
    12281360</HTML> 
    12291361")); 
     1362 
    12301363      Interfaces.Flange_b flange   annotation (Placement(transformation( 
    12311364            origin={0,0}, 
     
    12461379 
    12471380      annotation ( 
    1248          
    12491381        Documentation(info="<html> 
    12501382<p> 
     
    13281460              textString="Position s", 
    13291461              lineColor={0,0,255})})); 
     1462 
    13301463    equation 
    13311464      v = der(s); 
     
    13381471 
    13391472      annotation ( 
    1340          
    13411473        Documentation(info="<html> 
    13421474<p> 
     
    14041536              textString="Length L", 
    14051537              lineColor={0,0,255})})); 
     1538 
    14061539    equation 
    14071540      0 = flange_a.f + flange_b.f; 
     
    14151548 
    14161549      annotation ( 
    1417          
    14181550        Documentation(info="<html> 
    14191551<p> 
     
    14591591            Line(points={{-86,0},{-60,0},{-44,-30},{-16,30},{14,-30},{44,30},{ 
    14601592                  60,0},{84,0}}, color={0,0,0})})); 
     1593 
    14611594    equation 
    14621595      f = c*(s_rel - s_rel0); 
     
    14681601        "damping constant"; 
    14691602      annotation ( 
    1470          
    14711603        Documentation(info="<html> 
    14721604<p> 
     
    15251657              lineColor={128,128,128}, 
    15261658              textString="der(s_rel)")})); 
     1659 
    15271660    equation 
    15281661      f = d*v_rel; 
     
    15371670      parameter SI.Position s_rel0=0 "unstretched spring length"; 
    15381671      annotation ( 
    1539          
    15401672        Documentation(info="<html> 
    15411673<p> 
     
    16101742            Line(points={{-90,0},{-80,0}}, color={0,0,0}), 
    16111743            Line(points={{90,0},{80,0}}, color={0,0,0})})); 
     1744 
    16121745    equation 
    16131746      f = c*(s_rel - s_rel0) + d*v_rel; 
     
    16231756 
    16241757      annotation ( 
    1625          
    16261758        Documentation(info="<html> 
    16271759<p> 
     
    17891921              textString="%name", 
    17901922              lineColor={0,0,255})})); 
     1923 
    17911924    /* 
    17921925Please note that initialization might fail due to the nonlinear spring characteristic 
     
    19912124 
    19922125    // Friction force 
    1993       flange_a.f + flange_b.f + f = 0; 
     2126      flange_a.f + flange_b.f - f = 0; 
    19942127 
    19952128    // Friction force 
     
    21772310 
    21782311    // Friction force, normal force and friction force for v_rel=0 
    2179       flange_a.f + flange_b.f + f = 0; 
     2312      flange_a.f + flange_b.f - f = 0; 
    21802313      fn = fn_max*f_normalized; 
    21812314      f0 = mue0*cgeo*fn; 
     
    24772610<li><i>June 10, 2002 by P. Beater, StateSelect.always for variables s and v (instead of fixed=true). </i> </li> 
    24782611</ul> 
    2479 </html>") 
    2480         , 
     2612</html>"), 
    24812613        Icon(coordinateSystem( 
    24822614            preserveAspectRatio=true, 
     
    27712903      SI.Acceleration a_rel(start=0) "relative angular acceleration"; 
    27722904      annotation ( 
    2773          
    27742905        Documentation(info="<html> 
    27752906<p> 
     
    28662997              color={0,0,0}, 
    28672998              pattern=LinePattern.Dash)})); 
     2999 
    28683000    equation 
    28693001      s_rel = flange_b.s - flange_a.s; 
     
    29113043      constant Real bf=0.6180 "s*s coefficient of Bessel filter"; 
    29123044      annotation ( 
    2913          
    29143045        Documentation(info="<HTML> 
    29153046<p> 
     
    29823113            extent={{-100,-100},{100,100}}, 
    29833114            grid={2,2}), graphics)); 
     3115 
    29843116    initial equation 
    29853117      if not exact then 
     
    30153147            transformation(extent={{-140,-20},{-100,20}}, rotation=0))); 
    30163148      annotation ( 
    3017          
    30183149        Documentation(info="<HTML> 
    30193150<p> 
     
    30863217            extent={{-100,-100},{100,100}}, 
    30873218            grid={2,2}), graphics)); 
     3219 
    30883220    protected 
    30893221      parameter Modelica.SIunits.AngularFrequency w_crit=2*Modelica.Constants.pi*f_crit 
     
    31193251              rotation=0))); 
    31203252      annotation ( 
    3121          
    31223253        Documentation(info="<html> 
    31233254<p> 
     
    31663297            extent={{-100,-100},{100,100}}, 
    31673298            grid={2,2}), graphics)); 
     3299 
    31683300    equation 
    31693301      v = der(s); 
     
    32373369              extent={{150,60},{-150,100}}, 
    32383370              textString="%name", 
    3239               lineColor={0,0,255})}) 
    3240         ); 
     3371              lineColor={0,0,255})})); 
    32413372    protected 
    32423373      function position 
     
    32883419              extent={{-140,-20},{-100,20}}, rotation=0))); 
    32893420      annotation ( 
    3290          
    32913421        Documentation(info="<html> 
    32923422<p> 
     
    33353465            extent={{-100,-100},{100,100}}, 
    33363466            grid={2,2}), graphics)); 
     3467 
    33373468    equation 
    33383469      flange.f = -f; 
     
    33493480            origin={0,40}))); 
    33503481      annotation ( 
    3351          
    33523482        Documentation(info="<html> 
    33533483<p> 
     
    33883518            extent={{-100,-100},{100,100}}, 
    33893519            grid={2,2}), graphics)); 
     3520 
    33903521    equation 
    33913522      flange_a.f =  f; 
     
    35213652 
    35223653    annotation ( 
    3523        
    35243654      Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, 
    35253655              100}}), graphics={ 
     
    35573687                -10},{120,10}}))); 
    35583688      annotation ( 
    3559          
    35603689        Documentation(info="<html> 
    35613690<p> 
     
    35693698            preserveAspectRatio=true, 
    35703699            extent={{-100,-100},{100,100}}, 
    3571             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3700            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    35723701              Text( 
    35733702              extent={{80,-28},{114,-62}}, 
     
    35783707            extent={{-100,-100},{100,100}}, 
    35793708            grid={1,1}), graphics)); 
     3709 
    35803710    equation 
    35813711      s = flange.s; 
     
    35893719              rotation=0))); 
    35903720      annotation ( 
    3591          
    35923721        Documentation(info="<html> 
    35933722<p> 
     
    36013730            preserveAspectRatio=true, 
    36023731            extent={{-100,-100},{100,100}}, 
    3603             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3732            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    36043733              Text( 
    36053734              extent={{80,-28},{111,-61}}, 
     
    36103739            extent={{-100,-100},{100,100}}, 
    36113740            grid={1,1}), graphics)); 
     3741 
    36123742    equation 
    36133743      v = der(flange.s); 
     
    36223752              rotation=0))); 
    36233753      annotation ( 
    3624          
    36253754        Documentation(info="<html> 
    36263755<p> 
     
    36353764            preserveAspectRatio=true, 
    36363765            extent={{-100,-100},{100,100}}, 
    3637             grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}), 
     3766            grid={1,1}), graphics={Line(points={{-70,0},{-90,0}}, color={0,0,0}),  
    36383767              Text( 
    36393768              extent={{80,-28},{115,-60}},