User Tools

Site Tools


discrete_event

Discrete events are used by various blocks in order to trig an action. The snapshot block uses a discrete event in order to trigger the snapshot, the transfer block can specify a discrete transfer by referencing a discrete event.

The discrete event can also be used to notify the ODE solver that something important has happened in the model and that the solver needs to reduce the current time_step. A typical case is for models that contain conditions. In a model with a condition such as (time>t_leakage), where t_leakage is a parameter indicating when a container starts to leak, it is important that the solver includes this time point when the simulation is run.

The block has a right hand side expression and a left hand side expression. The event is triggered when these are equal. Whenever a time step is taken by the solver, the solver will see if the difference of the two expressions has changed sign since the last time step. If so, the solver will try to backtrace to the time point when they are equal. After, the solver will restart with a time step given in simulation settings as the initial time step.

See also

discrete_event.txt · Last modified: 2014/06/09 12:01 (external edit)