Documentation

Limit Model Checks

What Is a Model Advisor Exclusion?

To save time during model development and verification, you can limit the scope of a Model Advisor analysis of your model. You can create a Model Advisor exclusion to exclude blocks in the model from selected checks. You can exclude all or selected checks from:

  • Simulink® blocks

  • Stateflow® charts

After you specify the blocks to exclude, Model Advisor uses the exclusion information to exclude blocks from specified checks during analysis. By default, Model Advisor exclusion information is stored in the model SLX file. Alternately, you can store the information in an exclusion file.

To view exclusion information for the model, right-click in the model window or right-click a block and select Model Advisor > Open Model Advisor Exclusion Editor. The Model Advisor Exclusion Editor dialog box includes the following information for each exclusion.

FieldDescription
Rationale

A description of why this object is excluded from Model Advisor checks. The rationale field is the only field that you can edit.

Type

Whether a specific block is excluded or all blocks of a given type are excluded.

Value

Name of excluded block or blocks.

Check ID (s)

Names of checks for which the block exclusion applies.

    Note:   If you comment out blocks, they are excluded from both simulation and Model Advisor analysis.

Save Model Advisor Exclusions in a Model File

To save Model Advisor exclusions to the model SLX file, in the Model Advisor Exclusion Editor dialog box, select Store exclusions in model file. When you open the model SLX file, the model contains the exclusions.

Save Model Advisor Exclusions in Exclusion File

A Model Advisor exclusion file specifies the collection of blocks to exclude from specified checks in an exclusion file. You can create exclusions and save them in an exclusion file. To use an exclusion file, in the Model Advisor Exclusion Editor dialog box, clear Store exclusions in model file. The Exclusion File field is enabled.

The Exclusion File contains the exclusion file name and location associated with the model. You can use an exclusion file with several models. However, a model can have only one exclusion file.

Unless you specify a different folder, the Model Advisor saves exclusion files in the current folder. The default name for an exclusion file is <model_name>_exclusions.xml.

If you create an exclusion file and save your model, you attach the exclusion file to your model. Each time that you open the model, the blocks and checks specified in the exclusion file are excluded from the analysis.

Create Model Advisor Exclusions

  1. In the model window, right-click a block and select Model Advisor. Select the menu option for the type of exclusion that you want to do.

    To Select Model Advisor >
    Exclude the block from all checks.

    Exclude block only > All Checks

    Exclude all blocks of this type from all checks.

    Exclude all blocks with type <block_type> > All Checks

    Exclude the block from selected checks.
    • Exclude block only > Select Checks.

    • In the Check Selector dialog box, select the checks. Click OK.

    Exclude all blocks of this type from selected checks.
    • Exclude all blocks with type <block_type> > Select Checks.

    • In the Check Selector dialog box, select the checks. Click OK.

    Exclude the block from all failed checks. After a Model Advisor analysis, this option is available.

    Exclude block only > Only failed checks

    Exclude all blocks of this type from all failed checks. After a Model Advisor analysis, this option is available.

    Exclude all blocks with type <block_type> > Only failed checks

    Exclude the block from a failed check. After a Model Advisor analysis, this option is available.

    Exclude block only > <name of failed check>

    Exclude all blocks of this type from a failed check. After a Model Advisor analysis, this option is available.

    Exclude all blocks with type <block_type> > <name of failed check>

  2. In the Model Advisor Exclusion Editor dialog box, to:

    • Store exclusions in model file, select Store exclusions in model file. Click OK or Apply to create the exclusion.

    • Save the information to an exclusion file, clear Store exclusions in model file. Click OK or Apply. If this exclusion is the first one, a Save Exclusion File as dialog box opens. In this dialog box, click Save to create a exclusion file with the default name <model_name>_exclusions.xml in the current folder. Optionally, you can select a different file name or location.

  3. Optionally, if you want to change the exclusion file name or location:

    1. In the Model Advisor Exclusion Editor dialog box, clear Store exclusions in model file.

    2. In the Model Advisor Exclusion Editor dialog box, select Change.

    3. In the Change Exclusion File dialog box, select Save as.

    4. In the Save Exclusion File dialog box, navigate to the location that you want and enter a file name. Click Save.

    5. In the Model Advisor Exclusion Editor dialog box, select OK or Apply to create the exclusion and save the information to an exclusion file.

You can create as many Model Advisor exclusions as you want by right-clicking model blocks and selecting Model Advisor. Each time that you create an exclusion, the Model Advisor Exclusion Editor dialog box opens. In the Rationale field, you can specify a reason for excluding blocks or checks from the Model Advisor analysis. The rationale is useful to others who review your model.

