-
Notifications
You must be signed in to change notification settings - Fork 164
/
Rotor1D.mo
375 lines (355 loc) · 16.4 KB
/
Rotor1D.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
within Modelica.Mechanics.MultiBody.Parts;
model Rotor1D
"1D inertia attachable on 3-dim. bodies (3D dynamic effects are taken into account if world.driveTrainMechanics3D=true)"
parameter Boolean animation=true
"= true, if animation shall be enabled (show rotor as cylinder)";
parameter SI.Inertia J(min=0,start=1)
"Moment of inertia of rotor around its axis of rotation";
parameter Modelica.Mechanics.MultiBody.Types.Axis n={1,0,0}
"Axis of rotation resolved in frame_a"
annotation (Evaluate=true);
parameter SI.Position r_center[3]=zeros(3)
"Position vector from origin of frame_a to center of cylinder"
annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
parameter SI.Distance cylinderLength=2*world.defaultJointLength
"Length of cylinder representing the rotor" annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
parameter SI.Distance cylinderDiameter=2*world.defaultJointWidth
"Diameter of cylinder representing the rotor" annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
input Modelica.Mechanics.MultiBody.Types.Color cylinderColor=Modelica.Mechanics.MultiBody.Types.Defaults.RodColor
"Color of cylinder representing the rotor" annotation (Dialog(
colorSelector=true,
tab="Animation",
group="if animation = true",
enable=animation));
input Modelica.Mechanics.MultiBody.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.default
"Priority to use rotor angle (phi) and rotor speed (w) as states"
annotation (Dialog(tab="Advanced"));
parameter Boolean exact=true
"= true, if exact calculations; false if influence of bearing on rotor acceleration is neglected to avoid an algebraic loop"
annotation (Evaluate=true, Dialog(tab="Advanced"));
SI.Angle phi(start=0, stateSelect=stateSelect)
"Rotation angle of rotor with respect to frame_a (= flange_a.phi = flange_b.phi)";
SI.AngularVelocity w(start=0, stateSelect=stateSelect)
"Angular velocity of rotor with respect to frame_a";
SI.AngularAcceleration a(start=0)
"Angular acceleration of rotor with respect to frame_a";
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
"(left) driving flange (flange axis directed INTO cut plane)" annotation (
Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b
"(right) driven flange (flange axis directed OUT OF cut plane)"
annotation (Placement(transformation(extent={{90,-10},{110,10}})));
Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a if world.driveTrainMechanics3D
"Frame in which rotor housing is fixed (connector is removed, if world.driveTrainMechanics3D=false)"
annotation (Placement(transformation(
origin={0,-100},
extent={{-20,-20},{20,20}},
rotation=90)));
encapsulated model RotorWith3DEffects
"1D inertia attachable on 3-dim. bodies (3D dynamic effects are taken into account)"
import Modelica;
import Modelica.Units.SI;
import Modelica.Mechanics.MultiBody.Frames;
import Modelica.Mechanics.MultiBody.Types;
parameter Boolean animation=true
"= true, if animation shall be enabled (show rotor as cylinder)";
parameter SI.Inertia J(min=0) = 1
"Moment of inertia of rotor around its axis of rotation";
parameter Types.Axis n={1,0,0} "Axis of rotation resolved in frame_a";
parameter SI.Position r_center[3]=zeros(3)
"Position vector from origin of frame_a to center of cylinder"
annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
parameter SI.Distance cylinderLength=2*world.defaultJointLength
"Length of cylinder representing the rotor" annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
parameter SI.Distance cylinderDiameter=2*world.defaultJointWidth
"Diameter of cylinder representing the rotor" annotation (Dialog(
tab="Animation",
group="if animation = true",
enable=animation));
input Types.Color cylinderColor=Modelica.Mechanics.MultiBody.Types.Defaults.RodColor
"Color of cylinder representing the rotor" 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.default
"Priority to use rotor angle (phi) and rotor speed (w) as states"
annotation (Dialog(tab="Advanced"));
parameter Boolean exact=true
"= true, if exact calculations; false if influence of bearing on rotor acceleration is neglected to avoid an algebraic loop"
annotation (Evaluate=true, Dialog(tab="Advanced"));
SI.AngularVelocity w_a[3]
"Angular velocity of frame_a, resolved in frame_a";
SI.Angle phi(start=0, final stateSelect=stateSelect)
"Rotation angle of rotor with respect to frame_a (= flange_a.phi = flange_b.phi)"
annotation (Dialog(showStartAttribute=true));
SI.AngularVelocity w(start=0, stateSelect=stateSelect)
"Angular velocity of rotor with respect to frame_a"
annotation (Dialog(showStartAttribute=true));
SI.AngularAcceleration a(start=0)
"Angular acceleration of rotor with respect to frame_a"
annotation (Dialog(showStartAttribute=true));
Modelica.Mechanics.Rotational.Interfaces.Flange_a flange_a
"(left) driving flange (flange axis directed INTO cut plane)"
annotation (Placement(transformation(extent={{-110,-10},{-90,10}})));
Modelica.Mechanics.Rotational.Interfaces.Flange_b flange_b
"(right) driven flange (flange axis directed OUT OF cut plane)"
annotation (Placement(transformation(extent={{90,-10},{110,10}})));
Modelica.Mechanics.MultiBody.Interfaces.Frame_a frame_a
"Frame in which rotor housing is fixed" annotation (Placement(
transformation(
origin={0,-100},
extent={{-20,-20},{20,20}},
rotation=90)));
protected
outer Modelica.Mechanics.MultiBody.World world;
parameter Real e[3](each final unit="1")=
Modelica.Math.Vectors.normalizeWithAssert(n)
"Unit vector in direction of rotor axis, resolved in frame_a";
parameter SI.Inertia nJ[3]=J*e;
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape cylinder(
shapeType="cylinder",
color=cylinderColor,
specularCoefficient=specularCoefficient,
length=cylinderLength,
width=cylinderDiameter,
height=cylinderDiameter,
lengthDirection=n,
widthDirection={0,1,0},
extra=1,
r_shape=r_center - e*(cylinderLength/2),
r=frame_a.r_0,
R=Frames.absoluteRotation(frame_a.R, Frames.planarRotation(
e,
phi,
0))) if world.enableAnimation and animation;
equation
phi = flange_a.phi;
phi = flange_b.phi;
w = der(phi);
a = der(w);
w_a = Modelica.Mechanics.MultiBody.Frames.angularVelocity2(frame_a.R);
if exact then
J*a = flange_a.tau + flange_b.tau - nJ*der(w_a);
else
J*a = flange_a.tau + flange_b.tau;
end if;
/* Reaction torque:
t = n*(J*a - flange_a.tau - flange_b.tau) + cross(w_a, nJ*w)
Since
J*a = flange_a.tau + flange_b.tau - nJ*der(w_a);
the reaction torque can be simplified to
t = n*(- nJ*der(w_a)) + cross(w_a, nJ*w)
*/
frame_a.f = zeros(3);
frame_a.t = cross(w_a, nJ*w) - e*(nJ*der(w_a));
annotation (Documentation(info="<html>
<p>
This component is used to model the gyroscopic torques exerted by a 1-dim.
inertia (so called <em>rotor</em>) on its 3-dim. carrier body. Gyroscopic torques
appear, if the vector of the carrier body's angular velocity is not parallel
to the vector of the rotor's axis. The axis of rotation of the rotor is defined by
the parameter <code>n</code>, which has to be given in the local coordinate system
of <code>frame_a</code>. The default animation of this component is
shown in the figure below.</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/MultiBody/Parts/Rotor1D.png\" alt=\"model Parts.Rotor1D\">
</p>
<p>This component is a replacement for
<a href=\"modelica://Modelica.Mechanics.Rotational.Components.Inertia\">Modelica.Mechanics.Rotational.Components.Inertia</a>
for the case, that a 1-dim.-rotational mechanical system should be attached with a 3-dim.
carrier body.</p>
<p>The Boolean parameter <code>exact</code> was introduced due to performance
reasons. If <code>exact</code> is set to <strong>false</strong>, the influence of the carrier body
motion on the angular velocity of the rotor is neglected. This influence is usually
negligible if the 1-dim.-rotational mechanical system accelerates much faster as the base body (this is,
e.g., the case in vehicle powertrains). The essential advantage is
that an algebraic loop is removed since then there is only an
action on acceleration level from the powertrain to the base body
but not vice versa.</p>
<p><strong>Reference</strong><br>
<span style=\"font-variant:small-caps\">Schweiger</span>, Christian ;
<span style=\"font-variant:small-caps\">Otter</span>, Martin:
<a href=\"https://www.modelica.org/events/Conference2003/papers/h06_Schweiger_powertrains_v5.pdf\">Modelling
3D Mechanical Effects of 1-dim. Powertrains</a>. In: <em>Proceedings of the 3rd International
Modelica Conference</em>. Linköping : The Modelica Association and Linköping University,
November 3-4, 2003, pp. 149-158</p>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},{100,
100}}), graphics={
Rectangle(
extent={{-100,10},{100,-10}},
lineColor={64,64,64},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Line(points={{-80,-25},{-60,-25}}),
Line(points={{60,-25},{80,-25}}),
Line(points={{-70,-25},{-70,-70}}),
Line(points={{70,-25},{70,-70}}),
Line(points={{-80,25},{-60,25}}),
Line(points={{60,25},{80,25}}),
Line(points={{-70,45},{-70,25}}),
Line(points={{70,45},{70,25}}),
Line(points={{-70,-70},{70,-70}}),
Rectangle(
extent={{-50,50},{50,-50}},
lineColor={64,64,64},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={255,255,255},
radius=10),
Rectangle(
extent={{-50,50},{50,-50}},
lineColor={64,64,64},
radius=10),
Text(
extent={{-148,112},{152,72}},
textString="%name=%J",
textColor={0,0,255}),
Line(points={{0,-70},{0,-100}})}));
end RotorWith3DEffects;
protected
outer Modelica.Mechanics.MultiBody.World world;
parameter Real e[3](each final unit="1")=
Modelica.Math.Vectors.normalizeWithAssert(n)
"Unit vector in direction of rotor axis, resolved in frame_a";
Modelica.Mechanics.MultiBody.Visualizers.Advanced.Shape cylinder(
shapeType="cylinder",
color=cylinderColor,
specularCoefficient=specularCoefficient,
length=cylinderLength,
width=cylinderDiameter,
height=cylinderDiameter,
lengthDirection=n,
widthDirection={0,1,0},
extra=1,
r_shape=r_center - e*(cylinderLength/2),
r=zeros(3),
R=Modelica.Mechanics.MultiBody.Frames.planarRotation(
e,
phi,
0)) if world.enableAnimation and animation and not world.driveTrainMechanics3D;
Modelica.Mechanics.Rotational.Components.Inertia inertia(J=J, stateSelect=
StateSelect.never) if not world.driveTrainMechanics3D annotation (
Placement(transformation(extent={{-20,-20},{20,20}})));
RotorWith3DEffects rotorWith3DEffects(
animation=animation,
J=J,
n=n,
r_center=r_center,
cylinderLength=cylinderLength,
cylinderDiameter=cylinderDiameter,
cylinderColor=cylinderColor,
specularCoefficient=specularCoefficient,
exact=exact,
stateSelect=StateSelect.never) if world.driveTrainMechanics3D annotation (
Placement(transformation(extent={{-20,-80},{20,-40}})));
equation
phi = flange_a.phi;
w = der(phi);
a = der(w);
connect(inertia.flange_a, flange_a) annotation (Line(
points={{-20,0},{-100,0}}));
connect(inertia.flange_b, flange_b) annotation (Line(
points={{20,0},{100,0}}));
connect(rotorWith3DEffects.flange_b, flange_b) annotation (Line(
points={{20,-60},{60,-60},{60,0},{100,0}}));
connect(rotorWith3DEffects.flange_a, flange_a) annotation (Line(
points={{-20,-60},{-60,-60},{-60,0},{-100,0}}));
connect(rotorWith3DEffects.frame_a, frame_a) annotation (Line(
points={{0,-80},{0,-100}},
color={95,95,95},
thickness=0.5));
annotation (Documentation(info="<html>
<p>This component is used to model the gyroscopic torques exerted by a 1-dim.
inertia (so called <em>rotor</em>) on its 3-dim. carrier body. Gyroscopic torques
appear, if the vector of the carrier body's angular velocity is not parallel
to the vector of the rotor's axis. The axis of rotation of the rotor is defined by
the parameter <code>n</code>, which has to be given in the local coordinate system
of <code>frame_a</code>. The default animation of this component is
shown in the figure below.</p>
<p>
<img src=\"modelica://Modelica/Resources/Images/Mechanics/MultiBody/Parts/Rotor1D.png\" alt=\"model Parts.Rotor1D\">
</p>
<p>This component is a replacement for
<a href=\"modelica://Modelica.Mechanics.Rotational.Components.Inertia\">Modelica.Mechanics.Rotational.Components.Inertia</a>
for the case, that a 1-dim.-rotational mechanical system should be attached with a 3-dim.
carrier body.</p>
<p>The Boolean parameter <code>exact</code> was introduced due to performance
reasons. If <code>exact</code> is set to <strong>false</strong>, the influence of the carrier body
motion on the angular velocity of the rotor is neglected. This influence is usually
negligible if the 1-dim.-rotational mechanical system accelerates much faster as the base body (this is,
e.g., the case in vehicle powertrains). The essential advantage is
that an algebraic loop is removed since then there is only an
action on acceleration level from the powertrain to the base body
but not vice versa.</p>
<p><strong>Reference</strong><br>
<span style=\"font-variant:small-caps\">Schweiger</span>, Christian ;
<span style=\"font-variant:small-caps\">Otter</span>, Martin:
<a href=\"https://www.modelica.org/events/Conference2003/papers/h06_Schweiger_powertrains_v5.pdf\">Modelling
3D Mechanical Effects of 1-dim. Powertrains</a>. In: <em>Proceedings of the 3rd International
Modelica Conference</em>. Linköping : The Modelica Association and Linköping University,
November 3-4, 2003, pp. 149-158</p>
</html>"),
Icon(coordinateSystem(preserveAspectRatio=true, extent={{-100,-100},
{100,100}}), graphics={
Rectangle(
extent={{-100,10},{100,-10}},
lineColor={64,64,64},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={192,192,192}),
Line(points={{-80,-25},{-60,-25}}),
Line(points={{60,-25},{80,-25}}),
Line(points={{-70,-25},{-70,-70}}),
Line(points={{70,-25},{70,-70}}),
Line(points={{-80,25},{-60,25}}),
Line(points={{60,25},{80,25}}),
Line(points={{-70,45},{-70,25}}),
Line(points={{70,45},{70,25}}),
Line(points={{-70,-70},{70,-70}}),
Rectangle(
extent={{-50,50},{50,-50}},
lineColor={64,64,64},
fillPattern=FillPattern.HorizontalCylinder,
fillColor={255,255,255},
radius=10),
Rectangle(
extent={{-50,50},{50,-50}},
lineColor={64,64,64},
radius=10),
Text(
extent={{-150,125},{150,85}},
textColor={0,0,255},
textString="%name"),
Line(points={{0,-70},{0,-100}}),
Text(
extent={{-150,80},{150,50}},
textString="%J")}));
end Rotor1D;