### 4.2Lab 2, Simulate moving mass on spring inside slot on a moving table

4.2.1  Problem description
4.2.2  Physical model
4.2.3  Mathematical model

This Lab assignment is to study motion of circular disk with mass on spring moving in a slot on the table.

#### 4.2.1Problem description

The simulation assignment is to reproduce Example 3.2 in your book for the pinned disk with a slot and mass particle. Turn in your computer ﬁle with the equations you simulated and plots that show that your simulation worked.

An addendum to the problem is in this #### 4.2.2Physical model

The following diagram shows the physical model of the system. It is a horizontal table, with a slot in it, where a mass $$m$$ attached to spring that moves with no friction inside this slot. In the above, the frame of reference for the moving mass $$m$$ has its origin coincide with the origin of the inertial frame. The vector $$a$$ is always  perpendicular to the slot, and it is assumed the mass $$m$$ when the spring is relaxed will be located at the end of the vector $$a$$ and hence $$y$$ is measured related to that location.

#### 4.2.3Mathematical model

The system has 2 degrees of freedom $$\theta$$ and $$y$$. The 2 equations of motion will be derived using both the $$F=ma$$ and using Lagrangian method.

##### Deriving equations of motion using $$F=ma$$

The following is the velocity, acceleration and force diagrams  Now that we have the acceleration and the force diagrams, we can write the equations of motion using $$F=ma.$$

There are 3 unknowns in the problem $$\theta ^{\prime \prime },y^{\prime \prime }$$ and $$N$$, the reaction force on the side of the slot wall. Hence we need to generate 3 equations.

Apply $$F=ma$$ in the direction parallel to the $$a$$ vector we obtain

\begin{align*} \sum F &= -m\left ( a\left ( \theta ^{\prime }\right ) ^{2} +y\theta ^{\prime \prime }+2\theta ^{\prime }y^{\prime }\right )\\ N &=-m\left ( a\left ( \theta ^{\prime }\right ) ^{2}+y\theta ^{\prime \prime }+2\theta ^{\prime }y^{\prime }\right ) (1) \end{align*}

Applying $$F=ma$$ in the direction parallel to the $$y$$ vector gives

\begin{align*} \sum F&=m\left ( a\theta ^{\prime \prime }+y^{\prime \prime }-y\left (\theta ^{\prime }\right ) ^{2}\right )\\ -ky &= m\left ( a\theta ^{\prime \prime }+y^{\prime \prime }-y\left (\theta ^{\prime }\right ) ^{2}\right )\\ y^{\prime \prime } &=-\frac{k}{m}y-a\theta ^{\prime \prime }+y\left (\theta ^{\prime }\right ) ^{2} (2) \end{align*}

Applying moment equation for the disk results in\begin{equation} \tau +Ny+\left ( ky\right ) a=I_{g}\theta ^{\prime \prime } \tag{3} \end{equation} Substituting Eq. (1 into Eq. (3) results in\begin{align*} \tau -\left [ m\left ( a\left ( \theta ^{\prime }\right ) ^{2}+y\theta ^{\prime \prime }+2\theta ^{\prime }y^{\prime }\right ) \right ] y+\left ( ky\right ) a & =I_{g}\theta ^{\prime \prime }\\ \tau -mya\left ( \theta ^{\prime }\right ) ^{2}-my^{2}\theta ^{\prime \prime }-2m\theta ^{\prime }yy^{\prime }+kya & =I_{g}\theta ^{\prime \prime }\\ \theta ^{\prime \prime }\left ( my^{2}+I_{g}\right ) & =\tau -mya\left ( \theta ^{\prime }\right ) ^{2}-2my\theta ^{\prime }y^{\prime }+kya \end{align*}

Therefore, the ﬁnal EQM are\begin{align} y^{\prime \prime } & =-\frac{k}{m}y-a\theta ^{\prime \prime }+y\left ( \theta ^{\prime }\right ) ^{2}\tag{4}\\ \theta ^{\prime \prime } & =\frac{\tau -mya\left ( \theta ^{\prime }\right ) ^{2}-2my\theta ^{\prime }y^{\prime }+kya}{my^{2}+I_{g}} \tag{5} \end{align}

##### Decoupling the EQM and the state space formulation

Substituting Eq. (5) into Eq. (4) gives$y^{\prime \prime }=-\frac{k}{m}y-a\frac{\tau -mya\left ( \theta ^{\prime }\right ) ^{2}-2my\theta ^{\prime }y^{\prime }+kya}{my^{2}+I_{g}}+y\left ( \theta ^{\prime }\right ) ^{2}$ Using the decoupled ODE above along with Eq. (5) and introducing 4 state variables $$x_{1},x_{2},x_{3}\,x_{4}$$ we obtain

\begin{align*} \begin{pmatrix} x_{1}\\ x_{2}\\ x_{3}\\ x_{4}\end{pmatrix} & =\begin{pmatrix} \theta \\ y\\ \theta ^{\prime }\\ y^{\prime }\end{pmatrix} \overset{\frac{d}{dt}}{\rightarrow }\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} =\begin{pmatrix} \theta ^{\prime }\\ y^{\prime }\\ \theta ^{\prime \prime }\\ y^{\prime \prime }\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{\tau }{my^{2}+I_{g}}-\frac{mya\left ( \theta ^{\prime }\right ) ^{2}}{my^{2}+I_{g}}-\frac{2my\theta ^{\prime }y^{\prime }}{my^{2}+I_{g}}+\frac{kya}{my^{2}+I_{g}}\\ -\frac{k}{m}y-a\frac{\tau -mya\left ( \theta ^{\prime }\right ) ^{2}-2my\theta ^{\prime }y^{\prime }+kya}{my^{2}+I_{g}}+y\left ( \theta ^{\prime }\right ) ^{2}\end{pmatrix} \\\begin{pmatrix} \dot{x}_{1}\\ \dot{x}_{2}\\ \dot{x}_{3}\\ \dot{x}_{4}\end{pmatrix} & =\begin{pmatrix} x_{3}\\ x_{4}\\ \frac{\tau }{mx_{2}^{2}+I_{g}}-\frac{mx_{2}ax_{3}^{2}}{mx_{2}^{2}+I_{g}}-\frac{2mx_{2}x_{3}x_{4}}{mx_{2}^{2}+I_{g}}+\frac{kx_{2}a}{mx_{2}^{2}+I_{g}}\\ -\frac{k}{m}x_{2}-a\left [ \frac{\tau }{mx_{2}^{2}+I_{g}}-\frac{mx_{2}ax_{3}^{2}}{mx_{2}^{2}+I_{g}}-\frac{2mx_{2}x_{3}x_{4}}{mx_{2}^{2}+I_{g}}+\frac{kx_{2}a}{mx_{2}^{2}+I_{g}}\right ] +x_{2}x_{3}^{2}\end{pmatrix} \end{align*}

