Main Content

na_0037: Use of single variable for variant condition

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

Variant conditions shall be used to prohibit compound conditions that are formed from multiple variables.

Exception

Conditional expressions that are formed from multiple variables can be used when using default variants.

Custom Parameter

Not Applicable

Example — Correct

The variant condition is set by a single condition that is formed from multiple variables.

The usage of enumerated type variables is recommended in a condition equation. This example uses numerical values to improve readability.

Example — Incorrect

The variant condition is set by a compound condition that is formed from multiple variables.

Rationale

Sub ID a:

  • Complicates the conditions, which makes it difficult to determine which subsystem will become active. This can result in conditions being omitted.

  • When conditions are omitted, there is a risk that there may not be an active subsystem.

Verification

Model Advisor check: Check use of single variable variant conditionals (Simulink Check)

Last Changed

R2020a

Introduced in R2020a