Main Content

Model Coverage

Model coverage helps you validate your model tests by measuring how thoroughly the model objects are tested. Model coverage calculates how much a model test case exercises simulation pathways through a model. It is a measure of how thoroughly a test case tests a model and the percentage of pathways that a test case exercises.

Model coverage analyzes the execution of the following types of model objects that directly or indirectly determine simulation pathways through your model:

  • Simulink® blocks

  • Models referenced in Model blocks

  • The states and transitions of Stateflow® charts

During a simulation run, the tool records the behavior of the covered objects, 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 object in the model.

For the types of coverage that model coverage performs, see Types of Model Coverage. For an example of a model coverage report, see Top-Level Model Coverage Report.

The Simulink Coverage™ software can only collect model coverage for a model if its simulation mode is set to Normal. If the simulation mode is set to any other mode, model coverage is not measured during simulation.

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