Resolve Data Properties from Simulink Signal Objects
Stateflow® local and output data in charts can explicitly inherit properties from
Simulink.Signal objects in the model workspace or base workspace. This process is called signal resolution and requires that the resolved signal have the same name as the chart output or local data.
When Stateflow local or output data resolve to Simulink signal objects, they inherit these properties:
Storage class controls the appearance of chart data in the generated code. See Organize Parameter Data into a Structure by Using Struct Storage Class (Embedded Coder).
Enable Signal Resolution
To enable explicit signal resolution:
Open the Configuration Parameters dialog box and, in the Diagnostics > Data Validity pane, set Signal resolution to a value other than
None. For more information about the other options, see Signal resolution (Simulink).
In the model workspace, base workspace, or data dictionary, define a
Simulink.Signalobject with the properties you want your Stateflow data to inherit. For more information about creating Simulink signals, see
Add chart output or local data. Use the same name for your data as for the
Enable the Data must resolve to signal object property, as described in Set Data Properties. After you select this property, the dialog box removes or dims the properties that your data inherits from the signal.
A Simple Example
This model shows how a chart resolves local and output data to
In the base workspace, there are three
Simulink.Signal objects, each with a different set of properties.
y1has these properties: Type =
double, Dimensions =
1, and Storage Class =
y2has these properties: Type =
uint32, Dimensions =
[2 2], and Storage Class =
localhas these properties: Type =
single, Dimensions =
1, and Storage Class =
The chart contains three data objects — two outputs and a local variable — that resolve to a signal with the same name.
When you build the model, each data object inherits the properties of the identically named signal.
The generated code declares the data based on the storage class that the data inherits from the associated Simulink signal. For example, the header file below declares local to be an exported global variable:
/* * Exported States * * Note: Exported states are block states with an exported global * storage class designation. Code generation will declare the memory for these * states and exports their symbols. * */ extern real32_T local; /* '<Root>/Signal Object Chart' */
- Symbol Resolution (Simulink)
- Organize Parameter Data into a Structure by Using Struct Storage Class (Embedded Coder)