|
Model eventsIn the history of an evolving system there may be changes that aren’t smooth, we will call these occurrences ‘events’.
For example, it’s an event in a simulation of motion of a basketball when the ball bounces off the floor. A bounce can be implemented as a reversal of the direction of velocity. A condition can be set up specifying that if the ball is no longer above the floor it must have hit the floor, it must have bounced, and the ball must subsequently be moving in the opposite direction. If the height of the floor is defined as z=0, then when the value of z becomes smaller than 0 the ball’s velocity must be reversed.
However, that is not sufficient. The simulation proceeds with time increments so when the condition (z < 0) is met the ball will in fact be in an, shall we say, illegal position. To handle the bounce correctly the moment in time that the ball makes contact with the ground must be determined exactly (which the ODE solver cannot do), and the way that the bounce proceeds must be handled in a physically realistic way. After that the simulation can return to the ODE’s for the subsequent evolution.
EJS event handling determines the point in time of the event to within a specified tolerance. Starting in EJS version 4.2, if you leave the tolerance field blank, the same value as the solver’s absolute tolerance will be used for it.
![]() The event editor
|