Hasan Şener - Anasayfa

Hasan Şener

Personal Writings, PhD Adventure



watch this blog!

Solving a Dynamics System by Using Lagrange Equations - 1

24 Haziran 2023 Cumartesi - # # # # #

 In this problem we'll examine below figure. 

Figure 1 System

Problem Definition

There exist a  cart $m_1$ connected to ground via prismatic joint then a slender rod attached to it by weld joints, in which there is no rotation. However, there is rotating disc connected to $m_2$. And $m_5$ slides onto $m_4$ which it's connected to $m_3$. 

Finding Degree of Freedom

Acoording to Grüebbler's criteria: 
$n_f = \lambda (l-j-1) + \sum_{i} f_i$

Degree of freedom of the system can be found as 3. 

Generalized Coordinate Selection 

In this problem generalized coordinates are selected as $x_1,x_2,θ$. According to the rotating spring pendulum motion in $m_5$, our system can be defined with these 3 coordinates without considering any constraints. 

However one can select 2 arbitrary generalized coordinates such as $X,Y$ defined in Figure 1. In this state, there shall be 2 constraint equations to capture the motion of the system.

$\phi_1 = x_1 + (r+x_2) \cos(\theta) \quad \rightarrow \quad X - \left(x_1 + (r+x_2) \cos(\theta)\right) = 0$
$\phi_2 = (l+h) + X_2 \sin(\theta) \quad \rightarrow \quad Y - \left((l+h) + X_2 \sin(\theta)\right) = 0$

To construct constraint equations in Pfaffian form partial derivatives shall be calculated with respect to each generalized coordinate:

\(\psi = \frac{{dQ_k}}{{dq_k}}\)
\(\psi_{11} = \frac{{d\phi_1}}{{dx_1}}, \quad \psi_{12} = \frac{{d\phi_1}}{{dX_2}}, \quad \psi_{13} = \frac{{d\phi_1}}{{d\theta}}, \quad \psi_{14} = \frac{{d\phi_1}}{{dX}}, \quad \psi_{15} = \frac{{d\phi_1}}{{dY}}\)
\(\psi_{21} = \frac{{d\phi_2}}{{dx_1}}, \quad \psi_{22} = \frac{{d\phi_2}}{{dx_2}}, \quad \psi_{23} = \frac{{d\phi_2}}{{d\theta}}, \quad \psi_{24} = \frac{{d\phi_2}}{{dX}}, \quad \psi_{25} = \frac{{d\phi_2}}{{dY}}\)
\(\psi_{11} = -1, \quad \psi_{12} = -\cos(\theta), \quad \psi_{13} = x_2 \sin(\theta), \quad \psi_{14} = 1, \quad \psi_{15} = 0\)
\(\psi_{21} = 0, \quad \psi_{12} = -\sin(\theta), \quad \psi_{23} = -X_2 \sin(\theta), \quad \psi_{24} = 0, \quad \psi_{25} = 1\)
\[ \psi = \begin{pmatrix} -1 & -\cos(\theta(t)) & \sin(\theta(t))(r+x_2(t)) & 1 & 0 \\ 0 & -\sin(\theta(t)) & -\cos(\theta(t))(r+x_2(t)) & 0 & 1 \\ \end{pmatrix} \]

Constraint type: Holonomic, since \(\phi_1\) and \(\phi_2\) reduce the degree of freedom by two.

Variables: Rheonomic, since the variables \(X_1\), \(X_2\), and \(\theta\) are time-dependent.

Deriving Lagrangian 

The system's generalized coordinates are selected as \(x_1, x_2, \theta, X, Y\) respectively.

To find the Lagrangian, one shall find the kinetic, potential, and dissipative energies. In order to achieve this, MATLAB's Symbolic Library was used.

Finding the kinetic energy:

Let \(K_i\) define the kinetic energy, where \(i = \{1,2,3,4,5\}\) indicates the corresponding mass.

\(K_1 = \frac{{(m_1(\frac{{\partial}}{{\partial t}} x_1(t))^2)}}{2}\)

\(K_2 = \frac{{(m_2(\frac{{\partial}}{{\partial t}} x_1(t))^2)}}{2}\)

\(K_3 = \frac{{(I_3(\frac{{\partial}}{{\partial t}} \theta(t))^2) + (m_3(\frac{{\partial}}{{\partial t}} x_1(t))^2)}}{2}\)

