23
Texas A&M University, Department of Aerospace Engineering AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER- LOADING TECHNIQUES D. Todd Griffith, Andrew J. Sinclair, James D. Turner, John E. Hurtado, and John L. Junkins Texas A&M University Department of Aerospace Engineering College Station, TX 77840 T d L L C dt Q λ q q (x 3 ,y 3 ) 1 2 N

AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

  • Upload
    arella

  • View
    26

  • Download
    0

Embed Size (px)

DESCRIPTION

1. 2. N. AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES. D. Todd Griffith, Andrew J. Sinclair, James D. Turner, John E. Hurtado, and John L. Junkins Texas A&M University Department of Aerospace Engineering College Station, TX 77840. - PowerPoint PPT Presentation

Citation preview

Page 1: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-

LOADING TECHNIQUES

D. Todd Griffith, Andrew J. Sinclair, James D. Turner,

John E. Hurtado, and John L. Junkins

Texas A&M University

Department of Aerospace Engineering

College Station, TX 77840

Td L LC

dt

Q λq q

(x3,y3)

1

2

N

Page 2: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Presentation Outline

•Introduction and previous work

•Overview of automatic differentiation by OCEA

•Equation of motion formulation using automatic differentiation

•A new algorithm for numerical integration

•Examples

Page 3: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Introduction and previous work

• Work on multibody dynamics dates back to around 1960’s

• Multibody dynamics is a mature field; many codes and many books have been written in the area– Authors include: Shabana, Scheihlen, Garcia de Jalon

• In general, many methods exist for equation of motion generation. Typically, Lagrange’s equations, Kane’s equations, or Newton/Euler Methods employed

• The primary question is which method for generation of equations of motion is most suitable for problem complexity, generality desired, computational issues, and computational resources to name a few.

Page 4: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Equation of motion formulation using automatic differentiation

• Lagrange’s equations:

Td L LC

dt

Q λq q

C q bsubject to

Lagrangian:

T, V: kinetic and potential energy

q: generalized coordinates

Q: generalized force

C: constraint matrix

: Lagrange multipliers

L T V

Of course, many choices for equation of motion formulation exist; however, the utility of automatic differentiation is immediately seen for implementing Lagrange’s Equations………………...

Page 5: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Presentation Outline

•Introduction and previous work

•Overview of automatic differentiation by OCEA

•Equation of motion formulation using automatic differentiation

•A new algorithm for numerical integration

•Examples

Page 6: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Overview of automatic differentiation by OCEA(1)

• OCEA (Object Oriented Coordinate Embedding Method) – Extension for FORTRAN90 (F90) written by James D. Turner

– Automatic Differentiation (AD) equation manipulation package in which new data types are created in order to define independent and dependent variables (functions)

• OCEA description– Automatic differentiation enabled by coding rules for differentiation -

Chain rule of calculus

– Can compute first through fourth-order partial derivatives of scalar, vector, matrix, and higher order tensors

– Standard mathematical library functions (e.g. sin, cos, exp) are overloaded

– Scalars are replaced by differential n-tuple

2:f f f f

Page 7: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Overview of automatic differentiation by OCEA(2)

• OCEA description (cont’d)– Intrinsic operators such as ( +, - , * , / , = ) are also overloaded to enable,

for example, addition and multiplication of OCEA variables:

– Partial derivative computation is hidden to the user - takes place in the background without user intervention.

– Access to partial derivatives (e.g. Jacobian, Hessian, etc.) made simple by overloading of the “ = “ sign.

2 2:a b a b a b a b

* : * * *i j ia b a b a b a b

Page 8: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Overview of automatic differentiation by OCEA(3)

• The need for computation of partial derivatives is found in numerous applications

• Previous applications include

– Root solving and Optimization

– Second and higher-order GLSDC algorithms (AAS 04-148)

• In this paper, we consider automatic generation of equations of motion for linked mechanical systems

Page 9: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Presentation Outline

•Introduction and previous work

•Overview of automatic differentiation by OCEA

•Equation of motion formulation using automatic differentiation

•A new algorithm for numerical integration

•Examples

Page 10: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Approach (1): Direct approach(1)By differentiating the Lagrangian

Td T LC

dt

Q λq q

2 2

j ji i j i j

d T T Tq q

dt q q q q q

2

iji j

TM m

q q

2

iji j

TM m

q q

Td L LC

dt

Q λq q

L

C

q

Q

Automatic Differentiation (AD)

Specified

AD or specified

many methods

Mass matrix and its time derivative computed by second-order differentiation………..

Page 11: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Approach (1): Direct approach(2) By differentiating the Lagrangian

2

iji j

TM m

q q

2

iji j

TM m

q q

( ) q 0

( ) C Ct t

q q = q

q q

TLM M C

q + q Q λ

q

-1 TLM M C

q = q + Q λq

Can also compute constraint matrix, C, automatically for holonomic type constraint.

Now forming equations:

Accelerations computed after generating or prescribing all terms here. Now, can proceed with numerical integration…….

Page 12: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Approach (2): A modified form of Lagrange’s Equations

Td L LC

dt

Q λq q

( )( ) ( , ) TV

M C

qq q G q q Q λ

q

( ) ( ) 1

2ij jki i ik

jkk j i

m mmH h

q q q

-1 TVM C

q = G + Q λq

(1) ( )( , ) ...T T nH H G q q q q q q

In this approach, we can bypass forming the kinetic energy function.

Must still form potential energy (if you want to), but most importantly need an efficient method for computing the mass matrix and partial derivatives of mass matrix…………..

Page 13: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Approach (2): Identifying the mass matrix (1)

1

1( , )

2

nT T

i i i i i ii

T m v v I

v ω

KE for system of rigid bodies

( ) ii iA

r

v q q qq

( ) ii iB

ω q q q

q

Introduce the following velocity transformation matrices:

For the case of planar rigid bodies, transformation matrices specialize to partials of position of mass center and partials of angular orientations

Additionally, Bi is a constant vector of 1’s and 0’s for a minimal coordinate planar system

Page 14: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Approach (2): Identifying the mass matrix (2)

1

1( , )

2

nT T

i i i i i ii

T m v v I

v ω

1

1

1

1( , )

2

1

2

1( )

2

nT T T T

i i i i i i i i i ii

nT T Ti i i i i i i i

i

nTi i

i

T m q A A q I q B B q

q m A A I B B q

q M q

q q

+

q

Introduce transformations

Mass matrix and mass matrix partials

1

( )n

T Ti i i i i i

i

M q m A A I B B

+

1

( ) T TnT Ti i i i

i i i i i ii

A A B BMm A A I B B

q

+ +q q q q q

Need not specify T, can get M by forming mass center positions vectors…...

Page 15: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Presentation Outline

•Introduction and previous work

•Overview of automatic differentiation by OCEA

•Equation of motion formulation using automatic differentiation

•A new algorithm for numerical integration

•Examples

Page 16: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Numerical Integration: Solving

1 0 1 2 32 26k k

h x x k k k k

0 ( , )k ktk f x

02 21 ( , )h

k kt kk f x

12 22 ( , )h

k kt kk f x

3 2( , )k kt h k f x k

Fourth-order Runge-Kutta algorithm

Utilizes approximate derivatives through fourth order

0 0

( ( ), )

( )

t t

t

x f x

x x

So called Taylor integration scheme:

2 3

4 5

1 1( ) ( ) ( ( ), ) ( ( ), ) ( ( ), )

2! 3!1 1

( ( ), ) ( ( ), ) .....4! 5!

t t t t t t t t t t t t

t t t t t t

x x f x f x f x

f x f x

Can compute through fourth-order time derivatives exactly. Potentially fifth-order method.

Page 17: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Presentation Outline

•Introduction and previous work

•Overview of automatic differentiation by OCEA

•Equation of motion formulation using automatic differentiation

•A new algorithm for numerical integration

•Examples

Page 18: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Spring Pendulum by Direct method (1)

r

θ

L T V 2 2 21

2 ( )T m r r

210 02 ( ) ( cos )

spring gravV V V

k r r mg r r

2

iji j

TM m

q q

2

iji j

TM m

q q

-1 TLM M C

q = q + Q λq

Page 19: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Spring Pendulum by Direct method (2)SUBROUTINE SPRING_PEND_EQNS( PASS, TIME, X0, DXDT, FLAG )

USE EB_HANDLINGIMPLICIT NONE

****************************************!.....LOCAL VARIABLES

TYPE(EB)::L, T, V ! LAGRANGIAN, KINETIC, POTENTIALREAL(DP):: M, K ! MASS AND STIFFNESS VALUESREAL(DP), DIMENSION(NV):: JAC_LREAL(DP), DIMENSION(NV,NV):: HES_L

****************************************T = 0.5D0*M*(X0(3)**2 + X0(1)**2*X0(4)**2) ! DEFINE KEV = 0.5D0*K*(X0(1)-R0)**2 + M*GRAV*(R0-X0(1)*COS(X0(2))) ! DEFINE PEL = T – V ! DEFINE LAGRANGIAN FUNCTION

JAC_L = L ! dL/(dq,dqdot)JAC_L_Q = JAC_L(1:NV/2) ! dL/dq

HES_L = L ! EXTRACT SECOND ORDER PARTIALS OF LAGRANGIANMASS = HES_L(NV/2+1:NV,NV/2+1:NV) ! COMPUTE MASS MATRIXMASSDOT = HES_L(NV/2+1:NV,1:NV/2) !COMPUTE MDOT

****************************************DXDT(1)%E = X0(3)%E ! RDOTDXDT(2)%E = X0(4)%E ! THETADOTDXDT(3)%E = QDOTDOT(1) ! RDOTDOTDXDT(4)%E = QDOTDOT(2) ! THETADOTDOT

END SUBROUTINE SPRING_PEND_EQNS

Page 20: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Open-chain Topology of Rigid Bodies (1)

1

2

N

Mass center location can be recursively formulated and utilized to compute velocity transformation matrices and ultimately the mass matrix and its partial derivatives.

Generation of Equations of motion for open-chain topologies can be automated to the point of simply specifying the number of bodies and the initial conditions, while for closed chain-topologies we additionally need to prescribe the constraint equations.

Page 21: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Open-chain Topology of Rigid Bodies (2)10 body model for laboratory deployment of inflated aerospace structure.

Model easily updated to include joint torques (e.g. damping)

Page 22: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Closed-chain Topology Example

(x3,y3)

Payload Motion

5 link manipulator example.

Two holonomic constraints specified.

Driving torque on link 1.

Page 23: AUTOMATIC GENERATION AND INTEGRATION OF EQUATIONS OF MOTION BY OPERATOR OVER-LOADING TECHNIQUES

Texas A&M University, Department of Aerospace Engineering

Conclusion•Introduced an automatic differentiation (AD) tool: OCEA

•Implemented Lagrange’s equations using AD

–Mass matrix and it’s time derivatives computed by direct differentiation of T and by recursive formulation

•Suggested a new algorithm for numerical integration

•Examples included simulations of a generalized code for planar n-body systems with open and closed-chain topologies

•Future work includes computational studies, extension to 3D topologies, and efforts to validate solutions for flexible body systems