Basic Operation of the Model Coverage Tool
This example shows how to use the Configuration Parameters dialog to enable coverage for a Simulink® model and adjust the type of information that is reported.
Open Example Model
The sldemo_clutch
example model that ships with Simulink provides a good introduction to model coverage. This model contains several blocks that have intrinsic decisions, places where control flow can take more than one path.
Open Coverage Settings Dialog
You can find coverage settings under the Coverage pane of the Configuration Parameters dialog box. To navigate to this pane, from the Modeling tab, click Model Settings.
Enable Multiple Coverage Metrics
To enable coverage, select Enable coverage analysis. This setting enables the other options in the Coverage pane.
The Coverage metrics section controls the types of coverage information to collect during simulation.
The Structural coverage level drop-down menu allows you to select which structural coverage metrics to analyze during the simulation. These are ordered from the least rigorous (Block Execution) to the most rigorous (Modified Condition Decision (MCDC)).
For this example, select the Modified Condition Decision (MCDC) structural coverage level. The resulting report also includes decision and condition coverage results.
You can find additional coverage metrics under the Other metrics toggle panel. Click the black arrow to expand this panel and see the available metrics. Selecting all coverage metrics provides the most coverage information.
For this example, select Signal Range and Lookup Table.
Click OK to apply your selected settings and close the Coverage Settings dialog box.
Run Simulation and Explore Results
Once you enable coverage analysis for your model, simulate the model to collect coverage information. At the end of the simulation, the model Coverage Details pane opens, showing results for the model. Additionally, the model displays a coverage highlighting overlay that visually indicates coverage completeness for each object in the model.
Click the Run (Coverage) button to simulate the model and collect coverage.
Produce Coverage Report from Results Explorer
After the simulation completes, in the Coverage tab of the toolstrip, click Results Explorer. The Coverage Results Explorer offers various functionality for processing, displaying, and reporting coverage results for your model.
Click the Generate report link at the bottom of the Coverage Results Explorer window. This produces an HTML report of coverage information that displays within the built-in MATLAB® web browser.