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 appropriate. HDL Coder™ integrates the checks in the HDL Code Advisor with the Model Advisor.
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?.
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:
Select the checks that you want to run.
Select the folder that contains these checks and then click Run Selected Checks
For example, to run all the checks in the Checks for blocks and block settings folder, select the folder, and then click Run Selected Checks.
You can also click the button to run the selected checks in the Model
Advisor.
If you have Parallel Computing Toolbox™, you can run the checks in the background. You can continue working on the model during analysis. The analysis does not reflect changes that you make to your model while Model Advisor is running in the background.
To run the Model Advisor checks in background, before you select and run the
checks, click the Run checks in background toggle,
.
When you run the checks, the Model Advisor starts an analysis on a parallel
processor. To stop running checks in the background, in the Model Advisor Window,
click Stop background run, .
To display an HTML report of the check results, before you run the checks, select Show report after run. You can specify this setting to generate a report for all the checks in the HDL Coder folder, or for all checks within a subfolder, such as the Checks for blocks and block settings.
If you did not select Show report after run, you can generate a report after you run the checks by selecting Generate Report. Specify the Directory, Filename, and Format of the HTML report that want to generate.
This report shows typical results for a run of the Checks for blocks and block settings folder.
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.
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.
You can also use the Model Advisor highlighting capability to color-highlight Simulink blocks and Stateflow® charts in your model, which indicates the analysis results. To highlight blocks, in the Model Advisor window, select Highlighting > Enable Highlighting.
To fix warnings or failures, in the Result subpane, review the recommended actions to make changes to your model. When you fix a warning or failure, to verify that the check passes, rerun the check.
Some checks have an Action subpane. This example displays the incorrect MATLAB Function block settings that caused the check to display a warning.
When you select Modify Settings, the Result subpane 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.
By default, the Simulink software saves the state of the most recent Model Advisor session. The next time that you activate the Model Advisor, it returns to that state. You can also save the current settings of the Model Advisor to a named restore point. A restore point is a snapshot in time of the model, base workspace, and Model Advisor. Later, you can restore the same settings by loading the restore point data into the Model Advisor.
You can use this data restore point to revert changes to your model in response to recommendations from the Model Advisor. For example, you can save a model and restore point to undo your changes if the Model Advisor reports a warning after running a certain check. You can also restore the default configuration of the Model Advisor. In the Model Advisor window, select Settings > Restore Default Configuration.
To save the Model Advisor state, in the Model Advisor Window, select File > Save Restore Point As. Enter a Name and Description, and then click Save. You can save more than one restore point.
To restore a Model Advisor state, in the Model Advisor Window, select File > Load Restore Point. Select the restore point and click Load. When you load a restore point, the Model Advisor warns that the restoration overwrites the current settings.