Declare operating modes in mode chart
modes mode m1 ... end mode m2 ... end end
modes
begins a modes declaration block in
a mode chart. The modes
block, terminated by an end
keyword,
can contain one or more mode
constructs. Each mode
construct
declares one mode.
For example, the following syntax declares two modes, m1
and m2
.
modes mode m1 ... end mode m2 ... end end
mode
is a named construct. It is terminated
by an end
keyword. Each mode declaration contains
a complete set of equations that describe this operating mode.
modes mode m1 equations ... end end mode m2 equations ... end end end
For every mode, the total number of equation expressions, their
dimensionality, and their order must be the same. This restriction
is the same as for the equations in different branches of the if-elseif-else
statement.
This restriction does not apply to the assert
expressions,
because they are not included in the expression count.
A mode declaration can contain an entry
section,
which 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 variable immediately
before entering the mode.
modes mode m1 equations ... end end mode m2 entry ... end equations ... end end end
The entry
section is separate from the
equations
section, and the event variable
updates in the entry
section are not counted in the
number of equation expressions for the mode.
To implement a state reset, mode charts can contain instantaneous modes and compound transitions. An instantaneous mode is a mode that is active only for one event iteration. You declare instantaneous modes the same way as regular modes, using the same syntax. The same mode can be used as an instantaneous mode in one case and a regular mode in another, depending on the transitions declared in a mode chart. To specify that a mode is instantaneous, list it as the middle mode in a compound transition.