Documentation

Check for Compliance Using the Model Advisor and Edit-Time Checking

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.

Check Your Model Interactively

You can use the Model Advisor to check your model interactively against modeling standards and guidelines. In the model window, selectAnalysis>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 theBy ProductorBy Taskfolders. 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
检查模型符合IEC 61508、IEC62304, 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

Check Your Model While You Edit

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.

Configure Your Model for Edit-Time Checking

To enable edit-time checking for Model Advisor checks, in the model window, selectAnalysis>Model Advisor>Display Advisor Checks in Editor.

一旦你选择了这个选项,模型顾问职业vides visual cues for several standards compliance issues. To configure the selection and behavior of these checks:

  1. To open a filtered view of the edit-time checks in the Model Advisor Configuration Editor, in the model window, selectAnalysis>Model Advisor>Configure Advisor Edit-Time Checks.

  2. Use the configuration editor to enable, disable, or customize checks.

  3. If you have made updates to check selection or behavior, save the current configuration. Then selectFile>Set Current Configuration as Default.

    Note

    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 theBy Taskfolder, and finally to the check in yourBy Productfolder.

Locate Highlighted Compliance Issues in the Model Editor

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 theIgnorebutton. For a block violating multiple checks, cycle through the edit-time warnings with the<<and>>buttons. SeeExclude 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//www.tatmou.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.

Check MAAB guideline compliance during Edit-Time forStateflow

To check your Stateflow chart for compliance with the MAAB guidelines while you edit:

  1. Open your model that contains Stateflow charts. For example, at the command prompt, opensf_boiler.

  2. To enable the edit-time MAAB checks, go toAnalysis>Model Advisor>Display Advisor checks in editor.

  3. Open theBang-Bang Controllerchart by double-clicking it. The Model Advisor highlights multiple states. Each highlighted state contains a MAAB warning. Hover your cursor over the warning of theOffstate to discover the issue.

  4. Select the warning. The Model Advisor indicates that there must be a new line afteren:to comply with the MAAB guidelines. Place your cursor afteren:and pressEnter. A new line is added and the warning is cleared.

Current guidelines checked for Stateflow charts during edit-time are listed in this table:

Guideline Check

jc_0501: Format of entries in a State block

Check entry formatting in State blocks in Stateflow charts

mathworks.maab.jc_0501

db_0151: State machine patterns for transition actions

Check transition actions in Stateflow charts

mathworks.maab.db_0151

db_0132: Transitions in flow charts

Check transition orientations in flow charts

mathworks.maab.db_0132

db_0127: MATLAB commands in Stateflow®

Check for MATLAB expressions in Stateflow charts

mathworks.maab.db_0127

Related Examples

More About

Was this topic helpful?