How do you check your model for common mistakes? Do you have an easy way to verify that your model matches the MAAB (MathWorks Automotive Advisory Board) Control Algorithm Modeling Guidelines? In this post, I will introduce model advisor and show you how easy it is to use automated checking in your modeling process.
The Model Advisor is a tool in core Simulink that automatically checks your model for some common mistakes. From any model, you can open the Model Advisor from the Tools menu.
The Model Advisor can analyze the entire model, or a subset of the model. When you open it from the tools menu, you have to pick which system you want to work on.
You can also launch the Model Advisor on a selected system from the right click menu. The Model Advisor shows the available checks on the left side, grouped by product and by task.
The individual checks can run one at a time, or you can run all the selected checks for a given node of the tree. The immediate results display when you highlight the check in the tree. For example, I ran the Simulink checks on this demo model:
It turned up a warning in the check for unconnected objects.
Often checks include links back into the model so you can locate the offending blocks. Some checks show you obvious problems in the model, like these unconnected lines. This check identifies the offending blocks and provides a brief explanation on why this could be a problem.
Another output from the Model Advisor is the report. An HTML report is stored in the SLPRJ directory after you have run the checks on the model. When you select to run a group of checks, you can automatically launch the report and review the summary of results.
Core Simulink Model Advisor capabilities
The core Simulink checks available in Model Advisor help you find common mistakes, ensure model correctness and best practices. I think of the core Simulink Model Advisor checks like advice you would get from an expert Simulink user if they were looking over your shoulder while you work. There are so many optimizations and diagnostic settings in Simulink. It is not uncommon to find that you have a setting that triggers a warning from Model Advisor. Reviewing the information with the warning can help improve your model.
Modeling Standards Checks with Simulink V&V
Simulink Verification and Validation adds modeling standards checks commonly needed when developing embedded code for safety critical applications. In the R2008b release of Simulink V&V, there are additional modeling standards checks for DO-178B, IEC 61508, and MAAB 2.0. In the documentation, you can review the available modeling standards checks.
Checks with Actions
After reviewing the check, I may want to make the recommended changes to the optimization settings to comply with this check. I can click on the Modify Setting button, which makes the appropriate changes to my model.
The results of the action display below the button for review. When the check is re-run, it no longer produces warnings.
Restore Points, new in R2008b
New in R2008b is the ability to save a model and data restore point. Restore points allow you to revert changes that you made in response to advice from the Model Advisor. A restore point is a snapshot in time of the model, base workspace, and Model Advisor.
From the File menu you can select to save and load restore points. When you select Save Restore Point As... you can name the restore point and provide a description.
After making changes to the model, you can revert to the previous restore point by loading that point.
The Model Advisor maintains restore points for the model or subsystem of interest through multiple sessions of MATLAB.
How do you check your models?
Do you use Model Advisor in your model development process? Are there any standard checks you would want to see? Leave a comment here and tell us what you think.
6 CommentsOldest to Newest
I do not use model advisor in my model development process,and I want to know other standard checks.
I now use Matlab 7.1,and its model advisor is not the same with what you have post. I found that the capability of my model advisor is lower than yours,which just has two folders named Simulink and Real-Time Workshop Embedded Coder, do not has the folder such as Simulink Verification and Validation and Modeling standards and Do-1788 Checks.
@Liu Yingpei – There have been many checks added to Model Advisor since R14sp3 (MATLAB 7.1). The Simulink Verification and Validation checks are licensed with the Simulink Verification and Validation product.
I am using Model Advisor (MATLAB 2010b, v7.11).
Please guide me for following things:
1. How can I add my own checks/rules?
2. How can I access checks (say e.g. MAAB rule jc_0111, Check orientation of Subsystem blocks) from MATLAB command prompt? May be via APIs.
@Prageet – Here are the answers to your questions:
1 – you can create your own checks by writing an SL_CUSTOMIZATION.M file. This is documented in the Authoring Custom Checks section.
2 – For programatically running checks, review the Checking Systems Programatically section in the documentation.
Please guide me for following things:
How can I add my own checks/rules in model advisor?
@chandrashekar – The examples index for Simulink Verification and Validation includes links to many instructional examples of writing custom checks for Model Advisor. Click on the above link and scroll down to the section titled: Model Advisor Check. Good luck.