Before starting a model coverage analysis, you specify several model coverage recording and reporting options. In the Simulink® Editor, select Analysis > Coverage > Settings. The Coverage Settings dialog box opens, with the Coverage tab displayed.
The following sections describe the settings for each tab in the Coverage Settings dialog box.
On the Coverage tab, select the model coverages calculated during simulation.
Instructs the software to gather and report the model coverages that you specify during simulation. When you select the Coverage for this model option, the Select Subsystem button and the Coverage metrics section of the Coverage pane become available.
Specifies the subsystem for which the software gathers and reports coverage data. When you select the Coverage for this model option, the software, by default, generates coverage data for the entire model.
To restrict coverage reporting to a particular subsystem:
On the Coverage tab, click Select Subsystem.
The Subsystem Selection dialog box opens.
In the Subsystem Selection dialog box, select the subsystem for which you want to enable coverage reporting and click OK.
Causes the software to record and report the model coverages that you specify for referenced models during simulation. When you select the Coverage for referenced models option, the Select Models button and the Coverage metrics section of the Coverage tab become available.
Click to specify the referenced models for which the Simulink Verification and Validation™ software
records and reports coverage data. When you select Coverage
for referenced models, the software, by default, generates
coverage data for all referenced
models where the simulation mode of the Model block
is set to
To enable coverage reporting for particular referenced models:
On the Coverage pane, click Select Models.
In the Select Models for Coverage Analysis dialog box, select the referenced models for which you want to record coverage.
The icon next to the model name indicates the simulation mode
for that referenced model. You can select only referenced models whose
simulation mode is set to
If you have multiple Model blocks that reference
the same model and whose simulation mode is set to
selecting or clearing one check box for that model causes the check
boxes for all normal mode instances
of that model to be selected or cleared.
To close the Select Models for Coverage Analysis dialog box and return to the Coverage Settings dialog box, click OK.
Enables coverage for any external functions called by MATLAB® functions in your model. The MATLAB functions may be defined in a MATLAB Function block or in a Stateflow® chart.
You must select either Coverage for this model or Coverage for referenced models to select the Coverage for MATLAB files option.
Enables coverage for C/C++ S-Function blocks in your model. If you select this option, coverage metrics are reported for the S-Function blocks and the C/C++ code in those blocks. For more information, see Generate Coverage Report for S-Function.
You must select either Coverage for this model or Coverage for referenced models to select the Coverage for S-Functions option.
Select the types of test case coverage analysis that you want the tool to perform (see Types of Model Coverage). The Simulink Verification and Validation software gathers and reports those types of coverage for the subsystems, models, and referenced models that you specify.
On the Results tab, select the destination for model coverage results.
Accumulates model coverage results from successive simulations
and saves the coverage results to a
by default. You specify the name and output folder of the
in the Output section. To collect model coverage
results for multiple simulations in one
in the workspace, select this option and Save cumulative
results in workspace variable. For more information, see Cumulative Coverage Data.
Clears the currently loaded cumulative coverage data. If cumulative coverage data is saved in a workspace variable, rename that workspace variable to avoid overwriting it in future simulations.
Loads existing coverage data from a
Accumulates and saves the results of successive simulations
cvdata object in the workspace. Specify the
workspace variable name in cvdata object name.
For more information, see Cumulative Coverage Data.
Saves the results of the last simulation run in a
in the workspace. Specify the workspace variable name in cvdata
Increments the name of the coverage data object variable that saves the coverage data from each previous simulation run. Therefore the current simulation run does not overwrite the results of the previous run.
Records results up to the point at which you pause the simulation for the first time. When you resume simulation and later pause or stop, the model coverage report reappears, with coverage results up to the current pause or stop time.
After simulation, colors model objects according to their level of coverage. Objects highlighted in light green receive full coverage during testing. Objects highlighted in light red receive incomplete coverage. See View Coverage Results in a Model.
The folder where you save the coverage data. The default location
slcov_output/$ModelName$ in the current folder.
the name of the model.
Saves the coverage data to a
.cvt file with
the name that you specify in Data file name.
The default data file name is
the name of the model.
On the Reporting tab, specify whether the model coverage tool generates an HTML report and what data the report includes.
Creates an HTML report containing the coverage data collected from simulation. Click the Settings button to select various reporting options.
Specifies whether to open the generated HTML coverage report in a MATLAB browser window at the end of model simulation.
On the Reporting tab, for Detailed Report, click Settings to open the Settings dialog box. In the Settings dialog box, choose model coverage report options.
Include each test in the model summary
At the top of the HTML report, the model hierarchy table includes columns listing the coverage metrics for each test. If you do not select this option, the model summary reports only the total coverage.
Produce bar graphs in the model summary
Causes the model summary to include a bar graph for each coverage result for a visual representation of the coverage.
Use two color bar graphs (red, blue)
Red and blue bar graphs are displayed in the report instead of black and white bar graphs.
Display hit/count ratio in the model summary
Reports coverage numbers as both a percentage and a ratio, for example, 67% (8/12).
Exclude fully covered model objects from report
The coverage report includes only model objects that the simulation does not cover fully, useful when developing tests, because it reduces the size of the generated reports.
Exclude fully covered model object details from report
If you choose to include fully covered model objects in the report, the report does not include the details of the fully covered model objects
Include cyclomatic complexity numbers in summary
Includes the cyclomatic complexity (see Types of Model Coverage) of the model and its top-level subsystems and charts in the report summary. A cyclomatic complexity number shown in boldface indicates that the analysis considered the subsystem itself to be an object when computing its complexity. Boldface text can occur for atomic and conditionally executed subsystems andStateflow Chart blocks.
Include cyclomatic complexity numbers in block details
Includes the cyclomatic complexity metric in the block details section of the report.
Filter Stateflow events from report
Excludes coverage data on Stateflow events.
Filter Execution metric from report
Excludes coverage data on Execution metrics
Include model coverage results from successive simulations in the report. For more information, see Cumulative Coverage Data.
Include in the report only the results of the most recent simulation run.
Specify names of coverage data objects from previous runs to include in the current report along with the current coverage data. Each entry creates a new set of columns in the report.
On the Options tab, select options for model coverage reports.
The Treat Simulink logic blocks as short-circuited option
applies only to condition and MCDC coverage. If you select this option,
coverage analysis treats Simulink logic blocks as if the block
ignores remaining inputs when the previous inputs alone determine
the block output. For example, if the first input to a Logical Operator block whose Operator parameter
AND is false, MCDC coverage analysis
ignores the values of the other inputs when determining MCDC coverage
for a test case.
If you enable this feature and logic blocks are short-circuited while collecting model coverage, you may not be able to achieve 100% coverage for that block.
To generate code from a model, select this option. Also select this option for where you want the MCDC coverage analysis to approximate the degree of coverage that your test cases achieve for the generated code (most high-level languages short-circuit logic expressions).
Note: A test case that does not achieve full MCDC coverage for non-short-circuited logic expressions might achieve full coverage for short-circuited expressions.
Select this option to warn you at the end of the simulation that the model contains blocks that require coverage analysis but are not currently covered by the tool.
To achieve faster execution during model simulation and in generated code, in the Configuration Parameters dialog box, on the All Parameters tab, 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 enable 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.
The model coverage report identifies any reduced blocks. For an example of a reduced blocks report, see Block Reduction.
To record model coverage only inside a specified simulation time interval, check Restrict recording to interval and define a Start time and Stop time. Model coverage is not recorded for simulation times outside Start time and Stop time. If your simulation starts at a time greater than or equal to Stop time, model coverage is not recorded.
For example, you might want to restrict model coverage recording if your model has transient effects early in simulation, or if you need model coverage reported only for a particular model operation.
Specify the value of absolute tolerance for relational boundary coverage of floating point inputs. For more information, see Relational Boundary Coverage.
Specify the value of relative tolerance for relational boundary coverage of floating point inputs. For more information, see Relational Boundary Coverage.
On the Filter tab, enter the file name that specifies the model objects to be excluded from model coverage collection. You can use the same filter file for multiple models.
If you enable coverage for this model, you can create a filter file or open an existing filter file. In this filter file, you can then specify objects that you want to exclude from model coverage collection during simulation.
In the Filename field, enter the full path
to the file that specifies the model objects to be excluded from model
coverage collection. You can also click Browse to
navigate to the file. You can only open files that have the valid
If the current model has a filter file already associated with it, the file name appears in the Filename field, and the Open in Filter Viewer link is displayed. To edit the coverage filter settings, click this link.
If the Open in Filter Viewer link is unavailable, go to the Coverage tab. To enable coverage for the current model, select Coverage for this model. You can then enter the filter file name and edit the file.