Main Content

Naming Considerations

hisl_0031: Model file names

ID: Titlehisl_0031: Model file names
Description

For model file names:

  • Use these characters: a-z, A-Z, 0-9, and the underscore (_).

  • Use strings that are more than 2 and less than 64 characters. (Not including the dot and file extension).

Do not:

  • Start the name with a number.

  • Use underscores at the beginning or end of a string.

  • Use more than one consecutive underscore.

  • Use underscores in file extensions.

  • Use reserved identifiers.

Rationale
  • Readability

  • Compiler limitations

  • Model-to-generated code traceability

Model Advisor ChecksCheck model file name (Simulink Check)
See Also
References
  • ISO 26262-6, Table 1 (1h) 'Use of naming conventions'

  • DO-331, Section MB.6.3.2.e – ‘Low-level requirements conform to standards’

    DO-331, MB.6.3.3.e 'Software architecture conforms to standards’

  • DCL37-C. Do not declare or define a reserved identifier

Last ChangedR2021b
Examples

Recommended

  • My_model.slx

Not Recommended

  • _My__model.slx

  • 2018_01_11_model.slx

  • New.slx

hisl_0032: Model element names

ID: Titlehisl_0032: Model element names
Description

For these types of model elements:

  • Signal labels

  • Parameters

  • Blocks

  • Named Stateflow® objects (states, boxes, Simulink® functions, graphical functions, truth tables)

And, these types of architecture model objects:

  • Components

  • Ports

  • Connectors

  • Interfaces

  • Stereotypes

Use:

  • These characters: a-z, A-Z, 0-9, and the underscore (_).

  • Strings that are fewer than 32 characters.

Do not:

  • Start the name with a number.

  • Use underscores at the beginning or end of a string.

  • Use more than one consecutive underscore.

  • Use reserved identifiers.

Notes

Reserved names:

  • MATLAB® keywords

  • Reserved keywords for C, C++, and code generation. For complete list, see Reserved Keywords (Simulink Coder).

  • int8 , uint8

  • int16, uint16

  • int32, uint32

  • int64, uint64

  • inf, Inf

  • NaN, nan

  • eps

  • intmin, intmax

  • realmin, realmax

  • pi

  • infinity

  • Nil

Rationale

The code generator might remove or mangle invalid characters when producing an identifier in generated code.

Model Advisor ChecksCheck model object names (Simulink Check)
See Also

MAB guidelines:

References

  • MISRA C:2012, Rule 5.1

  • MISRA C:2012, Rule 21.2

  • ISO 26262-6, Table 1 (1h) 'Use of naming conventions'

  • DO-331, Section MB.6.3.2.e – ‘Low-level requirements conform to standards’

    DO-331, MB.6.3.3.e 'Software architecture conforms to standards’

  • DCL37-C. Do not declare or define a reserved identifier

Last ChangedR2023a
Examples

Recommended

  • Block name: My_Controller

  • Signal name: a_b

Not Recommended

  • Block name: My Controller

  • Signal name: 12a__b