In order to use Lagrange’s equations to find equations of motion we need Potential energy and Kinetic energy. For the potential energy part, since the cart is located at zero height, y_p \ = 0 , it has zero potential energy so we just need to calculate the potential energy of the pendulum mass:
Potential energy:
V = mgh = mg{y_p} = mgl\cos \thetaFor Kinetic energy, it is equal to {v_i} = \frac{1}{2}{m_i}v_i^2, where m_i is the mass of ith object and v_i is it’s velocity:
Kinetic energy:
T = \frac{1}{2}M{{\dot x}^2} + \frac{1}{2}m\overbrace {\left( {\dot x_p^2 + \dot y_p^2} \right)}^{v_p^2}\\\,\,\,\,\,\, = \frac{1}{2}M{{\dot x}^2} + \frac{1}{2}m\left( {{{\dot x}^2} + 2l\dot \theta \dot x\cos \theta + {l^2}{{\dot \theta }^2}\overbrace {\left( {{{\cos }^2}\theta + {{\sin }^2}\theta } \right)}^1} \right)To apply Lagrange’s equation, the initial step involves the computation of the Lagrangian in the following manner:
L = T – V\\\,\,\,\,\,\, = \frac{1}{2}\left( {m + M} \right){{\dot x}^2} + \frac{1}{2}m{l^2}{{\dot \theta }^2} + ml\dot \theta \dot x\cos \theta – mgl\cos \thetaWe are now able to apply Lagrange’s equation:
\frac{d}{{dt}}\left( {\frac{{\partial L}}{{\partial {q_i}}}} \right) – \frac{{\partial L}}{{\partial {q_i}}} = {Q_i}To simplify matters, let’s start by understanding the concept of a generalized force denoted as Q_i . This refers to the sum of all forces acting in the direction of a specific variable. For instance, if you intend to calculate the equations of motion for the variable x you need to consider the force F(t) , In the case of a non-zero friction force represented by f_f the generalized force would be given by Q_i = F(t)-f_f .
Regarding \frac{{\partial L}}{{\partial {q_i}}} the process is straightforward. We simply need to determine the partial derivative of L with respect to all variables involved (in this case x and \theta ) However, for the remaining part of the equation \frac{d}{{dt}}\left( {\frac{{\partial L}}{{\partial {q_i}}}} \right) the understanding may not be as straightforward, so let’s make it clear as crystal by solving this part for x !
Equations of motion:
x:
First, we need to identify the components of L that contain \frac{{\partial L}}{{\partial {x}}} , so we have \frac{1}{2}\left( {m + M} \right){{\dot x}^2} and ml\dot \theta \dot x\cos \theta .
Once these components have been identified, we can simply differentiate them with respect to time.
As there are no components that solely depend on x the second part becomes irrelevant here, also for generalized force we just have F(t) :
\left( {m + M} \right)\ddot x + ml\ddot \theta \cos \theta – ml{\dot \theta ^2}\sin \theta = F\left( t \right) \,\,\,\,\,\, \leftarrow \,\,\,\,\,\ First \ equation \ of \ motionLet’s go for \theta part:
We have two parts that contain \dot \theta , \frac{1}{2}m{l^2}{{\dot \theta }^2} and ml\dot \theta \dot x\cos \theta , and two parts that contain \theta , ml\dot \theta \dot x\cos \theta and – mgl\cos \theta .
So let us differentiate the parts containing \dot \theta with respect to time and parts with \theta with respect to \theta
\,\,\,\,m{l^2}\ddot \theta + ml\ddot x\cos \theta – ml\dot x\dot \theta \sin \theta – \left[ { – ml\dot x\dot \theta \sin \theta + mgl\sin \theta } \right] = 0 \\ = m{l^2}\ddot \theta + ml\ddot x\cos \theta – mgl\sin \theta = 0\\ \Rightarrow l\ddot \theta + \ddot x\cos \theta – g\sin \theta = 0\,\,\,\,\,\,\,\,\, \leftarrow \,\,\,\,\,\,\,\,\,\ Second\ equation \ of \ motionAt this point we have all equations of motion we need. From here onwards you can simply follow the instructions for state space or transfer function modeling. we will discuss linearization, modeling, and simulation of IPCS in another post and check if our model is correct or not.
Suppose you have taken different angle into account for the pendulum’s rotation, and now you need to determine if your set of equations of motion are correct or not. for instance, if someone considers \varphi instead of \theta :
To find the new set of equations we just need to replace \theta with \varphi and apply all changes.
\theta = – \varphi \\\dot \theta = – \dot \varphi \\\ddot \theta = – \ddot \varphi \\\sin \theta = – \sin \varphi \\\cos \theta = \cos \varphiAs an assignment, your task is to determine the set of equations corresponding to the specified angle selection.