Writing S-Functions | ![]() ![]() |
Request that Simulink attempt to reduce a block.
Syntax
Arguments
S
SimStruct representing an S-Function block.
flag
If true, Simulink should attempt to reduce this block.
Description
Use this macro to ask Simulink to reduce this block. A block is reducible if it can be eliminated from the model without affecting the model's behavior. Simulink optimizes performance by skipping execution of reducible blocks during model simulation. In particular, Simulink does not invoke the mdlStart, mdlUpdate, and mdlOutputs methods of reducible blocks. Further, Simulink executes the mdlTerminate method of a reduced block only if the block has set the SS_OPTION_CALL_TERMINATE_AT_EXIT
option before the simulation loop has begun, using ssSetOptions.
A block must meet certain criteria to be considered reducible. For example, a block must have at least one input, must have the same number of outputs as inputs or no outputs, and none of the block's inputs can be a bus signal. If a block fails to meet any of these criteria, Simulink includes the block in the simulation regardless of whether the block has requested reduction.
Your S-function must invoke this macro before Simulink would otherwise invoke the S-function's mdlStart method (see the callback flow diagram in How Simulink Interacts with C S-Functions). This means your S-function must invoke this macro no later than its mdlSetWorkWidths method to be considered a candidate for block reduction.
Languages
See Also
![]() | ssSampleAndOffsetAreTriggered | ssSetCallSystemOutput | ![]() |