Request that the Simulink engine attempt to reduce a block
uint_T ssSetBlockReduction(SimStruct *S, uint_T flag)
Use this macro to ask the engine to reduce this block. A block is reducible if it can be eliminated from the model without affecting the model's behavior. The engine optimizes performance by skipping execution of reducible blocks during model simulation. In particular, the engine does not invoke the mdlStart, mdlUpdate, and mdlOutputs methods of reducible blocks. Further, the engine executes the mdlTerminate method of a reduced block only if the block has set the SS_OPTION_CALL_TERMINATE_ON_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.
A block must have the same number of outputs as inputs or no outputs.
A block cannot have inputs that are bus signals.
A block cannot have continuous state.
A block cannot have discrete states while the model is logging states.
A block cannot have zero crossings.
A block cannot have tunable parameters.
If a block fails to meet any of these criteria, the engine includes the block in the simulation regardless of whether the block has requested reduction.
For details, see the Block reduction reference page in Simulink documentation. Note, if you want to enable dead branch elimination, do not request block reduction. Instead, set the SS_OPTION_NONVOLATILE option using ssSetOptions.
Your S-function must invoke this macro before the engine would otherwise invoke the S-function's mdlStart method (see the callback flow diagram in Simulink Engine Interaction 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.