##### Simulation results and discussion

First, the 4 ﬁgures shown in the textbook at page 100 and 101 are reproduced below using the simulation program written for this assignment.

##### Figure 3.7 and 3.8 reproduced

When the spring is made very stiﬀ ($$f_{n}=200$$ Hz) then the mass attached to the spring had almost no moment. Therefore, the system behaved as if the mass was just placed on the table, and no reactive force was generated on the side of the table due to spring extension. The generated solution agrees with this result as shown below. All other simulation parameters used are as shown in table 3.2, page 99 in the textbook.

##### Figure 3.9 and 3.10 reproduced

Now the simulation parameters were all set to the same values in table 3.2, and the following is the result: We can see that now, since the spring is extended and contracting, then there will be reactive force on the table at the point where the spring is attached to it. This force will change in value as the mass move up and down the slot. Therefore this resulted in the disk angular speed changing as shown above. We notice now that the mass position produces oscillatory motion around the point of static equilibrium of the spring.

##### Results when proportional controller added

The input torque applied to the disk is now given by $\tau =K_{p}\left ( \omega _{des}-\omega \right )$ where $$\omega _{des}$$ is the angular speed of the disk that we would like the disk to be running at all the time, and $$\omega$$ is the actual angular speed of the disk. Diﬀerent values of $$\omega _{des}$$ was tried. It was found that as the $$\omega _{des}$$ was made larger (in other words, as the disk angular speed was made larger and constant) then the oscillation of the mass attached to the spring became smaller. Hence there is an inverse relationship. Therefore, by measuring the oscillation frequency of the mass attached to the spring, one can determine the angular velocity of the disk. This is the idea behind tachometer. The following table shows the diﬀerent $$\omega _{des}$$ used, and the resulting oscillation frequency of the mass. All other parameters used are as shown in table 3.2 in the textbook. $$K_{p}$$ used was set to $$10$$ in all the runs. Simulation time was set to $$10$$ seconds.

 $$n$$ $$\omega _{des}\left ( rad/\sec \right )$$ mass oscillation (Hz) $$0.5$$ $$3.142$$ $$0.92$$ $$0.6$$ $$3.77$$ $$0.81$$ $$0.7$$ $$4.398$$ $$0.708$$ $$0.8$$ $$5.027$$ $$0.609$$ $$0.9$$ $$5.655$$ $$0.41$$ $$0.95$$ $$5.969$$ $$0.306$$ $$0.99$$ $$6.22$$ mass fell oﬀ the edge

We notice that as the $$\omega _{des}$$ approached or exceeded the natural frequency of the spring, then the mass will oscillate such that the amplitude became larger than the distance it has available to it on the top of the disk, and the mass fell over, and the simulation was stopped then. The simulation program detects when the mass position is outside the disk and will terminate the simulation. This can be attributed to resonance, since at resonance the amplitude becomes very large. The following plot shows the above result to conﬁrm the inverse relation between mass oscillation and the disk angular speed The mass position amplitude damped out during oscillation in all the above runs was, but the oscillation was clear and was measured in the program by counting how many times the mass crosses its position of static equilibrium. The following plot shows the output from one typical run showing the damped motion of the mass. 