Main Content

Store Continuous State Information in Local Variables

To compute a continuous state, you must determine its time derivative. You can represent this information by using local variables that are updated in continuous time. Continuous-time simulation is supported only in Stateflow®charts in Simulink®模型。有关更多信息,请参见Continuous-Time Modeling in Stateflow.

Define Continuous-Time Variables

  1. Configure the chart to update in continuous time, as described inConfigure a Stateflow Chart for Continuous-Time Simulation.

  2. Add a data object to your chart, as described inAdd Stateflow Data.

  3. Set theScopeproperty for the data object toLocal.

  4. Set theUpdate Methodproperty for the data object toContinuous.

In a Stateflow chart, continuous-time variables always have typedouble.

Compute Implicit Time Derivatives

For each continuous-time variable, Stateflow implicitly creates a variable to represent its time derivative. A chart denotes time derivative variables asvariable_name_dot. For example,data_dotrepresents the time derivative of a continuous variabledata. You can write to the time derivative variable in theduring行动的统计e. The time derivative variable does not appear in theSymbolspane or in the Model Explorer.

Note

Do not explicitly define variables with the suffix_dotin a chart configured for continuous-time simulation.

Expose Continuous State to a万博1manbetxModel

In a Stateflow chart, you represent the continuous state by using local variables rather than inputs or outputs. To expose the continuous state to a Simulink model, you must explicitly assign the local variables to Stateflow outputs in theduring行动的统计e.

Guidelines for Continuous-Time Variables

  • Scope for continuous-time variables can beLocalorOutput.

  • Define continuous-time variables at the chart level or below in the Stateflow hierarchy.

  • Expose the continuous state of a chart by assigning the local continuous-time variable to a Stateflow output.

Related Topics