To find \(K_4\), the position and velocity equations of \(m_4\) shall be written such as:

Let \(x_4\) and \(y_4\) be the position of \(m_4\), then \(\dot{x_4}\) and \(\dot{y_4}\) become the components of the velocity vector \(\vartheta_4\).

Where \(\vartheta_4^2 = \dot{x_4}^2 + \dot{y_4}^2\).

$x_4 = x_1(t) + cos(\theta(t))(l/2+r)$

$y_4 = h + l + sin(\theta(t))(l/2+r)$

\(\vartheta_4 = \dot{x_4}^2 + \dot{y_4}^2 = (\frac{{\partial}}{{\partial t}} x_1(t) - \sin(\theta(t))(l/2+r)\frac{{\partial}}{{\partial t}} \theta(t))^2 + \cos^2(\theta(t))(l/2+r)^2(\frac{{\partial}}{{\partial t}} \theta(t))^2\)

Then the kinetic energy of \(m_4\) is:

\(K_4 = \frac{1}{2} m_4 \vartheta_4^2\)

Similarly for \(m_5\), \(X\) and \(Y\) are selected coordinates. Then the sum of squares of the velocities shall be taken into consideration.

\(K_5 = \frac{1}{2} m_5 ((X^2 + \dot{Y}^2))^2\)

Total kinetic energy can be written as:

\(K = \frac{m_5 (\frac{{\partial}}{{\partial t}} X(t))^2 + (\frac{{\partial}}{{\partial t}} Y(t))^2}{2} + \frac{I_3 \sigma_2}{2} + \frac{I_4 \sigma_2}{2} + \frac{m_4 (\frac{{\partial}}{{\partial t}} x_1(t) - \sin(\theta(t))(l/2+r) \frac{{\partial}}{{\partial t}} \theta(t))^2 + \cos^2(\theta(t))(l/2+r)^2 \sigma_2}{2} + \frac{m_1 \sigma_1}{2} + \frac{m_2 \sigma_1}{2} + \frac{m_3 \sigma_1}{2}\), where \(\sigma_1 = (\frac{{\partial}}{{\partial t}} x_1(t))^2\) and \(\sigma_2 = (\frac{{\partial}}{{\partial t}} \theta(t))^2\)

Finding potential energy:

Corresponding potential energies are defined as \(U_i\), where \(i = \{1,2,3,4,5\}\).

\(U_1 = g \cdot m_1 \cdot (\frac{h}{2})\)

\(U_2 = g \cdot m_2 \cdot (h + \frac{l}{2})\)

\(U_3 = \frac{k_2 \cdot \theta(t)^2}{2} + g \cdot m_3 \cdot (h + l)\)

\(U_4 = g \cdot m_4 \cdot (h + l + \sin(\theta(t))(l/2+r))\)

\(U_5 = \frac{k_3 \cdot x_2(t)^2}{2} + g \cdot m_5 \cdot Y(t)\)

Total potential energy is calculated as:

\(U = U_1 + U_2 + U_3 + U_4 + U_5\)

\(U = \frac{{k_2 \theta(t)^2}}{2} + \frac{{k_1 x_1(t)^2}}{2} + \frac{{k_3 x_2(t)^2}}{2} + gm_5 Y(t) + gm_3 (h + l) + \frac{{ghm_1}}{2} + gm_4 (h + l + \sin(\theta(t))(l/2+r)) + gm_2 (h + \frac{l}{2})\)

Calculating dissipation energy:

The D term is calculated due to the damping effect of the given damper as \( D = \frac{{c₁(\frac{{\partial}}{{\partial t}}x₁(t))^2}}{2} \)

In the problem, there exists a friction coefficient, shown as \( μ \), however, in this study, it wasn’t taken into consideration. Even if it was, the dissipation term should be as follows:

\( D = \frac{{c₁(\frac{{\partial}}{{\partial t}}x₁(t))^2}}{2} + \text{{sgn}}(\frac{{\partial}}{{\partial t}}x₂)μN \)

Where \( N \) is the normal constraint force holding \( m₅ \) onto \( m₄ \).

Calculating external forces:

Recall Lagrange equation:

