View Coverage Results in Simulink Canvas
Overview of Model Coverage Highlighting
When you simulate a Simulink® model, you can configure your model to provide visual results that enable you to see which objects failed to record 100% coverage. After the simulation:
In the model window, model objects are highlighted in certain colors according to what coverage was recorded:
Green indicates that an object received full coverage during simulation.
Green with a dashed border indicates that an object had incomplete coverage that you justified.
Red indicates that an object received incomplete coverage.
Gray with a dashed border indicates that you excluded an object from coverage.
Objects with no color highlighting did not receive coverage.
When you place your cursor over a colored object, you see a tooltip with details about the coverage recorded for that block. For subsystems and Stateflow® charts, the coverage tooltip lists the summary coverage for all objects in that subsystem or chart. For other blocks, the coverage tooltip lists specific details about the objects that did not receive 100% coverage.
The simulation highlights blocks that received these types of model coverage:
Enable Coverage Highlighting
Your model will receive coverage highlighting if you simulate the model using the Run button. After simulation, you can see which model objects received full, partial, or no coverage.
If you simulate without the Run button, or load coverage data,
you can click Highlight model with coverage results in the Results
Explorer to enable model coverage highlighting. To open the results explorer, in the
Apps tab, select Coverage Analyzer. Then
click Results Explorer. For more information, see Accessing Coverage Data from the Results Explorer. You can also use
cvmodelview to enable model highlighting.
Highlighted Coverage Results
Examples of highlighted model objects in colors that correspond to the recorded coverage are:
Green: Full Coverage. The Switch block received 100% coverage, as indicated by the green highlighting and the information in the coverage tooltip.
Green with Dashed Border: Justified Coverage. The Relational Operator block received justified coverage, as indicated by the green highlighting with a dashed border and the information in the coverage tooltip.
Red: Partial Coverage. The
Stateflow chart received this coverage:
Stateflow chart, the
gear_state substate was never
Two of the data ports in the Multiport Switch block were never executed.
Gray with Dashed Border: Filtered Coverage. The fuel_rate_control subsystem is highlighted in gray because it was excluded from coverage recording.
No Coloring: Coverage Not Recorded. The Inport block is not highlighted because it does not receive coverage recording.
View Coverage Details
After you highlight coverage results on the model, you can view coverage details for each model element in the Coverage Details window. To open the Coverage Details window, click the Coverage Details icon in the lower-left corner of the Simulink block diagram, and then click Open Coverage Details:
You can then click a model object to view its coverage details.