| 1 | within Modelica.Mechanics; |
|---|
| 2 | package Translational |
|---|
| 3 | "Library to model 1-dimensional, translational mechanical systems" |
|---|
| 4 | extends Modelica.Icons.Library2; |
|---|
| 5 | import SI = Modelica.SIunits; |
|---|
| 6 | annotation ( |
|---|
| 7 | version="1.1.1", versionDate="2007-11-22", |
|---|
| 8 | Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100, |
|---|
| 9 | 100}}), graphics={ |
|---|
| 10 | Line(points={{-84,-73},{66,-73}}, color={0,0,0}), |
|---|
| 11 | Rectangle( |
|---|
| 12 | extent={{-81,-22},{-8,-65}}, |
|---|
| 13 | lineColor={0,0,0}, |
|---|
| 14 | fillPattern=FillPattern.Sphere, |
|---|
| 15 | fillColor={192,192,192}), |
|---|
| 16 | Line(points={{-8,-43},{-1,-43},{6,-64},{17,-23},{29,-65},{40,-23},{50,-44}, |
|---|
| 17 | {61,-44}}, color={0,0,0}), |
|---|
| 18 | Line(points={{-59,-73},{-84,-93}}, color={0,0,0}), |
|---|
| 19 | Line(points={{-11,-73},{-36,-93}}, color={0,0,0}), |
|---|
| 20 | Line(points={{-34,-73},{-59,-93}}, color={0,0,0}), |
|---|
| 21 | Line(points={{14,-73},{-11,-93}}, color={0,0,0}), |
|---|
| 22 | Line(points={{39,-73},{14,-93}}, color={0,0,0}), |
|---|
| 23 | Line(points={{63,-73},{38,-93}}, color={0,0,0})}), |
|---|
| 24 | Documentation(info="<html> |
|---|
| 25 | <p> |
|---|
| 26 | This package contains components to model <i>1-dimensional translational |
|---|
| 27 | mechanical</i> systems. |
|---|
| 28 | </p> |
|---|
| 29 | <p> |
|---|
| 30 | The <i>filled</i> and <i>non-filled green squares</i> at the left and |
|---|
| 31 | right side of a component represent <i>mechanical flanges</i>. |
|---|
| 32 | Drawing a line between such squares means that the corresponding |
|---|
| 33 | flanges are <i>rigidly attached</i> to each other. The components of this |
|---|
| 34 | library can be usually connected together in an arbitrary way. E.g. it is |
|---|
| 35 | possible to connect two springs or two sliding masses with inertia directly |
|---|
| 36 | together. |
|---|
| 37 | <p> The only <i>connection restriction</i> is that the Coulomb friction |
|---|
| 38 | elements (e.g. MassWithStopAndFriction) should be only connected |
|---|
| 39 | together provided a compliant element, such as a spring, is in between. |
|---|
| 40 | The reason is that otherwise the frictional force is not uniquely |
|---|
| 41 | defined if the elements are stuck at the same time instant (i.e., there |
|---|
| 42 | does not exist a unique solution) and some simulation systems may not be |
|---|
| 43 | able to handle this situation, since this leads to a singularity during |
|---|
| 44 | simulation. It can only be resolved in a \"clean way\" by combining the |
|---|
| 45 | two connected friction elements into |
|---|
| 46 | one component and resolving the ambiguity of the frictional force in the |
|---|
| 47 | stuck mode. |
|---|
| 48 | </p> |
|---|
| 49 | <p> Another restriction arises if the hard stops in model MassWithStopAndFriction are used, i. e. |
|---|
| 50 | the movement of the mass is limited by a stop at smax or smin. |
|---|
| 51 | <font color=\"#ff0000\"> <b>This requires the states Stop.s and Stop.v</b> </font>. If these states are eliminated during the index reduction |
|---|
| 52 | the model will not work. To avoid this any inertias should be connected via springs |
|---|
| 53 | to the Stop element, other sliding masses, dampers or hydraulic chambers must be avoided. </p> |
|---|
| 54 | <p> |
|---|
| 55 | In the <i>icon</i> of every component an <i>arrow</i> is displayed in grey |
|---|
| 56 | color. This arrow characterizes the coordinate system in which the vectors |
|---|
| 57 | of the component are resolved. It is directed into the positive |
|---|
| 58 | translational direction (in the mathematical sense). |
|---|
| 59 | In the flanges of a component, a coordinate system is rigidly attached |
|---|
| 60 | to the flange. It is called <i>flange frame</i> and is directed in parallel |
|---|
| 61 | to the component coordinate system. As a result, e.g., the positive |
|---|
| 62 | cut-force of a \"left\" flange (flange_a) is directed into the flange, whereas |
|---|
| 63 | the positive cut-force of a \"right\" flange (flange_b) is directed out of the |
|---|
| 64 | flange. A flange is described by a Modelica connector containing |
|---|
| 65 | the following variables: |
|---|
| 66 | </p> |
|---|
| 67 | <pre> |
|---|
| 68 | Modelica.SIunits.Position s \"Absolute position of flange\"; |
|---|
| 69 | <b>flow</b> Modelica.SIunits.Force f \"Cut-force in the flange\"; |
|---|
| 70 | </pre> |
|---|
| 71 | |
|---|
| 72 | <p> |
|---|
| 73 | This library is designed in a fully object oriented way in order that |
|---|
| 74 | components can be connected together in every meaningful combination |
|---|
| 75 | (e.g. direct connection of two springs or two shafts with inertia). |
|---|
| 76 | As a consequence, most models lead to a system of |
|---|
| 77 | differential-algebraic equations of <i>index 3</i> (= constraint |
|---|
| 78 | equations have to be differentiated twice in order to arrive at |
|---|
| 79 | a state space representation) and the Modelica translator or |
|---|
| 80 | the simulator has to cope with this system representation. |
|---|
| 81 | According to our present knowledge, this requires that the |
|---|
| 82 | Modelica translator is able to symbolically differentiate equations |
|---|
| 83 | (otherwise it is e.g. not possible to provide consistent initial |
|---|
| 84 | conditions; even if consistent initial conditions are present, most |
|---|
| 85 | numerical DAE integrators can cope at most with index 2 DAEs). |
|---|
| 86 | </p> |
|---|
| 87 | |
|---|
| 88 | <dl> |
|---|
| 89 | <dt><b>Library Officer</b> |
|---|
| 90 | <dd><a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> <br> |
|---|
| 91 | Deutsches Zentrum für Luft und Raumfahrt e.V. (DLR)<br> |
|---|
| 92 | Institut für Robotik und Mechatronik (DLR-RM)<br> |
|---|
| 93 | Abteilung Systemdynamik und Regelungstechnik<br> |
|---|
| 94 | Postfach 1116<br> |
|---|
| 95 | D-82230 Wessling<br> |
|---|
| 96 | Germany<br> |
|---|
| 97 | email: <A HREF=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</A><br><br> |
|---|
| 98 | </dl> |
|---|
| 99 | |
|---|
| 100 | <p> |
|---|
| 101 | <b>Contributors to this library:</b> |
|---|
| 102 | </p> |
|---|
| 103 | |
|---|
| 104 | <ul> |
|---|
| 105 | <li> Main author until 2006:<br> |
|---|
| 106 | Peter Beater <br> |
|---|
| 107 | Universität Paderborn, Abteilung Soest<br> |
|---|
| 108 | Fachbereich Maschinenbau/Automatisierungstechnik<br> |
|---|
| 109 | Lübecker Ring 2 <br> |
|---|
| 110 | D 59494 Soest <br> |
|---|
| 111 | Germany <br> |
|---|
| 112 | email: <A HREF=\"mailto:Beater@mailso.uni-paderborn.de\">Beater@mailso.uni-paderborn.de</A><br><br> |
|---|
| 113 | </li> |
|---|
| 114 | |
|---|
| 115 | <li> <a href=\"http://www.haumer.at/\">Anton Haumer</a><br> |
|---|
| 116 | Technical Consulting & Electrical Engineering<br> |
|---|
| 117 | A-3423 St.Andrae-Woerdern, Austria<br> |
|---|
| 118 | email: <a href=\"mailto:a.haumer@haumer.at\">a.haumer@haumer.at</a><br><br></li> |
|---|
| 119 | |
|---|
| 120 | <li> <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> (DLR-RM)</li> |
|---|
| 121 | </ul> |
|---|
| 122 | |
|---|
| 123 | <p> |
|---|
| 124 | Copyright © 1998-2008, Modelica Association, Anton Haumer and Universität Paderborn, FB 12. |
|---|
| 125 | </p> |
|---|
| 126 | <p> |
|---|
| 127 | <i>This Modelica package is <b>free</b> software; it can be redistributed and/or modified |
|---|
| 128 | under the terms of the <b>Modelica license</b>, see the license conditions |
|---|
| 129 | and the accompanying <b>disclaimer</b> |
|---|
| 130 | <a href=\"Modelica://Modelica.UsersGuide.ModelicaLicense\">here</a>.</i> |
|---|
| 131 | </p><br> |
|---|
| 132 | |
|---|
| 133 | </HTML> |
|---|
| 134 | ", revisions="<html> |
|---|
| 135 | <ul> |
|---|
| 136 | <li><i>Version 1.0 (January 5, 2000)</i> |
|---|
| 137 | by Peter Beater <br> |
|---|
| 138 | Realized a first version based on Modelica library Mechanics.Rotational |
|---|
| 139 | by Martin Otter and an existing Dymola library onedof.lib by Peter Beater. |
|---|
| 140 | <br> |
|---|
| 141 | <li><i>Version 1.01 (July 18, 2001)</i> |
|---|
| 142 | by Peter Beater <br> |
|---|
| 143 | Assert statement added to \"Stop\", small bug fixes in examples. |
|---|
| 144 | <br> |
|---|
| 145 | </li> |
|---|
| 146 | <li><i>Version 1.1.0 2007-11-16</i> |
|---|
| 147 | by Anton Haumer<br> |
|---|
| 148 | Redesign for Modelica 3.0-compliance<br> |
|---|
| 149 | Added new components acording to Mechanics.Rotational library |
|---|
| 150 | <br> |
|---|
| 151 | </li> |
|---|
| 152 | </ul> |
|---|
| 153 | </html>")); |
|---|
| 154 | |
|---|
| 155 | package Examples "Demonstration examples of the components of this package" |
|---|
| 156 | |
|---|
| 157 | extends Modelica.Icons.Library; |
|---|
| 158 | |
|---|
| 159 | annotation ( |
|---|
| 160 | Documentation(info="<html> |
|---|
| 161 | <p> |
|---|
| 162 | This package contains example models to demonstrate the usage of the |
|---|
| 163 | Translational package. Open the models and |
|---|
| 164 | simulate them according to the provided description in the models. |
|---|
| 165 | </p> |
|---|
| 166 | |
|---|
| 167 | </HTML> |
|---|
| 168 | ")); |
|---|
| 169 | |
|---|
| 170 | model SignConvention "Examples for the used sign conventions." |
|---|
| 171 | extends Modelica.Icons.Example; |
|---|
| 172 | annotation (Documentation(info="<html> |
|---|
| 173 | <p> |
|---|
| 174 | If all arrows point in the same direction a positive force |
|---|
| 175 | results in a positive acceleration a, velocity v and position s. |
|---|
| 176 | </p> |
|---|
| 177 | For a force of 1 N and a mass of 1 Kg this leads to |
|---|
| 178 | <pre> |
|---|
| 179 | a = 1 m/s2 |
|---|
| 180 | v = 1 m/s after 1 s (SlidingMass1.v) |
|---|
| 181 | s = 0.5 m after 1 s (SlidingMass1.s) |
|---|
| 182 | </pre> |
|---|
| 183 | The acceleration is not available for plotting. |
|---|
| 184 | <p> |
|---|
| 185 | </p> |
|---|
| 186 | System 1) and 2) are equivalent. It doesn't matter whether the |
|---|
| 187 | force pushes at flange_a in system 1 or pulls at flange_b in system 2. |
|---|
| 188 | </p><p> |
|---|
| 189 | It is of course possible to ignore the arrows and connect the models |
|---|
| 190 | in an arbitrary way. But then it is hard see in what direction the |
|---|
| 191 | force acts. |
|---|
| 192 | </p><p> |
|---|
| 193 | In the third system the two arrows are opposed which means that the |
|---|
| 194 | force acts in the opposite direction (in the same direction as in |
|---|
| 195 | the two other examples). |
|---|
| 196 | </p> |
|---|
| 197 | |
|---|
| 198 | </HTML> |
|---|
| 199 | "), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{ |
|---|
| 200 | 100,100}}), graphics={ |
|---|
| 201 | Text( |
|---|
| 202 | extent={{-100,80},{-82,60}}, |
|---|
| 203 | textString="1)", |
|---|
| 204 | lineColor={0,0,255}), |
|---|
| 205 | Text( |
|---|
| 206 | extent={{-100,40},{-82,20}}, |
|---|
| 207 | textString="2)", |
|---|
| 208 | lineColor={0,0,255}), |
|---|
| 209 | Text( |
|---|
| 210 | extent={{-100,-20},{-82,-40}}, |
|---|
| 211 | textString="3)", |
|---|
| 212 | lineColor={0,0,255})}), |
|---|
| 213 | experiment(StopTime=1)); |
|---|
| 214 | Translational.Components.Mass mass1(L=1, |
|---|
| 215 | s(fixed=true), |
|---|
| 216 | v(fixed=true), |
|---|
| 217 | m=1) annotation (Placement( |
|---|
| 218 | transformation(extent={{40,60},{60,80}}, rotation=0))); |
|---|
| 219 | Translational.Sources.Force force1 |
|---|
| 220 | annotation (Placement(transformation(extent={{ |
|---|
| 221 | -4,60},{16,80}}, rotation=0))); |
|---|
| 222 | Modelica.Blocks.Sources.Constant constant1(k=1) |
|---|
| 223 | annotation (Placement(transformation(extent={{ |
|---|
| 224 | -44,60},{-24,80}}, rotation=0))); |
|---|
| 225 | Translational.Components.Mass mass2(L=1, |
|---|
| 226 | s(fixed=true), |
|---|
| 227 | v(fixed=true), |
|---|
| 228 | m=1) annotation (Placement( |
|---|
| 229 | transformation(extent={{40,0},{60,20}}, rotation=0))); |
|---|
| 230 | Translational.Sources.Force force2 |
|---|
| 231 | annotation (Placement(transformation(extent={{ |
|---|
| 232 | -4,20},{16,40}}, rotation=0))); |
|---|
| 233 | Modelica.Blocks.Sources.Constant constant2(k=1) |
|---|
| 234 | annotation (Placement(transformation(extent={{ |
|---|
| 235 | -44,20},{-24,40}}, rotation=0))); |
|---|
| 236 | Translational.Components.Mass mass3(L=1, |
|---|
| 237 | s(fixed=true), |
|---|
| 238 | v(fixed=true), |
|---|
| 239 | m=1) annotation (Placement( |
|---|
| 240 | transformation(extent={{-40,-40},{-20,-20}}, rotation=0))); |
|---|
| 241 | Translational.Sources.Force force3(useSupport=true) |
|---|
| 242 | annotation (Placement(transformation(extent={{ |
|---|
| 243 | 20,-40},{0,-20}}, rotation=0))); |
|---|
| 244 | Modelica.Blocks.Sources.Constant constant3(k=1) |
|---|
| 245 | annotation (Placement(transformation(extent={{ |
|---|
| 246 | 60,-40},{40,-20}}, rotation=0))); |
|---|
| 247 | Translational.Components.Fixed fixed |
|---|
| 248 | annotation (Placement(transformation(extent={{0,-60},{20,-40}}))); |
|---|
| 249 | equation |
|---|
| 250 | connect(constant1.y,force1. f) annotation (Line(points={{-23,70},{-6,70}}, |
|---|
| 251 | color={0,0,127})); |
|---|
| 252 | connect(constant2.y,force2. f) annotation (Line(points={{-23,30},{-6,30}}, |
|---|
| 253 | color={0,0,127})); |
|---|
| 254 | connect(constant3.y,force3. f) annotation (Line(points={{39,-30},{22,-30}}, |
|---|
| 255 | color={0,0,127})); |
|---|
| 256 | connect(force1.flange, mass1.flange_a) annotation (Line( |
|---|
| 257 | points={{16,70},{40,70}}, |
|---|
| 258 | color={0,127,0}, |
|---|
| 259 | smooth=Smooth.None)); |
|---|
| 260 | connect(force2.flange, mass2.flange_b) annotation (Line( |
|---|
| 261 | points={{16,30},{70,30},{70,10},{60,10}}, |
|---|
| 262 | color={0,127,0}, |
|---|
| 263 | smooth=Smooth.None)); |
|---|
| 264 | connect(mass3.flange_b, force3.flange) annotation (Line( |
|---|
| 265 | points={{-20,-30},{0,-30}}, |
|---|
| 266 | color={0,127,0}, |
|---|
| 267 | smooth=Smooth.None)); |
|---|
| 268 | connect(fixed.flange, force3.support) annotation (Line( |
|---|
| 269 | points={{10,-50},{10,-40}}, |
|---|
| 270 | color={0,127,0}, |
|---|
| 271 | smooth=Smooth.None)); |
|---|
| 272 | end SignConvention; |
|---|
| 273 | |
|---|
| 274 | model InitialConditions "Setting of initial conditions" |
|---|
| 275 | |
|---|
| 276 | extends Modelica.Icons.Example; |
|---|
| 277 | annotation ( |
|---|
| 278 | Documentation(info="<html> |
|---|
| 279 | <p> |
|---|
| 280 | There are several ways to set initial conditions. |
|---|
| 281 | In the first system the position of the mass m3 was defined |
|---|
| 282 | by using the modifier s(start=4.5), the position of m4 by s(start=12.5). |
|---|
| 283 | These positions were chosen such that the system is a rest. To calculate |
|---|
| 284 | these values start at the left (Fixed1) with a value of 1 m. The spring |
|---|
| 285 | has an unstreched length of 2 m and m3 an length of 3 m, which leads to |
|---|
| 286 | </p> |
|---|
| 287 | |
|---|
| 288 | <pre> |
|---|
| 289 | 1 m (fixed1) |
|---|
| 290 | + 2 m (spring s2) |
|---|
| 291 | + 3/2 m (half of the length of mass m3) |
|---|
| 292 | ------- |
|---|
| 293 | 4,5 m = s(start = 4.5) for m3 |
|---|
| 294 | + 3/2 m (half of the length of mass m3) |
|---|
| 295 | + 4 m (springDamper 2) |
|---|
| 296 | + 5/2 m (half of length of mass m4) |
|---|
| 297 | ------- |
|---|
| 298 | 12,5 m = s(start = 12.5) for m4 |
|---|
| 299 | </pre> |
|---|
| 300 | |
|---|
| 301 | <p> |
|---|
| 302 | This selection of initial conditions has the effect that Dymola selects |
|---|
| 303 | those variables (m3.s and m4.s) as state variables. |
|---|
| 304 | In the second example the length of the springs are given as start values |
|---|
| 305 | but they cannot be used as state for pure springs (only for the spring/damper |
|---|
| 306 | combination). In this case the system is not at rest. |
|---|
| 307 | </p> |
|---|
| 308 | |
|---|
| 309 | <p> |
|---|
| 310 | <IMG SRC=../Images/Translational/Fig.translational.examples.InitialConditions.png> |
|---|
| 311 | </p> |
|---|
| 312 | |
|---|
| 313 | |
|---|
| 314 | </html> |
|---|
| 315 | "), experiment(StopTime=5), |
|---|
| 316 | Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100}, |
|---|
| 317 | {100,100}}), |
|---|
| 318 | graphics)); |
|---|
| 319 | |
|---|
| 320 | Translational.Components.Fixed fixed2( s0=1) |
|---|
| 321 | annotation (Placement(transformation( |
|---|
| 322 | extent={{-100,60},{-80,80}}, rotation=0))); |
|---|
| 323 | Translational.Components.Spring s2( s_rel0=2, c=1e3) |
|---|
| 324 | annotation (Placement( |
|---|
| 325 | transformation(extent={{-60,60},{-40,80}}, rotation=0))); |
|---|
| 326 | Translational.Components.Mass m3( L=3, s(start=4.5, fixed=true), |
|---|
| 327 | v(fixed=true), |
|---|
| 328 | m=1) annotation (Placement( |
|---|
| 329 | transformation(extent={{-20,60},{0,80}}, rotation=0))); |
|---|
| 330 | Translational.Components.SpringDamper sd2( s_rel0=4, c=111, |
|---|
| 331 | d=1) annotation (Placement( |
|---|
| 332 | transformation(extent={{20,60},{40,80}}, rotation=0))); |
|---|
| 333 | Translational.Components.Mass m4( L=5, s(start=12.5, fixed=true), |
|---|
| 334 | v(fixed=true), |
|---|
| 335 | m=1) annotation (Placement( |
|---|
| 336 | transformation(extent={{60,60},{80,80}}, rotation=0))); |
|---|
| 337 | |
|---|
| 338 | Translational.Components.Fixed fixed1( s0=-1) |
|---|
| 339 | annotation (Placement(transformation( |
|---|
| 340 | extent={{-100,-20},{-80,0}}, rotation=0))); |
|---|
| 341 | Translational.Components.Spring s1( |
|---|
| 342 | s_rel0=1, |
|---|
| 343 | c=1e3, |
|---|
| 344 | s_rel(start=1, fixed=true)) |
|---|
| 345 | annotation (Placement(transformation(extent={{-58,-20}, |
|---|
| 346 | {-38,0}}, rotation=0))); |
|---|
| 347 | Translational.Components.Mass m1( L=1, v(fixed=true), |
|---|
| 348 | m=1) annotation (Placement(transformation( |
|---|
| 349 | extent={{-20,-20},{0,0}}, rotation=0))); |
|---|
| 350 | Translational.Components.SpringDamper sd1( |
|---|
| 351 | s_rel0=1, |
|---|
| 352 | c=111, |
|---|
| 353 | s_rel(start=1, fixed=true), |
|---|
| 354 | v_rel(fixed=true), |
|---|
| 355 | d=1) annotation (Placement(transformation(extent={{20,-20},{ |
|---|
| 356 | 40,0}}, rotation=0))); |
|---|
| 357 | Translational.Components.Mass m2( L=2, m=1) |
|---|
| 358 | annotation (Placement(transformation( |
|---|
| 359 | extent={{60,-20},{80,0}}, rotation=0))); |
|---|
| 360 | equation |
|---|
| 361 | connect(s2.flange_a, fixed2.flange) annotation (Line( |
|---|
| 362 | points={{-60,70},{-90,70}}, |
|---|
| 363 | color={0,127,0}, |
|---|
| 364 | smooth=Smooth.None)); |
|---|
| 365 | connect(s1.flange_a, fixed1.flange) annotation (Line( |
|---|
| 366 | points={{-58,-10},{-90,-10}}, |
|---|
| 367 | color={0,127,0}, |
|---|
| 368 | smooth=Smooth.None)); |
|---|
| 369 | connect(m1.flange_a, s1.flange_b) annotation (Line( |
|---|
| 370 | points={{-20,-10},{-38,-10}}, |
|---|
| 371 | color={0,127,0}, |
|---|
| 372 | smooth=Smooth.None)); |
|---|
| 373 | connect(sd1.flange_a, m1.flange_b) annotation (Line( |
|---|
| 374 | points={{20,-10},{0,-10}}, |
|---|
| 375 | color={0,127,0}, |
|---|
| 376 | smooth=Smooth.None)); |
|---|
| 377 | connect(m2.flange_a, sd1.flange_b) annotation (Line( |
|---|
| 378 | points={{60,-10},{40,-10}}, |
|---|
| 379 | color={0,127,0}, |
|---|
| 380 | smooth=Smooth.None)); |
|---|
| 381 | connect(m4.flange_a, sd2.flange_b) annotation (Line( |
|---|
| 382 | points={{60,70},{40,70}}, |
|---|
| 383 | color={0,127,0}, |
|---|
| 384 | smooth=Smooth.None)); |
|---|
| 385 | connect(sd2.flange_a, m3.flange_b) annotation (Line( |
|---|
| 386 | points={{20,70},{0,70}}, |
|---|
| 387 | color={0,127,0}, |
|---|
| 388 | smooth=Smooth.None)); |
|---|
| 389 | connect(m3.flange_a, s2.flange_b) annotation (Line( |
|---|
| 390 | points={{-20,70},{-40,70}}, |
|---|
| 391 | color={0,127,0}, |
|---|
| 392 | smooth=Smooth.None)); |
|---|
| 393 | end InitialConditions; |
|---|
| 394 | |
|---|
| 395 | model WhyArrows "Use of arrows in Mechanics.Translational" |
|---|
| 396 | |
|---|
| 397 | extends Modelica.Icons.Example; |
|---|
| 398 | annotation ( |
|---|
| 399 | Documentation(info="<html> |
|---|
| 400 | <p> |
|---|
| 401 | When using the models of the translational sublibrary |
|---|
| 402 | it is recommended to make sure that all arrows point in |
|---|
| 403 | the same direction because then all component have the |
|---|
| 404 | same reference system. |
|---|
| 405 | In the example the distance from flange_a of Rod1 to flange_b |
|---|
| 406 | of Rod2 is 2 m. The distance from flange_a of Rod1 to flange_b |
|---|
| 407 | of Rod3 is also 2 m though it is difficult to see that. Without |
|---|
| 408 | the arrows it would be almost impossible to notice. |
|---|
| 409 | That all arrows point in the same direction is a sufficient |
|---|
| 410 | condition for an easy use of the library. There are cases |
|---|
| 411 | where horizontally flipped models can be used without |
|---|
| 412 | problems. |
|---|
| 413 | </p> |
|---|
| 414 | </html> |
|---|
| 415 | "), Diagram(coordinateSystem( |
|---|
| 416 | preserveAspectRatio=true, |
|---|
| 417 | extent={{-100,-100},{100,100}}, |
|---|
| 418 | grid={2,2}), graphics={ |
|---|
| 419 | Text( |
|---|
| 420 | extent={{-80,14},{90,0}}, |
|---|
| 421 | lineColor={0,0,255}, |
|---|
| 422 | textString="positionSensor2.s = positionSensor3.s"), |
|---|
| 423 | Text( |
|---|
| 424 | extent={{-84,4},{88,-16}}, |
|---|
| 425 | lineColor={0,0,255}, |
|---|
| 426 | textString="positionSensor3.s <>positionSensor1.s"), |
|---|
| 427 | Text( |
|---|
| 428 | extent={{-82,-80},{94,-92}}, |
|---|
| 429 | textString="Both systems are equivalent", |
|---|
| 430 | lineColor={0,0,255}), |
|---|
| 431 | Line( |
|---|
| 432 | points={{-90,-28},{90,-28}}, |
|---|
| 433 | thickness=0.5, |
|---|
| 434 | color={0,0,255})}), |
|---|
| 435 | experiment(StopTime=1)); |
|---|
| 436 | |
|---|
| 437 | Translational.Components.Fixed fixed |
|---|
| 438 | annotation (Placement(transformation(extent={{ |
|---|
| 439 | -20,20},{0,40}}, rotation=0))); |
|---|
| 440 | Translational.Components.Rod rod1( L=1) |
|---|
| 441 | annotation (Placement(transformation(extent={ |
|---|
| 442 | {-48,20},{-28,40}}, rotation=0))); |
|---|
| 443 | Translational.Components.Rod rod2( L=1) |
|---|
| 444 | annotation (Placement(transformation(extent={ |
|---|
| 445 | {20,20},{40,40}}, rotation=0))); |
|---|
| 446 | Translational.Components.Rod rod3( L=1) |
|---|
| 447 | annotation (Placement(transformation(extent={ |
|---|
| 448 | {-30,58},{-50,78}}, rotation=0))); |
|---|
| 449 | Translational.Sensors.PositionSensor positionSensor2 annotation (Placement( |
|---|
| 450 | transformation(extent={{60,20},{80,40}}, rotation=0))); |
|---|
| 451 | Translational.Sensors.PositionSensor positionSensor1 annotation (Placement( |
|---|
| 452 | transformation(extent={{-60,20},{-80,40}}, rotation=0))); |
|---|
| 453 | Translational.Sensors.PositionSensor positionSensor3 annotation (Placement( |
|---|
| 454 | transformation(extent={{-60,58},{-80,78}}, rotation=0))); |
|---|
| 455 | Translational.Components.Fixed fixed1( s0=-1.9) |
|---|
| 456 | annotation (Placement(transformation( |
|---|
| 457 | extent={{-100,-60},{-80,-40}}, rotation=0))); |
|---|
| 458 | Translational.Components.Spring spring1( s_rel0=2, c=11) |
|---|
| 459 | annotation (Placement( |
|---|
| 460 | transformation(extent={{-80,-60},{-60,-40}}, rotation=0))); |
|---|
| 461 | Translational.Components.Mass mass1( |
|---|
| 462 | L=2, |
|---|
| 463 | s(fixed=true), |
|---|
| 464 | v(fixed=true), |
|---|
| 465 | m=1) annotation (Placement( |
|---|
| 466 | transformation(extent={{-50,-60},{-30,-40}}, rotation=0))); |
|---|
| 467 | Translational.Components.Fixed fixed2( s0=-1.9) |
|---|
| 468 | annotation (Placement(transformation( |
|---|
| 469 | extent={{0,-60},{20,-40}}, rotation=0))); |
|---|
| 470 | Translational.Components.Spring spring2( s_rel0=2, c=11) |
|---|
| 471 | annotation (Placement( |
|---|
| 472 | transformation(extent={{30,-60},{50,-40}}, rotation=0))); |
|---|
| 473 | Translational.Components.Mass inertia2( L=2, |
|---|
| 474 | m=1, |
|---|
| 475 | s(fixed=true), |
|---|
| 476 | v(fixed=true)) annotation (Placement( |
|---|
| 477 | transformation(extent={{80,-60},{60,-40}}, rotation=0))); |
|---|
| 478 | equation |
|---|
| 479 | connect(spring1.flange_b, mass1.flange_b) annotation (Line(points={{-60,-50}, |
|---|
| 480 | {-60,-72},{-30,-72},{-30,-50}}, color={0,191,0})); |
|---|
| 481 | connect(spring2.flange_b, inertia2.flange_b) annotation (Line(points={{50,-50}, |
|---|
| 482 | {60,-50}}, color={0,191,0})); |
|---|
| 483 | connect(rod3.flange_b,positionSensor3. flange) annotation (Line( |
|---|
| 484 | points={{-50,68},{-60,68}}, |
|---|
| 485 | color={0,127,0}, |
|---|
| 486 | smooth=Smooth.None)); |
|---|
| 487 | connect(rod1.flange_a,positionSensor1. flange) annotation (Line( |
|---|
| 488 | points={{-48,30},{-60,30}}, |
|---|
| 489 | color={0,127,0}, |
|---|
| 490 | smooth=Smooth.None)); |
|---|
| 491 | connect(rod1.flange_b, fixed.flange) annotation (Line( |
|---|
| 492 | points={{-28,30},{-10,30}}, |
|---|
| 493 | color={0,127,0}, |
|---|
| 494 | smooth=Smooth.None)); |
|---|
| 495 | connect(rod3.flange_a, fixed.flange) annotation (Line( |
|---|
| 496 | points={{-30,68},{-10,68},{-10,30}}, |
|---|
| 497 | color={0,127,0}, |
|---|
| 498 | smooth=Smooth.None)); |
|---|
| 499 | connect(fixed.flange, rod2.flange_a) annotation (Line( |
|---|
| 500 | points={{-10,30},{20,30}}, |
|---|
| 501 | color={0,127,0}, |
|---|
| 502 | smooth=Smooth.None)); |
|---|
| 503 | connect(rod2.flange_b,positionSensor2. flange) annotation (Line( |
|---|
| 504 | points={{40,30},{60,30}}, |
|---|
| 505 | color={0,127,0}, |
|---|
| 506 | smooth=Smooth.None)); |
|---|
| 507 | connect(fixed1.flange,spring1. flange_a) annotation (Line( |
|---|
| 508 | points={{-90,-50},{-80,-50}}, |
|---|
| 509 | color={0,127,0}, |
|---|
| 510 | smooth=Smooth.None)); |
|---|
| 511 | connect(fixed2.flange,spring2. flange_a) annotation (Line( |
|---|
| 512 | points={{10,-50},{30,-50}}, |
|---|
| 513 | color={0,127,0}, |
|---|
| 514 | smooth=Smooth.None)); |
|---|
| 515 | end WhyArrows; |
|---|
| 516 | |
|---|
| 517 | model Accelerate "Use of model accelerate." |
|---|
| 518 | |
|---|
| 519 | extends Modelica.Icons.Example; |
|---|
| 520 | Translational.Sources.Accelerate accelerate |
|---|
| 521 | annotation (Placement(transformation( |
|---|
| 522 | extent={{-40,20},{-20,40}}, rotation=0))); |
|---|
| 523 | Translational.Components.Mass mass(L=1, m=1) |
|---|
| 524 | annotation (Placement( |
|---|
| 525 | transformation(extent={{0,20},{20,40}}, rotation=0))); |
|---|
| 526 | Modelica.Blocks.Sources.Constant constantAcc(k=1) |
|---|
| 527 | annotation (Placement(transformation(extent={{-80,20}, |
|---|
| 528 | {-60,40}}, rotation=0))); |
|---|
| 529 | annotation (Documentation(info="<html> |
|---|
| 530 | <p> |
|---|
| 531 | Demonstrate usage of component Sources.Accelerate by moving a massing |
|---|
| 532 | with a predefined acceleration. |
|---|
| 533 | </p> |
|---|
| 534 | </html>"), Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100, |
|---|
| 535 | -100},{100,100}}), |
|---|
| 536 | graphics), |
|---|
| 537 | experiment(StopTime=1)); |
|---|
| 538 | equation |
|---|
| 539 | connect(accelerate.flange, mass.flange_a) annotation (Line( |
|---|
| 540 | points={{-20,30},{0,30}}, |
|---|
| 541 | color={0,127,0}, |
|---|
| 542 | smooth=Smooth.None)); |
|---|
| 543 | connect(constantAcc.y, accelerate.a_ref) annotation (Line( |
|---|
| 544 | points={{-59,30},{-42,30}}, |
|---|
| 545 | color={0,0,127}, |
|---|
| 546 | smooth=Smooth.None)); |
|---|
| 547 | end Accelerate; |
|---|
| 548 | |
|---|
| 549 | model Damper "Use of damper models." |
|---|
| 550 | |
|---|
| 551 | extends Modelica.Icons.Example; |
|---|
| 552 | annotation (Documentation(info="<html> |
|---|
| 553 | <p> |
|---|
| 554 | Demonstrate usage of damper components in different variants. |
|---|
| 555 | </p> |
|---|
| 556 | </html>"), |
|---|
| 557 | |
|---|