\( \frac{{δ}}{{δt}}(\frac{{δK}}{{δ(q_k)}}) - \frac{{δK}}{{δq_k}} + \frac{{δU}}{{δq_k}} + \frac{{δD}}{{δ(q_k)}} = Q_k + \sum_{{j=1}}^v λ[ψ] \)

where \( [ψ] = \frac{{δϕ_k}}{{δq_k}} \)

To form the right-hand side of the equations, \( Q_k \)'s shall be calculated:

\( Q_{{x₁}} = 0 + F(t)\sin(θ(t)) \)

\( Q_{{x₂}} = 0 \)

\( Q_θ = F(t)(l+r) \)

\( Q_X = 0 \)

\( Q_Y = 0 \)

Then recall constraint equations & Pfaffian:

\( ϕ₁ = X(t) - x₁(t) - \cos(θ(t))(r+x₂(t)) \)

\( ϕ₂ = Y(t) - l - h - \sin(θ(t))(r+x₂(t)) \)

\( [ψ] = \begin{pmatrix} -1 & -\cos(θ(t)) & \sin(θ(t))(r+x₂(t)) & 1 & 0 \\ 0 & -\sin(θ(t)) & -\cos(θ(t))(r+x₂(t)) & 0 & 1 \end{pmatrix} \)

For \(x_1\):

\(\frac{{\delta K}}{{\delta \dot{x}_1}} - \frac{{\delta K}}{{\delta x_1}} + \frac{{\delta U}}{{\delta x_1}} + \frac{{\delta D}}{{\delta \dot{x}_1}} = Q_{x_1} + \lambda_1 \frac{{\delta \phi_1}}{{\delta x_1}} + \lambda_2 \frac{{\delta \phi_2}}{{\delta x_1}}\)

\((m_1 \sigma_1 + m_2 \sigma_1 + m_3 \sigma_1 + c_1 \frac{{\partial}}{{\partial t}} x_1(t) + k_1 x_1(t) - \frac{{m_4(-2\sigma_1+2 \cos(θ(t))(l/2+r)(\frac{{\partial}}{{\partial t}} θ(t))^2 + 2 \sin(θ(t))(l/2+r) \frac{{\partial^2}}{{\partial t^2}} θ(t))}}{2}) = -\lambda_1 \quad \text{where} \quad \sigma_1 = \frac{{\partial^2}}{{\partial t^2}} x_1(t)\)

For \(x_2\):

\(\frac{{\delta K}}{{\delta \dot{x}_2}} - \frac{{\delta K}}{{\delta x_2}} + \frac{{\delta U}}{{\delta x_2}} + \frac{{\delta D}}{{\delta \dot{x}_2}} = Q_{x_2} + \lambda_1 \frac{{\delta \phi_1}}{{\delta x_2}} + \lambda_2 \frac{{\delta \phi_2}}{{\delta x_2}}\)

\(k_3 x_2(t) = -\lambda_1 \cos(θ(t)) - \lambda_2 \sin(θ(t))\)

For \(\theta\):

\(\frac{{\delta K}}{{\delta \dot{\theta}}} - \frac{{\delta K}}{{\delta \theta}} + \frac{{\delta U}}{{\delta \theta}} + \frac{{\delta D}}{{\delta \dot{\theta}}} = Q_{\theta} + \lambda_1 \frac{{\delta \phi_1}}{{\delta \theta}} + \lambda_2 \frac{{\delta \phi_2}}{{\delta \theta}}\)

For \(X\):

\(\frac{{\delta K}}{{\delta \dot{X}}} - \frac{{\delta K}}{{\delta X}} + \frac{{\delta U}}{{\delta X}} + \frac{{\delta D}}{{\delta \dot{X}}} = Q_X + \lambda_1 \frac{{\delta \phi_1}}{{\delta X}} + \lambda_2 \frac{{\delta \phi_2}}{{\delta X}}\)

\(m_5 \frac{{\partial^2}}{{\partial t^2}} X(t) = \lambda_1\)

For \(Y\):

\(\frac{{\delta K}}{{\delta \dot{Y}}} - \frac{{\delta K}}{{\delta Y}} + \frac{{\delta U}}{{\delta Y}} + \frac{{\delta D}}{{\delta \dot{Y}}} = Q_Y + \lambda_1 \frac{{\delta \phi_1}}{{\delta Y}} + \lambda_2 \frac{{\delta \phi_2}}{{\delta Y}}\)

