Specify actions to be performed upon entering a mode
entry v_old = v; end
entry block, terminated by an
end keyword, is an optional section inside a mode declaration
that lets you specify the actions to be performed upon entering the mode. These actions
are event variable updates based on the value of a continuous expression immediately
before entering the mode.
modes mode m entry v_old = v; end equations ... end end end
entry section is especially useful for
modeling state reset because, in the majority of state reset use cases, the reset value
is a function of the previous value of the variable. For example, when modeling a slider
moving between two hard stops, the new velocity depends on the velocity before impact.
For more information and an example, see State Reset Example.
In each entry action, the left-hand side must be an event variable. The right-hand side is a continuous expression, evaluated immediately before entering the mode. This expression can include any combination of continuous variables, event variables, and intermediates.
You can use entry actions both in instantaneous and regular modes.