User`s guide
The C MEX S-Function SimStruct
3-115
ssGetPWork(S)
Can be used in the simulation loop, mdlInitializeConditions,
or
mdlStart routines to get the pointer (void *) work vector.
Thisvector has length
ssGetNumPWork(S). Typically, this vector
and its pointer contents are initialized in
mdlStart or
mdlInitializeConditions. Its contents are updated in
mdlUpdate, and used in mdlOutputs.
ssGetNumNonsampledZCs(S)
Canbeusedinanyroutine(exceptmdlInitializeSizes)to
determine the number of nonsampled zero crossing vector
elements your S-function is using.
ssGetNonsampledZCs(S)
This is used in mdlZeroCrossings to return th e z ero crossing
signal values. The variable step solvers track the signals to
locate where it crosses zero. The simulation time steps taken
include these points. This vector has length
ssGetNumNonsampledZCs(S).
ssGetNumModes(S)
Canbeusedinanyroutine(exceptmdlInitializeSizes)to
determine the number of mode vector elements your S-function
is using.
ssGetModeVector(S)
Can be used in the simulation loop, mdlInitializeConditions,
or
mdlStart routines to get the mode (int_T) work vector. This
vector has length
ssGetNumModes(S). Typically, this vector is
initialized in
mdlInitializeConditions if the default value of
zero 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 ne gative, 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 mi nor time steps. The
mode vector may also be used in the
mdlZeroCrossings routine
to determine the current mode.
Table 3-10: State and Work Vector SimStruct Macros (Continued)
Macro Description