Main Content

Model Coverage

Model coverage helps you verify your model by analyzing the behavior of covered objects, states, and transitions and measuring the extent to which a simulation exercises the potential simulation pathways through each covered object in the model. You can collect model coverage for models by enabling coverage on the model and then starting the simulation, or measure the percentage of coverage objectives that a test case satisfies by creating test cases using the Test Manager in Simulink® Test™. For a detailed list of the objects that you can measure model coverage for, see Model Objects That Receive Coverage.

Model Coverage Overview

To enable coverage on your model, in the Modeling tab, click Model Settings. In the Configuration Parameters Dialog Box, in the left pane, click Coverage, then select Enable coverage analysis.

You can analyze models for various coverage metrics, such as block execution coverage, decision coverage, condition coverage, and modified condition/decision coverage. For a full list of the types of coverage that model coverage performs, see Types of Model Coverage.

Simulink Coverage™ can only collect model coverage for a model when you simulate in normal mode.

If you have an Embedded Coder® license, you can also measure code coverage for code generated from models in software-in-the-loop (SIL) mode or processor-in-the-loop (PIL) mode. For the types of coverage that code coverage performs, see Types of Code Coverage. For an example of how to enable code coverage, see Code Coverage for Models in Software-in-the-Loop (SIL) Mode and Processor-in-the-Loop (PIL) Mode.

Types of Coverage Data

When you simulate your model with coverage enabled using the Run button, Simulink Coverage opens the Coverage Details pane and displays a coverage report.

You can also manually generate a model coverage report that shows the results of the model coverage analysis. The report contains a summary as well as coverage details for each object that you analyzed, depending on the blocks that your model contains and the coverage metrics that you select.

In both cases, the type of coverage report displayed depends on what format your coverage data is in, and the format of your coverage data depends on what your model contains.

Coverage Data

If you analyze one model that does not call external code files or contain model references, Simulink Coverage saves coverage data in cvdata objects. When you generate a coverage report from a cvdata object, you see the top-level model coverage report for your model. This report contains details for each analyzed object in your model.

Coverage Data Group

If your model calls external code files or contains model references, Simulink Coverage returns the coverage data in a cvdatagroup object which contains a cvdata object for each model or file. The model summary coverage report links to a coverage report for each cvdata object contained in the cvdatagroup object.

See Also

|

Related Topics