-
Notifications
You must be signed in to change notification settings - Fork 169
/
Translational.mo
6020 lines (5669 loc) · 267 KB
/
Translational.mo
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
within Modelica.Mechanics;
package Translational
"Library to model 1-dimensional, translational mechanical systems"
extends Modelica.Icons.Package;
import SI = Modelica.SIunits;
package UsersGuide "User's Guide of Translational Library"
extends Modelica.Icons.Information;
class Overview "Overview"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
This package contains components to model <strong>1-dimensional translational
mechanical</strong> systems, including different types of masses,
external forces, spring/damper elements,
frictional elements, elastogaps, elements to measure position, velocity,
acceleration and the cut-force of a flange. In sublibrary
<strong>Examples</strong> several examples are present to demonstrate the usage of
the elements. Just open the corresponding example model and simulate
the model according to the provided description.
</p>
<p>
A unique feature of this library is the <strong>component-oriented</strong>
modeling of <strong>Coulomb friction</strong> elements, such as support friction.
Even (dynamically) coupled friction elements can be handled
<strong>without</strong> introducing stiffness which leads to fast simulations.
The underlying theory is new and is based on the solution of mixed
continuous/discrete systems of equations, i.e., equations where the
<strong>unknowns</strong> are of type <strong>Real</strong>, <strong>Integer</strong> or <strong>Boolean</strong>.
Provided appropriate numerical algorithms for the solution of such types of
systems are available in the simulation tool, the simulation of
(dynamically) coupled friction elements of this library is
<strong>efficient</strong> and <strong>reliable</strong>.
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/drive1.png\" alt=\"drive1\">
</p>
<p>
A simple example of the usage of this library is given in the
figure above. This drive consists of a shaft with mass m1=1 which
is connected via a spring to a second shaft with mass m2=5.
The left shaft is driven via an external, sinusoidal force.
The <strong>filled</strong> and <strong>non-filled green squares</strong> at the left and
right side of a component represent <strong>mechanical flanges</strong>.
Drawing a line between such squares means that the corresponding
flanges are <strong>rigidly attached</strong> to each other.
By convention in this library, the connector characterized as a
<strong>filled</strong> green square is called <strong>flange_a</strong> and placed at the
left side of the component in the \"design view\" and the connector
characterized as a <strong>non-filled</strong> green square is called <strong>flange_b</strong>
and placed at the right side of the component in the \"design view\".
The two connectors are completely <strong>identical</strong>, with the only
exception that the graphical layout is a little bit different in order
to distinguish them for easier access of the connector variables.
For example, <code>m1.flange_a.f</code> is the cut-force in the connector
<code>flange_a</code> of component <code>m1</code>.
</p>
<p>
The components of this
library can be <strong>connected</strong> together in an <strong>arbitrary</strong> way. E.g., it is
possible to connect two springs or two shafts with mass directly
together, see figure below.
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/driveConnections1.png\" alt=\"driveConnections1\"><br>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/driveConnections2.png\" alt=\"driveConnections2\"><br>
</p>
</html>"));
end Overview;
class FlangeConnectors "Flange Connectors"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
A flange is described by the connector class
Interfaces.<strong>Flange_a</strong>
or Interfaces.<strong>Flange_b</strong>. As already noted, the two connector
classes are completely identical. There is only a difference in the icons,
in order to easier identify a flange variable in a diagram.
Both connector classes contain the following variables:
</p>
<pre>
Modelica.SIunits.Position s \"Absolute position of flange\";
<strong>flow</strong> Modelica.SIunits.Force f \"Cut-force in the flange\";
</pre>
<p>
If needed, the velocity <code>v</code> and the
acceleration <code>a</code> of a flange connector can be
determined by differentiation of the flange position <code>s</code>:
</p>
<pre>
v = <strong>der</strong>(s); a = <strong>der</strong>(v);
</pre>
</html>"));
end FlangeConnectors;
class SupportForces "Support Forces"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>The following figure shows examples of components equipped with
a support flange (framed flange in the lower center), which can be used
to fix components on the ground or on other moving elements or to combine
them with force elements. Via Boolean parameter <strong>useSupport</strong>, the
support flange is enabled or disabled. If it is enabled, it must be connected.
If it is disabled, it need not be connected.
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/bearing.png\" alt=\"bearing\">
</p>
<p>
Depending on the setting of <strong>useSupport</strong>, the icon of the corresponding
component is changing, to either show the support flange or a ground mounting.
For example, the two implementations in the following figure give
identical results.
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/bearing2.png\" alt=\"bearing2\">
</p>
</html>"));
end SupportForces;
class SignConventions "Sign Conventions"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
The variables of a component of this library can be accessed in the
usual way. However, since most of these variables are basically elements
of <strong>vectors</strong>, i.e., have a direction, the question arises how the
signs of variables shall be interpreted. The basic idea is explained
at hand of the following figure:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/drive2.png\" alt=\"drive2\">
</p>
<p>
First, one has to define
a <strong>positive</strong> direction of this line, called <strong>axis of movement</strong>.
In the top part of the figure this is characterized by an arrow
defined as <code>axis of movement</code>. The simple rule is now:
If a variable of a component is positive and can be interpreted as
the element of a vector (e.g., force or velocity vector), the
corresponding vector is directed into the positive direction
of the axis of movement. In the following figure, the right-most
mass of the figure above is displayed with the positive
vector direction displayed according to this rule:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/drive3.png\" alt=\"drive3\">
</p>
<p>
The cut-force <code>m2.flange_a.f</code>
of the right mass is directed into the
direction of movement if the values are positive. Similarly,
the velocity <code>m2.v</code> of the right mass
is also directed into the
direction of movement if the values are positive
</p>
</html>"));
end SignConventions;
class UserDefinedComponents "User Defined Components"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
In this section some hints are given to define your own
1-dimensional translational components which are compatible with the
elements of this package.
It is convenient to define a new
component by inheritance from one of the following base classes,
which are defined in sublibrary Interfaces:
</p>
<table border=1 cellspacing=0 cellpadding=2>
<tr><th>Name</th><th>Description</th></tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialCompliant\">PartialCompliant</a>
</td>
<td>Compliant connection of two translational 1-dim. flanges
(used for force laws such as a spring or a damper).</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialCompliantWithRelativeStates\">PartialCompliantWithRelativeStates</a>
</td>
<td> Same as \"PartialCompliant\", but relative position and relative speed are
defined as preferred states. Use this partial model if the force law
needs anyway the relative speed. The advantage is that it is usually better
to use relative positions between drive train components
as states, especially, if the position is not limited.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialElementaryTwoFlangesAndSupport2\">PartialElementaryTwoFlangesAndSupport2</a>
</td>
<td> Partial model for a 1-dim. translational component consisting of the flange of
an input shaft, the flange of an output shaft and the support.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialForce\">PartialForce</a>
</td>
<td> Partial model of a force acting at the flange (accelerates the flange).
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialTwoFlanges\">PartialTwoFlanges</a>
</td>
<td>General connection of two translational 1-dim. flanges.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialAbsoluteSensor\">PartialAbsoluteSensor</a>
</td>
<td>Measure absolute flange variables.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Translational.Interfaces.PartialRelativeSensor\">PartialRelativeSensor</a>
</td>
<td>Measure relative flange variables.
</td>
</tr>
</table>
<p>
The difference between these base classes are the auxiliary
variables defined in the model and the relations between
the flange variables already defined in the base class.
For example, in model <strong>PartialCompliant</strong> there is no
support flange, whereas in model
<strong>PartialElementaryTwoFlangesAndSupport2</strong>
there is a support flange.
</p>
<p>
The equations of a mechanical component are vector equations, i.e.,
they need to be expressed in a common coordinate system.
Therefore, for a component a <strong>local axis of movement</strong> has to be
defined. All vector quantities, such as cut-forces or
velocities have to be expressed according to this definition.
Examples for such a definition are given in the following figure
for a mass component:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/driveAxis.png\" alt=\"driveAxis\">
</p>
<p>
As can be seen, all vectors are directed into the direction
of the movement axis. The positions in the flanges are defined
correspondingly.
</p>
<p>
On first view, one may assume that the selected local
coordinate system has an influence on the usage of the
component. But this is not the case, as shown in the next figure:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/masses.png\" alt=\"masses\">
</p>
<p>
In the figure the <strong>local</strong> axes of rotation of the components
are shown. The connection of two masses in the left and in the
right part of the figure are completely equivalent, i.e., the right
part is just a different drawing of the left part. This is due to the
fact, that by a connection, the two local coordinate systems are
made identical and the (automatically) generated connection equations
(= positions are identical, cut-forces sum-up to zero) are also
expressed in this common coordinate system. Therefore, even if in
the left figure it seems to be that the velocity vector of
<code>m2</code> goes from right to left, in reality it goes from
left to right as shown in the right part of the figure, where the
local coordinate systems are drawn such that they are aligned.
Note, that the simple rule stated in section 4 (Sign conventions)
also determines that
the velocity of <code>m2</code> in the left part of the
figure is directed from left to right.
</p>
<p>
To summarize, the local coordinate system selected for a component
is just necessary, in order that the equations of this component
are expressed correctly. The selection of the coordinate system
is arbitrary and has no influence on the usage of the component.
Especially, the actual direction of, e.g., a cut-force is most
easily determined by the rule of section 4. A more strict determination
by aligning coordinate systems and then using the vector direction
of the local coordinate systems, often requires a re-drawing of the
diagram and is therefore less convenient to use.
</p>
</html>"));
end UserDefinedComponents;
class StateSelection "State Selection"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>
Only a few components of the Translational library use the der(…) operator
and are therefore candidates to have states. Most important, component <a href=\"modelica://Modelica.Mechanics.Translational.Components.Mass\">Mass</a>
defines the absolute position and the absolute velocity of this
component as candidate for states. In the \"Advanced\" menu the built-in StateSelect
enumeration can be set to define the priority to use these variables as states.
Without further action, in most cases a tool will select these variables as states.
</p>
<p>
For positioning drive trains where the goal is to position a load, the absolute positions of the components are bounded,
and the issue discussed below is not present.
</p>
<p>
For drive trains where the goal is to control the velocity of a load,
the absolute positions of the components are quickly increasing
during operation. This is critical, because then the step size control of time
integrators might then no longer work appropriately:
</p>
<p>
Integrators with step size control adjust their time step size automatically
to meet user defined error bounds (\"tolerances\").
Typically the local error estimate EST_i is compared with a mixed bound for absolute and relative errors.
</p>
<pre>
EST_i ≤ abstol_i + reltol_i*|x_i|
</pre>
<p>
Here, abstol_i and reltol_i denote the bounds for the absolute and relative error of state variable x_i, respectively. This mixed error bound is used since it is more robust than a pure relative error based error bound if the nominal value x_i is (very) close to 0.
In a Modelica simulation model, typically the same relative tolerance reltol is used for all
states and the absolute tolerances are computed using the relative tolerance and the
nominal values of the states:
</p>
<pre>
reltol_i = reltol
abstol_i = reltol*x_i(nominal)*0.01
</pre>
<p>
This error control fails if the state variable x_i grows without bounds (such as for a
drive train), since then the allowed error
also grows without bounds. The effect is that the error control on this variable is practically
switched off. The correct way to handle this would be to set reltol_i = 0 on such a state
variable and only use an absolute tolerance for the step size control.
</p>
<p>
Currently, in Modelica there is no possibility to provide this information.
In order to reduce this effect, it is advisable to not use absolute angles, but
relative angles as states. A user can define relative variables as states
explicitly with component
<a href=\"modelica://Modelica.Mechanics.Translational.Components.RelativeStates\">RelativeStates</a>.
Furthermore, all compliant components, such as
<a href=\"modelica://Modelica.Mechanics.Translational.Components.SpringDamper\">SpringDamper</a> are
defining the relative position and the relative velocity as preferred states.
Therefore, a tool will select in most cases relative positions as states.
</p>
<p>
The relative positions of compliant components are usually small.
Without further action, the error control would not work properly on variables
that are so small (so often switching the error control off). The remedy is to define
explicitly a nominal value on the relative angle. This definition is provided in the
\"Advanced\" menu of the compliant components with parameter \"s_nominal\".
The default value is 1e-4 m, to be in the order of a compliant deformation of a
drive.
</p>
</html>"));
end StateSelection;
class Contact "Contact"
extends Modelica.Icons.Contact;
annotation (Documentation(info="<html>
<h4>Library officers</h4>
<p>
<strong>Jakub Tobolar</strong> and <a href=\"http://www.robotic.dlr.de/Martin.Otter/\"><strong>Martin Otter</strong></a><br>
Deutsches Zentrum für Luft- und Raumfahrt e.V. (DLR)<br>
Institut für Systemdynamik und Regelungstechnik (DLR-SR)<br>
Forschungszentrum Oberpfaffenhofen<br>
D-82234 Wessling<br>
Germany<br>
email: <a href=\"mailto:Martin.Otter@dlr.de\">Martin.Otter@dlr.de</a>
</p>
<h4>Contributors to this library</h4>
<ul>
<li> Main author until 2006:<br>
Peter Beater<br>
Universität Paderborn, Abteilung Soest<br>
Fachbereich Maschinenbau/Automatisierungstechnik<br>
Lübecker Ring 2<br>
D 59494 Soest<br>
Germany<br>
email: <a href=\"mailto:info@beater.de\">info@beater.de</a>
</li>
<li> <a href=\"http://www.robotic.dlr.de/Martin.Otter/\">Martin Otter</a> (DLR-RM)</li>
<li> Christian Schweiger (DLR-RM, until 2006).</li>
<li> <a href=\"https://www.haumer.at/\">Anton Haumer</a><br>
Technical Consulting & Electrical Engineering<br>
D-93049 Regensburg, Germany<br>
email: <a href=\"mailto:a.haumer@haumer.at\">a.haumer@haumer.at</a></li>
</ul>
</html>"));
end Contact;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>Library <strong>Translational</strong> is a <strong>free</strong> Modelica package providing 1-dimensional, translational mechanical components to model in a convenient way translational mechanical systems.
More details are given in the following sub-sections:
</p>
<ul>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.Overview\">Overview</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.FlangeConnectors\">Flange Connectors</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.SupportForces\">Support Forces</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.SignConventions\">Sign Conventions</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.UserDefinedComponents\">User Defined Components</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Translational.UsersGuide.StateSelection\">State Selection</a></li>
</ul>
</html>"));
end UsersGuide;
package Examples "Demonstration examples of the components of this package"
extends Modelica.Icons.ExamplesPackage;
model SignConvention "Examples for the used sign conventions"
extends Modelica.Icons.Example;
Translational.Components.Mass mass1(
L=1,
s(fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{40,60},{60,80}})));
Translational.Sources.Force force1 annotation (Placement(transformation(
extent={{0,60},{20,80}})));
Modelica.Blocks.Sources.Constant constant1(k=1) annotation (Placement(
transformation(extent={{-40,60},{-20,80}})));
Translational.Components.Mass mass2(
L=1,
s(fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{40,0},{60,20}})));
Translational.Sources.Force force2 annotation (Placement(transformation(
extent={{0,20},{20,40}})));
Modelica.Blocks.Sources.Constant constant2(k=1) annotation (Placement(
transformation(extent={{-40,20},{-20,40}})));
Translational.Components.Mass mass3(
L=1,
s(fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{-40,-40},{-20,-20}})));
Translational.Sources.Force force3(useSupport=false)
annotation (Placement(
transformation(extent={{20,-40},{0,-20}})));
Modelica.Blocks.Sources.Constant constant3(k=1) annotation (Placement(
transformation(extent={{60,-40},{40,-20}})));
Translational.Components.Fixed fixed
annotation (Placement(transformation(extent={{0,-60},{20,-40}})));
equation
connect(constant1.y, force1.f)
annotation (Line(points={{-19,70},{-2,70}}, color={0,0,127}));
connect(constant2.y, force2.f)
annotation (Line(points={{-19,30},{-2,30}}, color={0,0,127}));
connect(constant3.y, force3.f)
annotation (Line(points={{39,-30},{22,-30}}, color={0,0,127}));
connect(force1.flange, mass1.flange_a) annotation (Line(
points={{20,70},{40,70}}, color={0,127,0}));
connect(force2.flange, mass2.flange_b) annotation (Line(
points={{20,30},{70,30},{70,10},{60,10}}, color={0,127,0}));
connect(mass3.flange_b, force3.flange) annotation (Line(
points={{-20,-30},{0,-30}}, color={0,127,0}));
connect(fixed.flange, force3.support) annotation (Line(
points={{10,-50},{10,-40}}, color={0,127,0}));
annotation (
Documentation(info="<html>
<p>
If all arrows point in the same direction, a positive force
results in a positive acceleration <var>a</var>, velocity <var>v</var> and position <var>s</var>.
</p>
<p>
For a force of 1 N and a mass of 1 kg this leads to
</p>
<blockquote><pre>
a = 1 m/s2
v = 1 m/s after 1 s (SlidingMass1.v)
s = 0.5 m after 1 s (SlidingMass1.s)
</pre></blockquote>
<p>
The acceleration is not available for plotting.
</p>
<p>
System 1) and 2) are equivalent. It doesn't matter whether the
force pushes at flange_a in system 1 or pulls at flange_b in system 2.
</p><p>
It is of course possible to ignore the arrows and connect the models
in an arbitrary way. But then it is hard see in what direction the
force acts.
</p><p>
In the third system the two arrows are opposed which means that the
force acts in the opposite direction (in the same direction as in
the two other examples).
</p>
</html>"),
Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
{100,100}}),graphics={Text(
extent={{-100,80},{-82,60}},
textString="1)",
lineColor={0,0,255}),Text(
extent={{-100,40},{-82,20}},
textString="2)",
lineColor={0,0,255}),Text(
extent={{-100,-20},{-82,-40}},
textString="3)",
lineColor={0,0,255})}),
experiment(StopTime=1.0, Interval=0.001));
end SignConvention;
model InitialConditions "Setting of initial conditions"
extends Modelica.Icons.Example;
Translational.Components.Fixed fixed2(s0=1) annotation (Placement(
transformation(extent={{-90,30},{-70,50}})));
Translational.Components.Spring s2(s_rel0=2, c=1e3) annotation (Placement(
transformation(extent={{-60,30},{-40,50}})));
Translational.Components.Mass m3(
L=3,
s(start=4.5, fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{-20,30},{0,50}})));
Translational.Components.SpringDamper sd2(
s_rel0=4,
c=111,
d=1) annotation (Placement(transformation(extent={{20,30},{40,50}})));
Translational.Components.Mass m4(
L=5,
s(start=12.5, fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{60,30},{80,50}})));
Translational.Components.Fixed fixed1(s0=-1) annotation (Placement(
transformation(extent={{-100,-70},{-80,-50}})));
Translational.Components.Spring s1(
s_rel0=1,
c=1e3,
s_rel(start=0.5, fixed=true)) annotation (Placement(transformation(
extent={{-60,-70},{-40,-50}})));
Translational.Components.Mass m1(
L=1,
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{-20,-70},{0,-50}})));
Translational.Components.SpringDamper sd1(
s_rel0=1,
c=111,
s_rel(start=1, fixed=true),
v_rel(fixed=true),
d=1) annotation (Placement(transformation(extent={{20,-70},{40,-50}})));
Translational.Components.Mass m2(L=2, m=1) annotation (Placement(
transformation(extent={{60,-70},{80,-50}})));
equation
connect(s2.flange_a, fixed2.flange) annotation (Line(
points={{-60,40},{-80,40}}, color={0,127,0}));
connect(s1.flange_a, fixed1.flange) annotation (Line(
points={{-60,-60},{-90,-60}}, color={0,127,0}));
connect(m1.flange_a, s1.flange_b) annotation (Line(
points={{-20,-60},{-40,-60}}, color={0,127,0}));
connect(sd1.flange_a, m1.flange_b) annotation (Line(
points={{20,-60},{0,-60}}, color={0,127,0}));
connect(m2.flange_a, sd1.flange_b) annotation (Line(
points={{60,-60},{40,-60}}, color={0,127,0}));
connect(m4.flange_a, sd2.flange_b) annotation (Line(
points={{60,40},{40,40}}, color={0,127,0}));
connect(sd2.flange_a, m3.flange_b) annotation (Line(
points={{20,40},{0,40}}, color={0,127,0}));
connect(m3.flange_a, s2.flange_b) annotation (Line(
points={{-20,40},{-40,40}}, color={0,127,0}));
annotation (
Documentation(info="<html>
<p>
There are several ways to set initial conditions.
In the first system the position of the mass m3 was defined
by using the modifier s(start=4.5), the position of m4 by s(start=12.5).
These positions were chosen such that the system is at rest. To calculate
these values start at the left (fixed2) with a value of 1 m. The spring s2
has an unstretched length of 2 m and m3 an length of 3 m, which leads to
</p>
<blockquote><pre>
1 m (fixed2)
+ 2 m (spring s2)
+ 3/2 m (half of the length of mass m3)
-------
4,5 m = s(start = 4.5) for m3
+ 3/2 m (half of the length of mass m3)
+ 4 m (springDamper sd2)
+ 5/2 m (half of length of mass m4)
-------
12,5 m = s(start = 12.5) for m4
</pre></blockquote>
<p>
This selection of initial conditions can prioritize the selection of
those variables (m3.s and m4.s) as state variables.
</p>
<p>
In the second example, the lengths of the springs are given start values
but they cannot be used as state for pure springs (only for the spring/damper
combination). In this case the system is not at rest.
</p>
<blockquote>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Translational/InitialConditions.png\">
</blockquote>
</html>"),
experiment(StopTime=5.0, Interval=0.001),
Diagram(coordinateSystem(preserveAspectRatio=false, extent={{-100,-100},
{100,100}}), graphics={
Line(points={{-80,58},{-80,46}}, color={0,0,255}),
Text(
extent={{-10,5},{10,-5}},
lineColor={255,0,0},
textString="ref= 0 m",
origin={-96,73},
rotation=90),
Line(
points={{-10,76},{-10,50}},
color={0,0,255}),
Text(
extent={{-40,82},{-20,72}},
lineColor={255,0,0},
textString=" 4.5 m "),
Line(
points={{70,90},{70,50}},
color={0,0,255}),
Text(
extent={{40,98},{60,88}},
lineColor={255,0,0},
textString="12.5 m"),
Text(
extent={{-60,16},{-40,6}},
lineColor={0,0,255},
textString=" 2 m "),
Text(
extent={{20,16},{40,6}},
lineColor={0,0,255},
textString=" 4 m "),
Text(
extent={{-20,16},{0,6}},
textString=" 3 m "),
Text(
extent={{60,16},{80,6}},
textString=" 5 m "),
Text(
extent={{-60,-84},{-40,-94}},
lineColor={255,0,0},
textString=" 0.5 m
(1 m) "), Text(
extent={{20,-84},{40,-94}},
lineColor={255,0,0},
textString=" 1 m
(1 m) "), Text(
extent={{-20,-84},{0,-94}},
textString=" 1 m "),
Text(
extent={{60,-84},{80,-94}},
textString=" 2 m "),
Line(
points={{-90,-32},{-90,-56}},
color={0,0,255}),
Text(
extent={{-10,5},{10,-5}},
lineColor={255,0,0},
origin={-96,-35},
rotation=90,
textString="ref= -1 m"),
Line(
points={{-10,-32},{-10,-50}},
color={0,0,255}),
Text(
extent={{-20,-22},{0,-32}},
lineColor={0,0,255},
textString=" 0 m "),
Line(
points={{70,-32},{70,-50}},
color={0,0,255}),
Text(
extent={{20,-24},{40,-34}},
lineColor={238,46,47},
textString=" 2.5 m "),
Line(
points={{-90,54},{-80,54}},
color={0,0,255},
arrow={Arrow.None,Arrow.Open}),
Line(
points={{-90,70},{-10,70}},
color={0,0,255},
arrow={Arrow.None,Arrow.Open}),
Line(
points={{-90,86},{70,86}},
color={0,0,255},
arrow={Arrow.None,Arrow.Open}),
Line(points={{-60,30},{-60,16}}, color={0,0,255}),
Line(points={{-40,30},{-40,16}}, color={0,0,255}),
Line(points={{-20,30},{-20,16}}, color={0,0,255}),
Line(points={{0,30},{0,16}}, color={0,0,255}),
Line(points={{20,30},{20,16}}, color={0,0,255}),
Line(points={{40,30},{40,16}}, color={0,0,255}),
Line(points={{60,30},{60,16}}, color={0,0,255}),
Line(points={{80,30},{80,16}}, color={0,0,255}),
Line(
points={{-60,20},{-40,20}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{-20,20},{0,20}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{20,20},{40,20}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{60,20},{80,20}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{-90,90},{-90,46}},
color={0,0,255}),
Text(
extent={{-90,66},{-70,56}},
lineColor={255,0,0},
textString="1 m "),
Line(
points={{-60,-70},{-60,-84}},
color={0,0,255}),
Line(
points={{-40,-70},{-40,-84}},
color={0,0,255}),
Line(
points={{-20,-70},{-20,-84}},
color={0,0,255}),
Line(
points={{0,-70},{0,-84}},
color={0,0,255}),
Line(
points={{20,-70},{20,-84}},
color={0,0,255}),
Line(
points={{40,-70},{40,-84}},
color={0,0,255}),
Line(
points={{60,-70},{60,-84}},
color={0,0,255}),
Line(
points={{80,-70},{80,-84}},
color={0,0,255}),
Line(
points={{-60,-80},{-40,-80}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{-20,-80},{0,-80}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{20,-80},{40,-80}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{60,-80},{80,-80}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{-90,-36},{-10,-36}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Line(
points={{-10,-36},{70,-36}},
color={0,0,255},
arrow={Arrow.Open,Arrow.Open}),
Text(
extent={{-60,-24},{-40,-34}},
lineColor={238,46,47},
textString="1 m ")}));
end InitialConditions;
model WhyArrows "Use of arrows in Mechanics.Translational"
extends Modelica.Icons.Example;
Translational.Components.Fixed fixed annotation (Placement(transformation(
extent={{-20,20},{0,40}})));
Translational.Components.Rod rod1(L=1) annotation (Placement(
transformation(extent={{-48,20},{-28,40}})));
Translational.Components.Rod rod2(L=1) annotation (Placement(
transformation(extent={{20,20},{40,40}})));
Translational.Components.Rod rod3(L=1) annotation (Placement(
transformation(extent={{-30,58},{-50,78}})));
Translational.Sensors.PositionSensor positionSensor2 annotation (
Placement(transformation(extent={{60,20},{80,40}})));
Translational.Sensors.PositionSensor positionSensor1 annotation (
Placement(transformation(extent={{-60,20},{-80,40}})));
Translational.Sensors.PositionSensor positionSensor3 annotation (
Placement(transformation(extent={{-60,58},{-80,78}})));
Translational.Components.Fixed fixed1(s0=-1.9) annotation (Placement(
transformation(extent={{-100,-60},{-80,-40}})));
Translational.Components.Spring spring1(s_rel0=2, c=11) annotation (
Placement(transformation(extent={{-80,-60},{-60,-40}})));
Translational.Components.Mass mass1(
L=2,
s(fixed=true),
v(fixed=true),
m=1) annotation (Placement(transformation(extent={{-50,-60},{-30,-40}})));
Translational.Components.Fixed fixed2(s0=-1.9) annotation (Placement(
transformation(extent={{0,-60},{20,-40}})));
Translational.Components.Spring spring2(s_rel0=2, c=11) annotation (
Placement(transformation(extent={{30,-60},{50,-40}})));
Translational.Components.Mass inertia2(
L=2,
m=1,
s(fixed=true),
v(fixed=true)) annotation (Placement(transformation(extent={{80,-60},{
60,-40}})));
equation
connect(spring1.flange_b, mass1.flange_b) annotation (Line(points={{-60,-50},
{-60,-72},{-30,-72},{-30,-50}}, color={0,127,0}));
connect(spring2.flange_b, inertia2.flange_b)
annotation (Line(points={{50,-50},{60,-50}}, color={0,127,0}));
connect(rod3.flange_b, positionSensor3.flange) annotation (Line(
points={{-50,68},{-60,68}}, color={0,127,0}));
connect(rod1.flange_a, positionSensor1.flange) annotation (Line(
points={{-48,30},{-60,30}}, color={0,127,0}));
connect(rod1.flange_b, fixed.flange) annotation (Line(
points={{-28,30},{-10,30}}, color={0,127,0}));
connect(rod3.flange_a, fixed.flange) annotation (Line(
points={{-30,68},{-10,68},{-10,30}}, color={0,127,0}));
connect(fixed.flange, rod2.flange_a) annotation (Line(
points={{-10,30},{20,30}}, color={0,127,0}));
connect(rod2.flange_b, positionSensor2.flange) annotation (Line(
points={{40,30},{60,30}}, color={0,127,0}));
connect(fixed1.flange, spring1.flange_a) annotation (Line(
points={{-90,-50},{-80,-50}}, color={0,127,0}));
connect(fixed2.flange, spring2.flange_a) annotation (Line(
points={{10,-50},{30,-50}}, color={0,127,0}));
annotation (
Documentation(info="<html>
<p>
When using the models of the translational sublibrary
it is recommended to make sure that all arrows point in
the same direction because then all component have the
same reference system.
In the example the distance from flange_a of Rod1 to flange_b
of Rod2 is 2 m. The distance from flange_a of Rod1 to flange_b
of Rod3 is also 2 m though it is difficult to see that. Without
the arrows it would be almost impossible to notice.
That all arrows point in the same direction is a sufficient
condition for an easy use of the library. There are cases
where horizontally flipped models can be used without
problems.
</p>
</html>"),
Diagram(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
{100,100}}), graphics={Text(
extent={{-84,10},{88,2}},
lineColor={0,0,255},
textString="positionSensor2.s = positionSensor3.s"),Text(
extent={{-78,-4},{86,-12}},
lineColor={0,0,255},
textString="positionSensor3.s <>positionSensor1.s"),Text(
extent={{-82,-80},{92,-88}},
textString="Both systems are equivalent",
lineColor={0,0,255}),Line(
points={{-90,-28},{90,-28}},
thickness=0.5,
color={0,0,255})}),
experiment(StopTime=1.0, Interval=0.001));
end WhyArrows;
model Accelerate "Use of model accelerate"
extends Modelica.Icons.Example;
Translational.Sources.Accelerate accelerate annotation (Placement(
transformation(extent={{-10,-10},{10,10}})));
Translational.Components.Mass mass(L=1, m=1) annotation (Placement(
transformation(extent={{30,-10},{50,10}})));
Modelica.Blocks.Sources.Constant constantAcc(k=1) annotation (Placement(
transformation(extent={{-50,-10},{-30,10}})));
equation
connect(accelerate.flange, mass.flange_a) annotation (Line(
points={{10,0},{30,0}}, color={0,127,0}));
connect(constantAcc.y, accelerate.a_ref) annotation (Line(
points={{-29,0},{-12,0}}, color={0,0,127}));
annotation (Documentation(info="<html>
<p>
Demonstrate usage of component
<a href=\"modelica://Modelica.Mechanics.Translational.Sources.Accelerate\">Sources.Accelerate</a>
by moving a mass with a predefined acceleration.
</p>
</html>"), experiment(StopTime=1.0, Interval=0.001));
end Accelerate;
model Damper "Use of damper models"
extends Modelica.Icons.Example;
Translational.Components.Mass mass1(
L=1,
s(start=3, fixed=true),
v(start=10, fixed=true),
m=1) annotation (Placement(transformation(extent={{-60,50},{-40,70}})));
Translational.Components.Damper damper1(d=25) annotation (Placement(
transformation(extent={{-10,50},{10,70}})));
Translational.Components.Fixed fixed1(s0=4.5) annotation (Placement(
transformation(extent={{30,50},{50,70}})));
Translational.Components.Mass mass2(
L=1,
s(start=3, fixed=true),
v(start=10, fixed=true),
m=1) annotation (Placement(transformation(extent={{-60,-10},{-40,10}})));
Translational.Components.Damper damper2(d=25) annotation (Placement(
transformation(extent={{-10,0},{10,20}})));
Translational.Components.Fixed fixed2(s0=4.5) annotation (Placement(
transformation(extent={{30,-10},{50,10}})));
Translational.Components.Mass mass3(
L=1,
s(start=3, fixed=true),
v(start=10, fixed=true),
m=1) annotation (Placement(transformation(extent={{-60,-70},{-40,-50}})));
Translational.Components.Fixed fixed3(s0=4.5) annotation (Placement(
transformation(extent={{30,-70},{50,-50}})));
Translational.Components.Spring spring2(s_rel0=1, c=1) annotation (
Placement(transformation(extent={{-10,-20},{10,0}})));
Translational.Components.SpringDamper springDamper3(
s_rel0=1,
d=25,
c=1) annotation (Placement(transformation(extent={{-10,-70},{10,-50}})));
equation
connect(mass1.flange_b, damper1.flange_a)
annotation (Line(points={{-40,60},{-10,60}}, color={0,127,0}));
connect(mass2.flange_b, damper2.flange_a)
annotation (Line(points={{-40,0},{-20,0},{-20,10},{-10,10}},
color={0,127,0}));
connect(damper2.flange_b, spring2.flange_b)
annotation (Line(points={{10,10},{20,10},{20,-10},{10,-10}},
color={0,127,0}));
connect(damper2.flange_a, spring2.flange_a)
annotation (Line(points={{-10,10},{-20,10},{-20,-10},{-10,-10}},
color={0,127,0}));
connect(mass3.flange_b, springDamper3.flange_a)
annotation (Line(points={{-40,-60},{-10,-60}}, color={0,127,0}));
connect(damper1.flange_b, fixed1.flange) annotation (Line(
points={{10,60},{40,60}},color={0,127,0}));
connect(damper2.flange_b, fixed2.flange) annotation (Line(points={{10,10},{20,10},{20,0},{40,0}},
color={0,127,0}));
connect(springDamper3.flange_b, fixed3.flange) annotation (Line(
points={{10,-60},{40,-60}},color={0,127,0}));
annotation (Documentation(info="<html>
<p>
Demonstrate usage of a translational damper component in various configurations.
</p>
</html>"), experiment(StopTime=1.0, Interval=0.001));
end Damper;