Select and Run Model Advisor Checks

Model Advisor Overview

The Model Advisor checks a model or subsystem for conditions and configuration settings including conditions that cause inaccurate or inefficient simulation of the system that the model represents. If you have Simulink® Coder™ or Simulink Check™, the Model Advisor can check for model settings that cause generation of inefficient code or code unsuitable for safety-critical applications. If you have Simulink Design Verifier™, the Model Advisor can check for design errors. If an error is reported, you can view a test case that reproduces the error.

The Model Advisor produces a report that lists the suboptimal conditions or settings that it finds, and proposes better model configuration settings where appropriate.

Software is inherently complex and may not be free of errors. Model Advisor checks might contain bugs. MathWorks® reports known bugs brought to its attention on its Bug Report system at https://www.mathworks.com/support/bugreports/. The bug reports are an integral part of the documentation for each release. Examine periodically all bug reports for a release as such reports may identify inconsistencies between the actual behavior of a release you are using and the behavior described in this documentation.

While applying Model Advisor checks to your model increases the likelihood that your model does not violate certain modeling standards or guidelines, their application cannot guarantee that the system being developed will be safe or error-free. It is ultimately your responsibility to verify, using multiple methods, that the system being developed provides its intended functionality and does not include any unintended functionality.

Run Model Advisor Checks

  1. Open the Model Advisor example model sldemo_mdladv.

  2. Start the Model Advisor. In the Model Editor, select Analysis > Model Advisor > Model Advisor or Model Advisor Dashboard. The dashboard preserves the checks used in the previous analysis. You can run these same checks without reloading them, saving analysis time.

  3. In the Model Explorer, in the Contents pane, select Advice for model. model is the name of the model that you want to check.

  4. In the Model Editor, right-click the subsystem that you want to check, and in the context menu select Model Advisor.

  5. At the command prompt, enter modeladvisor('sldemo_mdladv').

  6. In the System Selector dialog box, select the model or system that you want to analyze, for example, sldemo_mdladv. Click OK.

  7. In the left pane of the Model Advisor, expand the By Product and By Task folders to display the subfolders. The By Task folders display checks related to specific tasks. For example, to run checks to determine if your model is configured for simulation accuracy, select checks in the Simulation Accuracy folder.

  8. The By Product folders display checks available with specific products.

  9. Select Settings > Preferences to control the folders that are displayed.

  10. In the left pane, select the checks to run on your model. For example, select the checks in the By Product > Simulink folder.

Display Check Results

To display an HTML report of check results:

  1. In the right pane of the Model Advisor, select Show report after run.

  2. On the toolbar, click Run Selected Checks or . After the Model Advisor runs the checks, the results appear in a browser if you selected the option to show the report.

    Check status results include:

    • Pass ─ Check did not identify issues.

    • D-Pass ─ Dependent on configuration parameter. Check did not identify issues.

    • Warn ─ Check has identified issues.

    • Fail ─ Check fails to execute.

  3. Review the results and fix the warnings or failures as desired.

Set Model Advisor Window Preferences

To open the Model Advisor Preferences dialog box, on the toolbar, select Settings > Preferences.

ActionSelect

Display the check available for each product.

Show By Product Folder

Display checks related to specific tasks.

Show By Task Folder

Display the check Title, TitleId, and location of the MATLAB® source code for the check.

Show Source Tab. The Source tab displays check source information.

Display checks that are excluded from the Model Advisor analysis.

Show Exclusion tab. The Exclusions tab displays checks that are excluded from the Model Advisor analysis.

Display and Run Checks

ActionModel Advisor Options

Display checks related to specific tasks.

Select By Task.

Display the check available for each product.

Select By Product.

Find checks and folders.

In the Find: field, enter text and click the Find Next button (). The Model Advisor searches in check names, folder names, and analysis descriptions.

Reset the status of the checks to not run.

In the left pane, right-click Model Advisor and select Reset.

Select some or all of the checks.

Select the check and folder check boxes.

Run the selected checks.

On the toolbar of the Model Advisor window, click Run selected checks ().

Run the Same Set of Checks Consistently

To consistently run the same set of checks on your model, use the Model Advisor dashboard.

ActionOption

Select and view checks.

In the Model Advisor window, click the Switch to standard view toggle () button.

Run checks.

Click Run checks ().

View the report in a separate browser window.

Click Open Report.

View highlighted results.

Click the Enable highlighting toggle () button.

Run Model Checks Programmatically

If you have Simulink Check, you can create MATLAB scripts and functions so that you can run the Model Advisor programmatically. For example, you can create a ModelAdvisor.run function to check whether your model passes a specified set of the Model Advisor checks every time that you open the model and start a simulation. If you have Simulink Coder, the function can generate code from the model.

Access Other Advisors

You can use the Model Advisor window to access other Advisors.

ActionSelect

Configure your model to meet code generation objectives.

Code Generation Advisor. See Application Objectives Using Code Generation Advisor (Simulink Coder).

Upgrade and improve models with the current release.

Upgrade Advisor. See Consult the Upgrade Advisor.

Improve the simulation performance of your model.

Performance Advisor. See Improve Simulation Performance Using Performance Advisor.

See Also

Related Examples

More About