Download What Is an S

Transcript
7
Implementing Block Features
*/
ssSetNumRWork(S, 0);
ssSetNumIWork(S, 0);
ssSetNumPWork(S, 0);
/*
* Modes and zero crossings:
* If we have a variable-step solver and this block has a continuous
* sample time, then
*
*
o One mode element will be needed for each scalar output
in order to specify which equation is valid (1), (2), or (3).
*
o Two ZC elements will be needed for each scalar output
*
in order to help the solver find the exact instants
*
at which either of the two possible "equation switches"
*
One will be for the switch from eq. (1) to (2);
*
the other will be for eq. (2) to (3) and vice versa.
* otherwise
*
o No modes and nonsampled zero crossings will be used.
*
*/
ssSetNumModes(S, DYNAMICALLY_SIZED);
ssSetNumNonsampledZCs(S, DYNAMICALLY_SIZED);
/*
* options
*
*
*
o No mexFunctions and no problematic mxFunctions are called
so the exception free code option safely gives faster simulations.
o Scalar expansion of the inputs is desired.
*
this without the need to
*
mdlSetInputPortWidth functions.
The option provides
write mdlSetOutputPortWidth and
*/
ssSetOptions(S, ( SS_OPTION_EXCEPTION_FREE_CODE |
SS_OPTION_ALLOW_INPUT_SCALAR_EXPANSION));
} /* end mdlInitializeSizes */
The required S-function method mdlInitializeSampleTimes specifies the
S-function’s sample rates. The input argumentINHERITED_SAMPLE_TIME
passed to ssSetSampleTime specifies that this S-function
7-90