If you create an exclusion file and save your model, you attach the exclusion file to your model. Each time that you open the model, the blocks and checks specified in the exclusion file are excluded from the analysis.

Review Model Advisor Exclusions

You can review the exclusions associated with your model. Before or after a Model Advisor analysis, to view exclusions information:

  • Right-click in the model window or right-click a block and select Model Advisor > Open Model Advisor Exclusion Editor. The Model Advisor Exclusion Editor dialog box lists the exclusions for your model.

  • On the Model Advisor toolbar, select Settings > Preferences. In the Model Advisor Preferences dialog box, select Show Exclusion tab. In the right pane of the Model Advisor window, select the Exclusions tab to display checks that are excluded from the Model Advisor analysis.

  • In the model window, select Analysis > Model Advisor > Model Advisor to open the Model Advisor.

    1. On the Model Advisor window toolbar, select Highlighting > Highlight Exclusions. By default, this menu option is selected.

    2. In the Model Advisor window, click Enable highlighting ( ).

    3. In the left pane of the Model Advisor window, select a check. The blocks excluded from the check appear in the model window, highlighted in gray with a black border.

After the Model Advisor analysis, you can view exclusion information for individual checks in the:

  • HTML report. Before the analysis, in the Model Advisor window, make sure that you select the Show report after run check box.

  • Model Advisor window. In the left pane of the Model Advisor window, select By Product > Simulink > < name of check >. If the By Product folder is not displayed, select Show By Product Folder from the Settings > Preferences dialog box.

If the checkThe HTML report and Model Advisor window
Has no exclusions rules applied. Show that no exclusions were applied to this check.
Does not support exclusions.Shows that the check does not support exclusions.
Is excluded from a block.Lists the check exclusion rules.

Manage Exclusions

Save Exclusions in a File

  1. In the Model Advisor Exclusion Editor dialog box, clear Store exclusions in model file and click OK or Apply. If this exclusion is the first one, a Save Exclusion File as dialog box opens. In this dialog box, click Save to create an exclusion file with the default name <model_name>_exclusions.xml in the current folder. Optionally, you can select a different file name or location.

  2. If you want to change the exclusion file name or location:

    1. In the Model Advisor Exclusion Editor dialog box, select Change.

    2. In the Change Exclusion File dialog box, select Save as.

    3. In the Save Exclusion File dialog box, navigate to the location that you want and enter a file name. Click Save.

    4. In the Model Advisor Exclusion Editor dialog box, select OK or Apply to create the exclusion and save the information in an exclusion file.

Load an Exclusion File

To load an existing exclusion file for use with your model:

  1. In the Model Advisor Exclusion Editor dialog box, clear Store exclusions in model file. Click Change.

  2. In the Change Exclusion File dialog box, click Load.

  3. Navigate to the exclusion file that you want to use with your model. Select Open.

  4. In the Model Advisor Exclusion Editor dialog box, click OK to associate the exclusion file with your model.

Detach an Exclusion File

To detach an exclusion file associated with your model:

  1. In the Model Advisor Exclusion Editor dialog box, clear Store exclusions in model file. Click Change.

  2. In the Change Exclusion File dialog box, click Detach.

  3. In the Model Advisor Exclusion Editor dialog box, click OK.

Remove an Exclusion

  1. In the Model Advisor Exclusion Editor dialog box, select the exclusions that you want to remove.

  2. Click Remove Exclusion.

Add a Rationale to an Exclusion

You can add text that describes why you excluded a particular block or blocks from selected checks during Model Advisor analysis. A description is useful to others who review your model.

  1. In the Model Advisor Exclusion Editor dialog box, double-click the Rationale field for the exclusion.

  2. Delete the existing text.

  3. Add the rationale for excluding this object.

Programmatically Specify an Exclusion File

You can use the MAModelExclusionFile method to programmatically specify the name of an exclusion file.

  1. Use get_param to obtain the model object. For example, for sldemo_mdladv:

    mo = get_param('sldemo_mdladv','Object')

  2. Use MAModelExclusionFile to specify the name of an exclusion file. For example, to specify exclusion file my_exclusion.xml in S:\work:

    mo.MAModelExclusionFile = ['S:\work\','my_exclusion.xml']

  3. Open the Model Advisor Exclusion Editor dialog box. The Exclusion File field contains the specified exclusion file and path.

Related Examples

More About

Was this topic helpful?