Main Content

Combine signal/state structures

Whether to combine global block signal and state data into one structure

Model Configuration Pane: Code Generation / Interface

Description

The Combine signal/state structures parameter specifies whether the code generator combines global block signal and state data into one data structure.

Settings

Off (default) | On
On

Enables generation of global block signal data (block I/O) and global state data (DWork vectors) into one data structure.

Off

Disables generation of global block signal and state data into one data structure. The code generator produces separate data structures for global block signals and global states.

This parameter setting is not relevant and, therefore, is not supported for component models configured with a service code interface.

Examples

expand all

  1. For a model that generates the following code:

    /* Block signals (auto storage) */
    typedef struct {
      struct {
        uint_T LogicalOperator:1;
        uint_T UnitDelay1:1;
      } bitsForTID0;
    } BlockIO;
    /* Block states (auto storage) */
    typedef struct {
      struct {
        uint_T UnitDelay_DSTATE:1
        uint_T UnitDelay1_DSTATE:1
      } bitsForTID0;
    } D_Work;
  2. If you select Combine signal/state structures, the generated code now looks like this:

    /* Block signals and states (auto storage)
       for system */
    typedef struct {
      struct {
        uint_T LogicalOperator:1;
        uint_T UnitDelay1:1;
        uint_T UnitDelay_DSTATE:1;
        uint_T UnitDelay1_DSTATE:1;
      } bitsForTID0;
    } D_Work;

Tips

The benefits to selecting this parameter are:

  • Enables tighter memory representation through fewer bitfields, which reduces RAM usage

  • Enables better alignment of data structure elements, which reduces RAM usage

  • Reduces the number of arguments to reusable subsystem and model block functions, which reduces stack usage

  • Better readable data structures with more consistent element sorting

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Programmatic Use

Parameter: CombineSignalStateStructs
Type: character vector
Value: 'on' | 'off'
Default: off

Version History

Introduced in R2011a