The Model Advisor checks your model or subsystem for modeling conditions and configuration settings that cause inaccurate or inefficient simulation of the system that the model represents. The Model Advisor checks can help you verify compliance with industry standards and guidelines. By using the Model Advisor, you can implement consistent modeling guidelines across projects and development teams.
Upon completing the analysis of your model, the Model Advisor produces a report that lists the suboptimal conditions, settings, and modeling techniques and proposes solutions, when applicable.
You can use the Model Advisor to check your model in these ways:
Interactively run Model Advisor checks
Configure the Model Advisor to automatically run edit-time checks (requires Simulink® Check™)
These limitations apply when you use the Model Advisor to check your model. For limitations that apply to specific checks, see the Capabilities and Limitations section in the check documentation.
If you rename a system, you must restart the Model Advisor to check that system.
In systems that contain a variant subsystem, the Model Advisor checks only the active subsystem.
Model Advisor does not analyze commented blocks.
Checks do not search in model blocks or
subsystem blocks with the block parameter
Read/Write set to
NoReadorWrite. However, on a check-by-check
basis, Model Advisor checks do search in library blocks and masked
Unless specified otherwise in the documentation for a check, the Model Advisor
does not analyze the contents of a Model block.
To run checks on referenced models, use instances of the
Advisor.Application class (Simulink
Check license required).
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 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 unintended functionality.
The Model Advisor only displays the checks for your installed products. This table provides links to the product-specific check documentation. A product license may be required to review some of the documentation.
|Product||Model Advisor Check Documentation|
|Simulink||Simulink Checks (Simulink)|
|Embedded Coder®||Embedded Coder Checks (Embedded Coder)|
|AUTOSAR Blockset||MathWorks AUTOSAR Blockset Checks (AUTOSAR Blockset)|
|Simulink Coder™||Simulink Coder Checks (Simulink Coder)|
|HDL Coder™||Model Checks in HDL Coder (HDL Coder)|
|Simulink Code Inspector™||Simulink Code Inspector Checks (Simulink Code Inspector)|
|Simulink Design Verifier™||Simulink Design Verifier Checks (Simulink Design Verifier)|
|Simulink Requirements™||Requirements Consistency Checks (Simulink Requirements)|
|Simscape™||Documentation is available only in the Model Advisor. To review the documentation for the check, in the Model Advisor, right-click on the check title and select What's This?|
|Simulink Control Design™||Simulink Control Design Checks (Simulink Control Design)|
|IEC Certification Kit|
IEC Certification Kit Checks for Bug Reports (IEC Certification Kit)
|DO Qualification Kit|
DO Qualification Kit Checks for Bug Reports (DO Qualification Kit)
You can use the Model Advisor to check your model interactively against modeling standards and guidelines. The following example uses the
sldemo_mdladv model to demonstrate the execution of the Model Advisor checks using the Model Advisor.
Open the Model Advisor example model
To open the Model Advisor, in the Simulink editor, click the Modeling tab and select Model Advisor. A System Selector ― Model Advisor dialog box opens. Select the model or system that you want to review and click OK.
In the left pane of the Model Advisor, select the checks you want to run on your model:
You can select the checks by using the By Product or By Task folders. If these folders are not displayed in the Model Advisor window, open Settings > Preferences and select:
Show By Product Folder ― Displays checks available for each product
Show By Task Folder ― Displays checks related to specific tasks
You can search for and execute a specific check by enter the Title or TitleID of the check in the Find: field and click the Find Next button. The Model Advisor searches in check names, folder names, and analysis descriptions. You can use the Source tab to identify the Title, TitleID, and location of the MATLAB® source code for each check. To display the Source in the right pane of the Model Advisor, open Settings > Preferences and select Show Source Tab.
Click on the folder that contains the checks and, on the right pane of the Model Advisor, select:
Show report after run to automatically generate and display the report in HTML format
Run Selected Checks to execute the analysis.
To run a single check, right-click the check in the folder and select Run This Check.
View the results on the Model Advisor User Interface. Common check status results include
Pass ─ Check did not identify issues.
D-Pass ─ Dependent on configuration parameter
or successful execution of another check.
Warn ─ Check has identified issues.
Fail ─ Check fails to execute.
Fix the warnings or failures as desired. For more information, see Address Model Check Results (Simulink).
Prior to applying a fix, you can save a restore point, which is a snapshot in time of the model, base workspace, and Model Advisor. By saving a restore point, you can revert changes that you made in response to recommendations from the Model Advisor.
Use the Exclusions tab to review checks that were marked for exclusion from the analysis. To display the Exclusions tab in the right pane of the Model Advisor, open Settings > Preferences and select Show Exclusion tab.
View and save the report. For additional information, see Save and View Model Advisor Check Reports (Simulink).
If you did not select Show report after run when you executed the checks, you can generate a report of the results after the analysis is complete. See Generate Model Advisor Reports.
If desired, you can reset the status of the checks to the Not Run state. In
the left pane, right-click on Model Advisor and select
Reset. This action does not delete the results of
the analysis from the Model Advisor.
You can save time by consistently running the same set of checks on your model by using the Model Advisor dashboard. When you use the dashboard, the Model Advisor does not reload the checks before executing them, saving analysis time.
Open the Model Advisor example model
Select Model Advisor > Model Advisor Dashboard. A System Selector ― Model Advisor dialog box opens. Select the model or system that you want to review and click OK.
The Model Advisor Dashboard window opens. From this dashboard, you can:
Click the Run checks button to execute the same checks from the previous analysis
Click the Switch to standard view button to open the Model Advisor and select different checks
Click the Enable Highlighting button to view the highlighted results in the Simulink editor
Click the Run checks button to run the same checks on the model that were used in the previous analysis. If desired, click the Enable Highlighting button.
The Model Advisor execute the checks and updates the dashboard to reflect the results of the analysis, including the number of:
If you clicked the Enable Highlighting button, the flagged results are highlighted in the model.
The Model Advisor Highlighting information window opens with a link to the Model Advisor window. In the Model Advisor window, you can find more information about the check results and how to fix the warning condition.
Click the Open Report button to open the entire report in HTML format. Alternatively, you can select the number link beside the results to filter the report results.
You can identify modeling issues earlier in the model design process by using edit-time checking.
To enable edit-time checking, in the Simulink editor, click the Debug tab and select these Diagnostics options:
Edit-Time Errors & Warnings ― Automatically highlights check violations in the model. The Simulink editor highlights objects that violate the edit-time checks in red (for errors) or orange (for warnings). When you point to an object that is highlighted and click the error or warning badge, a tooltip displays details and possible fixes.
Edit-Time checks ― When using edit-time checking, the Model Advisor evaluates the model against a subset of Model Advisor checks. Highlighted blocks in the model editor window alert you to issues in your model. You can also enable this option by clicking the Modeling tab and selecting Model Advisor > Edit-Time Checks.
To enable edit-time checking of modeling issues that are specific for code generation, open the C Code app (available with Embedded Coder or Simulink Coder) and select the C/C++ Code Advisor > Edit-Time Checks box.
When using edit-time checking, the Model Advisor highlights blocks that violate the Model Advisor checks.
Use one of these methods to enable edit-time checking of your model:
In the Debug tab, select Diagnostics > Edit-Time Checks
In the Modeling tab, select Model Advisor > Edit-Time Checks
The Model Advisor highlights blocks in your model that violate Model Advisor checks. Point to a highlighted block and click the error or warning icon.
The Model Advisor identifies compliance issues in the block that violate edit-time checks. When a block has multiple check violations, you can move between the edit-time violations by using the << and >> buttons. For each issue, you can:
Review the cause.
Click the question mark to access detailed documentation about the flagged Model Advisor check.
Ignore the warning and add the block to the exclusion list for that check by clicking Ignore.
In this example, you use edit-time checking to verify the compliance of a Stateflow chart with the MAAB guidelines while you edit.
Open a model that contains Stateflow charts. For example, at the
command prompt, type:
To enable the edit-time checking, in the Modeling tab, select Model Advisor > Edit-Time Checks .
Open the Bang-Bang Controller chart by double-clicking it. The Model Advisor highlights multiple states. Place your cursor over the warning of the Off state to discover the issue.
Select the warning. The Model Advisor indicates that there must be a new line after entry: to comply with the MAAB guidelines. In your model, place your cursor after en: and press Enter. A new line is added and the warning is cleared.
When you run the Model Advisor edit-time checks, the Model Advisor evaluates the model against a subset of Model Advisor checks. To view and configure the Model Advisor checks that edit-time checking flags:
In the Simulink editor, click the Modeling tab and select Model Advisor > Customize Edit-Time Checks.
In the Model Advisor Configuration Editor, verify that the
Edit-time Supported Checks item is
selected from the Show drop-down list. The filtered
list identifies the model advisor checks that are flagged.
Select or clear checks. Selected checks are included in the edit-time check analysis. You can use the Input Parameters options to customize each check.
If you have made updates to check selection or behavior, save the current configuration. Then select File > Set Current Configuration as Default.
Only the default configuration can change the behavior of edit-time checks.
To customize the behavior of edit-time checks, configure updates in the filtered view of edit-time checks in the Model Advisor Configuration Editor. If a check appears in multiple folders of your Model Advisor tree, for edit-time checking, Model Advisor prioritizes the check in your custom folder. If the check is not in your custom folder, priority goes to the check in the By Task folder, and finally to the check in your By Product folder.