Using Simulink Previous page   Next Page

The Optimization Pane

The Optimization pane allows you to select various options that improve simulation performance and the performance of code generated from this model. This pane contains a panel of optimizations that apply both to simulation and to code generated from the model.


Block reduction optimization

Replaces a group of blocks with a synthesized block, thereby speeding up execution of the model.

This option performs the following kinds of block reduction optimizations.

Accumulator folding.   Simulink reduces block diagrams that represent accumulators to a single block.

Redundant Type Conversion Removal.   Removes unnecessary type conversion blocks. For example, this optimization will remove an int type conversion block whose input and output are of type int.

Dead Branch Elimination.   Eliminates any block that exists on a dead branch of the block diagram, i.e., a branch whose execution does not affect the simulation. A block must meet the following conditions to be considered part of a dead branch:

Consider the following model.

The upper branch of this model's block diagram has no effect on the output. Dead branch optimization therefore eliminates the Gain block from the compiled model.

Conditional input branch execution

This optimization applies to models containing Switch and Multiport Switch blocks. When enabled, this optimization executes only the blocks required to compute the control input and the data input selected by the control input at each time step for each Switch or Multiport Switch block in the model. Similarly, code generated from the model by Real-Time Workshop executes only the code needed to compute the control input and the selected data input. This optimization speeds simulation and execution of code generated from the model.

At the beginning of the simulation or code generation, Simulink examines each signal path feeding a switch block data input to determine the portion of the path that can be optimized. The optimizable portion of the path is that part of the signal path that stretches from the corresponding data input back to the first block that is a nonvirtual subsystem, has continuous or discrete states, or detects zero crossings.

Simulink encloses the optimizable portion of the signal path in an invisible atomic subsystem. During simulation, if a switch data input is not selected, Simulink executes only the nonoptimizable portion of the signal path feeding the input. If the data input is selected, Simulink executes both the nonoptimizable and the optimizable portion of the input signal path.

Inline parameters

By default you can modify ("tune") many block parameters during simulation (see Tunable Parameters). Selecting this option makes all parameters nontunable by default. Making parameters nontunable allows Simulink to move blocks whose outputs depend only on block parameter values outside the simulation loop, thereby speeding up simulation of the model and execution of code generated from the model. When this option is selected, Simulink disables the parameter controls of the block dialog boxes for the blocks in your model to prevent you from accidentally modifying the block parameters.

Simulink allows you to override the Inline parameters option for parameters whose values are defined by variables in the MATLAB workspace. To specify that such a parameter remain tunable, specify the parameter as global in the Model Parameter Configuration dialog box (see Model Parameter Configuration Dialog Box). To display the dialog box, click the adjacent Configure button. To tune a global parameter, change the value of the corresponding workspace variable and choose Update Diagram (Ctrl+D) from the Simulink Edit menu.

Implement logic signals as boolean data (vs. double)

Causes blocks that accept Boolean signals to require Boolean signals. If this option is off, blocks that accept inputs of type boolean also accept inputs of type double. For example, consider the following model.

This model connects signals of type double to a Logical Operator block, which accepts inputs of type boolean. If the Boolean logic signals option is on, this model generates an error when executed. If the Boolean logic signals option is off, this model runs without error.

Signal storage reuse

Causes Simulink to reuse memory buffers allocated to store block input and output signals. If this option is off, Simulink allocates a separate memory buffer for each block's outputs. This can substantially increase the amount of memory required to simulate large models, so you should select this option only when you need to debug a model. In particular, you should disable signal storage reuse if you need to

Simulink opens an error dialog if Signal storage reuse is enabled and you attempt to use a Floating Scope or floating Display block to display a signal whose buffer has been reused.

Application lifespan (days)

Specifies the lifespan in days of the system represented by this model. This value and the simulation step size determine the data type used by fixed-point blocks to store absolute time values.


Model Parameter Configuration Dialog Box

The Model Parameter Configuration dialog box allows you to override the Inline parameters option (see Inline parameters) for selected parameters.

The dialog box has the following controls.

Source list..   Displays a list of workspace variables. The options are

Refresh list.   Updates the source list. Click this button if you have added a variable to the workspace since the last time the list was displayed.

Add to table.   Adds the variables selected in the source list to the adjacent table of tunable parameters.

New.   Defines a new parameter and adds it to the list of tunable parameters. Use this button to create tunable parameters that are not yet defined in the MATLAB workspace.

Storage class.   Used for code generation. See the Real-Time Workshop documentation for more information.

Storage type qualifier.   Used for code generation. See the Real-Time Workshop documentation for more information.


Previous page  Data Import/Export Pane The Diagnostics Pane Next page

© 1994-2005 The MathWorks, Inc.