Main Content

Check type and size of condition expressions

mathworks.hism.himl_0011

Dependencies: Simulink® Check™

Usage: High-Integrity System Modeling

Guideline: himl_0011: Data type and size of condition expressions

Description

Use this check to verify that logical scalars are used for condition expressions.

Conditional expressions are:

  • if expressions

  • elseif expressions

  • while expressions

  • Condition expressions of Stateflow® transitions

Check Parameters

Use the Model Advisor Configuration Editor to define the scope of the analysis by specifying the input parameters.

ParameterDescription
Check external .m files referenced in the model

Specify whether to run on referenced MATLAB® files in the model.

on (default) | off

Follow links

Specify whether to include content of library-linked blocks in the analysis.

on (default) | off

Look under masks

Specify whether to include masked model elements in the analysis.

all (default) | none | graphical | functional

  • all — Check analysis includes all masked model elements.

  • none — Check analysis excludes masked model elements.

  • graphical — Check analysis includes only the graphical masked model elements.

  • functional — Check analysis includes only the functional masked model elements.

Recommended Actions and Results

Review the violations that are flagged by the check and the recommended action for fixing the issue. After applying the changes, save the model and rerun the check analysis.

Modeling ConditionRecommended Action

if expression is not a logical scalar.

Change expression to a logical scalar.

elseif expression is not a logical scalar.

Change expression to a logical scalar.

while expression is not a logical scalar.

Change expression to a logical scalar.

Condition expression of Stateflow transition expression is not a logical scalar.

Change expression to a logical scalar.

Capabilities and Limitations

  • Does not check the conditions of Stateflow transitions and state actions when using C as the Stateflow action language

  • Does not run on library models

  • Analyzes content in masked subsystems

  • Analyzes content of library-linked blocks

  • Unreachable invariant conditions and code fragments might not be analyzed.

  • Supports only active variant choices

  • Performs model compilation

Tips

The results table identifies each expression that contains an expression that is not a logical scalar. To review the issue, select the corresponding function link from the result table. The Model Advisor opens and highlights the corresponding function definition or, for Stateflow, opens the chart and highlights the state in which the issue occurs.

Manually change the condition expressions to logical scalars. Save the model and rerun the check.

Version History

Introduced in R2019b