forked from modelica/ModelicaStandardLibrary
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Universal.mo
168 lines (161 loc) · 6.61 KB
/
Universal.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
within Modelica.Mechanics.MultiBody.Joints;
model Universal "Universal joint (2 degrees-of-freedom, 4 potential states)"
extends Modelica.Mechanics.MultiBody.Interfaces.PartialTwoFrames;
parameter Boolean animation=true "= true, if animation shall be enabled";
parameter Modelica.Mechanics.MultiBody.Types.Axis n_a={1,0,0}
"Axis of revolute joint 1 resolved in frame_a" annotation (Evaluate=true);
parameter Modelica.Mechanics.MultiBody.Types.Axis n_b={0,1,0}
"Axis of revolute joint 2 resolved in frame_b" annotation (Evaluate=true);
parameter SI.Distance cylinderLength=world.defaultJointLength
"Length of cylinders representing the joint axes"
annotation (Dialog(tab="Animation", group="if animation = true", enable=animation));
parameter SI.Distance cylinderDiameter=world.defaultJointWidth
"Diameter of cylinders representing the joint axes"
annotation (Dialog(tab="Animation", group="if animation = true", enable=animation));
input Types.Color cylinderColor=Modelica.Mechanics.MultiBody.Types.Defaults.JointColor
"Color of cylinders representing the joint axes"
annotation (Dialog(colorSelector=true, tab="Animation", group="if animation = true", enable=animation));
input Types.SpecularCoefficient specularCoefficient = world.defaultSpecularCoefficient
"Reflection of ambient light (= 0: light is completely absorbed)"
annotation (Dialog(tab="Animation", group="if animation = true", enable=animation));
parameter StateSelect stateSelect=StateSelect.prefer
"Priority to use joint coordinates (phi_a, phi_b, w_a, w_b) as states" annotation(Dialog(tab="Advanced"));
Modelica.Mechanics.MultiBody.Joints.Revolute revolute_a(
n=n_a,
stateSelect=StateSelect.never,
cylinderDiameter=cylinderDiameter,
cylinderLength=cylinderLength,
cylinderColor=cylinderColor,
specularCoefficient=specularCoefficient,
animation=animation) annotation (Placement(transformation(extent={{-60,-25},{-10,25}})));
Modelica.Mechanics.MultiBody.Joints.Revolute revolute_b(
n=n_b,
stateSelect=StateSelect.never,
animation=animation,
cylinderDiameter=cylinderDiameter,
cylinderLength=cylinderLength,
cylinderColor=cylinderColor,
specularCoefficient=specularCoefficient) annotation (Placement(transformation(
origin={35,45},
extent={{-25,-25},{25,25}},
rotation=90)));
SI.Angle phi_a(start=0, stateSelect=stateSelect)
"Relative rotation angle from frame_a to intermediate frame";
SI.Angle phi_b(start=0, stateSelect=stateSelect)
"Relative rotation angle from intermediate frame to frame_b";
SI.AngularVelocity w_a(start=0, stateSelect=stateSelect)
"First derivative of angle phi_a (relative angular velocity a)";
SI.AngularVelocity w_b(start=0, stateSelect=stateSelect)
"First derivative of angle phi_b (relative angular velocity b)";
SI.AngularAcceleration a_a(start=0)
"Second derivative of angle phi_a (relative angular acceleration a)";
SI.AngularAcceleration a_b(start=0)
"Second derivative of angle phi_b (relative angular acceleration b)";
equation
phi_a = revolute_a.phi;
phi_b = revolute_b.phi;
w_a = der(phi_a);
w_b = der(phi_b);
a_a = der(w_a);
a_b = der(w_b);
connect(frame_a, revolute_a.frame_a)
annotation (Line(
points={{-100,0},{-60,0}},
color={95,95,95},
thickness=0.5));
connect(revolute_b.frame_b, frame_b) annotation (Line(
points={{35,70},{35,90},{70,90},{70,0},{100,0}},
color={95,95,95},
thickness=0.5));
connect(revolute_a.frame_b, revolute_b.frame_a) annotation (Line(
points={{-10,0},{35,0},{35,20}},
color={95,95,95},
thickness=0.5));
annotation (
Documentation(info="<html>
<p>
Joint where frame_a rotates around axis n_a which is fixed in frame_a
and frame_b rotates around axis n_b which is fixed in frame_b.
The two frames coincide when
\"revolute_a.phi=0\" and \"revolute_b.phi=0\". This joint
has the following potential states;
</p>
<ul>
<li> The relative angle phi_a = revolute_a.phi [rad] around axis n_a,</li>
<li> the relative angle phi_b = revolute_b.phi [rad] around axis n_b,</li>
<li> the relative angular velocity w_a (= der(phi_a)) and</li>
<li> the relative angular velocity w_b (= der(phi_b)).</li>
</ul>
<p>
They are used as candidates for automatic selection of states
from the tool. This may be enforced by setting \"stateSelect=StateSelect.<strong>always</strong>\"
in the <strong>Advanced</strong> menu. The states are usually selected automatically.
In certain situations, especially when closed kinematic loops are present,
it might be slightly more efficient, when using the \"StateSelect.always\" setting.
</p>
<p>
In the following figure the animation of a universal
joint is shown. The light blue coordinate system is
frame_a and the dark blue coordinate system is
frame_b of the joint
(here: n_a = {0,0,1}, n_b = {0,1,0}, phi_a.start = 90<sup>o</sup>,
phi_b.start = 45<sup>o</sup>).
</p>
<div>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/MultiBody/Joints/Universal.png\">
</div>
</html>"),
Icon(coordinateSystem(
preserveAspectRatio=true,
extent={{-100,-100},{100,100}}), graphics={
Rectangle(
extent={{-100,11},{100,-10}},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={235,235,235}),
Ellipse(
extent={{-80,-80},{80,80}},
lineColor={160,160,164},
fillColor={192,192,192},
fillPattern=FillPattern.Solid,
startAngle=90,
endAngle=270),
Ellipse(
extent={{-60,-60},{60,60}},
lineColor={255,255,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid,
startAngle=89,
endAngle=271,
closure=EllipseClosure.Radial),
Line(
points={{0,80},{0,-80}},
thickness=0.5),
Ellipse(
extent={{-60,-60},{60,60}},
lineColor={160,160,164},
startAngle=90,
endAngle=270,
closure=EllipseClosure.None),
Ellipse(
extent={{-70,-40},{70,40}},
lineColor={160,160,164},
fillColor={192,192,192},
fillPattern=FillPattern.Solid,
startAngle=-120,
endAngle=60),
Ellipse(
extent={{-48,-22},{52,24}},
lineColor={255,255,255},
fillColor={255,255,255},
fillPattern=FillPattern.Solid),
Line(
points={{40,40},{-40,-40}},
thickness=0.5),
Line(
points={{0,72},{0,-20}},
thickness=0.5),
Text(
extent={{-150,120},{150,80}},
textString="%name",
textColor={0,0,255})}));
end Universal;