Simulink Optimizations and Model Coverage

In the Configuration Parameters dialog box, there are three Simulink® optimization parameters that can affect your model coverage data:

Inlined parameters

To transform tunable model parameters into constant values for code generation, in the Configuration Parameters dialog box, on the Math and Data Types pane, set Default parameter behavior to Inlined.

When the parameters are transformed into constants, Simulink may eliminate certain decisions in your model. You cannot achieve coverage for eliminated decision, so the coverage report displays 0/0 for those decisions.

Block reduction

To achieve faster execution during model simulation and in generated code, in the Configuration Parameters dialog box, select the Block reduction parameter. The Simulink software collapses certain groups of blocks into a single, more efficient block, or removes them entirely.

One of the model coverage options, Force block reduction off, allows you to ignore the Block reduction parameter when collecting model coverage.

If you do not select the Block reduction parameter, or if you select Force block reduction off, the Simulink Coverage™ software provides coverage data for every block in the model that collects coverage.

If you select the Block reduction parameter and do not set Force block reduction off, the coverage report lists the reduced blocks that would have collected coverage.

Conditional input branch execution

To improve model execution when the model contains Switch and Multiport Switch blocks, in the Configuration Parameters dialog box, select Conditional input branch execution. If you select this parameter, the simulation executes only blocks that are required to compute the control input and the data input selected by the control input.

When Conditional input branch execution is enabled, instead of executing all blocks driving the Switch block input ports at each time step, only the blocks required to compute the control input and the data input selected by the control input execute.

Several considerations affect or limit Switch block optimization:

  • Only blocks with -1 (inherited) or inf (Constant) sample time can be optimized.

  • Blocks with outputs flagged as test points cannot be optimized.

  • Multirate blocks cannot be optimized.

  • Blocks with states cannot be optimized.

  • Only S-functions with the SS_OPTION_CAN_BE_CALLED_CONDITIONALLY option enabled can be optimized.

For example, if your model has a Switch block and an input is flagged as a test point, such as when a Scope block is attached, the blocks feeding that input will always be executed for model coverage regardless of the switch position. If you have a model with Switch blocks and you want to ensure that the model coverage data is processing each input at every step, clear Conditional input branch execution.

Conditional input branch execution does not apply to Stateflow® charts.