ME451 Kinematics and Dynamics of Machine Systems Numerical Integration October 28, 2013 Radu Serban University of Wisconsin-Madison Before we get started… Last Time: Today Wrap-up discussion on recovering constraint reaction forces Begin section on numerical integration Assignments: Specifying position and velocity initial conditions for dynamics Recovering constraint reaction forces Matlab 7 – due Wednesday, October 30, Learn@UW (11:59pm) Your simEngine2D can now perform complete Kinematic analysis! Test the provided visualization function (available on the SBEL course webpage) Miscellaneous Draft proposals for the Final Project due on Friday, November 1 Midterm 2 – Wednesday, November 6, 12:00pm in ME 1143 Review session – Monday, November 4, 6:30pm in ME 1143 2 3 Final Project I encourage you to come up with a problem on your own Some suggestions The Reuleaux collection of kinematic mechanisms at Cornell University http://kmoddl.library.cornell.edu/ Mechanical computers http://www.youtube.com/watch?v=s1i-dnAH9Y4 Extend simEngine2D to include contact dynamics (DEM – penalty method) Default project Something related to your research Something related to a personal interest of yours Something that you are curious about simEngine2D kinematic and dynamic analysis of the web cutting mechanism Problems 5.2 and 8.2 in the textbook You decide what the interesting/relevant questions are Rules of Engagement The final project can use either simEngine2D or ADAMS (or both) You can work individually or in groups of two For the proposal, send (email) a PDF (at most one page, typeset) with a description of the problem, how you propose to tackle it, and what you expect to be able to answer about it Draft proposal due on Friday, November 1; Final proposal (if needed) due on Friday, November 8 If you decide to work on the default problem, simply send an email indicating that Final report Due on Wednesday, December 11 Use Word or LaTeX and generate a PDF Describe the problem, the analysis procedure, and the results Include all necessary figures, derivations, equations Include your simEngine2D (if applicable) and/or ADAMS models 6.6 Constraint Reaction Forces Reaction Forces Remember that we jumped through some hoops to get rid of the reaction forces that develop in joints Now, we want to go back and recover them, since they are important: Durability analysis Stress/Strain analysis Selecting bearings in a mechanism Etc. The key ingredient needed to compute the reaction forces in all joints is the set of Lagrange multipliers 5 6 Reaction Forces: The Basic Idea Recall the partitioning of the total force acting on the mechanical system Applying a variational approach (principle of virtual work) we ended up with this equation of motion After jumping through hoops, we ended up with this: It’s easy to see that Reaction Forces: Important Observation What we obtain by multiplying the transposed Jacobian of a constraint, 𝚽𝐪𝑇 , with the computed corresponding Lagrange multiplier(s), 𝛌, is the constraint reaction force expressed as a generalized force: Important Observation: What we want is the real reaction force, expressed in the GRF: We would like to find F𝑥 , F𝑦 , and a torque T due to the constraint We would like to report these quantities as acting at some point 𝑃 on a body 7 The strategy: Look for a real force which, when acting on the body at the point 𝑃, would lead to a generalized force equal to 𝐐𝐶 Reaction Forces: Framework Assume that the 𝑘-th joint in the system constrains points 𝑃𝑖 on body 𝑖 and 𝑃𝑗 on body 𝑗 We are interested in finding the (𝑘) reaction forces and torques 𝐅𝑖 and (𝑘) 𝑇𝑖 acting on body 𝑖 at point 𝑃𝑖 , as (𝑘) (𝑘) well as 𝐅𝑗 and 𝑇𝑗 𝑗 at point 𝑃𝑗 acting on body The book complicates the formulation for no good reason by expressing these reaction forces with respect to some arbitrary body-fixed RFs attached at the points 𝑃𝑖 and 𝑃𝑗 , respectively. It is much easier to derive the reaction forces and torques in the GRF and, if desired, re-express them in any other frame by using the appropriate rotation matrices. 8 Reaction Forces: Main Result Let the 𝑚𝑘 constraint equations defining the 𝑘-th joint be Let the 𝑚𝑘 Lagrange multipliers associated with this joint be Then, the presence of the 𝑘-th joint leads to the following reaction force and torque at point 𝑃𝑖 on body 𝑖 9 Reaction Forces: Comments 10 Note that there is one Lagrange multiplier associated with each constraint equation Number of Lagrange multipliers in mechanism is equal to number of constraints Example: the revolute joint brings along a set of two kinematic constraints and therefore there will be two Lagrange multipliers associated with this joint Each Lagrange multiplier produces (leads to) a reaction force/torque combo Therefore, to each constraint equation corresponds a reaction force/torque pair that “enforces” the satisfaction of the constraint, throughout the time evolution of the mechanism For constraint equations that act between two bodies 𝑖 and 𝑗, there will also be a 𝐅𝑗 , 𝑇𝑗 pair associated with such constraints, representing the constraint reaction forces on body 𝑗 According to Newton’s third law, they oppose 𝐅𝑖 and 𝑇𝑖 , respectively If the system is kinematically driven (meaning there are driver constraints), the same approach is applied to obtain reaction forces associated with such constraints In this case, we obtain the force/torque required to impose that driving constraint 11 Reaction Forces: Summary A joint (constraint) in the system requires a (set of) Lagrange multiplier(s) The Lagrange multiplier(s) result in the following reaction force and torque Note: The expression of 𝚽 for all the usual joints is known, so a boiler plate approach can be used to obtain the reaction force in all these joints An alternative expression for the reaction torque is Reaction force in a Revolute Joint [Example 6.6.1] 12 Numerical Integration 14 Numerical Methods Numerical Analysis is the study of quantitative approximations to the solution of problems of mathematical analysis (i.e., calculus) Study of algorithms Algorithm Program Code (arithmetic model) (set of procedures) (computer implementations) Study of approximation errors Truncation (discretization) Round-off Study of numerical stability Examples: interpolation and extrapolation, solving linear system of equations, eigenanalysis, solving nonlinear systems of equations, optimization (linear and nonlinear), numerical quadrature, numerical differential equations, etc. ,etc. Numerical Integration The particular numerical methods used to solve differential equations are typically called “numerical integrators”, or “integration formulas” A numerical integrator generates an approximate solution at discrete time points (also called grid points, station points, nodes) This is in fact just like in Kinematics, where the solution is computed on a time grid Different numerical integrators generate different solutions, but these solutions are typically very close together, and (hopefully) close to the actual solution of the problem Putting things in perspective: In 99% of the cases, the use of numerical integrators is the only alternative for solving complicated systems described by non-linear differential equations 15 Basic Concept IVP In general, all we can hope for is approximating the solution at a sequence of discrete points in time Uniform grid (constant step integration) Adaptive grid (variable step integration) Basic idea: somehow turn the differential problem into an algebraic problem (approximate the derivatives) IVP in dynamics: What we calculate are the accelerations Oversimplifying, we get something like This is a second-order DE which needs to be integrated to obtain velocities and positions 16 17 Simplest method: Forward Euler Starting from the IVP Use the simplest approximation to the derivative Rewrite the above as and use ODE to obtain Forward Euler Method with constant step-size ℎ FE: Geometrical Interpretation IVP Forward Euler integration formula 18 FE: Example Solve the IVP using Forward Euler (FE) with a step-size ℎ = 0.01 Compare to the exact solution 19 20 Forward Euler: Effect of Step-Size % IVP (RHS + IC) f = @(t,y) -0.1*y + sin(t); y0 = 0; tend = 50; % Analytical solution y_an = @(t) (0.1*sin(t) - cos(t) + exp(-0.1*t)) / (1+0.1^2); % Loop over the various step-size values and plot errors colors = [[0, 0.4, 0]; [1, 0.5, 0]; [0.6, 0, 0]]; Figure, hold on, box on h = [0.001 0.01 0.1]; for ih = 1:length(h) tspan = 0:h(ih):tend; y = zeros(size(tspan)); err = zeros(size(tspan)); y(1) = y0; err(1) = 0; for i = 2:length(tspan) y(i) = y(i-1) + h(ih) * f(tspan(i-1), y(i-1)); err(i) = y(i) - y_an(tspan(i)); end plot(tspan, err, 'color', colors(ih,:)); end legend('h = 0.001', 'h = 0.01', 'h = 0.1'); FE errors for different values of the step-size ℎ = 0.001, 0.01, 0.1 0.06 h = 0.001 h = 0.01 h = 0.1 0.04 0.02 0 -0.02 -0.04 -0.06 0 5 10 15 20 25 30 35 40 45 50 21 FE: Effect of Step-Size % IVP (RHS + IC) f = @(t,y) -0.1*y + sin(t); y0 = 0; tend = 50; FE accuracy at different values of the step-size ℎ = 0.1, 1.0, 5.0 6 % Loop over the various step-size values and plot errors colors = [[0, 0.4, 0]; [1, 0.5, 0]; [0.6, 0, 0]]; Figure, hold on, box on h = [0.1 1.0 5.0]; for ih = 1:length(h) tspan = 0:h(ih):tend; y = zeros(size(tspan)); y(1) = y0; for i = 2:length(tspan) y(i) = y(i-1) + h(ih) * f(tspan(i-1), y(i-1)); end plot(tspan,y, 'color', colors(ih,:)) end legend('h = 0.1', 'h = 1', 'h = 5'); h = 0.1 h=1 h=5 4 2 0 -2 -4 -6 0 5 10 15 20 25 30 35 40 45 50