\(m_5 \frac{{\partial^2}}{{\partial t^2}} Y(t) + gm_5 = \lambda_2\)

For \(\theta\):

\(\frac{{m_4 (2\cos(θ(t))^2 \sigma_3 \sigma_2 + 2\sin(θ(t))(l/2+r)(\cos(θ(t))(l/2+r)\sigma_4 - \frac{{\partial^2}}{{\partial t^2}} x_1(t) + \sin(θ(t))(l/2+r)\sigma_2) - 4\cos(θ(t))\sin(θ(t))\sigma_3 \sigma_4 - \sigma_1)}}{2} + \frac{{m_4 (2\cos(θ(t))\sin(θ(t))\sigma_3 \sigma_4 + \sigma_1)}}{2} + k_2θ(t) + I_3\sigma_2 + I_4\sigma_2 + gm_4\cos(θ(t))(l/2+r) = F(t)(l+r) - \lambda_2\cos(θ(t))(r+x_2(t)) + \lambda_1\sin(θ(t))(r+x_2(t))\)

\(\text{where} \sigma_1 = 2\cos(θ(t))(\frac{{\partial}}{{\partial t}} x_1(t) - \sin(θ(t))(l/2+r)\frac{{\partial}}{{\partial t}} θ(t))(l/2+r)\frac{{\partial}}{{\partial t}} θ(t)\)

\(\sigma_2 = \frac{{\partial^2}}{{\partial t^2}} θ(t)\)

\(\sigma_3 = (l/2+r)^2\)

\(\sigma_4 = \left(\frac{{\partial}}{{\partial t}} θ(t)\right)^2\)

Final Lagrange Equations:

\(\begin{aligned} & \left(m_1 \sigma_2 + m_2 \sigma_2 + m_3 \sigma_2 + c_1 \frac{{\partial}}{{\partial t}} x_1(t) + k_1 x_1(t) - \frac{{m_4 (-2 \sigma_2 + 2 \cos(\theta(t)) (l/2+r) \sigma_4 + 2 \sin(\theta(t)) (l/2+r) \sigma_3)}}{2}\right) \\ & = \sin(\theta(t)) F(t) - \lambda_1 \\ & \\ & k_3 x_2(t) = -\lambda_1 \cos(\theta(t)) - \lambda_2 \sin(\theta(t)) \\ \\ & + \frac{{m_4 (2 \cos(\theta(t))^2 \sigma_5 \sigma_3 + 2 \sin(\theta(t)) (l/2+r) (\cos(\theta(t)) (l/2+r) \sigma_4 - \sigma_2) + \sin(\theta(t)) (l/2+r) \sigma_3 - 4 \cos(\theta(t)) \sin(\theta(t)) \sigma_5 \sigma_4 - \sigma_1)}}{2} \\ & + \frac{{m_4 (2 \cos(\theta(t)) \sin(\theta(t)) \sigma_5 \sigma_4 + \sigma_1)}}{2} + k_2 \theta(t) + I_3 \sigma_3 + I_4 \sigma_3 + g m_4 \cos(\theta(t)) (l/2+r) = F(t)(l+r) - \lambda_2 \cos(\theta(t)) (r+x_2(t)) + \lambda_1 \sin(\theta(t)) (r+x_2(t)) \end{aligned}\)

\(\text{{where }} \sigma_1 = 2 \cos(\theta(t)) \left(\frac{{\partial}}{{\partial t}} x_1(t) - \sin(\theta(t)) (l/2+r) \frac{{\partial}}{{\partial t}} \theta(t)\right)(l/2+r) \frac{{\partial}}{{\partial t}} \theta(t)\)

\(\sigma_2 = \frac{{\partial^2}}{{\partial t^2}} x_1(t)\)\

\(\sigma_3 = \frac{{\partial^2}}{{\partial t^2}} \theta(t)\)\

\(\sigma_4 = \left(\frac{{\partial}}{{\partial t}} \theta(t)\right)^2\)\

\(\sigma_5 = (l/2+r)^2\)\

Define  from constraint equations such as:

Substitute  $\lambda_1, \lambda_2$ and $X$ and $Y$ into the first three equations.

Then we'll have 3 equations with 3 unknowns, which $x_1(t), x_2(t)$ and $\theta(t)$

Since we have all equations, now let's solve with Matlab. 

From here we can continue with Part - 2




Last Comments