In this project, a pendulum is attached to a spinning frame. The frame has dimensions,
and the pendulum length is
Your team's goal is to
- build the equations of motion using Lagrange and least action
$L=T-V$ - solve for the motion for a slow rotation speed and a fast rotation speed
- visualize the solution with plots and animations
Four specific cases were evaluated, and the results are presented below.
We can make several conclusions from the cases above. First, we notice that solving the same equation with different initial conditions has a significant effect on the behavior of the system. When starting with a greater initial angle of displacement
Overall, this project was a great example of how Lagrangian mechanics can be used to define a complex system! This project also demonstrated the power of using programming (more specifically, Julia) to perform complex math as opposed to doing so by hand.
A note on accuracy. As mentioned previously, to explore the symbolic capabilities of Julia, ModelingToolkit was used to derive the EOM for the pendulum symbolically (but following the same procedure as the derivation below). To evaluate the accuracy of doing this, the following plot was created to find the difference between the symbolic EOM and the one derived by hand.
From this plot, we observe that for all cases evaluated, the magnitude of the error never exceeds approximately
To solve this problem, we can define a reference frame that rotates with the pivot about the z-axis. At time t, the rotating reference frame rotates by
Doing so yields:
We can now convert the position of the pivot and the mass from the rotating frame to the inertial frame. For the pivot (in the rotating frame):
Therefore, the pivot position in the inertial frame can be expressed as: $$ \vec{r}_{Pivot} = \begin{bmatrix} w_1 \cos(\Omega t) \ w_1 \sin(\Omega t) \ h_1 \end{bmatrix} $$
The position of the mass in the rotating frame relative to the pivot can be expressed as:
Where
The absolute position of the mass in the inertial frame can then be expressed as:
Therefore:
Taking the time derivative of each allows us to find the speed of the mass, which can then be used to find the kinetic energy of the system:
The potential energy of the system can also be expressed as:
We can now write the Lagrangian as:
Finally we can used the Euler-Lagrange equation,
Please note that a full derivation of the equation above can be found in the project01_team06_notes.pdf file in the notes directory of the repository.
Now, in order to program this system in Julia, we must decompose the second-order ODE above into two first-order ODEs. We can do that by defining:
Therefore, we have:
Finally, we must determine a low and high speed for
Therefore, we can choose a low speed of
From the project directory, run:
julia main.jl The program may take a few minutes to run. All final plots are output to the results/ directory and use the following naming convention: plottype_omega_value_theta_value.extension. The types of animated plots are:
- 3d Trajectory Plots
- Theta versus time
- Theta dot versus time
- Dashboards (which include the three above)
The non-animated plots are:
- 3d Trajectories (for the slow and fast rotation speed)
- Theta versus time (for the slow and fast rotation speed)
- Angular acceleration difference (between the symbolic Equation of Motion (EOM) found using Julia and the EOM derived by hand below)
All source code is in the src/ directory.
This project was developed and tested with Julia version 1.12.4
The following packages are required:
ModelingToolkitOrdinaryDiffEqPlotsMeasures
project_01-6/
|
├───── archive/ # old plots and files
|
├───── notes/ # hand calculations
|
├───── src/ # Source Code
| |
| ├───── derive_equations.jl # derive EOM
| ├───── physics.jl # create functions for symbolic and hand calc EOMs
| ├───── simulate.jl # solve EOM
| └───── visualize.jl # define visualization functions
|
├───── main.jl # main driver
|
└───── README.md # project documentation




