-
Notifications
You must be signed in to change notification settings - Fork 169
/
Rotational.mo
8250 lines (7751 loc) · 356 KB
/
Rotational.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 Rotational
"Library to model 1-dimensional, rotational mechanical systems"
extends Modelica.Icons.Package;
import SI = Modelica.SIunits;
package UsersGuide "User's Guide of Rotational 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 rotational
mechanical</strong> systems, including different types of gearboxes,
shafts with inertia, external torques, spring/damper elements,
frictional elements, backlash, elements to measure angle, angular velocity,
angular acceleration and the cut-torque 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 friction in bearings,
clutches, brakes, and gear efficiency. Even (dynamically) coupled
friction elements, e.g., as in automatic gearboxes, 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/Rotational/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 inertia J1=0.2 which
is connected via an ideal gearbox with gear ratio=5 to a second shaft
with inertia J2=5. The left shaft is driven via an external,
sinusoidal torque.
The <strong>filled</strong> and <strong>non-filled grey 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> grey 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> grey 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>J1.flange_a.tau</code> is the cut-torque in the connector
<code>flange_a</code> of component <code>J1</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 inertia directly
together, see figure below.
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveConnections1.png\" alt=\"driveConnections1\"><br>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveConnections2.png\" alt=\"driveConnections2\">
</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.Angle phi \"Absolute rotation angle of flange\";
<strong>flow</strong> Modelica.SIunits.Torque tau \"Cut-torque in the flange\";
</pre>
<p>
If needed, the angular velocity <code>w</code> and the
angular acceleration <code>a</code> of a flange connector can be
determined by differentiation of the flange angle <code>phi</code>:
</p>
<pre>
w = <strong>der</strong>(phi); a = <strong>der</strong>(w);
</pre>
</html>"));
end FlangeConnectors;
class SupportTorques "Support Torques"
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 rotating elements or to combine
them with force elements. Via Boolean parameter <strong>useSupport</strong>, the
support torque is enabled or disabled. If it is enabled, it must be connected.
If it is disabled, it need not be connected.
Enabled support flanges offer, e.g., the possibility to model gearboxes mounted on
the ground via spring-damper-systems (cf. example
<a href=\"modelica://Modelica.Mechanics.Rotational.Examples.ElasticBearing\">ElasticBearing</a>).
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/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/Rotational/bearing2.png\" alt=\"bearing2\">
</p>
</html>"));
end SupportTorques;
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/Rotational/drive2.png\" alt=\"drive2\">
</p>
<p>
In the figure, three identical drive trains are shown. The only
difference is that the gear of the middle drive train and the
gear as well as the right inertia of the lower drive train
are horizontally flipped with regards to the upper drive train.
The signs of variables are now interpreted in the following way:
Due to the 1-dimensional nature of the model, all components are
basically connected together along one line (more complicated
cases are discussed below). First, one has to define
a <strong>positive</strong> direction of this line, called <strong>axis of rotation</strong>.
In the top part of the figure this is characterized by an arrow
defined as <code>axis of rotation</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., torque or angular velocity vector), the
corresponding vector is directed into the positive direction
of the axis of rotation. In the following figure, the right-most
inertias of the figure above are displayed with the positive
vector direction displayed according to this rule:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/drive3.png\" alt=\"drive3\">
</p>
<p>
The cut-torques <code>J2.flange_a.tau, J4.flange_a.tau, J6.flange_b.tau</code>
of the right inertias are all identical and are directed into the
direction of rotation if the values are positive. Similarly,
the angular velocities <code>J2.w, J4.w, J6.w</code> of the right inertias
are all identical and are also directed into the
direction of rotation if the values are positive. Some special
cases are shown in the next figure:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/drive4.png\" alt=\"drive4\">
</p>
<p>
In the upper part of the figure, two variants of the connection of an
external torque and an inertia are shown. In both cases, a positive
signal input into the torque component accelerates the inertias
<code>inertia1, inertia2</code> into the positive axis of rotation,
i.e., the angular accelerations <code>inertia1.a, inertia2.a</code>
are positive and are directed along the \"axis of rotation\" arrow.
In the lower part of the figure the connection of inertias with
a planetary gear is shown. Note, that the three flanges of the
planetary gearbox are located along the axis of rotation and that
the axis direction determines the positive rotation along these
flanges. As a result, the positive rotation for <code>inertia4, inertia6</code>
is as indicated with the additional grey arrows.
</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 rotational 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.Rotational.Interfaces.PartialCompliant\">PartialCompliant</a>
</td>
<td>Compliant connection of two rotational 1-dim. flanges
(used for force laws such as a spring or a damper).</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialCompliantWithRelativeStates\">PartialCompliantWithRelativeStates</a>
</td>
<td> Same as \"PartialCompliant\", but relative angle 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 angles between drive train components
as states, especially, if the angle is not limited (e.g., as for drive trains
in vehicles).
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialElementaryTwoFlangesAndSupport2\">PartialElementaryTwoFlangesAndSupport2</a>
</td>
<td> Partial model for a 1-dim. rotational gear 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.Rotational.Interfaces.PartialTorque\">PartialTorque</a>
</td>
<td> Partial model of a torque acting at the flange (accelerates the flange).
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialTwoFlanges\">PartialTwoFlanges</a>
</td>
<td>General connection of two rotational 1-dim. flanges.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialAbsoluteSensor\">PartialAbsoluteSensor</a>
</td>
<td>Measure absolute flange variables.
</td>
</tr>
<tr>
<td><a href=\"modelica://Modelica.Mechanics.Rotational.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 rotation</strong> has to be
defined. All vector quantities, such as cut-torques or angular
velocities have to be expressed according to this definition.
Examples for such a definition are given in the following figure
for an inertia component and a planetary gearbox:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveAxis.png\" alt=\"driveAxis\">
</p>
<p>
As can be seen, all vectors are directed into the direction
of the rotation axis. The angles in the flanges are defined
correspondingly. For example, the angle <code>sun.phi</code> in the
flange of the sun wheel of the planetary gearbox is positive,
if rotated in mathematical positive direction (= counter clock
wise) along the axis of rotation.
</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/Rotational/inertias.png\" alt=\"inertias\">
</p>
<p>
In the figure the <strong>local</strong> axes of rotation of the components
are shown. The connection of two inertias 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
(= angles are identical, cut-torques 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 angular velocity vector of
<code>J2</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 angular velocity of <code>J2</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-torque 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 RequirementsForSimulationTool "Requirements for Simulation Tools"
extends Modelica.Icons.Information;
annotation (DocumentationClass=true, Documentation(info="<html>
<p>
This library is designed in a fully object oriented way in order that
components can be connected together in every meaningful combination
(e.g., direct connection of two springs or two inertias).
As a consequence, most models lead to a system of
differential-algebraic equations of <strong>index 3</strong> (= constraint
equations have to be differentiated twice in order to arrive at
a state space representation) and the Modelica translator or
the simulator has to cope with this system representation.
According to our present knowledge, this requires that the
Modelica translator is able to symbolically differentiate equations
(otherwise it is e.g., not possible to provide consistent initial
conditions; even if consistent initial conditions are present, most
numerical DAE integrators can cope at most with index 2 DAEs).
</p>
<p>
The elements of this library can be connected together in an
arbitrary way. However, difficulties may occur, if the elements which can <strong>lock</strong> the
<strong>relative motion</strong> between two flanges are connected <strong>rigidly</strong>
together such that essentially the <strong>same relative motion</strong> can be locked.
The reason is
that the cut-torque in the locked phase is not uniquely defined if the
elements are locked at the same time instant (i.e., there does not exist a
unique solution) and some simulation systems may not be
able to handle this situation, since this leads to a singularity during
simulation. Currently, this type of problem can occur with the
Coulomb friction elements <strong>BearingFriction, Clutch, Brake, LossyGear</strong> when
the elements become stuck:
</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/Rotational/driveConnections3.png\" alt=\"driveConnections3\">
</p>
<p>
In the figure above two typical situations are shown: In the upper part of
the figure, the series connection of rigidly attached BearingFriction and
Clutch components are shown. This does not hurt, because the BearingFriction
element can lock the relative motion between the element and the housing,
whereas the clutch element can lock the relative motion between the two
connected flanges. Contrary, the drive train in the lower part of the figure
may give rise to simulation problems, because the BearingFriction element
and the Brake element can lock the relative motion between a flange and
the housing and these flanges are rigidly connected together, i.e.,
essentially the same relative motion can be locked. These difficulties
may be solved by either introducing a compliance between these flanges
or by combining the BearingFriction and Brake element into
one component and resolving the ambiguity of the frictional torque in the
stuck mode. A tool may handle this situation also <strong>automatically</strong>,
by picking one solution of the infinitely many, e.g., the one where
the difference to the value of the previous time instant is as small
as possible.
</p>
</html>"));
end RequirementsForSimulationTool;
class StateSelection "State Selection"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>
Only a few components of the Rotational library use the der(…) operator
and are therefore candidates to have states. Most important, component <a href=\"modelica://Modelica.Mechanics.Rotational.Components.Inertia\">Inertia</a>
defines the absolute rotation angle and the absolute angular 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 (e.g. the drive
train of a robot, or of an elevator), the absolute angles 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 (e.g. the drive
train of a vehicle or the crank angle of an engine),
the absolute angles 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 or the crank angle of a vehicle), 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.Rotational.Components.RelativeStates\">RelativeStates</a>.
Furthermore, all compliant components, such as
<a href=\"modelica://Modelica.Mechanics.Rotational.Components.SpringDamper\">SpringDamper</a> are
defining the relative angle and the relative angular velocity as preferred states.
Therefore, a tool will select in most cases relative angles as states.
</p>
<p>
The relative angles of compliant components are usually small. For example, the
deformation of a typical elastic component is in the order of 1e-4 rad.
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 \"phi_nominal\".
The default value is 1e-4 rad, to be in the order of a compliant deformation of a
drive. For some components, like
a <a href=\"modelica://Modelica.Mechanics.Rotational.Components.Clutch\">Clutch</a>
this might be too small and a value of phi_nominal=1 might be more appropriate
(a value of phi_nominal = 1e-4 does not hurt, but just makes the error control
unnecessarily stringent).
</p>
</html>"));
end StateSelection;
class ModelingOfFriction "Modeling of Friction"
extends Modelica.Icons.Information;
annotation (Documentation(info="<html>
<p>
Several elements of this library model <strong>Coulomb friction</strong> with the method proposed in:
</p>
<dl>
<dt>Otter M., Elmqvist H., and Mattsson S.E. (1999):</dt>
<dd><strong>Hybrid Modeling in Modelica based on the Synchronous
Data Flow Principle</strong>. CACSD'99, Aug. 22.-26, Hawaii.</dd>
</dl>
<p>
The friction equations are defined in base model
<a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialFriction\">Interfaces.PartialFriction</a>.
Here are some explanations:
</p>
<p>
Assume first the most simplest friction problem: A block sliding on a surface.
The friction force \"f\" acts between the block surface and the environment surface and shall be a
linear function of the relative velocity \"v\" between the two surfaces.
When the relative velocity becomes zero, the two surfaces are stuck to each other and the friction force is no longer
a function of \"v\". The element starts sliding again if the friction force becomes larger than the maximum
static friction force \"f0\". This element could be defined with a parameterized curve description
leading to the following equations:
</p>
<blockquote><pre>forward = s > 1;
backward = s < -1;
v = if forward then s-1 elseif backward then s+1 else 0;
f = if forward then f0+f1*(s-1) elseif
backward then -f0+f1*(s+1) else f0*s;
</pre></blockquote>
<p>
This model completely describes the simplified friction element in
a declarative way. Unfortunately, currently it is not known how to transform such
an element description automatically in a form which can be simulated:
</p>
<p>
The block is described by the following equation:
</p>
<blockquote><pre>
m*der(v) = u - f
</pre></blockquote>
<p>
Note, that \"m\" is the mass of the block and \"u(t)\" is the given driving force.
If the element is in its \"forward sliding\" mode, that is s ≥ 1, this model is described by:
</p>
<blockquote><pre>
m*der(v) = u - f
v = s - 1
f = f_0 + f_1*(s-1)
</pre></blockquote>
<p>
which can be easily transformed into state space form with \"v\" as the state.
If the block becomes stuck, that is -1 ≤ s ≤ 1, the equation \"v=0\" becomes
active and therefore \"v\" can no longer be a state, that is an index
change takes place. Besides the difficulty to handle the variable state change,
there is a more serious problem:
</p>
<p>
Assume that the block is stuck and that \"s\" becomes greater than one. Before the event occurs, s ≤ 1
and v = 0; at the event instant s > 1 because this relation is the event triggering condition. The element
switches into the forward sliding mode where \"v\" is a state which is initialized with its last value \"v=0\".
Since \"v\" is a state, \"s\" is computed from \"v\" via \"s := v+1\", resulting in \"s=1\", that is the relation
\"s > 1\" becomes false and the element switches back into the stuck mode. In other words, it is never possible to
switch into the forward sliding mode. Taking numerical errors into account, the situation is even worse.
</p>
<p>
The key to the solution is the observation that \"v=0\" in the stuck mode and when forward sliding starts, but
\"der(v) > 0\" when sliding starts and der(v) = 0 in the stuck mode. Since the friction characteristic
at zero velocity is no functional relationship, again a parameterized curve description
with a new curve parameter \"s_a\" has to be used leading to the following equations (note: at zero velocity):
</p>
<blockquote><pre>
startFor = sa > 1;
startBack = sa < -1;
a = der(v);
a = if startFor then sa-1 elseif startBack then sa+1 else 0;
f = if startFor then f0 elseif startBack then -f0 else f0*sa;
</pre></blockquote>
<p>
At zero velocity, these equations and the equation of the block form a mixed continuous/discrete set of
equations which has to be solved at event instants (e.g. by a fix point iteration),
When switching from sliding to stuck mode, the velocity is small or zero. Since the derivative of the constraint
equation der(v) = 0 is fulfilled in the stuck mode, the velocity remains small even if v = 0 is not explicitly
taken into account. The approach to use the acceleration der(v) = 0 as \"constraint\" instead of \"v = 0\",
is often used in multi-body software. The benefit is that the velocity \"v\" remains a state in all switching
configurations (there is a small, linear drift, but the friction element would have to stay stuck several days
before the drift becomes too large). Consequently, \"v\" is small but may have any sign when switching
from stuck to sliding mode; if the friction element starts to slide, say in the forward direction, one has
to wait until the velocity is really positive, before switching to forward mode (note, that even for
exact calculation without numerical errors a \"waiting\" phase is necessary, because \"v=0\" when sliding starts).
Since \"der(v) > 0\", this will occur after a small time period. This \"waiting\" procedure can be
described by a state machine. Collecting all the pieces together, finally results in the following equations
of a simple friction element:
</p>
<blockquote><pre>
// part of mixed system of equations
startFor = pre(mode) == Stuck and sa > 1;
startBack = pre(mode) == Stuck and sa < -1;
a = der(v);
a = if pre(mode) == Forward or startFor then sa - 1 elseif
pre(mode) == Backward or startBack then sa + 1 else 0;
f = if pre(mode) == Forward or startFor then f0 + f1*v elseif
pre(mode) == Backward or startBack then -f0 + f1*v else f0*sa;
// state machine to determine configuration
mode = if (pre(mode) == Forward or startFor) and v>0 then Forward elseif
(pre(mode) == Backward or startBack) and v<0 then Backward else Stuck;
</pre></blockquote>
<p>
The above approach to model a simplified friction element is slightly generalized in model
<a href=\"modelica://Modelica.Mechanics.Rotational.Interfaces.PartialFriction\">Interfaces.PartialFriction</a>:
</p>
<ul>
<li> The sliding friction force has a nonlinear characteristic instead a linear one,
by interpolation in a table of f(v) values.</li>
<li> There may be a jump in the friction force when going from stuck to sliding mode
(described with parameter peak).</li>
</ul>
</html>"));
end ModelingOfFriction;
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
</p>
<h4>Contributors to this library</h4>
<ul>
<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>Rotational</strong> is a <strong>free</strong> Modelica package providing
1-dimensional, rotational mechanical components to model in a convenient way
drive trains with frictional losses. More details are given in the following
sub-sections:
</p>
<ul>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.Overview\">Overview</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.FlangeConnectors\">Flange Connectors</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SupportTorques\">Support Torques</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.SignConventions\">Sign Conventions</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.UserDefinedComponents\">User Defined Components</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.RequirementsForSimulationTool\">Requirements for Simulation Tools</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.StateSelection\">State Selection</a></li>
<li> <a href=\"modelica://Modelica.Mechanics.Rotational.UsersGuide.ModelingOfFriction\">Modeling of Friction</a></li>
</ul>
</html>"));
end UsersGuide;
package Examples "Demonstration examples of the components of this package"
extends Modelica.Icons.ExamplesPackage;
model First "First example: simple drive train"
extends Modelica.Icons.Example;
parameter Modelica.SIunits.Torque amplitude=10
"Amplitude of driving torque";
parameter SI.Frequency freqHz=5 "Frequency of driving torque";
parameter SI.Inertia Jmotor(min=0) = 0.1 "Motor inertia";
parameter SI.Inertia Jload(min=0) = 2 "Load inertia";
parameter Real ratio=10 "Gear ratio";
parameter Real damping=10 "Damping in bearing of gear";
Rotational.Components.Fixed fixed annotation (Placement(transformation(
extent={{38,-48},{54,-32}})));
Rotational.Sources.Torque torque(useSupport=true) annotation (Placement(
transformation(extent={{-68,-8},{-52,8}})));
Rotational.Components.Inertia inertia1(J=Jmotor) annotation (Placement(
transformation(extent={{-38,-8},{-22,8}})));
Rotational.Components.IdealGear idealGear(ratio=ratio, useSupport=true)
annotation (Placement(transformation(extent={{-8,-8},{8,8}})));
Rotational.Components.Inertia inertia2(
J=2,
phi(fixed=true, start=0),
w(fixed=true, start=0)) annotation (Placement(transformation(extent={{
22,-8},{38,8}})));
Rotational.Components.Spring spring(c=1.e4, phi_rel(fixed=true))
annotation (Placement(transformation(extent={{52,-8},{68,8}})));
Rotational.Components.Inertia inertia3(J=Jload, w(fixed=true, start=0))
annotation (Placement(transformation(extent={{82,-8},{98,8}})));
Rotational.Components.Damper damper(d=damping) annotation (Placement(
transformation(
origin={46,-22},
extent={{-8,-8},{8,8}},
rotation=270)));
Modelica.Blocks.Sources.Sine sine(amplitude=amplitude, freqHz=freqHz)
annotation (Placement(transformation(extent={{-98,-8},{-82,8}})));
equation
connect(inertia1.flange_b, idealGear.flange_a)
annotation (Line(points={{-22,0},{-8,0}}));
connect(idealGear.flange_b, inertia2.flange_a)
annotation (Line(points={{8,0},{22,0}}));
connect(inertia2.flange_b, spring.flange_a)
annotation (Line(points={{38,0},{52,0}}));
connect(spring.flange_b, inertia3.flange_a)
annotation (Line(points={{68,0},{82,0}}));
connect(damper.flange_a, inertia2.flange_b)
annotation (Line(points={{46,-14},{46,0},{38,0}}));
connect(damper.flange_b, fixed.flange)
annotation (Line(points={{46,-30},{46,-40}}));
connect(sine.y, torque.tau)
annotation (Line(points={{-81.2,0},{-69.6,0}}, color={0,0,127}));
connect(torque.support, fixed.flange)
annotation (Line(points={{-60,-8},{-60,-40},{46,-40}}));
connect(idealGear.support, fixed.flange)
annotation (Line(points={{0,-8},{0,-40},{46,-40}}));
connect(torque.flange, inertia1.flange_a) annotation (Line(
points={{-52,0},{-38,0}}));
annotation (
Documentation(info="<html>
<p>The drive train consists of a motor inertia which is driven by
a sine-wave motor torque. Via a gearbox the rotational energy is
transmitted to a load inertia. Elasticity in the gearbox is modeled
by a spring element. A linear damper is used to model the
damping in the gearbox bearing.</p>
<p>Note, that a force component (like the damper of this example)
which is acting between a shaft and the housing has to be fixed
in the housing on one side via component Fixed.</p>
<p>Simulate for 1 second and plot the following variables:<br>
angular velocities of inertias inertia2 and 3: inertia2.w, inertia3.w</p>
</html>"),
experiment(StopTime=1.0, Interval=0.001));
end First;
model FirstGrounded
"First example: simple drive train with grounded elements"
extends Modelica.Icons.Example;
parameter Modelica.SIunits.Torque amplitude=10
"Amplitude of driving torque";
parameter SI.Frequency freqHz=5 "Frequency of driving torque";
parameter SI.Inertia Jmotor(min=0) = 0.1 "Motor inertia";
parameter SI.Inertia Jload(min=0) = 2 "Load inertia";
parameter Real ratio=10 "Gear ratio";
parameter Real damping=10 "Damping in bearing of gear";
Rotational.Components.Fixed fixed annotation (Placement(transformation(
extent={{38,-48},{54,-32}})));
Rotational.Sources.Torque torque(useSupport=false) annotation (Placement(
transformation(extent={{-68,-8},{-52,8}})));
Rotational.Components.Inertia inertia1(J=Jmotor) annotation (Placement(
transformation(extent={{-38,-8},{-22,8}})));
Rotational.Components.IdealGear idealGear(ratio=ratio, useSupport=false)
annotation (Placement(transformation(extent={{-8,-8},{8,8}})));
Rotational.Components.Inertia inertia2(
J=2,
phi(fixed=true, start=0),
w(fixed=true, start=0)) annotation (Placement(transformation(extent={{
22,-8},{38,8}})));
Rotational.Components.Spring spring(c=1.e4, phi_rel(fixed=true))
annotation (Placement(transformation(extent={{52,-8},{68,8}})));
Rotational.Components.Inertia inertia3(J=Jload, w(fixed=true, start=0))
annotation (Placement(transformation(extent={{82,-8},{98,8}})));
Rotational.Components.Damper damper(d=damping) annotation (Placement(
transformation(
origin={46,-22},
extent={{-8,-8},{8,8}},
rotation=270)));
Modelica.Blocks.Sources.Sine sine(amplitude=amplitude, freqHz=freqHz)
annotation (Placement(transformation(extent={{-98,-8},{-82,8}})));
equation
connect(inertia1.flange_b, idealGear.flange_a)
annotation (Line(points={{-22,0},{-8,0}}));
connect(idealGear.flange_b, inertia2.flange_a)
annotation (Line(points={{8,0},{22,0}}));
connect(inertia2.flange_b, spring.flange_a)
annotation (Line(points={{38,0},{52,0}}));
connect(spring.flange_b, inertia3.flange_a)
annotation (Line(points={{68,0},{82,0}}));
connect(damper.flange_a, inertia2.flange_b)
annotation (Line(points={{46,-14},{46,0},{38,0}}));
connect(damper.flange_b, fixed.flange)
annotation (Line(points={{46,-30},{46,-40}}));
connect(sine.y, torque.tau)
annotation (Line(points={{-81.2,0},{-69.6,0}}, color={0,0,127}));
connect(torque.flange, inertia1.flange_a) annotation (Line(
points={{-52,0},{-38,0}}));
annotation (Documentation(info="<html>
<p>The drive train consists of a motor inertia which is driven by
a sine-wave motor torque. Via a gearbox the rotational energy is
transmitted to a load inertia. Elasticity in the gearbox is modeled
by a spring element. A linear damper is used to model the
damping in the gearbox bearing.</p>
<p>Note, that a force component (like the damper of this example)
which is acting between a shaft and the housing has to be fixed
in the housing on one side via component Fixed.</p>
<p>Simulate for 1 second and plot the following variables:<br>
angular velocities of inertias inertia2 and 3: inertia2.w, inertia3.w</p>
</html>"), experiment(StopTime=1.0, Interval=0.001));
end FirstGrounded;
model Friction "Drive train with clutch and brake"
import Modelica.Constants.pi;
extends Modelica.Icons.Example;
parameter SI.Time startTime=0.5 "Start time of step";
output SI.Torque tMotor=torque.tau "Driving torque of inertia3";
output SI.Torque tClutch=clutch.tau "Friction torque of clutch";
output SI.Torque tBrake=brake.tau "Friction torque of brake";
output SI.Torque tSpring=spring.tau "Spring torque";
Rotational.Sources.Torque torque(useSupport=true) annotation (Placement(
transformation(extent={{-90,-10},{-70,10}})));
Rotational.Components.Inertia inertia3(
J=1,
phi(
start=0,
fixed=true,
displayUnit="deg"),
w(start=100,
fixed=true,
displayUnit="rad/s")) annotation (Placement(transformation(extent={{-60,
-10},{-40,10}})));
Rotational.Components.Clutch clutch(fn_max=160) annotation (Placement(
transformation(extent={{-30,-10},{-10,10}})));
Rotational.Components.Inertia inertia2(
J=0.05,
phi(start=0, fixed=true),
w(start=90, fixed=true)) annotation (Placement(transformation(extent={{
0,-10},{20,10}})));
Rotational.Components.SpringDamper spring(c=160, d=1) annotation (
Placement(transformation(extent={{30,-10},{50,10}})));
Rotational.Components.Inertia inertia1(
J=1,
phi(start=0, fixed=true),
w(start=90, fixed=true)) annotation (Placement(transformation(extent={{
90,-10},{110,10}})));
Rotational.Components.Brake brake(fn_max=1600, useSupport=true)
annotation (Placement(transformation(extent={{60,-10},{80,10}})));
Modelica.Blocks.Sources.Constant const(k=1) annotation (Placement(
transformation(
origin={-25,35},
extent={{-5,-5},{15,15}},
rotation=270)));
Modelica.Blocks.Sources.Step step(startTime=startTime) annotation (
Placement(transformation(
origin={65,35},
extent={{-5,-5},{15,15}},
rotation=270)));
Modelica.Blocks.Sources.Step step2(
height=-1,
offset=1,
startTime=startTime) annotation (Placement(transformation(extent={{-160,
-30},{-140,-10}})));
Modelica.Blocks.Sources.Sine sine(amplitude=200, freqHz=50/pi)
annotation (Placement(transformation(extent={{-160,10},{-140,30}})));
Modelica.Blocks.Math.Product product annotation (Placement(transformation(
extent={{-120,-10},{-100,10}})));
Rotational.Components.Fixed fixed annotation (Placement(transformation(
extent={{-10,-30},{10,-10}})));
equation
connect(torque.flange, inertia3.flange_a)
annotation (Line(points={{-70,0},{-70,0},{-60,0}}));
connect(inertia3.flange_b, clutch.flange_a)
annotation (Line(points={{-40,0},{-30,0}}));
connect(clutch.flange_b, inertia2.flange_a)
annotation (Line(points={{-10,0},{0,0}}));
connect(inertia2.flange_b, spring.flange_a)
annotation (Line(points={{20,0},{30,0}}));
connect(spring.flange_b, brake.flange_a)
annotation (Line(points={{50,0},{60,0}}));
connect(brake.flange_b, inertia1.flange_a)
annotation (Line(points={{80,0},{80,0},{90,0}}));
connect(sine.y, product.u1) annotation (Line(points={{-139,20},{-130,20},
{-130,6},{-122,6}}, color={0,0,127}));
connect(step2.y, product.u2) annotation (Line(points={{-139,-20},{-130,-20},
{-130,-6},{-126,-6},{-122,-6}}, color={0,0,127}));
connect(product.y, torque.tau)
annotation (Line(points={{-99,0},{-99,0},{-92,0}}, color={0,0,127}));
connect(const.y, clutch.f_normalized) annotation (Line(points={{-20,19},{
-20,12.75},{-20,11}}, color={0,0,127}));
connect(step.y, brake.f_normalized)
annotation (Line(points={{70,19},{70,16},{70,11}}, color={0,0,127}));
connect(torque.support, fixed.flange)
annotation (Line(points={{-80,-10},{-80,-20},{0,-20}}));
connect(brake.support, fixed.flange)
annotation (Line(points={{70,-10},{70,-20},{0,-20}}));
annotation (Documentation(info="<html>
<p>This drive train contains a frictional <strong>clutch</strong> and a <strong>brake</strong>.
Simulate the system for 1 second using the following initial
values (defined already in the model):</p>
<pre> inertia1.w = 90 (or brake.w)
inertia2.w = 90
inertia3.w = 100
</pre>
<p>Plot the output signals</p>
<pre> tMotor Torque of motor
tClutch Torque in clutch
tBrake Torque in brake
tSpring Torque in spring
</pre>
<p>as well as the absolute angular velocities of the three inertia components
(inertia1.w, inertia2.w, inertia3.w).</p>
</html>"), experiment(StopTime=3.0, Interval=0.001),
Diagram(coordinateSystem(extent = {{-170,-100},{120,100}})));
end Friction;
model CoupledClutches "Drive train with 3 dynamically coupled clutches"
extends Modelica.Icons.Example;
parameter SI.Frequency freqHz=0.2
"Frequency of sine function to invoke clutch1";
parameter SI.Time T2=0.4 "Time when clutch2 is invoked";
parameter SI.Time T3=0.9 "Time when clutch3 is invoked";
Rotational.Components.Inertia J1(
J=1,
phi(fixed=true, start=0),
w(start=10, fixed=true)) annotation (Placement(transformation(extent={{
-70,-10},{-50,10}})));
Rotational.Sources.Torque torque(useSupport=true) annotation (Placement(
transformation(extent={{-100,-10},{-80,10}})));
Rotational.Components.Clutch clutch1(peak=1.1, fn_max=20) annotation (
Placement(transformation(extent={{-40,-10},{-20,10}})));
Modelica.Blocks.Sources.Sine sin1(amplitude=10, freqHz=5) annotation (
Placement(transformation(extent={{-130,-10},{-110,10}})));
Modelica.Blocks.Sources.Step step1(startTime=T2) annotation (Placement(
transformation(
origin={25,35},
extent={{-5,-5},{15,15}},
rotation=270)));
Rotational.Components.Inertia J2(
J=1,
phi(fixed=true, start=0),
w(fixed=true, start=0)) annotation (Placement(transformation(extent={{-10,
-10},{10,10}})));
Rotational.Components.Clutch clutch2(peak=1.1, fn_max=20) annotation (
Placement(transformation(extent={{20,-10},{40,10}})));
Rotational.Components.Inertia J3(
J=1,
phi(fixed=true, start=0),
w(fixed=true, start=0)) annotation (Placement(transformation(extent={{
50,-10},{70,10}})));
Rotational.Components.Clutch clutch3(peak=1.1, fn_max=20) annotation (
Placement(transformation(extent={{80,-10},{100,10}})));
Rotational.Components.Inertia J4(
J=1,
phi(fixed=true, start=0),
w(fixed=true, start=0)) annotation (Placement(transformation(extent={{
110,-10},{130,10}})));
Modelica.Blocks.Sources.Sine sin2(
amplitude=1,
freqHz=freqHz,
phase=1.570796326794897) annotation (Placement(transformation(
origin={-35,35},
extent={{-5,-5},{15,15}},
rotation=270)));
Modelica.Blocks.Sources.Step step2(startTime=T3) annotation (Placement(
transformation(
origin={85,35},
extent={{-5,-5},{15,15}},
rotation=270)));
Rotational.Components.Fixed fixed annotation (Placement(transformation(
extent={{-100,-30},{-80,-10}})));