Main Content

Run Model Advisor Checks for HDL Coder

The Model Advisor checks a model or subsystem for conditions and configuration settings that can result in inaccurate or inefficient simulation. The Model Advisor produces a report that lists the suboptimal conditions or settings that it finds, and proposes better model configuration settings where possible. HDL Coder™ integrates the checks in the HDL Code Advisor with the Model Advisor.

Open the Model Advisor Checks

You can open the Model Advisor in either of these ways:

  • In the Modeling tab, select Model Advisor. In the System Selector dialog box, select the model or Subsystem that you want to analyze, and click OK.

  • To run the model advisor checks for the Subsystem that you want to analyze, right-click that Subsystem, and select Model Advisor > Open Model Advisor.

  • At the command line, enter modeladvisor('system'). system is the name of the model or Subsystem that you want to analyze. For more information, see modeladvisor.

When you open the Model Advisor in Simulink®, you see the checks in the HDL Coder subfolder of the By Product folder. Each subfolder in the HDL Coder folder represents a group or category of related checks. Expanding the folders display available checks in each folder. From the left pane, you can select a folder or an individual check. The Model Advisor displays information about the selected folder or check in the right pane. The content of the right pane depends on the selected folder or check. The right pane has a Result subpane that contains a display area for status messages and other task results.

To learn more about each individual check, right-click that check, and select What's This?.

Run Checks in the Model Advisor

In the Model Advisor window, you can run individual checks or a group of checks. To run a check, Select that check, and then click Run This Check.

To run a group of checks within a folder:

  1. Select the checks that you want to run.

  2. Select the folder that contains these checks and then click Run Checks

For example, to run the checks in the Checks for blocks and block settings folder, select the folder, and then click Run Checks.

Select Run Checks for the HDL Coder folder in the Model Advisor tool strip.

You can also right-click the folder Checks for blocks and block settings, and select Run Selected Checks in the Model Advisor.

Display Check Results in the Model Advisor Report

To display an HTML report of the check results, click Report from the toolstrip. You can use the Report drop-down to change the report format to PDF or WORD.

This report shows typical results for a run of the Checks for blocks and block settings folder.

Shows the Check results in the Model Advisor report.

The report displays a run summary of the checks in the folder that you generated the report for. As you run the checks, the Model Advisor updates the reports with the latest information for each check in the folder. When you run the checks at different times, timestamps appear at the top right of the report to indicate when checks have been run. Checks that occurred during previous runs have a timestamp following the check name. You can filter checks in the report to show checks that display a Warning, or show checks that Passed, and so on.

Fix Warnings or Failures

When a model or referenced model has a suboptimal condition, checks can fail. After you run a Model Advisor analysis, indicates checks that have warnings. A warning result is informational. You can fix the reported issue or move on to the next task.

To fix warnings or failures, in the Result sub-pane, review the recommended actions to make changes to your model. When you fix a warning or failure, to verify that the check passes, re-run the check.

Some checks can use the Fix option from the toolstrip. Note that this option is available for selected checks that display violations with input parameters. This example displays the incorrect Reciprocal block settings that caused the check to display a warning.

To select the Fix button in the Model Advisor tool strip

When you select Fix, the Action Report window shows the changes that were applied. To verify that the check passes, rerun the check. If you use the Model Advisor dashboard, you see that the analysis is faster when you rerun the check because the Model Advisor does not reload the checks before executing them.

Related Topics