Skip to content

Solving odes to simulate the Dynamics of a pendulum under several conditions. The code was developed in Scilab while I was monitor of the subject "General Mechanics II" at "Universidade de São Paulo"

License

Notifications You must be signed in to change notification settings

vitoramr/Pendulum_Dynamics_simulation

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

12 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Numerical simulation of a pendulum

EP3 Model EP3 Gif

Escola Politécnica da Universidade de São Paulo

PME 3200 - General mechanics II

These programs were developed on Scilab 6.1, a open source software for numerical computation that can be downloaded on the software's website.

The codes were conceived while I was monitor of the subject "PME 3200 - General mechanics II". The goals of these exercises were to teach the students enrolled at the subject concepts such as: mechanical systems modelling, states vector, numerical solving of ODEs, as well as the interactions on systems with multiple degrees of freedom.

The exercises consists on the modelling of a pendulum and at each exercise more complex mechanical interactions were added to the system, accordingly to the topics the students were learning. The first exercise consists of a pendulum with viscous friction and an oscillating external momentum. On the following exercise, collision was added, and the pendulum collides with a wall at a given angle with a coefficient of restitution. At last, the mass, which was fixed to the pendulum, was replaced by a mass with a spring attached to the pendulum's joint and the system gained an additional degree of freedom.

The model images of each exercise are listed below. The video with the result of the 3rd exercise simulation can be downloaded here.

1st Exercise (EP1)

The first exercise consists of a pendulum with a mass attached to the middle of its lenght. The forces acting in the pendulum are the gravity weight, a friction viscous moment and an external oscillating momentum.

EP2 Model

The model's state variables are:

  • theta
  • theta dot

The model's parameters are:

  • theta0 = Initial angular position [rad]
  • theta dot 0 = Initial angular velocity [rad/s]
  • t0 = Initial time of the simulation [s]
  • tf = Final time of the simulation [s]
  • m = Mass of the fixed body [kg]
  • L = Pendulum length [m]
  • c = Viscous angular friction coefficient [Nms/rad]
  • Momentum = Oscillating external momentum [Nm]
  • Mo = Momentum amplitude [Nm]
  • Omega m = Momentum oscillating frequency [rad/s]
  • Phi = Momentum initial fase [rad/s]

2nd Exercise (EP2)

The second exercise uses a model similar to the first one. The difference is that the fixed body is attached to the edge of the pendulum and there is a wall that stops the pendulum from advancing to the left. Hence, the collision between the pendulum and the wall has also to be dealt with.

EP2 Model

The additional parameters for the second model are:

  • theta lim = Wall angular position [rad]
  • e = Coefficient of restitution
  • tm = Initial time for the momentum activation [s]

3rd Exercise (EP3)

EP3 Model

The final exercise added a spring between the mass and the pendulum joint, in a manner that the mass is still dragged by the pendulum, while moving relatively to it.

Therefore, the model gains an additional degree of freedom and the states vector is now described by:

  • space vector

Where x represents the position of the body relative to the pendulum (in m).

The video with the result of a simulation can be downloaded here.

About

Solving odes to simulate the Dynamics of a pendulum under several conditions. The code was developed in Scilab while I was monitor of the subject "General Mechanics II" at "Universidade de São Paulo"

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages