View Coverage Results in a Model

Overview of Model Coverage Highlighting

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:

Enable Coverage Highlighting

To enable the model coverage colored diagram display:

  1. In the Simulink Editor, select Analysis > Coverage > Settings to open the Coverage Settings dialog box.

  2. In the Coverage tab, select Coverage for this model. Click Select Subsystem to open the Subsystem Selection dialog box. Select the top-level model sldemo_fuelsys so that all subsystems are included in coverage analysis. Close the Subsystem Selection dialog box.

  3. In the Coverage Settings dialog box, under the Coverage metrics pane, select Decision, Condition, MCDC, and Simulink Design Verifier.

  4. Select the Results tab.

  5. 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.

Highlighted Coverage Results

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:

  • Decision: 25%

  • Condition: 21%

  • MCDC: 0%

Inside the control_logic subsystem, the Pressure substate was never fail.

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.

View Results in Coverage Display Window

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.

Abbreviations in Coverage Results

The Coverage Display Window shows results with abbreviations. You can view expanded results in the Top-Level Model Coverage Report.

AbbreviationMeaning
CNDcondition
ENBLenable
FCALLfunction call
INinput
LGClogic
LLlower limit
MX ITERmaximum iterations exceeded
NAnot applicable
OffThresh[switch] off threshold
OnThreshswitch on threshold
OUToutput
SOsaturate on integer overflow
TBLlookup table
THRESHthreshold
TItest interval
TOtest objective
TPtest point
TRIGtrigger
Uinput
ULupper limit
X
  • integration result (Discrete-Time Integrator block)

  • slew rate (Rate Limiter block)

Was this topic helpful?