By default, signal lines, block parameters, states, and other model data appear in the generated code as fields of standard structures. For general information, see How Generated Code Stores Internal Signal, State, and Parameter Data.
The table shows some common data structures in the generated code. The name of the structure type and, if applicable, structure variable in the code that you generate from a model depends on the model settings. Regardless of the settings, the name of the structure type in the code contains the short name from the Short Name of Structure Type column in the table.
Data Structures Generated for a Model
Short Name of Structure Type | Data Represented in the Structure |
---|---|
ExtU |
Data from root Inport blocks |
ExtY |
Data from root Outport blocks |
B |
Block output signals |
ConstB |
Block outputs that have constant values |
P |
Block parameters |
ConstP |
Constant parameters |
DW |
Discrete block states |
XDis |
Status of enabled subsystems |
InstP | Parameter arguments |
SharedDSM | Shared local data stores |
For additional structures, see System-generated identifiers (Embedded Coder).
You can exclude data from appearing in these structures by using:
Direct application of storage classes. For example, you can use storage classes to represent signals, tunable parameters, and states as individual global variables. For more information, see C Code Generation Configuration for Model Interface Elements.
Configuration parameters, such as those on the Optimization pane in the Configuration Parameters dialog box. You can adjust these configuration parameters to control the default representation of data. For more information, see Model Configuration Parameters: Code Generation Optimization.
To control the characteristics of the standard data structures, use the information in the table.
Name | How to Change Name |
---|---|
Structure types | Specify a naming rule to use for the types. Set a value for Configuration Parameters > Global types. |
Global structure variables | Specify a naming rule with Configuration Parameters > Global variables. |
Names of structure fields | By default, the name of each structure field derives from the name of the data item in the model (for example, the name of a block state, which you specify by using the State name block parameter). Specify a naming rule with Configuration Parameters > Field name of global types. |
Data types of structure fields | Use Simulink.AliasType objects and data type replacement to
rename primitive types for the corresponding data items in the model. See Control Data Type Names in Generated Code (Embedded Coder). |
For more information about configuration parameters that control names and other identifiers in the generated code, see Customize Generated Identifiers (Embedded Coder).
Combine signal/state structures (Embedded Coder)