Main Content

na_0042: Usage of Simulink functions

Since R2020a

Guideline Publication

Control Algorithm Modeling Guidelines - Using MATLAB®, Simulink®, and Stateflow®

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

When using a Simulink Function block in a Stateflow Chart (Stateflow), one or more of the following conditions shall be met:

  • Input/output variables shall use only local Stateflow Chart data and input data in the Simulink Function block.

  • The Simulink Function block shall be called from multiple places in the Stateflow Chart.

  • The Simulink Function block shall not be called at every time step.

Custom Parameter

Not Applicable

Example — Correct

The Simulink Function block lookup1D is not called from every time step and, therefore, can be used.

Example — Incorrect

The Simulink Function block lookup1D is called from every time step and, therefore, cannot be used (out is the Stateflow output data)

Rationale

Sub ID a:

  • To improve model readability, the use of the Simulink Function block should be used with caution in charts.

Verification

Model Advisor check: Check usage of Simulink function in Stateflow (Simulink Check)

Last Changed

R2020a

Version History

Introduced in R2020a