When-Equations


When-equations have been introduced in Modelica to express instantaneous equations (equations that are valid only at certain points when specific conditions become true). Then equations in the when-equation are activated when at least one of the conditions become true.


1 Bouncing Ball

A bouncing ball is a good example of a hybrid system for which the when-equation is appropriate when modeled. The motion of the ball is characterized by the variable height above the ground and the vertical velocity. The reinit equation is a special from of equation that can be used in when-equations to define new values for continuous-time state variables of a model at an event.



A bouncing ball

2 Simulation 1 of Bouncing Ball

When we simulate the BouncingBall model from 0 to 8 we see how it bounces





3 Simulation 2 of Bouncing Ball

When we Simulate BouncingBall a little further then it bounces faster and faster. Then the simulation fails and it looks like the ball bounces under the floor. This is called the Zeno effect. An execution of a hybrid system is called Zeno, if it takes infinitely many discrete transitions in a finite time interval.