Impact Modeling with Euler-Lagrangian and Hamiltonian Mechanics

4 point mass system impact simulation in Python with SymPy

Results

*Jack Simulation GIF*
*Simulation Results Plot*

Simulation Setup

Transformation

*Transformation Diagram*

Vertices of the bot were represented as {A}, {B}, {C}, and {D} while its edges were denoted as {1}, {2}, {3}, and {4}. Four point masses of the jack were shown as {a}, {b}, {c}, and {d} while the World frame is shown as {W}.

Configuration

*Configuration Setup*

Both the box and jack are free to translate and rotate in an xy-plane.

LAGRANGIAN

*Velocity Components v1 and v2*
*Velocity Diagram*
*Potential Energy (PE)*
*Kinetic Energy (KE)*
*Lagrangian (L)*

External Force

*External Force (F)*
*External Force Extended (Fext)*

External force was applied assuming someone is shaking the box.

To ensure that the jack hit all four edges of the box, the external force was applied in the x-direction while gravity acted in the y-direction, causing the jack to contact the box boundaries.

Constraint

*Constraint List (qlist)*
*Constraint Formulation (qfor)*

The jack has the constraint that it has to stay within the boundaries of the box.

Phi defines when the point masses of the jack make contact with the boundaries of the box, which are {1}, {2}, {3}, and {4}. This system contains multiple constraint functions stored in phi_list, and they are called in a for-loop so that it eliminates the need to make multiple impact update functions.

Phi can be expressed with the g matrix, while g_ij [3] represents the x-component and g_ij [7] the y-component.

Euler-Lagrangian

*Euler-Lagrangian Equation*

Impact Update Law

*Impact Update Equation (QPM)*
*Hamiltonian (HAM)*
*Impact Equations (EQ)*

Function impact_condition takes phi_list and initial conditions, which include initial positions and velocities, lambdifies phi values, and tolerance to decide the impact condition.

Function impact_update takes initial conditions and impact equations to numerically update impacts.