INC 693, 481 Dynamics System and Modelling: Lagrangian Method III Dr.-Ing. Sudchai Boonto Assistant Professor Department of Control System and Instrumentation Engineering King Mongkut s Unniversity of Technology Thonburi Thailand
First-order Equations for the Lagrangian Method The second-order differential equation can be expressed in the from of two first-order equations by defining an additional variable. Define the additional variables as the generalized momenta, given by p i = L q i Since d dt ( ) L = ṗ i q i The Lagrangian equation ( ) d L L + R = 0 dt q i q i q i ṗ i L + R = 0 q i q i These are first-order equations. The desirable form of the first-order equations is such that the derivative quantities ( q i and ṗ i ) may be eqpressed as function of the fundamental variables. 2/24
First-order Equations for the Lagrangian Method Spring Pendulum Recall the Lagrangian of the spring pendulum system is given by L = 1 2 mṙ2 + 1 2 m(a + r)2 θ2 1 ( 2 k r + mg ) 2 + mg(a + r) cos θ mga. k Here the generalized coordinates are q 1 = r and q 2 = θ. Then L = 1 2 m q2 1 + 1 2 m(a + q 1) 2 q 2 2 1 ( 2 k q 1 + mg ) 2 + mg(a + q1 ) cos q 2 mga k Hence, the generalized momenta are p 1 = L q 1 = m q 1, p 2 = L q 2 = m(a + q 1 ) 2 q 2. Putting the derivative quantities, we have q 1 = p 1 m, p 2 q 2 = m(a + q 1 ) 2 3/24
First-order Equations for the Lagrangian Method Spring Pendulum The first equation is obtained from Substituting q 2, we get ( ṗ 1 m q 2 2 (a + q 1) + k ṗ 1 = p 2 ( 2 m(a + q 1 ) 3 k q 1 + mg k q 1 + mg k The equation in the second coordinate is obtained from ṗ 2 L q 2 = 0 ṗ 2 = mg(a + q 1 ) sin q 2 ṗ 1 L q 1 = 0 ) mg cos q 2 = 0 ) + mg cos q 2 Thus we get four first-order equations of q 1, q 2, ṗ 1 and ṗ 2. To get the linear state-space form, we need to linearize the equations. 4/24
First-order Equations for the Lagrangian Method RLC Circuit Consider a RLC circuit C L 2 E + q 1 L 1 q 2 R We have T = 1 2 L 1( q 1 q 2 ) 2 + 1 2 L 2 q 2 2 V = 1 2C q2 1 q 1 E, R = 1 2 R q2 2 L = 1 2 L 1( q 1 q 2 ) 2 + 1 2 L 2 q 2 2 1 2C q2 1 + q 1E 5/24
First-order Equations for the Lagrangian Method RLC Circuit The Lagrangian equations become L 1 ( q 1 q 2 ) + 1 C q 1 E = 0 L 1 ( q 1 q 2 ) + L 2 q 2 + R q 2 = 0 The conjugate momenta are p 1 = L q 1 = L 1 ( q 1 q 2 ), p 2 = L q 2 = L 1 ( q 1 q 2 ) + L 2 q 2 These provide the equations for q 1 and q 2 as ( 1 q 1 = + 1 ) p 1 + 1 p 2, q 2 = 1 p 1 + 1 p 2. L 1 L 2 L 2 L 2 L 2 In terms of p 1 and p 2, the Lagrangian equations become ṗ 1 = 1 C q 1 + E, ṗ 2 = R q 2 = R L 2 (p 1 + p 2 ). 6/24
The Hamiltonian Formalism ˆ To derive the system equations directly in the first order, can be done by using Hamiltonian method. Instead of the Lagrangian function L = T V, we shall use the total energy function and denote it by H. Hence H = T + V Note that the potential V is dependent only on the generalized coordinates and not on the generalized velocities. Hence V q i = 0, and therefore, L = (T V ) = T q i q i q i ˆ the kinetic energy is a homogeneous function of degree 2 in the generalized velocities. ˆ To see this consider T (k q 1, k q 2 ) = k 2 T ( q 1, q 2 ) 7/24
The Hamiltonian Formalism ˆ Differentiate both sides of the equation, to get T T q 1 + q 2 = 2kT ( q 1, q 2 ) k q 1 k q 2 Since k is arbitrary, this equation would be valid for k = 1. Hence For higher dimensional system, we have q 1 T q 1 + q 2 T q 2 = 2T ( q 1, q 2 ) i i q i T q i = 2T q i L q i = 2T The total energy function H can be written as H = T + V = 2T (T V ) = 2T L 8/24
The Hamiltonian Formalism ˆ or H = i q i L q i L = i q i p i L. The function in the right-hand side is called the Hamiltonian function (denote by H) in classical mechanics. ˆ The Hamiltonian function is the total energy (i.e. H = H) for systems which the above functional forms of T and V hold. H is a function of p i, q i, and t. Moreover, from the previous discussion, we have expressed T as a function of q i, it will be necessary to substitute q i in terms of p i or q i. This can be written explicitly as q(p, q). ˆ After H(p i, q i, t) is obtained, the equations of motion in terms of H can be obtained by taking the taking the differential of H as dh = i H dp i + p i i H dq i + H q i t dt 9/24
The Hamiltonian Formalism ˆ From H(q, p) p H(q, p) q (p q(p, q)) = p ( = q + p q ) p = (p q(p, q)) q = p q L(q, q) q q L(q, q) = q ˆ Then, we can also write dh as L(q, q(p, q)) p L(q, q) q(p, q) = q p L(q, ṗ(p, q)) q ( q + p q ) p q p p = q L(q, q) q(p, q) = p q L(q, q) p q q q q q q dh = i = i q i dp i i q i dp i + i L dq i L q i t dt ( ṗ i R ) dq i L q i t dt 10/24
The Hamiltonian Formalism ˆ Finally we have the relations (Comparing dh in page 9 and in page 10) H = q i p i H = ṗ i R, q i q i H t = L t ˆ the first two equations, expressed in the first-order form, are called the Hamiltonian equations of motion. ˆ the last equation is not a differential equation and hence is not needed to represent the dynamics. ˆ the dynamical systems where these equations hold are called Hamiltonian systems. 11/24
Hamiltonian method RLC Circuit Consider a RLC circuit C L 2 E + q 1 L 1 q 2 R H = T + V = 1 2 L 1( q 1 q 2 ) 2 + 1 2 L 2 q 2 2 + 1 2C q2 1 q 1 E = 1 ( ) 1 2 2 L 1 p 1 + 1 ( ) 1 2 L 1 2 L 2 2 (p 1 + p 2 ) + 1 2C q2 1 q 1E = 1 2L 1 p 2 1 + 1 2L 2 (p 1 + p 2 ) 2 + 1 2C q2 1 q 1E 12/24
Hamiltonian method RLC Circuit Hence, the Hamiltonian equations are q 1 = H p 1 = 1 L 1 p 1 + 1 L 2 (p 1 + p 2 ), q 2 = H p 2 = 1 L 2 (p 1 + p 2 ), ṗ 1 = H q 1 R q 1 = 1 C q 1 + E, ṗ 2 = H q 1 R q 2 = R q 2 = R L 2 (p 1 + p 2 ) 13/24
Hamiltonian method RLC Circuit2 C2 q3 L q1 q1 q2 R1 q1 q3 q2 E + C1 R2 q1 q2 + q3 L = 1 2 L q2 1 1 2C 1 q 2 2 1 2C 2 q 2 3 + E(q 1 + q 3 ), R = 1 2 R 1 ( q 1 q 2 ) 2 + 1 2 R 2 ( q 1 q 2 + q 3 ) 2 This gives p 1 = L 1 q 1, p 2 = 0, p 3 = 0 14/24
Hamiltonian method RLC Circuit2 Thus, H can be written as H = 1 2L 1 p 2 1 + 1 2C 1 q 2 2 + 1 2C 2 q 2 3 E(q 1 + q 3 ). The first set of Hamiltonian equations give q 1 = H/ p 1 = p 1 /L 1. Since p 2 = p 3 = 0 H/ p 2 and H/ p 3 are undefined, and ṗ 2 = ṗ 3 = 0. The second set of Hamiltonian equations give ṗ 1 = E R 1 ( q 1 q 2 ) R 2 ( q 1 q 2 + q 3 ), ṗ 2 = q 2 C 1 + R 1 ( q 1 q 2 ) + R 2 ( q 1 q 2 + q 3 ) = 0, ṗ 3 = q 3 C 2 + E R 2 ( q 1 q 2 + q 3 ) = 0. 15/24
Hamiltonian method RLC Circuit2 Algebraic manipulation of these three equations yield ṗ 1 = E q 2 C 1, q 2 = q 2 R 1 C 1 q 3 R 1 C 2 + p 1 q 3 = q 2 R 2 C 1 R 1 + R 2 R 1 R 2 + E, L 1 R 1 ( q2 + q 3 E C 1 C 2 These three are the first-order differential equations of the system. ) 16/24
Hamiltonian method Separately excited DC motor and mechanical load system with a flexible shaft. q1 La Ra I1, R1 E + k l1 Const. q2 q3 R2 ˆ q 1 : the charge flowing in the armature circuit ˆ q 2 : the angle of the rotor ˆ q 3 : the angle of the load wheel There are two sub-systems: the electrical circuit and the mechanical part. ˆ These two sub-systems interact through the torque F exerted by the electrical side one the mechanical side. E b = Kϕ q 2, ˆ The back emf E b exerted by the mechanical side on the electrical side. F = Kϕ q 1 17/24
Hamiltonian method Separately excited DC motor and mechanical load system with a flexible shaft. The electrical sub-system: T e = 1 2 La q2 1, V e = (E E b )q 1 R e = 1 2 Ra q2 1 p 1 = Le q 1 = Te q 1 = L a q 1 The Hamiltonian H e of the electrical sub-system in terms of q 1 and p 1 as This gives the first-order equations as H e = 1 2L a p 2 1 Eq 1 + E b q 1 q 1 = He p 1 = p 1 L a ṗ 1 = He q 1 Re q 1 = E E b R a q 1 = E E b Ra L a p 1 18/24
Hamiltonian method Separately excited DC motor and mechanical load system with a flexible shaft. The mechanical sub-system: T m = 1 2 I 1 q 2 2 + 1 2 I 2 q 2 3, V m = 1 2 k(q 2 q 3 ) 2 F q 2 R m = 1 2 R 1 q 2 2 + 1 2 R 2 q 2 3 The generalized momenta, p 2 and p 3 are given by p 2 = Tm q 2 = I 1 q 2, p 3 = Tm q 3 = I 2 q 3 The Hamiltonian function of the mechanical system is H m = 1 2I 1 p 2 2 + 1 2I 2 p 2 3 + 1 2 k(q 2 q 3 ) 2 F q 2. 19/24
Hamiltonian method Separately excited DC motor and mechanical load system with a flexible shaft. The first-order equations for the mechanical sub-system: q 2 = Hm p 2 = p 2 I 1 q 3 = Hm p 3 = p 3 I 2 ṗ 2 = Hm q 2 ṗ 3 = Hm q 3 Rm q 2 = k(q 2 q 3 ) + F R 1 q 2 = k(q 2 q 3 ) + F R 1 I 1 p 2 Rm q 3 = k(q 2 q 3 ) R 2 q 3 = k(q 2 q 3 ) R 2 I 2 p 3. The interaction between the mechanical and electrical sub-system: ṗ 1 = E Kϕ p 2 I 1 Ra L a p 1 ṗ 2 = k(q 2 q 3 ) + Kϕ p 1 L a R 1 I 1 p 2. 20/24
Lagrangian method Separately excited DC motor and mechanical load system with a flexible shaft. The total kinetic energy without separating the sub-system is T = 1 2 La q2 1 + 1 2 I 1 q 2 2 + 1 2 I 2 q 2 3 The total potential energy is V = (E E b )q 1 + 1 2 k(q 2 q 3 ) 2 F q 2 = (E Kϕ q 2 )q 1 + 1 2 k(q 2 q 3 ) 2 Kϕ q 1 q 2, The total Rayleigh function is R = 1 2 Ra q2 1 + 1 2 R 1 q 2 2 + 1 2 R 2 q 2 3 21/24
Lagrangian method Separately excited DC motor and mechanical load system with a flexible shaft. Since L T, we have to use q i q 1 We get the second-order equations as ( ) d T L + R = 0 dt q i q i q i L a q 1 (E Kϕ q 2 ) + R a q 1 0 I 1 q 2 Kϕ q 1 + k(q 2 q 3 ) + R 1 q 2 = 0 The expression forthe generalized momenta will be which gives I 2 q 3 k(q 2 q 3 ) + R 2 q 3 = 0 p i = T q i p 1 = L a q 1, p 2 = I 1 q 2, p 3 = I 2 q 3. 22/24
Lagrangian method Separately excited DC motor and mechanical load system with a flexible shaft. The first-order equations are obtained from as ṗ i = L q i R q i ṗ 1 = E Kϕ q 2 R a q 1 = E Kϕ p 2 I 1 R a p 1 L a ṗ 2 = Kϕ q 1 k(q 2 q 3 ) R 1 q 2 = Kϕ p 1 L a k(q 2 q 3 ) R 1 p 2 I 1 ṗ 3 = k(q 2 q 3 ) R 2 q 3 = k(q 2 q 3 ) R 2 p 3 I 2 23/24
Reference 1. Wellstead, P. E. Introduction to Physical System Modelling, Electronically published by: www.control-systems-principles.co.uk, 2000 2. Banerjee, S., Dynamics for Engineers, John Wiley & Sons, Ltd., 2005 3. Rojas, C., Modeling of Dynamical Systems, Automatic Control, School of Electrical Engineering, KTH Royal Institute of Technology, Sweeden 4. Fabien, B., Analytical System Dynamics: Modeling and Simulation Springer, 2009 5. Spong, M. W. and Hutchinson, S. and Vidyasagar, M., Robot Modeling and Control, John Wiley & Sons, Inc. 24/24