Figure 1: Control the Local Complexity and Achieve Well-Structured Models

Guidelines Are the Key to Better Models

Sophia Kohle
Managing Director

Modeling guidelines pave the way for developing high quality, standard compliant software.

Modeling in Simulink is a great way to implement and visualize functionality, while simultaneously generating code from it. The quality of the model has a strong influence on the quality of the generated code. The challenge posed at model level is getting a handle on the amount of possible modeling elements, their extensive configurations, and their interaction. This makes working on software difficult, especially within a team.

But How Do We Determine and Evaluate What a Good Model Is?

In model-based languages, established software development principles apply, such as

· Simplicity,

· Readability,

· Robustness,

· Maintainability,

· Avoidance of error-prone patterns.

Thankfully, many experts have been pondering how to achieve these goals over the last several decades. The knowledge of these experts has been incorporated into a vast number of guidelines, which are a vital part of static testing. With their help, we can indicate how to improve software at a very early stage in the development process. Guidelines simplify a model's design, maintenance, and review. These guidelines have been published by various bodies, for example, the MAB, MISRA SLSF, dSPACE, or Model Engineering Solutions' (MES) guidelines. There are already numerous established and helpful guidelines for Simulink, which can be automatically checked with the MES Model Examiner® (MXAM). MXAM’s automatic repair function also facilitates the safe and efficient repair of findings.

Modeling Guidelines Pave the Way to Better Models

On the one hand, guidelines serve as a knowledge source for what good modeling looks like and why certain constructs or functionalities should not be used. A selected set of guidelines outlines the desired modeling standard agreed upon by the team, allowing developers to focus on functionality. On the other hand, guidelines can be used to check if predefined modeling standards are being met. To save you from having to manually check these, there is tool support such as the MES Model Examiner®, which smoothen the process of compliant modeling.

Figure 1: Control the Local Complexity and Achieve Well-Structured Models
Figure 1: Control the Local Complexity and Achieve Well-Structured Models

Which Topics do Guidelines Cover?

The aspects particularly worth mentioning here are layout and design, architecture, model configuration, and functional safety. As an example, model metrics can be used to avoid high complexity. Monitoring the model complexity from the get go ensures the development of comprehensible and well-structured models, regardless of their extensive functionality.

Figure 2: Distinguish Logical and Numerical Expressions
Figure 2: Distinguish Logical and Numerical Expressions

Other guidelines deal with specific best practices for data types. For instance, boolean variables shall be used for logical expressions and numeric data types for calculations (cf. na_0002, MAB). See Figure 2.

Figure 3: Avoid Redundancies in Conditions
Figure 3: Avoid Redundancies in Conditions

Modeling that reduces code is especially useful. In the following example (Figure 3), conditions are expressed redundantly and can be greatly simplified. This can be checked with the MES guideline mes_slsf_1302.

In summary, guidelines help development teams to design safe and maintainable software. Guideline compliance therefore forms an integral part of the model-based software development process and can be successfully and simply implemented with the help of MXAM.

For more examples or any questions related to static and guideline compliance testing, subscribe to us on YouTube. We will soon create a playlist, which will be updated regularly with short guideline videos, so stay tuned!

Dieser Artikel wurde ursprünglich in Englisch auf LinkedIn publiziert.

Kontaktieren Sie uns

Elena Bley
Elena Bley
Senior Manager Marketing & Webinars
Was ist die Summe aus 3 und 2?

* Pflichtfeld

Bitte addieren Sie 5 und 7.