| Stateflow User's Guide |
 |
Configuring a Simulation Target for Stateflow
You can configure your model to simulate the Stateflow blocks in your model by configuring the Stateflow simulation target (sfun). Any model that contains one or more Stateflow blocks has a Stateflow simulation target. When you configure this target and build the model for simulation, this target configuration is carried into the simulation configuration for the entire model.
To configure the Stateflow simulation target, do the following:
- From the Stateflow diagram editor Tools menu, select Open Simulation Target.
- The Stateflow Target Builder dialog appears.

- Select one of the following build options:
- Stateflow Target (incremental) to rebuild only those portions of the target corresponding to charts that have changed logically since the last build.
- Rebuild All (including libraries) to rebuild the target, including chart libraries, from scratch.
- Make without generating code to invoke the make process without generating code. This is useful when you have custom source files that need to be recompiled within a Stateflow incremental build mechanism that does not detect changes in custom software files.
- To specify code generation options for a simulation target, select Coder Options.
- The Simulation Coder Options dialog box appears.

- Select OK or Apply for any or all of the following options:
- Enable debugging/animation -- Enables chart animation and debugging. Stateflow enables debugging code generation when you use the debugger to start a model simulation. You can enable or disable chart animation separately in the debugger. (The Stateflow debugger does not work with stand-alone and RTW targets. Therefore, Stateflow and Real-Time Workshop do not generate debugging/animation code for these targets, even if this option is enabled.)
- Enable overflow detection (with debugging) -- Overflow occurs for data when a value is assigned to it that exceeds the numeric capacity of its type. If this check box is selected, Stateflow generates code for overflow detection of Stateflow data. If cleared, no code is generated for overflow detection.
| Note
To actually detect overflow in data during simulation, you must also select the Data Range check box in the Debugger window. See Debugging Data Range Violations for more details.
|
- Echo expressions without semicolons -- Display run-time output in the MATLAB Command Window, specifically actions that are not terminated by a semicolon.
- Select (check) the Use settings for all libraries option if you want the settings that you specify for this target to apply to all the Stateflow charts contributed by library models as well.
- To specify custom code options for the simulation target, select Target Options.
- See Integrating Custom Code with Stateflow Targets for details on using the simulation target to integrate custom code with generated code for the Stateflow diagrams in the model.
- To finish configuring the simulation target, do one of the following:
- Click Apply to apply the selected options
- Click OK to apply the options and close the dialog
- Click Build to build the simulation target.
| Note
Use the Chart Properties dialog to tell the simulation target builder to recognize C bitwise operators (~, &, |, ^, >>, and so on) in action language statements and encode them as C bitwise operations.
|
| Adding a Stateflow Target | | Configuring Real-Time Workshop for Stateflow |  |
© 1994-2005 The MathWorks, Inc.