By Goran Begic, MathWorks
When embedded system designs require models with thousands or even tens of thousands of blocks, it is vital to find ways of dealing with design complexity. A best practice for managing large-scale models is to implement modeling standards.
Like coding standards, modeling standards can be established among vendors in a particular engineering domain, within an organization, or by a group of global industry leaders, such as The MathWorks Automotive Advisory Board (MAAB).
Standards implementation is usually verified through visual inspection of the models and related documentation during design reviews. A quicker, more effective approach to this time-consuming and unreliable method is to perform checks using the automation features available in design tools such as Simulink Verification and Validation.
Automated modeling standards checks not only help ensure that the model accurately represents the design and correctly implements the standards; they also prevent design problems from being introduced into the generated code.
Compliance with modeling standards checks is validated through the Model Advisor feature in Simulink (Figure 1). Model Advisor performs static checking to prepare models for simulation and code generation. Built-in checks let you verify the completeness of the model and select the parameters that will enable code generation with Real-Time Workshop and Real-Time Workshop Embedded Coder. Simulink Verification and Validation supplements these checks with modeling standard checks that focus on the implementation of style guidelines defined by MAAB.
Model Advisor runs the selected checks against the complete model, lists all violations to the guidelines, and provides links to model objects that do not comply with the guidelines.
To illustrate the value of design review automation through modeling standards checking, we will examine a check that enables enforcement of MAAB style guideline jm_0010: Port Names in Simulink models, which recommends that all inport and outport blocks match the associated signals. This seemingly trivial check proves its value in a large model.
Let’s say that a signal has been misconnected, either because of a lack of documentation or because a temporary fix was never corrected. The error was not detected in simulation because test cases did not completely exercise the functionality of the signal.
In a simple design, such a problem would probably be detected visually during a design review. In a complex design, it could remain undetected until system integration, causing delays and increasing development costs.
One way to prevent the problem is to conduct an automated review of the model with modeling standards checks.
With modeling standards checks enabled, Model Advisor automatically finds all violations of selected guidelines. In our example, Model Advisor finds one inconsistency between ports and signal names (Figure 2). By following the link to the model object highlighted in the report, we discover the origin of the mismatch.
We can now take corrective action—by, for example, removing the port, redesigning the logic that was using signals from this port, or adding tests and the new coverage report for the refactored component.
Every company, and possibly every bigger project, needs design guidelines specific to the type of embedded software application being developed, the target device that it will work on, and the specifications and standards with which it must comply. You can use modeling standards checks to capture these vendor- or project-specific guidelines and apply them to Simulink and Stateflow models. The Model Advisor API available through Simulink Verification and Validation lets you define custom checks not only for any of the models and model objects, but also for any other aspects of the project, including object properties and workspace variables. The checks are defined in MATLAB functions and saved as M-files.
You can group custom checks together and enable and disable them just as you would the modeling standards checks provided in Simulink Verification and Validation. When applied against the model, the resulting report provides a comprehensive overview of compliance.
The MathWorks Automotive Advisory Board (MAAB) was established in 1998 as a forum for The MathWorks to collect input on product capability requirements. The founding members were Toyota, Ford, and DaimlerChrysler. Today, MAAB members include most of the world‘s major automotive OEMs and suppliers.
An important output of MAAB has been a set of modeling style guidelines, which are now publicly available.
Published 2007 - 91474v00