When you simulate a Simulink® model, you can configure your model to provide visual results that allow you to see at a glance which objects recorded 100% coverage. After the simulation:
In the model window, model objects are highlighted in certain colors according to what coverage was recorded:
Light green indicates that an object received full coverage during testing.
Light red indicates that an object received incomplete coverage.
Gray indicates that an object was filtered from coverage.
Objects with no color highlighting received no coverage.
When you click a colored object, the Coverage Display Window provides details about the coverage recorded for that block. For subsystems and Stateflow® charts, the Coverage Display Window lists the summary coverage for all objects in that subsystem or chart. For other blocks, the Coverage Display Window lists specific details about the objects that did not receive 100% coverage.
The simulation highlights blocks that received the following types of model coverage:
To enable the model coverage colored diagram display:
In the Simulink Editor, select Analysis > Coverage > Settings to open the Coverage pane of the Configuration Parameters dialog box.
In the Coverage pane of the Configuration Parameters dialog box, select Enable coverage analysis and then select Entire System.
MCDC as the Structural
Select Objectives and Constraints under Other metrics.
On the Results pane of the Configuration Parameters dialog box, select Display coverage results using model coloring. This is the default setting.
After you have enabled the coverage coloring, simulate your model. In the model, you can see at a glance which objects received full, partial, or no coverage.
The following sections show examples of highlighted model objects in colors that correspond to the recorded coverage.
Green: Full Coverage. In this example, the Switch block received 100% coverage, as indicated by the green highlighting and the information in the Coverage Display Window.
Red: Partial Coverage. In this example, the control_logic Stateflow chart received the following coverage:
Inside the control_logic subsystem, the Pressure substate was
In the next example, in the Multiport Switch block, two of the data ports were never executed.
Gray: Filtered Coverage. In this example, the fuel_rate_control subsystem is highlighted in gray because it was filtered out of coverage recording.
After simulating the model and recording coverage, by default, the Coverage Display Window is the top-most visible window. When you click an object that recorded coverage, the Coverage Display Window displays details of the coverage recorded during simulation.
In the Coverage Display Window, you can:
Configure the window so it is not always the top-most visible window. Next to Always on top, click and removing the check.
Configure the window to display coverage information when you click an object that recorded coverage. Click and select Click.
Configure the window to display coverage information when you hover your cursor on an object that recorded coverage. Click and select Focus.
Close the window. Press Alt+F4.
Close the window and remove highlighting on the model. Select Display > Remove Highlighting.
The Coverage Display Window shows results with abbreviations. You can view expanded results in the Top-Level Model Coverage Report.
|maximum iterations exceeded|
|[switch] off threshold|
|switch on threshold|
|saturate on integer overflow|