Main Content

Shared utilities identifier format

Customize shared utility identifiers

Model Configuration Pane: Code Generation / Identifiers

Description

Customize shared utility identifiers.

Dependencies

This parameter:

  • Appears only for ERT-based targets.

  • Appears only for C++ and AUTOSAR code generation.

  • Requires Embedded Coder® when generating code.

Settings

$N$C (default) | string

Customize generated shared utility identifier names.

Enter a macro that specifies whether, and in what order, certain text is to be included in the generated identifier. The macro can include a combination of the following format tokens.

TokenDescription
$N

Insert system-generated name of the object for which the shared utility identifier is generated. Optional.

$C

Insert eight-character conditional checksum when $N is not specified or the Maximum identifier length does not accommodate the full length of $N. Modify checksum character length by using Shared checksum length parameter. Required.

$R

Insert root model name into identifier, replacing unsupported characters with the underscore (_) character.

$U

Insert text that you specify for the $U token. Use the Custom token text parameter to specify this text.

Tips

  • Where possible, increase the Maximum identifier length to accommodate the length of the identifiers that you expect to generate.

  • The checksum token $C is required. If $C is specified without $N or $R, the checksum is included in the identifier name. Otherwise, the code generator includes the checksum when necessary to prevent name collisions.

  • To control the case (upper or lower case) of the text that each token represents, include decorators such as [U_] in your macro. See Control Case of Identifiers by Using Basic Token Decorators.

  • If you specify $N or $R, then the checksum is included in the identifier name only when the identifier length is too short to accommodate the fully expanded format text. The code generator includes the checksum and truncates $N or $R until the length is equal to Maximum identifier length. When necessary, an underscore is inserted to separate tokens.

  • If you specify $N and $R, then the checksum is included in the identifier name only when the identifier length is too short to accommodate the fully expanded format text. The code generator includes the checksum and truncates $N, and if required, $R, until the length is equal to Maximum identifier length. When necessary, an underscore is inserted to separate tokens.

  • Descriptive text helps make the identifier name more accessible.

  • For versions prior to R2016a, the Shared utilities identifier format parameter does not support the $R token. For a model, if the Shared utilities identifier format parameter includes a $R token, and you export the model to a version prior to R2016a, the Shared utilities identifier format parameter defaults to $N$C.

  • For C code generation, use the Embedded Coder dictionary to create a function customization template that specifies the naming rule, then apply the template by using the Code Mappings editor.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityUse default
EfficiencyNo impact
Safety precautionNo recommendation

Programmatic Use

Parameter: CustomSymbolStrUtil
Type: character vector
Value: valid combination of tokens
Default: $N$C

Version History

Introduced in R2013b