Main Content

db_0122: Stateflow and Simulink interface signals and parameters

Sub ID Recommendations

  • NA-MAAB — a

  • JMAAB — a

MATLAB Versions

All

Rule

Sub ID a

Chart block parameter Use Strong Data Typing with Simulink I/O shall be selected so that strong data typing between a Stateflow® chart and Simulink® is permitted.

Note

Use Strong Data Typing with Simulink I/O is available only whenChart block property Action Language is set to C.

Custom Parameter

Not Applicable

Example — Correct

Parameter Use Strong Data Typing with Simulink I/O is selected, so the input and output is set to uint8 type.

Example — Incorrect

Parameter Use Strong Data Typing with Simulink I/O is not selected, so the input and output is set to double type.

Rationale

Sub ID a:

  • When parameter Use Strong Data Typing with Simulink I/O is not selected, the Simulink signal data type that can input and output to a Stateflow Chart is set to double type:

    • As a result, type conversion is required prior to input and after output, which increases the number of blocks and decreases readability.

    • However, input data of any type in a Stateflow Chart can connect directly with that signal. When these two signals have different data types, an implicit data type conversion occurs. By selecting the parameter, the implicit data type conversion does not take place and a data type inconsistency error is generated. This prevents misunderstandings due to differences in data type, thus improving readability.

Verification

Model Advisor check: Check for Strong Data Typing with Simulink I/O (Simulink Check)

Last Changed

R2020a

Introduced in R2020a