Documentation Center

  • Trial Software
  • Product Updates

Simulink Optimizations and Model Coverage

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

Inline parameters

To transform tunable model parameters into constant values for code generation, in the Configuration Parameters dialog box, on the Optimization > Signals and Parameters pane, select Inline parameters. When you enable this option, you cannot change the values of block parameters during simulation.

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, on the Optimization pane, 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 Verification and Validation™ 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, on the Optimization pane, 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 with output flagged as a test point, such as when a Scope block is attached, that Switch block is not executed, and the model coverage data is incomplete. If you have a model with Switch blocks and you want to verify that the model coverage data is complete, clear Conditional input branch execution.

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

Was this topic helpful?