Dynamics Part Two
Dynamics Part Two
DYNAMICS
232
y Fy Fx x M a mg
Figure 4.17: Planar pendulum The pendulum consists of a mass attached on a rod of length where a torque
CHAPTER 4. DYNAMICS
233
is applied. Considering the planar motion in the x-y plane, the equation of
motion can be derived using Newtons and Eulers equations
(4.120) (4.121)
degree of freedom. Choosing the angle as the system possesses the generalised coordinate, the constraint forces can be eliminated and the equation of motion reads as (4.122)
An other way to derive this equation is the application of Eulers equation with respect to the xed pivot point A
(4.123)
For the comparison of the numerical solution obtained by time integration with the analytical solution, we choose the trivial case of static equilibrium position as shown in Fig. 4.18.
g III
II a
Figure 4.18: Different positions of planar pendulum
CHAPTER 4. DYNAMICS
In a static equilibrium position , it is torque in the equilibrium state
234
For numerical solution, the integration code ode45 of M ATLAB is used choosing a tolerance of RelTol = AbsTol = 10e-5 for the relative and the absolute error, respectively. The specic parameters of the pendulum considered are , and (mathematical pendulum).
Case I: Equilibrium position Fig. 4.18 shows the pendulum in the considered position. Starting the integra tion with the initial conditions and and looking at the solution within a time period of 30 s it remains zero as it is expected. This means the solution is exact within the precision of the machine. An articial error is now introduced into the initial conditions and the result is shown in Fig. 4.19. and An exponential-like deviation can be seen indicating an unstable behaviour. It can be shown by applying stability theory that the chosen position is a mechanically monotone unstable equilibrium.
9 8 7 6
(t) [rad]
5 4 3 2 1 0 0
t [s]
Figure 4.19: Mechanically unstable motion of pendulum initiated by numerical errors, position I
CHAPTER 4. DYNAMICS
235
Case II : Equilibrium position As indicated in Fig. 4.18, the mass of the pendulum is below the bearing, which is a mechanically stable position (more precisely, it is marginally stable). The integration with the exact initial conditions again leads to a solution exact in the range of machine precision. An articial error as above causes the solution as plotted in Fig. 4.20 showing an oscillatory instability behaviour.
6 x 10
5
(t) [rad]
6 0
10
15
20
25
30
t [s]
Case III: Equilibrium position The hanging pendulum is mechanically marginally stable, of course. a) The integration with the exact and with the disturbed initial conditions leads to the same behaviour as we could see in case II. b) Changing the coordinate of description to leads to a sligthly changed equation of motion. Now the corresponding initial condition is . With this condition the computed solution shows the same oscillatory instability as in the case of the disturbed condition in a). Obviously the truncation error in the representation of the number is sufcient to cause this unacceptable behaviour.
In addition to the stability properties of the mechanical system, the stability proper-
CHAPTER 4. DYNAMICS
236
ties of the numerical procedure itself has to be taken into account when a numerical solution is computed. The details can not be provided here and reader ist referred to [8],[9]. Other illustrative examples can also be found in chapter 5. As it can be seen the stability behaviour depends on the conguration of the system. The sensitivity of the system on errors in the initial conditions (round off error due to numeric representation of ) is different. The numerical errors which cause the instability in case III do not cause unstable behaviour in case II. However, although the numerical representation of the initial conditions may inuence the quality of solution, the characteristics and parameters of the chosen integration procedure (stability of the algorithm, relative and absolute tolerances) are cruical for obtaining reliable results. The programs Integpendode.m and Odefuncpend.m for time integration reads:
% % ODE-INTEGRATION PROGRAM: PLANAR PENDULUM % --------------------------------------% %---------------------------------------------------------------------------% % load Date_pend % load the saved parameters and % % initial conditions % % % % set options for the integration subroutine % % RelTol - relativ tolerance of integration (default {1e-3}); % AbsTol - absolut tolerance of integration (default {1e-6}); % % options = odeset(RelTol,1e-5,AbsTol,[1e-5 1e-5]); % %----------------------------------------------------------------------------% % Integration with solver ode45: % ----------------------------% % ode45 - MATLAB ODE nonstiff solver, based on an % explicit Runge-Kutta (4,5) formula, % the Dormand-Prince pair % % Vector [t,x] is to create, whereas: % % t - time, [0 3] - time interval; % x - statevector [alpha, omega]; % odefuncpend - extern function, that provides right % hand side of ODE system
CHAPTER 4. DYNAMICS
237
% incondvect_ode - initial condition vector % options - see above % [t,x]=ode45(odefuncpend,[0 30], incondvect_ode,options); % %----------------------------------------------------------------------------
% % Function f of ODE system rhs % % % odefuncpend Name of function (responds to name in % integrpendode) % % t, x time, statevector (integration variables) % % % %------------------------------------------------------------------------------% function rhs = odefuncpend(t,x) % %------------------------------------------------------------------------------% % read parameters % --------------% % % load Date_pend % load the saved parameters % % % calculate the torque for equilibrium position % Mom = m*g*l*sin(alphades); % % rhs = [x(2); (Mom - m*g*l*sin(x(1)))/(m*l^2)]; % right hand side %---------------------------------------------------------------
Example 1.2: Planar pendulum, DAE representation In this example the integration in time domain is shown using a solver for differentialalgebraic systems DAE.
CHAPTER 4. DYNAMICS
238
The planar pendulum is considered as shown in Fig. 4.17 where the conguration coordinates are given by the coordinates
(4.125)
In contrary to the minimal form of equation of motion (4.114), the governing equations consist of the Newton-Euler-equations (4.109-4.111) plus the kinematical constraints (4.112, 4.113) as listed below
(4.126)
(4.127)
These equations form a system of coupled differential and algebraic equations ( DAE system) of index 3 because the geometrical constraints in Eq. (4.119) are formulated at position level. Although it can be integrated in this form, many numerical procedures demand a formulation of the DAE in index 1 - form. The rst differentiation of Eq.(4.119) provides constraints at velocity level
(4.128)
By combining Eq. (4.118) and Eq. (4.120), DAE of index 2 is established. Further differentiation of constraint equation results in
(4.129)
representing the geometrical constraints at acceleration level. To formulate DAE of index 1, dynamical equations (4.118) has to be combined with Eq. (4.121). Since this DAE system contains time derivatives of second order, it has to be reformulated to obtain the form
(4.130)
CHAPTER 4. DYNAMICS
239
With this aim in view, a state vector is dened containing the unknown positions and the constraint forces . To formulate a rst order differential equation, the velocities have to be also included in the state vector. However, to formulate the right hand side , where only coordinates of are allowed to appear, the accelerations is introduced in the state vector as well. Finally it reads as
(4.131)
(4.132)
CHAPTER 4. DYNAMICS
or
240
. . .
..
(4.133)
The internal structure of is depending on how the structure of is chosen by the user. The representation used above show particular features, some of them are important for the effective application of ODE15s and ODE23t.
The programs Intependdae.m and daefuncpend are listed. The corresponding data le is already given in example 4.1.
CHAPTER 4. DYNAMICS
241
% % DAE-INTEGRATION PROGRAM: PLANAR PENDULUM % ---------------------------------------% %--------------------------------------------------------------------------% % load Date_pend % load the saved parameters and % % initial conditions % % % set options for the integration subroutine % % RelTol - relativ tolerance of integration (default {1e-3}); % AbsTol - absolut tolerance of integration (default {1e-6}); % Mass - type of submission of mass matrix % ( "M" - const, "M(t)" - time-depend, % "Mfunc" - extern function); % MassSingular - whether mass matrix is singular (for DAE always!!) % % options = odeset(RelTol,1e-3,AbsTol,1e-6,Mass,M,MassSingular, yes); % %--------------------------------------------------------------------------% % Integration with solver ode15s: % ------------------------------% % ode15s - MATLAB ODE stiff variable-order solver, % based on the numerical differentiation % % Vector [t,y] is to create, whereas: % % t - time, [0 3] - time interval; % y - statevector; % daefuncpend - extern function, that provides right % hand side of DAE-system or mass matrix % incondvect_dae - initial condition vector for y % options - see above % [t,y]=ode15s(daefuncpend,[0 3], incondvect_dae, options); % %----------------------------------------------------------------------------
% % %
CHAPTER 4. DYNAMICS
242
% % daefuncpend - Name of function (responds to name in % integrpendode) % % t, y - time, statevector (integration variables) % flag - string indicating the type information % that should be returned % %------------------------------------------------------------------------------% function rhs = daefuncpend(t,y,flag) % %------------------------------------------------------------------------------% % read parameters % --------------% % % load Date_pend % load the saved parameters % % %------------------------------------------------------------------------------% % DAE solver demands: % ------------------% % event1: right hand side f of DAE is required % switch(flag) case % % calculate torque for equilibrium position % Mom = m*g*l*sin(alphades); % % calculate the right hand side f % rhs = [y(4); y(5); y(6); y(7); y(8); y(9); -m*y(7) + y(10); -m*y(8) - m*g + y(11); -I*y(9) + Mom + y(2)*y(10) - y(1)*y(11); y(7) + y(5)*y(6) + y(2)*y(9); y(8) - y(4)*y(6) - y(1)*y(9)]; % % % event2: mass matrix of DAE is required % % case mass % % calculate the mass matrix
CHAPTER 4. DYNAMICS
% rhs = diag([1,1,1,1,1,1,0,0,0,0,0]) % % end of switch % end % %----------------------------------------------------
243
The results of a time integration using ODE15s with the default tolerances are discussed. a) Equilibrium positions Similar to example 1.1, the three cases shown in Fig. 4.18 are considered. Using the exact initial conditions, in all three cases the numerical solutions show no difference to the analytical ones within the considered time interval of s. Using the disturbed initial condition with an error of in the positions, in all three cases the numerical solution converged to the exact one. Even in case I, representing the mechanical unstable position, the articial error was damped out by the integrator.
b) Oscillatory motion Considered is the case II with the statical equilibrium position and an initial condition . A time integration delivers the solution is shown in Fig. 4.21. It is a periodical motion but not a harmonical one because the problem is kinematically nonlinear (the lower reversal point is not at ). The full descriptor formulation contains also the constraint forces an which are plotted in Fig.4.22 with respect to time. A frequency double to that of the pendulum can be observed in the vertical component of constraint force. With these examples the utilisation of a DAE solver has been demonstrated. The particular properties of this procedure like damping out of numerical errors and delivering constraint force could be seen. Attention has to be drawn on the long term stability of computed solutions since drift effects may occur where energy is transfered between the motions in particular coordinates.
CHAPTER 4. DYNAMICS
244
[rad]
0.5
1.5
2.5
3.5
t [s]
7 6 5 4 3 2 1 0 1 2 0 F (t) x F (t)
y
F [N] , F [N]
0.5
1.5
2.5
3.5
t [s]
CHAPTER 4. DYNAMICS
245
Remark: In practice, sometimes small vibrations with respect to a reference motion have to be investigated. In that case the equations of motion are linear with respect to the unknown variables. To obtain these equations a particular procedure must be followed or the nonlinear equation of motion have to be linearised. For that in the equation of motion (4.114) of the pendulum the coordinate
is introduced. With the assumption of small vibration , it is and , follows. By use of these relations all nonlinear functions of are represented in a power series expansion. Neglecting all terms of quadratic and higher order, then
hold. Introducing these relations into Eq. (4.114) it follows
In particular cases the reference motion may be a constant = const, as it was in the example above.)
CHAPTER 4. DYNAMICS
246
y g
M 1(t)
a1 y+ a 2
CHAPTER 4. DYNAMICS
y l2 y2 (m 2, I 2) M2 x2 * 1 M1 x Fx A Fy A x + x 1y 1 1x 2y 2 2
T
247
y * 2 Fy B Fx B Fx B FG FG
2
M2 g B
M2 Fy B
y1 (m 1, I 1) l1 x1 M1
A y
(4.138) (4.139)
CHAPTER 4. DYNAMICS
248
(4.148)
(4.149)
constraint forces can be expressed using "geometrical approach" via constraint matrix and Lagrange multipliers :
obviously:
(4.150)
. (4.151)
CHAPTER 4. DYNAMICS
kinematical constraints in matrix form:
249
dynamical equations of the free body diagram in the matrix form expressed via transposed constraint matrix and Langrange multipliers kinematical constraints in the matrix form
(4.156)
Minimal form
Governing equations in the minimal form (equations of motion of the system) have been derived via transformation from the full descriptor form. the chosen generalised coordinates (2 DOF): absolute orientation angle of the rst body, angle of the relative orientation of the second body with respect to the rst one Jacobian matrix that species relation between two sets of coordinates has been established using NEWEUL multibody package
CHAPTER 4. DYNAMICS
250
Example 2.1: Inverse dynamics of 2 DOF robot Inverse dynamics of the robot that follows a specied trajectory
Determination of the applied forces (torques of the actuators of the force type) that have to be imposed to the robot to follow specied trajectory as well as the constraint forces due to the joints. Kinematical data which is the basis of inverse dynamic analysis has been calculated on the basis of the specied trajectory of the robots end-effector and the kinematical structure of robots mechanism (length of linkages). Inertia parameters and lengths of linkages are specied as follows: kg, , kg, , m, m.
Inverse dynamics problem of the robots motion is solved using mathematical model in full descriptor form, formulated above. Trajectory of the end effector is prescribed by the equation , .
The time history of the generalized coordinates and , calculated on the basis of the specied trajectory of robots end-effector are shown in Fig. 4.25. The driving torques and constraint forces in two cases (with and without gravity) are shown in the Fig. 4.26 - Fig. 4.31. It can be observed that the forces due to the statical origin are dominant.
CHAPTER 4. DYNAMICS
251
1.5
1(t) (t)
2
1 [rad]; 2 [rad]
0.5
0.5
1 0
0.5
1.5
2.5
t [s]
Figure 4.25: Time history of the generalised coordinates end-effector follow prescribed trajectory
CHAPTER 4. DYNAMICS
Case I: gravity is included
1.5 M1(t) M2(t) 1
252
M1 [Nm]; M2 [Nm]
0.5
0.5
1 0
0.5
1.5
2.5
t [s]
Figure 4.26: Robot driving torques needed to follow a specied end-effector trajectory. Calculated on the basis of robots prescribed motion
CHAPTER 4. DYNAMICS
0.1 Fbx (t) F (t)
fx
253
0.05
[N], F [N] F
bx
fx
0.05
0.1
0.15
0.2 0
0.5
1.5
2.5
t [s]
Figure 4.27: Constraint force in -direction: joint A (basis joint) and joint B (ying) joint
10 Fby (t) F (t)
fy
4 0
0.5
1.5
2.5
t [s]
Figure 4.28: Constraint force in -direction: joint A (basis joint) and joint B (ying joint)
CHAPTER 4. DYNAMICS
Case II: gravity is not included
0.05 0.04 0.03 0.02 0.01 0 0.01 0.02 0.03 0.04 0 M1 (t) M2 (t) 0.5 1 1.5 2 2.5 3
254
M , M [Nm]
t [s]
Figure 4.29: Robot driving torques needed to follow a specied end-effector trajectory. Calculated on the basis of robots prescribed motion
In this example forward dynamics of 2 DOF robot, based on the marhematical model in minimal form (two dimensional ODE system) is performed. The explicit Runge-Kutta method (within M ATLAB code: ode45 integration algorithm) has been used. The tolerances have been set as follows: RelTol=1e-3, AbsTol=1e-6 (default values). The simulation results are shown in Fig. 4.32. In Fig. 4.33, the difference between simulation results and reference values is depicted. It is visible that absolute error within the whole integration domain does not exceed the magnitude of 4e-6. Further analysis has shown that time integration with imposed more strict tolerances provides more accurate integration results. The proof-check if integration results converge when more strict tolerances are imposed on integration routine, is in the most case-studies a necessary step in obtaining reliable simulation results.
CHAPTER 4. DYNAMICS
0.1 Fbx (t) Ffx (t)
255
0.05
[N], F [N] F
bx
fx
0.05
0.1
0.15
0.2 0
0.5
1.5
2.5
t [s]
Figure 4.30: Constraint force in -direction: joint A (basis joint) and joint B (ying joint)
0.04 0.03 0.02
[N], F [N] F
by
fy
0.5
1.5
2.5
t [s]
Figure 4.31: Constraint force in -direction: joint A (basis joint) and joint B (ying joint)
CHAPTER 4. DYNAMICS
1.5 (t) 1 (t)
2
256
1 [rad], 2 [rad],
0.5
0.5
1 0
0.5
1.5
2.5
t [s]
Here, the same robot is considered as in the Example 2.2, with the only difference that gravity forces act on the robot links. Integration routine ode45 is used again. In contrary to the results obtained in the case (Fig. 4.32, Fig. 4.33), an integration with default tolerances leads to a very strongly divergent solution. Even when more strict tolerances (i. e. 1e-8) are imposed to the integratin routine the errors are reduced but the solution is still divergent, Fig. 4.34. A further restriction of tolerances to 1e-10 leads to further reduction of errors, but the divergent characteristics are still the same, as it can be seen in Fig. 4.35. The reason for such a behaviour lies in the fact that analysed system is mechanically unstable (the proof is left to the reader) and numerical errors that are unvoidable during integration routine (discretisation errors due to the characteristics of the chosen routine and round-off errors) initiate an unstable behaviour of the system (see also Example 1.1 and Example 1.2). The consequences of the errors in the joint angles on the position of end-effector is illustrated in Fig. 4.36 (tolerances of magnitude 1e-8 have been used) and Fig. 4.37 (tolerances of magnitude 1e-10).
CHAPTER 4. DYNAMICS
3 x 10
6
257
4 0
t [s]
Figure 4.33: Difference between simulated results (RelTol=1e-3, AbsTol=1e-6) and reference data: generalised coordinates ,
Example 2.4: Control via PD-feedback From the previous examples it became clear, that mechanically unstable or marginally stable systems are difcult to simulate by numerical integration. In reality such feedforward calculation of the desired driving torques by inverse dynamics and applying to the robot also does not result in a satisfactory motion, i.e. it is not possible to drive the robot along a prescribed path, since disturbances act on the robot. Therefore a feedback control is necessary, see Fig. 4.38. From control theory a broad variety of control laws are known and may be applied. The choice of a specic or an optimal control law is not considered here. In the following example it is assumed that the positions and as well as the corresponding velocities can be measured, e.g. by resolvers and tachogenerators, respectively. Therefore, a complete state variable feedback can be performed. In the case of rigid robot arms and ideal joints, this allows the full reduction of deviations of the end effector position
(4.157)
CHAPTER 4. DYNAMICS
0.1
258
0.05
0.05
0.1
0.15
1 (t) (t)
2
0.2 0
0.5
1.5
2.5
t [s]
Figure 4.34: Difference between simulated results (RelTol=AbsTol=1e-8) and reference data: generalised coordinates ,
(4.158)
where the gains of state variable feedback control have to full the stability condition that the poles must be in the left half-plane. With a desired modal damping of the gains are
(4.159)
Here has been chosen arbitrarily as leading to a stable system. For closer details of design of controllers see [14]. The standard routine ode45 with the default tolerances ( RelTol = 10e-3, AbsTol = 10e-6 ) is used to calculate the trajectory of the robot, and the deviations of the angles , , and from their desired values were observed. The integration delivered satisfactory results, the errors are bounded and smaller than the chosen tolerance of the numerical integration process. To show the stability of the entire system, the initial condition is now disturbed by a e rad. First, the case is shown. It turns out that the initially given deviation can not be compensated by the PD-controller. Its feedback gain are too weak to cancel the destabilising forces, as illustrated in Fig. 4.39.
CHAPTER 4. DYNAMICS
3 2 x 10
3
259
Tol: 10 8
1 0
10
t [s]
Figure 4.35: Comparison between simulation results obtained using integration routines with different tolerances, RelTol=AbsTol=1e-8, RelTol=AbsTol=1e-10. Difference between simulated results , and reference data are depicted In the cases and , the simulations clearly show a decay of the initially given deviations. The remaining error is bounded within the precision of the integration routine. Depending on the parameters of the feedback control, the decay behaviour is different as it is shown in Fig. 4.40, Fig. 4.41 and Fig. 4.42. The position error (position of end-effector is expressed in worldcoordinates) is within acceptable range. On the basis of these numerical experiments, it could be seen that the feedback controller law stabilises the solution. This happens due to the fact that additional terms appear in the "stiffness matrix", leading to an asymptotic stable system. From the mechanical point of view, such terms can be caused by - a ctive mounting of springs and dampers between the real links of the robot and guiding device (not existing in reality) or - installation of a controller system (consisting of sensors, control law, ampliers and actuators) to get a stable behaviour of the robot. It has to be mentioned that for very high feedback gains the system becomes stiff and beyond a certain limit instability may occur. Concerning the numerical integration of differential equations, this controller system can be considered as a kind of stabilisation procedure as mentioned in chap-
CHAPTER 4. DYNAMICS
0.025 xe(t) ye(t)
260
0.02
x [m], y [m]
0.015
0.5
1.5
2.5
t [s]
Figure 4.36: Difference betweeen simulated results and referent values: endeffector position coordinates
x 10
4
2.5
xe(t) y (t)
e
xe [m], ye [m]
1.5
0.5
0.5 0
0.5
1.5
2.5
t [s]
Figure 4.37: Difference betweeen simulated results and referent values: endeffector position coordinates
CHAPTER 4. DYNAMICS
yd y d ,y d Controler Mc
. ..
261
Md
Feedforward
Robot
2.5
x 10
(t) 1 (t)
2
1 [rad], 2 [rad]
1.5
0.5
0 0
0.5
1.5
2.5
t [s]
ter 4.3.3. (This type of stabilisation was proposed e.g. by Baumgarte.) Note: Real technical systems have elastic links and joints and their deformation may inuence the position of the end effector considerably. If this position can not be measured directly, an observer based on the equations of motion has to be applied to estimate the elastic deformation and include it in the control.
CHAPTER 4. DYNAMICS
x 10
5
262
1.2
(t) 1 (t)
2
1 [rad], 2 [rad]
0.8
0.6
0.4
0.2
0 0
0.5
1.5
2.5
t [s]
, deviations of angles ,
7 6 5
x 10
xe (t) ye (t)
xe [m], ye [m]
4 3 2 1 0
t [s]
, deviations
and of
CHAPTER 4. DYNAMICS
263
7 6 5
x 10
xe (t) ye (t)
xe [m], ye [m]
4 3 2 1 0
t [s]
, deviations
and
of
CHAPTER 4. DYNAMICS
264
y a2 g a1
M 2(t)
y + a 1ory + a 2
M geny + q v y, y, t ) q a gen
..
Minimal form: y 91
Integration of ODE
Figure 4.43: Modelling of 1 DOF robot
MBS with 1 DOF Chosen generalised coordinate: absolute orientation angle of the rst body or angle of the relative orientation of the second body with respect to the rst one
CHAPTER 4. DYNAMICS
265
System constraint forces: constraint forces at the joints, constraint force at the mechanically constrained end-effector
I NVERSE DYNAMICS Since robot (see Fig. 4.43) possesses 1 DOF, its motion can be controlled by just one force-actuator. There is a choice between two cases: a) Case I - torque acts at joint A ( ), b) Case II - torque acts at joint B ( ). However, actual magnitude of constraint force that acts on end-effector (as well as other applied and constraint forces) depenf on that choice. In the Case I the constraint force that acts on the end-effector is shown in Fig. 4.44. On the contrary, if the actuation is provided via actuator (Case II), the time-history of the end-effector constraint force is different as it is depicted in Fig. 4.45. In copmpariison to the Case I, the constraint force is of much higher magnitude and with changing orientation. By comparing Fig. 4.44 and Fig. 4.45, it is visible that the actuation via is preferable, if the criteria of having small magnitude of constraint force acting on end-effector force is of importance.
2.49
2.48
2.47
[N] F
2.46
0.5
1.5
2.5
t [s]
Figure 4.44: Constraint force that acts on the end effector, Case I
CHAPTER 4. DYNAMICS
266
Fend [N]
10
15 0
0.5
1.5
2.5
t [s]
Figure 4.45: Constraint force that acts on the end effector, Case II
CHAPTER 4. DYNAMICS
267
F ORWARD DYNAMICS In Fig. 4.46 the result of time integration (difference between integrated results of end-effector coordinate and reference values, based on the mathematical model in minimal form (1 ODE), are shown for Case I. Integration routine ode45 with imposed tolerances RelTol=1e-8 and AbsTol=1e-8 has been applied. By dealing with Case II, the errors are considerably greater (Fig. 4.47). The errors of such magnitude exceed the precision demanded in robotics. Because of the inherent mechanical instability of the analysed system (see Example 1.1 and Example 2.4), the integration results deviate of the accurate values. This deviation is strongly dependent on the error tolerances that have been imposed on the integration routine.
4.5 4 3.5 3 x 10
5
xe (t) [m]
0.5 0
0.5
1.5
2.5
t [s]
Figure 4.46: Difference betweeen simulated results and referent values, Case I
CHAPTER 4. DYNAMICS
268
2.5
x 10
1.5
xe (t) [m]
0.5
0.5 0
0.5
1.5
2.5
t [s]
Figure 4.47: Difference betweeen simulated results and referent values, Case II
CHAPTER 4. DYNAMICS
269
20 15 10 5
Mm [Nm]
0 5
10 15 20 0 m = 0.8 kg p m = 4.0 kg
p
0.5
1.5
2.5
t [s]
Figure 4.48: Driving torque of slider-crank mechanism: two cases with different masses of the piston
Example 3.2: Forward dynamics of slider-crank mechanism Forward dynamics of slider-crank mechanism has been performed by:
CHAPTER 4. DYNAMICS
200 150 100
270
50 0 50
0.2
0.4
0.6
0.8
t [s]
10 20 30 0
0.2
0.4
0.6
0.8
t [s]
Figure 4.50: Components of constraint force in piston-rod bearing and piston guidance
CHAPTER 4. DYNAMICS
271
using 1 generalised coordinate: crank angle deriving equation of motion via transformation from the full descriptor form
Systems free-run has been studied (no driving torque is applied). In Fig. 4.51 time history of the angular velocity of crank shaft is presented for two cases: a) mass of the piston, kg b) mass of the piston kg. A comparison of the piston displacement travel with an ideal cos time-function is presented in Fig. 4.52. It becomes obvious that the piston does not follow an hatmonic function due to the nonlinearity in crank-slider mechanism
[rad/s]
6.1
6.05 6
2.5
t [s]
Figure 4.51: Angular velocity of crank: casses with different masses of the piston MATLAB program for forward dynamics of slider-crank mechanism in minimal form / main program reads as
% Integration of the equations of motion of the slider % crank model in minimal form % integration interval t0=0; tf=1; % inital conditions, x(1)=positions, x(2)=velocities x0=[0, 0] % call of ode45 integrator [t,x]=ode45(Eqslide,t0,tf,x0) % description of the system: Eqslide.m % End
CHAPTER 4. DYNAMICS
272
0.8
yp ycos
0.6
yp [m]
0.4 0.2 0
0.5
1.5
2.5
t [s]
Figure 4.52: Piston displacement travel: comparison with the cos time-function
CHAPTER 4. DYNAMICS
Example 8: Cable way
273
Typical questions concerning the dynamics of a mechanical system are discussed on a cabin of a cable way. The cabin of a cable way as shown in Fig. 4.53 is considered with its carriage and suspension. The roller of the carriage by a spring (stiffness constant ). A bearing (mass , centre of mass ) is visco-elastically hinged (stiffness constant , damping constant ) in the trolley. It carries the cabin itself (mass , centre of mass , moment of inertia ). Forward dynamics is carried out to get an insight into the dynamical behaviour using time integration. Since large oscillations are expected the nonlinear equations of motion were used for the integration in time domain. In this example the excitation is assumed as a step-like switch on of the winding drum at : for , . for
S 1, m 1 s w0 k R h cS r a x d S 2, m 2 db cF b u g
S 3, m 3, I 3
CHAPTER 4. DYNAMICS
generalised coordinates is
274
By writing Newtons equations for trolley, bearing and cabin and adding Eulers equation for cabin the Newton-Euler equation reads as
CHAPTER 4. DYNAMICS
the equation of motion is received as
sym.
275
. This premultiplication reduces the dimensions of the matrices and vectors to the dimension , it garantees a symmetrical mass matrix and eliminates the generalised constraint forces . This is due the orthogonality of the matrices and . PARAMETERS OF C ABLEWAY All physical constants are kept in the seperate m-le values.m. Note that denoted as w0 in all m-les.
% values.m % Physical constants for cabin-problem: % Make constants accessible in all modules global m1 m2 m3 g alpha w0 R r cf cs d Dbeta I3 l y0 m1 m2 m3 I3 g alpha w0 R cf cs d Dbeta l r = = = = = = = = = = = = = = 50; % Mass of trolley 10; % Mass of cabin bearing 300; % Mass of cabin % possibly + 200 kg for persons m3*1; % Cabins moment of inertia 9.81; % Gravity rad(35); % Inclination towards horizontal rad(180); % Rotary speed of drive roll 1; % Radius of drive roll 8e4; % Spring stiffness for cabin bearing 5e4; % Spring stiffness for towing rope 1e3; % Damper constant for bearing 800; % Rotational damper constant 2; % Distance from bearing to % cabins centre of gravity 0.6; % Distance rope - damper [kg] [kg] [kg] [kg*m^2] [m/(s^2)] [rad] [rad/s] [m] [N/m] [N/m] [N*s/m] [N*m*s] [m] [m]
is
CHAPTER 4. DYNAMICS
% Define constants for field-names to increase readability global fn_s fn_ds fn_u fn_du fn_beta fn_dbeta fn_s = 1; fn_ds = 2; fn_u = 3; fn_du = 4; fn_beta = 5; fn_dbeta = 6;
276
The incluence of parameter variation on the dynamical behaviour is shown on the time history of characteristic coordinates, a linearisation of the equations of motion and an eigenvalue analysis is not performed. The two short auxiliary functions deg and rad are used to convert radian to degree and vice versa. Each function is dened in a separate m-le.
% deg.m % Convert rad into degree function angle_deg=deg(angle_rad) angle_deg=angle_rad.*180./pi; % rad.m % Convert degree into rad function angle_rad=rad(angle_deg) angle_rad=angle_deg.*pi./180;
The right hand side of the ODE system is generated in the Fcabin.m:
% Fcabin.m % ODE-File for cabin-problem % Defines the ODE-system % % % % % % % % % y(1)=s y(2)=ds=dy(1) dds=dy(2) y(3)=u y(4)=du=dy(3) ddu=dy(4) y(5)=beta y(6)=dbeta=dy(5) ddbeta=dy(6)
function dy = Fcabin(t,y,command) % get access to physical constants and field-names global m1 m2 m3 g alpha w0 R cf cs d Dbeta I3 l
CHAPTER 4. DYNAMICS
global fn_s fn_ds fn_u fn_du fn_beta fn_dbeta M=[(m1+m2+m3), 0, -m3*l*cos(alpha+y(fn_beta)); 0, (m2+m3), -m3*l*sin(alpha+y(fn_beta)); -m3*l*cos(alpha+y(fn_beta)), -m3*l*sin(alpha+y(fn_beta)),... m3*l^2+I3]; a=[-m3*l*sin(alpha+y(fn_beta))*y(fn_dbeta)^2; m3*l*cos(alpha+y(fn_beta))*y(fn_dbeta)^2; 0]; b=[-(m1+m2+m3)*g*sin(alpha)-cs*(y(1)-R*w0*t); (m2+m3)*g*cos(alpha)-cf*y(fn_u)-d*y(fn_du); -l*m3*g*(sin(y(fn_beta))-Dbeta*y(fn_dbeta)]; % multiply with inverse of matrix M h=inv(M)*(a+b); % write new values into dy dy(fn_s) = y(fn_ds); dy(fn_ds) = h(1); dy(fn_u) = y(fn_du); dy(fn_du) = h(2); dy(fn_beta) = y(fn_dbeta); dy(fn_dbeta)= h(3); % Return a column-vector dy=dy;
277
T IME INTEGRATION OF ODE For a rst overview ode45 is used. This is carried out by calling the m-le cabin.m:
% cabin.m % Initialisation: clear; values;
% read constants
% Define time interval of integration, % use steps of 0.01 seconds for output. time_range = 0:0.01:8; % Define options used for integration % relative error tolerance (default) options = odeset(reltol,1e-3); % absolute error tolerance (default) options = odeset(options,abstol,1e-6); % Calculate the initial static equilibrium
CHAPTER 4. DYNAMICS
y0(fn_s)=-(m1+m2+m3)*g*sin(alpha)/cs; y0(fn_u)=m3*g*cos(alpha+y0(fn_beta))/cf; % Solve the system [T,Y]=ode45(Fcabin,time_range,y0,options); % Calculate desired path of trolley s_des = w0.*R.*T-(m1+m2+m3)*g*sin(alpha)/cs; % Store data for plot in another matrix solution(:,1)=Y(:,fn_s)-s_des; solution(:,2)=Y(:,fn_u); solution(:,3)=deg(Y(:,fn_beta)); % give beta in degree % Prepare graphic window figure(1) clf % Plot all solutions in a single window subplot(3,1,1) plot(T,solution(:,1)); title(Excursions versus time using default error tolerance) % Define plot layout axis tight grid on xlabel(Time t [s]) ylabel(s(t) - s_d (t) subplot(3,1,2) plot(T,solution(:,2)); % Define plot layout axis tight grid on xlabel(Time t [s]) ylabel(u(t) [m]) subplot(3,1,3) plot(T,solution(:,3)); % Define plot layout axis tight grid on xlabel(Time t [s]) ylabel(\beta(t) [\circ])
278
This program calculates a solution by using default tolerances for the integrator and shows the results in a single window. The rst graph shows the difference
CHAPTER 4. DYNAMICS
Excursions versus time using default error tolerance 0.1 0.05 s(t) sd (t) [m] 0
279
0.1 0.08 u(t) [m] 0.06 0.04 0.02 0 0.02 0 1 2 3 4 Time t [s] 5 6 7 8
between the actual location of the cable ways carriage . The desired location can be expressed as
(4.160) The second graph shows the excursion of the suspension relative to the carriage. The third graph depicts the swing motion of the cabin relative to its
suspension. As can be seen, the solution is already stable when using default error tolerance. To check the reliability of the solution, stricter error tolerances of 10e-6 for relative and 10e-8 for absolute error have been chosen. For doing this, only very few lines have to be modied in cabin.m:
% cabin_H.m
CHAPTER 4. DYNAMICS
...
% Define options used for integration % relative error tolerance options = odeset(reltol,1e-6); % absolute error tolerance options = odeset(options,abstol,1e-8);
280
... The result obtained from the modied m-le looks very similar to the previous one. To show the actual difference between the two solutions, the m-le cabin_lh.m can be used:
% cabin_lh.m % Initialisation: clear; values;
% read constants
% Define time interval of integration, % use steps of 0.01 seconds for output. time_range = 0:0.01:8; % Define options used for integration % relative error tolerance (default) options = odeset(reltol,1e-3); % absolute error tolerance (default) options = odeset(options,abstol,1e-6); % Calculate the initial static equilibrium y0(fn_s)=-(m1+m2+m3)*g*sin(alpha)/cs; y0(fn_u)=m3*g*cos(alpha+y0(fn_beta))/cf; % Solve the system [T,Y]=ode45(Fcabin,time_range,y0,options); % Switch to high accurancy % relative error tolerance options = odeset(reltol,1e-6); % absolute error tolerance options = odeset(options,abstol,1e-8); % Solve the system using new error tolerances [T,Y_H]=ode45(Fcabin,time_range,y0,options); % Calculate difference between the two solutions solution(:,1)=Y(:,fn_s)-Y_H(:,fn_s); solution(:,2)=Y(:,fn_u)-Y_H(:,fn_u); % Convert beta to degree solution(:,3)=deg(Y(:,fn_beta))-deg(Y_H(:,fn_beta));
CHAPTER 4. DYNAMICS
...
% Print maximum differences as numbers max(solution)
x 10 1 0.5 0
4
281
0.5 1 0
5
4 Time t [s]
x 10 8 6 4 u(t) [m] 2 0 2 4 6 8 0
1
3
4 Time t [s]
x 10 2 1 0 (t) [] 1 2 3 4 5 0
4 Time t [s]
Figure 4.55: Comparison of solution with default and high accuracy Note: Here it is mandatory to use a xed width of the time steps. Otherwise the output matrices of the different solvers could have different dimensions and therefore can not be subtracted from each other. The program prints out the maximal differences of the two solutions. These are less than 2e-4 meters for and , and less than 3e-3 for . Now the integrator ode45 is compared to ode15s. Therefore the m-le has to be changed slightly:
CHAPTER 4. DYNAMICS
% cabin_45_15s.m
282
...
% Solve the system using ode45 [T,Y]=ode45(Fcabin,time_range,y0,options); % Solve the system using ode15s [T,Y_H]=ode15s(Fcabin,time_range,y0,options); % Calculate difference between the two solutions solution(:,1)=Y(:,fn_s)-Y_H(:,fn_s); solution(:,2)=Y(:,fn_u)-Y_H(:,fn_u); % Convert beta to degree solution(:,3)=deg(Y(:,fn_beta))-deg(Y_H(:,fn_beta));
... Again, the comparison shows that the absolute difference is acceptable from the engineering point of view. Therefore, ode45 with default error tolerance is used for further calulations. PARAMETER VARIATION Now it is investigated how variations of several parameters inuence the behaviour of the cable way. To present the data in graphs, the function plotcabin is used. This function controls different line types, 2D and 3D-plots, automatic labeling and some other things. Control arguments are Y for the solution including the time vectors, and Param for the varied parameter. The other arguments are for describing the plots and are explained in the le.
% plotcabin.m % Plot three graphs containing 3d-lines function plotcabin(Y,Param,ParamUnit,ParamName,TitleSuff, AZ,EL) % input arguments: % Y 3-dim. matrix containing solutions of several % diff. equations: % Each 2D-matrix contains solutions in column% vectors, each column contains values for a single % parameter value. % y{i}(:,1) Deviation from desired position for i-th % parameter value % y{i}(:,2) Excursion of bearing for i-th parameter value % y{i}(:,3) Angle beta (in DEGREE!) for i-th parameter value % Y{i}(:,4) Time vector for i-th parameter value % % Param Matrix containing values of varied parameter % ParamUnit Name of measure unit for Parameter % ParamName Name of varied parameter
CHAPTER 4. DYNAMICS
x 10 10
4
283
Differences between ode45 and ode15s
0
4
4 Time t [s]
x 10 8 6 4 u(t) [m] 2 0 2 4 6 0
4 Time t [s]
(t) []
4 Time t [s]
% % TitleSuff % % AZ % EL
Suffix for title Azimuth angle for viewing, default: 40 degree Elevation angle for viewing, default: 50 degree values if necessary if nargin < 7, EL=50; end; AZ=40; end; TitleSuff = ; end; ParamName =Parameter; end; ParamUnit =; end;
%Apply default if nargin < 6, if nargin < 5, if nargin < 4, if nargin < 3,
CHAPTER 4. DYNAMICS
if (length(Param) < 5) UseDiffStyles = 1; else UseDiffStyles = 0; end; % less than 5 lines ?
284
% Prepare graphic window figure(1) clf % Plot all results in a single window subplot(3,1,1) title([Excursions versus time TitleSuff]) DoPlot(Y,1,Param,s(t) - s_d (t) [m],ParamName,ParamUnit,... AZ,EL,UseDiffStyles) subplot(3,1,2) DoPlot(Y, 2,Param, u(t) [m], ParamName,ParamUnit, AZ,EL,... UseDiffStyles) subplot(3,1,3) DoPlot(Y,3,Param,\beta(t)[\circ],ParamName,ParamUnit,... AZ,EL,UseDiffStyles) if UseDiffStyles == 1 % Show legend if needed subplot(3,1,1); for n = 1:length(Param) legendtext{n}= sprintf(%s = %.2e %s,ParamName,Param(n),... ParamUnit); end; legend(legendtext,1); % Place legend in upper right-hand corner end; function DoPlot(Y,Sel,Param,V_Name,ParamName,ParamUnit,... AZ,EL,UseDiffStyles) % Sub-function used for drawing actual plot % Y Solution array % Sel Selector for data to plot % Param Values of parameter % V_Name Name of plotted value % ParamName Name of parameter % ParamUnit Name of measure-unit % AZ, EZ Azimuth and elevation angles % UseDiffStyle Set to 1 to use different line-styles % Define array containing different line-styles: % [Parameter for plot3d-function, line-width] linestyles = {r-,g-,b:,m:}; linewidths = { 0.5, 1, 0.7, 1, 1}; % Rotate coordinate system view(AZ,EL)
CHAPTER 4. DYNAMICS
285
% Keep existing graphics hold on % Plot one curve for each parameter value for n = 1:length(Param) if UseDiffStyles == 1 linestyle = linestyles{n}; % use different line-styles linewidth = linewidths{n}; else linestyle = b-; % use same line-style if more than 4 lines linewidth = 0.5; end; % Plot line in space % Y{n}(:,4) contains always the time vector L=plot3(Y{n}(:,4),ones(1,length(Y{n}(:,4))).*Param(n),... Y{n}(:,Sel),linestyle); set(L,LineWidth,linewidth); Style=get(L); if AZ ~= 0 % If azimuth angle is different from zero, draw pointer at the % end of integration interval % Find global minimum of plot for i = 1:length(Y) mins(i) = min(Y{i}(:,Sel)); end; last=length(Y{n}(:,4)); L=line([Y{n}(last,4), Y{n}(last,4)], [Param(n), Param(n)],... [Y{n}(last,Sel) , min(mins)]); set(L,Color,Style.Color); set(L,LineStyle,--); set(L,LineWidth,Style.LineWidth); end end hold off % Define plot layout axis tight % Scale axes grid on % Switch grid on xlabel(Time t [s]) % Label axes if isempty(ParamUnit) ylabel(ParamName); else % Concatenate strings to form description ylabel(strcat(ParamName, [, ParamUnit, ]));
CHAPTER 4. DYNAMICS
end; zlabel(V_Name)
286
With this powerful function the main programs become much shorter. To get smooth plots, the step size of the output is automatically controlled by the ODEsolver. Then the time vectors differ between different solutions. In order to store the results in a single variable despite of this, a cell-array is used, and the time vector is stored together with each solution. Then the variable containing the results is then passed to the function plotcabin. Mass of cabin Obviously, in practice may change widely. This refers to the load of the cabin. The output showing the inuence of the mass of the cabin is generated by the m-le cabin_m3.m:
% cabin_m3.m % Vary mass of cabin m3: % Initialisation: clear; values;
% Read constants
% Define time interval of integration time_range = [0, 6]; % Define range and step for m3 range = 300:150:600; for n = 1:length(range) % Set parameter for current loop m3 = range(n); % Calculate initial spring excursions y0(fn_s)=-(m1+m2+m3)*g*sin(alpha)/cs; y0(fn_u)=m3*g*cos(alpha+y0(fn_beta))/cf; % Clear previous dimensions of T and Y clear T Y % Solve the system [T,Y(:,:)]=ode45(Fcabin,time_range,y0); % Calculate desired position for trolley s_des = w0.*R.*T-(m1+m2+m3)*g*sin(alpha)/cs; % Store data that should be plotted in a cell-array solution{n}(:,1)=Y(:,fn_s)-s_des;
CHAPTER 4. DYNAMICS
solution{n}(:,2)=Y(:,fn_u); solution{n}(:,3)=deg(Y(:,fn_beta)); % give beta in degree solution{n}(:,4)=T; % Store time-points for each solution end % Draw plots, set azimuth and elevation angle to zero % to draw 2d-plot plotcabin(solution,range,kg,m3,, variation of m3,0,0);
287
Excursions versus time, variation of m3 0.1 s(t) sd (t) [m] 0.05 0 m3 = 3.00e+02 kg m3 = 4.50e+02 kg m3 = 6.00e+02 kg
0.05 0.1
0.15
u(t) [m]
0.1
0.05
0 0 1 2 3 Time t [s] 4 5 6
Figure 4.57: Variation of mass of cabin An increasing mass leads to increased amplitudes and larger periods in trolley oscillation. Suspension excursions are signicatly larger bringing the damp. The swing motion of the cabin shows increased amplitudes whereas the time period
CHAPTER 4. DYNAMICS
is not affected. Stiffness of towing rope
% cabin_cs.m % Vary stiffness cs:
288
...
% Define range and step for cs range = 1e4:4.5e4:10e4; for n = 1:length(range) % Set parameter for current loop cs = range(n);
...
plotcabin(solution,range,N/m,c_s,, variation of c_s,0,0);
The trolley carries out large and slow motion for low stiffness of the towing rope. The suspension shows only a small amplitude resulting in weak damping. This is seen also in the large, weakly damped swing of the cabin. Stiffness of suspension
% cabin_cf.m % Vary stiffness cf:
...
% Define range for cf range = 1e4:2e4:5e4; % starting value for n = 1:length(range) % Set parameter for current loop cf = range(n);
...
plotcabin(solution,range,N/m,c_f,, variation of c_f,0,0);
A stiffer suspension leads to a larger exxcursion of the trolley. The amplitudes of the bearing are signicantly reduced and the time periods become shorter. Nearly no inuence on the swing motion is found. Damping constant of suspension To nd an optimal damping is an important task in optimisation. The variation of the damping constant shall give a rough information about the sensivity.
CHAPTER 4. DYNAMICS
Excursions versus time, variation of cs 0.3 0.2 s(t) sd (t) [m] 0.1 0 cs = 1.00e+04 N/m cs = 5.50e+04 N/m cs = 1.00e+05 N/m
289
0.1
u(t) [m]
0.05
30 20 10 0 10 20 0 1 2 3 Time t [s] 4 5 6
(t) []
...
% Define range and step for d range = 0.5e3:1e3:2.5e3; for n = 1:length(range) % set parameter for current loop d = range(n);
...
CHAPTER 4. DYNAMICS
Excursions versus time, variation of cf cf = 1.00e+04 N/m cf = 3.00e+04 N/m cf = 5.00e+04 N/m
290
0.05 0.1
A direct inuence can be seen on the motion of the bearing. Also the trolley is considerably damped. The high frequency vibrations in the swing motion are decaying. Rotational damper constant of cabin All the previous alterations of design parameters inuence the slow swing motion of the cabin only very weakly. Therefore, the constant of the damper between the suspension and the cabin is increased now. The two cases and are shown:
CHAPTER 4. DYNAMICS
Excursions versus time, variation of cf cf = 1.00e+04 N/m cf = 3.00e+04 N/m cf = 5.00e+04 N/m
291
0.05 0.1
% cabin_dbeta1.m % Vary damper constant dbeta for alpha = 20 degree: % Initialisation: clear; values;
% read constants
% Set alpha to 20 degree and convert to rad alpha = rad(20); % Define time interval of integration
CHAPTER 4. DYNAMICS
Excursions versus time, variation of d 0.1 s(t) sd (t) [m] 0.05 0 d = 5.00e+02 N*s/m d = 1.50e+03 N*s/m d = 2.50e+03 N*s/m
292
0.12 0.1 0.08 u(t) [m] 0.06 0.04 0.02 0 0.02 0.04 0 1 2 3 Time t [s] 4 5 6
time_range = [0, 6]; % Define range and step for dbeta range = 8e2:15e2:38e2; for n = 1:length(range) % Set parameter for current loop Dbeta = range(n);
...
plotcabin(solution,range,N*m*s,d_{\beta},... , variation of d_{\beta} for \alpha = 20 \circ,0,0)
CHAPTER 4. DYNAMICS
Excursions versus time, variation of d for = 20 0.05 d = 8.00e+02 N*m*s d = 2.30e+03 N*m*s s(t) sd (t) [m] 0 d = 3.80e+03 N*m*s
293
0.05
0.1
0.1 0.08 0.06 u(t) [m] 0.04 0.02 0 0.02 0.04 0 1 2 3 Time t [s] 4 5 6
An effective decay of the swing motion is obtained. It can be seen that increasing the damping coefcient of the suspension is strongly inuencing the motion of the trolley as well as of the suspension. Previously the elevation angle of the guiding rope was . Now the elevation angle is considered to be degree. For this, replace with :
% cabin_dbeta2.m % Vary damper constant dbeta for alpha = 70 degree: % Initialisation: clear;
CHAPTER 4. DYNAMICS
values; % read constants
294
...
Excursions versus time, variation of d for = 70 0.2 0.1 0 d = 8.00e+02 N*m*s d = 2.30e+03 N*m*s s(t) sd (t) [m] d = 3.80e+03 N*m*s
0.06
0.02
Here again the effective reduction of the swing amplitudes of the cabin can be seen. Because of the high inclination angle, the coupling to the trolley and the suspension oscillations is weak, there is nearly no inuence on the swing damper. Elevation of the guiding rope
CHAPTER 4. DYNAMICS
The inuence of the slope of the guiding rope is considered.
% cabin_alpha.m % Vary alpha:
295
...
% Define range and step for alpha and convert into rad range = rad(20:25:70); for n = 1:length(range) % Set parameter for current loop alpha = range(n);
...
% Convert parameter alpha back to degree plotcabin(solution,deg(range),\circ,alpha,... , variation of alpha,0,0)
For a steep slope nearly the whole mass is hanging at the towing rope, both dampers are only weakly articulated which results in weakly damped motions. D IFFERENT SOLVERS FOR DIFFERENT SYSTEM CONFIGURATIONS Here a variation of the angle of the guiding rope is carried out to show the dependence of the sensivity on numerical errors. The two integration routines ode45 and ode15s with default tolerances are used.
% cabin_alpha_dif.m % Vary alpha and compare different integration methods: % Initialisation: clear; values;
% read constants
% Define time interval of integration. Here it is mandatory to % use a fixed step-width, otherwise later the two solutions % cannot be compared time_range = 0:0.01:6; % Define range and step-width for alpha and convert into rad range = rad(20:25:70); % First, find a solution with ode45 for n = 1:length(range) % Set parameter for current loop alpha = range(n);
CHAPTER 4. DYNAMICS
Excursions versus time, variation of alpha 0.2 0.1 0 alpha = 2.00e+01 alpha = 4.50e+01 alpha = 7.00e+01
296
0.1 0.08 0.06 u(t) [m] 0.04 0.02 0 0.02 0.04 0 1 2 3 Time t [s] 4 5 6
% Calculate initial spring excursions y0(fn_s)=-(m1+m2+m3)*g*sin(alpha)/cs; y0(fn_u)=m3*g*cos(alpha+y0(fn_beta))/cf; % Clear previous dimensions of T and Y clear T Y % Solve the system using default error tolerance [T,Y(:,:)]=ode45(Fcabin,time_range,y0); % Calculate desired position for trolley s_des = w0.*R.*T-(m1+m2+m3)*g*sin(alpha)/cs;
CHAPTER 4. DYNAMICS
297
% Store data that should be plotted in a cell-array solution1{n}(:,1)=Y(:,fn_s)-s_des; solution1{n}(:,2)=Y(:,fn_u); solution1{n}(:,3)=deg(Y(:,fn_beta)); % give beta in degree solution1{n}(:,4)=T; % Store time-points for each solution end
% Then integrate by using ode15s for n = 1:length(range) % Set parameter for current loop alpha = range(n); % Calculate initial spring excursions y0(fn_s)=-(m1+m2+m3)*g*sin(alpha)/cs; y0(fn_u)=m3*g*cos(alpha+y0(fn_beta))/cf; % Clear previous dimensions of T and Y clear T Y % Solve the system using default error tolerance [T,Y(:,:)]=ode15s(Fcabin,time_range,y0); % Calculate desired position for trolley s_des = w0.*R.*T-(m1+m2+m3)*g*sin(alpha)/cs; % Store data that should be plotted in a cell-array solution2{n}(:,1)=Y(:,fn_s)-s_des; solution2{n}(:,2)=Y(:,fn_u); solution2{n}(:,3)=deg(Y(:,fn_beta)); % give beta in degree solution2{n}(:,4)=T; % Store time-points for each solution end % Calculate difference between the two solutions. % Time-vector must stay untouched! for i = 1:length(range) diff{i}(:,1:3) = solution1{i}(:,1:3)-solution2{i}(:,1:3); % Time-vector must stay untouched! diff{i}(:,4) = solution1{i}(:,4); end; % Convert parameter alpha back to degree plotcabin(diff,deg(range),\circ,alpha,... using different integration methods (plotted: difference!),... 35,50)
In Fig. 4.65 the difference between the obtained solutions is plotted. Obviously, the error is depending on the system conguration. The errors are maximal in the
BIBLIOGRAPHY
Excursions versus time using different integration methods (plotted: difference!) alpha = 2.00e+01 alpha = 4.50e+01 alpha = 7.00e+01
298
2 0 70 60 1 50 2 3 40 4 5 30 6 20 alpha []
2 0
Time t [s]
x 10 5 u(t) [m] 0 5 0
70 60 1 50 2 3 40 4 5 30 6 20 alpha []
Time t [s]
Time t [s]
case of a steep slope. Of course, for a steep angle large trolley amplitudes occur whereas only a small swing amplitude is induced. On the other hand, the damping of the motion of the trolley is very low.
Bibliography
[1] Klaus-Jrgen Bathe. Finite-Elemente-Methoden. 1990. (in German). [2] D. Bestle. Analyse und Optimierung von Mehrkrper-systemen. 1994. (in German).
BIBLIOGRAPHY
299
[3] A. F. DSouza and V. K. Garg. Advanced Dynamics, Modeling and Analysis. Prentice-Hall International Editions, Englewood Cliffs, New Jersey, USA, 1984. [4] W. Schiehlen (ed.). Multibody Systems Handbook. Springer-Verlag, Berlin, Heidelberg, Germany, 1990. [5] W. Schiehlen (ed.). Advanced Multibody System Dynamics. Kluwer Academic Publishers, Dordrecht, The Netherlands, 1993. [6] R. Fletcher. Practical Methods of Optimization. John Wiley & Sons, Chichester, UK, 1987. [7] N. Gershenfeld. The Nature of Mathematical Modelling. University Press, Cambridge, 1999. [8] E. Hairer, S. P. Nrsett, and G. Wanner. Solving Ordinary Differential Equations I. Springer-Verlag, Berlin, Germany, 1987. [9] E. Hairer and G. Wanner. Solving Ordinary Differential Equations II. Springer-Verlag, Berlin, Germany, 1991. [10] J. L. Junkins and Youdan Kim. Introduction to Dynamics and Control of Flexible Structures. AIAA, American Institute of Aeronautics and Astronautics, Inc., Reston, VA, USA, 1993. [11] K. Kreuzer and W. Schiehlen. NEWEUL. 1988. (in German). [12] K. Magnus and H. H. Mller. Grundlagen der Technischen Mechanik. 1974. (in German). [13] P. C. Mller and W. O. Schiehlen. Linear Vibrations. Martinus Nijhoff Publishers, Dordrecht, The Netherlands, 1985. [14] Nattick. Control Toolbox Users Guide. The MathWorks, 1996. [15] D. E. Newland. Mechanical Vibration Analysis and Computation. Longman Scientic and Technical, Essex, England, 1989. [16] P. E. Nikravesh. Computer-Aided Analysis of Mechanical Systems. PrenticeHall International Editions, Englewood Cliffs, New Jersey, USA, 1988. [17] J. C. Polking. MATLAB Manual for Ordinary Differential Equations. PrenticeHall, Englewood Cliffs, NJ, USA, 1995. [18] W. Schiehlen. Technische Dynamik. 1986. (in German).
BIBLIOGRAPHY
300
[19] A. A. Shabana. Dynamics of Multibody Systems. John Wiley & Sons, New York, USA, 1989. [20] Irving H. Shames. Engineering Mechanics. Statics and Dynamics. Prentice Hall, Upper Saddle River, New Jersey, USA, 1996. [21] V. Stejskal and M. Valek. Kinematics and Dynamics of Machinery. Marcel Dekker, Inc., New York, USA, 1996. [22] Z. Terze, D. Lefeber, and O. Mufti c. Null Space Integration Method for Constrained Multibody Systems with No Constraint Viola tion, in: Multibody System Dynamics. 2001. (in print).