Getting Started With LI Modelling Rule Checks

Why Modelling Rules?

Over the 1990's the use of generated code from Simulink models was introduced to automotive devices. While Simulink itself was never designed for that special purpose, it soon turned out, that not everything you can do in a model suits the intended use with code generation, even if functionality is fully given. Also in automotive development models were often used and adapted not only by different developers but even by different departments like R&D and serial teams.

To address these problems a group of automotive manufacturers, calling themselves MathWorks Automotive Advisory Board released a modelling guideline in 2001 titled Controller Style Guidelines For Production Intent Using MATLAB®, Simulink® and Stateflow®, referred to as MAAB 1.0. It soon turned out that these rules were useful not only for the original purpose, but also checking models by review is a lengthy and error prone task.

To provide an alternative to lengthy reviews, TheMathworks provided a tool called Model Advisor™ with Simulink, and an additional toolbox Verification & Validation with (among others) a set of MAAB rule implementations (today contained in Simulink Check). In 2020 MAAB, now renamed into MAB for Matlab Advisory Board to express a more genral approach, released the most recent 5.0 edition of its modelling rules. But the approach is still the same: to provide rules for better readability, reusability, exchangability, and avoidance of unintended simulation and code generation results.

Why LI Modelling Rule Checks?

As an alternative to The MathWorks implementation of MAAB/MAB rules LI Modelling Rule Checks were implemented, offering some additional concepts and features.

Where Simulink Check before R2020a does only offer a small subset of MAB 5.0 rules, LI Modelling Rule Checks is compatible back to at least R2010b and contains all MAB 5.0 checks considered implementable.

Further on a concept of excluding libraries rather than single blocks is implemented. Excluding single blocks is questionable and thus requires review where higher levels of safety measures are involved. Excluding libraries, of cause, is all the more so, but this feature is useful where third party libraries are in use that shouldn't be changed by developers and where the liablity for functional safety and coder generation results lies with the supplier, while comprehensibility should come with the suppliers documentation or manual. Here excluding specific libraries makes most sense, while editable parts of the model should rather be changed to apply to the chosen set of rules than be exempt.

A wider range of parameters is provided, that allows for variants of rules that might be more useful depending on the general modelling approach. And in other places simply allow variants, that represent different interpretations of a rule. So you might choose by parameter setting paramter bAllowMpSwitchEnum to true, that enumerated signals might be used for the control port of a multiport switch, even though it is based on Simulink.IntEnumType while MAAB 5.0 Rule jc_0630 demands the use of an unsigned integer type. For a list of check configuration paramters see here

Last but not least, LI Modelling Rule Checks offers modular pricing, subdividing MAB 5.0 to Simulink-NA-MAAB, Stateflow-NA-MAAB, and JA-MAAB sublicenses. And even a license for the full set of checks is still half the price of Simulink Check.

First Steps Using LI Modelling Rule Checks

Run a Check, Adjust, and Run Again

This chapter expects a successful installation of, and a valid license for LI Modelling Rule Checks. This includes respective paths to installed files being added to the Matlab path.

The example from MAB 5.0 for an incorrect model with regards to rule jc_0110 might be created from scratch or using open m-script lick_getting_started1_bad_mdlscript.m:

Now open the Model Advisor™ from the model's menu:

In less recent versions' menus looks like this:

This opens a selection dialogue for the subsystem, in this case this is the top level only. Just click OK:

After that the Model Advisor™ opens for the example model, and a new root folder named LI MAB 5.0 Model Checks should appear. Open rule check jc_0110 in the tree of that folder:

Then click the "Run This Check" button in the top of the right pane. This should yield the following check result:

When you click the link to the offending block in the middle of the right pane, the model comes to the fromt with that block highlighted.

To open the rule check help, click the "Help" button in the bottom of the right pane:

To adjust the model to the rule, you might switch the gain block's direction shift it with its connecting lines respectively. Or you can close the model and use open m-script lick_getting_started1_good_mdlscript.m. The result should look like this:

If you closed the Model Advisor™ window before, you need to repeat the startup procedure as described above. Then execute the chek again, the result should look like:

Now the example model is in accordance with MAB 5.0 jc_0110.