This example demonstrates how to model a hybrid system with discrete events (impacts) using Simit. A ball is dropped from a height, accelerates due to gravity, and bounces off the ground with a coefficient of restitution.
System Dynamics
The vertical position of the ball is governed by gravity :
When the ball hits the ground (), its velocity is reversed and dampened:
Where is the coefficient of restitution (between 0 and 1).
Block Diagram
To model this in Simit:
- Integrator blocks are used to compute velocity from acceleration , and position from velocity .
- A Constant block provides gravity .
- A Zero Crossing or Hit Crossing detection logic (simulated via conditional logic in this basic example) handles the bounce.
Note: In the current version of Simit, we can model the impact using a logic block that resets the integrator state or applies an impulse force.
Step-by-Step Implementation
- Add two Integrator blocks.
- Integrator 1 (Velocity): Initial condition = .
- Integrator 2 (Position): Initial condition = (drop height).
- Add a Gain block set to
-9.81(Gravity) feeding into Integrator 1. - Add a Scope to visualize position .
(Full hybrid modeling features are coming in upcoming updates)
Simulation Results
Run the simulation for seconds. You will see the ball’s height parabolic trajectory decreasing with each bounce as energy is lost.