Dynamic Simulation:
Lagrangian Multipliers
Objective
The objective of this module is to introduce Lagrangian multipliers that are used with Lagrange’s equation to find the equations that control the motion of mechanical systems having constraints.
The matrix form of the equations used by computer programs such as
Autodesk Inventor’s Dynamic Simulation are also presented.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Basic Problem in Multi-body Dynamics
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 2
Lagrange’s Equation
In the previous module (Module 6) we developed Lagrange’s equation and showed how it could be used to determine the equations of simple motion systems.
d dt
L
q i
L
q i
0
The examples we considered were for systems in which there were no constraints between the generalized coordinates.
The basic problem of multi-body dynamics is to systematically find and solve the equations of motion when there are constraints that bodies in the system must satisfy.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Non-conservative Forces
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 3
The derivation of Lagrange’s equation in the previous module (Module
6) considered only processes that store and release potential energy.
These processes are called conservative because they conserve energy.
Lagrange’s equation must be modified to accommodate nonconservative processes that dissipate energy (i.e. friction, damping, and external forces).
A non-conservative force or moment acting on generalized coordinate q i is denoted as Q i
.
The more general form of Lagrange’s equation is d dt
L
q i
L
q i
Q i
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
The pendulum shown in the figure will be used as an example throughout this module.
The position of the pendulum is known at any instance of time if the coordinates of the c.g., X cg
,Y cg
, and the angle q are known.
X cg
,Y cg and q are the generalized coordinates.
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 4
Simple
Pendulum
Y cg
Y c.g.
y x
θ
X cg
X
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Kinetic and Potential Energies
The kinetic energy (T) and potential energy (V) of the pendulum are
T
V
1
I q
2
2
mgY cg
1
2 m X
2 cg
1
2 mY cg
2
These equations also give the kinetic and potential energy of the unconstrained body flying through the air.
There needs to be a way to include the constraints to differentiate between the two systems.
Y cg
Y
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 5 c.g.
y x
θ
X
X cg
Unconstrained
Body
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Constraint Equations
In addition to satisfying
Lagrange’s equations of motion, the pendulum must satisfy the constraints that the displacements at X
1 zero.
and Y
1 are
The constraint equations are
X cg
Y cg
2 sin q
2 cos q
X
1
Y
1
0
0
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 6
Y cg
Y c.g.
y
X
1
,Y
1 x
θ
X cg
The c.g. lies on the y axis halfway along the
X
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
The kinetic energy is augmented by adding the constraint equations multiplied by parameters called
Lagrangian Multipliers.
Note that since the constraint equations are equal to zero, we have not changed the magnitude of the kinetic energy.
The Lagrangian multipliers are treated like unknown generalized coordinates.
What are the units of l
1 and l
2
?
Y
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 7
Y
1
X
1
θ
T
l
1
1
2
I q
2
1
2 m
2 cg
1
2 m Y
cg
2
X cg
2 sin q
X
1
l
2
Y cg
2 cos q y
1
X
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Governing Equations
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 8
In the following slides, Lagrange’s equation will be used in a systematic manner to determine the equations of motion for the pendulum.
The governing equations that will be used are shown here.
There are no non-conservative forces
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Lagrangian
L
i n
1
T i
V i
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 1 st Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 9
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Generalized Coordinates q
1 q
2 q
3 q
4 q
5
X cg
Y cg
q
l
1 l
2
Mathematical Steps
L
q
1
m X
cg d dt
L
q
1
L
q
1
l
1
m X
cg
1 st Equation m X
cg
l
1
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 2 nd Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 10
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Generalized Coordinates q
1 q
2 q
3 q
4 q
5
X cg
Y cg
q
l
1 l
2
Mathematical Steps
L
q
2
m Y
cg d dt
L
q
2
L
q
2
l
2
m Y
cg
mg
2 nd Equation m
cg
l
2
mg
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 3 rd Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 11
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Generalized Coordinates q
1 q
2 q
3 q
4 q
5
X cg
Y cg
q
l
1 l
2
Mathematical Steps
L
q
3
I q d dt
L
q
3
L
q
3
l
1
I q
2 cos q l
2
2 sin q
3 rd Equation
I q l
1
2 cos q l
2
2 sin q
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 4 th Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 12
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Generalized Coordinates q
1 q
2 q
3 q
4 q
5
X cg
Y cg
q
l
1 l
2
Mathematical Steps
L
q
4
0 d dt
L
q
4
L
q
4
X cg
0
2 sin q
X
1
4 th Equation
X cg
2 sin q
X
1
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Equation for 5 th Generalized Coordinate
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 13
L
1
2
I q
2
1
2 m X
2 cg
1
2 m Y
2 cg
l
1
X cg
2 sin q
X
1
l
2
Y cg
2 cos q
Y
1
mgY cg
Lagrange’s Equation d dt
L
q i
L
q i
Q i
Generalized Coordinates q
1 q
2 q
3 q
4 q
5
X cg
Y cg
q
l
1 l
2
Mathematical Steps
L
q
5
0 d dt
L
q
5
L
q
5
Y cg
0
2 cos q
Y
1
5 th Equation
Y cg
2 cos q
Y
1
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Summary of Equations
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 14
There are five unknown generalized coordinates including the two
Lagrangian Multipliers. There are also five equations.
Three of the equations are differential equations.
Two of the equations are algebraic equations.
Combined, they are a system of differential-algebraic equations
(DAE).
m X
cg m
cg
l
1
0
l
2
mg
0
I q l
1
2 cos q l
2
2 sin q
0
X cg
2 sin q
X
1
0
Y cg
2 cos q
Y
1
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Free Body Diagram Approach
Summation of Forces in the X-direction m X
cg
l
1
0
Summation of Forces in the Y-direction m
cg
l
2
mg
0
Summation of Moments about the c.g.
I q l
1
2 cos q l
2
2 sin q
0
The application of Lagrange’s equation yields the same equations obtained by drawing a free-body diagram.
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 15
2
2 cos q
q 2
λ
1 mY cg
2 sin q
Iθ cg mX cg mg
Free Body Diagram with
Inertial Forces
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Physical Significance of Lagrangian Multipliers
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 16
Newton’s 2 nd Law in x-direction m X
cg
l
1
0
Force required to impose the constraint that X constant.
1 is a
Lagrangian Multipliers are simply the forces (moments) required to enforce the constraints. In general, the Lagrangian Multipliers are a function of time, because the forces (moments) required to enforce the constraints vary with time (i.e. depend on the position of the pendulum).
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Matrix Format
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 17
The computer implementation of Lagrange’s equation is facilitated by writing the equations in matrix format.
Separating the Lagrangian into kinetic and potential energy terms enables Lagrange’s equation to be written as d dt
T
i
T
q i
Q i
V
q i
In this format, the conservative and non-conservative forces are lumped together on the right hand side of the equation.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Matrix Format
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 18
The kinetic energy augmented with Lagrangian Multipliers can be written in matrix format as
T
1
2
T
Column array containing generalized coordinate velocities.
Column array containing the constraint equations
(refer to Module 3 in this section).
Column array containing the Lagrangian multipliers.
Matrix containing the mass and mass moments of inertia associated with each generalized coordinate.
Inertia Matrix
m
0
0
0
A
0 m
A
0
0
0
0
A
I cg
0
0
0
0
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Matrix Format
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 19
Lagrange’s equation for a mechanical system becomes
T
i
q j
i
q j
Is the constraint equation Jacobian matrix introduced in Module 4 in this section.
Column array containing both conservative and non-conservative forces.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Matrix Format
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 20
Another equation for acceleration was obtained in Module 4 based on kinematics and the constraint equations.
i
q j
Matrix Form of Equations
M q j i
i
q j
0
l
q
Q
This equation can be solved to find the accelerations and constraint forces at an instant in time.
Combining this equation with
Lagrange’s equation from the previous slide yields: The accelerations must then be integrated to find the velocities and positions.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Solution of Differential-Algebraic
Equations (DAE)
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 21
The solution of even the simplest system of DAE requires computer programs that employ predictor-corrector type numerical integrators.
The Adams-Moulton method is an example of the type of numerical method used.
Significant research has led to the development of efficient and robust integrators that are found in commercial computer programs that generate, assemble, and solve these equations.
Autodesk Inventor’s Dynamic Simulation environment is an example of such software.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community
Module Summary
Section 4 – Dynamic Simulation
Module 7 – Lagrangian Multipliers
Page 22
This module showed how Lagrangian Multipliers are used in conjunction with Lagrange’s equation to obtain the equations that control the motion of mechanical systems.
The method presented provides a systematic method that forms the basis of mechanical simulation programs such as Autodesk Inventor’s
Dynamic Simulation environment.
The matrix format of the equations were presented to provide insight into the computations performed by computer software.
The Jacobian and constraint kinematics developed in Module 4 of this section are an important part of the matrix formulation.
© 2011 Autodesk
Freely licensed for use by educational institutions. Reuse and changes require a note indicating that content has been modified from the original, and must attribute source content to Autodesk.
www.autodesk.com/edcommunity
Education Community