Using Simulink    

Model Coverage Tool

The Model Coverage Tool determines the extent to which a model test case exercises simulation pathways through a model. The percentage of pathways that a test case exercises is called its model coverage. Model coverage is a measure of how thoroughly a test tests a model. The Model Coverage Tool therefore helps you to validate your model tests.

How the Model Coverage Tool Works

The Model Coverage Tool works by analyzing the execution of blocks that directly or indirectly determine simulation pathways through your model. If a model includes Stateflow charts, the tool also analyzes the states and transitions of those charts. During a simulation run, the tool records the behavior of the covered blocks, states, and transitions. At the end of the simulation, the tool reports the extent to which the run exercised potential simulation pathways through each covered block.

Coverage Analysis

The tool performs any or all of the following types of coverage analysis, depending on which coverage options you select:

Covered Blocks

The following table lists the types of Simulink blocks analyzed by the tool and the kind of coverage analysis performed for each block.

Block
Decision
Condition
MC/DC
LUT
1D Look-Up




2D Look-Up




Abs




Combin. Logic




Discrete-Time Integrator (when saturation limits are enabled)




Fcn (Boolean operators only)




For




If




Logic




MinMax




Multiport Switch




Rate Limiter

(relative to slew rates)



Relay




Saturation




Subsystem




Switch




SwitchCase




While




The tool also provides decision coverage for Stateflow states and events, state temporal logic decisions, and decision, condition, and MCDC coverage for Stateflow transitions.

Using the Model Coverage Tool

To develop effective tests with the Model Coverage Tool:

  1. Develop one or more test cases for your model (see Creating and Running Test Cases).
  2. Run the test cases to verify that the model behavior is correct.
  3. Analyze the coverage reports produced by Simulink.
  4. Using the information in the coverage reports, modify the test cases to increase their coverage or add new test cases that cover areas not covered by the current set of test cases.
  5. Repeat the preceding steps until you are satisfied with the coverage of your test set.


  Profiler Creating and Running Test Cases