This is machine translation

Translated by Microsoft
Mouseover text to see original. Click the button below to return to the English version of the page.

Note: This page has been translated by MathWorks. Click here to see
To view all translated materials including this page, select Country from the country navigator on the bottom of this page.

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.

For information about Simulink® signal resolution, see Symbol Resolution (Simulink) and Symbol Resolution Process (Simulink).

Inherited Properties

When Stateflow local or output data resolve to Simulink signal objects, they inherit these properties:

  • Size

  • Complexity

  • Type

  • Minimum value

  • Maximum value

  • Initial value

  • Storage class

Storage class controls the appearance of chart data in the generated code. See Apply Custom Storage Classes to Individual Signal, State, and Parameter Data Elements (Embedded Coder).

Enable Signal Resolution

To enable explicit signal resolution, follow these steps:

  1. Set Configuration Parameters > Diagnostics > Data Validity > Signal resolution to a value other than None. For more information about the other options, see Signal resolution (Simulink).

  2. In the model workspace, base workspace, or data dictionary, define a Simulink.Signal object with the properties you want your Stateflow data to inherit. For more information about creating Simulink signals, see Simulink.Signal.

  3. Add output or local data to a chart.

  4. Enter a name for your data that matches the name of the Simulink.Signal object.

  5. In the data properties, select the Data must resolve to signal object check box. After you select this check box, 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 Simulink.Signal objects.

In the base workspace, there are three Simulink.Signal objects, each with a different set of properties.

  • y1 has these properties: Type = double, Dimensions = 1, and Storage Class = Model default.

  • y2 has these properties: Type = uint32, Dimensions = [2 2], and Storage Class = Auto.

  • local has these properties: Type = single, Dimensions = 1, and Storage Class = ExportedGlobal.

The chart contains three data objects — two outputs and a local variable — that will 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.
 *
 */
extern real32_T local;                  /* '<Root>/Signal Object Chart' */

See Also

Related Topics