Get the mode vector
int_T *ssGetModeVector(SimStruct *S)
S
SimStruct representing an S-Function block.
A pointer (int_T *
) to the mode vector.
Use to obtain a pointer to the mode vector. This vector has length
ssGetNumModes(S)
. Typically, this vector is initialized in
mdlInitializeConditions
if the default value of 0 isn't
acceptable. It is then used in mdlOutputs
, in conjunction with
nonsampled zero crossings, to determine when the output function should change mode.
For example, consider an absolute value function. When the input is negative, negate
it to create a positive value; otherwise, take no action. This function has two
modes. The output function should be designed not to change modes during minor time
steps. You can also use the mode vector in the mdlZeroCrossings
routine to determine the current mode.
C, C++
See the S-function sfun_zc.c
used in sfcndemo_sfun_zc
.