You can use the Model Advisor to check a model or subsystem for adherence to modeling guidelines or standards. The Model Advisor includes checks that help you define and implement consistent design guidelines. Using model checks, you can apply guidelines across projects and development teams.
You can use the Model Advisor to check your model in these ways:
Run checks interactively after you complete your model design.
Configure the Model Advisor to check for violations while you edit.
The Model Advisor reviews your model for conditions and configuration settings that cause inaccurate or inefficient simulation and code generation of the system that the model represents.
You can use the Model Advisor to check your model interactively against modeling standards and guidelines. In the model window, select Analysis > Model Advisor > Model Advisor. Select the model or system that you want to review. Select the checks that you want to run on your model from the By Product or By Task folders. Then run your selected checks. The Model Advisor reviews your model and, if selected, displays an HTML report of your results.
Depending on which products you have installed, the Model Advisor includes different checks.
|For more information||See|
|Checking model compliance with the DO-178C safety standard||Model Checks for DO-178C/DO-331 Standard Compliance|
|Checking model compliance with the IEC 61508, IEC 62304, ISO 26262, or EN 50182 safety standards||Model Checks for IEC 61508, IEC 62304, ISO 26262, and EN 50128 Standard Compliance|
|Checking model compliance with MathWorks® Automotive Advisory Board (MAAB) guidelines||Model Checks for MathWorks Automotive Advisory Board (MAAB) Guideline Compliance|
|Checking model compliance with the MISRA C:2012 standard||Model Checks for MISRA C:2012 Compliance|
|Checking model compliance with CERT C, CWE, and ISO/IEC TS 17961 secure coding standards||Model Checks for Secure Coding (CERT C, CWE, and ISO/IEC TS 17961 Standards)|
|Checking requirements links||Model Checks for Requirements Links|
|Checking model metrics||Collect Model Metrics Using the Model Advisor|
You can identify standards compliance issues earlier in the model design process by using edit-time checking. Edit-time checking provides visual cues for some Model Advisor check violations. In the model editor window, highlighted blocks alert you to issues as you design your model. Hover your cursor over a highlighted block for information about the violation.
To enable edit-time checking for Model Advisor checks, in the model window, select Analysis > Model Advisor > Display Advisor Checks in Editor.
Once you select this option, the Model Advisor provides visual cues for several standards compliance issues. To configure the selection and behavior of these checks:
To open a filtered view of the edit-time checks in the Model Advisor Configuration Editor, in the model window, select Analysis > Model Advisor > Configure Advisor Edit-Time Checks.
Use the configuration editor to enable, disable, or customize checks.
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 assigns priority to 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.
Once you have configured edit-time checking, as you edit your model, highlighted blocks alert you to compliance issues. Hover your cursor over a highlighted block and click the error or warning icon.
A dialog box provides a description of the warning. For detailed documentation on the check that detected the issue, click the question mark. To ignore the warning for a block and to add the block to the exclusion list for that check, click the Ignore button. For a block violating multiple checks, cycle through the edit-time warnings with the << and >> buttons. See Exclude Checks During Edit-Time.
Software is inherently complex and may not be completely free of errors. Model Advisor checks might contain bugs. MathWorks reports known bugs brought to its attention on its Bug Report system at http://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 will increase the likelihood that your model does not violate certain modeling standards or guidelines, 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.
To check your Stateflow chart for compliance with the MAAB guidelines while you edit:
Open your model that contains Stateflow charts. For example, at
the command prompt, open
To enable the edit-time MAAB checks, go to Analysis > Model Advisor > Display Advisor checks in editor.
Open the Bang-Bang Controller chart by double-clicking it. The Model Advisor highlights multiple states. Each highlighted state contains a MAAB warning. Hover 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 en: to comply with the MAAB guidelines. Place your cursor after en: and press Enter. A new line is added and the warning is cleared.
Current guidelines checked for Stateflow charts during edit-time are listed in this table:
Check entry formatting in State blocks in Stateflow charts
|db_0151: State machine patterns for transition actions||
Check transition actions in Stateflow charts
|db_0132: Transitions in flow charts||
Check transition orientations in flow charts
|db_0127: MATLAB commands in Stateflow®||
Check for MATLAB expressions in Stateflow charts