Main Content

Generate separate internal data per entry-point function

Whether to place variables representing signals and states operated on at same rate in same data structure

Since R2021a

Model Configuration Pane: Code Generation / Interface

Description

The Generate separate internal data per entry-point function parameter specifies whether to place the variables that represent model signals (block I/O data) and discrete states (DWork data) that are operated on at the same rate into the same data structure. If you configure a model to place the data associated with different rates in different structures, the code generator includes prefixes FuncInternalData0, FunctionInternalData1, and so on in the structure names.

Dependency

To enable this parameter, select the Combine signal/state structures parameter.

Settings

Off (default) | On
On

Enables generation of code for storing global block signal data (block I/O) and global state data (DWork vectors) that are operated on at the same rate in one data structure.

Off

Disables generation of code for storing global block signal data and global state data that are operated on at the same rate in one data structure.

Examples

expand all

  1. For a model that generates this code:

    /* Block signals and states (default storage) for system '<Root>' */
    typedef struct {
      real_T RTBS2F;                       /* '<Root>/RTBS2F' */
      real_T UDS;                          /* '<Root>/UDS' */
      real_T Sum3;                         /* '<Root>/Sum3' */
      real_T Sum1;                         /* '<Root>/Sum1' */
      real_T UDF_DSTATE;                   /* '<Root>/UDF' */
      real_T UDS_DSTATE;                   /* '<Root>/UDS' */
      real_T RTBS2F_Buffer0;               /* '<Root>/RTBS2F' */
      real_T MIXEDDSM;                     /* '<Root>/DSMM' */
      real_T SLOWDSM;                      /* '<Root>/DSMS' */
    } DW_demo1_T;
    
  2. If you select Generate separate internal data per entry-point function, the generated code looks like this:

    /* Block signals and states (default storage) for system '<Root>' */
    typedef struct {
      real_T RTBS2F_Buffer0;               /* '<Root>/RTBS2F' */
      real_T MIXEDDSM;                     /* '<Root>/DSMM' */
    } DW_demo1_T;
    
    /* Internal Data Grouped For Same Function, for system '<Root>' */
    typedef struct {
      real_T RTBS2F;                       /* '<Root>/RTBS2F' */
      real_T Sum3;                         /* '<Root>/Sum3' */
      real_T UDF_DSTATE;                   /* '<Root>/UDF' */
    } FuncInternalData0_demo1_T;
    
    /* Internal Data Grouped For Same Function, for system '<Root>' */
    typedef struct {
      real_T UDS;                          /* '<Root>/UDS' */
      real_T Sum1;                         /* '<Root>/Sum1' */
      real_T UDS_DSTATE;                   /* '<Root>/UDS' */
      real_T SLOWDSM;                      /* '<Root>/DSMS' */
    } FuncInternalData1_demo1_T;
    

Tips

Selecting this parameter improves cache performance when deploying a model to a multicore hardware environment that meets these requirements:

  • The model has multiple rates and the Treat each discrete rate as a separate task parameter is selected.

  • The model contains multiple exported functions that run at different rates.

The previous models have separate entry-point functions that different cores can call. A core has its own data cache. Placing data for a single entry-point function in the same core data cache improves execution efficiency because the cache accesses are contiguous rather than spread out over multiple cores.

Recommended Settings

ApplicationSetting
DebuggingNo impact
TraceabilityNo impact
EfficiencyOn
Safety precautionNo impact

Programmatic Use

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

Version History

Introduced in R2021a