Documentation

Create, Edit, and View Coverage Filter Rules

Create and Edit Coverage Filter Rules

Create a Coverage Filter Rule

To create a coverage filter rule:

  1. In the Coverage Settings dialog box, enable model coverage.

  2. In the model window, right-click a model object and select Coverage > Exclude.

The following table lists the Exclude menu options. Depending on which option you select, the Type field is set for the coverage filter rule you selected. You cannot override the value in the Type field.

If you select Coverage >The rule type is

Exclude this block

by block path

Exclude all blocks with type <block_type>

by block type

Exclude all blocks with type MATLAB Function

by block type

Exclude all blocks with type Truth Table

by block type

Exclude subsystem with all dependents

by subsystem

Exclude referenced library: <library_name>

by library reference

Exclude subsystem with all descendants

by subsystem

Exclude chart with all descendants

by chart

Exclude mask type <mask name>

by mask type

Exclude state with all descendants

by state

Exclude this transition

by transition

Exclude temporal event <event_name>

by temporal event

Select the Filtering Mode

When you create a filtering rule, the default filtering mode is Excluded. Excluded objects do not appear in the coverage reports. You can also set the filtering mode to Justified. Justified blocks appear as achieving 100% coverage.

For more information, see Coverage Filtering.

Add Rationale to a Coverage Filter Rule

Optionally, you can add text that describes why you want to exclude that object or objects from coverage recording. This information can be useful to others who review the coverage for your model. When you add a coverage filter rule, the Coverage Filter Viewer opens. To add the rationale:

  1. Double-click the Rationale field for the rule.

  2. Delete the existing text.

  3. Add the rationale for excluding this object.

The following graphic shows examples of text in the Rationale field.

    Note:   The Rationale field and Mode field are the only coverage filter rule fields that you can edit in the Coverage Filter Viewer.

Create Additional Coverage Filter Rules

From the Coverage Filter Viewer, you can navigate back to the model to create as many coverage filter rules as you need. To return to the model window, click Add new rule by right-clicking in the model.

For each rule that you add, the Coverage Filter Viewer opens so that you can specify a rationale for excluding that object from coverage.

Save Coverage Filter to File

After you define the coverage filter rules, save the rules to a file so that you can reuse them with this model or with other models. By default, coverage filter files are named <model_name>_covfilter.cvf.

In the Coverage Filter Viewer:

  1. In the File name field, specify a file name for the filter file or accept the default file name.

  2. To save the coverage filter rules to that file, click Apply.

If you make multiple changes to the coverage filter rules, apply the changes to the coverage filter file each time.

Attach Coverage Filter File to Model

Attach a coverage filter file to your model so that each time you open the model, the coverage filter rules apply when you simulate your model.

In the Coverage Filter Viewer:

  1. Select Attach file to model.

  2. Click Apply.

    Note:   You can also attach a coverage filter file to your model in the Coverage Settings dialog box, on the Filter tab.

You can have only one coverage filter file attached to a model at a time. If you attach a different coverage filter file, the newly attached file replaces the previously attached file.

Two or more models can have the same coverage filter file attached. If a model has an attached filter file that contains coverage filter rules for specific objects in a different model, those rules are ignored during coverage recording.

Update the Report with the Current Filter Settings

If you change the filtering settings or add filters after you simulate the model, you can update the coverage report and model highlighting without resimulating the model. After you have simulated the model, in the Coverage Filter Viewer:

  1. Select Attach to current data.

  2. Click Update Report.

View Coverage Filter Rules in Your Model

Whenever you define a coverage filter rule or remove an existing coverage filter rule, the Coverage Filter Viewer opens. This dialog box lists all the coverage filter rules for your model. For more information, see Coverage Filter Viewer.

To open the Coverage Filter Viewer, right-click anywhere in the model window and select Coverage > Open Filter Viewer.

If you are inside a subsystem, you can view any coverage filter rule attached to the subsystem. To open the Coverage Filter Viewer, right-click any object inside the subsystem and select Coverage > Show filter parent.

View Coverage Filter Rules in Your Model

Whenever you define a coverage filter rule or remove an existing coverage filter rule, the Coverage Filter Viewer opens. This dialog box lists all the coverage filter rules for your model. For more information, see Coverage Filter Viewer.

To open the Coverage Filter Viewer, right-click anywhere in the model window and select Coverage > Open Filter Viewer.

If you are inside a subsystem, you can view any coverage filter rule attached to the subsystem. To open the Coverage Filter Viewer, right-click any object inside the subsystem and select Coverage > Show filter parent.

Was this topic helpful?