FazBrowse GitHub Viewer
|
Trending
|
URL:
|
Home
Tools:
[Download Repo ZIP]
[View Raw Code]
[Original HTTPS Page]
ModelicaStandardLibrary/ModelicaTest/MultiBody.mo at master · modelscript/ModelicaStandardLibrary · GitHub
ModelicaStandardLibrary/ModelicaTest/MultiBody.mo at master · modelscript/ModelicaStandardLibrary · GitHub
Skip to content
Navigation Menu
Sign in
Appearance settings
AI CODE CREATION
GitHub Copilot
Write better code with AI
GitHub Copilot app
Direct agents from issue to merge
MCP Registry
Integrate external tools
DEVELOPER WORKFLOWS
Actions
Automate any workflow
Codespaces
Instant dev environments
Issues
Plan and track work
Code Review
Manage code changes
Code Quality
Enforce quality at merge
APPLICATION SECURITY
GitHub Advanced Security
Find and fix vulnerabilities
Code security
Secure your code as you build
Secret protection
Stop leaks before they start
EXPLORE
Why GitHub
Documentation
Blog
Changelog
Marketplace
View all features
BY COMPANY SIZE
Enterprises
Small and medium teams
Startups
Nonprofits
BY USE CASE
App Modernization
DevSecOps
DevOps
CI/CD
View all use cases
BY INDUSTRY
Healthcare
Financial services
Manufacturing
Government
View all industries
View all solutions
EXPLORE BY TOPIC
AI
Software Development
DevOps
Security
View all topics
EXPLORE BY TYPE
Customer stories
Events & webinars
Ebooks & reports
Business insights
GitHub Skills
SUPPORT & SERVICES
Documentation
Customer support
Community forum
Trust center
Partners
View all resources
COMMUNITY
GitHub Sponsors
Fund open source developers
PROGRAMS
Security Lab
Maintainer Community
GitHub Stars
Archive Program
REPOSITORIES
Topics
Trending
Collections
ENTERPRISE SOLUTIONS
Enterprise platform
AI-powered developer platform
AVAILABLE ADD-ONS
GitHub Advanced Security
Enterprise-grade security features
Copilot for Business
Enterprise-grade AI features
Premium Support
Enterprise-grade 24/7 support
Pricing
Sign in
Sign up
Appearance settings
You signed in with another tab or window.
Reload
to refresh your session.
You signed out in another tab or window.
Reload
to refresh your session.
You switched accounts on another tab or window.
Reload
to refresh your session.
Dismiss alert
{{ message }}
Uh oh!
There was an error while loading.
Please reload this page
.
modelscript
/
ModelicaStandardLibrary
Public
forked from
modelica/ModelicaStandardLibrary
Notifications
You must be signed in to change notification settings
Fork
0
Star
0
Code
Pull requests
0
Actions
Projects
Security and quality
0
Insights
Additional navigation options
Code
Pull requests
Actions
Projects
Security and quality
Insights
Expand file tree
Breadcrumbs
ModelicaStandardLibrary
/
ModelicaTest
/
MultiBody.mo
Copy path
More file actions
More file actions
Latest commit
History
History
History
10987 lines (10713 loc) · 487 KB
Breadcrumbs
ModelicaStandardLibrary
/
ModelicaTest
/
MultiBody.mo
Copy path
File metadata and controls
10987 lines (10713 loc) · 487 KB
Raw
Copy raw file
Download raw file
Open symbols panel
Edit and raw actions
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
ModelicaTest;
package
MultiBody
"Test models for Modelica.Mechanics.MultiBody"
import
Modelica.Mechanics.MultiBody;
model
PlanarLoopWithMove
"Move block + multi-body system where index reduction can fail"
extends
Modelica.Icons.Example;
parameter
SI.Length
rh1[
3
]
=
{
0.5
,
0
,
0
}
"Position vector from r1 to r4"
;
parameter
SI.Length
rv1[
3
]
=
{
0
,
0.5
,
0
}
"Position vector from r1 to r2"
;
parameter
SI.Length
rv2[
3
]
=
{
0.1
,
0.5
,
0
}
"Position vector from r4 to r2"
;
final
parameter
SI.Length
rh2[
3
]
=
rv2
+
rh1
-
rv1
"Position vector from r2 to r3"
;
inner
MultiBody.World
world(
axisDiameter
=
0.6
/
40
,
axisLength
=
0.8
)
annotation (Placement(transformation(extent={{-40,-60},{-20,-40}})));
MultiBody.Joints.Revolute
r1(useAxisFlange
=
true
)
annotation (Placement(transformation(
origin={0,-10},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Joints.Revolute
r2
annotation (Placement(
transformation(extent={{20,30},{40,50}})));
MultiBody.Joints.Revolute
r3
annotation (Placement(
transformation(extent={{-10,-10},{10,10}},
rotation=-90,
origin={90,10})));
MultiBody.Joints.RevolutePlanarLoopConstraint
r4
annotation (Placement(transformation(extent={{50,-60},{70,-40}})));
MultiBody.Parts.FixedTranslation
rod1(r
=
rv1)
annotation (
Placement(transformation(
origin={0,20},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.FixedTranslation
rod2(r
=
rh1)
annotation (
Placement(transformation(extent={{20,-60},{40,-40}})));
MultiBody.Parts.BodyShape
bodyShape(
m
=
1
,
r
=
rh2,
r_CM
=
rh2
/
2
)
annotation (Placement(transformation(extent={{50,30},{70,50}})));
MultiBody.Parts.FixedTranslation
rod3(r
=
rv2)
annotation (
Placement(transformation(
origin={90,-20},
extent={{-10,-10},{10,10}},
rotation=90)));
Modelica.Blocks.Math.MatrixGain
deg2rad1(
K=[2*Modelica.Math.asin(1)/180,0,0;
0
,
2
*
Modelica.Math.
asin
(
1
)
/
180
,
0
;
0
,
0
,
2
*
Modelica.Math.
asin
(
1
)
/
180
])
annotation (Placement(transformation(extent={{-70,-20},{-50,0}})));
Modelica.Blocks.Sources.CombiTimeTable
combiTimeTable(
smoothness
=
Modelica.Blocks.Types.Smoothness.ContinuousDerivative,
table
=
[
0
,
0
,
10
,
0
;
1
,
10
,
10
,
0
;
2
,
20
,
10
,
0
;
3
,
30
,
10
,
0
],
extrapolation
=
Modelica.Blocks.Types.Extrapolation.LastTwoPoints)
annotation (Placement(transformation(extent={{-100,-20},{-80,0}})));
Modelica.Mechanics.Rotational.Sources.Move
move
annotation (Placement(transformation(extent={{-40,-20},{-20,0}})));
equation
connect
(world.frame_b, r1.frame_a)
annotation (Line(
points={{-20,-50},{-6.66134e-16,-50},{-6.66134e-16,-20}},
color={95,95,95},
thickness=0.5));
connect
(rod1.frame_a, r1.frame_b)
annotation (Line(
points={{-6.66134e-016,10},{-6.66134e-016,6},{-6.66134e-016,0},{4.44089e-016,
0}},
thickness=0.5));
connect
(rod2.frame_a, world.frame_b)
annotation (Line(
points={{20,-50},{-20,-50}},
color={95,95,95},
thickness=0.5));
connect
(rod1.frame_b, r2.frame_a)
annotation (Line(
points={{4.44089e-16,30},{4.44089e-16,40},{20,40}},
color={95,95,95},
thickness=0.5));
connect
(bodyShape.frame_b, r3.frame_a)
annotation (Line(
points={{70,40},{90,40},{90,20}},
color={95,95,95},
thickness=0.5));
connect
(rod2.frame_b, r4.frame_a)
annotation (Line(
points={{40,-50},{50,-50}},
color={95,95,95},
thickness=0.5));
connect
(r4.frame_b, rod3.frame_a)
annotation (Line(
points={{70,-50},{90,-50},{90,-30}},
color={95,95,95},
thickness=0.5));
connect
(rod3.frame_b, r3.frame_b)
annotation (Line(
points={{90,-10},{90,0}},
color={95,95,95},
thickness=0.5));
connect
(combiTimeTable.y, deg2rad1.u)
annotation (Line(
points={{-79,-10},{-72,-10}}, color={0,0,127}));
connect
(move.flange, r1.axis)
annotation (Line(
points={{-20,-10},{-10,-10}}));
connect
(deg2rad1.y, move.u)
annotation (Line(
points={{-49,-10},{-42,-10}}, color={0,0,127}));
connect
(r2.frame_b, bodyShape.frame_a)
annotation (Line(
points={{40,40},{50,40}},
color={95,95,95},
thickness=0.5));
annotation (experiment(StopTime=3), Documentation(info=
"<html>
<p>
This model is a combination of a multi-body system with a kinematic loop
and a Move block, where symbolic transformation is difficult:
</p>
<p>
Standard symbolic transformation works in the following way if functions
are present with annotation \"
InineAfterIndexReduction = true\
".
</p>
<ol>
<li> These functions are not inlined, the Pantelides algorithm
is applied and the equations are symbolically differentiated.</li>
<li> The functions are inlined and further symbolic transformation
is performed (sorting the equations, dummy derivative method etc..</li>
</ol>
<p>
The model contains the following functions that have annotation
\"
InineAfterIndexReduction = true\
":
</p>
<ol>
<li> MultiBody.Frames.resolve1/resolve2(..) functions are used to transform the coordinates
of a vector in another coordinate system. When these functions need to be differentiated
in the Pantelides algorithm, then Euler's differentiation rule is applied with the angular velocity
that is usually a factor of 2-3 more efficient as if direct differentiation
is applied. The drawback is that the sparsity structure is more \"
coarse\
" and
this lets the Pantelides algorithm fail in this example (this happens usually only
in systems with kinematic loops). This means that the differentiated equation system
is structurally singular, after the functions with annotation \"
InineAfterIndexReduction = true\
"
are inlined.</li>
<li> The Rotational.Sources.Move block is using internally functions to express that
an input u[2] is the derivative of input u[1]. In order that this is possible, the functions
have the annotation \"
InineAfterIndexReduction = true\
" so that the differentiation takes place
with the not inlined functions. After the Pantelides algorithm and the differentiation
is applied, the functions are inlined to enhance efficiency.</li>
</ol>
<p>
The problem with (1) is that after inlining the functions with
annotation \"
InineAfterIndexReduction = true\
", the equations are structurally singular, but the
source of the singularity is now known. One remedy is to restart symbolic processing and to
inline all functions with \"
InineAfterIndexReduction = true\
" before the Pantelides algorithm
is applied. In the model, this approach is in principal successful and the model would
be structurally regular. However, the Move block is no longer working correctly if the Pantelides
algorithm is applied with inlining. For this reason in MSL 3.2.1 build 3, the annotation
\"
InineAfterIndexReduction = true\
" in the Move block has been replaced by
annotation \"
Inline = false\
". This results in slightly less efficient code, but is more robust
in the situation at hand.
</p>
</html>"
));
end
PlanarLoopWithMove;
extends
Modelica.Icons.ExamplesPackage;
model
SphericalDoublePendulum
"Double pendulum with two spherical joints and two bodies"
extends
Modelica.Icons.Example;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-88,0},{-68,20}})));
MultiBody.Parts.BodyBox
boxBody1(width
=
0.06
, r
=
{
0.4
,
0.0
,
-
0.3
})
annotation (Placement(transformation(extent={{-10,0},{10,20}})));
MultiBody.Parts.BodyBox
boxBody2(width
=
0.06
, r
=
{
0.3
,
-
0.4
,
0
})
annotation (Placement(transformation(extent={{74,0},{94,20}})));
MultiBody.Joints.Spherical
Spherical1(
enforceStates
=
true
,
useQuaternions
=
false
,
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
,
w_rel_a_start
=
{
0.05235987755982989
,
0.03490658503988659
,
0.0174532925199433
})
annotation (Placement(transformation(extent={{-52,0},{-32,20}})));
MultiBody.Joints.Spherical
Spherical2(
enforceStates
=
true
,
useQuaternions
=
false
,
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
)
annotation (Placement(transformation(extent={{32,0},
{52,20}})));
MultiBody.Parts.BodyBox
boxBody3(width
=
0.06
, r
=
{
0.4
,
0.0
,
-
0.3
})
annotation (Placement(transformation(extent={{-10,-40},{10,-20}})));
MultiBody.Parts.BodyBox
boxBody4(width
=
0.06
, r
=
{
0.3
,
-
0.4
,
0
})
annotation (Placement(transformation(extent={{76,-40},{96,-20}})));
MultiBody.Joints.Spherical
Spherical3(
enforceStates
=
true
,
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
,
w_rel_a_start
=
{
0.05235987755982989
,
0.03490658503988659
,
0.0174532925199433
})
annotation (Placement(transformation(extent={{-52,-40},{-32,-20}})));
MultiBody.Joints.Spherical
Spherical4(
enforceStates
=
true
,
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
)
annotation (Placement(transformation(extent={{32,-40},
{52,-20}})));
MultiBody.Parts.BodyBox
boxBody5(
width
=
0.06
,
r
=
{
0.4
,
0.0
,
-
0.3
},
useQuaternions
=
true
)
annotation (Placement(transformation(extent={{-10,-80},
{10,-60}})));
MultiBody.Parts.BodyBox
boxBody6(
width
=
0.06
,
r
=
{
0.3
,
-
0.4
,
0
},
useQuaternions
=
true
)
annotation (Placement(transformation(extent={{74,-80},
{94,-60}})));
MultiBody.Joints.Spherical
Spherical5(
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
,
w_rel_a_start
=
{
0.05235987755982989
,
0.03490658503988659
,
0.0174532925199433
})
annotation (Placement(transformation(extent={{-52,-80},{-32,-60}})));
MultiBody.Joints.Spherical
Spherical6(
angles_fixed
=
true
,
w_rel_a_fixed
=
true
,
z_rel_a_fixed
=
false
)
annotation (Placement(transformation(extent={{32,-80},
{52,-60}})));
equation
connect
(boxBody1.frame_b, Spherical2.frame_a)
annotation (Line(
points={{10,10},{32,10}},
thickness=0.5));
connect
(Spherical2.frame_b, boxBody2.frame_a)
annotation (Line(
points={{52,10},{74,10}},
thickness=0.5));
connect
(world.frame_b, Spherical1.frame_a)
annotation (Line(
points={{-68,10},{-52,10}},
thickness=0.5));
connect
(Spherical1.frame_b, boxBody1.frame_a)
annotation (Line(
points={{-32,10},{-10,10}},
thickness=0.5));
connect
(boxBody3.frame_b, Spherical4.frame_a)
annotation (Line(
points={{10,-30},{32,-30}},
thickness=0.5));
connect
(Spherical4.frame_b, boxBody4.frame_a)
annotation (Line(
points={{52,-30},{76,-30}},
thickness=0.5));
connect
(Spherical3.frame_b, boxBody3.frame_a)
annotation (Line(
points={{-32,-30},{-10,-30}},
thickness=0.5));
connect
(world.frame_b, Spherical3.frame_a)
annotation (Line(
points={{-68,10},{-60,10},{-60,-30},{-52,-30}},
thickness=0.5));
connect
(boxBody5.frame_b, Spherical6.frame_a)
annotation (Line(
points={{10,-70},{32,-70}},
thickness=0.5));
connect
(Spherical6.frame_b, boxBody6.frame_a)
annotation (Line(
points={{52,-70},{74,-70}},
thickness=0.5));
connect
(Spherical5.frame_b, boxBody5.frame_a)
annotation (Line(
points={{-32,-70},{-10,-70}},
thickness=0.5));
connect
(Spherical5.frame_a, world.frame_b)
annotation (Line(
points={{-52,-70},{-60,-70},{-60,10},{-68,10}},
thickness=0.5));
annotation (experiment(StopTime=3), Documentation(info=
"<html>
<p>
This example demonstrates that by using joint and body
elements animation is automatically available. Also the revolute
joints are animated. Note, that animation of every component
can be switched of by setting the first parameter <strong>animation</strong>
to <strong>false</strong> or by setting <strong>enableAnimation</strong> in the <strong>world</strong>
object to <strong>false</strong> to switch off animation of all components.
</p>
<div>
<img src=\"
modelica://Modelica/Resources/Images/Mechanics/MultiBody/Examples/Elementary/DoublePendulum.png\
"
alt=\"
model Examples.Elementary.DoublePendulum\
">
</div>
</html>"
));
end
SphericalDoublePendulum;
model
WorldGroundVisualization
"Demonstrate visualization of world's ground plane"
extends
Modelica.Icons.Example;
MultiBody.Visualizers.FixedArrow
visGroundAxis(
animation
=
true
,
r_tail
=
{
0
,
0
,
0
},
n
=
world.groundAxis_u,
length
=
world.nominalLength
/
4
)
"Visualize arrow in direction of world.groundAxis_u"
annotation (Placement(transformation(extent={{0,-10},{20,10}})));
inner
MultiBody.World
world(
groundLength_v
=
0.2
,
animateGround
=
true
,
groundAxis_u
=
{
1
,
0.3
,
0
},
groundColor
=
{
0
,
128
,
0
},
n
=
{
-
0.2
,
0.3
,
-
1
},
groundLength_u
=
1
,
animateGravity
=
true
,
gravityType
=
MultiBody.Types.GravityTypes.UniformGravity)
annotation (Placement(transformation(extent={{-40,-10},{-20,10}})));
equation
connect
(visGroundAxis.frame_a, world.frame_b)
annotation (Line(
points={{0,0},{-20,0}},
color={95,95,95},
thickness=0.5));
annotation (experiment(StopTime=1));
end
WorldGroundVisualization;
package
FourbarVariants
"Test joints and assembly joints with four bar loop"
extends
Modelica.Icons.ExamplesPackage;
model
SphericalAndUniversal
"One kinematic loop with four bars (with Spherical and Universal joint)"
extends
Modelica.Icons.Example;
output
SI.Angle
j1_phi
"angle of revolute joint j1"
;
output
SI.Position
j2_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
j1_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
j2_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Revolute
j1(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
phi(fixed
=
true
),
w(fixed
=
true
, start
=
5.235987755982989
))
annotation (Placement(
transformation(extent={{-54,-40},{-34,-20}})));
MultiBody.Joints.Prismatic
j2(
n
=
{
1
,
0
,
0
},
boxWidth
=
0.05
)
annotation (Placement(transformation(extent={{12,-80},{32,-60}})));
MultiBody.Parts.BodyCylinder
b1(r
=
{
0
,
0.5
,
0.1
},
diameter
=
0.05
)
annotation (Placement(transformation(
origin={-30,0},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.BodyCylinder
b2(r
=
{
0
,
0.2
,
0
}, diameter
=
0.05
)
annotation (Placement(transformation(
origin={50,-50},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.FixedTranslation
b3(r
=
{
1
,
0
,
0
},
animation
=
false
)
annotation (Placement(transformation(extent={{-32,-80},
{-12,-60}})));
MultiBody.Joints.Spherical
spherical(animation
=
false
)
annotation (Placement(transformation(extent={{-20,20},{0,40}})));
MultiBody.Parts.FixedTranslation
FixedTranslation1(r
=
{
1
,
-
0.3
,
-
0.1
}, animation
=
false
)
annotation (Placement(transformation(
extent={{12,20},{32,40}})));
MultiBody.Joints.Universal
Universal1(n_b
=
{
0
,
1
,
0
}, n_a
=
{
0
,
0
,
1
})
annotation (Placement(transformation(extent={{44,20},{64,40}})));
equation
j1_phi
=
j1.phi;
j2_s
=
j2.s;
j1_w
=
j1.w;
j2_v
=
j2.v;
connect
(j2.frame_b, b2.frame_a)
annotation (Line(
points={{32,-70},{50,-70},{50,-60}},
thickness=0.5));
connect
(j1.frame_b, b1.frame_a)
annotation (Line(
points={{-34,-30},{-30,-30},{-30,-10}},
thickness=0.5));
connect
(j1.frame_a, world.frame_b)
annotation (Line(
points={{-54,-30},{-60,-30},{-60,-70}},
thickness=0.5));
connect
(b3.frame_a, world.frame_b)
annotation (Line(
points={{-32,-70},{-60,-70}},
thickness=0.5));
connect
(b3.frame_b, j2.frame_a)
annotation (Line(
points={{-12,-70},{12,-70}},
thickness=0.5));
connect
(b1.frame_b, spherical.frame_a)
annotation (Line(
points={{-30,10},{-30,30},{-20,30}},
thickness=0.5));
connect
(spherical.frame_b, FixedTranslation1.frame_a)
annotation (Line(
points={{0,30},{12,30}},
thickness=0.5));
connect
(FixedTranslation1.frame_b, Universal1.frame_a)
annotation (Line(
points={{32,30},{44,30}},
thickness=0.5));
connect
(b2.frame_b, Universal1.frame_b)
annotation (Line(
points={{50,-40},{50,-2},{80,-2},{80,30},{64,30}},
thickness=0.5));
annotation (experiment(StopTime=5), Documentation(info=
"<html>
<p>
This is a second version of the \"
four-bar\
" mechanism, see figure:
</p>
<div>
<img src=\"
modelica://Modelica/Resources/Images/Mechanics/MultiBody/Examples/Loops/Fourbar2.png\
" alt=\"
model Examples.Loops.Fourbar2\
">
</div>
<p>
In this case
the three revolute joints on the left top-side and the two revolute
joints on the right top side have been replaced by the joint <strong>UniversalSpherical</strong>
that is a rod connecting a spherical and a universal joint. This joint is defined
by <strong>1 constraint</strong> stating that the distance between the two spherical joints is
constant. Using this joint in a kinematic loop reduces the sizes of
non-linear algebraic equations. For this loop, only one non-linear
algebraic system of equations of order 1 remains.
</p>
<p>
At the UniversalSpherical joint an additional frame_ia fixed to the rod
is present where components can be attached to the connecting rod. In this
example just a coordinate system is attached to visualize frame_ia (coordinate
system on the right in blue color).
</p>
<p>
Another feature is that the length of the connecting rod can be
automatically calculated during <strong>initialization</strong>. In order to do this,
another initialization condition has to be given. In this example, the
initial value of the distance of the prismatic joint j2 has been fixed
(via the \"
Initialization\
" menu) and the rod length of joint
\"
UniversalSpherical\
" is computed during initialization since parameter
<strong>computeLength</strong> = <strong>true</strong> is set in the joint parameter
menu. The main advantage is that during initialization no non-linear
system of equation is solved and therefore initialization always works.
To be precise, the following trivial non-linear equation is actually solved
for rodLength:
</p>
<blockquote><pre>
rodLength*rodLength = f(angle of revolute joint, distance of prismatic joint)
</pre></blockquote>
</html>"
));
end
SphericalAndUniversal;
model
SphericalSpherical
"One kinematic loop with four bars (with SphericalSpherical joint)"
extends
Modelica.Icons.Example;
output
SI.Angle
j1_phi
"angle of revolute joint j1"
;
output
SI.Position
j2_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
j1_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
j2_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Revolute
j1(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
phi(fixed
=
true
),
w(fixed
=
true
, start
=
5.235987755982989
))
annotation (Placement(
transformation(extent={{-54,-40},{-34,-20}})));
MultiBody.Joints.Prismatic
j2(
n
=
{
1
,
0
,
0
},
a(fixed
=
false
),
s(fixed
=
true
),
v(fixed
=
false
))
annotation (Placement(transformation(extent={{12,-80},{32,-60}})));
MultiBody.Parts.BodyCylinder
b1(r
=
{
0
,
0.5
,
0.1
},
diameter
=
0.05
)
annotation (Placement(transformation(
origin={-30,0},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.BodyCylinder
b2(r
=
{
0
,
0.2
,
0
}, diameter
=
0.05
)
annotation (Placement(transformation(
origin={50,-50},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Joints.SphericalSpherical
sphericalSpherical(
computeRodLength
=
true
, m
=
1
)
annotation (Placement(transformation(
extent={{0,20},{-20,40}})));
MultiBody.Parts.FixedTranslation
b3(r
=
{
1
,
0
,
0
},
animation
=
false
)
annotation (Placement(transformation(extent={{-32,-80},
{-12,-60}})));
equation
connect
(j2.frame_b, b2.frame_a)
annotation (Line(
points={{32,-70},{50,-70},{50,-60}},
thickness=0.5));
connect
(j1.frame_b, b1.frame_a)
annotation (Line(
points={{-34,-30},{-30,-30},{-30,-10}},
thickness=0.5));
connect
(j1.frame_a, world.frame_b)
annotation (Line(
points={{-54,-30},{-60,-30},{-60,-70}},
thickness=0.5));
connect
(b1.frame_b, sphericalSpherical.frame_b)
annotation (Line(
points={{-30,10},{-30,30},{-20,30}},
thickness=0.5));
connect
(sphericalSpherical.frame_a, b2.frame_b)
annotation (Line(
points={{0,30},{50,30},{50,-40}},
thickness=0.5));
j1_phi
=
j1.phi;
j2_s
=
j2.s;
j1_w
=
j1.w;
j2_v
=
j2.v;
connect
(b3.frame_a, world.frame_b)
annotation (Line(
points={{-32,-70},{-60,-70}},
thickness=0.5));
connect
(b3.frame_b, j2.frame_a)
annotation (Line(
points={{-12,-70},{12,-70}},
thickness=0.5));
annotation (experiment(StopTime=5), Documentation(info=
"<html>
<p>
This is a third version of the \"
four-bar\
" mechanism. In this case
the three revolute joints on the left top-side and the two revolute
joints on the right top side have been replaced by the joint <strong>SphericalSpherical</strong>
that is a rod with two spherical joints on each side. This joint is defined
by <strong>1 constraint</strong> stating that the distance between the two spherical joints is
constant. Using this joint in a kinematic loop reduces the sizes of
non-linear algebraic equations. For this loop, only one non-linear
algebraic system of equations of order 1 remains.
</p>
<p>
The SphericalSpherical joint may be massless or may have a point mass in
the middle of the rod to approximate in an convenient way the rod
mass properties.
</p>
<p>
Another nice feature is that the <strong>length</strong> of the connecting rod can be
automatically calculated during <strong>initialization</strong>. In order to do this,
another initialization condition has to be given. In this example, the
initial value of the distance of the prismatic joint j2 has been fixed
(via the \"
Initialization\
" menu) and the length parameter of joint
\"
SphericalSpherical\
" is computed during initialization since parameter
<strong>computeLength</strong> = <strong>true</strong> is set in the joint parameter
menu (this sets \"
fixed=false\
" on parameter \"
length\
").
</p>
</html>"
));
end
SphericalSpherical;
model
UniversalSpherical
"One kinematic loop with four bars (with UniversalSpherical joint)"
extends
Modelica.Icons.Example;
output
SI.Angle
j1_phi
"angle of revolute joint j1"
;
output
SI.Position
j2_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
j1_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
j2_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Revolute
j1(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
phi(fixed
=
true
),
w(fixed
=
true
, start
=
5.235987755982989
))
annotation (Placement(
transformation(extent={{-54,-40},{-34,-20}})));
MultiBody.Joints.Prismatic
j2(
n
=
{
1
,
0
,
0
},
boxWidth
=
0.01
,
a(fixed
=
false
),
s(fixed
=
false
),
v(fixed
=
false
))
annotation (Placement(transformation(extent={{12,-80},{32,-60}})));
MultiBody.Parts.BodyCylinder
b1(r
=
{
0
,
0.5
,
0.1
},
diameter
=
0.05
)
annotation (Placement(transformation(
origin={-30,0},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.BodyCylinder
b2(r
=
{
0
,
0.2
,
0
}, diameter
=
0.05
)
annotation (Placement(transformation(
origin={50,-50},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Joints.UniversalSpherical
universalSpherical(
rRod_ia
=
{
-
1
,
0.3
,
0.1
}, n1_a
=
{
0
,
1
,
0.1
})
annotation (Placement(
transformation(extent={{0,20},{-20,40}})));
MultiBody.Parts.FixedTranslation
b3(animation
=
false
, r
=
{
0.8
,
0
,
0
})
annotation (Placement(transformation(extent={{-32,-80},{-12,
-60}})));
MultiBody.Visualizers.FixedFrame
fixedFrame4
annotation (Placement(transformation(
origin={-10,70},
extent={{-10,-10},{10,10}},
rotation=90)));
equation
j1_phi
=
j1.phi;
j2_s
=
j2.s;
j1_w
=
j1.w;
j2_v
=
j2.v;
connect
(j2.frame_b, b2.frame_a)
annotation (Line(
points={{32,-70},{50,-70},{50,-60}},
thickness=0.5));
connect
(j1.frame_b, b1.frame_a)
annotation (Line(
points={{-34,-30},{-30,-30},{-30,-10}},
thickness=0.5));
connect
(j1.frame_a, world.frame_b)
annotation (Line(
points={{-54,-30},{-60,-30},{-60,-70}},
thickness=0.5));
connect
(b1.frame_b, universalSpherical.frame_b)
annotation (Line(
points={{-30,10},{-30,30},{-20,30}},
thickness=0.5));
connect
(universalSpherical.frame_a, b2.frame_b)
annotation (Line(
points={{0,30},{50,30},{50,-40}},
thickness=0.5));
connect
(b3.frame_a, world.frame_b)
annotation (Line(
points={{-32,-70},{-60,-70}},
thickness=0.5));
connect
(b3.frame_b, j2.frame_a)
annotation (Line(
points={{-12,-70},{12,-70}},
thickness=0.5));
connect
(fixedFrame4.frame_a, universalSpherical.frame_ia)
annotation (
Line(
points={{-10,60},{-10,50},{-6,50},{-6,40}},
thickness=0.5));
annotation (experiment(StopTime=5), Documentation(info=
"<html>
<p>
This is a fourth version of the \"
four-bar\
" mechanism. In this case
the three revolute joints on the left top-side and the two revolute
joints on the right top side have been replaced by the joint <strong>UniversalSpherical</strong>
that is a rod with a spherical and a universal joint on two sides. This joint is defined
by <strong>1 constraint</strong> stating that the distance between the two spherical joints is
constant. Using this joint in a kinematic loop reduces the sizes of
non-linear algebraic equations. For this loop, only one non-linear
algebraic system of equations of order 1 remains.
</p>
<p>
The essential difference to joint SphericalSpherical is that the
orientation of the rod can be computed by removing one degree of freedom
of one of the spherical joints (i.e., replacing it by a universal joint).
Usually, the eigenrotation of the connecting rod is of no technical
interest and by this approximation it is constrained to move in a
somewhat arbitrary way. This allows to have an additional connector,
<strong>frame_ia</strong>, to be fixed on the rod, where other objects can be attached.
In this example, the coordinate system of frame_ia is visualized.
</p>
<p>
Another nice feature is that the <strong>length</strong> of the connecting rod can be
automatically calculated during <strong>initialization</strong>. In order to do this,
another initialization condition has to be given. In this example, the
initial value of the distance of the prismatic joint j2 has been fixed
(via the \"
Initialization\
" menu) and the length parameter of joint
\"
UniversalSpherical\
" is computed during initialization since parameter
<strong>computeLength</strong> = <strong>true</strong> is set in the joint parameter
menu (this sets \"
fixed=false\
" on parameter \"
length\
").
</p>
</html>"
));
end
UniversalSpherical;
model
JointUSR
"One kinematic loop with four bars (using JointUSR joint)"
extends
Modelica.Icons.Example;
output
SI.Angle
j1_phi
"angle of revolute joint j1"
;
output
SI.Position
j2_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
j1_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
j2_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Prismatic
j2(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
s(fixed
=
true
),
v(fixed
=
true
, start
=
-
0.4
))
annotation (Placement(transformation(extent={{10,-80},{30,-60}})));
MultiBody.Parts.BodyCylinder
b2(r
=
{
0
,
0.2
,
0
}, diameter
=
0.05
)
annotation (Placement(transformation(
origin={40,-30},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.FixedTranslation
b3(animation
=
false
, r
=
{
1
,
0
,
0
})
annotation (Placement(transformation(extent={{-30,-80},{-10,-60}})));
MultiBody.Visualizers.FixedFrame
fixedFrame
annotation (Placement(transformation(
origin={30,30},
extent={{-10,-10},{10,10}})));
MultiBody.Joints.Assemblies.JointUSR
jointUSR(
n1_a
=
{
0
,
1
,
0
},
n_b
=
{
1
,
0
,
0
},
rRod2_ib
=
{
0
,
0.5
,
0.1
},
checkTotalPower
=
true
,
rRod1_ia
=
{
-
1
,
0.3
,
-
0.1
})
annotation (Placement(transformation(extent={{0,
0},{-20,20}})));
MultiBody.Parts.Body
Body1(
m
=
1
,
I_11
=
0.1
,
I_22
=
0.1
,
I_33
=
0.1
,
r_CM
=
{
0.01
,
0
,
0
})
annotation (Placement(transformation(extent={{-30,30},
{-50,50}})));
MultiBody.Parts.Body
Body2(
m
=
1
,
I_11
=
0.1
,
I_22
=
0.1
,
I_33
=
0.1
,
r_CM
=
jointUSR.eRod1_ia
/
2
)
annotation (Placement(transformation(extent={
{20,50},{40,70}})));
MultiBody.Parts.Body
Body3(
m
=
1
,
I_11
=
0.1
,
I_22
=
0.1
,
I_33
=
0.1
,
r_CM
=
{
0
,
0
,
0
})
annotation (Placement(transformation(
extent={{-10,-10},{10,10}},
rotation=90,
origin={-10,70})));
Modelica.Mechanics.Rotational.Components.Damper
damper(d
=
0.1
)
annotation (
Placement(transformation(
origin={-60,10},
extent={{-10,-10},{10,10}},
rotation=90)));
equation
j1_phi
=
jointUSR.revolute.phi;
j2_s
=
j2.s;
j1_w
=
der
(jointUSR.revolute.phi);
j2_v
=
j2.v;
connect
(j2.frame_b, b2.frame_a)
annotation (Line(
points={{30,-70},{40,-70},{40,-40}},
thickness=0.5));
connect
(b3.frame_a, world.frame_b)
annotation (Line(
points={{-30,-70},{-60,-70}},
thickness=0.5));
connect
(b3.frame_b, j2.frame_a)
annotation (Line(
points={{-10,-70},{10,-70}},
thickness=0.5));
connect
(world.frame_b, jointUSR.frame_b)
annotation (Line(
points={{-60,-70},{-40,-70},{-40,10},{-20,10}},
thickness=0.5));
connect
(jointUSR.frame_a, b2.frame_b)
annotation (Line(
points={{0,10},{40,10},{40,-20}},
thickness=0.5));
connect
(damper.flange_b, jointUSR.axis)
annotation (Line(
points={{-60,20},{-50,20},{-50,18},{-20,18}}));
connect
(damper.flange_a, jointUSR.bearing)
annotation (Line(
points={{-60,0},{-50,0},{-50,14},{-20,14}}));
connect
(Body1.frame_a, jointUSR.frame_ib)
annotation (Line(
points={{-30,40},{-18,40},{-18,20}},
color={95,95,95},
thickness=0.5));
connect
(Body2.frame_a, jointUSR.frame_ia)
annotation (Line(
points={{20,60},{10,60},{10,30},{-2,30},{-2,20}},
color={95,95,95},
thickness=0.5));
connect
(Body3.frame_a, jointUSR.frame_im)
annotation (Line(
points={{-10,60},{-10,20},{-10,20}},
color={95,95,95},
thickness=0.5));
connect
(fixedFrame.frame_a, jointUSR.frame_ia)
annotation (Line(
points={{20,30},{-2,30},{-2,20}},
color={95,95,95},
thickness=0.5));
annotation (experiment(StopTime=2), Documentation(info=
"<html>
<p>
This is a fourth version of the \"
four-bar\
" mechanism. In this case
the three revolute joints on the left top-side and the two revolute
joints on the right top side have been replaced by the joint <strong>UniversalSpherical</strong>
that is a rod with a spherical and a universal joint on two sides. This joint is defined
by <strong>1 constraint</strong> stating that the distance between the two spherical joints is
constant. Using this joint in a kinematic loop reduces the sizes of
non-linear algebraic equations. For this loop, only one non-linear
algebraic system of equations of order 1 remains.
</p>
<p>
The essential difference to joint SphericalSpherical is that the
orientation of the rod can be computed by removing one degree of freedom
of one of the spherical joints (i.e., replacing it by a universal joint).
Usually, the eigenrotation of the connecting rod is of no technical
interest and by this approximation it is constrained to move in a
somewhat arbitrary way. This allows to have an additional connector,
<strong>frame_ia</strong>, to be fixed on the rod, where other objects can be attached.
In this example, the coordinate system of frame_ia is visualized.
</p>
<p>
Another nice feature is that the <strong>length</strong> of the connecting rod can be
automatically calculated during <strong>initialization</strong>. In order to do this,
another initialization condition has to be given. In this example, the
initial value of the distance of the prismatic joint j2 has been fixed
(via the \"
Initialization\
" menu) and the length parameter of joint
\"
UniversalSpherical\
" is computed during initialization since parameter
<strong>computeLength</strong> = <strong>true</strong> is set in the joint parameter
menu (this sets \"
fixed=false\
" on parameter \"
length\
").
</p>
</html>"
));
end
JointUSR;
model
JointSSR
"One kinematic loop with four bars (using JointSSR joint)"
extends
Modelica.Icons.Example;
parameter
SI.Distance
L
=
Modelica.Math.Vectors.length({
-
1
,
0.3
,
0.1
});
output
SI.Angle
j1_phi
"angle of revolute joint j1"
;
output
SI.Position
j2_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
j1_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
j2_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Prismatic
j2(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
s(fixed
=
true
),
v(fixed
=
true
, start
=
-
0.2
))
annotation (Placement(transformation(extent={{10,-80},{30,-60}})));
MultiBody.Parts.BodyCylinder
b2(r
=
{
0
,
0.2
,
0
}, diameter
=
0.05
)
annotation (Placement(transformation(
origin={40,-30},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.FixedTranslation
b3(animation
=
false
, r
=
{
1
,
0
,
0
})
annotation (Placement(transformation(extent={{-30,-80},{-10,-60}})));
MultiBody.Joints.Assemblies.JointSSR
jointSSR(
n_b
=
{
1
,
0
,
0
},
rRod2_ib
=
{
0
,
0.5
,
0.1
},
rod1Length
=
L,
checkTotalPower
=
true
,
rod1Mass
=
0.1
)
annotation (Placement(transformation(extent={{0,0},{-20,20}})));
MultiBody.Visualizers.FixedFrame
FixedFrame1
annotation (Placement(transformation(extent={{-30,60},{-50,80}})));
MultiBody.Parts.Body
Body1(r_CM
=
jointSSR.rRod2_ib
/
2
, m
=
0.1
)
annotation (Placement(transformation(extent={{-30,30},{-50,50}})));
MultiBody.Parts.Body
Body2(m
=
0.1
, r_CM
=
{
0
,
0
,
0
})
annotation (Placement(transformation(extent={{0,30},{20,50}})));
Modelica.Mechanics.Rotational.Components.Damper
damper(d
=
0.5
)
annotation (
Placement(transformation(
origin={-60,10},
extent={{-10,-10},{10,10}},
rotation=90)));
equation
j1_phi
=
jointSSR.revolute.phi;
j2_s
=
j2.s;
j1_w
=
der
(jointSSR.revolute.phi);
j2_v
=
j2.v;
connect
(jointSSR.axis, damper.flange_b)
annotation (Line(points={{-20,18},
{-50,18},{-50,20},{-60,20}}));
connect
(jointSSR.bearing, damper.flange_a)
annotation (Line(points={{-20,
14},{-50,14},{-50,0},{-60,0}}));
connect
(world.frame_b, b3.frame_a)
annotation (Line(
points={{-60,-70},{-30,-70}},
color={95,95,95},
thickness=0.5));
connect
(world.frame_b, jointSSR.frame_b)
annotation (Line(
points={{-60,-70},{-40,-70},{-40,10},{-20,10}},
color={95,95,95},
thickness=0.5));
connect
(b3.frame_b, j2.frame_a)
annotation (Line(
points={{-10,-70},{10,-70}},
color={95,95,95},
thickness=0.5));
connect
(j2.frame_b, b2.frame_a)
annotation (Line(
points={{30,-70},{40,-70},{40,-40}},
color={95,95,95},
thickness=0.5));
connect
(b2.frame_b, jointSSR.frame_a)
annotation (Line(
points={{40,-20},{40,10},{0,10}},
color={95,95,95},
thickness=0.5));
connect
(Body1.frame_a, jointSSR.frame_ib)
annotation (Line(
points={{-30,40},{-18,40},{-18,20}},
color={95,95,95},
thickness=0.5));
connect
(Body2.frame_a, jointSSR.frame_im)
annotation (Line(
points={{0,40},{-10,40},{-10,20}},
color={95,95,95},
thickness=0.5));
connect
(FixedFrame1.frame_a, jointSSR.frame_ib)
annotation (Line(
points={{-30,70},{-18,70},{-18,20}},
color={95,95,95},
thickness=0.5));
annotation (experiment(StopTime=1.1), Documentation(info=
"<html>
<p>
This is a fourth version of the \"
four-bar\
" mechanism. In this case
the three revolute joints on the left top-side and the two revolute
joints on the right top side have been replaced by the joint <strong>UniversalSpherical</strong>
that is a rod with a spherical and a universal joint on two sides. This joint is defined
by <strong>1 constraint</strong> stating that the distance between the two spherical joints is
constant. Using this joint in a kinematic loop reduces the sizes of
non-linear algebraic equations. For this loop, only one non-linear
algebraic system of equations of order 1 remains.
</p>
<p>
The essential difference to joint SphericalSpherical is that the
orientation of the rod can be computed by removing one degree of freedom
of one of the spherical joints (i.e., replacing it by a universal joint).
Usually, the eigenrotation of the connecting rod is of no technical
interest and by this approximation it is constrained to move in a
somewhat arbitrary way. This allows to have an additional connector,
<strong>frame_ia</strong>, to be fixed on the rod, where other objects can be attached.
In this example, the coordinate system of frame_ia is visualized.
</p>
<p>
Another nice feature is that the <strong>length</strong> of the connecting rod can be
automatically calculated during <strong>initialization</strong>. In order to do this,
another initialization condition has to be given. In this example, the
initial value of the distance of the prismatic joint j2 has been fixed
(via the \"
Initialization\
" menu) and the length parameter of joint
\"
UniversalSpherical\
" is computed during initialization since parameter
<strong>computeLength</strong> = <strong>true</strong> is set in the joint parameter
menu (this sets \"
fixed=false\
" on parameter \"
length\
").
</p>
</html>"
));
end
JointSSR;
model
JointUSP
"One kinematic loop with four bars (using JointUSP joint)"
extends
Modelica.Icons.Example;
output
SI.Angle
revolute_phi
"angle of revolute joint j1"
;
output
SI.Position
prismatic_s
"distance of prismatic joint j2"
;
output
SI.AngularVelocity
revolute_w
"axis speed of revolute joint j1"
;
output
SI.Velocity
prismatic_v
"axis velocity of prismatic joint j2"
;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,-80},{-60,-60}})));
MultiBody.Joints.Revolute
revolute(
n
=
{
1
,
0
,
0
},
stateSelect
=
StateSelect.always,
a(fixed
=
false
),
phi(fixed
=
true
),
w(fixed
=
true
, start
=
5.235987755982989
))
annotation (Placement(
transformation(extent={{-40,-40},{-20,-20}})));
MultiBody.Parts.BodyCylinder
body1(r
=
{
0
,
0.5
,
0.1
},
diameter
=
0.05
)
annotation (Placement(transformation(
origin={-10,-10},
extent={{-10,-10},{10,10}},
rotation=90)));
MultiBody.Parts.BodyCylinder
body3(r
=
{
0
,
0.2
,
0
},
diameter
=
0.05
)
annotation (Placement(transformation(
origin={40,60},
extent={{-10,-10},{10,10}})));
MultiBody.Parts.FixedTranslation
ground_rod(animation
=
false
, r
=
{
1.2
,
0
,
0
})
annotation (Placement(transformation(extent={{-32,
-80},{-12,-60}})));
MultiBody.Joints.Assemblies.JointUSP
jointUSP(
rRod2_ib
=
{
0
,
0.2
,
0
},
n1_a
=
{
0
,
0
,
-
1
},
n_b
=
{
-
1
,
0
,
0
},
rod1Diameter
=
0.04
,
boxWidth
=
0.05
,
rRod1_ia
=
{
1
,
-
0.3
,
0.1
})
annotation (Placement(transformation(extent={{0,
20},{20,40}})));
MultiBody.Parts.BodyCylinder
body2(r
=
{
1
,
-
0.3
,
0.1
},
diameter
=
0.05
)
annotation (Placement(transformation(extent={{-10,50},
{-30,70}})));
Modelica.Mechanics.Translational.Components.Damper
damper(d
=
50
)
annotation (Placement(transformation(
origin={50,30},
extent={{10,-10},{-10,10}},
rotation=270)));
equation
revolute_phi
=
revolute.phi;
prismatic_s
=
jointUSP.prismatic.s;
revolute_w
=
revolute.w;
prismatic_v
=
der
(jointUSP.prismatic.s);
connect
(jointUSP.bearing, damper.flange_a)
annotation (Line(points={{20,
34},{38,34},{38,18},{50,18},{50,20}}, color={0,191,0}));
connect
(jointUSP.axis, damper.flange_b)
annotation (Line(points={{20,38},
{38,38},{38,40},{50,40}}, color={0,191,0}));
connect
(ground_rod.frame_b, jointUSP.frame_b)
annotation (Line(
points={{-12,-70},{30,-70},{30,30},{20,30}},
color={95,95,95},
thickness=0.5));
connect
(world.frame_b, ground_rod.frame_a)
annotation (Line(
points={{-60,-70},{-32,-70}},
color={95,95,95},
thickness=0.5));
connect
(world.frame_b, revolute.frame_a)
annotation (Line(
points={{-60,-70},{-50,-70},{-50,-30},{-40,-30}},
color={95,95,95},
thickness=0.5));
connect
(revolute.frame_b, body1.frame_a)
annotation (Line(
points={{-20,-30},{-10,-30},{-10,-20}},
color={95,95,95},
thickness=0.5));
connect
(body1.frame_b, jointUSP.frame_a)
annotation (Line(
points={{-10,0},{-10,30},{0,30}},
color={95,95,95},
thickness=0.5));
connect
(jointUSP.frame_ia, body2.frame_a)
annotation (Line(
points={{2,40},{2,60},{-10,60}},
color={95,95,95},
thickness=0.5));
connect
(jointUSP.frame_ib, body3.frame_a)
annotation (Line(
points={{18,40},{18,60},{30,60}},
color={95,95,95},
thickness=0.5));
annotation (experiment(StopTime=5), Documentation(info=
""
));
end
JointUSP;
end
FourbarVariants;
package
Frames
"Test functions of package Frames"
extends
Modelica.Icons.ExamplesPackage;
model
AngularVelocity
"Test angular velocity functions"
import
Modelica.Mechanics.MultiBody.Frames.{angularVelocity1, angularVelocity2, resolve1};
extends
Modelica.Icons.Example;
MultiBody.Frames.Orientation R=body.frame_a.R
;
SI.AngularVelocity
wa[
3
]
=
angularVelocity2(R);
SI.AngularVelocity
w1[
3
]
=
resolve1(R, wa);
SI.AngularVelocity
w2[
3
]
=
angularVelocity1(R);
SI.AngularVelocity
w_err[
3
]
=
w2
-
w1;
inner
MultiBody.World
world
annotation (Placement(
transformation(extent={{-80,20},{-60,40}})));
MultiBody.Parts.FixedTranslation
bar2(r
=
{
0.8
,
0
,
0
},
animation
=
false
)
annotation (Placement(transformation(extent={{-20,20},{0,40}})));
MultiBody.Forces.Spring
spring1(
width
=
0.1
,
coilWidth
=
0.005
,
numberOfWindings
=
5
,
c
=
20
,
s_unstretched
=
0
)
annotation (Placement(transformation(
origin={-40,0},
extent={{-10,-10},{10,10}},
rotation=270)));
MultiBody.Parts.BodyShape
body(
m
=
1
,
I_11
=
1
,
I_22
=
1
,
I_33
=
1
,
r
=
{
0.4
,
0
,
0
},
r_CM
=
{
0.2
,
0
,
0
},
width
=
0.05
,
angles_start
=
{
0.174532925199433
,
0.174532925199433
,
0.174532925199433
},
a_0(
each
fixed
=
false
),
angles_fixed
=
true
,
r_0(
each
fixed
=
true
, start
=
{
0.2
,
-
0.5
,
0.1
}),
View remainder of file in raw view
Footer
© 2026 GitHub, Inc.
Footer navigation
Terms
Privacy
Security
Status
Community
Docs
Contact
You can’t perform that action at this time.
Back
|
FazBrowse Home
|
New Git URL