Main Content

Cumulative Coverage Data

When you simulate your model with coverage enabled, you can run more than one simulation to get a cumulative result. The cumulative result shows the percentage of coverage in your model summed over all the simulations. Use one of the following methods to generate cumulative coverage results:

Collect Coverage by Clicking the Run Button to Simulate Your Model

When you run more than one simulation with coverage enabled, Simulink® Coverage™ updates and displays coverage data for each simulation, as well as the aggregated total. You see these results in the Coverage Details pane and in the Coverage Results Explorer. You can change this behavior in the Configuration Parameters dialog box. Click Coverage and, in the right pane, under Advanced parameters, select or deselect the Enable cumulative data collection parameter. By default, this parameter is selected.

Note

If you make changes to the model or block settings between simulations that affect the type or number of coverage objective outcomes, the cumulative coverage data resets. Save your coverage results to a file if you make changes of this nature and want to access the previous results.

For more information about managing cumulative results, see Access, Manage, and Aggregate Coverage Results.

Collect Coverage Using the Multiple Simulations Pane

You can use the Multiple Simulations pane to collect coverage for two or more simulations. In Simulink, on the Simulation tab, under Prepare, click Multiple Simulations. In this pane, you can create design studies, add simulation scenarios to your design studies, and then run all the scenarios as a series of simulations. If you have Parallel Computing Toolbox™, the simulations run in parallel. When you collect coverage this way, Simulink Coverage updates and displays data for each simulation as well as the aggregated total. You see the coverage results in the Coverage Details pane and in the Coverage Results Explorer. For an example, see Collect Coverage for Multiple Simulations by Using Design Studies

Collect Coverage for Multiple Tests Using the Test Manager in Simulink Test

You can use the Test Manager in Simulink Test™ to author test scenarios. In your test file, under Coverage Settings, select Record coverage for system under test. Then select the coverage metrics you want to collect. When you collect coverage this way, the Test Manager shows the cumulative coverage summary for your test file under the Aggregated Coverage Results section. If you click the model name in the Test Manager coverage summary, it highlights your model with those coverage results. The Test Manager also provides a link to the coverage report. For an example, see Analyze Model Coverage by Using the Test Manager in Simulink Test.

Collect Coverage Programmatically and Aggregate Results

You can collect your coverage data programmatically by using sim or parsim, and then aggregate the results manually using the overloaded + operator. You can then save and load coverage results by using cvsave and cvload. For more information, see Operations on Coverage Data.

See Also

| | | |

Related Topics