When developing a model from which you intend to generate code that will be verified using Simulink® Code Inspector™, you can incrementally and iteratively check the model for compatibility with Simulink Code Inspector rules. Model compatibility checking can significantly reduce the amount of time to achieve satisfactory code inspection results by exposing issues early in the model development process. The compatibility checks also promote model, block, and coder usage patterns that tend to align with the needs of high-integrity applications, such as maintaining a high degree of traceability.
During a model compatibility check, the software checks for model and block configuration settings that help produce an in-memory representation of the model that is compatible with Simulink Code Inspector rules. You can set model and block configuration parameters many different ways and produce a compatible in-memory representation. Compatibility checks scan for a subset of those ways. Although a model can fail a compatibility check and still pass inspection, passing compatibility checks increases the likelihood of satisfactory code inspection.
The compatibility checks look for conditions that violate Simulink Code Inspector constraints on model configuration parameters, other model-wide attributes, and block usage. Items affected by Simulink Code Inspector constraints include:
Model parameters for
Solver use
Data import/export
Optimization
Diagnostics
Hardware implementation
Model referencing
Code generation
Model-wide attributes
Unconnected objects
Function specifications
Model arguments
Unsupported blocks
Tunable workspace variables
Sample times
Global data stores
Fixed-point instrumentation
Root outport usage
Bus usage
Block usage
Data types and ports
Block parameters
Stateflow® object usage
Charts
Data and Events
Junctions
States
Transitions
For detailed description of Simulink Code Inspector constraints and the corresponding model compatibility checks, see:
To initiate compatibility checking for your model, you can do any of the following:
From the model window, on theApps tab, select Code Inspector. Use the Simulink Code Inspector dialog box to control model compatibility checking. For more information, see Check Model Compatibility Using the User Interface.
Use the slci.Configuration
interface to programmatically control
model compatibility checking. For more information, see Check Model Compatibility Using the Command-Line Interface.
Use the slciadvisor
interface to open an SLCI Advisor session
(equivalent to Model Advisor preloaded with Simulink
Code Inspector checks)
for the open model. This function provides direct access to SLCI model
compatibility checking that can streamline iterative checking of a
model.
Use edit-time checking to identify compatibility issues earlier in the model design process. For more information, see Check Model Compatibility While You Edit.
If your model might be used as a referenced model, in the SLCI Advisor window, consider selecting Settings > Treat as Referenced Model. Referenced models compile differently than non-referenced models. The compatibility checks provide setting recommendations based on the different compilation methods.
Model compatibility checking generates a detailed HTML report for each model checked. If you checked models in a model reference hierarchy, the software reports summary status at the MATLAB® command line and displays a summary HTML report. You can click links in the HTML summary report to view the detailed Model Advisor Report for each model and referenced model that was checked. If you checked only one model, the detailed model results are displayed directly in a Model Advisor dialog box.
The Simulink Code Inspector does not run custom Model Advisor checks that you add to the compatibility checks.
In the detailed results, the result of each check is explained, and if you need to fix your model, recommended actions are provided. The available model compatibility checks are listed in report order and described in the Simulink Code Inspector Checks reference.