0% found this document useful (0 votes)
39 views

Simulink 7 - GUI

Uploaded by

Arthur Liraneto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
39 views

Simulink 7 - GUI

Uploaded by

Arthur Liraneto
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 553

Simulink® 7

Graphical User Interface


How to Contact The MathWorks

www.mathworks.com Web
comp.soft-sys.matlab Newsgroup
www.mathworks.com/contact_TS.html Technical Support

[email protected] Product enhancement suggestions


[email protected] Bug reports
[email protected] Documentation error reports
[email protected] Order status, license renewals, passcodes
[email protected] Sales, pricing, and general information

508-647-7000 (Phone)

508-647-7001 (Fax)

The MathWorks, Inc.


3 Apple Hill Drive
Natick, MA 01760-2098
For contact information about worldwide offices, see the MathWorks Web site.
Simulink® Graphical User Interface
© COPYRIGHT 1990–2009 by The MathWorks, Inc.
The software described in this document is furnished under a license agreement. The software may be used
or copied only under the terms of the license agreement. No part of this manual may be photocopied or
reproduced in any form without prior written consent from The MathWorks, Inc.
FEDERAL ACQUISITION: This provision applies to all acquisitions of the Program and Documentation
by, for, or through the federal government of the United States. By accepting delivery of the Program
or Documentation, the government hereby agrees that this software or documentation qualifies as
commercial computer software or commercial computer software documentation as such terms are used
or defined in FAR 12.212, DFARS Part 227.72, and DFARS 252.227-7014. Accordingly, the terms and
conditions of this Agreement and only those rights specified in this Agreement, shall pertain to and govern
the use, modification, reproduction, release, performance, display, and disclosure of the Program and
Documentation by the federal government (or other entity acquiring for or through the federal government)
and shall supersede any conflicting contractual terms or conditions. If this License fails to meet the
government’s needs or is inconsistent in any respect with federal procurement law, the government agrees
to return the Program and Documentation, unused, to The MathWorks, Inc.
Trademarks
MATLAB and Simulink are registered trademarks of The MathWorks, Inc. See
www.mathworks.com/trademarks for a list of additional trademarks. Other product or brand
names may be trademarks or registered trademarks of their respective holders.
Patents
The MathWorks products are protected by one or more U.S. patents. Please see
www.mathworks.com/patents for more information.
Revision History
September 2007 Online only New for Simulink 7.0 (Release 2007b)
March 2008 Online only Revised for Simulink 7.1 (Release 2008a)
October 2008 Online only Revised for Simulink 7.2 (Release 2008b)
March 2009 Online only Revised for Simulink 7.3 (Release 2009a)
September 2009 Online only Revised for Simulink 7.4 (Release 2009b)
1

Configuration Parameters
Dialog Box

• “Configuration Parameters Dialog Box Overview” on page 1-2


• “Model Configuration Pane” on page 1-5
• “Solver Pane” on page 1-8
• “Data Import/Export Pane” on page 1-76
• “Optimization Pane” on page 1-111
• “Diagnostics Pane: Solver” on page 1-187
• “Diagnostics Pane: Sample Time” on page 1-213
• “Diagnostics Pane: Data Validity” on page 1-229
• “Diagnostics Pane: Type Conversion” on page 1-284
• “Diagnostics Pane: Connectivity” on page 1-297
• “Diagnostics Pane: Compatibility” on page 1-322
• “Diagnostics Pane: Model Referencing” on page 1-326
• “Diagnostics Pane: Saving” on page 1-340
• “Hardware Implementation Pane” on page 1-346
• “Model Referencing Pane” on page 1-408
• “Simulation Target Pane: General” on page 1-424
• “Simulation Target Pane: Symbols” on page 1-440
• “Simulation Target Pane: Custom Code” on page 1-444
1 Configuration Parameters Dialog Box

Configuration Parameters Dialog Box Overview


The Configuration Parameters dialog box specifies the settings for a
model’s active configuration set. These parameters determine the type of
solver used, import and export settings, and other values that determine how
the model runs. See Configuration Sets for more information.

Note You can also use the Model Explorer to modify settings for the active
configuration set or any other configuration set. See The Model Explorer
for more information.

To display the dialog box, select Simulation > Configuration Parameters


in the Model Editor, or press Ctrl+E. The dialog box appears.

1-2
Configuration Parameters Dialog Box Overview

The dialog box groups the configuration parameters into various categories.
To display the parameters for a specific category, click the category in the
Select tree on the left side of the dialog box.

In most cases, Simulink® software does not apply changes until you click OK
or Apply at the bottom of the dialog box. The OK button applies your changes
and dismisses the dialog box. The Apply button applies your changes but
leaves the dialog box open.

1-3
1 Configuration Parameters Dialog Box

Note Each of the parameters in the Configuration Parameters dialog


box can also be set via the sim and simset commands. Each parameter
description includes the corresponding command line information.

1-4
Model Configuration Pane

Model Configuration Pane


In this section...
“Model Configuration Overview” on page 1-5
“Name” on page 1-6
“Description” on page 1-7

Model Configuration Overview


View or edit the name and description of your configuration set.

In the Model Explorer you can edit the name and description of your
configuration sets.

In the Model Explorer or Simulink Preferences window you can edit


the description of your template configuration set, Model Configuration
Preferences. Go to the Model Configuration Preferences to edit the template
Configuration Parameters to be used as defaults for new models.

When editing the Model Configuration preferences, you can click Restore
to Default Preferences to restore the default configuration settings for
creating new models. These underlying defaults cannot be changed.

1-5
1 Configuration Parameters Dialog Box

Name
Specify the name of your configuration set.

Settings
Default: Configuration (for Active configuration set) or Configuration
Preferences (for default configuration set).

Edit the name of your configuration set.

In the Model Configuration Preferences, the name of the default configuration


is always Configuration Preferences, and cannot be changed.

1-6
Model Configuration Pane

Description
Specify a description of your configuration set.

Settings
No Default

Enter text to describe your configuration set.

1-7
1 Configuration Parameters Dialog Box

Solver Pane

In this section...
“Solver Overview” on page 1-10
“Start time” on page 1-12
“Stop time” on page 1-14
“Type” on page 1-16
“Solver” on page 1-19
“Max Step Size” on page 1-27
“Initial Step Size” on page 1-29
“Min Step Size” on page 1-31
“Relative tolerance” on page 1-33
“Absolute tolerance” on page 1-35
“Maximum order” on page 1-38
“Solver reset method” on page 1-40

1-8
Solver Pane

In this section...
“Number of consecutive min steps” on page 1-42
“Shape preservation” on page 1-44
“Tasking mode for periodic sample times” on page 1-46
“Automatically handle rate transition for data transfer” on page 1-48
“Deterministic data transfer” on page 1-50
“Higher priority value indicates higher task priority” on page 1-52
“Zero-crossing control” on page 1-54
“Time tolerance” on page 1-56
“Number of consecutive zero crossings” on page 1-58
“Algorithm” on page 1-60
“Signal threshold” on page 1-62
“Periodic sample time constraint” on page 1-64
“Fixed-step size (fundamental sample time)” on page 1-67
“Sample time properties” on page 1-69
“Extrapolation order” on page 1-72
“Number Newton’s iterations” on page 1-74

1-9
1 Configuration Parameters Dialog Box

Solver Overview
Specify the simulation start and stop time, and the solver configuration for
the simulation. Use the Solver pane to set up a solver for a model’s active
configuration set.

A solver computes a dynamic system’s states at successive time steps over a


specified time span, using information provided by the model.

Configuration

1 Select a solver type from the Type list.

2 Select a solver from the Solver list.

3 Set the parameters displayed for the selected type and solver combination.

4 Apply the changes.

Tips

• Simulation time is not the same as clock time. For example, running
a simulation for 10 seconds usually does not take 10 seconds. Total
simulation time depends on factors such as model complexity, solver step
sizes, and computer speed.

• Fixed-step solver type is required for code generation, unless you use an
S-function or RSim target.
• Variable-step solver type can significantly shorten the time required
to simulate models in which states change rapidly or which contain
discontinuities.

See Also

• Solvers
• Choosing a Solver
• Specifying a Simulation Start and Stop Time

1-10
Solver Pane

• Configuration Parameters Dialog Box


• Solver Pane

1-11
1 Configuration Parameters Dialog Box

Start time
Specify the start time for the simulation or generated code as a
double-precision value, scaled to seconds.

Settings
Default: 0.0

• A start time other than 0.0 is an offset, and must be less than or equal to
the stop time. An example of when you might use an offset is to set up a
delay to accommodate some type of initialization.
• The values of block parameters with initial conditions must match the
initial condition settings at the specified start time.
• Simulation time is not the same as clock time. For example, running
a simulation for 10 seconds usually does not take 10 seconds. Total
simulation time depends on factors such as model complexity, solver step
sizes, and computer speed.

Command-Line Information
Parameter: StartTime
Type: string
Value: any valid value
Default: '0.0'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution 0.0

1-12
Solver Pane

See Also

• Specifying a Simulation Start and Stop Time


• Configuration Parameters Dialog Box
• Solver Pane

1-13
1 Configuration Parameters Dialog Box

Stop time
Specify the stop time for the simulation or generated code as a double-precision
value, scaled to seconds.

Settings
Default: 10

• Stop time must be greater than or equal to the start time.


• Specify inf to run a simulation or generated program until you explicitly
pause or stop it.
• If the stop time is the same as the start time, the simulation or generated
program runs for one step.
• Simulation time is not the same as clock time. For example, running
a simulation for 10 seconds usually does not take 10 seconds. Total
simulation time depends on factors such as model complexity, solver step
sizes, and computer speed.
• If your model includes blocks that depend on absolute time and you are
creating a design that runs indefinitely, see Blocks That Depend on
Absolute Time.

Command-Line Information
Parameter: StopTime
Type: string
Value: any valid value
Default: '10.0'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Any positive value

1-14
Solver Pane

See Also

• Blocks That Depend on Absolute Time


• Using Blocks to Stop or Pause a Simulation
• Specifying a Simulation Start and Stop Time
• Configuration Parameters Dialog Box
• Solver Pane

1-15
1 Configuration Parameters Dialog Box

Type
Select the type of solver you want to use to simulate your model.

Settings
Default: Variable-step

Variable-step
Step size varies from step to step, depending on model dynamics. A
variable-step solver:
• Reduces step size when model states change rapidly, to maintain
accuracy.
• Increases step size when model states change slowly, to avoid
unnecessary steps.

Variable-step is recommended for models in which states change


rapidly or that contain discontinuities. In these cases, a variable-step
solver requires fewer time steps than a fixed-step solver to achieve a
comparable level of accuracy. This can significantly shorten simulation
time.
Fixed-step
Step size remains constant throughout the simulation.

Required for code generation, unless you use an S-function or RSim


target.

Note The solver computes the next time as the sum of the current time and
the step size.

Dependencies
Selecting Variable-step enables the following parameters:

• Solver
• Max step size
• Min step size

1-16
Solver Pane

• Initial step size


• Relative tolerance
• Absolute tolerance
• Shape preservation
• Initial step size
• Number of consecutive min steps
• Zero-crossing control
• Time tolerance
• Number of consecutive zero crossings
• Algorithm

Selecting Fixed-step enables the following parameters:

• Solver
• Periodic sample time constraint
• Fixed-step size (fundamental sample time)
• Tasking mode for periodic sample times
• Higher priority value indicates higher task priority
• Automatically handle rate transitions for data transfers

Command-Line Information
Parameter: SolverType
Type: string
Value: 'Variable-step' | 'Fixed-step'
Default: 'Variable-step'

Recommended Settings

Application Setting
Debugging No impact

1-17
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution Fixed-step

See Also

• Solvers
• Choosing a Solver
• “Purely Discrete Systems”
• Configuration Parameters Dialog Box
• Solver Pane

1-18
Solver Pane

Solver
Select the solver you want to use to compute the model’s states during
simulation or code generation.

Settings
The available solvers change depending on which solver Type you selected:

• “Fixed-step Solvers” on page 1-19


• “Variable-step Solvers” on page 1-21

Fixed-step Solvers. Default: ode3 (Bogacki-Shampine)

ode3 (Bogacki-Shampine)
Computes the model’s state at the next time step as an explicit function
of the current value of the state and the state derivatives, using the
Bogacki-Shampine Formula integration technique to compute the state
derivatives. In the following example, X is the state, DX is the state
derivative, and h is the step size:

X(n+1) = X(n) + h * DX(n)

Discrete (no continuous states)


Computes the time of the next time step by adding a fixed step size
to the current time.

Use this solver for models with no states or discrete states only, using a
fixed step size. Relies on the model’s blocks to update discrete states.

The accuracy and length of time of the resulting simulation depends on


the size of the steps taken by the simulation: the smaller the step size,
the more accurate the results but the longer the simulation takes.

Note The fixed-step discrete solver cannot be used to simulate models


that have continuous states.

1-19
1 Configuration Parameters Dialog Box

ode5 (Dormand-Prince)
Computes the model’s state at the next time step as an explicit function
of the current value of the state and the state derivatives. Uses the
Dormand-Prince Formula integration technique to compute the state
derivatives. In the following example, X is the state, DX is the state
derivative, and h is the step size:

X(n+1) = X(n) + h * DX(n)

ode4 (Runge-Kutta)
Uses the Fourth-Order Runge-Kutta (RK4) Formula integration
technique to compute the model’s state at the next time step as
an explicit function of the current value of the state and the state
derivatives. In the following example, X is the state, DX is the state
derivative, and h is the step size:

X(n+1) = X(n) + h * DX(n)

ode2 (Heun)
Uses the Heun’s Method integration technique to compute the model’s
state at the next time step as an explicit function of the current value of
the state and the state derivatives. In the following example, X is the
state, DX is the state derivative, and h is the step size:

X(n+1) = X(n) + h * DX(n)

ode1 (Euler)
Uses the Euler’s Method integration technique to computes the model’s
state at the next time step as an explicit function of the current value of
the state and the state derivatives. In the following example, X is the
state, DX is the state derivative, and h is the step size:

X(n+1) = X(n) + h * DX(n)

ode14x (extrapolation)
Uses a combination of Newton’s method and extrapolation from the
current value to compute the model’s state at the next time step, as an
implicit function of the state and the state derivative at the next time
step. In the following example, X is the state, DX is the state derivative,
and h is the step size:

X(n+1) - X(n) - h * DX(n+1) = 0

1-20
Solver Pane

This solver requires more computation per step than an explicit solver,
but is more accurate for a given step size.

Variable-step Solvers. Default: ode45 (Dormand-Prince)

ode45 (Dormand-Prince)
Computes the model’s state at the next time step using an explicit
Runge-Kutta (4,5) formula (the Dormand-Prince pair) for numerical
integration.

ode45 is a one-step solver, and therefore only needs the solution at the
preceding time point.

Use ode45 as a first try for most problems.


Discrete (no continuous states)
Computes the time of the next step by adding a step size that varies
depending on the rate of change of the model’s states.

Use this solver for models with no states or discrete states only, using
a variable step size.
ode23 (Bogacki-Shampine)
Computes the model’s state at the next time step using an explicit
Runge-Kutta (2,3) formula (the Bogacki-Shampine pair) for numerical
integration.

ode23 is a one-step solver, and therefore only needs the solution at the
preceding time point.

ode23 is more efficient than ode45 at crude tolerances and in the


presence of mild stiffness.
ode113 (Adams)
Computes the model’s state at the next time step using a variable-order
Adams-Bashforth-Moulton PECE numerical integration technique.

ode113 is a multistep solver, and thus generally needs the solutions at


several preceding time points to compute the current solution.

ode113 can be more efficient than ode45 at stringent tolerances.

1-21
1 Configuration Parameters Dialog Box

ode15s (stiff/NDF)
Computes the model’s state at the next time step using variable-order
numerical differentiation formulas (NDFs). These are related to, but
more efficient than the backward differentiation formulas (BDFs), also
known as Gear’s method.

ode15s is a multistep solver, and thus generally needs the solutions at


several preceding time points to compute the current solution.

ode15s is efficient for stiff problems. Try this solver if ode45 fails or is
inefficient.
ode23s (stiff/Mod. Rosenbrock)
Computes the model’s state at the next time step using a modified
Rosenbrock formula of order 2.

ode23s is a one-step solver, and therefore only needs the solution at


the preceding time point.

ode23s is more efficient than ode15s at crude tolerances, and can solve
stiff problems for which ode15s is ineffective.
ode23t (Mod. stiff/Trapezoidal)
Computes the model’s state at the next time step using an
implementation of the trapezoidal rule with a “free” interpolant.

ode23t is a one-step solver, and therefore only needs the solution at


the preceding time point.

Use ode23t if the problem is only moderately stiff and you need a
solution with no numerical damping.
ode23tb (stiff/TR-BDF2)
Computes the model’s state at the next time step using a multistep
implementation of TR-BDF2, an implicit Runge-Kutta formula with a
trapezoidal rule first stage, and a second stage consisting of a backward
differentiation formula of order two. By construction, the same iteration
matrix is used in evaluating both stages.

ode23tb is more efficient than ode15s at crude tolerances, and can solve
stiff problems for which ode15s is ineffective.

1-22
Solver Pane

Tips

• Identifying the optimal solver for a model requires experimentation, for an


in-depth discussion, see Choosing a Solver.
• The optimal solver balances acceptable accuracy with the shortest
simulation time.
• Simulink software uses a discrete solver for any model with no states or
discrete states only, even if you specify a continuous solver.
• A smaller step size increases accuracy, but also increases simulation time.
• The degree of computational complexity increases for oden, as n increases.
• As computational complexity increases, the accuracy of the results also
increases.

Dependencies
Selecting the ode1 (Euler) , ode2 (Huen), ode 3 (Bogacki-Shampine),
ode4 (Runge-Kutta), ode 5 (Dormand-Prince), or Discrete (no
continuous states) fixed-step solvers enables the following parameters:

• Fixed-step size (fundamental sample time)


• Periodic sample time constraint
• Tasking mode for periodic sample times
• Automatically handle rate transition for data transfers
• Higher priority value indicates higher task priority

Selecting ode14x (extrapolation) enables the following parameters:

• Fixed-step size (fundamental sample time)


• Extrapolation order
• Number Newton’s iterations
• Periodic sample time constraint
• Tasking mode for periodic sample times
• Automatically handle rate transition for data transfers

1-23
1 Configuration Parameters Dialog Box

• Higher priority value indicates higher task priority

Selecting the Discrete (no continuous states) variable-step solver


enables the following parameters:

• Max step size


• Automatically handle rate transition for data transfers
• Higher priority value indicates higher task priority
• Zero-crossing control
• Time tolerance
• Number of consecutive zero crossings
• Algorithm

Selecting ode45 (Dormand-Prince), ode23 (Bogacki-Shampine), ode113


(Adams), or ode23s (stiff/Mod. Rosenbrock) enables the following
parameters:

• Max step size


• Min step size
• Initial step size
• Relative tolerance
• Absolute tolerance
• Shape preservation
• Number of consecutive min steps
• Automatically handle rate transition for data transfers
• Higher priority value indicates higher task priority
• Zero-crossing control
• Time tolerance
• Number of consecutive zero crossings
• Algorithm

1-24
Solver Pane

Selecting ode15s (stiff/NDF), ode23t (Mod. stiff/Trapezoidal), or


ode23tb (stiff/TR-BDF2) enables the following parameters:

• Max step size


• Min step size
• Initial step size
• Solver reset method
• Number of consecutive min steps
• Relative tolerance
• Absolute tolerance
• Shape preservation
• Maximum order
• Automatically handle rate transition for data transfers
• Higher priority value indicates higher task priority
• Zero-crossing control
• Time tolerance
• Number of consecutive zero crossings
• Algorithm

Command-Line Information
Parameter: Solver
Type: string
Value: 'VariableStepDiscrete' | 'ode45' | 'ode23' |
'ode113' | 'ode15s' | 'ode23s' | 'ode23t' | 'ode23tb' |
'FixedStepDiscrete' | 'ode5' | 'ode4' | 'ode3' | 'ode2' |
'ode1' | 'ode14x'
Default: 'ode45'

1-25
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Discrete (no continuous states)

See Also
• Solvers
• Choosing a Solver
• “Purely Discrete Systems”
• Configuration Parameters Dialog Box
• Solver Pane

1-26
Solver Pane

Max Step Size


Specify the largest time step that the solver can take.

Settings
Default: auto

• For the discrete solver, the default value (auto) is the model’s shortest
sample time.
• For continuous solvers, the default value (auto) is determined from
the start and stop times. If the stop time equals the start time or is
inf, Simulink software chooses 0.2 seconds as the maximum step size.
Otherwise, it sets the maximum step size to

Tips

• Generally, the default maximum step size is sufficient. If you are concerned
about the solver missing significant behavior, change the parameter to
prevent the solver from taking too large a step.
• If the time span of the simulation is very long, the default step size might
be too large for the solver to find the solution.
• If your model contains periodic or nearly periodic behavior and you know
the period, set the maximum step size to some fraction (such as 1/4) of
that period.
• In general, for more output points, change the refine factor, not the
maximum step size. For more information, see Specifying Output Options.

Dependencies
This parameter is enabled only if the solver Type is set to Variable-step.

1-27
1 Configuration Parameters Dialog Box

Command-Line Information
Parameter: MaxStep
Type: string
Value: any valid value
Default: 'auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• “Purely Discrete Systems”


• Specifying Output Options
• Configuration Parameters Dialog Box
• Solver Pane

1-28
Solver Pane

Initial Step Size


Specify the size of the first time step that the solver takes.

Settings
Default: auto

By default, the solver selects an initial step size by examining the derivatives
of the states at the start time.

Tips
• Be careful when increasing the initial step size. If the first step size is too
large, the solver might step over important behavior.
• The initial step size parameter is a suggested first step size. The solver
tries this step size but reduces it if error criteria are not satisfied.

Dependencies
This parameter is enabled only if the solver Type is set to Variable-step.

Command-Line Information
Parameter: InitialStep
Type: string
Value: any valid value
Default: 'auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-29
1 Configuration Parameters Dialog Box

See Also
• “Purely Discrete Systems”
• Improving Simulation Performance and Accuracy
• Configuration Parameters Dialog Box
• Solver Pane

1-30
Solver Pane

Min Step Size


Specify the smallest time step that the solver can take.

Settings
Default: auto

• The default value (auto) sets an unlimited number of warnings and a


minimum step size on the order of machine precision.
• You can specify either a real number greater than zero, or a two-element
vector for which the first element is the minimum step size and the second
element is the maximum number of minimum step size warnings before
an error was issued.

Tips

• If the solver takes a smaller step to meet error tolerances, it issues a


warning indicating the current effective relative tolerance.
• Setting the second element to zero results in an error the first time the
solver must take a step smaller than the specified minimum. This is
equivalent to changing the Min step size violation diagnostic to error on
the Diagnostics pane (see Min step size violation).
• Setting the second element to -1 results in an unlimited number of
warnings. This is also the default if the input is a scalar.

Dependencies
This parameter is enabled only if the solver Type is set to Variable-step.

Command-Line Information
Parameter: MinStep
Type: string
Value: any valid value
Default: 'auto'

1-31
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• “Purely Discrete Systems”


• Min step size violation
• Configuration Parameters Dialog Box
• Solver Pane

1-32
Solver Pane

Relative tolerance
Specify the largest acceptable solver error, relative to the size of each state
during each time step. If the relative error exceeds this tolerance, the solver
reduces the time step size.

Settings
Default: 1e-3

• The relative tolerance is a percentage of the state’s value.


• The default value (1e-3) means that the computed state is accurate to
within 0.1%.

Tips

• The acceptable error at each time step is a function of both the Relative
tolerance and the Absolute tolerance. For more information about how
these settings work together, see Specifying Variable-Step Solver Error
Tolerances.
• During each time step, the solver computes the state values at the end of
the step and also determines the local error – the estimated error of these
state values. If the error is greater than the acceptable error for any state,
the solver reduces the step size and tries again.
• The default relative tolerance value is sufficient for most applications.
Decreasing the relative tolerance value can slow down the simulation.
• To check the accuracy of a simulation after you run it, you can reduce
the relative tolerance to 1e-4 and run it again. If the results of the two
simulations are not significantly different, you can feel confident that the
solution has converged.

Dependencies
This parameter is enabled only if you set:

• Solver Type to Variable-step.


• Solver to a continuous variable-step solver.

1-33
1 Configuration Parameters Dialog Box

This parameter works along with Absolute tolerance to determine the


acceptable error at each time step. For more information about how these
settings work together, see Specifying Variable-Step Solver Error Tolerances.

Command-Line Information
Parameter: RelTol
Type: string
Value: any valid value
Default: '1e-3'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Specifying Variable-Step Solver Error Tolerances


• Improving Simulation Performance and Accuracy
• Configuration Parameters Dialog Box
• Solver Pane

1-34
Solver Pane

Absolute tolerance
Specify the largest acceptable solver error, as the value of the measured
state approaches zero. If the absolute error exceeds this tolerance, the solver
reduces the time step size.

Settings
Default: auto

• The default value (auto) initially sets the absolute tolerance for each state
to 1e-6. As the simulation progresses, the absolute tolerance for each state
is reset to the maximum value that the state has thus far assumed times
the relative tolerance for that state.
For example, if a state goes from 0 to 1 and the Relative tolerance is 1e-3,
then by the end of the simulation the Absolute tolerance is set to 1e-3.
• If the computed setting is not suitable, you can determine an appropriate
setting yourself.

Tips

• The acceptable error at each time step is a function of both the Relative
tolerance and the Absolute tolerance. For more information about how
these settings work together, see Specifying Variable-Step Solver Error
Tolerances.
• The Integrator, Transfer Fcn, State-Space, and Zero-Pole blocks allow you
to specify absolute tolerance values for solving the model states that they
compute or that determine their output. The absolute tolerance values that
you specify in these blocks override the global setting in the Configuration
Parameters dialog box.
• You might want to override the Absolute tolerance setting using blocks if
the global setting does not provide sufficient error control for all of your
model’s states, for example if they vary widely in magnitude.
• If you set the Absolute tolerance too low, the solver may take too many
steps around near-zero state values, slowing down the simulation.
• To check the accuracy of a simulation after you run it, you can reduce the
absolute tolerance and run it again. If the results of the two simulations

1-35
1 Configuration Parameters Dialog Box

are not significantly different, you can feel confident that the solution
has converged.
• If your simulation results do not seem accurate, and your model has states
whose values approach zero, the Absolute tolerance may be too large.
Reduce the Absolute tolerance to force the simulation to take more steps
around areas of near-zero state values.

Dependencies
This parameter is enabled only if you set:

• Solver Type to Variable-step.


• Solver to a continuous variable-step solver.

This parameter works along with Relative tolerance to determine the


acceptable error at each time step. For more information about how these
settings work together, see Specifying Variable-Step Solver Error Tolerances.

Command-Line Information
Parameter: AbsTol
Type: string
Value: any valid value
Default: 'auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-36
Solver Pane

See Also

• Specifying Variable-Step Solver Error Tolerances


• Improving Simulation Performance and Accuracy
• Configuration Parameters Dialog Box
• Solver Pane

1-37
1 Configuration Parameters Dialog Box

Maximum order

Select the order of the numerical differentiation formulas (NDFs) used in


the ode15s solver.

Settings
Default: 5

5
Specifies that the solver uses fifth order NDFs.
1
Specifies that the solver uses first order NDFs.
2
Specifies that the solver uses second order NDFs.
3
Specifies that the solver uses third order NDFs.
4
Specifies that the solver uses fourth order NDFs.

Tips

• Although the higher order formulas are more accurate, they are less stable.
• If your model is stiff and requires more stability, reduce the maximum
order to 2 (the highest order for which the NDF formula is A-stable).
• As an alternative, you can try using the ode23s solver, which is a lower
order (and A-stable) solver.

Dependencies
This parameter is enabled only if Solver is set to ode15s.

1-38
Solver Pane

Command-Line Information
Parameter: MaxOrder
Type: integer
Value: 1 | 2 | 3 | 4 | 5
Default: 5

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Specifying Variable-Step Solver Error Tolerances


• Improving Simulation Performance and Accuracy
• Configuration Parameters Dialog Box
• Solver Pane

1-39
1 Configuration Parameters Dialog Box

Solver reset method


Select how the solver behaves during a reset, such as when it detects a zero
crossing.

Settings
Default: Fast

Fast
Specifies that the solver will not recompute the Jacobian matrix at a
solver reset.
Robust
Specifies that the solver will recompute the Jacobian matrix needed by
the integration step at every solver reset.

Tips

• Selecting Fast speeds up the simulation. However, it can result in incorrect


solutions in some cases.
• If you suspect that the simulation is giving incorrect results, try the Robust
setting. If there is no difference in simulation results between the fast and
robust settings, revert to the fast setting.

Dependencies
This parameter is enabled only if you select one of the following solvers:

• ode15s (Stiff/NDF)
• ode23t (Mod. Stiff/Trapezoidal)
• ode23tb (Stiff/TR-BDF2)

Command-Line Information
Parameter: SolverResetMethod
Type: string
Value: 'Fast' | 'Robust'
Default: 'Fast'

1-40
Solver Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Choosing a Solver
• Configuration Parameters Dialog Box
• Solver Pane

1-41
1 Configuration Parameters Dialog Box

Number of consecutive min steps


Specify the maximum number of consecutive minimum step size violations
allowed during simulation.

Settings
Default: 1

• A minimum step size violation occurs when a variable-step continuous


solver takes a smaller step than that specified by the Min step size
property (see Min step size).
• Simulink software counts the number of consecutive violations that it
detects. If the count exceeds the value of Number of consecutive min
steps, Simulink software displays either a warning or error message as
specified by the Min step size violation diagnostic (see Min step size
violation).

Dependencies
This parameter is enabled only if you set:

• Solver Type to Variable-step.


• Solver to a continuous variable step solver.

Command-Line Information
Parameter: MaxConsecutiveMinStep
Type: string
Value: any valid value
Default: '1'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-42
Solver Pane

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Choosing a Solver
• Min step size violation
• Min step size
• Configuration Parameters Dialog Box
• Solver Pane

1-43
1 Configuration Parameters Dialog Box

Shape preservation
At each time step use derivative information to improve integration accuracy.

Settings
Default: Disable all

Disable all
Do not perform Shape preservation on any signals
Enable all
Perform Shape preservation on all signals.

Tips

• The default setting (Disable all) usually provides good accuracy for most
models.
• Setting to Enable all will increase accuracy in those models having
signals whose derivative exhibits a high rate of change, but simulation
time may be increased.

Dependencies
This parameter is enabled only if a continuous-step solver is used.

Command-Line Information
Parameter: ShapePreserveControl
Type: string
Value: 'EnableAll' | 'DisableAll'
Default: 'DisableAll'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-44
Solver Pane

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Zero-Crossing Detection
• Solver Pane

1-45
1 Configuration Parameters Dialog Box

Tasking mode for periodic sample times


Select how blocks with periodic sample times execute.

Settings
Default: Auto

Auto
Specifies that single-tasking execution is used if:
• Your model contains one sample time.
• Your model contains a continuous and a discrete sample time, and
the fixed-step size is equal to the discrete sample time.

Selects multitasking execution for models operating at different sample


rates.
SingleTasking
Specifies that all blocks are processed through each stage of simulation
together (for example, calculating output and updating discrete states).
MultiTasking
Specifies that groups of blocks with the same execution priority
are processed through each stage of simulation (for example,
calculating output and updating discrete states) based on task
priority. Multitasking mode helps to create valid models of real-world
multitasking systems, where sections of your model represent
concurrent tasks.

Tip
The Multitask rate transition parameter on the Diagnostics > Sample
Time pane allows you to adjust error checking for sample rate transitions
between blocks that operate at different sample rates.

Dependency
This parameter is enabled by selecting Fixed-step solver type.

1-46
Solver Pane

Command-Line Information
Parameter: SolverMode
Type: string
Value: 'Auto' | 'SingleTasking' | 'MultiTasking'
Default: 'Auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Rate Transition block


• Model Execution and Rate Transitions
• Single-Tasking and Multitasking Execution Modes
• Sample Rate Transitions
• Single-Tasking and Multitasking Execution of a Model: an Example
• Configuration Parameters Dialog Box
• Solver Pane

1-47
1 Configuration Parameters Dialog Box

Automatically handle rate transition for data transfer


Specify whether Simulink software automatically inserts hidden Rate
Transition blocks between blocks that have different sample rates to ensure:
the integrity of data transfers between tasks; and optional determinism of
data transfers for periodic tasks.

Settings
Default: Off

On
Inserts hidden Rate Transition blocks between blocks when rate
transitions are detected. Handles rate transitions for asynchronous and
periodic tasks. Simulink software adds the hidden blocks configured
to ensure data integrity for data transfers. Selecting this option also
enables the parameter Deterministic data transfer, which allows you
to control the level of data transfer determinism for periodic tasks.

Off
Does not insert hidden Rate Transition blocks when rate transitions are
detected. If Simulink software detects invalid transitions, you must
adjust the model such that the sample rates for the blocks in question
match or manually add a Rate Transition block.

See Rate Transition Block Options in the Real-Time Workshop®


documentation for further details.

Tips

• Selecting this parameter allows you to handle rate transition issues


automatically. This saves you from having to manually insert Rate
Transition blocks to avoid invalid rate transitions, including invalid
asynchronous-to-periodic and asynchronous-to-asynchronous rate
transitions, in multirate models.
• For asynchronous tasks, Simulink software configures the inserted blocks
to ensure data integrity but not determinism during data transfers.

1-48
Solver Pane

Command-Line Information
Parameter: AutoInsertRateTranBlk
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact (for simulation and during
development)
Off (for production code generation)
Efficiency No impact
Safety precaution Off

See Also

• Rate Transition Block Options


• Configuration Parameters Dialog Box
• Solver Pane

1-49
1 Configuration Parameters Dialog Box

Deterministic data transfer


Control whether the Rate Transition block parameter Ensure deterministic
data transfer (maximum delay) is set for auto-inserted Rate Transition
blocks

Default: Whenever possible

Always
Specifies that the block parameter Ensure deterministic data
transfer (maximum delay) is always set for auto-inserted Rate
Transition blocks.

If Always is selected and if a model needs to auto-insert a Rate


Transition block to handle a rate transition that is not between two
periodic sample times related by an integer multiple, Simulink errors
out.
Whenever possible
Specifies that the block parameter Ensure deterministic data
transfer (maximum delay) is set for auto-inserted Rate Transition
blocks whenever possible. If an auto-inserted Rate Transition block
handles data transfer between two periodic sample times that are
related by an integer multiple, Ensure deterministic data transfer
(maximum delay) is set; otherwise, it is cleared.
Never (minimum delay)
Specifies that the block parameter Ensure deterministic data
transfer (maximum delay) is never set for auto-inserted Rate
Transition blocks.

Note Clearing the Rate Transition block parameter Ensure deterministic


data transfer (maximum delay) can provide reduced latency for
models that do not require determinism. See the description of Ensure
deterministic data transfer (maximum delay) on the Rate Transition
block reference page for more information.

1-50
Solver Pane

Dependencies
This parameter is enabled only if Automatically handle rate transition
for data transfer is checked.

Command-Line Information
Parameter: InsertRTBMode
Type: string
Value: 'Always' | 'Whenever possible'| 'Never (minimum delay)'
Default: 'Whenever possible'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution 'Whenever possible'

See Also

• Rate Transition Block Options


• Configuration Parameters Dialog Box
• Solver Pane

1-51
1 Configuration Parameters Dialog Box

Higher priority value indicates higher task priority


Specify whether the real-time system targeted by the model assigns higher
or lower priority values to higher priority tasks when implementing
asynchronous data transfers

Settings
Default: Off

On
Real-time system assigns higher priority values to higher priority tasks,
for example, 8 has a higher task priority than 4. Rate Transition blocks
treat asynchronous transitions between rates with lower priority values
and rates with higher priority values as low-to-high rate transitions.

Off
Real-time system assigns lower priority values to higher priority tasks,
for example, 4 has a higher task priority than 8. Rate Transition blocks
treat asynchronous transitions between rates with lower priority values
and rates with higher priority values as high-to-low rate transitions.

Command-Line Information
Parameter: PositivePriorityOrder
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-52
Solver Pane

See Also

• Rate Transitions and Asynchronous Blocks


• Configuration Parameters Dialog Box
• Solver Pane

1-53
1 Configuration Parameters Dialog Box

Zero-crossing control
Enables zero-crossing detection during variable-step simulation of the model.
For most models, this speeds up simulation by enabling the solver to take
larger time steps.

Settings
Default: Use local settings

Use local settings


Specifies that zero-crossing detection be enabled on a block-by-block
basis. For a list of applicable blocks, see “Simulating Dynamic Systems”

To specify zero-crossing detection for one of these blocks, open the


block’s parameter dialog box and select the Enable zero-crossing
detection option.
Enable all
Enables zero-crossing detection for all blocks in the model.
Disable all
Disables zero-crossing detection for all blocks in the model.

Tips

• For most models, enabling zero-crossing detection speeds up simulation by


allowing the solver to take larger time steps.
• If a model has extreme dynamic changes, disabling this option can speed
up the simulation but can also decrease the accuracy of simulation results.
See Zero-crossing Detection for more information.
• Selecting Enable all or Disable all overrides the local zero-crossing
detection setting for individual blocks.

Dependencies
This parameter is enabled only if the solver Type is set to Variable-step.

Selecting either Use local settings or Enable all enables the following
parameters:

1-54
Solver Pane

• Time tolerance
• Number of consecutive zero crossings
• Algorithm

Command-Line Information
Parameter: ZeroCrossControl
Type: string
Value: 'UseLocalSettings' | 'EnableAll' | 'DisableAll'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Zero-Crossing Detection
• Number of consecutive zero crossings
• Consecutive zero-crossings violation
• Time tolerance
• Configuration Parameters Dialog Box
• Solver Pane

1-55
1 Configuration Parameters Dialog Box

Time tolerance
Specify a tolerance factor that controls how closely zero-crossing events must
occur to be considered consecutive.

Settings
Default: 10*128*eps

• Simulink software defines zero crossings as consecutive if the time between


events is less than a particular interval. The following figure depicts a
simulation timeline during which Simulink software detects zero crossings
ZC1 and ZC2, bracketed at successive time steps t1 and t2.

Simulink software determines that the zero crossings are consecutive if

dt < RelTolZC * t2

where dt is the time between zero crossings and RelTolZC is the Time
tolerance.
• Simulink software counts the number of consecutive zero crossings that it
detects. If the count exceeds the value of Number of consecutive zero
crossings allowed, Simulink software displays either a warning or error
as specified by the Consecutive zero-crossings violation diagnostic (see
Consecutive zero-crossings violation).

Tips

• Simulink software resets the counter each time it detects nonconsecutive


zero crossings (successive zero crossings that fail to meet the relative
tolerance setting); therefore, decreasing the relative tolerance value may
afford your model’s behavior more time to recover.

1-56
Solver Pane

• If your model experiences excessive zero crossings, you can also increase
the Number of consecutive zero crossings to increase the threshold
at which Simulink software triggers the Consecutive zero-crossings
violation diagnostic.

Dependencies
This parameter is enabled only if Zero-crossing control is set to either
Use local settings or Enable all.

Command-Line Information
Parameter: ConsecutiveZCsStepRelTol
Type: string
Value: any valid value
Default: '10*128*eps'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Zero-crossing Detection
• Zero-crossing Control
• Number of consecutive zero crossings
• Consecutive zero-crossings violation
• Configuration Parameters Dialog Box
• Solver Pane

1-57
1 Configuration Parameters Dialog Box

Number of consecutive zero crossings


Specify the number of consecutive zero crossings that can occur before
Simulink software displays a warning or an error.

Settings
Default: 1000

• Simulink software counts the number of consecutive zero crossings that


it detects. If the count exceeds the specified value, Simulink software
displays either a warning or an error as specified by the Consecutive
zero-crossings violation diagnostic (see Consecutive zero-crossings
violation).
• Simulink software defines zero crossings as consecutive if the time between
events is less than a particular interval (see Time tolerance).

Tips

• If your model experiences excessive zero crossings, you can increase this
parameter to increase the threshold at which Simulink software triggers
the Consecutive zero-crossings violation diagnostic. This may afford
your model’s behavior more time to recover.
• Simulink software resets the counter each time it detects nonconsecutive
zero crossings; therefore, decreasing the relative tolerance value may also
afford your model’s behavior more time to recover.

Dependencies
This parameter is enabled only if Zero-crossing control is set to either
Use local settings or Enable all.

Command-Line Information
Parameter: MaxConsecutiveZCs
Type: string
Value: any valid value
Default: '1000'

1-58
Solver Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Zero-Crossing Detection
• Zero-Crossing Control
• Consecutive zero-crossings violation
• Time tolerance
• Configuration Parameters Dialog Box
• Solver Pane

1-59
1 Configuration Parameters Dialog Box

Algorithm
Specifies the algorithm to detect zero crossings when a variable-step solver
is used.

Settings
Default: Nonadaptive

Adaptive
Use an improved zero-crossing algorithm which dynamically activates
and deactivates zero-crossing bracketing. With this algorithm you can
set a zero-crossing tolerance. See “Signal threshold” on page 1-62 to
learn how to set the zero-crossing tolerance.
Nonadaptive
Use the nonadaptive zero-crossing algorithm present in the Simulink
software prior to Version 7.0 (R2008a). This option is provided for
backward compatibility.

Tips

• The adaptive zero-crossing algorithm is especially useful in systems


having strong “chattering”, or Zeno behavior. In such systems, this
algorithm yields shorter simulation run times compared to the nonadaptive
algorithm. See Zero-Crossing Detection for more information.

Dependencies

• This parameter is enabled only if the solver Type is set to Variable-step.


• Selecting Adaptive enables the Signal threshold parameter.

Command-Line Information
Parameter: ZeroCrossAlgorithm
Type: string
Value: 'Nonadaptive' | 'Adaptive'
Default: 'Nonadaptive'

1-60
Solver Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Zero-Crossing Detection
• Number of consecutive zero crossings
• Consecutive zero-crossings violation
• Time tolerance
• Configuration Parameters Dialog Box
• Solver Pane

1-61
1 Configuration Parameters Dialog Box

Signal threshold
Specifies the deadband region used during the detection of zero crossings.
Signals falling within this region are defined as having crossed through zero.

The signal threshold is a real number, greater than or equal to zero.

Settings
Default: Auto

Auto
The signal threshold is determined automatically by the adaptive
algorithm.
String
Use the specified value for the signal threshold. The value must be a
real number equal to or greater than zero.

Tips

• Entering too small of a value for the Signal Threshold parameter will
result in long simulation run times.
• Entering a large Signal Threshold value may improve the simulation
speed (especially in systems having extensive chattering). However,
making the value too large may reduce the simulation accuracy.

Dependency
This parameter is enabled if the zero-crossing Algorithm is set to Adaptive.

Command-Line Information
Parameter: ZCThreshold
Type: string
Value: 'auto' | any real number greater than or equal to zero
Default: 'auto'

1-62
Solver Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Zero-Crossing Detection
• Number of consecutive zero crossings
• Consecutive zero-crossings violation
• Time tolerance
• Configuration Parameters Dialog Box
• Solver Pane

1-63
1 Configuration Parameters Dialog Box

Periodic sample time constraint


Select constraints on the sample times defined by this model. If the model
does not satisfy the specified constraints during simulation, Simulink
software displays an error message.

Settings
Default: Unconstrained

Unconstrained
Specifies no constraints. Selecting this option causes Simulink software
to display a field for entering the solver step size.

Use the Fixed-step size (fundamental sample time) option to


specify solver step size.
Ensure sample time independent
Specifies that Model blocks inherit sample time from the context in
which they are used. This option is required if you use the Model block
in a triggered subsystem. For more information, see:
• Model Block Sample Times
• Inherited Sample Time for Referenced Models
• Function Call Models

Simulink software checks to ensure that this model can inherit its
sample times from a model that references it without altering its
behavior. Models that specify a step size (i.e., a base sample time)
cannot satisfy this constraint. For this reason, selecting this option
causes Simulink software to hide the group’s step size field (see
Fixed-step size (fundamental sample time)).
Specified
Specifies that Simulink software check to ensure that this model
operates at a specified set of prioritized periodic sample times. Use
the Sample time properties option to specify and assign priorities to
model sample times.

Executing Multitasking Models explains how to use this option for


multitasking models.

1-64
Solver Pane

Tips
During simulation, Simulink software checks to ensure that the model
satisfies the constraints. If the model does not satisfy the specified constraint,
then Simulink software displays an error message.

Dependencies
This parameter is enabled only if the solver Type is set to Fixed-step.

Selecting Unconstrained enables the following parameters:

• Fixed-step size (fundamental sample time)


• Tasking mode for periodic sample times
• Higher priority value indicates higher task priority
• Automatically handle rate transitions for data transfers

Selecting Specified enables the following parameters:

• Sample time properties


• Tasking mode for periodic sample times
• Higher priority value indicates higher task priority
• Automatically handle rate transitions for data transfers

Command-Line Information
Parameter: SampleTimeConstraint
Type: string
Value: 'unconstrained' | 'STIndependent' | 'Specified'
Default: 'unconstrained'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-65
1 Configuration Parameters Dialog Box

Application Setting
Efficiency No impact
Safety precaution Specified or Ensure sample time
independent

See Also

• Model Block Sample Times


• Inherited Sample Time for Referenced Models
• Function Call Models
• Fixed-step size (fundamental sample time)
• Executing Multitasking Models
• Configuration Parameters Dialog Box
• Solver Pane

1-66
Solver Pane

Fixed-step size (fundamental sample time)


Specify the step size used by the selected fixed-step solver.

Settings
Default: auto

• Entering auto (the default) in this field causes Simulink software to choose
the step size.
• If the model specifies one or more periodic sample times, Simulink software
chooses a step size equal to the least common denominator of the specified
sample times. This step size, known as the fundamental sample time of
the model, ensures that the solver will take a step at every sample time
defined by the model.
• If the model does not define any periodic sample times, Simulink software
chooses a step size that divides the total simulation time into 50 equal steps.

Dependencies
This parameter is enabled only if the Periodic sample time constraint is
set to Unconstrained.

Command-Line Information
Parameter: FixedStep
Type: string
Value: any valid value
Default: 'auto'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-67
1 Configuration Parameters Dialog Box

See Also

• Modeling Dynamic Systems


• Configuration Parameters Dialog Box
• Solver Pane

1-68
Solver Pane

Sample time properties


Specify and assign priorities to the sample times that this model implements.

Settings
No Default

• Enter an Nx3 matrix with rows that specify the model’s discrete sample
time properties in order from fastest rate to slowest rate.
• Faster sample times must have higher priorities.

Format.

[period, offset, priority]

period The time interval (sample rate) at which updates occur


during the simulation.
offset A time interval indicating an update delay. The block
is updated later in the sample interval than other blocks
operating at the same sample rate.
priority Execution priority of the real-time task associated with
the sample rate.

See Specifying Sample Time for more details and options for specifying
sample time.

Example.

[[0.1, 0, 10]; [0.2, 0, 11]; [0.3, 0, 12]]

• Declares that the model should specify three sample times.


• Sets the fundamental sample time period to 0.1 second.
• Assigns priorities of 10, 11, and 12 to the sample times.
• Assumes higher priority values indicate lower priorities — the Higher
priority value indicates higher task priority option is not selected.

1-69
1 Configuration Parameters Dialog Box

Tips

• If the model’s fundamental rate differs from the fastest rate specified by
the model, specify the fundamental rate as the first entry in the matrix
followed by the specified rates, in order from fastest to slowest. See “Purely
Discrete Systems”.
• If the model operates at one rate, enter the rate as a three-element vector
in this field — for example, [0.1, 0, 10].
• When you update a model, Simulink software displays an error message if
what you specify does not match the sample times defined by the model.
• If Periodic sample time constraint is set to Unconstrained, Simulink
software assigns priority 40 to the model base sample rate. If Higher
priority value indicates higher task priority is selected, Simulink
software assigns priorities 39, 38, 37, and so on, to subrates of the base
rate. Otherwise, it assigns priorities 41, 42, 43, and so on, to the subrates.
• Continuous rate is assigned a higher priority than is the discrete base rate
regardless of whether Periodic sample time constraint is Specified or
Unconstrained.

Dependencies
This parameter is enabled by selecting Specified from the Periodic sample
time constraint list.

1-70
Solver Pane

Command-Line Information
Parameter: SampleTimeProperty
Type: structure
Value: any valid matrix
Default: []

Note If you specify SampleTimeProperty at the command line, you must


enter the sample time properties as a structure with the following fields:

• SampleTime
• Offset
• Priority

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Period, offset, and priority of each sample
time in the model; faster sample times
must have higher priority than slower
sample times

See Also

• “Purely Discrete Systems”


• Specifying Sample Time
• Configuration Parameters Dialog Box
• Solver Pane

1-71
1 Configuration Parameters Dialog Box

Extrapolation order
Select the extrapolation order used by the ode14x solver to compute a model’s
states at the next time step from the states at the current time step.

Settings
Default: 4

1
Specifies first order extrapolation.
2
Specifies second order extrapolation.
3
Specifies third order extrapolation.
4
Specifies fourth order extrapolation.

Tip
Selecting a higher order produces a more accurate solution, but is more
computationally intensive per step size.

Dependencies
This parameter is enabled by selecting ode14x (extrapolation) from the
Solver list.

Command-Line Information
Parameter: ExtrapolationOrder
Type: integer
Value: 1 | 2 | 3 | 4
Default: 4

1-72
Solver Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Choosing a Fixed-Step Solver


• Configuration Parameters Dialog Box
• Solver Pane

1-73
1 Configuration Parameters Dialog Box

Number Newton’s iterations


Specify the number of Newton’s method iterations used by the ode14x solver
to compute a model’s states at the next time step from the states at the
current time step.

Settings
Default: 1
Minimum: 1
Maximum: 2147483647

More iterations produce a more accurate solution, but are more


computationally intensive per step size.

Dependencies
This parameter is enabled by selecting ode14x (extrapolation) from the
Solver list.

Command-Line Information
Parameter: NumberNewtonIterations
Type: integer
Value: any valid number
Default: 1

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-74
Solver Pane

See Also

• Choosing a Fixed-Step Solver


• Configuration Parameters Dialog Box
• Solver Pane
• “Purely Discrete Systems”

1-75
1 Configuration Parameters Dialog Box

Data Import/Export Pane

In this section...
“Data Import/Export Overview” on page 1-78
“Input” on page 1-79
“Initial State” on page 1-81
“Time” on page 1-83
“States” on page 1-85
“Output” on page 1-87
“Final states” on page 1-89
“Save complete SimState in final state” on page 1-91
“Signal logging” on page 1-94
“Inspect signal logs when simulation is paused/stopped” on page 1-96
“Limit data points to last” on page 1-98

1-76
Data Import/Export Pane

In this section...
“Decimation” on page 1-100
“Format” on page 1-102
“Output options” on page 1-104
“Refine factor” on page 1-106
“Output times” on page 1-108
“Return as Single Object” on page 1-109

1-77
1 Configuration Parameters Dialog Box

Data Import/Export Overview


The Data Import/Export pane allows you to import input signal and initial
state data from a workspace and export output signal and state data to the
MATLAB® workspace during simulation. This capability allows you to use
standard or custom MATLAB functions to generate a simulated system’s input
signals and to graph, analyze, or otherwise postprocess the system’s outputs.

Configuration

1 Specify the data to load from a workspace before simulation begins.

2 Specify the data to save to the MATLAB workspace after simulation


completes.

Tips

• For more information on using this pane, see Importing and Exporting
Simulation Data.
• See the documentation of the sim command for some capabilities that are
available only for programmatic simulation.

See Also

• Importing Data from a Workspace


• Exporting Data to the MATLAB Workspace
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-78
Data Import/Export Pane

Input
Loads input data from a workspace before the simulation begins.

Settings
Default: Off, [t,u]

On
Loads data from a workspace.

Specify a MATLAB expression for the data to be imported from a


workspace. The Simulink software resolves symbols used in this
specification as described in “Resolving Symbols”. The input data can
take any of the following forms:
• Time series
• Data array
• Time expression
• Data structure

See Importing Data from a Workspace for information on how to use


this field.
Off
Does not load data from a workspace.

Tips

• You must select the Input check box before entering input data.
• Simulink software linearly interpolates or extrapolates input values as
necessary if the Interpolate data option is selected for the corresponding
Inport.
• The use of the Input box is independent of the setting of the Format list
on the Data Import/Export pane.
• Limitation: You cannot load fixed-point data that is contained in a
structure. Consider using a Simulink.Timeseries object instead of a
structure.

1-79
1 Configuration Parameters Dialog Box

Command-Line Information
Parameter: LoadExternalInput
Type: string
Value: 'on' | 'off'
Default: 'off'

Parameter: ExternalInput
Type: scalar or vector
Value: any valid value
Default: [t,u]

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Importing Data from a Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-80
Data Import/Export Pane

Initial State
Loads the model’s initial states from a workspace before simulation begins.

Settings
Default: Off, xInitial

On
Simulink software loads initial states from a workspace.

Specify the name of a variable that contains the initial state values, for
example, a variable containing states saved from a previous simulation.

Use the structure or structure-with-time option to specify initial states


if you want to accomplish any of the following:
• Associate initial state values directly with the full path name to the
states. This eliminates errors that could occur if Simulink software
reorders the states, but the initial state array is not correspondingly
reordered.
• Assign a different data type to each state’s initial value.
• Initialize only a subset of the states.

See Importing and Exporting States for more information.

Off
Simulink software does not load initial states from a workspace.

Tips

• You must select the Initial State check box before entering initial state
data.
• The initial values specified by the workspace variable override the initial
values specified by the model itself (the values specified by the initial
condition parameters of those blocks in the model that have states).
• You must use the structure or structure-with-time format to initialize the
states of a top model and the models that it references.

1-81
1 Configuration Parameters Dialog Box

Command-Line Information
Parameter: LoadInitialState
Type: string
Value: 'on' | 'off'
Default: 'off'

Parameter: InitialState
Type: variable (string) or vector
Value: any valid value
Default: 'xInitial'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Importing Data from a Workspace


• Importing and Exporting States
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-82
Data Import/Export Pane

Time
Saves simulation time data to the specified variable during simulation.

Settings
Default: On, tout

On
Simulink software exports time data to the MATLAB workspace during
simulation.

Specify the name of the MATLAB variable used to store time data. See
Exporting Data to the MATLAB Workspace for more information.

Off
Simulink software does not export time data to the MATLAB workspace
during simulation.

Tips

• You must select the Time check box before entering the time variable.
• Simulink software saves the output to the MATLAB workspace at the base
sample rate of the model. Use a To Workspace block if you want to save
output at a different sample rate.
• The Save options area enables you to specify the format and restrict the
amount of output saved.

Command-Line Information
Parameter: SaveTime
Type: string
Value: 'on' | 'off'
Default: 'on'

Parameter: TimeSaveName
Type: string
Value: any valid value
Default: 'tout'

1-83
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Exporting Data to the MATLAB Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-84
Data Import/Export Pane

States
Saves state data to the specified MATLAB variable during a simulation.

Settings
Default: Off, xout

On
Simulink software exports state data to the MATLAB workspace during
simulation.

Specify the name of the MATLAB variable used to store state data. See
Importing and Exporting States for more information.

Off
Simulink software does not export state data during simulation.

Tips

• You must select the States check box before entering the states variable.
• Simulink software saves the states in a MATLAB workspace variable
having the specified name.
• The saved data has the format that you specify in the Save options area.

Command-Line Information
Parameter: SaveState
Type: string
Value: 'on' | 'off'
Default: 'off'

Parameter: StateSaveName
Type: string
Value: any valid value
Default: 'xout'

1-85
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Importing and Exporting States


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-86
Data Import/Export Pane

Output
Saves signal data to the specified MATLAB variable during simulation.

Settings
Default: On, yout

On
Simulink software exports signal data to the MATLAB workspace
during simulation.

Specify the name of the MATLAB variable used to store signal data. See
Exporting Data to the MATLAB Workspace for more information.

Off
Simulink software does not export signal data during simulation.

Tips

• You must select the Output check box before entering the output variable.
• Simulink software saves the output to the MATLAB workspace at the base
sample rate of the model. Use a To Workspace block if you want to save
output at a different sample rate.
• The Save options area enables you to specify the format and restrict the
amount of output saved.

Command-Line Information
Parameter: SaveOutput
Type: string
Value: 'on' | 'off'
Default: 'on'

Parameter: OutputSaveName
Type: string
Value: any valid value
Default: 'yout'

1-87
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Exporting Data to the MATLAB Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-88
Data Import/Export Pane

Final states
Saves the model’s logged states at the end of a simulation to the specified
MATLAB variable.

Settings
Default: Off, xFinal

On
Simulink software exports final logged state data to the MATLAB
workspace during simulation.

Specify the name of the MATLAB variable in which to store the values
of these final states. See Importing and Exporting States for more
information.
Off
Simulink software does not export the final state data during simulation.

Tips

• You must select the Final states check box before entering the final states
variable.
• Simulink software saves the final states in a MATLAB workspace variable
having the specified name.
• The saved data has the format that you specify in the Save options area.

Command-Line Information
Parameter: SaveFinalState
Type: string
Value: 'on' | 'off'
Default: 'off'

Parameter: FinalStateName
Type: string
Value: any valid value
Default: 'xFinal'

1-89
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Importing and Exporting States


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-90
Data Import/Export Pane

Save complete SimState in final state


At the end of a simulation, Simulink saves the complete set of states of the
model, including logged states, to the specified MATLAB variable.

Settings
Default: Off, xFinal

On
Simulink software exports the complete set of final state data (i.e., the
SimState) to the MATLAB workspace during simulation.

Specify the name of the MATLAB variable in which to store the values
of the final states. See Importing and Exporting States for more
information.
Off
Simulink software exports the final logged states during simulation.

Tips

• You must select the Final states check box to enable the Save complete
SimState in final state option.
• Simulink saves the final states in a MATLAB workspace variable having
the specified name.
• The saved data has the format that you specify in the Save options area.

Dependencies
This parameter is enabled by Final states.

Command-Line Information
Parameter: SaveCompleteFinalSimState
Type: string
Value: 'on' | 'off'
Default: 'off'

Parameter: FinalStateName

1-91
1 Configuration Parameters Dialog Box

Type: string
Value: any valid value
Default: 'xFinal'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Importing and Exporting States


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-92
1 Configuration Parameters Dialog Box

1-93
1 Configuration Parameters Dialog Box

Signal logging
Globally enable or disable signal logging for this model.

Settings
Default: On, logsout

On
Enables signal logging to the MATLAB workspace during simulation.

Specify the name of the signal logging object used to record logged
signal data in the MATLAB workspace. See Logging Signals for more
information.
Off
Disables signal logging to the MATLAB workspace during simulation.

Tips

• You must select the Signal logging check box before entering the signal
logging variable.
• Simulink software saves the signal data in a MATLAB workspace variable
having the specified name.
• The saved data has the format that you specify in the Save options area.
• Simulink software does not support signal logging for the following types of
signals:
- Output of a Function-Call Generator block
- Signal connected to the input of a Merge block
- Outputs of Trigger and Enable blocks

Dependencies
This parameter enables Inspect signal logs when simulation is
paused/stopped.

1-94
Data Import/Export Pane

Command-Line Information
Parameter: SignalLogging
Type: string
Value: 'on' | 'off'
Default: 'on'

Parameter: SignalLoggingName
Type: string
Value: any valid value
Default: 'logsOut'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Logging Signals
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-95
1 Configuration Parameters Dialog Box

Inspect signal logs when simulation is


paused/stopped
Specify whether Simulink software displays logged signals in the MATLAB
Time Series Tools viewer at the end of a simulation or whenever you pause
the simulation.

Settings
Default: Off

On
Simulink software displays logged signals in the MATLAB Time Series
Tools viewer at the end of a simulation or whenever you pause the
simulation.
Off
Simulink software does not display logged signals at the end of a
simulation.

Tips

• If this option is off, you must select Tools > Inspect logged signals in the
model editor to display logged signals in the Time Series Tools viewer.
• You must run the simulation before selecting Tools > Inspect logged
signals. Otherwise, the command has no effect.

Dependencies
This parameter is enabled by Signal logging.

Command-Line Information
Parameter: InspectSignalLogs
Type: string
Value: 'on' | 'off'
Default: 'off'

1-96
Data Import/Export Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Logging Signals
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-97
1 Configuration Parameters Dialog Box

Limit data points to last


Specify the number of data points exported to the MATLAB workspace be
limited to the number specified.

Settings
Default: On, 1000

On
Limits the number of data points exported to the MATLAB workspace
to the number specified.

Specify the maximum number of data points exported to the MATLAB


workspace. At the end of the simulation, the MATLAB workspace
contains the last N points generated by the simulation.

Off
Does not limit the number of data points.

Tips

• You must select the Limit data points to last check box before specifying
the number of data points.
• Saving data to the MATLAB workspace can slow down the simulation
and consume memory. Use this parameter to limit the number of samples
saved to help avoid this problem.
• You can also apply a Decimation factor to skip a selected number of
samples.

1-98
Data Import/Export Pane

Command-Line Information
Parameter: LimitDataPoints
Type: string
Value: 'on' | 'off'
Default: 'on'

Parameter: MaxDataPoints
Type: string
Value: any valid value
Default: '1000'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Exporting Data to the MATLAB Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-99
1 Configuration Parameters Dialog Box

Decimation
Specify that Simulink software output only every N points, where N is the
specified decimation factor.

Settings
Default: 1

• The default value (1) specifies that all data points are saved.
• Simulink software outputs data only at the specified number of data points.
For example, specifying 2 saves every other data point, while specifying 10
saves just one in ten data points.
• At the end of the simulation, the total number of data points is reduced by
the factor specified.

Tips

• Saving data to the MATLAB workspace can slow down the simulation
and consume memory. Use this parameter to limit the number of samples
saved to help avoid this problem.
• You can also use the Limit data points to last parameter to help resolve
this problem.

Command-Line Information
Parameter: Decimation
Type: string
Value: any valid value
Default: '1'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-100
Data Import/Export Pane

Application Setting
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Exporting Data to the MATLAB Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-101
1 Configuration Parameters Dialog Box

Format
Select the format of state and output data saved to the MATLAB workspace.

Settings
Default: Array

Array
The format of the data is a matrix each row of which corresponds to a
simulation time step.
Structure
The format of the data is a structure that contains substructures
for each port. Each port substructure contains signal data for the
corresponding port.
Structure with time
The format of the data is a structure that has two fields: a time field
and a signals field. The time field contains a vector of simulation
times. The signals field contains a substructure for each model input
port (for imported data) or output port (for exported data). Each port
substructure contains signal data for the corresponding port.

Tips

• You can use array format to save your model’s outputs and states only if
the outputs are either all scalars or all vectors (or all matrices for states),
are either all real or all complex, and are all of the same data type. Use the
Structure or Structure with time output formats (see Structure with
time) if your model’s outputs and states do not meet these conditions.
• Simulink software can read back simulation data saved to the workspace in
the Structure with time output format. See Importing Signal-and-Time
Data Structures for more information.

1-102
Data Import/Export Pane

Command-Line Information
Parameter: SaveFormat
Type: string
Value: 'Array' | 'Structure' | 'StructureWithTime'
Default: 'Array'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Exporting Data to the MATLAB Workspace


• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-103
1 Configuration Parameters Dialog Box

Output options
Select options for generating additional output signal data for variable-step
solvers.

Settings
Default: Refine output

Refine output
Generates data output between as well as at simulation times steps.
Use Refine factor to specify the number of points to generate between
simulation time steps. For more information, see Refining Output.
Produce additional output
Generates additional output at specified times. Use Output times
to specify the simulation times at which Simulink software should
generate additional output.
Produce specified output only
Generates output only at specified times. Use Output times to specify
the simulation times at which Simulink software should generate
output.

Tips

• These settings can force the solver to calculate output values for times that
it would otherwise have omitted because the calculations were not needed
to achieve accurate simulation results. These extra calculations can cause
the solver to locate zero crossings that it would otherwise have missed.
• For additional information on how Simulink software calculates outputs for
these three options, see Specifying Output Options.

Dependencies
This parameter is enabled only if the model specifies a variable-step solver
(see Solver Type).

Selecting Refine output enables the Refine factor parameter.

1-104
Data Import/Export Pane

Selecting Produce additional output or Produce specified output only


enables the Output times parameter.

Command-Line Information
Parameter: OutputOption
Type: string
Value: 'RefineOutputTimes' | 'AdditionalOutputTimes' |
'SpecifiedOutputTimes'
Default: 'RefineOutputTimes'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Specifying Output Options


• Refine factor
• Refining Output
• Exporting Data to the MATLAB Workspace
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-105
1 Configuration Parameters Dialog Box

Refine factor
Specify how many points to generate between time steps to refine the output.

Settings
Default: 1

• The default refine factor is 1, meaning that no extra data points are
generated.
• A refine factor of 2 provides output midway between the time steps, as
well as at the steps.

Tip
Simulink software ignores this option for discrete models. This is because the
value of data between time steps is undefined for discrete models.

Dependency
This parameter is enabled only if you select Refine output as the value
of Output options.

Command-Line Information
Parameter: Refine
Type: string
Value: any valid value
Default: '1'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-106
Data Import/Export Pane

Application Setting
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Refining Output
• Configuration Parameters Dialog Box
• Data Import/Export Pane

1-107
1 Configuration Parameters Dialog Box

Output times
Specify times at which Simulink software should generate output in addition
to, or instead of, the times of the simulation steps taken by the solver used
to simulate the model.

Settings
Default: []

• Enter a matrix containing the times at which Simulink software should


generate output in addition to, or instead of, the simulation steps taken
by the solver.
• If the value of Output options is Produce additional output, the
default value [] specifies that no additional data points are generated.
• If the value of Output options is Produce specified output only, the
default value [] specifies that no data points are generated.

Tips

• The Produce additional output option generates output at the specified


times as well as the regular simulation steps.
• The Produce specified output only option generates output only at
the specified times.
• Discrete models define outputs only at major time steps. Therefore,
Simulink software logs output for discrete models only at major time steps.
If the Output times field specifies other times, Simulink software displays
a warning at the MATLAB command line.

Dependency
This parameter is enabled only if the value of Output options is Produce
additional output or Produce specified output only.

1-108
Data Import/Export Pane

Command-Line Information
Parameter: OutputTimes
Type: string
Value: any valid value
Default: '[]'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development
Off for production code generation

See Also

• Refining Output
• Configuration Parameters Dialog Box
• Data Import/Export Pane

Return as Single Object


Enable the single-output format of the sim command.

Settings
Default: off

• Turning this option ’on’ directs Simulink to return all simulation outputs
within a single Simulink.SimulationOutput object.
• Enabling this option makes the sim command compatible with the parfor
command, in terms of transparency issues.

1-109
1 Configuration Parameters Dialog Box

Tips

• The method who of the Simulink.SimulationOutput object returns the list


of variables that the object contains.
• Use the find method of the Simulink.SimulationOutput object to access the
variables that the object contains.

Command-Line Information
Parameter: ReturnWorkspaceOutputs
Type: string
Value: 'on' | 'off' |
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• “Configuration Parameters Dialog Box Overview” on page 1-2


• “Data Import/Export Pane” on page 1-76
• “Using the sim Command”
• “Running Parallel Simulations”

1-110
Optimization Pane

Optimization Pane
The Optimization pane includes the following parameters:

The Optimization pane includes the following parameters when the Real-Time
Workshop product is installed on your system and you select a GRT-based
target.

1-111
1 Configuration Parameters Dialog Box

The Optimization pane includes the following parameters when the Real-Time
Workshop product is installed on your system and you select an ERT-based
target. ERT-based target optimizations require a Real-Time Workshop®
Embedded Coder™ license when generating code.

1-112
Optimization Pane

The Optimization pane includes the following parameters when Real-Time


Workshop and Stateflow® products are both installed on your system, and the
model includes Stateflow charts or Embedded MATLAB™ Function blocks.

1-113
1 Configuration Parameters Dialog Box

In this section...
“Optimization Overview” on page 1-116
“Block reduction” on page 1-117
“Conditional input branch execution” on page 1-121
“Inline parameters” on page 1-123
“Implement logic signals as Boolean data (vs. double)” on page 1-126
“Signal storage reuse” on page 1-128
“Application lifespan (days)” on page 1-130
“Use integer division to handle net slopes that are reciprocals of integers”
on page 1-133
“Parameter structure” on page 1-135
“Enable local block outputs” on page 1-137
“Ignore integer downcasts in folded expressions” on page 1-140
“Eliminate superfluous local variables (Expression folding)” on page 1-143
“Minimize data copies between local and global variables” on page 1-145
“Simplify array indexing” on page 1-147
“Reuse block outputs” on page 1-149
“Inline invariant signals” on page 1-152
“Pack Boolean data into bitfields” on page 1-154
“Loop unrolling threshold” on page 1-156
“Use memcpy for vector assignment” on page 1-158
“Memcpy threshold (bytes)” on page 1-160
“Pass reusable subsystem outputs as” on page 1-162
“Remove root level I/O zero initialization” on page 1-164
“Use memset to initialize floats and doubles to 0.0” on page 1-166
“Remove internal data zero initialization” on page 1-168
“Optimize initialization code for model reference” on page 1-170

1-114
Optimization Pane

In this section...
“Remove code from floating-point to integer conversions that wraps
out-of-range values” on page 1-172
“Remove code from floating-point to integer conversions with saturation
that maps NaN to zero” on page 1-174
“Remove code that protects against division arithmetic exceptions” on
page 1-176
“Use bitsets for storing state configuration” on page 1-178
“Use bitsets for storing Boolean data” on page 1-180
“Model Parameter Configuration Dialog Box” on page 1-182
“Compiler optimization level” on page 1-184
“Verbose accelerator builds” on page 1-186

1-115
1 Configuration Parameters Dialog Box

Optimization Overview
Set up optimizations for a model’s active configuration set. Optimizations are
set for both simulation and code generation.

Configuration
Set the parameters displayed.

Tips

• Real-Time Workshop optimizations appear only when the Real-Time


Workshop product is installed on your system. Selecting a GRT-based or
ERT-based system target file changes the available options. ERT-based
target optimizations require a Real-Time Workshop Embedded Coder
license when generating code.
• Stateflow software optimizations appear only when Real-Time Workshop
and Stateflow products are both installed on your system and the model
includes Stateflow charts or Embedded MATLAB Function blocks. The
settings you make for the Stateflow software options also apply to all
Embedded MATLAB Function blocks in the model. You do not need a
Stateflow license to use Embedded MATLAB Function blocks.

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane
• “Performing Acceleration”

1-116
Optimization Pane

Block reduction
Reduce execution time by collapsing or removing groups of blocks.

Settings
Default: On

On
Simulink software searches for and reduces the following block patterns:
• Accumulators — A group consisting of a Constant block, a Sum
block, and feedback through a Unit Delay block.
• Redundant type conversions — Unnecessary type conversion
blocks, such as an int type conversion block with an input and
output of type int.
• Dead code — Blocks or signals in an unused code path.
• Fast-to-slow Rate Transition block in a single-tasking system
— Rate Transition blocks with an input frequency faster than its
output frequency.

Off
Simulink software does not search for block patterns that can be
optimized. Simulation and generated code are not optimized.

Tips

• When you select Block reduction, Simulink software collapses certain


groups of blocks into a single, more efficient block, or removes them
entirely. This results in faster execution during model simulation and in
generated code.
• Block reduction does not change the appearance of the source model.
• Tunable parameters do not prevent a block from being reduced by dead
code elimination.
• Once block reduction takes place, Simulink software does not display the
sorted order for blocks that have been removed.

1-117
1 Configuration Parameters Dialog Box

• Block reduction is intended to remove only the generated code that


represents execution of a block. Other supporting data, such as definitions
for sample time and data types might remain in the generated code.

Accumulators. Simulink software recognizes the block diagram shown in


the following figure as an accumulator:

• An accumulator construct is recognized anywhere across a block diagram,


or within subsystems at lower levels.
• With the Block reduction option enabled, Simulink software creates a
synthesized block, Sum_synth_accum. The synthesized block replaces the
previous block diagram, resulting in a simple increment calculation.

Dead Code Elimination. Any blocks or signals in an unused code path


are eliminated from generated code.

• The following conditions need to be met for a block to be considered part of


an unused code path:
- All signal paths for the block end with a block that does not execute.
Examples of blocks that do not execute include Terminator blocks,
disabled Assertion blocks, S-Function blocks configured for block
reduction, and To Workspace blocks when MAT-file logging is disabled
for code generation.
- No signal paths for the block include global signal storage downstream
from the block.
• Tunable parameters do not prevent a block from being reduced by dead
code elimination.
• Consider the signal paths in the following block diagram.

1-118
Optimization Pane

If you check Block reduction, Real-Time Workshop software responds to


each signal path as follows:

For Signal Real-Time Workshop Software...


Path...
In1 to Out1 Always generates code because dead code elimination
conditions are not met.
In2 to Never generates code because dead code elimination
Terminator conditions are met.
In3 to Scope Generates code if MAT-file logging is enabled and
eliminates code if MAT-file logging is disabled.

Command-Line Information
Parameter: BlockReduction
Type: string
Value: 'on' | 'off'
Default: 'on'

1-119
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging Off (for simulation and during
development)
No impact (for production code generation)
Traceability Off
Efficiency On
Safety precaution Off

See Also

• Block Reduction
• Single-Tasking Execution
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-120
Optimization Pane

Conditional input branch execution


Improve model execution when the model contains Switch and Multiport
Switch blocks.

Settings
Default: On

On
Executes only the blocks required to compute the control input and
the data input selected by the control input. This optimization speeds
execution of code generated from the model. Limits to Switch block
optimization:
• Only blocks with -1 (inherited) or inf (Constant) sample time can
participate.
• Blocks with outputs flagged as test points cannot participate.
• No multirate block can participate.
• Blocks with states cannot participate.
• Only S-functions with option
SS_OPTION_CAN_BE_CALLED_CONDITIONALLY set can participate.

Off
Executes all blocks driving the Switch block input ports at each time
step.

Command-Line Information
Parameter: ConditionallyExecuteInputs
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact

1-121
1 Configuration Parameters Dialog Box

Application Setting
Traceability On
Efficiency On
Safety precaution Off

See Also

• Expression Folding
• Conditional Input Execution
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-122
Optimization Pane

Inline parameters
Transform tunable parameters into constant values.

Settings
Default: Off

On
Selecting Inline parameters has the following effects:
• Real-Time Workshop software uses the numerical values of model
parameters, instead of their symbolic names, in generated code.
• Reduces global RAM usage, because parameters are not declared in
the global parameters structure.
• Enables the Configure button. Clicking the Configure button
opens the Model Parameter Configuration dialog box.

Off
Uses symbolic names for model parameters in generated code.

Tips

• Simulink software 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 Configuration Parameters 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 select Update Diagram (Ctrl+D) from the
Simulink Edit menu.
• You cannot tune inlined parameters in code generated from a model.
However, when simulating a model, you can tune an inlined parameter
if its value derives from a workspace variable. For example, suppose
that a model has a Gain block whose Gain parameter is inlined and
equals a, where a is a variable defined in the model’s workspace. When
simulating the model, Simulink software disables the Gain parameter
field, preventing you from using the block’s dialog box to change the gain.

1-123
1 Configuration Parameters Dialog Box

However, you can still tune the gain by changing the value of a at the
MATLAB command line and updating the diagram.
• When a top model uses referenced models:
- All referenced models must specify Inline parameters to be on.
- The top model can specify Inline parameters to be on or off.
See Inline Parameter Requirements for more information.
• If your model contains an Environment Controller block, you can suppress
code generation for the branch connected to the Sim port if you select
Inline parameters and the branch does not contain external signals.

Dependencies
This parameter enables:

• Configure button
• “Parameter structure” on page 1-135
• “Inline invariant signals” on page 1-152

Command-Line Information
Parameter: InlineParams
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging Off (for simulation and during
development)
On (for production code generation)
Traceability On
Efficiency On
Safety precaution No impact

1-124
Optimization Pane

See Also

• Model Parameter Configuration Dialog Box


• Parameter Storage, Interfacing, and Tuning
• Model Referencing Inline Parameters
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-125
1 Configuration Parameters Dialog Box

Implement logic signals as Boolean data (vs. double)


Controls the output data type of blocks that generate logic signals.

Settings
Default: On

On
Blocks that generate logic signals output a signal of boolean data type.
This reduces the memory requirements of generated code.

Off
Blocks that generate logic signals output a signal of double data type.
This ensures compatibility with models created by earlier versions of
Simulink software.

Tips

• Setting this option on reduces the memory requirements of generated code,


because a Boolean signal typically requires one byte of storage compared
to eight bytes for a double signal.
• Setting this option off allows the current version of Simulink software to
run models that were created by earlier versions of Simulink software that
supported only signals of type double.
• This optimization affects the following blocks:
- Logical Operator block – This parameter affects only those Logical
Operator blocks whose Output data type parameter specifies Logical.
If this parameter is selected, such blocks output a signal of boolean data
type; otherwise, such blocks output a signal of double data type.
- Relational Operator block – This parameter affects only those
Relational Operator blocks whose Output data type parameter
specifies Logical. If this parameter is selected, such blocks output a
signal of boolean data type; otherwise, such blocks output a signal of
double data type.
- Combinatorial Logic block – If this parameter is selected,
Combinatorial Logic blocks output a signal of boolean data type;

1-126
Optimization Pane

otherwise, they output a signal of double data type. See Combinatorial


Logic in the Simulink Reference for an exception to this rule.
- Hit Crossing block – If this parameter is selected, Hit Crossing blocks
output a signal of boolean data type; otherwise, they output a signal
of double data type.

Dependencies

• This parameter is disabled for models created with a version of Simulink


software that supports only signals of type double.

Command-Line Information
Parameter: BooleanDataType
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution On

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-127
1 Configuration Parameters Dialog Box

Signal storage reuse


Reuse signal memory.

Settings
Default: On

On
Simulink software reuses memory buffers allocated to store block input
and output signals, reducing the memory requirement of your real-time
program.

Off
Simulink software allocates a separate memory buffer for each block’s
outputs. This makes all block outputs global and unique, which in many
cases significantly increases RAM and ROM usage.

Tips

• This option applies only to signals with storage class Auto.


• Signal storage reuse can occur only among signals that have the same
data type.
• Clearing this option can substantially increase the amount of memory
required to simulate large models.
• Clear this option if you need to:
- Debug a C-MEX S-function
- Use a Floating Scope or a Display block with the Floating display
option selected to inspect signals in a model that you are debugging
• Simulink software 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.

Dependencies
This parameter enables:

• “Enable local block outputs” on page 1-137

1-128
Optimization Pane

• “Reuse block outputs” on page 1-149


• “Eliminate superfluous local variables (Expression folding)” on
page 1-143
• “Minimize data copies between local and global variables” on page
1-145

Command-Line Information
Parameter:OptimizeBlockIOStorage
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution No impact

See Also

• Signal Storage, Optimization, and Interfacing


• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-129
1 Configuration Parameters Dialog Box

Application lifespan (days)


Specify how long (in days) an application that contains blocks depending on
elapsed or absolute time should be able to execute before timer overflow.

Settings
Default: inf
Min: Must be greater than zero
Max: inf

Enter a positive (nonzero) scalar value (for example, 0.5) or inf.

If you are licensed for the Real-Time Workshop Embedded Coder product
and select an ERT target for your model, the default value for Application
lifespan (days) is 1.

This parameter is ignored when you are operating your model in external
mode, have Mat-file logging enabled, or have a continuous sample time
because a 64 bit timer is required in these cases.

Tips

• Specifying a lifespan, along with the simulation step size, determines the
data type used by blocks to store absolute time values.
• For simulation, setting this parameter to a value greater than the
simulation time will ensure time does not overflow.
• Simulink software evaluates this parameter first against the model
workspace. If this does not resolve the parameter, Simulink software then
evaluates it against the base workspace.
• The Application lifespan also determines the word size used by timers in
the generated code, which can lower RAM usage. For more information, see
Timing Services in the Real-Time Workshop documentation.
• Application lifespan, when combined with the step size of each task,
determines the data type used for integer absolute time for each task, as
follows:
- If your model does not require absolute time, this option affects neither
simulation nor the generated code.

1-130
Optimization Pane

- If your model requires absolute time, this option optimizes the word size
used for storing integer absolute time in generated code. This ensures
that timers do not overflow within the lifespan you specify. If you set
Application lifespan to inf, two uint32 words are used.
- If your model contains fixed-point blocks that require absolute time, this
option affects both simulation and generated code.
For example, using 64 bits to store timing data enables models with a step
size of 0.001 microsecond (10E-09 seconds) to run for more than 500 years,
which would rarely be required. To run a model with a step size of one
millisecond (0.001 seconds) for one day would require a 32-bit timer (but it
could continue running for 49 days).
• A timer will allocate 64 bits of memory if you specify a value of inf.
• To minimize the amount of RAM used by time counters, specify a lifespan
no longer than necessary.
• Must be the same for top and referenced models.
• Optimize the size of counters used to compute absolute and elapsed time.

Command-Line Information
Parameter: LifeSpan
Type: string
Value: positive (nonzero) scalar value or inf
Default: 'inf'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency Finite value
Safety precaution inf

1-131
1 Configuration Parameters Dialog Box

See Also

• Timing Services
• Using Timers in Asynchronous Tasks
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-132
Optimization Pane

Use integer division to handle net slopes that are


reciprocals of integers
The Simulink® Fixed Point™ software performs net slope correction using
integer division to handle net slopes that are reciprocals of integers when
simplicity and accuracy conditions are met.

Settings
Default: Off

On
Perform net slope correction using integer division when simplicity
and accuracy conditions are met.

Off
Perform net slope correction using integer multiplication followed by
shifts.

Tips

• This optimization affects both simulation and code generation.


• When a change of fixed-point slope is not a power of two, net slope
correction is necessary. Normally, net slope correction uses an integer
multiplication followed by shifts. Enabling this new optimization replaces
the multiplication and shifts with an integer division under certain
simplicity and accuracy conditions.
• Performing net slope correction using integer division is not always more
efficient than using multiplication followed by shifts. Ensure that the
target hardware supports efficient division.
• To ensure that this optimization occurs, you must:
- Set the word length of the block to ensure that the software can perform
division using the production target long data type. This avoids using
multiword operations.
- Set the Signed integer division rounds to configuration parameter
setting on the Hardware Implementation > Embedded Hardware
subpane to Zero or Floor. The optimization does not occur if this
parameter is set to Undefined.

1-133
1 Configuration Parameters Dialog Box

- Set the Integer rounding mode parameter of the block to Simplest or


to the value of the Signed integer division rounds to configuration
parameter setting on the Hardware Implementation > Embedded
Hardware subpane.

Dependency
This parameter requires a Simulink Fixed Point license.

Command-Line Information
Parameter: UseIntDivNetSlope
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On (when target hardware supports
efficient division)
Off (otherwise)
Safety precaution No impact

See Also

• Use Integer Division for Net Slope Correction


• Configuration Parameters Dialog Box
• Optimization Pane

1-134
Optimization Pane

Parameter structure
Control how parameter data is generated for reusable subsystems.

Settings
Default: Hierarchical

Hierarchical
Generates a separate header file, defining an independent parameter
structure, for each subsystem that meets the following conditions:
• The subsystem’s Real-Time Workshop system code parameter is
set to Reusable function.
• The subsystem does not violate any code reuse limitations.
• The subsystem does not access parameters other than its own (such
as parameters of the root-level model).

Each subsystem parameter structure is referenced as a substructure of


the root-level parameter data structure, creating a structure hierarchy.
NonHierarchical
Generates a single, flat parameter data structure. Subsystem
parameters are defined as fields within the structure. A nonhierarchical
data structure can reduce compiler padding between word boundaries,
producing more efficient compiled code.

Dependencies

• This parameter appears only for ERT-based targets.


• This parameter requires a Real-Time Workshop Embedded Coder license
when generating code.
• This parameter is enabled by “Inline parameters” on page 1-123.

Command-Line Information
Parameter: InlinedParameterPlacement
Type: string
Value: 'Hierarchical' | 'NonHierarchical'

1-135
1 Configuration Parameters Dialog Box

Default: 'Hierarchical'

Recommended Settings

Application Setting
Debugging No impact
Traceability Hierarchical
Efficiency NonHierarchical
Safety precaution No impact

See Also

• Nonvirtual Subsystem Code Generation


• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-136
Optimization Pane

Enable local block outputs


Specify whether block signals are declared locally or globally.

Settings
Default: On

On
Block signals are declared locally in functions.

Off
Block signals are declared globally.

Tips

• If it is not possible to declare an output as a local variable, the generated


code declares the output as a global variable.
• If you are constrained by limited stack space, you can turn Enable local
block outputs off and still benefit from memory reuse.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled by Signal storage reuse.

Command-Line Information
Parameter: LocalBlockOutputs
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging Off

1-137
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact
Efficiency On
Safety precaution No impact

See Also

• Signal Storage, Optimization, and Interfacing


• Signals with Auto Storage Class
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-138
1 Configuration Parameters Dialog Box

1-139
1 Configuration Parameters Dialog Box

Ignore integer downcasts in folded expressions


Specify how the Real-Time Workshop software handles casting of intermediate
variables in mixed-bit systems.

Note Ignore integer downcasts in folded expressions will be removed


in a future release.

Settings
Default: Off (GUI), 'on' (command-line)

On
Real-Time Workshop software collapses block computations into a single
expression, avoiding casts of intermediate variables.

Off
Explicitly downcasts the results of 8- and 16-bit integer expressions.

Tips

• To ensure consistency between simulation and code generation, the results


of 8 and 16-bit integer expressions must be explicitly downcast.
• Expressions involving 8- and 16-bit arithmetic are less likely to overflow
in code than they are in simulation. Therefore, it is good practice to clear
Ignore integer downcasts in folded expressions for safety, to ensure
that answers obtained from generated code are consistent with simulation
results.

Dependency
This parameter requires a Real-Time Workshop license.

Command-Line Information
Parameter: EnforceIntegerDowncast
Type: string
Value: 'on' | 'off'

1-140
Optimization Pane

Default: 'on'

Note The command-line values are reverse of the settings values. Therefore,
'on' in the command line corresponds to the description of “Off” in the
settings section, and 'off' in the command line corresponds to the description
of “On” in the settings section.

Recommended Settings

Application Setting
Debugging Off
Traceability No impact
Efficiency No impact
Safety precaution Off

See Also

• Optimizing a Model for Code Generation


• Expression Folding
• Configuration Parameters Dialog Box
• Optimization Pane

1-141
1 Configuration Parameters Dialog Box

1-142
Optimization Pane

Eliminate superfluous local variables (Expression


folding)
Collapse block computations into single expressions.

Settings
Default: On

On
• Enables expression folding.
• Eliminates local variables, incorporating the information into the
main code statement.
• Improves code readability and efficiency.

Off
Disables expression folding.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled by Signal storage reuse.

Command-Line Information
Parameter: ExpressionFolding
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging Off

1-143
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact (for simulation and during
development)
Off (for production code generation)
Efficiency On
Safety precaution No impact

See Also

• Expression Folding
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-144
Optimization Pane

Minimize data copies between local and global


variables
Reuse existing global variables to store temporary results.

Settings
Default: Off

On
Writes data for block outputs to global variables, reducing RAM
consumption and execution time.

Off
Writes data for block outputs to local variables.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled by “Signal storage reuse” on page 1-128.

Command-Line Information
Parameter: EnhancedBackFolding
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution On

1-145
1 Configuration Parameters Dialog Box

See Also

• “Signal Considerations”
• “Optimizing Generated Code”
• Configuration Parameters Dialog Box
• Optimization Pane

1-146
Optimization Pane

Simplify array indexing


Replace multiply operations in array indices when accessing arrays in a loop.

Settings
Default: Off

On
In array indices, replace multiply operations with add operations when
accessing arrays in a loop in the generated code. When the original
signal is multidimensional, the Real-Time Workshop Embedded Coder
generates one-dimensional arrays, resulting in multiply operations
in the array indices. Using this setting eliminates costly multiply
operations when accessing arrays in a loop in the C/C++ program.
This optimization (commonly referred to as strength reduction) is
particularly useful if the C/C++ compiler on the target platform does
not have similar functionality. No appearance of multiply operations
in the C/C++ program does not imply that the C/C++ compiler does
not generate multiply instructions.

Off
Leave multiply operations in array indices when accessing arrays in
a loop.

Dependencies
This parameter:

• Requires a Real-Time Workshop Embedded Coder license to generate code.


• Appears only for ERT-based targets.

Command-Line Information
Parameter: StrengthReduction
Type: string
Value: 'on' | 'off'
Default: 'off'

1-147
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

See Also

• “Optimizing Generated Code”

• “Preparing Models for Code Generation”

1-148
Optimization Pane

Reuse block outputs


Specify whether Real-Time Workshop software reuses signal memory.

Settings
Default: On

On
• Real-Time Workshop software reuses signal memory whenever
possible, reducing stack size where signals are being buffered in
local variables.
• Selecting this parameter trades code traceability for code efficiency.

Off
Signals are stored in unique locations.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled by Signal storage reuse.

Command-Line Information
Parameter: BufferReuse
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution No impact

1-149
1 Configuration Parameters Dialog Box

See Also

• Signal Storage, Optimization, and Interfacing


• Signals with Auto Storage Class
• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-150
1 Configuration Parameters Dialog Box

1-151
1 Configuration Parameters Dialog Box

Inline invariant signals


Transform symbolic names of invariant signals into constant values.

Settings
Default: Off

On
Real-Time Workshop software uses the numerical values of model
parameters, instead of their symbolic names, in generated code. An
invariant signal is not inlined if it is nonscalar, complex, or the block
inport the signal is attached to takes the address of the signal.

Off
Uses symbolic names of model parameters in generated code.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled by Inline parameters.

Command-Line Information
Parameter: InlineInvariantSignals
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution No impact

1-152
Optimization Pane

See Also
Inlining Invariant Signals

1-153
1 Configuration Parameters Dialog Box

Pack Boolean data into bitfields


Specify whether Boolean signals are stored as one–bit bitfields or as a Boolean
data type.

Note You cannot use this optimization when you generate code for a target
that specifies an explicit structure alignment.

Settings
Default: Off

On
Stores Boolean signals into one–bit bitfields in global block I/O
structures or DWork vectors. This will reduce RAM, but might cause
more executable code.
Off
Stores Boolean signals as a Boolean data type in global block I/O
structures or DWork vectors.

Dependencies
This parameter:

• Requires a Real-Time Workshop Embedded Coder license.


• Appears only for ERT-based targets.

Command-Line Information
Parameter: BooleansAsBitfields
Type: string
Value: 'on' | 'off'
Default: 'off'

1-154
Optimization Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

See Also
“Optimization Pane” on page 1-111

1-155
1 Configuration Parameters Dialog Box

Loop unrolling threshold


Specify the minimum signal or parameter width for which a for loop is
generated.

Settings
Default: 5

Specify the array size at which the code generator begins to use a for loop
instead of separate assignment statements to assign values to the elements of
a signal or parameter array.

When there are perfectly nested loops, the code generator uses a for loop if
the product of the loop counts for all loops in the perfect loop nest is greater
than or equal to the threshold.

Dependency
This parameter requires a Real-Time Workshop license.

Command-Line Information
Parameter: RollThreshold
Type: string
Value: any valid value
Default: '5'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency >0
Safety precaution >1

1-156
Optimization Pane

See Also

• Configuring a Loop Unrolling Threshold


• Real-Time Workshop Target Language Compiler

1-157
1 Configuration Parameters Dialog Box

Use memcpy for vector assignment


Optimize code generated for vector assignment by replacing for loops with
memcpy.

Settings
Default: On

On
Enables use of memcpy for vector assignment based on the associated
threshold parameter Memcpy threshold (bytes). memcpy is used in
the generated code if the number of array elements times the number
of bytes per element is greater than or equal to the specified value for
Memcpy threshold (bytes). One byte equals the width of a character
in this context.
Off
Disables use of memcpy for vector assignment.

Dependencies

• This parameter requires a Real-Time Workshop license.


• When selected, this parameter enables the associated parameter Memcpy
threshold (bytes).

Command-Line Information
Parameter: EnableMemcpy
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-158
Optimization Pane

Application Setting
Efficiency On
Safety precaution No impact

See Also

• “Optimizing Code Generated for Vector Assignments”


• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-159
1 Configuration Parameters Dialog Box

Memcpy threshold (bytes)


Specify the minimum array size in bytes for which memcpy function calls
should replace for loops in the generated code for vector assignments.

Settings
Default: 64

Specify the array size, in bytes, at which the code generator begins to use
memcpy instead of for loops for vector assignments.

Dependencies

• This parameter requires a Real-Time Workshop license.


• This parameter is enabled when you select Use memcpy for vector
assignment.

Command-Line Information
Parameter: MemcpyThreshold
Type: integer
Value: any valid quantity of bytes
Default: 64

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency Accept default or determine target-specific
optimal value
Safety precaution No impact

1-160
Optimization Pane

See Also

• “Optimizing Code Generated for Vector Assignments”


• Optimizing a Model for Code Generation
• Configuration Parameters Dialog Box
• Optimization Pane

1-161
1 Configuration Parameters Dialog Box

Pass reusable subsystem outputs as


Specify how a reusable subsystem passes outputs.

Settings
Default: Structure reference

Structure reference
Passes reusable subsystem outputs as a pointer to a structure stored in
global memory.
Individual arguments
Passes each reusable subsystem output argument as an address of a
local, instead of as a pointer to an area of global memory containing
all output arguments. This option reduces global memory usage and
eliminates copying local variables back to global block I/O structures.
When the signals are allocated as local variables, there may be an
increase in stack size. If the stack size increases beyond a level that
you want, use the default setting. The maximum number of output
arguments passed individually is 12.

Note The default option is used for reusable subsystems that have signals
with variable dimensions.

Dependencies
This parameter:

• Requires a Real-Time Workshop Embedded Coder license.


• Appears only for ERT-based targets.

Command-Line Information
Parameter: PassReuseOutputArgsAs
Type: string
Value: 'Structure reference' | 'Individual arguments'
Default: 'Structure reference'

1-162
Optimization Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency Individual arguments
Safety precaution No impact

See Also

• “Optimizing Generated Code”

• “Preparing Models for Code Generation”

1-163
1 Configuration Parameters Dialog Box

Remove root level I/O zero initialization


Specify whether to generate initialization code for root-level inports and
outports set to zero.

Settings
Default: Off (GUI), 'on' (command-line)

On
Does not generate initialization code for root-level inports and outports
set to zero.
Off
Generates initialization code for all root-level inports and outports. You
should use the default:
• To ensure that memory allocated for C MEX S-function wrappers
is initialized to zero
• For safety-critical applications that require that all internal and
external data be initialized to zero

Dependencies

• This parameter appears only for ERT-based targets.


• This parameter requires a Real-Time Workshop Embedded Coder license
when generating code.

Command-Line Information
Parameter: ZeroExternalMemoryAtStartup
Type: string
Value: 'off' | 'on'
Default: 'on'

1-164
Optimization Pane

Note The command-line values are reverse of the settings values. Therefore,
'on' in the command line corresponds to the description of “Off” in the
settings section, and 'off' in the command line corresponds to the description
of “On” in the settings section.

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution Off

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-165
1 Configuration Parameters Dialog Box

Use memset to initialize floats and doubles to 0.0


Specify whether to generate code that explicitly initializes floating-point
data to 0.0.

Settings
Default: On (GUI), 'off' (command-line)

On
Uses memset to clear internal storage for floating-point data to integer
bit pattern 0 (all bits 0), regardless of type. An example of a case for
selecting this option is to gain compiler efficiency when the compiler
and target CPU both represent floating-point zero with the integer bit
pattern 0.

Off
Generates code to explicitly initialize storage for data of types float
and double to 0.0. The resulting code is slightly less efficient than code
generated when you select the option.

You should not select this option if you need to ensure that memory
allocated for C MEX S-function wrappers is initialized to zero.

Dependency
This parameter requires a Real-Time Workshop license.

Command-Line Information
Parameter: InitFltsAndDblsToZero
Type: string
Value: 'on' | 'off'
Default: 'off'

Note The command-line values are reverse of the settings values. Therefore,
'on' in the command line corresponds to the description of “Off” in the
settings section, and 'off' in the command line corresponds to the description
of “On” in the settings section.

1-166
Optimization Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On (GUI), 'off' (command-line)
Safety precaution No impact

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-167
1 Configuration Parameters Dialog Box

Remove internal data zero initialization


Specify whether to generate initialization code for internal work structures,
such as block states and block outputs, to zero.

Settings
Default: Off (GUI), 'on' (command-line)

On
Does not generate code that initializes internal work structures to zero.
An example of when you might select this parameter is to test the
behavior of a design during warm boot—a restart without full system
reinitialization.

Selecting this parameter does not guarantee that memory is in a known


state each time the generated code begins execution. When you run a
model or generated S-function multiple times, each run can produce a
different answer, even when calling the model initialization function in
an attempt to reset memory.

If want to get the same answer on every run from a generated


S-function, enter the command clear SFcnNam or clear mex in the
MATLAB Command Window before each run.
Off
Generates code that initializes internal work structures to zero. You
should use the default:
• To ensure that memory allocated for C MEX S-function wrappers
is initialized to zero
• For safety critical applications that require that all internal and
external data be initialized to zero

Dependencies

• This parameter appears only for ERT-based targets.


• This parameter requires a Real-Time Workshop Embedded Coder license
when generating code.

1-168
Optimization Pane

Command-Line Information
Parameter: ZeroInternalMemoryAtStartup
Type: string
Value: 'off' | 'on'
Default: 'on'

Note The command-line values are reverse of the settings values. Therefore,
'on' in the command line corresponds to the description of “Off” in the
settings section, and 'off' in the command line corresponds to the description
of “On” in the settings section.

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution Off

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-169
1 Configuration Parameters Dialog Box

Optimize initialization code for model reference


Specify whether to generate initialization code for blocks that have states.

Settings
Default: on

On
Suppresses generation of initialization code for blocks that have states
unless the blocks are in a system that can reset its states, such as an
enabled subsystem. This results in more efficient code, but requires that
you not refer to the model from a Model block that resides in a system
that resets states. If you violate this constraint, Simulink software
reports an error, in which case you can disable this optimization.

Off
Generates initialization code for all blocks that have states. Disable this
option if the current model includes a subsystem that resets states, such
as an enabled subsystem, and the model is referred to from another
model with a Model block.

Dependencies

• This parameter appears only for ERT-based targets.


• This parameter requires a Real-Time Workshop Embedded Coder license
when generating code.
• You must disable this option if your model includes enabled subsystem and
model is referred to from another model with Model block.

Command-Line Information
Parameter: OptimizeModelRefInitCode
Type: string
Value: 'on' | 'off'
Default: 'on'

1-170
Optimization Pane

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-171
1 Configuration Parameters Dialog Box

Remove code from floating-point to integer


conversions that wraps out-of-range values
Remove wrapping code that handles out-of-range floating-point to integer
conversion results.

Settings
Default: Off

On
Removes code when out-of-range conversions occur. Select this check
box if code efficiency is critical to your application and the following
conditions are true for at least one block in the model:
• Computing the outputs or parameters of a block involves converting
floating-point data to integer or fixed-point data.
• The Saturate on integer overflow check box is cleared in the
Block Parameters dialog box.

Caution Execution of generated code might not produce the same


results as simulation.

Off
Results for simulation and execution of generated code match when
out-of-range conversions occur. The generated code is larger than when
you select this check box.

Tips

• Selecting this check box reduces the size and increases the speed of the
generated code at the cost of potentially producing results that do not
match simulation in the case of out-of-range values.
• Selecting this check box affects code generation results only for out-of-range
values and cannot cause code generation results to differ from simulation
results for in-range values.

1-172
Optimization Pane

Dependency
This parameter requires a Real-Time Workshop license.

Command-Line Information
Parameter: EfficientFloat2IntCast
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution Off (for simulation and during
development)
On (for production code generation)

See Also

• Removing Code That Wraps Out-of-Range Values


• Configuration Parameters Dialog Box
• Optimization Pane

1-173
1 Configuration Parameters Dialog Box

Remove code from floating-point to integer


conversions with saturation that maps NaN to zero
Remove code that handles floating-point to integer conversion results for
NaN values.

Settings
Default: On

On
Removes code when mapping from NaN to integer zero occurs. Select
this check box if code efficiency is critical to your application and the
following conditions are true for at least one block in the model:
• Computing outputs or parameters of a block involves converting
floating-point data to integer or fixed-point data.
• The Saturate on integer overflow check box is selected in the
Block Parameters dialog box.

Caution Execution of generated code might not produce the same


results as simulation.

Off
Results for simulation and execution of generated code match when
mapping from NaN to integer zero occurs. The generated code is larger
than when you select this check box.

Tips

• Selecting this check box reduces the size and increases the speed of the
generated code at the cost of producing results that do not match simulation
in the case of NaN values.
• Selecting this check box affects code generation results only for NaN values
and cannot cause code generation results to differ from simulation results
for any other values.

1-174
Optimization Pane

Dependencies

• This parameter requires a Real-Time Workshop license.


• For ERT-based targets, this parameter is enabled when you select the
floating-point numbers and non-finite numbers check boxes in the
Real-Time Workshop > Interface pane.

Command-Line Information
Parameter: EfficientMapNaN2IntZero
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency On
Safety precaution Off (for simulation and during
development)
On (for production code generation)

See Also

• Removing Code That Maps NaN Values to Integer Zero


• Configuration Parameters Dialog Box
• Optimization Pane

1-175
1 Configuration Parameters Dialog Box

Remove code that protects against division arithmetic


exceptions
Specify whether to generate code that guards against division by zero for
fixed-point data.

Settings
Default: On

On
Does not generate code that guards against division by zero for
fixed-point data. When you select this option, simulation results and
results from generated code might not be in bit-for-bit agreement.

Off
Generates code that guards against division by zero for fixed-point data.

Dependencies

• This parameter appears only for ERT-based targets.


• This parameter requires a Real-Time Workshop Embedded Coder license
when generating code.

Command-Line Information
Parameter: NoFixptDivByZeroProtection
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-176
Optimization Pane

Application Setting
Efficiency On
Safety precaution Off

See Also

• Optimizing a Model for Code Generation


• Configuration Parameters Dialog Box
• Optimization Pane

1-177
1 Configuration Parameters Dialog Box

Use bitsets for storing state configuration


Use bitsets to reduce the amount of memory required to store state
configuration variables.

Settings
Default: Off

On
Stores state configuration variables in bitsets. Potentially reduces the
amount of memory required to store the variables. Potentially requires
more instructions to access state configuration, which can result in
less optimal code.

Off
Stores state configuration variables in unsigned bytes. Potentially
increases the amount of memory required to store the variables.
Potentially requires fewer instructions to access state configuration,
which can result in more optimal code.

Tips

• Selecting this check box can significantly reduce the amount of memory
required to store the variables. However, it can increase the amount of
memory required to store target code if the target processor does not
include instructions for manipulating bitsets.
• Select this check box for Stateflow charts that have a large number of
sibling states at a given level of the hierarchy.
• Clear this check box for Stateflow charts with a small number of sibling
states at a given level of the hierarchy.

Dependency
This parameter requires a Stateflow license.

Command-Line Information
Parameter: StateBitsets

1-178
Optimization Pane

Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency Off
Safety precaution No impact

See Also

• Optimizing Generated Code


• Configuration Parameters Dialog Box
• Optimization Pane

1-179
1 Configuration Parameters Dialog Box

Use bitsets for storing Boolean data


Use bitsets to reduce the amount of memory required to store Boolean data.

Settings
Default: Off

On
Stores Boolean data in bitsets. Potentially reduces the amount
of memory required to store the data. Potentially requires more
instructions to access the data, which can result in less optimal code.

Off
Stores Boolean data in unsigned bytes. Potentially increases the
amount of memory required to store the data. Potentially requires fewer
instructions to access the data, which can result in more optimal code.

Tips

• Select this check box for Stateflow charts that reference Boolean data
infrequently.
• Clear this check box for Stateflow charts that reference Boolean data
frequently.

Dependency
This parameter requires a Stateflow license.

Command-Line Information
Parameter: DataBitsets
Type: string
Value: 'on' | 'off'
Default: 'off'

1-180
Optimization Pane

Recommended Settings

Application Setting
Debugging Off
Traceability Off
Efficiency Off
Safety precaution No impact

See Also

• Optimizing Generated Code


• Configuration Parameters Dialog Box
• Optimization Pane

1-181
1 Configuration Parameters Dialog Box

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.

Note Simulink software ignores the settings of this dialog box if a model
contains references to other models. However, you can still tune parameters
of such models, using Simulink.Parameter objects (see “Inline Parameter
Requirements” for more information).

The dialog box has the following controls.

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

• MATLAB workspace

1-182
Optimization Pane

Lists all variables in the MATLAB workspace that have numeric values.
• Referenced workspace variables
Lists only those variables referenced by the model.

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.

Note This option does not create the corresponding variable in the MATLAB
workspace. You must create the variable yourself.

Storage class
Used for code generation. See the Real-Time Workshop User’s Guide for more
information.

Storage type qualifier


Used for code generation. See the Real-Time Workshop User’s Guide for more
information.

1-183
1 Configuration Parameters Dialog Box

Compiler optimization level


Sets the degree of optimization used by the compiler when generating code
for acceleration.

Settings
Default: Optimizations off (faster builds)

Optimizations off (faster builds)


Specifies the compiler not to optimize code. This results in faster build
times.
Optimizations on (faster runs)
Specifies the compiler to generate optimized code. The generated code
will run faster, but the model build will take longer than if optimizations
are off.

Tips

• The default Optimizations off is a good choice for most models. This
quickly produces code that can be used with acceleration.
• Set Optimizations on to optimize your code. The fast running code
produced by optimization can be advantageous if you will repeatedly run
your model with the accelerator.

Command-Line Information
Parameter: SimCompilerOptimization
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-184
Optimization Pane

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• “Accelerating Models”
• “Interacting with the Acceleration Modes Programmatically”
• “Customizing the Acceleration Build Process”

1-185
1 Configuration Parameters Dialog Box

Verbose accelerator builds


Select the amount of information displayed during code generation for
Simulink Accelerator mode, referenced model Accelerator mode, and Rapid
Accelerator mode.

Settings
Default: Off

Off
Display limited amount of information during the code generation
process.

On
Display progress information during code generation, and show the
compiler options in use.

Command-Line Information
Parameter: AccelVerboseBuild
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also
For more information about AccelVerboseBuild, see “Controlling Verbosity
During Code Generation”.

1-186
Diagnostics Pane: Solver

Diagnostics Pane: Solver

In this section...
“Solver Diagnostics Overview” on page 1-189
“Algebraic loop” on page 1-190
“Minimize algebraic loop” on page 1-192
“Block priority violation” on page 1-194
“Min step size violation” on page 1-196
“Sample hit time adjusting” on page 1-198
“Consecutive zero-crossings violation” on page 1-200
“Unspecified inheritability of sample time” on page 1-202
“Solver data inconsistency” on page 1-204
“Automatic solver parameter selection” on page 1-206
“Extraneous discrete derivative signals” on page 1-208

1-187
1 Configuration Parameters Dialog Box

In this section...
“State name clash” on page 1-210
“SimState interface checksum mismatch:” on page 1-211

1-188
Diagnostics Pane: Solver

Solver Diagnostics Overview


Specify what diagnostic actions Simulink software should take, if any, when
it detects an abnormal condition with the solver.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also

• Diagnosing Simulation Errors


• Sample Time Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-189
1 Configuration Parameters Dialog Box

Algebraic loop
Select the diagnostic action to take if Simulink software detects an algebraic
loop while compiling the model.

Settings
Default: warning

none
Simulink software does not check for algebraic loops.
warning
When Simulink software detects an algebraic loop, it displays a warning.
error
When Simulink software detects an algebraic loop, it terminates the
simulation, displays an error message, and highlights the portion of the
block diagram that comprises the loop.

Tips

• An algebraic loop generally occurs when an input port with direct


feedthrough is driven by the output of the same block, either directly, or by
a feedback path through other blocks with direct feedthrough. An example
of an algebraic loop is this simple scalar loop.

• When a model contains an algebraic loop, Simulink software calls a loop


solving routine at each time step. The loop solver performs iterations to
determine the solution to the problem (if it can). As a result, models with
algebraic loops run slower than models without them.
• Use the error option to highlight algebraic loops when you simulate a
model. This causes Simulink software to display an error dialog (the
Diagnostics Viewer) and recolor portions of the diagram that represent the
algebraic loops that it detects. Simulink software uses red to color the

1-190
Diagnostics Pane: Solver

blocks and lines that constitute the loops. Closing the error dialog restores
the diagram to its original colors.
• See Algebraic Loops for more information.

Command-Line Information
Parameter: AlgebraicLoopMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging error
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Algebraic Loops
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-191
1 Configuration Parameters Dialog Box

Minimize algebraic loop


Select the diagnostic action to take if algebraic loop minimization cannot
be performed for a subsystem because an input port of that subsystem has
direct feedthrough.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• If the port is involved in an algebraic loop, Simulink software can remove


the loop only if at least one other input port in the loop lacks direct
feedthrough.
• Simulink software cannot minimize algebraic loops containing signals
designated as test points (see Working with Test Points).

Command-Line Information
Parameter: ArtificialAlgebraicLoopMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact

1-192
Diagnostics Pane: Solver

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also
• Algebraic Loops
• Diagnosing Simulation Errors
• Working with Test Points
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-193
1 Configuration Parameters Dialog Box

Block priority violation


Select the diagnostic action to take if Simulink software detects a block
priority specification error.

Settings
Default: warning

warning
When Simulink software detects a block priority specification error, it
displays a warning.
error
When Simulink software detects a block priority specification error, it
terminates the simulation and displays an error message.

Tips

• Simulink software allows you to assign update priorities to blocks.


Simulink software executes the output methods of higher priority blocks
before those of lower priority blocks.
• Simulink software honors the block priorities that you specify only if they
are consistent with the Simulink block sorting algorithm. If Simulink
software is unable to honor a user specified block priority, it generates
a block priority specification error.

Command-Line Information
Parameter: BlockPriorityViolationMsg
Type: string
Value: 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact

1-194
Diagnostics Pane: Solver

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also
• Controlling and Displaying the Sorted Order
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-195
1 Configuration Parameters Dialog Box

Min step size violation


Select the diagnostic action to take if Simulink software detects that the next
simulation step is smaller than the minimum step size specified for the model.

Settings
Default: warning

warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• A minimum step size violation can occur if the specified error tolerance for
the model requires a step size smaller than the specified minimum step
size. See Min step size and Maximum order for more information.
• Simulink software allows you to specify the maximum number of
consecutive minimum step size violations permitted (see Number of
consecutive min steps).

Command-Line Information
Parameter: MinStepSizeMsg
Type: string
Value: 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-196
Diagnostics Pane: Solver

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Min step size


• Maximum order
• Number of consecutive min steps
• “Purely Discrete Systems”
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-197
1 Configuration Parameters Dialog Box

Sample hit time adjusting


Select the diagnostic action to take if Simulink software makes a minor
adjustment to a sample hit time while running the model.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.

Tips

• Simulink software might change a sample hit time if that hit time is
close to the hit time for another task. If Simulink software considers the
difference to be due only to numerical errors (for example, precision issues
or roundoff errors), it changes the sample hits of the faster task or tasks to
exactly match the time of the slowest task that has that hit.
• Over time, these sample hit changes might cause a discrepancy between
the numerical simulation results and the actual theoretical results.
• When this option is set to warning, the MATLAB Command Window
displays a warning like the following when Simulink software detects a
change in the sample hit time:

Warning: Timing engine warning: Changing the hit time for ...

Command-Line Information
Parameter: TimeAdjustmentMsg
Type: string
Value: 'none' | 'warning'
Default: 'none'

1-198
Diagnostics Pane: Solver

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-199
1 Configuration Parameters Dialog Box

Consecutive zero-crossings violation


Select the diagnostic action to take when Simulink software detects that the
number of consecutive zero crossings exceeds the specified maximum.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• If you select warning or error, Simulink software reports the current


simulation time, the number of consecutive zero crossings counted, and
the type and name of the block in which Simulink software detected the
zero crossings.
• For more information, see Preventing Excessive Zero Crossings.

Dependency
This diagnostic applies only when you are using a variable-step solver and the
zero-crossing control is set to either Enable all or Use local settings.

Command-Line Information
Parameter: MaxConsecutiveZCsMsg
Type: string
Value: 'none' | 'warning'
Default: 'error'

1-200
Diagnostics Pane: Solver

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution warning or error

See Also

• Zero-Crossing Detection
• Zero-Crossing Control
• Number of consecutive zero crossings
• Time tolerance
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-201
1 Configuration Parameters Dialog Box

Unspecified inheritability of sample time


Select the diagnostic action to take if this model contains S-functions that do
not specify whether they preclude this model from inheriting their sample
times from a parent model.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Not specifying an inheritance rule may lead to incorrect simulation results.


• Simulink software checks for this condition only if the solver used to
simulate this model is a fixed-step discrete solver and the periodic sample
time constraint for the solver is set to ensure sample time independence
• For more information, see Periodic sample time constraint.

Command-Line Information
Parameter: UnknownTsInhSupMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact

1-202
Diagnostics Pane: Solver

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Periodic sample time constraint


• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-203
1 Configuration Parameters Dialog Box

Solver data inconsistency


Select the diagnostic action to take if Simulink software detects S-functions
that have continuous sample times, but do not produce consistent results
when executed multiple times.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Consistency checking can cause a significant decrease in performance (up


to 40%).
• Consistency checking is a debugging tool that validates certain assumptions
made by Simulink ODE solvers. Use this option to:
- Validate your S-functions and ensure that they adhere to the same rules
as Simulink built-in blocks.
- Determine the cause of unexpected simulation results.
- Ensure that blocks produce constant output when called with a given
value of t (time).
• Simulink software saves (caches) output, the zero-crossing, the derivative,
and state values from one time step for use in the next time step. The value
at the end of a time step can generally be reused at the start of the next
time step. Solvers, particularly stiff solvers such as ode23s and ode15s,
take advantage of this to avoid redundant calculations. While calculating
the Jacobian matrix, a stiff solver can call a block’s output functions many
times at the same value of t.

1-204
Diagnostics Pane: Solver

• When consistency checking is enabled, Simulink software recomputes the


appropriate values and compares them to the cached values. If the values
are not the same, a consistency error occurs. Simulink software compares
computed values for these quantities:
- Outputs
- Zero crossings
- Derivatives
- States

Command-Line Information
Parameter: ConsistencyChecking
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging warning
Traceability No impact
Efficiency none
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Choosing a Solver
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-205
1 Configuration Parameters Dialog Box

Automatic solver parameter selection


Select the diagnostic action to take if Simulink software changes a solver
parameter setting.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips
When enabled, this option notifies you if:

• Simulink software changes a user-modified parameter to make it consistent


with other model settings.
• Simulink software automatically selects solver parameters for the model,
such as FixedStepSize.

For example, if you simulate a discrete model that specifies a continuous


solver, Simulink software changes the solver type to discrete and displays a
warning about this change at the MATLAB command line.

Command-Line Information
Parameter: SolverPrmCheckMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

1-206
Diagnostics Pane: Solver

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Choosing a Solver
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-207
1 Configuration Parameters Dialog Box

Extraneous discrete derivative signals


Select the diagnostic action to take when a discrete signal appears to pass
through a Model block to the input of a block with continuous states.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This error can occur if a discrete signal passes through a Model block to
the input of a block with continuous states, such as an Integrator block. In
this case, Simulink software cannot determine with certainty the minimum
rate at which it needs to reset the solver to solve this model accurately.
• If this diagnostic is set to none or warning, Simulink software resets the
solver whenever the value of the discrete signal changes. This ensures
accurate simulation of the model if the discrete signal is the source of the
signal entering the block with continuous states. However, if the discrete
signal is not the source of the signal entering the block with continuous
states, resetting the solver at the rate the discrete signal changes can lead
to the solver being reset more frequently than necessary, slowing down
the simulation.
• If this diagnostic is set to error, Simulink software halts when compiling
this model and displays an error.

Dependency
This diagnostic applies only when you are using a variable-step ode solver and
the block diagram contains Model blocks.

1-208
Diagnostics Pane: Solver

Command-Line Information
Parameter: ModelReferenceExtraNoncontSigs
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Choosing a Solver
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

1-209
1 Configuration Parameters Dialog Box

State name clash


Select the diagnostic action to take when a name is used for more than one
state in the model.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.

Tips

• This diagnostic applies for continuous and discrete states during


simulation.
• This diagnostic applies only if you save states to the MATLAB workspace
using the format Structure or Structure with time. If you do not save
states in structure format, the state names are not used, and therefore the
diagnostic will not warn you about a naming conflict.

Command-Line Information
Parameter: StateNameClashWarn
Type: string
Value: 'none' | 'warning'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-210
Diagnostics Pane: Solver

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Data Import/Export Pane
• Save to workspace: States
• Save options: Format
• Exporting Data to the MATLAB Workspace
• Configuration Parameters Dialog Box
• Diagnostics Pane: Solver

SimState interface checksum mismatch:


Use this check to ensure that the interface checksum is identical to the model
checksum before loading the SimState.

Settings
Default: warning

none
Simulink software does not compare the interface checksum to the
model checksum.
warning
The interface checksum in the SimState is different than the model
checksum.
error
When Simulink detects that a change in the configuration settings
occurred after saving the SimState, it does not load the SimState and
reports an error.

1-211
1 Configuration Parameters Dialog Box

Command-Line Information
Parameter: SimStateInterfaceChecksum
Type: string
Value: 'warning' | 'error' | 'none'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• “Saving and Restoring the Simulation State as the SimState”


1-212
Diagnostics Pane: Sample Time

Diagnostics Pane: Sample Time

In this section...
“Sample Time Diagnostics Overview” on page 1-214
“Source block specifies -1 sample time” on page 1-215
“Discrete used as continuous” on page 1-217
“Multitask rate transition” on page 1-219
“Single task rate transition” on page 1-221
“Multitask conditionally executed subsystem” on page 1-223
“Tasks with equal priority” on page 1-225
“Enforce sample times specified by Signal Specification blocks” on page
1-227

1-213
1 Configuration Parameters Dialog Box

Sample Time Diagnostics Overview


Specify what diagnostic actions Simulink software should take, if any, when
it detects a compilation error related to model sample times.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also

• Diagnosing Simulation Errors


• Solver Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-214
Diagnostics Pane: Sample Time

Source block specifies -1 sample time


Select the diagnostic action to take if a source block (such as a Sine Wave
block) specifies a sample time of -1.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• The Random Source block does not obey this parameter. If its Sample
time parameter is set to -1, the Random Source block inherits its sample
time from its output port and never produces warnings or errors.
• Some Communications Blockset™ blocks internally inherit sample times,
which can be a useful and valid modeling technique. Set this parameter
to none for these types of models.

Command-Line Information
Parameter: InheritedTsInSrcMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact

1-215
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-216
Diagnostics Pane: Sample Time

Discrete used as continuous


Select the diagnostic action to take if a discrete block (such as the Unit Delay
block), inherits a continuous sample time from the block connected to its input.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: DiscreteInheritContinuousMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-217
1 Configuration Parameters Dialog Box

• Configuration Parameters Dialog Box


• Diagnostics Pane: Sample Time

1-218
Diagnostics Pane: Sample Time

Multitask rate transition


Select the diagnostic action to take if an invalid rate transition occurred
between two blocks operating in multitasking mode.

Settings
Default: error

warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This parameter allows you to adjust error checking for sample rate
transitions between blocks that operate at different sample rates.
• Use this option for models of real-time multitasking systems to ensure
detection of illegal rate transitions between tasks that can result in a
task’s output being unavailable when needed by another task. You can
then use Rate Transition blocks to eliminate such illegal rate transitions
from the model.

Command-Line Information
Parameter: MultiTaskRateTransMsg
Type: string
Value: 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-219
1 Configuration Parameters Dialog Box

Application Setting
Efficiency No impact
Safety precaution error

See Also

• Rate Transition block


• Model Execution and Rate Transitions
• Single-Tasking and Multitasking Execution Modes
• Sample Rate Transitions
• Tasking mode for periodic sample times
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-220
Diagnostics Pane: Sample Time

Single task rate transition


Select the diagnostic action to take if a rate transition occurred between two
blocks operating in single-tasking mode.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This parameter allows you to adjust error checking for sample rate
transitions between blocks that operate at different sample rates.
• Use this parameter when you are modeling a single-tasking system. In
such systems, task synchronization is not an issue.

Command-Line Information
Parameter: SingleTaskRateTransMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-221
1 Configuration Parameters Dialog Box

Application Setting
Efficiency No impact
Safety precaution none or error

See Also

• Rate Transition block


• Model Execution and Rate Transitions
• Single-Tasking and Multitasking Execution Modes
• Sample Rate Transitions
• Tasking mode for periodic sample times
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-222
Diagnostics Pane: Sample Time

Multitask conditionally executed subsystem


Select the diagnostic action to take if Simulink software detects a subsystem
that may cause data corruption or non-deterministic behavior.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• These types of subsystems can be caused by either of the following


conditions:
- Your model uses multitasking solver mode and it contains an enabled
subsystem that operates at multiple rates.
- Your model contains a conditionally executed subsystem that can reset
its states and that contains an asynchronous subsystem.
These types of subsystems can cause corrupted data or nondeterministic
behavior in a real-time system that uses code generated from the model.
• For models that use multitasking solver mode and contain an enabled
subsystem that operates at multiple rates, consider using single-tasking
solver mode or using a single-rate enabled subsystem instead.
• For models that contain a conditionally executed subsystem that can reset
its states and that contains an asynchronous subsystem, consider moving
the asynchronous subsystem outside the conditionally executed subsystem.

1-223
1 Configuration Parameters Dialog Box

Command-Line Information
Parameter: MultiTaskCondExecSysMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Tasking mode for periodic sample times


• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-224
Diagnostics Pane: Sample Time

Tasks with equal priority


Select the diagnostic action to take if Simulink software detects two tasks
with equal priority that can preempt each other in the target system.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This condition can occur when one asynchronous task of the target
represented by this model has the same priority as one of the target’s
asynchronous tasks.
• This option must be set to Error if the target allows tasks having the same
priority to preempt each other.

Command-Line Information
Parameter: TasksWithSamePriorityMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact

1-225
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution none or error

See Also

• Diagnosing Simulation Errors


• Rate Transitions and Asynchronous Blocks
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-226
Diagnostics Pane: Sample Time

Enforce sample times specified by Signal Specification


blocks
Select the diagnostic action to take if the sample time of the source port of
a signal specified by a Signal Specification block differs from the signal’s
destination port.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• The Signal Specification block allows you to specify the attributes of the
signal connected to its input and output ports. If the specified attributes
conflict with the attributes specified by the blocks connected to its ports,
Simulink software displays an error when it compiles the model, for
example, at the beginning of a simulation. If no conflict exists, Simulink
software eliminates the Signal Specification block from the compiled model.
• You can use the Signal Specification block to ensure that the actual
attributes of a signal meet desired attributes, or to ensure correct
propagation of signal attributes throughout a model.

Command-Line Information
Parameter: SigSpecEnsureSampleTimeMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

1-227
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Signal Specification block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Sample Time

1-228
Diagnostics Pane: Data Validity

Diagnostics Pane: Data Validity

1-229
1 Configuration Parameters Dialog Box

In this section...
“Data Validity Diagnostics Overview” on page 1-231
“Signal resolution” on page 1-232
“Division by singular matrix” on page 1-234
“Underspecified data types” on page 1-236
“Simulation range checking” on page 1-238
“Detect overflow” on page 1-240
“Inf or NaN block output” on page 1-242
“"rt" prefix for identifiers” on page 1-244
“Detect downcast” on page 1-246
“Detect overflow” on page 1-248
“Detect underflow” on page 1-250
“Detect precision loss” on page 1-252
“Detect loss of tunability” on page 1-254
“Detect read before write” on page 1-256
“Detect write after read” on page 1-258
“Detect write after write” on page 1-260
“Multitask data store” on page 1-262
“Duplicate data store names” on page 1-264
“Detect multiple driving blocks executing at the same time step” on page
1-266
“Underspecified initialization detection” on page 1-268
“Check undefined subsystem initial output” on page 1-271
“Check preactivation output of execution context” on page 1-274
“Check runtime output of execution context” on page 1-277
“Array bounds exceeded” on page 1-280
“Model Verification block enabling” on page 1-282

1-230
Diagnostics Pane: Data Validity

Data Validity Diagnostics Overview


Specify what diagnostic action Simulink software should take, if any, when
it detects a condition that could compromise the integrity of data defined
by the model, as well as the Data Validity parameters that pertain to code
generation, and are used to debug a model.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also

• Diagnosing Simulation Errors


• Solver Diagnostics
• Sample Time Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-231
1 Configuration Parameters Dialog Box

Signal resolution
Select how Simulink software resolves signals to Simulink.Signal objects.
See “Explicit and Implicit Symbol Resolution” for more information.

Settings
Default: Explicit only

Explicit only
Do not perform implicit signal resolution. Only explicitly specified
signal resolution occurs. This is the recommended setting.
Explicit and implicit
Perform implicit signal resolution wherever possible, without posting
any warnings about the implicit resolutions.
Explicit and warn implicit
Perform implicit signal resolution wherever possible, posting a warning
of each implicit resolution that occurs.

Tips

• Use the Signal Properties dialog box (see Signal Properties Dialog Box) to
specify explicit resolution for signals.
• Use the State Attributes pane on dialog boxes of blocks that have discrete
states, e.g., the Discrete-Time Integrator block, to specify explicit resolution
for discrete states.
• Multiple signals can resolve to the same signal object and have the
properties that the object specifies.
• The MathWorks discourages using implicit signal resolution except for fast
prototyping, because implicit resolution slows performance, complicates
model validation, and can have nondeterministic effects.
• Simulink software provides the disableimplicitsignalresolution
function, which you can use to change settings throughout a model so that
it does not use implicit signal resolution.

1-232
Diagnostics Pane: Data Validity

Command-Line Information
Parameter: SignalResolutionControl
Type: string
Value: 'UseLocalSettings' | 'TryResolveAll' |
'TryResolveAllWithWarning'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Explicit only

See Also

• Diagnosing Simulation Errors


• Simulink.Signal
• Signal Properties Dialog Box
• Discrete-Time Integrator block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-233
1 Configuration Parameters Dialog Box

Division by singular matrix


Select the diagnostic action to take if the Product block detects a singular
matrix while inverting one of its inputs in matrix multiplication mode.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: CheckMatrixSingularityMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-234
Diagnostics Pane: Data Validity

• Product block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-235
1 Configuration Parameters Dialog Box

Underspecified data types


Select the diagnostic action to take if Simulink software could not infer the
data type of a signal during data type propagation.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: UnderSpecifiedDataTypeMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-236
Diagnostics Pane: Data Validity

• Configuration Parameters Dialog Box


• Diagnostics Pane: Data Validity

1-237
1 Configuration Parameters Dialog Box

Simulation range checking


Select the diagnostic action to take when signals exceed specified minimum
or maximum values.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Use a block’s Output minimum or Minimum parameter to specify the


minimum value that the block should output.
• Use a block’s Output maximum or Maximum parameter to specify the
maximum value that the block should output.
• Enable this diagnostic to check whether block outputs exceed the minimum
or maximum values that you specified.
• When Simulation range checking is enabled, Simulink software
performs signal range checking at every time step during a simulation.
Setting this diagnostic to warning or error can cause a decrease in
simulation performance.

Command-Line Information
Parameter: SignalRangeChecking
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

1-238
Diagnostics Pane: Data Validity

Recommended Settings

Application Setting
Debugging warning or error
Traceability warning or error
Efficiency none
Safety precaution error

See Also

• Checking Signal Ranges


• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-239
1 Configuration Parameters Dialog Box

Detect overflow
Select the diagnostic action to take if the value of a signal or parameter is too
large to be represented by the signal or parameter’s data type.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This diagnostic applies only to overflows for integer and fixed-point data
types.
• To check for floating-point overflows (e.g., Inf or NaN) for double or single
data types, select the Inf or NaN block output diagnostic. (See “Inf or
NaN block output” on page 1-242 for more information.)

Command-Line Information
Parameter: IntegerOverflowMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact

1-240
Diagnostics Pane: Data Validity

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Working with Data Types
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-241
1 Configuration Parameters Dialog Box

Inf or NaN block output


Select the diagnostic action to take if the value of a block output is Inf or
NaN at the current time step.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This diagnostic applies only to floating-point overflows for double or


single data types.
• To check for integer and fixed-point overflows, select the Detect overflow
diagnostic. (See “Detect overflow” on page 1-240 for more information.)

Command-Line Information
Parameter: SignalInfNanChecking
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-242
Diagnostics Pane: Data Validity

Application Setting
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-243
1 Configuration Parameters Dialog Box

"rt" prefix for identifiers


Select the diagnostic action to take during code generation if a Simulink object
name (the name of a parameter, block, or signal) begins with rt.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• The default setting (error) causes code generation to terminate with an


error if it encounters a Simulink object name (parameter, block, or signal),
that begins with rt.
• This is intended to prevent inadvertent clashes with generated identifiers
whose names begins with rt.

Command-Line Information
Parameter: RTPrefix
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact

1-244
Diagnostics Pane: Data Validity

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-245
1 Configuration Parameters Dialog Box

Detect downcast
Select the diagnostic action to take when a parameter downcast occurs during
simulation.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• A parameter downcast occurs if the computation of block output required


converting the parameter’s specified type to a type having a smaller range
of values (for example, from uint32 to uint8).
• This diagnostic applies only to named tunable parameters.

Command-Line Information
Parameter: ParameterDowncastMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-246
Diagnostics Pane: Data Validity

Application Setting
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-247
1 Configuration Parameters Dialog Box

Detect overflow
Select the diagnostic action to take if a parameter overflow occurs during
simulation.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• A parameter overflow occurs if Simulink software encounters a parameter


whose data type’s range is not large enough to accommodate the
parameter’s ideal value (the ideal value is either too large or too small to be
represented by the data type). For example, suppose that the parameter’s
ideal value is 200 and its data type is int8. Overflow occurs in this case
because the maximum value that int8 can represent is 127.
• Parameter overflow differs from parameter precision loss, which occurs
when the ideal parameter value is within the range of the data type and
scaling being used, but cannot be represented exactly.
• Both parameter overflow and precision loss are quantization errors, and
the distinction between them can be a fine one. The Detect overflow
diagnostic reports all quantization errors greater than one bit. For very
small parameter quantization errors, precision loss will be reported rather
than an overflow when

( Max + Slope ) ≥ Videal > ( Min − Slope )


where
- Max is the maximum value representable by the parameter data type

1-248
Diagnostics Pane: Data Validity

- Min is the minimum value representable by the parameter data type


- Slope is the slope of the parameter data type (slope = 1 for integers)
- Videal is the ideal value of the parameter

Command-Line Information
Parameter: ParameterOverflowMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-249
1 Configuration Parameters Dialog Box

Detect underflow
Select the diagnostic action to take when a parameter underflow occurs
during simulation.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Parameter underflow occurs when Simulink software encounters a


parameter whose data type does not have enough precision to represent the
parameter’s ideal value because the ideal value is too small.
• When parameter underflow occurs, casting the ideal value to the data type
causes the parameter’s modeled value to become zero, and therefore to
differ from its ideal value.

Command-Line Information
Parameter: ParameterUnderflowMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact

1-250
Diagnostics Pane: Data Validity

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-251
1 Configuration Parameters Dialog Box

Detect precision loss


Select the diagnostic action to take when parameter precision loss occurs
during simulation.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Precision loss occurs when Simulink software encounters a parameter


whose data type does not have enough precision to represent the
parameter’s value exactly. As a result, the modeled value differs from the
ideal value.
• Parameter precision loss differs from parameter overflow, which occurs
when the range of the parameter’s data type, i.e., that maximum value that
it can represent, is smaller than the ideal value of the parameter.
• Both parameter overflow and precision loss are quantization errors, and
the distinction between them can be a fine one. The Detect Parameter
overflow diagnostic reports all parameter quantization errors greater
than one bit. For very small parameter quantization errors, precision loss
will be reported rather than an overflow when

( Max + Slope ) ≥ Videal > ( Min − Slope )


where
- Max is the maximum value representable by the parameter data type.
- Min is the minimum value representable by the parameter data type.

1-252
Diagnostics Pane: Data Validity

- Slope is the slope of the parameter data type (slope = 1 for integers).
- Videal is the full-precision, ideal value of the parameter.

Command-Line Information
Parameter: ParameterPrecisionLossMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-253
1 Configuration Parameters Dialog Box

Detect loss of tunability


Select the diagnostic action to take when an expression with tunable variables
is reduced to its numerical equivalent.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tip
If a tunable workspace variable is modified by Mask Initialization code, or is
used in an arithmetic expression with unsupported operators or functions, the
expression is reduced to a numeric expression and therefore cannot be tuned.

Command-Line Information
Parameter: ParameterTunabilityLossMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

1-254
Diagnostics Pane: Data Validity

See Also

• Diagnosing Simulation Errors


• Tunable Expressions
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-255
1 Configuration Parameters Dialog Box

Detect read before write


Select the diagnostic action to take if the model attempts to read data from a
data store to which it has not written data in this time step.

Settings
Default: Use local settings

Use local settings


For each local data store (defined by a Data Store Memory block or
Simulink.Signal object in a model workspace) use the setting specified
by the block. For each global data store (defined by a Simulink.Signal
object in the base workspace) disable the diagnostic.
Disable All
Disables this diagnostic for all data stores accessed by the model.
Enable All As Warnings
Displays diagnostic as a warning at the MATLAB command line.
Enable All As Errors
Halts the simulation and displays the diagnostic in an error dialog box.

Command-Line Information
Parameter: ReadBeforeWriteMsg
Type: string
Value: 'UseLocalSettings' | 'DisableAll' | 'EnableAllAsWarning' |
'EnableAllAsError'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Enable all as errors

1-256
Diagnostics Pane: Data Validity

See Also
• Diagnosing Simulation Errors
• Working with Data Stores
• Data Store Memory block
• Simulink.Signal object
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-257
1 Configuration Parameters Dialog Box

Detect write after read


Select the diagnostic action to take if the model attempts to write data to a
data store after previously reading data from it in the current time step.

Settings
Default: Use local settings

Use local settings


For each local data store (defined by a Data Store Memory block or
Simulink.Signal object in a model workspace) use the setting specified
by the block. For each global data store (defined by a Simulink.Signal
object in the base workspace) disable the diagnostic.
Disable All
Disables this diagnostic for all data stores accessed by the model.
Enable All As Warnings
Displays diagnostic as a warning at the MATLAB command line.
Enable All As Errors
Halts the simulation and displays the diagnostic in an error dialog box.

Command-Line Information
Parameter: WriteAfterReadMsg
Type: string
Value: 'UseLocalSettings' | 'DisableAll' | 'EnableAllAsWarning' |
'EnableAllAsError'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Enable all as errors

1-258
Diagnostics Pane: Data Validity

See Also
• Diagnosing Simulation Errors
• Working with Data Stores
• Data Store Memory block
• Simulink.Signal object
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-259
1 Configuration Parameters Dialog Box

Detect write after write


Select the diagnostic action to take if the model attempts to write data to a
data store twice in succession in the current time step.

Settings
Default: Use local settings

Use local settings


For each local data store (defined by a Data Store Memory block or
Simulink.Signal object in a model workspace) use the setting specified
by the block. For each global data store (defined by a Simulink.Signal
object in the base workspace) disable the diagnostic.
Disable All
Disables this diagnostic for all data stores accessed by the model.
Enable All As Warnings
Displays diagnostic as a warning at the MATLAB command line.
Enable All As Errors
Halts the simulation and displays the diagnostic in an error dialog box.

Command-Line Information
Parameter: WriteAfterWriteMsg
Type: string
Value: 'UseLocalSettings' | 'DisableAll' | 'EnableAllAsWarning' |
'EnableAllAsError'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Enable all as errors

1-260
Diagnostics Pane: Data Validity

See Also
• Diagnosing Simulation Errors
• Working with Data Stores
• Data Store Memory block
• Simulink.Signal object
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-261
1 Configuration Parameters Dialog Box

Multitask data store


Select the diagnostic action to take when one task reads data from a Data
Store Memory block to which another task writes data.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Such a situation is safe only if one of the tasks cannot interrupt the other,
such as when the data store is a scalar and the writing task uses an atomic
copy operation to update the store or the target does not allow the tasks to
preempt each other.
• You should disable this diagnostic (set it to none) only if the application
warrants it, such as if the application uses a cyclic scheduler that prevents
tasks from preempting each other.

Command-Line Information
Parameter: MultiTaskDSMMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

1-262
Diagnostics Pane: Data Validity

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Working with Data Stores
• Data Store Memory block
• Simulink.Signal object
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-263
1 Configuration Parameters Dialog Box

Duplicate data store names


Select the diagnostic action to take when the model contains multiple data
stores that have the same name. The data stores can be defined with Data
Store Memory blocks or Simulink.Signal objects.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tip
This diagnostic is useful for detecting errors that can occur when a lower-level
data store unexpectedly shadows a higher-level data store that has the same
name.

Command-Line Information
Parameter: UniqueDataStoreMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-264
Diagnostics Pane: Data Validity

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Working with Data Stores
• Data Store Memory block
• Simulink.Signal object
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-265
1 Configuration Parameters Dialog Box

Detect multiple driving blocks executing at the same


time step
Select the diagnostic action to take when the software detects a Merge block
with more than one driving block executing at the same time step.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Connecting the inputs of a Merge block to multiple driving blocks that


execute at the same time step can lead to inconsistent results for both
simulation and generated code. Set Detect multiple driving blocks
executing at the same time step to error to avoid such situations.
• If Underspecified initialization detection is set to Simplified,
this parameter is disabled, and Simulink software automatically uses
the strictest setting (error) for this diagnostic. Multiple driving blocks
executing at the same time step always result in an error.

Dependency
This parameter is enabled only if Underspecified initialization detection
is set to Classic.

1-266
Diagnostics Pane: Data Validity

Command-Line Information
Parameter: MergeDetectMultiDrivingBlocksExec
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging error
Traceability error
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Merge block
• “Check consistency of initialization parameters for Outport and Merge
blocks”
• “Underspecified initialization detection” on page 1-268
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-267
1 Configuration Parameters Dialog Box

Underspecified initialization detection


Select how Simulink software handles initialization of initial conditions for
conditionally executed subsystems, Merge blocks, subsystem elapsed time,
and Discrete-Time Integrator blocks.

Settings
Default: Classic

Classic
Initial conditions are initialized the same way they were prior to R2008b.
Simplified
Initial conditions are initialized using the enhanced behavior, which can
improve the consistency of simulation results.

Tips

• Use Classic to ensure compatibility with previous releases of Simulink.


• Use Simplified to improve the consistency of simulation results, especially
for models that do not specify initial conditions for conditional subsystem
output ports, and for models that have conditionally executed subsystem
output ports connected to S-functions.
• When using Simplified initialization mode, you must set both Mux
blocks used to create bus signals, and Bus signal treated as vector
to error on the Connectivity Diagnostics pane.
• For existing models, The MathWorks recommends using the Model Advisor
to migrate your model to the new settings. To migrate your model, run
the following Model Advisor checks:
- Check for proper bus usage
- Check consistency of initialization parameters for Outport and
Merge blocks
For more information, see “Check consistency of initialization parameters
for Outport and Merge blocks” in the Simulink Reference.

1-268
Diagnostics Pane: Data Validity

Dependencies
Selecting Classic enables the following parameters:

• Detect multiple driving blocks executing at the same time step


• Check undefined subsystem initial output
• Check preactivation output of execution context
• Check runtime output of execution context

Selecting Simplified disables these parameters, and automatically sets


Detect multiple driving blocks executing at the same time step to
error.

Command-Line Information
Parameter: UnderspecifiedInitializationDetection
Type: string
Value: 'classic' | 'simplified'
Default: 'classic'

Recommended Settings

Application Setting
Debugging Simplified
Traceability Simplified
Efficiency Simplified
Safety precaution Simplified

See Also

• “Check consistency of initialization parameters for Outport and Merge


blocks”
• Merge block
• Discrete-Time Integrator block

1-269
1 Configuration Parameters Dialog Box

• “Creating Conditional Subsystems”


• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-270
Diagnostics Pane: Data Validity

Check undefined subsystem initial output


Specify whether to display a warning if the model contains a conditionally
executed subsystem in which a block with a specified initial condition drives
an Outport block with an undefined initial condition

Settings
Default: On

On
Displays a warning if the model contains a conditionally executed
subsystem in which a block with a specified initial condition drives an
Outport block with an undefined initial condition.

Off
Does not display a warning.

Tips

• This situation occurs when a block with a specified initial condition, such
as a Constant, Initial Condition, or Delay block, drives an Outport block
with an undefined initial condition (Initial output parameter is set to []).
• Models with such subsystems can produce initial results (i.e., before initial
activation of the conditionally executed subsystem) in the current release
that differ from initial results produced in Release 13 or earlier releases.
Consider for example the following model.

1-271
1 Configuration Parameters Dialog Box

This model does not define the initial condition of the triggered subsystem’s
output port.
The following figure compares the superimposed output of this model’s Step
block and the triggered subsystem in Release 13 and the current release.

Notice that the initial output of the triggered subsystem differs between
the two releases. This is because Release 13 and earlier releases use the
initial output of the block connected to the output port (i.e., the Constant
block) as the triggered subsystem’s initial output. By contrast, this release
outputs 0 as the initial output of the triggered subsystem because the
model does not specify the port’s initial output.

Dependency
This parameter is enabled only if Underspecified initialization detection
is set to Classic.

Command-Line Information
Parameter: CheckSSInitialOutputMsg
Type: string
Value: 'on' | 'off'
Default: 'on'

1-272
Diagnostics Pane: Data Validity

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution On

See Also

• Diagnosing Simulation Errors


• “Creating Conditional Subsystems”
• “Underspecified initialization detection” on page 1-268
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-273
1 Configuration Parameters Dialog Box

Check preactivation output of execution context


Specify whether to display a warning if Simulink software detects potential
initial output differences from previous releases.

Settings
Default: Off

On
Displays a warning if Simulink software detects potential initial output
differences from previous releases.

Off
Does not display a warning.

Tips

• This diagnostic is triggered if the model contains a block that meets the
following conditions:
- The block produces nonzero output for zero input (e.g., a Cosine block).
- The block is connected to an output of a conditionally executed
subsystem.
- The block inherits its execution context from that subsystem.
- The Outport to which it is connected has an undefined initial condition,
i.e., the Outport block’s Initial output parameter is set to [].
• Models with blocks that meet these criteria can produce initial results
(i.e., before the conditionally executed subsystem is first activated in the
current release that differ from initial results produced in Release 13 or
earlier releases.
Consider for example the following model.

1-274
Diagnostics Pane: Data Validity

The following figure compares the superimposed output of the Pulse


Generator and cos block in Release 13 and the current release.

Note that the initial output of the cos block differs between the two
releases. This is because in Release 13, the cos block belongs to the
execution context of the root system and hence executes at every time step
whereas in the current release, the cos block belongs to the execution
context of the triggered subsystem and hence executes only when the
triggered subsystem executes.

1-275
1 Configuration Parameters Dialog Box

Dependency
This parameter is enabled only if Underspecified initialization detection
is set to Classic.

Command-Line Information
Parameter: CheckExecutionContextPreStartOutputMsg
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution On

See Also

• Diagnosing Simulation Errors


• “Underspecified initialization detection” on page 1-268
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-276
Diagnostics Pane: Data Validity

Check runtime output of execution context


Specify whether to display a warning if Simulink software detects potential
output differences from previous releases.

Settings
Default: Off

On
Displays a warning if Simulink software detects potential output
differences from previous releases.

Off
Does not display a warning.

Tips

• This diagnostic is triggered if the model contains a block that meets the
following conditions:
- The block has a tunable parameter.
- The block is connected to an output of a conditionally executed
subsystem.
- The block inherits its execution context from that subsystem.
- The Outport to which it is connected has an undefined initial condition,
i.e., the Outport block’s Initial output parameter is set to [].
• Models with blocks that meet these criteria can produce results when the
parameter is tuned in the current release that differ from results produced
in Release 13 or earlier releases.
Consider for example the following model.

1-277
1 Configuration Parameters Dialog Box

In this model, the tunevar S-function changes the value of the Gain
block’s k parameter and updates the diagram at simulation time 7 (i.e., it
simulates tuning the parameter).
The following figure compares the superimposed output of the model’s Pulse
Generator block and its Gain block in Release 13 and the current release.

Note that the output of the Gain block changes at time 7 in Release 13
but does not change in the current release. This is because in Release 13,
the Gain block belongs to the execution context of the root system and
hence executes at every time step whereas in the current release, the Gain

1-278
Diagnostics Pane: Data Validity

block belongs to the execution context of the triggered subsystem and hence
executes only when the triggered subsystem executes, i.e., at times 5, 10,
15, and 20.

Dependency
This parameter is enabled only if Underspecified initialization detection
is set to Classic.

Command-Line Information
Parameter: CheckExecutionContextRuntimeOutputMsg
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution On

See Also

• Diagnosing Simulation Errors


• “Underspecified initialization detection” on page 1-268
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-279
1 Configuration Parameters Dialog Box

Array bounds exceeded


Select the diagnostic action to take when blocks write data to locations outside
the memory allocated to them.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• Use this option to check whether execution of each instance of a block


during model simulation writes data to memory locations not allocated
to the block. This can happen only if your model includes a user-written
S-function that has a bug.
• Enabling this option slows down model execution considerably. Thus, you
should enable it only if you suspect that your model contains a user-written
S-function that has a bug.
• This option causes Simulink software to check whether a block writes
outside the memory allocated to it during simulation. Typically this can
happen only if your model includes a user-written S-function that has a bug.
• See Writing S-Functions for more information on using this option.

Command-Line Information
Parameter: ArrayBoundsChecking
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

1-280
Diagnostics Pane: Data Validity

Recommended Settings

Application Setting
Debugging warning
Traceability No impact
Efficiency none
Safety precaution No impact

See Also

• Diagnosing Simulation Errors


• Writing S-Functions
• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-281
1 Configuration Parameters Dialog Box

Model Verification block enabling


Enable model verification blocks in the current model either globally or locally.

Settings
Default: Use local settings

Use local settings


Enables or disables blocks based on the value of the Enable assertion
parameter of each block. If a block’s Enable assertion parameter is
on, the block is enabled; otherwise, the block is disabled.
Enable All
Enables all model verification blocks in the model regardless of the
settings of their Enable assertion parameters.
Disable All
Disables all model verification blocks in the model regardless of the
settings of their Enable assertion parameters.

Dependency
Simulation and code generation ignore the Model Verification block
enabling parameter when model verification blocks are inside a S-function.

Command-Line Information
Parameter: AssertControl
Type: string
Value: 'UseLocalSettings' | 'EnableAll' | 'DisableAll'
Default: 'UseLocalSettings'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-282
Diagnostics Pane: Data Validity

Application Setting
Efficiency No impact
Safety precaution Disable all

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Data Validity

1-283
1 Configuration Parameters Dialog Box

Diagnostics Pane: Type Conversion

In this section...
“Type Conversion Diagnostics Overview” on page 1-285
“Unnecessary type conversions” on page 1-286
“Vector/matrix block input conversion” on page 1-287
“32-bit integer to single precision float conversion” on page 1-289
“Detect underflow” on page 1-291
“Detect precision loss” on page 1-293
“Detect overflow” on page 1-295

1-284
Diagnostics Pane: Type Conversion

Type Conversion Diagnostics Overview


Specify the diagnostic actions that Simulink software should take when it
detects a data type conversion problem while compiling the model.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also
• Diagnosing Simulation Errors
• Solver Diagnostics
• Sample Time Diagnostics
• Data Validity Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-285
1 Configuration Parameters Dialog Box

Unnecessary type conversions


Select the diagnostic action to take when Simulink software detects a Data
Type Conversion block used where no type conversion is necessary.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.

Command-Line Information
Parameter: UnnecessaryDatatypeConvMsg
Type: string
Value: 'none' | 'warning'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution warning

See Also

• Diagnosing Simulation Errors


• Data Type Conversion block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-286
Diagnostics Pane: Type Conversion

Vector/matrix block input conversion


Select the diagnostic action to take when Simulink software detects a
vector-to-matrix or matrix-to-vector conversion at a block input.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips
Simulink software converts vectors to row or column matrices and row or
column matrices to vectors under the following circumstances:

• If a vector signal is connected to an input that requires a matrix, Simulink


software converts the vector to a one-row or one-column matrix.
• If a one-column or one-row matrix is connected to an input that requires a
vector, Simulink software converts the matrix to a vector.
• If the inputs to a block consist of a mixture of vectors and matrices and the
matrix inputs all have one column or one row, Simulink software converts
the vectors to matrices having one column or one row, respectively.

Command-Line Information
Parameter: VectorMatrixConversionMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

1-287
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Determining Output Signal Dimensions
• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-288
Diagnostics Pane: Type Conversion

32-bit integer to single precision float conversion


Select the diagnostic action to take if Simulink software detects a 32-bit
integer value was converted to a floating-point value.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.

Tip
Converting a 32-bit integer value to a floating-point value can result in a loss
of precision. See Working with Data Types for more information.

Command-Line Information
Parameter: Int32ToFloatConvMsg
Type: string
Value: 'none' | 'warning'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution warning

See Also

• Diagnosing Simulation Errors

1-289
1 Configuration Parameters Dialog Box

• Working with Data Types


• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-290
Diagnostics Pane: Type Conversion

Detect underflow
Specifies diagnostic action to take when a fixed-point constant underflow
occurs during simulation.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This diagnostic applies only to fixed-point constants (net slope and net bias).
• Fixed-point constant underflow occurs when Simulink software encounters
a fixed-point constant whose data type does not have enough precision to
represent the ideal value of the constant because the ideal value is too
small.
• When fixed-point constant underflow occurs, casting the ideal value to the
data type causes the value of the fixed-point constant to become zero, and
therefore to differ from its ideal value.

Dependency
This parameter requires a Simulink Fixed Point license.

Command-Line Information
Parameter:FixptConstUnderflowMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

1-291
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Net Slope and Net Bias Precision Issues


• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-292
Diagnostics Pane: Type Conversion

Detect precision loss


Specifies diagnostic action to take when a fixed-point constant precision loss
occurs during simulation.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This diagnostic applies only to fixed-point constants (net slope and net bias).
• Precision loss occurs when Simulink software converts a fixed-point
constant to a data type which does not have enough precision to represent
the exact value of the constant. As a result, the quantized value differs
from the ideal value.
• Fixed-point constant precision loss differs from fixed-point constant
overflow. Overflow occurs when the range of the parameter’s data type,
that is, the maximum value that it can represent, is smaller than the ideal
value of the parameter.

Dependency
This parameter requires a Simulink Fixed Point license.

Command-Line Information
Parameter:FixptConstPrecisionLossMsg
Type: string
Value: 'none' | 'warning' | 'error'

1-293
1 Configuration Parameters Dialog Box

Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Net Slope and Net Bias Precision Issues


• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-294
Diagnostics Pane: Type Conversion

Detect overflow
Specifies diagnostic action to take when a fixed-point constant overflow occurs
during simulation.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• This diagnostic applies only to fixed-point constants (net slope and net bias).
• Overflow occurs when the Simulink software converts a fixed-point
constant to a data type whose range is not large enough to accommodate
the ideal value of the constant. The ideal value is either too large or too
small to be represented by the data type. For example, suppose that the
ideal value is 200 and the converted data type is int8. Overflow occurs in
this case because the maximum value that int8 can represent is 127.
• Fixed-point constant overflow differs from fixed-point constant precision
loss. Precision loss occurs when the ideal fixed-point constant value is
within the range of the data type and scaling being used, but cannot be
represented exactly.

Dependency
This parameter requires a Simulink Fixed Point license.

Command-Line Information
Parameter:FixptConstOverflowMsg

1-295
1 Configuration Parameters Dialog Box

Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Net Slope and Net Bias Precision Issues


• Configuration Parameters Dialog Box
• Diagnostics Pane: Type Conversion

1-296
Diagnostics Pane: Connectivity

Diagnostics Pane: Connectivity

In this section...
“Connectivity Diagnostics Overview” on page 1-299
“Signal label mismatch” on page 1-300
“Unconnected block input ports” on page 1-302
“Unconnected block output ports” on page 1-304
“Unconnected line” on page 1-306
“Unspecified bus object at root Outport block” on page 1-308
“Element name mismatch” on page 1-310
“Mux blocks used to create bus signals” on page 1-312
“Bus signal treated as vector” on page 1-315

1-297
1 Configuration Parameters Dialog Box

In this section...
“Invalid function-call connection” on page 1-318
“Context-dependent inputs” on page 1-320

1-298
Diagnostics Pane: Connectivity

Connectivity Diagnostics Overview


Specify the diagnostic actions that Simulink software should take when it
detects a problem with block connections while compiling the model.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also
• Diagnosing Simulation Errors
• Solver Diagnostics
• Sample Time Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-299
1 Configuration Parameters Dialog Box

Signal label mismatch


Select the diagnostic action to take when Simulink software detects virtual
signals that have a common source signal but different labels.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: SignalLabelMismatchMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-300
Diagnostics Pane: Connectivity

• Virtual Signals
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-301
1 Configuration Parameters Dialog Box

Unconnected block input ports


Select the diagnostic action to take when the model contains a block with
an unconnected input.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: UnconnectedInputMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-302
Diagnostics Pane: Connectivity

• Configuration Parameters Dialog Box


• Diagnostics Pane: Connectivity

1-303
1 Configuration Parameters Dialog Box

Unconnected block output ports


Select the diagnostic action to take when the model contains a block with an
unconnected output.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: UnconnectedOutputMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-304
Diagnostics Pane: Connectivity

• Configuration Parameters Dialog Box


• Diagnostics Pane: Connectivity

1-305
1 Configuration Parameters Dialog Box

Unconnected line
Select the diagnostic action to take when the Model contains an unconnected
line or an unmatched Goto or From block.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: UnconnectedLineMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-306
Diagnostics Pane: Connectivity

• Goto block
• From block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-307
1 Configuration Parameters Dialog Box

Unspecified bus object at root Outport block


Select the diagnostic action to take while generating a simulation target for a
referenced model if any of the model’s root Outport blocks is connected to a
bus but does not specify a bus object (see Simulink.Bus).

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: RootOutportRequireBusObject
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-308
Diagnostics Pane: Connectivity

• Outport block
• Simulink.Bus
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-309
1 Configuration Parameters Dialog Box

Element name mismatch


Select the diagnostic action to take if the name of a bus element does not
match the name specified by the corresponding bus object.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tip
You can use this diagnostic along with bus objects to ensure that your model
meets bus element naming requirements imposed by some blocks, such as
the Switch block.

Command-Line Information
Parameter: BusObjectLabelMismatch
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

1-310
Diagnostics Pane: Connectivity

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-311
1 Configuration Parameters Dialog Box

Mux blocks used to create bus signals


Select the diagnostic action to take if Simulink software detects a Mux block
that creates a virtual bus.

Settings
Default: warning

none
Simulink software takes no action.

This option disables checking for Mux blocks used to create virtual bus
signals.
warning
Simulink software displays a warning.

This option does not enforce strict bus behavior. However, if it detects a
Mux block that creates a virtual bus during model update or simulation,
it displays a message in the MATLAB Command Window that identifies
the offending block. It does this for the first ten Mux blocks that it
encounters that violate strict bus behavior.
error
Simulink software terminates the simulation and displays an error
message identifying the first Mux block it encounters that is used to
create a virtual bus. If this option is selected, a Mux block with more
than one input is allowed to output only a vector signal, and a Mux
block with only one input is allowed to output only a scalar, vector,
or matrix signal.

Tips

• This diagnostic detects use of Mux blocks to create virtual buses. The
diagnostic considers a signal created by a Mux block to be a virtual bus if
the signal meets either or both of the following conditions:
- A Bus Selector block individually selects one or more of the signal’s
elements (as opposed to the entire signal).

1-312
Diagnostics Pane: Connectivity

- The signal’s components have differing data types, numeric types


(complex or real), dimensionality, storage classes (see the Real-Time
Workshop User’s Guide for information on storage classes), or sampling
modes (see the Signal Processing Blockset™ documentation for
information on frame-based sampling).
• If you are using simplified initialization mode, you must set this diagnostic
to error. For more information, see Underspecified initialization detection.
• You can identify Mux blocks used to create virtual buses using the Model
Advisor check Check for proper bus usage. For more information, see
“Check for proper bus usage”.
• You can avoid strict bus behavior errors and warnings by using
slreplace_mux to remove Mux blocks that violate strict bus behavior from
your model. Before executing the command, you should set this diagnostic
to warning or none.
• See Avoiding Mux/Bus Mixtures for more information.

Dependency
Selecting error enables the following parameter:

• Bus signal treated as vector

Command-Line Information
Parameter: StrictBusMsg
Type: string
Value: 'none' | 'warning' | 'ErrorLevel1' |
'WarnOnBusInputToNonBusBlock' | 'ErrorOnBusInputToNonBusBlock'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-313
1 Configuration Parameters Dialog Box

Application Setting
Efficiency No impact
Safety precaution error

See Also

• Avoiding Mux/Bus Mixtures


• Diagnosing Simulation Errors
• Mux block
• Bus Creator block
• Bus Selector block
• Underspecified initialization detection
• “Check for proper bus usage”
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-314
Diagnostics Pane: Connectivity

Bus signal treated as vector


Select the diagnostic action to take when Simulink software detects a virtual
bus signal that is used as a mux signal.

Settings
Default: warning

none
Disables checking for virtual buses used as muxes.
warning
Simulink software displays a warning if it detects a virtual bus used as
a mux. This option does not enforce strict bus behavior.
error
Simulink software terminates the simulation and displays an error
message when it builds a model that uses any virtual bus as a mux.

Tips

• This diagnostic detects the use of virtual bus signals used to specify muxes.
The diagnostic considers a virtual bus signal to be used as a mux if it is
input to a Demux block or to any block that can input a mux or a vector but
is not formally defined as bus-capable. See Bus-Capable Blocks for details.
• Virtual buses can be used as muxes only when they contain no nested
buses and all constituent signals have the same attributes. This practice
is deprecated as of R2007a (V6.6) and may cease to be supported at some
future time. The MathWorks therefore discourages mixing virtual buses
with muxes in new applications, and encourages upgrading existing
applications to avoid such mixtures.
• If you are using simplified initialization mode, you must set this diagnostic
to error. For more information, see Underspecified initialization detection.
• You can identify bus signals that are treated as a vectors using the Model
Advisor check Check for proper bus usage. For more information, see
“Check for proper bus usage”.
• You can eliminate warnings and errors about virtual buses used as muxes
by using Simulink.BlockDiagram.addBusToVector to insert a Bus to

1-315
1 Configuration Parameters Dialog Box

Vector block into any virtual bus signal that is used as a mux. Before
executing the command, you should set this diagnostic to warning or none.
• See Avoiding Mux/Bus Mixtures for more information.

Dependency
This parameter is enabled only when Mux blocks used to create bus
signals is set to error.

Command-Line Information
Parameter: StrictBusMsg
Type: string
Value: 'none' | 'warning' | 'ErrorLevel1' |
'WarnOnBusTreatedAsVector' | 'ErrorOnBusTreatedAsVector'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Avoiding Mux/Bus Mixtures


• Diagnosing Simulation Errors
• Bus-Capable Blocks
• Demux block
• Bus to Vector block
• Underspecified initialization detection

1-316
Diagnostics Pane: Connectivity

• “Check for proper bus usage”


• Simulink.BlockDiagram.addBusToVector
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-317
1 Configuration Parameters Dialog Box

Invalid function-call connection


Select the diagnostic action to take if Simulink software detects incorrect use
of a function-call subsystem.

Settings
Default: error

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• See the "Function-call systems" examples in the Simulink “Subsystem


Semantics” library for examples of invalid uses of function-call subsystems.
• Setting this parameter to none or warning can lead to invalid simulation
results.
• Setting this parameter to none or warning may cause Simulink software to
insert extra delay operations.

Command-Line Information
Parameter: InvalidFcnCallConnMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact

1-318
Diagnostics Pane: Connectivity

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors


• Subsystem Semantics library
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-319
1 Configuration Parameters Dialog Box

Context-dependent inputs
Select the diagnostic action to take when Simulink software has to compute
any of a function-call subsystem’s inputs directly or indirectly during
execution of a call to a function-call subsystem.

Settings
Default: Use local settings

Use local settings


Issues a warning only if the corresponding diagnostic is selected on the
function-call subsystem’s parameters dialog box (see the documentation
for the Subsystem block’s parameter dialog box for more information).
Enable all
Enables this diagnostic for all function-call subsystems in this model.
Disable all
Disables this diagnostic for all function-call subsystems in this model.

Tips

• This situation occurs when executing a function-call subsystem can change


its inputs.
• See the "Function-call systems" examples in the Simulink "Subsystem
Semantics" library for examples of such function-call subsystems).

Command-Line Information
Parameter: FcnCallInpInsideContextMsg
Type: string
Value: 'Use local settings' | 'Enable All' | 'Disable All'
Default: 'Use local settings'

Recommended Settings

Application Setting
Debugging No impact

1-320
Diagnostics Pane: Connectivity

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution Enable all

See Also

• Subsystem Semantics library


• Subsystem block
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Connectivity

1-321
1 Configuration Parameters Dialog Box

Diagnostics Pane: Compatibility

In this section...
“Compatibility Diagnostics Overview” on page 1-323
“S-function upgrades needed” on page 1-324

1-322
Diagnostics Pane: Compatibility

Compatibility Diagnostics Overview


Specify the diagnostic actions that Simulink software should take when it
detects an incompatibility between the current version of Simulink software
and the model.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also
• Diagnosing Simulation Errors
• Solver Diagnostics
• Sample Time Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Compatibility

1-323
1 Configuration Parameters Dialog Box

S-function upgrades needed


Select the diagnostic action to take if Simulink software encounters a block
that has not been upgraded to use features of the current release.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Command-Line Information
Parameter: SfunCompatibilityCheckMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Diagnosing Simulation Errors

1-324
Diagnostics Pane: Compatibility

• Configuration Parameters Dialog Box


• Diagnostics Pane: Compatibility

1-325
1 Configuration Parameters Dialog Box

Diagnostics Pane: Model Referencing

In this section...
“Model Referencing Diagnostics Overview” on page 1-327
“Model block version mismatch” on page 1-328
“Port and parameter mismatch” on page 1-330
“Model configuration mismatch” on page 1-332
“Invalid root Inport/Outport block connection” on page 1-334
“Unsupported data logging” on page 1-338

1-326
Diagnostics Pane: Model Referencing

Model Referencing Diagnostics Overview


Specify the diagnostic actions that Simulink software should take when it
detects an incompatibility relating to a model reference hierarchy.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also
• Referencing Models
• Diagnosing Simulation Errors
• Solver Diagnostics
• Sample Time Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Saving Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-327
1 Configuration Parameters Dialog Box

Model block version mismatch


Select the diagnostic action to take when loading or updating this model if
Simulink software detects a mismatch between the version of the model used
to create or refresh a Model block in this model and the referenced model’s
current version.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning and refreshes the Model block.
error
Simulink software displays an error message and does not refresh
Model block.

Tip
If you have enabled display of referenced model version numbers on Model
blocks for this model (see Displaying Referenced Model Version Numbers),
Simulink software displays a version mismatch on the Model block icon, for
example: Rev:1.0 != 1.2.

Command-Line Information
Parameter: ModelReferenceVersionMismatchMessage
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-328
Diagnostics Pane: Model Referencing

Application Setting
Efficiency No impact
Safety precaution none

See Also

• Referencing Models
• Diagnosing Simulation Errors
• Displaying Referenced Model Version Numbers
• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-329
1 Configuration Parameters Dialog Box

Port and parameter mismatch


Select the diagnostic action to take if Simulink software detects a port or
parameter mismatch during model loading or updating.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning and refreshes the Model block.
error
Simulink software displays an error message and does not refresh the
Model block.

Tips

• Port mismatches occur when there is a mismatch between the I/O ports of a
Model block and the root-level I/O ports of the model it references.
• Parameter mismatches occur when there is a mismatch between the
parameter arguments recognized by the Model block and the parameter
arguments declared by the referenced model.
• Model block icons can display a message indicating port or parameter
mismatches. To enable this feature, select Block displays > Model Block
I/O Mismatch from the parent model’s Format menu.

Command-Line Information
Parameter: ModelReferenceIOMismatchMessage
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

1-330
Diagnostics Pane: Model Referencing

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Referencing Models
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-331
1 Configuration Parameters Dialog Box

Model configuration mismatch


Select the diagnostic action to take if the configuration parameters of a model
referenced by this model do not match this model’s configuration parameters
or are inappropriate for a referenced model.

Settings
Default: none

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tip
Set this diagnostic to warning or error if you suspect that an inappropriate
or mismatched configuration parameter may be causing your model to give
the wrong result.

Command-Line Information
Parameter: ModelReferenceCSMismatchMessage
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-332
Diagnostics Pane: Model Referencing

Application Setting
Efficiency No impact
Safety precaution warning

See Also

• Referencing Models
• Configuration Parameter Requirements
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-333
1 Configuration Parameters Dialog Box

Invalid root Inport/Outport block connection


Select the diagnostic action to take if Simulink software detects invalid
internal connections to this model’s root-level Output port blocks.

Settings
Default: none

none
Simulink software silently inserts hidden blocks to satisfy the
constraints wherever possible.
warning
Simulink software warns you that a connection constraint has been
violated and attempts to satisfy the constraint by inserting hidden
blocks.
error
Simulink software terminates the simulation or code generation and
displays an error message.

Tips

• In some cases (such as function-call feedback loops), automatically inserted


hidden blocks may introduce delays and thus may change simulation
results.
• Auto-inserting hidden blocks to eliminate root I/O problems stops at
subsystem boundaries. Therefore, you may need to manually modify
models with subsystems that violate any of the constraints below.
• The types of invalid internal connections are:
- A root Output port is connected directly or indirectly to more than one
nonvirtual block port:

1-334
Diagnostics Pane: Model Referencing

- A root Output port is connected to a root Inport block, a Ground block, or


a nondata port:

- Two root Outport blocks are connected to the same block port:

- An Outport block is connected to some elements of a block output and


not others:

1-335
1 Configuration Parameters Dialog Box

- An Outport block is connected more than once to the same element:

Command-Line Information
Parameter: ModelReferenceIOMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution error

See Also

• Referencing Models

1-336
Diagnostics Pane: Model Referencing

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-337
1 Configuration Parameters Dialog Box

Unsupported data logging


Select the diagnostic action to take if this model contains To Workspace blocks
or Scope blocks with data logging enabled.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning.
error
Simulink software terminates the simulation and displays an error
message.

Tips

• The default action warns you that Simulink software does not support use
of these blocks to log data from referenced models.
• See Logging Referenced Model Signals for information on how to log signals
from a reference to this model.

Command-Line Information
Parameter: ModelReferenceDataLoggingMessage
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-338
Diagnostics Pane: Model Referencing

Application Setting
Efficiency No impact
Safety precaution error

See Also

• Referencing Models
• Diagnosing Simulation Errors
• Logging Referenced Model Signals
• To Workspace block
• Scope block
• Configuration Parameters Dialog Box
• Diagnostics Pane: Model Referencing

1-339
1 Configuration Parameters Dialog Box

Diagnostics Pane: Saving

In this section...
“Saving Tab Overview” on page 1-341
“Block diagram contains disabled library links” on page 1-342
“Block diagram contains parameterized library links” on page 1-344

1-340
Diagnostics Pane: Saving

Saving Tab Overview


Specify the diagnostic actions that Simulink software takes when saving a
block diagram containing disabled library links or parameterized library links.

Configuration
Set the parameters displayed.

Tips

• The options are typically to do nothing or to display a warning or an error


message.
• A warning does not terminate a simulation, but an error does.

See Also
• Saving a Model
• Model Parameters
• Diagnosing Simulation Errors
• Solver Diagnostics
• Sample Time Diagnostics
• Data Validity Diagnostics
• Type Conversion Diagnostics
• Connectivity Diagnostics
• Compatibility Diagnostics
• Model Referencing Diagnostics
• Configuration Parameters Dialog Box
• Diagnostics Pane: Saving

1-341
1 Configuration Parameters Dialog Box

Block diagram contains disabled library links


Select the diagnostic action to take when saving a model containing disabled
library links.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning and saves the block diagram. The
diagram may not contain the information you had intended.
error
Simulink software displays an error message. The model is not saved.

Tip
Use the Model Advisor Identify disabled library links check to find
disabled library links.

Command-Line Information
Parameter: SaveWithDisabledLinksMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-342
Diagnostics Pane: Saving

See Also

• Disabling Library Links


• Identify disabled library links
• Saving a Model
• Model Parameters
• Configuration Parameters Dialog Box
• Diagnostics Pane: Saving

1-343
1 Configuration Parameters Dialog Box

Block diagram contains parameterized library links


Select the diagnostic action to take when saving a model containing
parameterized library links.

Settings
Default: warning

none
Simulink software takes no action.
warning
Simulink software displays a warning and saves the block diagram. The
diagram may not contain the in formation you had intended.
error
Simulink software displays an error message. The model is not saved.

Tips

• Use the Model Advisor Identify parameterized library links check


to find parameterized library links.

Command-Line Information
Parameter: SaveWithParameterizedLinksMsg
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'none'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-344
Diagnostics Pane: Saving

See Also

• Identify parameterized library links


• Configuration Parameters Dialog Box
• Diagnostics Pane: Saving

1-345
1 Configuration Parameters Dialog Box

Hardware Implementation Pane

In this section...
“Hardware Implementation Overview” on page 1-348
“Device vendor” on page 1-349
“Device type” on page 1-352
“Number of bits: char” on page 1-361
“Number of bits: short” on page 1-363
“Number of bits: int” on page 1-365
“Number of bits: long” on page 1-367
“Number of bits: native word size” on page 1-369
“Byte ordering” on page 1-371
“Signed integer division rounds to” on page 1-373
“Shift right on a signed integer as arithmetic shift” on page 1-376
“None” on page 1-378
“Device vendor” on page 1-380

1-346
Hardware Implementation Pane

In this section...
“Device type” on page 1-382
“Number of bits: char” on page 1-391
“Number of bits: short” on page 1-393
“Number of bits: int” on page 1-395
“Number of bits: long” on page 1-397
“Number of bits: native word size” on page 1-399
“Byte ordering” on page 1-401
“Signed integer division rounds to” on page 1-403
“Shift right on a signed integer as arithmetic shift” on page 1-406

1-347
1 Configuration Parameters Dialog Box

Hardware Implementation Overview


Describe the hardware characteristics for the modelled system, including how
to set up embedded and emulation hardware settings for both simulation
and code generation.

Note Hardware Implementation pane options do not control hardware or


compiler behavior: their purpose is to solely describe hardware and compiler
properties to MATLAB software, which uses the information to generate
code that is correct for the platform, runs as efficiently as possible, and gives
bit-true agreement for the results of integer and fixed-point operations in
simulation, production code, and test code.

Configuration

1 Choose the Device type in the Embedded hardware subpane.

2 Set the parameters displayed for the selected device type.

3 Apply the changes.

4 Repeat as needed for Emulation hardware.

Tips

• This pane applies to models of computer-based systems, such as embedded


controllers.
• Specifying hardware characteristics enables simulation of the model to
detect error conditions that could arise when executing code, such as
hardware overflow.

See Also

• Configuring Hardware Properties


• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-348
Hardware Implementation Pane

Device vendor
Select the manufacturer of the hardware you will use to implement the
production version of the system represented by this model.

Settings
Default: Generic

• AMD
• ARM Compatible
• ASIC/FPGA
• Analog Devices
• Atmel
• Freescale
• Infineon
• Intel
• Microchip
• NEC
• Renesas
• SGI
• STMicroelectronics
• Texas Instruments
• Generic

Tips

• Select the device vendor before you specify the hardware device used to
define your system’s constraints.
• If your test hardware does not match any of the listed vendors, select
Generic.

1-349
1 Configuration Parameters Dialog Box

• The Device vendor and Device type fields both share the same command
line parameter: ProdHWDeviceType. When specifying this parameter from
the command line, separate the device vendor and device type values using
the characters >. For example: 'Intel->8051 Compatible'.
• To add Device vendor and Device type values to the default set that
is displayed on the Hardware Implementation pane, see “Registering
Additional Device Vendor and Device Type Values” in the Real-Time
Workshop documentation.

Dependencies
This parameter determines the options available in the Device type
drop-down menu.

Command-Line Information
Parameter: ProdHWDeviceType
Type: string
Value: any valid value (see tips)
Default: 'Generic->Unspecified (assume 32-bit Generic)'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Device type (production hardware)


• Device vendor (test hardware)
• Hardware Implementation Options

1-350
Hardware Implementation Pane

• Specifying Embedded Hardware Characteristics


• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-351
1 Configuration Parameters Dialog Box

Device type
Select the type of hardware you will use to implement the production version
of the system represented by this model.

Settings
Default: Unspecified (assume 32 bit Generic)

Generic options:

• 16-bit Embedded Processor


• 32-bit Embedded Processor
• 32-bit Real-Time Simulator
• 32-bit x-86 compatible
• 8-bit Embedded Processor
• Custom
• Unspecified (assume 32-bit Generic)

AMD® options:

• K5/K6/Athlon

ARM® Compatible options:

• ARM 7
• ARM 8
• ARM 9

ASIC/FPGA options:

• ASIC/FPGA

Analog Devices™ options:

• Blackfin

1-352
Hardware Implementation Pane

• SHARC
• TigerSHARC

Atmel® options:

• AVR

Freescale™ options:

• 32-bit PowerPC
• 68332
• 68HC08
• 68HC11
• ColdFire
• DSP563xx (16-bit mode)
• HC(S)12
• MPC5500

Infineon® options:

• C16x, XC16x
• TriCore

Intel® options:

• 8051 Compatible
• x86/Pentium

Microchip:

• PIC18
• dsPIC

NEC® options:

1-353
1 Configuration Parameters Dialog Box

• V850

Renesas® options:

• M16C
• M32C
• R8C/Tiny
• SH-2/3/4

SGI:

• UltraSPARC IIi

STMicroelectronics:

• ST10/Super10

Texas Instruments™ options:

• C2000
• C5000
• C6000
• MSP430

Tips

• Select the device vendor before you specify the hardware device type.
• Selecting a device type specifies the hardware device to define your
system’s constraints:
- Default hardware properties appear as the initial values.
- Parameters with only one possible value cannot be changed.
- Parameters with more than one possible value provide a pulldown list
of legal values.
- Static values for each device type are displayed in the following table.

1-354
Hardware Implementation Pane

- Parameters that you can modify are identified with an x.

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
Generic
Unspecified (assume 8 16 32 32 32 Un- x Set
32-bit Generic) specified
(default)
Custom x x x x x x x x
16-bit Embedded 8 16 16 32 16 x x Set
Processor
32-bit Embedded 8 16 32 32 32 x x Set
Processor
32-bit Real Time 8 16 32 32 32 x x Set
Simulator
32-bit x86 compatible 8 16 32 32 32 Little Zero Set
Endian
8-bit Embedded 8 16 16 32 8 x x Set
Processor
AMD
K5/K6/Athlon 8 16 32 32 32 Little x Set
Endian
ARM Compatible
ARM 7/8/9 8 16 32 32 x x x x
ASIC/FPGA
ASIC/FPGA NA NA NA NA NA NA NA NA
Analog Devices

1-355
1 Configuration Parameters Dialog Box

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
Blackfin 8 16 32 32 32 Little Zero Set
Endian
SHARC 32 32 32 32 32 Big Zero Set
Endian
TigerSHARC 32 32 32 32 32 Little Zero Set
Endian
Atmel
AVR 8 16 16 32 8 Little Zero Set
Endian
Freescale
32-bit PowerPC 8 16 32 32 32 Big Zero Set
Endian
68332 8 16 32 32 32 Big x Set
Endian
68HC08 8 16 16 32 8 Big x Set
Endian
68HC11 8 16 16 32 8 Big x Set
Endian
ColdFire 8 16 32 32 32 Big Zero Set
Endian
DSP563xx (16-bit 8 16 16 32 16 x x Set
mode)
HC(S)12 8 16 16 32 16 Big x Set
Endian
MPC5500 8 16 32 32 32 x Zero Set

1-356
Hardware Implementation Pane

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
Infineon
C16x, XC16x 8 16 16 32 16 Little Zero Set
Endian
TriCore 8 16 32 32 32 Little x Set
Endian
Intel
8051 Compatible 8 16 16 32 8 x x Clear
xPC/Pentium 8 16 32 32 32 Little x Set
Endian
Microchip
PIC18 8 16 16 32 8 Little Zero Set
Endian
dsPIC 8 16 16 32 16 Little Zero Set
Endian
NEC
V850 8 16 32 32 32 x x x
Renesas
M16C 8 16 16 32 16 Little x x
Endian
M32C 8 16 x 32 x Little x x
Endian
R8C/Tiny 8 16 16 32 16 Little x x
Endian
SH-2/3/4 8 16 32 32 32 x x x

1-357
1 Configuration Parameters Dialog Box

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
SGI
UltraSPARC IIi 8 16 32 32 32 Big x Set
Endian
STMicroelectronics
ST10/Super10 8 16 16 32 16 Little Zero Set
Endian
Texas Instruments
C2000 16 16 16 32 16 x Zero Set
C5000 16 16 16 32 16 Big Zero Set
Endian
C6000 8 16 32 40 32 x Zero Set

• If your production hardware does not match any of the listed types, select
Unspecified (assume 32-bit Generic) if it has the characteristics of a
generic 32-bit microprocessor; otherwise select Custom.
• The Device vendor and Device type fields both share the same command
line parameter: ProdHWDeviceType. When specifying this parameter from
the command line, separate the device vendor and device type values using
the characters >. For example: 'Intel->8051 Compatible'.
• To add Device vendor and Device type values to the default set that
is displayed on the Hardware Implementation pane, see “Registering
Additional Device Vendor and Device Type Values” in the Real-Time
Workshop documentation.

1-358
Hardware Implementation Pane

Dependencies
The options available in the drop-down menu are determined by the Device
vendor parameter.

Selecting ASIC/FPGA enables the Emulation hardware (code generation


only) subpane.

For all other device types, this parameter sets:

• char
• short
• int
• long
• native word size
• Byte ordering
• Signed integer division rounds to
• Shift right on a signed integer as arithmetic shift

Command-Line Information
Parameter: ProdHWDeviceType
Type: string
Value: any valid value (see tips)
Default: 'Generic->Unspecified (assume 32-bit Generic)'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-359
1 Configuration Parameters Dialog Box

See Also

• Device vendor (production hardware)


• Device type (test hardware)
• Hardware Implementation Options
• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-360
Hardware Implementation Pane

Number of bits: char


Describe the character bit length for the production hardware.

Settings
Default: 8

Minimum: 8

Maximum: 32

Enter a value between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdBitPerChar
Type: integer
Value: any valid value
Default: 8

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-361
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-362
Hardware Implementation Pane

Number of bits: short


Describe the data bit length for the production hardware.

Settings
Default: 16

Minimum: 8

Maximum: 32

Enter a value between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdBitPerShort
Type: integer
Value: any valid value
Default: 16

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-363
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-364
Hardware Implementation Pane

Number of bits: int


Describe the data integer bit length for the production hardware.

Settings
Default: 32

Minimum: 8

Maximum: 32

Enter a number between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdBitPerInt
Type: integer
Value: any valid value
Default: 32

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-365
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-366
Hardware Implementation Pane

Number of bits: long


Describe the data bit lengths for the production hardware.

Settings
Default: 32

Minimum: 32

Maximum: 64

Enter a value between 32 and 64.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdBitPerLong
Type: integer
Value: any valid value
Default: 32

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-367
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-368
Hardware Implementation Pane

Number of bits: native word size


Describe the microprocessor native word size for the production hardware.

Settings
Default: 32

Minimum: 8

Maximum: 64

Enter a value between 8 and 64.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdWordSize
Type: integer
Value: any valid value
Default: 32

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-369
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-370
Hardware Implementation Pane

Byte ordering
Describe the byte ordering for the production hardware.

Settings
Default: Unspecified

Unspecified
Specifies that the code determines the endianness of the hardware.
This is the least efficient choice.

Big Endian
The most significant byte appears first.
Little Endian
The least significant byte appears first.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: ProdEndianess
Type: string
Value: 'Unspecified' | 'LittleEndian' | 'BigEndian'
Default: 'Unspecified'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-371
1 Configuration Parameters Dialog Box

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-372
Hardware Implementation Pane

Signed integer division rounds to


Describe how to produce a signed integer quotient for the production
hardware.

Settings
Default: Undefined

Undefined
Choose this option if neither Zero nor Floor describes the compiler’s
behavior, or if that behavior is unknown.

Zero
If the quotient is between two integers, the compiler chooses the integer
that is closer to zero as the result.
Floor
If the quotient is between two integers, the compiler chooses the integer
that is closer to negative infinity.

Tips

• Use the Integer rounding mode parameter on your model’s blocks to


simulate the rounding behavior of the C compiler that you use to compile
code generated from the model. This setting appears on the Signal
Attributes pane of the parameter dialog boxes of blocks that can perform
signed integer arithmetic, such as the Product block.
• For most blocks, the value of Integer rounding mode completely defines
rounding behavior. For blocks that support fixed-point data and the
Simplest rounding mode, the value of Signed integer division rounds
to also affects rounding. For details, see “Rounding” in the Simulink Fixed
Point User’s Guide.
• See Hardware Implementation Options in the Real-Time Workshop
documentation for information on how this option affects code generation.
• The following table illustrates the compiler behavior described by the
options for this parameter.

1-373
1 Configuration Parameters Dialog Box

Ideal
N D N/D Zero Floor Undefined
33 4 8.25 8 8 8
-33 4 -8.25 -8 -9 -8 or -9
33 -4 -8.25 -8 -9 -8 or -9
-33 -4 8.25 8 8 8 or 9

Dependency
This parameter is enabled by Device type.

Command-Line Information
Parameter: ProdIntDivRoundTo
Type: string
Value: 'Floor' | 'Zero' | 'Undefined'
Default: 'Undefined'

Recommended settings

Application Setting
Debugging No impact for simulation and during
development.
Undefined for production code generation.
Traceability No impact for simulation and during
development.
Zero or Floor for production code
generation.
Efficiency No impact for simulation and during
development.
Zero for production code generation.
Safety precaution No impact for simulation and during
development.
Floor for production code generation.

1-374
Hardware Implementation Pane

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-375
1 Configuration Parameters Dialog Box

Shift right on a signed integer as arithmetic shift


Describe how your compiler rounds the result of two signed integers for the
production hardware.

Settings
Default: On

On
Generates simple efficient code whenever the Simulink model performs
arithmetic shifts on signed integers.

Off
Generates fully portable but less efficient code to implement right
arithmetic shifts.

Tips

• Select this parameter if the C compiler implements a signed integer right


shift as an arithmetic right shift.
• An arithmetic right shift fills bits vacated by the right shift with the value
of the most significant bit, which indicates the sign of the number in twos
complement notation.

Dependency
This parameter is enabled by Device type.

Command-Line Information
Parameter: ProdShiftRightIntArith
Type: string
Value: 'on' | 'off'
Default: 'on'

1-376
Hardware Implementation Pane

Recommended settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

See Also

• Hardware Implementation Options


• Specifying Embedded Hardware Characteristics
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-377
1 Configuration Parameters Dialog Box

None
Specify whether the test hardware differs from the deployment hardware.

Settings
Default: On

On
Specifies that the hardware used to test the code generated from
the model is the same as the production hardware, or has the same
characteristics.
Off
Specifies that the hardware used to test the code generated from the
model has different characteristics than the production hardware.

Tips

• You can generate code that runs on the test hardware but behaves as if it
had been generated for and executed on the deployment hardware.
• The Embedded hardware (simulation and code generation) subpane
specifies the deployment hardware properties. The Emulation hardware
(code generation only) subpane is used to specify the test hardware
properties.

Dependency
Enables the Emulation hardware subpane.

Command-Line Information
Parameter: ProdEqTarget
Type: string
Value: 'on' | 'off'
Default: 'on'

1-378
Hardware Implementation Pane

Recommended settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

More information

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-379
1 Configuration Parameters Dialog Box

Device vendor
Select the manufacturer of the hardware that will be used to test the code
generated from the model.

Settings
Default: Generic

• AMD
• ARM Compatible
• ASIC/FPGA
• Analog Devices
• Atmel
• Freescale
• Infineon
• Intel
• Microchip
• NEC
• Renesas
• SGI
• STMicroelectronics
• Texas Instruments
• Generic

Tips

• Select the device vendor before you specify the hardware device used to
define your system’s constraints.
• If your test hardware does not match any of the listed vendors, select
Generic.

1-380
Hardware Implementation Pane

• The Device vendor and Device type fields both share the same command
line parameter: TargetHWDeviceType. When specifying this parameter
from the command line, separate the device vendor and device type values
using the characters >. For example: 'Intel->8051 Compatible'.

Dependencies
This parameter determines the options available in the Device type
drop-down menu.

Command-Line Information
Parameter: TargetHWDeviceType
Type: string
Value: any valid value (see tips)
Default: 'Generic->Unspecified (assume 32-bit Generic)'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Device type (test hardware)


• Specifying Emulation Hardware Characteristics
• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-381
1 Configuration Parameters Dialog Box

Device type
Select the type of hardware that will be used to test the code generated from
the model.

Settings
Default: Unspecified (assume 32 bit Generic)

Generic options:

• 16-bit Embedded Processor


• 32-bit Embedded Processor
• 32-bit Real-Time Simulator
• 32-bit x-86 compatible
• 8-bit Embedded Processor
• Custom
• MATLAB Host Computer
• Unspecified (assume 32-bit Generic)

AMD options:

• K5/K6/Athlon

ARM Compatible options:

• ARM 7
• ARM 8
• ARM 9

Analog Devices options:

• Blackfin
• SHARC
• TigerSHARC

1-382
Hardware Implementation Pane

Atmel options:

• AVR

Freescale options:

• 32-bit PowerPC
• 68332
• 68HC08
• 68HC11
• ColdFire
• DSP563xx (16-bit mode)
• HC(S)12
• MPC5500

Infineon options:

• C16x, XC16x
• TriCore

Intel options:

• 8051 Compatible
• x86/Pentium

Microchip:

• PIC18
• dsPIC

NEC options:

• V850

Renesas options:

1-383
1 Configuration Parameters Dialog Box

• M16C
• R8C/Tiny
• SH-2/3/4

SGI:

• UltraSPARC IIi

STMicroelectronics:

• ST10/Super10

Texas Instruments options:

• C2000
• C5000
• C6000
• MSP430

Tips

• Select the device vendor before you specify the hardware device type.
• Selecting a device type specifies the hardware device to define your
system’s constraints:
- Default hardware properties appear as the initial values.
- Parameters with only one possible value cannot be changed.
- Parameters with more than one possible value provide a pulldown list
of legal values.
- Static values for each device type are displayed in the following table.
Parameters that you can modify are identified with an x.

1-384
Hardware Implementation Pane

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
Generic
Unspecified (assume 8 16 32 32 32 Un- x Set
32-bit Generic) specified
(default)
Custom x x x x x x x x
16-bit Embedded 8 16 16 32 16 x x Set
Processor
32-bit Embedded 8 16 32 32 32 x x Set
Processor
32-bit Real Time 8 16 32 32 32 x x Set
Simulator
32-bit x86 compatible 8 16 32 32 32 Little Zero Set
Endian
8-bit Embedded 8 16 16 32 8 x x Set
Processor
MATLAB Host Computer 8 16 32 Host Host Little x Set
specific specific Endian
value value
(32 or (32 or
64) 64)
AMD
K5/K6/Athlon 8 16 32 32 32 Little x Set
Endian
ARM Compatible
ARM 7/8/9 8 16 32 32 x x x x

1-385
1 Configuration Parameters Dialog Box

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
ASIC/FPGA
ASIC/FPGA NA NA NA NA NA NA NA NA
Analog Devices
Blackfin 8 16 32 32 32 Little Zero Set
Endian
SHARC 32 32 32 32 32 Big Zero Set
Endian
TigerSHARC 32 32 32 32 32 Little Zero Set
Endian
Atmel
AVR 8 16 16 32 8 Little Zero Set
Endian
Freescale
32-bit PowerPC 8 16 32 32 32 Big Zero Set
Endian
68332 8 16 32 32 32 Big x Set
Endian
68HC08 8 16 16 32 8 Big x Set
Endian
68HC11 8 16 16 32 8 Big x Set
Endian
ColdFire 8 16 32 32 32 Big Zero Set
Endian
DSP563xx (16-bit 8 16 16 32 16 x x Set
mode)

1-386
Hardware Implementation Pane

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
HC(S)12 8 16 16 32 16 Big x Set
Endian
MPC5500 8 16 32 32 32 x Zero Set
Infineon
C16x, XC16x 8 16 16 32 16 Little Zero Set
Endian
TriCore 8 16 32 32 32 Little x Set
Endian
Intel
8051 Compatible 8 16 16 32 8 x x Clear
xPC/Pentium 8 16 32 32 32 Little x Set
Endian
Microchip
PIC18 8 16 16 32 8 Little Zero Set
Endian
dsPIC 8 16 16 32 16 Little Zero Set
Endian
NEC
V850 8 16 32 32 32 x x x
Renesas
M16C 8 16 16 32 16 Little x x
Endian
M32C 8 16 x 32 x Little x x
Endian

1-387
1 Configuration Parameters Dialog Box

Key: Word size = native word size


Rounds to = Signed integer division rounds to
Shift right = Shift right on a signed integer as arithmetic shift
Device vendor / Device Number of bits Byte Rounds Shift
type ordering to right
char short int long Word
size
R8C/Tiny 8 16 16 32 16 Little x x
Endian
SH-2/3/4 8 16 32 32 32 x x x
SGI
UltraSPARC IIi 8 16 32 32 32 Big x Set
Endian
STMicroelectronics
ST10/Super10 8 16 16 32 16 Little Zero Set
Endian
Texas Instruments
C2000 16 16 16 32 16 x Zero Set
C5000 16 16 16 32 16 Big Zero Set
Endian
C6000 8 16 32 40 32 x Zero Set

• If your test hardware does not match any of the listed types, select
Unspecified (assume 32-bit Generic) if it has the characteristics of a
generic 32-bit microprocessor; otherwise select Custom.
• The Device vendor and Device type fields both share the same command
line parameter: TargetHWDeviceType. When specifying this parameter
from the command line, separate the device vendor and device type values
using the characters >. For example: 'Intel->8051 Compatible'.

Dependencies
The options available in the drop-down menu are determined by the Device
vendor parameter.

1-388
Hardware Implementation Pane

This parameter sets:

• char
• short
• int
• long
• native word size
• Byte ordering
• Signed integer division rounds to
• Shift right on a signed integer as arithmetic shift

Command-Line Information
Parameter: TargetHWDeviceType
Type: string
Value: any valid value (see tips)
Default: 'Generic->Unspecified (assume 32-bit Generic)'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Device vendor (test hardware)


• Specifying Emulation Hardware Characteristics
• Hardware Implementation Options

1-389
1 Configuration Parameters Dialog Box

• Configuration Parameters Dialog Box


• Hardware Implementation Pane

1-390
Hardware Implementation Pane

Number of bits: char


Describe the character bit length for the hardware used to test code.

Settings
Default: 8

Minimum: 8

Maximum: 32

Enter a value between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetBitPerChar
Type: integer
Value: any valid value
Default: 8

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-391
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-392
Hardware Implementation Pane

Number of bits: short


Describe the data bit length for the hardware used to test code.

Settings
Default: 16

Minimum: 8

Maximum: 32

Enter a value between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetBitPerShort
Type: integer
Value: any valid value
Default: 16

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-393
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-394
Hardware Implementation Pane

Number of bits: int


Describe the data integer bit length of the hardware used to test code.

Settings
Default: 32

Minimum: 8

Maximum: 32

Enter a number between 8 and 32.

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetBitPerInt
Type: integer
Value: any valid value
Default: 32

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-395
1 Configuration Parameters Dialog Box

Application Setting
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-396
Hardware Implementation Pane

Number of bits: long


Describe the data bit lengths for the hardware used to test code.

Settings
Default: 32

Minimum: 32

Maximum: 64

Enter a value between 32 and 64. (The value 64 is selected by default


if you run MATLAB software on a 64-bit host computer and select the
MATLAB host as the test hardware — that is, TargetHWDeviceType equals
'Generic->MATLAB Host Computer'.)

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetBitPerLong
Type: integer
Value: any valid value
Default: 32

Recommended Settings

Application Setting
Debugging No impact

1-397
1 Configuration Parameters Dialog Box

Application Setting
Traceability No impact
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-398
Hardware Implementation Pane

Number of bits: native word size


Describe the microprocessor native word size for the hardware used to test
code.

Settings
Default: 32

Minimum: 8

Maximum: 64

Enter a value between 8 and 64. (The value 64 is selected by default if you run
MATLAB software on a 64-bit host computer and select the MATLAB host as
the test hardware — that is, TargetHWDeviceType equals 'Generic->MATLAB
Host Computer'.)

Tip
All values must be a multiple of 8.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetWordSize
Type: integer
Value: any valid value
Default: 32

1-399
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency Target specific
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-400
Hardware Implementation Pane

Byte ordering
Describe the byte ordering for the hardware used to test code.

Settings
Default: Unspecified

Unspecified
Specifies that the code determines the endianness of the hardware.
This is the least efficient choice.

Big Endian
The most significant byte comes first.
Little Endian
The least significant byte comes first.

Note For guidelines to observe when configuring Embedded hardware


controls for code generation, see Hardware Implementation Options in the
Real-Time Workshop documentation.

Dependencies

• This parameter is enabled by Device type.


• Simulink software disables this control if it knows the data type lengths
for the selected device type.

Command-Line Information
Parameter: TargetEndianess
Type: string
Value: 'Unspecified' | 'LittleEndian' | 'BigEndian'
Default: 'Unspecified'

1-401
1 Configuration Parameters Dialog Box

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact for simulation and during
development.
Match operation of compiler and hardware
for code generation.

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-402
Hardware Implementation Pane

Signed integer division rounds to


Describe how to produce a signed integer quotient for the hardware used
to test code.

Settings
Default: Undefined

Undefined
Choose this option if neither Zero nor Floor describes the compiler’s
behavior, or if that behavior is unknown.

Zero
If the quotient is between two integers, the compiler chooses the integer
that is closer to zero as the result.
Floor
If the quotient is between two integers, the compiler chooses the integer
that is closer to negative infinity.

Tips

• Use the Integer rounding mode parameter on your model’s blocks to


simulate the rounding behavior of the C compiler that you use to compile
code generated from the model. This setting appears on the Signal
Attributes pane of the parameter dialog boxes of blocks that can perform
signed integer arithmetic, such as the Product block.
• For most blocks, the value of Integer rounding mode completely defines
rounding behavior. For blocks that support fixed-point data and the
Simplest rounding mode, the value of Signed integer division rounds
to also affects rounding. For details, see “Rounding” in the Simulink Fixed
Point User’s Guide.
• See Hardware Implementation Options in the Real-Time Workshop
documentation for information on how this option affects code generation.
• The following table illustrates the compiler behavior described by the
options for this parameter.

1-403
1 Configuration Parameters Dialog Box

Ideal
N D N/D Zero Floor Undefined
33 4 8.25 8 8 8
-33 4 -8.25 -8 -9 -8 or -9
33 -4 -8.25 -8 -9 -8 or -9
-33 -4 8.25 8 8 8 or 9

Dependency
This parameter is enabled by Device type.

Command-Line Information
Parameter: TargetIntDivRoundTo
Type: string
Value: 'Floor' | 'Zero' | 'Undefined'
Default: 'Undefined'

Recommended settings

Application Setting
Debugging No impact for simulation and during
development.
Undefined for production code generation.
Traceability No impact for simulation and during
development.
Zero or Floor for production code
generation.
Efficiency No impact for simulation and during
development.
Zero for production code generation.
Safety precaution No impact for simulation and during
development.
Floor for production code generation.

1-404
Hardware Implementation Pane

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-405
1 Configuration Parameters Dialog Box

Shift right on a signed integer as arithmetic shift


Describe how your compiler rounds the result of two signed integers for the
hardware used to test code.

Settings
Default: On

On
Generates simple efficient code whenever the Simulink model performs
arithmetic shifts on signed integers.

Off
Generates fully portable but less efficient code to implement right
arithmetic shifts.

Tips

• Select this parameter if your C compiler implements a signed integer right


shift as an arithmetic right shift.
• An arithmetic right shift fills bits vacated by the right shift with the value
of the most significant bit, which indicates the sign of the number in twos
complement notation. It is equivalent to dividing the number by 2.
• This setting affects only code generation

Dependency
This parameter is enabled by Device type.

Command-Line Information
Parameter: TargetShiftRightIntArith
Type: string
Value: 'on' | 'off'
Default: 'on'

1-406
Hardware Implementation Pane

Recommended settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

See Also

• Specifying Emulation Hardware Characteristics


• Hardware Implementation Options
• Configuration Parameters Dialog Box
• Hardware Implementation Pane

1-407
1 Configuration Parameters Dialog Box

Model Referencing Pane

In this section...
“Model Referencing Pane Overview” on page 1-410
“Rebuild options” on page 1-411
“Never rebuild targets diagnostic” on page 1-414
“Total number of instances allowed per top model” on page 1-416

1-408
Model Referencing Pane

In this section...
“Model dependencies” on page 1-418
“Pass scalar root inputs by value for Real-Time Workshop” on page 1-420
“Minimize algebraic loop occurrences” on page 1-422

1-409
1 Configuration Parameters Dialog Box

Model Referencing Pane Overview


Specify the options for including other models in this model, this model in
other models, and for building simulation and code generation targets.

Configuration
Set the parameters displayed.

Tips

• The Model Referencing pane allows you to specify options for:


- Including other models in this model.
- Including the current model in other models.
• The option descriptions use the term this model to refer to the model that
you are configuring and the term referenced model to designate models
referenced by this model.

See Also

• Model Dependencies
• Configuration Parameters Dialog Box
• Model Referencing Pane

1-410
Model Referencing Pane

Rebuild options
Select whether to rebuild simulation and Real-Time Workshop targets for
referenced models before updating, simulating, or generating code from this
model.

Settings
Default: If any changes detected

If any changes detected


Rebuilds the target for a referenced model if Simulink software detects
any changes of any kind in the target’s dependencies. This option
also checks for changes in the compiled form of the referenced model.
Checking the compiled model can detect some changes that occur even
in dependencies that you do not specify.
Always
Rebuilds all targets referenced by this model before simulating,
updating, or generating code from it.
If any changes in known dependencies detected
Rebuilds a target if Simulink software detects any changes in known
target dependencies (see below) since the target was last built. This
option ignores cosmetic changes, such as annotation changes, in the
referenced model and in any block library dependencies, thus preventing
unnecessary rebuilds.
Never
Never rebuild targets before simulating or generating code from this
model. If you are certain that your targets are up-to-date, you can use
this option to avoid time-consuming target dependency checking when
simulating, updating, or generating code from a model.

Tips

• Simulink software detects target dependencies in:


- The referenced model’s model file
- Block library files used by the referenced model
- Targets of models referenced by the referenced model

1-411
1 Configuration Parameters Dialog Box

- S-functions and associated TLC files used by the referenced model


- User-specified dependencies (see Model Dependencies)
- Workspace variables used by the referenced model
• It is a good idea to use the Always option before deployment of a model to
assure that all the model reference targets are up-to-date.
• Before selecting If any changes in known dependencies detected, you
should be certain that you have specified every user-created dependency
(e.g., M-files or MAT-files) for this model to ensure that all targets that need
to be rebuilt are rebuilt. Otherwise, invalid simulation results may occur.
• The If any changes in known dependencies detected option cannot
detect changes in unspecified dependencies, such as M-files used to
initialize block masks. If you suspect that a model has such unknown
dependencies, you can still guarantee valid simulation by selecting the
Always or the If any changes detected option.
• Use the Never option with caution because it may lead to invalid results if
referenced model targets are not in fact up-to-date.

Dependency
Selecting Never enables the Never rebuild targets diagnostic parameter.

Command-Line Information
Parameter: UpdateModelReferenceTargets
Type: string
Value: 'IfOutOfDate' | 'Force' | 'AssumeUpToDate' |
'IfOutOfDateOrStructuralChange'
Default: 'IfOutOfDateOrStructuralChange'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-412
Model Referencing Pane

Application Setting
Efficiency No impact
Safety precaution Never or If any changes detected

See Also

• Model Dependencies
• Configuration Parameters Dialog Box
• Model Referencing Pane

1-413
1 Configuration Parameters Dialog Box

Never rebuild targets diagnostic


Select the diagnostic action that Simulink software should take if it detects a
target that needs to be rebuilt.

Settings
Default: Error if targets require rebuild

none
Simulink software takes no action.
Warn if targets require rebuild
Simulink software displays a warning.
Error if targets require rebuild
Simulink software terminates the simulation and displays an error
message.

Tip
Selecting None bypasses dependency checking, and thus enables faster
updating, simulation, and code generation, but can cause models that are not
up-to-date to malfunction or generate incorrect results.

Dependency
This parameter is enabled only if you select Never in the Rebuild options
field.

Command-Line Information
Parameter: CheckModelReferenceTargetMessage
Type: string
Value: 'none' | 'warning' | 'error'
Default: 'error'

Recommended Settings

Application Setting
Debugging No impact

1-414
Model Referencing Pane

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution error if targets require rebuild

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Model Referencing Pane

1-415
1 Configuration Parameters Dialog Box

Total number of instances allowed per top model


Specify how many references to this model can occur in another model.

Settings
Default: Multiple

Zero
The model cannot be referenced. An error occurs if a reference to the
model occurs in another model.
One
The model can be referenced at most once in a model reference
hierarchy. An error occurs if more than one reference exists.
Multiple
The model can be referenced more than once in a hierarchy, provided
that it contains no constructs that preclude multiple reference. An
error occurs if the model cannot be multiply referenced, even if only
one reference exists.

Command-Line Information
Parameter: ModelReferenceNumInstancesAllowed
Type: string
Value: 'Zero' | 'Single' | 'Multi'
Default: 'Multi'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

1-416
Model Referencing Pane

See Also

• Diagnosing Simulation Errors


• Configuration Parameters Dialog Box
• Model Referencing Pane

1-417
1 Configuration Parameters Dialog Box

Model dependencies
Specify the files on which this model relies. They are typically MAT-files and
M-files used to initialize parameters and to provide data.

Settings
No Default

• Specify the dependencies as a cell array of strings, where each cell array
entry is the filename or path of a dependent file. These filenames may
include spaces and must include file extensions (e.g.,.m,.mat, etc.).
• Prefix the token $MDL to a dependency to indicate that the path to the
dependency is relative to the location of this model file.
• Wildcards are allowed. Use a ’%’ to comment out a line; use ’...’ to continue
lines.

Tips

• If Simulink software cannot find a specified dependent file when you


update or simulate a model that references this model, Simulink software
displays a warning.
• The dependencies automatically include the model.mdl and linked library
.mdl files.
• For files not on the MATLAB path, use absolute paths.

Command-Line Information
Parameter: ModelDependencies
Type: string
Value: any valid value
Default: ''

Recommended Settings

Application Setting
Debugging No impact

1-418
Model Referencing Pane

Application Setting
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Model Dependencies
• Configuration Parameters Dialog Box
• Model Referencing Pane

1-419
1 Configuration Parameters Dialog Box

Pass scalar root inputs by value for Real-Time


Workshop
Specify whether a model that calls (references) this model passes this model’s
scalar inputs by value.

Settings
Default: Off (GUI), 'on' (command-line)

On
A model that calls (i.e., references) this model passes this model’s scalar
inputs by value.

Off
The calling model passes the inputs by reference (it passes the addresses
of the inputs rather than the input values).

Tips

• Passing roots by value allows this model to read its scalar inputs from
register or local memory which is faster than reading the inputs from their
original locations.
• However, passing roots by value can lead to incorrect results if the model’s
root scalar inputs can change within a time step. This can happen, for
instance, if this model’s inputs and outputs share memory locations (as a
result of a feedback loop) and the model is invoked multiple times in a time
step (i.e., by a Function-Call Subsystem). In such cases, this model sees
scalar input changes that occur in the same time step only if the inputs are
passed by reference. That is why this option is off by default.
• If you are certain that this model is not referenced in contexts where its
inputs can change within a time step, select this option to generate more
efficient code for this model.
• Selecting this option can affect reuse of code generated for subsystems. See
Reusable Code and Referenced Models for more information.

1-420
Model Referencing Pane

Command-Line Information
Parameter:ModelReferencePassRootInputsByReference
Type: string
Value: 'on' | 'off'
Default: 'on'

Note The command-line values are reverse of the settings values. Therefore,
'on' in the command line corresponds to the description of “Off” in the
settings section, and 'off' in the command line corresponds to the description
of “On” in the settings section.

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution Off

See Also

• Function-Call Subsystem
• Reusable Code and Referenced Models
• Configuration Parameters Dialog Box
• Model Referencing Pane

1-421
1 Configuration Parameters Dialog Box

Minimize algebraic loop occurrences


Specify whether Simulink software tries to eliminate algebraic loops involving
this model from models that reference it.

Settings
Default: Off

On
Simulink software tries to eliminate algebraic loops involving this model
from models that reference it.
Off
Simulink software does not try to eliminate algebraic loops from the
models that reference this model.

Tips

• Enabling this option disables:


- Conditional input branch optimization for simulation
- The Real-Time Workshop software Single update/output function
optimization for code generation
• See Algebraic Loops for more information.

Command-Line Information
Parameter:ModelReferenceMinAlgLoopOccurrences
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-422
Model Referencing Pane

Application Setting
Efficiency No impact
Safety precaution Off

See Also

• Model block
• Algebraic Loops
• Model Blocks and Direct Feedthrough
• Diagnosing Simulation Errors
• Configuration Parameters Dialog Box
• Model Referencing Pane

1-423
1 Configuration Parameters Dialog Box

Simulation Target Pane: General

In this section...
“Simulation Target: General Tab Overview” on page 1-425
“Enable debugging/animation” on page 1-426
“Enable overflow detection (with debugging)” on page 1-428
“Ensure memory integrity” on page 1-430
“Echo expressions without semicolons” on page 1-432
“Use BLAS library for faster simulation” on page 1-434
“Ensure responsiveness” on page 1-436
“Simulation target build mode” on page 1-438

1-424
Simulation Target Pane: General

Simulation Target: General Tab Overview


Configure the simulation target for a model that contains Embedded
MATLAB Function blocks, Stateflow charts, or Truth Table blocks.

Configuration
Set the parameters that appear.

Dependency
If you have a Stateflow license, the title becomes Embedded MATLAB and
Stateflow. This title also appears if you do not have a Stateflow license, but
load a model that contains Stateflow charts or Truth Table blocks. In either
case, the parameters remain the same.

See Also

• Speeding Up Simulation
• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-425
1 Configuration Parameters Dialog Box

Enable debugging/animation
Enable debugging and animation during simulation of a model that contains
Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.

Settings
Default: On

On
Enables debugging and animation of a model during simulation.

This action also enables the Stateflow Debugger.

Off
Disables debugging and animation of a model during simulation.

This action also disables the Stateflow Debugger.

Tip

• If you disable debugging and animation, faster model simulation occurs.

Command-Line Information
Parameter: SFSimEnableDebug
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging On
Traceability No impact
Efficiency Off
Safety precaution On

1-426
Simulation Target Pane: General

See Also

• Speeding Up Simulation
• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-427
1 Configuration Parameters Dialog Box

Enable overflow detection (with debugging)


Enable overflow detection of data during simulation of a model that contains
Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.
Overflow occurs for data when a value assigned to it exceeds the numeric
capacity of the data type.

Settings
Default: On

On
Enables overflow detection of data during simulation.

You must also select the Data Range check box in the Stateflow
Debugger window.

Off
Disables overflow detection of data during simulation.

Tips

• If your model contains fixed-point data, enable overflow detection.


• If you disable overflow detection, faster model simulation occurs.

Command-Line Information
Parameter: SFSimOverflowDetection
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging On
Traceability No impact

1-428
Simulation Target Pane: General

Application Setting
Efficiency Off
Safety precaution On

See Also

• Speeding Up Simulation
• Overflow Detection for Fixed-Point Types
• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-429
1 Configuration Parameters Dialog Box

Ensure memory integrity


Detects violations of memory integrity in code generated for Embedded
MATLAB function blocks and stops execution with a diagnostic.

Settings
Default: On

On
Detect violations of memory integrity in code generated for Embedded
MATLAB function blocks and stops execution with a diagnostic message.

Off
Does not detect violations of memory integrity in code generated for
Embedded MATLAB function blocks.

Caution Without these checks, violations will result in unpredictable


behavior.

Tips

• The most likely cause of memory integrity issues is accessing an array


out of bounds.
• Only disable these checks if you are sure that your code is safe and that all
array bounds and dimension checking is unnecessary.

Command-Line Information
Parameter: SimIntegrity
Type: string
Value: 'on' | 'off'
Default: 'on'

1-430
Simulation Target Pane: General

Recommended Settings

Application Setting
Debugging On
Traceability On
Efficiency Off
Safety precaution On

See Also

• “Controlling Runtime Checks” in the Simulink User’s Guide.


• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-431
1 Configuration Parameters Dialog Box

Echo expressions without semicolons


Enable run-time output in the MATLAB Command Window, such as actions
that do not terminate with a semicolon. This behavior applies to a model that
contains Embedded MATLAB Function blocks, Stateflow charts, or Truth
Table blocks.

Settings
Default: On

On
Enables run-time output to appear in the MATLAB Command Window
during simulation.

Off
Disables run-time output from appearing in the MATLAB Command
Window during simulation.

Tip

• If you disable run-time output, faster model simulation occurs.

Command-Line Information
Parameter: SFSimEcho
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging On
Traceability No impact
Efficiency Off
Safety precaution No impact

1-432
Simulation Target Pane: General

See Also

• Speeding Up Simulation
• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-433
1 Configuration Parameters Dialog Box

Use BLAS library for faster simulation


Enable Embedded MATLAB Function blocks in Simulink models and
Embedded MATLAB functions in Stateflow charts to speed up low-level
matrix operations during simulation.

Settings
Default: On

On
Embedded MATLAB Function blocks in Simulink models and Embedded
MATLAB functions in Stateflow charts use Basic Linear Algebra
Subprograms (BLAS) libraries for low-level matrix operations.

Off
Embedded MATLAB Function blocks in Simulink models and Embedded
MATLAB functions in Stateflow charts do not use Basic Linear Algebra
Subprograms (BLAS) libraries for low-level matrix operations.

Command-Line Information
Parameter: SimBlas
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency On
Safety precaution No impact

1-434
Simulation Target Pane: General

See Also

• Configuration Parameters Dialog Box


• Simulation Target Pane: General

1-435
1 Configuration Parameters Dialog Box

Ensure responsiveness
Enables responsiveness checks in code generated for Embedded MATLAB
function blocks.

Settings
Default: On

On
Enables periodic checks for Ctrl+C breaks in code generated for
Embedded MATLAB function blocks. Also allows graphics refreshing.

Off
Disables periodic checks for Ctrl+C breaks in code generated for
Embedded MATLAB function blocks. Also disables graphics refreshing.

Caution Without these checks the only way to end a long-running


execution may be to terminate MATLAB.

Command-Line Information
Parameter: SimCtrlC
Type: string
Value: 'on' | 'off'
Default: 'on'

Recommended Settings

Application Setting
Debugging On
Traceability On
Efficiency Off
Safety precaution On

1-436
Simulation Target Pane: General

See Also

• “Controlling Runtime Checks” in the Simulink User’s Guide.


• Configuration Parameters Dialog Box
• Simulation Target Pane: General

1-437
1 Configuration Parameters Dialog Box

Simulation target build mode


Specifies how you build the simulation target for a model that contains
Embedded MATLAB Function blocks, Stateflow charts, or Truth Table blocks.

Settings
Default: Incremental build

Incremental build
This option rebuilds only those portions of the target that you changed
since the last build.
Rebuild all (including libraries)
This option rebuilds the target, including libraries, from scratch.
Make without generating code
This option invokes the make process without generating code.
Clean all (delete generated code/executables)
This option deletes both generated source code and executable files.
Clean objects (delete executables only)
This option deletes only executable files.

Tips

• The default Incremental build is a good choice for most models. This
action takes place whenever you simulate your model.
• Set Rebuild all (including libraries) if you have changed your
compiler or updated your object files since the last simulation. For example,
use this option to rebuild the simulation target to include custom code
changes.
• Set Make without generating code when you have custom source files
that you must recompile in an incremental build mechanism that does not
detect changes in custom code files.

1-438
Simulation Target Pane: General

Command-Line Information
Parameter: SimBuildMode
Type: string
Value: 'sf_incremental_build' | 'sf_nonincremental_build' |
'sf_make' | 'sf_make_clean' | 'sf_make_clean_objects'
Default: 'sf_incremental_build'

Recommended Settings

Application Setting
Debugging No impact

Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Configuration Parameters Dialog Box


• Simulation Target Pane: General

1-439
1 Configuration Parameters Dialog Box

Simulation Target Pane: Symbols

In this section...
“Simulation Target: Symbols Tab Overview” on page 1-441
“Reserved names” on page 1-442

1-440
Simulation Target Pane: Symbols

Simulation Target: Symbols Tab Overview

Configuration

1 Enter reserved names for a model that contains Embedded MATLAB


Function blocks, Stateflow charts, or Truth Table blocks.

2 Click Apply.

See Also

• Configuration Parameters Dialog Box


• Simulation Target Pane: Symbols

1-441
1 Configuration Parameters Dialog Box

Reserved names
Enter the names of variables or functions in the generated code that match
the names of variables or functions specified in custom code for a model that
contains Embedded MATLAB Function blocks, Stateflow charts, or Truth
Table blocks.

Settings
Default: {}

This action changes the names of variables or functions in the generated


code to avoid name conflicts with identifiers in custom code. Reserved names
must be shorter than 256 characters.

Tips

• Start each reserved name with a letter or an underscore to prevent error


messages.
• Each reserved name must contain only letters, numbers, or underscores.
• Separate the reserved names using commas or spaces.
• You can also specify reserved names by using the command line:

config_param_object.set_param('SimReservedNameArray', {'abc','xyz'})

where config_param_object is the object handle to the model settings in the


Configuration Parameters dialog box.

Command-Line Information
Parameter: SimReservedNameArray
Type: string array
Value: any reserved names shorter than 256 characters
Default: {}

1-442
Simulation Target Pane: Symbols

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Configuration Parameters Dialog Box


• Simulation Target Pane: Symbols

1-443
1 Configuration Parameters Dialog Box

Simulation Target Pane: Custom Code

In this section...
“Simulation Target: Custom Code Tab Overview” on page 1-446
“Source file” on page 1-447

1-444
Simulation Target Pane: Custom Code

In this section...
“Header file” on page 1-448
“Initialize function” on page 1-450
“Terminate function” on page 1-451
“Include directories” on page 1-452
“Source files” on page 1-454
“Libraries” on page 1-456
“Use local custom code settings (do not inherit from main model)” on page
1-458

1-445
1 Configuration Parameters Dialog Box

Simulation Target: Custom Code Tab Overview


Include custom code settings for a model that contains Embedded MATLAB
Function blocks, Stateflow charts, or Truth Table blocks.

Configuration

1 Select the type of information to include from the list on the left side of
the pane.

2 Enter a string to identify the specific code, directory, source file, or library.

3 Click Apply.

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-446
Simulation Target Pane: Custom Code

Source file
Enter code lines to appear near the top of a generated source code file.

Settings
Default: ’ ’

Code lines appear near the top of the generated model.c source file, outside
of any function.

Command-Line Information
Parameter: SimCustomSourceCode
Type: string
Value: any source file name
Default: ''

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-447
1 Configuration Parameters Dialog Box

Header file
Enter code lines to appear near the top of a generated header file.

Settings
Default: ’ ’

Code lines appear near the top of the generated model.h header file.

Tips

• When you include a custom header file, enclose the file name in double
quotes. For example, #include "sample_header.h" is a valid declaration
for a custom header file.
• You can include extern declarations of variables or functions.

Command-Line Information
Parameter: SimCustomHeaderCode
Type: string
Value: any header file name
Default: ''

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code

1-448
Simulation Target Pane: Custom Code

• Configuration Parameters Dialog Box


• Simulation Target Pane: Custom Code

1-449
1 Configuration Parameters Dialog Box

Initialize function
Enter code statements that execute once at the start of simulation.

Settings
Default: ’ ’

Code appears inside the model’s initialize function in the model.c file.

Tip

• Use this code to invoke functions that allocate memory or to perform other
initializations of your custom code.

Command-Line Information
Parameter: SimCustomInitializer
Type: string
Value: any code
Default: ''

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-450
Simulation Target Pane: Custom Code

Terminate function
Enter code statements that execute at the end of simulation.

Settings
Default: ’ ’

Code appears inside the model’s terminate function in the model.c file.

Tip

• Use this code to invoke functions that free memory allocated by the custom
code or to perform other cleanup tasks.

Command-Line Information
Parameter: SimCustomTerminator
Type: string
Value: any code
Default: ''

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-451
1 Configuration Parameters Dialog Box

Include directories
Specify a list of directory paths that contain files you include in the compiled
target.

Settings
Default:''

Enter a space-separated list of directory paths.

• Specify absolute or relative paths to the directories.


• Relative paths must be relative to the directory containing your model files,
not relative to the build directory.
• The order in which you specify the directories is the order in which they
are searched for header, source, and library files.

Note If you specify a Windows® path string containing one or more spaces,
you must enclose the string in double quotes. For example, the second
and third path strings in the Include directories entry below must be
double-quoted:

C:\Project "C:\Custom Files" "C:\Library Files"

If you set the equivalent command-line parameter SimUserIncludeDirs, each


path string containing spaces must be separately double-quoted within the
single-quoted third argument string, for example,

>> set_param('mymodel', 'SimUserIncludeDirs', ...


'C:\Project "C:\Custom Files" "C:\Library Files"')

Command-Line Information
Parameter: SimUserIncludeDirs
Type: string
Value: any directory file name
Default: ''

1-452
Simulation Target Pane: Custom Code

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-453
1 Configuration Parameters Dialog Box

Source files
Specify a list of source files to compile and link into the target.

Settings
Default:''

You can separate source files with a comma, a space, or a new line.

Note If you specify a Windows file name string containing one or more
spaces, you must enclose the string in double quotes. For example, the
second and third name strings in the Source files entry below must be
double-quoted:

algs.c "div alg.c" "sin alg.c"

If you set the equivalent command-line parameter SimUserSources, each file


name string containing spaces must be separately double-quoted within the
single-quoted third argument string, for example,

>> set_param('mymodel', 'SimUserSources', ...


'algs.c "div alg.c" "sin alg.c"')

Tip

• The file name is sufficient if the file is in the current MATLAB directory
or in one of the include directories.

Command-Line Information
Parameter: SimUserSources
Type: string
Value: any source file name
Default: ''

1-454
Simulation Target Pane: Custom Code

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-455
1 Configuration Parameters Dialog Box

Libraries
Specify a list of static libraries that contain custom object code to link into
the target.

Settings
Default:''

Enter a space-separated list of library files.

Note If you specify a Windows file name string containing one or more
spaces, you must enclose the string in double quotes. For example, the second
and third name strings in the Libraries entry below must be double-quoted:

mathutil.lib "op utils.lib" "fx utils.lib"

If you set the equivalent command-line parameter SimUserLibraries, each


file name string containing spaces must be separately double-quoted within
the single-quoted third argument string, for example,

>> set_param('mymodel', 'SimUserLibraries', ...


'mathutil.lib "op utils.lib" "fx utils.lib"')

Tip

• The file name is sufficient if the file is in the current MATLAB directory
or in one of the include directories.

Command-Line Information
Parameter: SimUserLibraries
Type: string
Value: any library file name
Default: ''

1-456
Simulation Target Pane: Custom Code

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-457
1 Configuration Parameters Dialog Box

Use local custom code settings (do not inherit from


main model)
Specify if a library model can use custom code settings that are unique from
the main model.

Settings
Default: Off

On
Enables a library model to use custom code settings that are unique
from the main model.
Off
Disables a library model from using custom code settings that are
unique from the main model.

Dependency
This parameter is available only for library models that contain Embedded
MATLAB Function blocks, Stateflow charts, or Truth Table blocks. To access
this parameter, select Tools > Open Simulation Target in the Embedded
MATLAB Editor or Stateflow Editor for your library model.

Command-Line Information
Parameter: SimUseLocalCustomCode
Type: string
Value: 'on' | 'off'
Default: 'off'

Recommended Settings

Application Setting
Debugging No impact
Traceability No impact

1-458
Simulation Target Pane: Custom Code

Application Setting
Efficiency No impact
Safety precaution No impact

See Also

• Including Custom C Code


• Configuration Parameters Dialog Box
• Simulation Target Pane: Custom Code

1-459
1 Configuration Parameters Dialog Box

1-460
2

Library Browser

• “About the Library Browser” on page 2-2


• “Libraries Pane” on page 2-5
• “Library Pane” on page 2-8
• “Block Description Pane” on page 2-14
• “Search Toolbar” on page 2-15
• “Found Pane” on page 2-18
• “Most Frequently Used Blocks Pane” on page 2-21
• “Library Data Repository” on page 2-22
• “Library Browser Keyboard Shortcuts” on page 2-23
2 Library Browser

About the Library Browser


Use the Library Browser to browse and search Simulink block libraries for
blocks to use in your models. You can also select from a list of your most
frequently used blocks.

The following figure shows the Library Browser with:

• The Sinks library selected from the Libraries pane (left-most pane)
• The Out1 block selected in the Library pane, which lists the blocks from
the library selected in the Libraries pane (Sinks, in this example)
• A Block Description pane for the Out1 block (the block selected in the
Library pane), at the bottom of the Library browser.

The Library Browser has a search box for searching for blocks or libraries
whose names that contain the search term you specify.

The Most Frequently Used Blocks pane displays a list of the blocks you
have added the most often.

2-2
About the Library Browser

For details about Library Browser features, see:

• “Libraries Pane” on page 2-5


• “Library Pane” on page 2-8
• “Most Frequently Used Blocks Pane” on page 2-21
• “Block Description Pane” on page 2-14
• “Search Toolbar” on page 2-15
• “Found Pane” on page 2-18

For information about key tasks involving the Library Browser, see:

• “Populating a Model”

2-3
2 Library Browser

• “Adding Blocks”
• “Adding Libraries to the Library Browser”

2-4
Libraries Pane

Libraries Pane
In this section...
“About the Libraries Pane” on page 2-5
“Selecting Nodes” on page 2-6
“Expanding and Collapsing Nodes” on page 2-7
“Refreshing the Tree View” on page 2-7

About the Libraries Pane


The Libraries pane allows you to select block libraries for browsing. The
pane displays a tree-structured directory (tree view) of libraries installed on
your system, each of whose nodes you can select with your mouse or keyboard.
Selecting a node displays the contents of the corresponding library in the
Library Browser’s Library pane. The Libraries pane indicates the selected
library via a selection cursor that highlights the corresponding node.

2-5
2 Library Browser

Tree View

Expand/Collapse Selection Cursor


Button

Selecting Nodes
You can use your keyboard or your mouse to select a node in the tree view.
To select a node with the mouse, first use the Libraries pane’s scroll bars, if
necessary, to move the node into view. Then click the node. To select a node
with the keyboard, use the keyboard’s Up or Down arrow key to move the
tree’s node selection cursor to the desired node.

Note Selecting a node can cause the Library Browser to update its library
data repository (see “Library Data Repository” on page 2-22). In this case, it
displays an advisory dialog box while the update is in process.

2-6
Libraries Pane

Expanding and Collapsing Nodes


To facilitate navigation of large directory trees, the Libraries pane displays
libraries containing sublibraries as expandable nodes, each containing a
toggle button labeled + or -, depending on whether the node is collapsed or
expanded. Clicking the button expands or collapses its node to show or hide
the corresponding parent library’s children. You can also expand or collapse
the currently selected node by pressing the Right or Left arrow keys on
your keyboard, respectively.

Refreshing the Tree View


To refresh the tree view displayed in the Libraries pane, select Refresh
Tree View from the Library Browser’s View menu. The Library Browser
adds or removes any libraries from the tree view that have been added or
deleted, respectively, from the MATLAB path since the view was last updated.

2-7
2 Library Browser

Library Pane
In this section...
“About the Library Pane” on page 2-8
“How to Tell Blocks from Libraries in the Library Pane” on page 2-9
“Choosing the Library Pane’s Layout” on page 2-10
“Setting Icon Size” on page 2-11
“Selecting Blocks” on page 2-12
“Creating an Instance of a Library Block in a Model” on page 2-12
“Displaying a Library Block’s Parameters” on page 2-12
“Displaying Help for a Library Block” on page 2-12
“Displaying the Contents of a Sublibrary” on page 2-12
“Displaying a Block or Sublibrary’s Parent” on page 2-13

About the Library Pane


The Library Browser’s Library pane displays the contents of the library
selected in the Libraries pane (see “Libraries Pane” on page 2-5).

2-8
Library Pane

Contents of selected library

You can use the Library pane to browse the contents of the selected library,
to view a library block’s parameters or help, and to create instances of library
blocks in models.

How to Tell Blocks from Libraries in the Library Pane


The Library pane displays the icon and name of each block or sublibrary
contained by the library selected in the Libraries pane. To enable you to
determine at a glance which icons represent libraries and which blocks,
the Library Browser by default draws a single rectangle around an icon
representing a block and a stack of three rectangles around an icon
representing a library.

2-9
2 Library Browser

library block

Note The Library Browser’s compact icon option eliminates display of


rectangles around icons (see “Setting Icon Size” on page 2-11). This allows
the Library Browser to fit more blocks and libraries into the visible area
of the Library pane.

Choosing the Library Pane’s Layout


The Library Browser can display blocks in either a list (single-column) layout
or a screen-saving grid layout. To choose a layout, select List or Grid from
the Library Browser’s View > Layout menu.

2-10
Library Pane

List Layout Grid Layout

Tip
Setting the Library Browser’s layout option to grid and its icon size to compact
(see “Setting Icon Size” on page 2-11) results in the most compact display of a
library’s contents in the Library pane.

Setting Icon Size


The Library Browser’s View > Icon Size menu allows you to select any
of four icon sizes: Compact (Ctrl+1), Small (Ctrl+2), Medium (Ctrl+3),
Large (Ctrl+4). The compact option eliminates the use of rectangles to
distinguish block icons from library icons and thus takes up the least amount
of space. Use this option if you want to maximize the number of icons visible
in the Library Browser’s Library pane.

2-11
2 Library Browser

Selecting Blocks
Many Library pane procedures require you to select a block displayed in the
pane. To select a block, click it with the mouse. The Library Browser moves
the block selection cursor to the selected block.

Creating an Instance of a Library Block in a Model


To create an instance of a library block in an existing model, select the block
in the Library pane and drag it into the model’s window.

To create an instance of a library block in a new model, select the block in the
Library pane and then select Add to a new model from the library block’s
context menu or Add Selected Block to a New Model from the Library
Browser’s Edit menu.

Displaying a Library Block’s Parameters


To display a library block’s parameter dialog box, double-click the block in the
Library pane or select Block parameter from the block’s context menu.

Note The dialog box is disabled to prevent you from using it to change a
library block’s parameters.

Displaying Help for a Library Block


To display help for a library block, select the block and then select Help from
the block’s context menu or from the Library Browser’s Help menu.

Displaying the Contents of a Sublibrary


To display the contents of a sublibrary appearing in the Library pane,
double-click the library. The library’s contents replaces the parent’s contents
in the Library pane.

2-12
Library Pane

Displaying a Block or Sublibrary’s Parent


To display the parent of an item (block or library) displayed in the Library
pane, select Go to parent from the item’s context menu. The contents of the
parent replaces the contents of the child in the Library pane.

2-13
2 Library Browser

Block Description Pane


This pane displays a description of the block selected in the Library pane.
The text of the description is the same as the text of the description that
appears on the block’s parameter dialog box.

To hide this pane, deselect Show block descriptions on the Library


Browser’s View menu.

2-14
Search Toolbar

Search Toolbar
In this section...
“About the Search Toolbar” on page 2-15
“Using the Search Toolbar to Find Blocks” on page 2-15
“Search Text Combo Box” on page 2-16
“Search Options Menu” on page 2-16
“Search Button” on page 2-17

About the Search Toolbar


The Library Browser’s Search toolbar allows you to search the block libraries
installed on your system for blocks whose names contain or match a text
string that you specify. The Search toolbar displays the blocks it finds in the
Library Browser’s Found pane. You can use the Found pane to view a found
block’s help or parameters or create an instance of the block in a model (see
“Found Pane” on page 2-18 for more information).

Search Text Search Button Search Options


Combo Box Menu Button

Using the Search Toolbar to Find Blocks


To find blocks whose names contain or match a specified text string:

1 Enter the string in the toolbar’s search text combo box (see “Search Text
Combo Box” on page 2-16).

2 Use the toolbar’s search options menu to specify the search options you
want to use, e.g., match whole words (see “Search Options Menu” on page
2-16).

3 Select the toolbar’s Search button to start the search.

2-15
2 Library Browser

The Library Browser searches the libraries installed on your system whose
names contain or match the search string you specified, depending on the
options you specified. It displays the results of the search in its Found pane
(see “Found Pane” on page 2-18).

Search Text Combo Box


The search text combo box allows you to specify the text string to be used to
search the block libraries on your system. The combo box consists of an edit
field and a drop-down list of search strings that you previously entered in the
current or previous sessions. To specify a string, enter the string in the edit
field or choose a string from the drop-down list.

Search text Pulldown list of previous


edit field search text entries

Search Options Menu


The Search Options menu allows you to specify various search options.
To display the menu, select the search options menu button on the Search
toolbar.

2-16
Search Toolbar

Regular Expression
Treat search text as a MATLAB regular expression (see “Regular
Expressions”).

Match Case
Consider case when matching search text against block names.

Match Whole Word


Allow a match only if the search string matches a word, i.e., text set off by
white space, in a block’s name.

Search Button
Selecting this button initiates a search of the block libraries on your system,
using the text string and search options specified in the toolbar’s search text
combo box (see “Search Text Combo Box” on page 2-16) and search options
menu (see “Search Options Menu” on page 2-16), respectively.

2-17
2 Library Browser

Found Pane
In this section...
“About the Found Pane” on page 2-18
“Selecting a Found Block in Library View” on page 2-19
“Displaying a Found Block’s Path” on page 2-20

About the Found Pane


The Found pane allows you to view and select blocks found by the Library
Browser’s Search tool. The pane displays the blocks found by the tool
grouped by library. A banner at the top of each group displays the name of
the top-level library containing the found blocks, the number of blocks found
in the library, and a button that allows you to hide or display the search
results for the library.

2-18
Found Pane

Library Banner Number of


blocks found

Click to hide
or show blocks
found in this
library.

You can use the Found pane to perform many of the same tasks you can
perform with the Library pane, including creating instances of found blocks
in models and other libraries, displaying a found block’s parameters, and
displaying help for a found block. The procedures for these tasks are the same
as for the Library pane (see “Library Pane” on page 2-8 for more information).

Selecting a Found Block in Library View


To select a found block in the Library pane, select the block in the Found
pane and then select Select in library view from the block’s context menu or
enter Ctrl+R. This brings the Library pane forward in the Library Browser
with the found block in view and selected.

2-19
2 Library Browser

Displaying a Found Block’s Path


To display the path of a found block, move the cursor over the block. The
block’s path appears in a tooltip.

2-20
Most Frequently Used Blocks Pane

Most Frequently Used Blocks Pane


Open the Most Frequently Used Blocks pane from the third tab in the
Library Browser.

For details, see “Selecting Your Most Frequently Used Blocks From the
Library Browser”.

2-21
2 Library Browser

Library Data Repository


To allow you to browse and search libraries without first loading them, the
Library Browser maintains a repository of data about each library installed on
your system. The data includes block paths and icons. The Library Browser
updates the repository when you select a library whose contents have changed
since the last time you selected the library.

2-22
Library Browser Keyboard Shortcuts

Library Browser Keyboard Shortcuts


Task Shortcut
Select Libraries or Library panes or tools Tab
on the Search toolbar.
Switch from the Library pane to the Ctrl+P
Found pane, or vice versa.
Open a model. Ctrl+O
Move node selection down in the Libraries Down Arrow
pane tree view.
Move node selection up in the Libraries Up Arrow
pane tree view.
Expand a node in the Libraries pane tree Right Arrow
view.
Collapse a node in the Libraries pane tree Left Arrow
view.
Select a block found with the search tool Ctrl+R
in the Library pane.
Insert the selected block in a new model. Ctrl+I
Increase the Library Browser’s font size. Ctrl++
Decrease the Library Browser’s font size Ctrl+-
Use compact block icons. Ctrl+1
Use small block icons. Ctrl+2
Use medium block icons. Ctrl+3
Use large block icons. Ctrl+4
Find a block. Ctrl+F

2-23
2 Library Browser

2-24
3

Signal Properties Dialog


Box

The Signal Properties dialog box lets you display and edit signal properties.
To display the dialog box, either

• Select the line that represents the signal whose properties you want to set
and then choose Signal Properties from the signal’s context menu or
from the Simulink Edit menu
or
• Select a block that outputs or inputs the signal and select Port Signal
Properties from the block’s context menu, then select the port to which
the signal is connected from the resulting menu

The Signal Properties dialog box appears.


3 Signal Properties Dialog Box

The dialog box includes the following controls.

• “Signal Properties Controls” on page 3-2


• “Logging and Accessibility Options” on page 3-4
• “Real-Time Workshop Options” on page 3-6
• “Documentation Options” on page 3-7

Signal Properties Controls

Signal name
Name of signal.

Signal name must resolve to Simulink signal object


Specifies that either the base MATLAB workspace or the model workspace
must contain a Simulink.Signal object with the same name as this signal.

3-2
Signal Properties Controls

Simulink software displays an error message if it cannot find such an object


when you update or simulate the model containing this signal.

Note Simulink.Signal objects in the model workspace must have their


storage class set to Auto. See “Using Model Workspaces” for more information.

When Signal name must resolve to Simulink signal object is enabled, a


signal resolution icon appears by default to the left of any label on the signal.
The icon looks like this:

See “Signal Resolution Indicators” for more information.

Show propagated signals

Note This option appears only for signals that originate from a virtual block
other than a Bus Selector block.

Show propagated signal names. You can select one of the following options:

Option Description
off Do not display signals represented by a virtual signal in the
signal’s label.

3-3
3 Signal Properties Dialog Box

Option Description
on Display the virtual and nonvirtual signals represented by
a virtual signal in the signal’s label. For example, suppose
that virtual signal s1 represents a nonvirtual signal s2 and
a virtual signal s3. If this option is selected, the label for
s1 is s1<s2, s3>.
all Display all the nonvirtual signals that a virtual signal
represents either directly or indirectly. For example, suppose
that virtual signal s1 represents a nonvirtual signal s2 and a
virtual signal s3 and virtual signal s3 represents nonvirtual
signals s4 and s5. If this option is selected, the label for s1
is s1<s2,s4,s5>.

See “Displaying the Nonvirtual Components of Virtual Signals” for more


information.

Logging and Accessibility Options


Select the Logging and accessibility tab on the Signal Properties
dialog box to display controls that enable you to specify signal logging and
accessibility options for this signal.

3-4
Logging and Accessibility Options

Log signal data


Select this option to cause Simulink software to save this signal’s values to
the MATLAB workspace during simulation. See “Logging Signals” for details.

Test point
Select this option to designate this signal as a test point. See “Working with
Test Points” for details.

Logging name
This pair of controls, consisting of a list box and an edit field, specifies the
name associated with logged signal data.

Simulink software uses the signal’s signal name as its logging name by
default. To specify a custom logging name, select Custom from the list box and
enter the custom name in the adjacent edit field.

Data
This group of controls enables you to limit the amount of data that Simulink
software logs for this signal.

The options are as follows.

3-5
3 Signal Properties Dialog Box

Limit data points to last


Discard all but the last N data points where N is the number entered in the
adjacent edit field.

Decimation
Log every Nth data point where N is the number entered in the adjacent edit
field. For example, suppose that your model uses a fixed-step solver with a
step size of 0.1 s. if you select this option and accept the default decimation
value (2), Simulink software records data points for this signal at times 0.0,
0.2, 0.4, etc.

Real-Time Workshop Options


The following controls set properties used by Real-Time Workshop to generate
code from the model. You can ignore them if you are not going to generate
code from the model.

Storage class
Select the storage class of this signal from the list. See “Interfacing Signals
to External Code”,“Using the State Attributes Tab to Interface States to
External Code”, and “Storage Classes for Data Store Memory Blocks” for
information on how to use the listed options.

Storage type qualifier


Enter a storage type qualifier for this signal. For more information, see
“Interfacing Signals to External Code”,“Using the State Attributes Tab to
Interface States to External Code”, and “Storage Classes for Data Store
Memory Blocks”.

3-6
Documentation Options

Documentation Options

Description
Enter a description of the signal in this field.

Document link
Enter a MATLAB expression in the field that displays documentation for the
signal. To display the documentation, click “Document Link.” For example,
entering the expression

web(['file:///' which('foo_signal.html')])

in the field causes MATLAB software’s default Web browser to display


foo_signal.html when you click the field’s label.

3-7
3 Signal Properties Dialog Box

3-8
4

Simulink Preferences
Window

• “Simulink Preferences Window: Main Pane” on page 4-2


• “Simulink Preferences Window: Display Defaults Pane” on page 4-21
• “Simulink Preferences Window: Font Defaults Pane” on page 4-28
• “Simulink Preferences Window: Configuration Defaults Pane” on page 4-30
4 Simulink® Preferences Window

Simulink Preferences Window: Main Pane

In this section...
“Simulink Preferences Window Overview” on page 4-3
“Window Reuse” on page 4-5
“Model File Change Notification” on page 4-7
“Updating or simulating the model” on page 4-8
“Action” on page 4-9
“First editing the model” on page 4-11

4-2
Simulink® Preferences Window: Main Pane

In this section...
“Saving the model” on page 4-12
“Autosave” on page 4-13
“Save before updating or simulating the model” on page 4-14
“Notify when loading an old model” on page 4-17
“Do not load models created with a newer version of Simulink” on page 4-18
“Callback tracing” on page 4-19
“Open the Sample Time Legend whenever Sample Time Display is changed”
on page 4-20

Simulink Preferences Window Overview


The Simulink Preferences Window comprises the following panes:

• General Preferences (root level)


Set preferences for configuring window reuse, file change and old version
notifications, autosave, and callback tracing.
• Display Defaults
Configure display options for the Model Browser, block connection lines
and port data types.
• Font Defaults
Configure font options for blocks, lines and annotations.
• Configuration Defaults
Edit the template Configuration Parameters to be used as defaults for
new models.

Click items in the tree to select panes.

Configuration

1 On the root level pane, select the check boxes to configure preferences.

4-3
4 Simulink® Preferences Window

2 Close the window to apply your changes.

Click Apply to apply your changes and keep the window open.

Your settings affect the behavior of all Simulink models, including those
currently open, and all subsequent models. Your preference settings are
preserved for the next time you use the software.

See Also
• Model File Change Notification
• “Simulink Preferences Window: Main Pane” on page 4-2
• “Simulink Preferences Window: Display Defaults Pane” on page 4-21
• “Simulink Preferences Window: Font Defaults Pane” on page 4-28
• “Simulink Preferences Window: Configuration Defaults Pane” on page 4-30

4-4
Simulink® Preferences Window: Main Pane

Window Reuse
Specify whether to use the current window or open new windows to display a
subsystem or its parent.

Settings
Default: Mixed

Mixed
Mixed window reuse. Subsystem opens in its own window. When you
press Escape (go to parent), the parent window rises to the front, and
the subsystem window disappears.
None
Never reuse windows. Subsystem opens in a new window. Press
Escape: the parent window moves to the front.
Replace
Replace parent window. Subsystem opens in a new window. Parent
window disappears. Press Escape: the parent window appears, and
the subsystem window disappears.
Reuse
Reuse parent window. Subsystem replaces the parent in the current
window. Press Escape: the parent window replaces subsystem in
current window.

Tips

• Reusing windows avoids cluttering your screen.


• Creating a window for each subsystem allows you to view subsystems side
by side with their parents or siblings.
• The WindowReuse preference does not affect the behavior of library
windows.

Command-Line Information
Parameter: WindowReuse
Type: string

4-5
4 Simulink® Preferences Window

Value: 'none' | 'reuse' | 'replace' | 'mixed'


Default: 'mixed'

4-6
Simulink® Preferences Window: Main Pane

Model File Change Notification


Use these preferences to specify notifications if the model has changed on
disk when you update, simulate, edit or save the model. When updating
or simulating, you can choose the action to take: warn, error, reload if
unmodified, or show a dialog box where you can choose to reload or ignore.
For more information, see Model File Change Notification.

The frame contains these controls:

• “Updating or simulating the model” on page 4-8


• “Action” on page 4-9
• “First editing the model” on page 4-11
• “Saving the model” on page 4-12

4-7
4 Simulink® Preferences Window

Updating or simulating the model


Specify whether to notify if the model has changed on disk when updating or
simulating the model.

Settings
Default: On

On
Notify if the model has changed on disk when updating or simulating
the model. Select the action to take in the Action list.
Off
Do not notify if the model has changed on disk when updating or
simulating the model.

Tip
To programmatically check whether the model has changed on disk since it
was loaded, use the function slIsFileChangedOnDisk.

Dependency
This parameter enablesAction.

Command-Line Information
Parameter: MDLFileChangedOnDiskChecks
Type: struct, field name: CheckWhenUpdating
Value: true | false | 1 | 0
Default: true

See Also
Model File Change Notification

4-8
Simulink® Preferences Window: Main Pane

Action
Select what action to take if the file has changed on disk since it was loaded.

Settings
Default: Warning

Warning
Displays a warning in MATLAB command window
Error
Displays an error, at the MATLAB command window if simulating from
the command line, or if simulating from a menu item, in the Simulation
Diagnostics window.
Reload model (if unmodified)
Reloads if the model is unmodified. If the model is modified, you see
the prompt dialog.
Show prompt dialog
Shows prompt dialog. In the dialog, you can choose to close and reload,
or ignore the changes.

Tip
To programmatically check whether the model has changed on disk since it
was loaded, use the function slIsFileChangedOnDisk.

Dependencies
This parameter is enabled by the parameter Updating or simulating the
model.

Command-Line Information
Parameter: MdlFileChangedOnDiskHandling
Type: string
Value: 'Warning' | 'Error' | 'Reload model (if unmodified)' |
'Show prompt dialog'
Default: 'Warning'

4-9
4 Simulink® Preferences Window

See Also
Model File Change Notification

4-10
Simulink® Preferences Window: Main Pane

First editing the model


Specify whether to notify if the file has changed on disk when editing the
model.

Settings
Default: On

On
Displays a warning if the file has changed on disk when you modify
the block diagram. Any graphical operation that modifies the block
diagram (e.g., adding a block) causes a warning dialog to appear. Any
command-line operation that causes the block diagram to be modified
(e.g., a call to set_param) will result in a warning like this at the
command line:

Warning: Block diagram 'mymodel' is being edited but file has


changed on disk since it was loaded. You should close and
reload the block diagram.

Off
Do not check for changes on disk when first editing the model.

Tip
To programmatically check whether the model has changed on disk since it
was loaded, use the function slIsFileChangedOnDisk.

Command-Line Information
Parameter: MDLFileChangedOnDiskChecks
Type: struct, field name: CheckWhenEditing
Value: true | false | 1 | 0
Default: true

See Also
Model File Change Notification

4-11
4 Simulink® Preferences Window

Saving the model


Specify whether to notify if the file has changed on disk when saving the
model.

Settings
Default: On

On
Notify if the file has changed on disk when you save the model.
• The save_system function displays an error, unless the
OverwriteIfChangedOnDisk option is used.
• Saving the model by using the menu (File > Save) or a keyboard
shortcut causes a dialog to be shown. In the dialog, you can choose to
overwrite, save with a new name, or cancel the operation.

Off
Do not check for changes on disk when saving the model.

Tip
To programmatically check whether the model has changed on disk since it
was loaded, use the function slIsFileChangedOnDisk.

Command-Line Information
Parameter: MDLFileChangedOnDiskChecks
Type: struct, field name: CheckWhenSaving
Value: true | false | 1 | 0
Default: true

See Also
Model File Change Notification

4-12
Simulink® Preferences Window: Main Pane

Autosave
Use this preference to specify whether to automatically save a backup copy of
the model before updating or simulating.

For more information, see the check box control “Save before updating or
simulating the model” on page 4-14.

4-13
4 Simulink® Preferences Window

Save before updating or simulating the model


Specify whether to automatically save a backup copy of the model before
updating or simulating.

Settings
Default: On

On
If the model has unsaved changes, automatically save a backup copy
of the model before updating or simulating. This autosave copy can be
useful for crash recovery.

The copy is saved in the same directory as the model, with the name
MyModel.mdl.autosave.

Off
Do not automatically save a copy before updating or simulating.

Tips
If you open or load a model with a more recent autosave copy available, the
model loads, and the non-modal dialog Model Recovery appears.

For each model in the list, you can choose to:

• Restore — Overwrite the original model file with the autosave copy, and
delete the autosave copy.
If you select the check box to Keep a copy of original model file, you can
save copies of the original model files named MyModel.mdl.original.
• Delete Autosave — Delete the autosave copy, and do nothing else.
• Ignore — Do nothing. This leaves the model and the autosave copy
untouched. The Model Recovery dialog will reappear the next time you
open the model, so you can choose to restore or delete autosave files later.

4-14
Simulink® Preferences Window: Main Pane

Select a check box for each model in the list to specify whether to restore,
delete autosave, or ignore. You can click the Restore All, Delete All or
Ignore All buttons to select that option for all models.

The default option is Ignore All. If you click OK without making any
changes, your models and autosave copies are left untouched. The next time
you open the model, the Model Recovery dialog will reappear and you can
choose again whether to restore or delete any autosave copies.

Caution If you restore, any changes made since your last save will be lost.

If a segmentation violation occurred, note that the last autosave file for
the model reflects the state of the autosave data prior to the segmentation
violation. Because Simulink models might be corrupted by a segmentation
violation, a model is not autosaved after a segmentation violation occurs.

Click OK to apply your choices.

Autosave has the following rules:

• If you deliberately close a modified model, any autosave copy is deleted.


• Autosave does not occur for models that are part of the MATLAB
installation, so you will not create autosave copies of the demo models.
• Autosave does not occur if the autosave file or location is read only.

4-15
4 Simulink® Preferences Window

Command-Line Information
Parameter: AutoSaveOptions
Type: struct, field name: SaveOnModelUpdate
Value: true | false | 1 | 0
Default: true

4-16
Simulink® Preferences Window: Main Pane

Notify when loading an old model


Specify whether to notify when loading a model last saved in a older version
of Simulink software.

Settings
Default: Off

On
Print a message in the command window when loading a model last
saved in an old version of Simulink software.
Off
No notification when loading old models.

Tips

• Run slupdate('modelname') to convert the block diagram to the format of


the current version of Simulink software.
• For advice on upgrading a model to the current version of Simulink
software, see “Consulting the Model Advisor”.

Command-Line Information
Parameter: NotifyIfLoadOldModel
Type: string
Value: 'on' | 'off'
Default: off

4-17
4 Simulink® Preferences Window

Do not load models created with a newer version


of Simulink
Specify whether to load a model last saved in a newer version of Simulink
software.

Settings
Default: Off

On
Do not load any model last saved in a newer version of Simulink
software, and print an error message in the command window.

Off
Load models last saved in a newer version of Simulink software, and
print a warning message in the command window.

Tip
If possible, use the Save As command to convert the block diagram to the
format of the desired version of Simulink software. The Save As command
allows you to save a model created with the latest version of the Simulink
software in formats used by earlier versions. See “Saving a Model in an
Earlier Simulink Version”.

Command-Line Information
Parameter: ErrorIfLoadNewModel
Type: string
Value: 'on' | 'off'
Default: off

4-18
Simulink® Preferences Window: Main Pane

Callback tracing
Specify whether to display the model callbacks that Simulink software
invokes when simulating a model.

Settings
Default: Off

On
Display the model callbacks in the MATLAB command window as they
are invoked.

Callback tracing allows you to determine the callbacks the software


invokes, and in what order, when you open or simulate a model.

Off
Do not display model callbacks.

Command-Line Information
Parameter: CallbackTracing
Type: string
Value: 'on' | 'off'
Default: 'off'

4-19
4 Simulink® Preferences Window

Open the Sample Time Legend whenever Sample


Time Display is changed
Specify whether to display the Sample Time Legend whenever Sample Time
Display is changed.

Settings
Default: On

On
Display the Sample Time Legend whenever you change Sample Time
Display by selecting Colors, Annotations, or All from the Sample Time
Display submenu. The model diagram is updated and the legend opens.

Off
Do not display the Sample Time Legend whenever Sample Time Display
is changed.

Command-Line Information
Parameter: OpenLegendWhenChangingSampleTimeDisplay
Type: string
Value: 'on' | 'off'
Default: 'on'

4-20
Simulink® Preferences Window: Display Defaults Pane

Simulink Preferences Window: Display Defaults Pane

In this section...
“Simulink Display Defaults Overview” on page 4-22
“Show masked subsystems” on page 4-23
“Show library links” on page 4-24
“Browser visible” on page 4-25

4-21
4 Simulink® Preferences Window

In this section...
“Wide nonscalar lines” on page 4-26
“Show port data types” on page 4-27

Simulink Display Defaults Overview


Configure display options for the Model Browser, block connection lines and
port data types.

Configuration

1 Select check boxes to configure display properties that will be applied to all
new block diagrams.

2 Close the window to apply your changes.

Click Apply to apply your changes and keep the window open.

These values will be inherited by new block diagrams.

See Also

• “The Model Browser” (Windows only)


• Signal Display Options

4-22
Simulink® Preferences Window: Display Defaults Pane

Show masked subsystems


Specify whether masked subsystems and their contents are shown in the
Model Browser (Windows only).

Settings
Default: Off

On
Display masked subsystems and their contents in the Model Browser.

Off
Do not display masked subsystems and their contents in the Model
Browser.

Command-Line Information
Parameter: BrowserLookUnderMasks
Type: string
Value: 'on' | 'off'
Default: 'off'

4-23
4 Simulink® Preferences Window

Show library links


Specify whether library links and their contents are shown in the Model
Browser (Windows only).

Settings
Default: Off

On
Display library links and their contents in the Model Browser.

Off
Do not display library links and their contents in the Model Browser.

Command-Line Information
Parameter: BrowserShowLibraryLinks
Type: string
Value: 'on' | 'off'
Default: 'off'

4-24
Simulink® Preferences Window: Display Defaults Pane

Browser visible
Specify whether the Model Browser (Windows only) is shown when you open
a model.

Settings
Default: Off

On
Display the Model Browser.

Off
Do not display the Model Browser.

Command-Line Information
Parameter: ModelBrowserVisibility
Type: string
Value: 'on' | 'off'
Default: 'off'

4-25
4 Simulink® Preferences Window

Wide nonscalar lines


Specify whether to show thick lines for nonscalar connections between blocks.

Settings
Default: Off

On
Show thick lines for nonscalar connections between blocks
Off
Do not show thick lines for nonscalar connections between blocks

Command-Line Information
Parameter: WideVectorLines
Type: string
Value: 'on' | 'off'
Default: 'off'

4-26
Simulink® Preferences Window: Display Defaults Pane

Show port data types


Specify whether to show the data type on each block port

Settings
Default: Off

On
Display the data type for each port on each block.

Off
Do not display data types on block ports.

Command-Line Information
Parameter: ShowPortDataTypes
Type: string
Value: 'on' | 'off'
Default: 'off'

4-27
4 Simulink® Preferences Window

Simulink Preferences Window: Font Defaults Pane

Simulink Font Defaults Overview


Configure font options for blocks, lines and annotations.

Configuration

1 Use the drop-down lists to specify font types, styles, and sizes that will be
applied to all new block diagrams.

4-28
Simulink® Preferences Window: Font Defaults Pane

2 Close the window to apply your changes.

Click Apply to apply your changes and keep the window open.

These properties will be inherited by new block diagrams.

4-29
4 Simulink® Preferences Window

Simulink Preferences Window: Configuration Defaults


Pane

Simulink Configuration Defaults Overview


On the main Configuration Defaults pane you can edit the description of your
template configuration set.

Expand the tree under Configuration Defaults to edit the template


Configuration Parameters to be used as defaults for new models.

4-30
Simulink® Preferences Window: Configuration Defaults Pane

Configuration

1 Expand the tree under Configuration Defaults to edit the template for
default Configuration Parameters.

2 Edit Configuration Parameters that you want to apply to all new block
diagrams.

3 Close the window to apply your changes.

Click Apply to apply your changes and keep the window open.

These values will be inherited by new block diagrams.

See Also
“Configuration Parameters Dialog Box Overview” on page 1-2

4-31
4 Simulink® Preferences Window

4-32
5

Simulink Mask Editor

• “Mask Editor Overview” on page 5-2


• “Icon & Ports Pane” on page 5-5
• “Parameters Pane” on page 5-12
• “Initialization Pane” on page 5-22
• “Documentation Pane” on page 5-25
5 Simulink® Mask Editor

Mask Editor Overview


You can use the Simulink Mask Editor to define a custom interface for a
Subsystem block, Model block, or S-Function block. This chapter provides
reference information about Mask Editor capabilities, but does not describe
the workflows needed to combine those capabilities to create and use masks.
That information appears in “Working with Block Masks” in the Simulink
user’s Guide.

To invoke the Mask Editor on a block, do one of the following:

• To create a new mask, select the block to be masked, then choose Mask
BlockType from the model window’s Edit menu or the block’s context
menu.
• To edit an existing mask, select the masked block, then choose Edit Mask
from the model window’s Edit menu or the block’s context menu.

A Mask Editor like the following appears. If the block is already masked, the
current mask specification appears in the editor, allowing you to change the
mask as needed. Otherwise, the editor is initially empty:

5-2
Mask Editor Overview

The Mask Editor contains a set of tabbed panes, each of which enables you to
define a feature of the mask:

• The Icon & Ports pane enables you to define the block icon. See “Icon
& Ports Pane” on page 5-5.
• The Parameters pane enables you to define and describe mask dialog
box parameter prompts, and to name the variables associated with the
parameters. See “Parameters Pane” on page 5-12.
• The Initialization pane enables you to specify initialization commands.
See “Initialization Pane” on page 5-22.
• The Documentation pane enables you to define the mask type and specify
the block description and the block help. See “Documentation Pane” on
page 5-25.

Five buttons appear along the bottom of the Mask Editor:

5-3
5 Simulink® Mask Editor

• The Unmask button deactivates the mask and closes the Mask Editor.
While the model is still active, the mask information is still retained so
that you can reactivate it.
To reactivate the mask, select the block and choose Mask Subsystem. The
Mask Editor opens, displaying the previous settings. Click OK or Apply
to restore the mask.
When you close the model, the inactive mask information is discarded.
If you want the mask information after this, you will need to recreate it
the next time you open the model.
• The OK button applies the mask settings on all panes and closes the Mask
Editor.
• The Cancel button closes the Mask Editor without applying any changes
made since you last clicked the Apply button.
• The Help button displays online information about the Mask Editor.
• The Apply button applies the mask settings on all panes and leaves the
Mask Editor open.

To see the system under the mask without unmasking it, select the Subsystem
block, then select Look Under Mask from the Edit menu or the block’s
context menu. This command opens the subsystem. The block’s mask is not
affected.

5-4
Icon & Ports Pane

Icon & Ports Pane


In this section...
“About the Icon & Ports Pane” on page 5-5
“Drawing commands” on page 5-6
“Examples of drawing commands” on page 5-6
“Icon & Ports options” on page 5-6

About the Icon & Ports Pane


The Mask Editor’s Icon & Ports pane enables you to create icons that can
contain descriptive text, state equations, images, and graphics.

Commands that draw the block icon

Parameters that control the icon appearance

Examples of drawing commands


you can use to draw the block
icon

The Icon & Ports pane contains the controls described in this section.

5-5
5 Simulink® Mask Editor

Drawing commands
This field allows you to enter commands that draw the block’s icon. A set of
commands is provided that can display text, one or more plots, or show a
transfer function, as described in “Mask Icon Drawing Commands”

. You must use only these commands to draw your icon. The drawing
commands are executed in the order in which they appear in this field.
Drawing commands have access to all variables in the mask workspace. If
the drawing commands cannot be successfully executed, the icon displays
three question marks.

The drawing commands are executed when you:

• Load the model


• Run or update the block diagram
• Apply any changes made in the mask parameter dialog box, either by
clicking Apply or OK.
• Apply any changes made in the Mask Editor, either by clicking Apply or
OK
• Make changes to the block diagram that affect the appearance of the block,
such as rotating the block
• Copy the masked block within the same model or between different models

Examples of drawing commands


This panel illustrates the usage of the various icon drawing commands
supported by the Simulink product. To determine the syntax of a command,
select the command from the Command list. An example of the selected
command is displayed at the bottom of the panel and the icon produced by
the command to the right of the list.

Icon & Ports options


These controls allow you to specify the following attributes of the block icon.

5-6
Icon & Ports Pane

Block Frame
The icon frame is the rectangle that encloses the block. You can choose to
show or hide the frame by setting the Frame parameter to Visible or
Invisible. The default is to make the icon frame visible. For example, this
figure shows visible and invisible icon frames for an AND gate block.

Icon Transparency
The icon can be set to Opaque or Transparent, either hiding or showing what
is underneath the icon. Opaque, the default, covers information the Simulink
software draws, such as port labels. This figure shows opaque and transparent
icons for an AND gate block. Notice the text on the transparent icon.

Icon Units
This option controls the coordinate system used by the drawing commands. It
applies only to plot and text drawing commands. You can select from among
these choices: Autoscale, Normalized, and Pixel.

• Autoscale scales the icon to fit the block frame. When the block is resized,
the icon is also resized. For example, this figure shows the icon drawn
using these vectors:

X = [0 2 3 4 9]; Y = [4 6 3 5 8];

5-7
5 Simulink® Mask Editor

The lower-left corner of the block frame is (0,3) and the upper-right corner
is (9,8). The range of the x-axis is 9 (from 0 to 9), while the range of the
y-axis is 5 (from 3 to 8).
• Normalized draws the icon within a block frame whose bottom-left corner
is (0,0) and whose top-right corner is (1,1). Only X and Y values between
0 and 1 appear. When the block is resized, the icon is also resized. For
example, this figure shows the icon drawn using these vectors:

X = [.0 .2 .3 .4 .9]; Y = [.4 .6 .3 .5 .8];

• Pixel draws the icon with X and Y values expressed in pixels. The icon
is not automatically resized when the block is resized. To force the icon to
resize with the block, define the drawing commands in terms of the block
size.

Icon Rotation
When the block is rotated or flipped, you can choose whether to rotate or flip
the icon or to have it remain fixed in its original orientation. The default is
not to rotate the icon. The icon rotation is consistent with block port rotation.
This figure shows the results of choosing Fixed and Rotates icon rotation
when the AND gate block is rotated.

5-8
Icon & Ports Pane

Port Rotation
The Icon & Ports > Port Rotation port option lets you specify a masked
block’s port rotation type. The choices are:

• default
Ports are reordered after a clockwise rotation to maintain a left-to-right
port numbering order for ports along the top and bottom of the block and
a top-to-bottom port numbering order for ports along the left and right
sides of the block.
• physical
Ports rotate with the block without being reordered after a clockwise
rotation.

The default rotation option is appropriate for control systems and other
modeling applications where block diagrams typically have a top-down and
left-right orientation. It simplifies editing of diagrams by minimizing the need
to reconnect blocks after rotations to preserve the standard orientation.

Similarly, the physical rotation option is appropriate for electronic,


mechanical, hydraulic, and other modeling applications where blocks
represent physical components and lines represent physical connections.
The physical rotation option more closely models the behavior of the devices
represented, i.e., the ports rotate with the block as they would on a physical
device. In addition, the option avoids introducing line crossings as the result
of rotations, making diagrams easier to read.

For example, the following figure shows two diagrams representing the same
transistor circuit. In one, the masked blocks representing transistors use
default rotation; in the other, physical rotation.

5-9
5 Simulink® Mask Editor

Both diagrams avoid line crossings that make diagrams harder to read. The
next figure shows the diagrams after a single clockwise rotation.

5-10
Icon & Ports Pane

Note that the rotation introduces a line crossing in the diagram that uses
default rotation but not in the diagram that uses physical rotation. Note also
that there is no way to edit the diagram with default rotation to remove the
line crossing. See “Changing a Block’s Orientation” for more information.

5-11
5 Simulink® Mask Editor

Parameters Pane
In this section...
“About the Parameters Pane” on page 5-12
“Dialog Parameters Panel” on page 5-13
“Control Types” on page 5-15
“Options for Selected Parameter Panel” on page 5-18
“Parameter Buttons” on page 5-20

About the Parameters Pane


The Parameters pane allows you to create and modify masked subsystem
parameters (mask parameters, for short) that determine the behavior of the
masked subsystem.

The Parameters pane contains the following elements:

5-12
Parameters Pane

• The Dialog parameters panel allows you to select and change the major
properties of the mask’s parameters. See “Dialog Parameters Panel” on
page 5-13 for more information.
• The Options for selected parameter panel allows you to set additional
options for the parameter selected in the Dialog parameters panel.
• The buttons on the left side of the Parameters pane allow you to add,
delete, and change the order of appearance of parameters on the mask’s
parameter dialog box. See “Dialog Parameters Panel” on page 5-13 for
more information.

Dialog Parameters Panel


Lists the mask’s parameters in tabular form. Each row displays the major
attributes of one of the mask’s parameters.

Prompt
Text that identifies the parameter on a masked subsystem’s dialog box.

Variable
Name of the variable that stores the parameter’s value in the mask’s
workspace. You can use this variable as the value of parameters of blocks
inside the masked subsystem, thereby allowing the user to set the parameters
via the mask dialog box.

5-13
5 Simulink® Mask Editor

Note The set_param and get_param commands are insensitive to case


differences in mask variable names. For example, suppose a model named
MyModel contains a masked subsystem named A that defines a mask variable
named Volume. Then, the following line of code returns the value of the
Volume parameter.

get_param('MyModel/A', 'voLUME')

However, case does matter when using a mask variable as the value of a
block parameter inside the masked subsystem. For example, suppose a
Gain block inside the masked subsystem A specifies VOLUME as the value of
its Gain parameter. This variable name does not resolve in the masked
subsystem’s workspace, as it contains a mask variable named Volume. If
the base workspace does not contain a variable named VOLUME, simulating
MyModel produces an error.

The mask variable name set by the Variable field cannot duplicate any
parameter name in or beneath the mask. Thus you cannot use any built-in
block parameter name, such as name, as a mask variable name. Violating this
requirement will cause an error when you apply changes in the Mask Editor.

Type
Type of control used to edit the value of this parameter. The control appears
on the mask’s parameter dialog box following the parameter prompt. The
button that follows the type name in the Parameters pane pops up a list of
supported commands To change the current control type, select another type
from the list. See “Control Types” on page 5-15 for more information.

Evaluate
Simulink can use the value of a mask parameter as the user enters it in the
Mask Parameters dialog box, or it can evaluate what the user specifies and
use the result of the evaluation. Select the parameter’s Evaluate option in
the Dialog parameters table to specify parameter evaluation (the default)
or clear the option to suppress evaluation. The effect of the Evaluate option
depends on the control type, as shown in “Control Types” on page 5-15.

5-14
Parameters Pane

If checked, this option causes the Simulink software to evaluate the expression
entered by the user before it is assigned to the variable. Otherwise, the
expression itself is treated as a string value and is assigned to the variable.
For example, if the user enters the expression gain in an edit field and the
Evaluate option is checked, gain is evaluated and the result is assigned to
the variable. Otherwise, the string 'gain' is assigned to the variable. See
“Check Box Control” on page 5-17 and “Pop-Up Control” on page 5-17 for
information about how this option affects evaluation of the parameters.

If you need both the string entered and the evaluated value, clear the
Evaluate option. To get the value of a base workspace variable entered as
the literal value of the mask parameter, use the MATLAB evalin command
in the mask initialization code. For example, suppose the user enters the
string 'gain' as the literal value of the mask parameter k where gain is the
name of a base workspace variable. To obtain the value of the base workspace
variable, use the following command in the mask’s initialization code:

value = evalin('base', k)

Tunable
Select the parameter’s Tunable option in the Mask Parameters dialog box
to specify that the value of the parameter can be changed during simulation
(the default) or clear the option to specify that the parameter value cannot be
changed. If the masked block does not support parameter tuning, Simulink
ignores the setting of a mask parameter’s Tunable option. See “Changing
the Values of Block Parameters During Simulation” for information about
parameter tuning and the blocks that support it.

Control Types
You can choose how parameter values are entered or selected. You can create
three styles of controls: edit fields, check boxes, and pop-up controls. To
specify the type of control that the Mask Parameters dialog box provides for
a mask parameter, set the parameter’s Type pulldown to edit, checkbox,
or popup:

• An edit control enables the user to enter a parameter value by typing it


into a field.

5-15
5 Simulink® Mask Editor

• A check box control enables the user to choose between two alternatives by
selecting or deselecting a check box.
• A pop-up control enables the user to choose a parameter value from a list of
possible values.

For example, this figure shows the Parameters pane of a Mask Parameters
dialog box that uses all three types of controls, with the pop-up control open
to show its possible values:

Edit Control
An edit field enables the user to enter a parameter value by typing it into
a field. This figure shows how the prompt for the sample edit control was
defined.

The value of the variable associated with the parameter is determined by


the Evaluate option.

Edit Control Evaluation

Evaluation Edit Control Parameter Value


On The result of evaluating the expression entered in the field
Off The literal string entered in the field

5-16
Parameters Pane

Check Box Control


A check box enables the user to choose between two alternatives by selecting
or deselecting a check box. This figure shows how the sample check box
control is defined.

The value of the variable associated with the parameter depends on whether
the Evaluate option is selected.

Check Box Evaluation

Check Box
Parameter
Evaluation State Check Box Parameter Value
On Selected 1
Cleared 'on'
Off Selected 0
Cleared 'off'

Pop-Up Control
A pop-up enables the user to choose a parameter value from a list of possible
values. When you define a Pop-Up control, you must specify the values that
the control presents to the user in the Mask Parameters dialog box. To specify
the values, select the parameter in the Dialog parameters table, then enter
the values in the Popups field of the Options for selected parameter
pane below the table. The next figure shows a pop-up control definition

5-17
5 Simulink® Mask Editor

The value of the variable associated with the parameter (Color) depends
on the item selected from the pop-up list and whether the Evaluate option
is checked (on).

Pop-Up Evaluation

Evaluation Pop-Up Parameter Value


On The index of the value selected from the list, starting
with 1. For example, if the third item is selected, the
parameter value is 3.
Off The literal string that is the value selected, as it appears
in the Mask Editor Popups field and the corresponding
Mask Parameters dialog box pulldown.

Options for Selected Parameter Panel


This panel allows you to set additional options for the parameter selected in
the Dialog parameters table.

Show parameter
The selected parameter appears on the masked block’s parameter dialog box
only if this option is checked (the default).

5-18
Parameters Pane

Enable parameter
Clearing this option grays the selected parameter’s prompt and disables its
edit control. This means that the user cannot set the value of the parameter.

Popups
This field is enabled only if the edit control for the selected parameter is a
pop-up. Enter the values of the pop-up control in this field, each on a separate
line.

Callback
Enter the MATLAB code that you want the Simulink software to execute
when a user applies a change to the selected parameter by selecting the
Apply or OK button on the mask dialog box. You can use such callbacks to
create dialogs whose appearance changes, depending on changes to control
settings made by the user, such as enabling an edit field when a user checks
a check box.

Note Callbacks are not intended to be used to alter the contents of a masked
subsystem. Altering a masked subsystem’s contents in a callback, for example
by adding or deleting blocks or changing block parameter values, can trigger
errors during model update or simulation. If you need to modify the contents
of a masked subsystem, use the mask’s initialization code to perform the
modifications. See “Initialization Pane” on page 5-22 for more information.

The callback can create and reference variables only in the block workspace.
If the callback needs the value of a mask parameter, it can use get_param to
obtain the value, for example:

if str2num(get_param(gcb, 'g'))<0
error('Gain is negative.')
end

The Simulink software executes the callback commands when you

• Open the mask parameter dialog box. Callback commands execute top
down, starting with the top mask dialog parameter

5-19
5 Simulink® Mask Editor

• Modify a parameter value in the mask parameter dialog box then change
the cursor’s focus by pressing the Tab key or clicking into another field
in the dialog

Note The callback commands are not executed when the parameter value
is modified using the set_param command.

• Modify the parameter value, either in the mask parameter dialog box or via
a call to set_param, than apply the change by clicking Apply or OK. Any
mask initialization commands execute after the callback commands. See
“Initialization Pane” on page 5-22 for more information.
• Cancel any applied changes made in the mask dialog box by clicking
Cancel.
• Hover over the masked block to see the block’s data tip, when the data tip
contains parameter names and values. The callback executes again when
the block data tip disappears.

Note The callback commands do not execute if the mask dialog box is
open when the block data tip appears.

Parameter Buttons
This table explains the purpose of the buttons that appear on the Parameters
pane in the order of their appearance from the top of the pane.

Click this button... To perform this action...


Add a new mask parameter. An
Add empty parameter appears in the
adjacent Dialog parameters table:
If an existing parameter is selected,
the new parameter appears below
the selected parameter.

5-20
Parameters Pane

Click this button... To perform this action...


Delete the parameter that is
Delete currently selected in the Dialog
parameters table.
Move the currently selected
Up parameter up one row in the Dialog
parameters table. The prompt for
this parameter moves up one slot in
the Mask Parameters dialog box.
Move the currently selected
Down parameter down one row in
the Dialog parameters table.
The prompt for this parameter
moves down one slot in the Mask
Parameters dialog box.

For example, this figure shows the result of clicking the Add button to create
the first parameter defined by a mask:

Add

New parameter

5-21
5 Simulink® Mask Editor

Initialization Pane
In this section...
“About the Initialization Pane” on page 5-22
“Dialog variables” on page 5-23
“Initialization commands” on page 5-24
“Allow library block to modify its contents” on page 5-24
“Initialization Command Limitations” on page 5-24

About the Initialization Pane


The Initialization pane allows you to enter MATLAB commands that
initialize the masked subsystem.

When you open a model, initialization commands execute for all masked
blocks that are visible because they reside at the top level of the model or in

5-22
Initialization Pane

an open subsystem. Initialization commands for masked blocks that are not
initially visible execute when you open the subsystem or model that contains
the blocks.

When you load a model into memory without displaying the model graphically,
no initialization commands initially run for any masked blocks. See “Loading
a Model” and load_system for information about loading a model without
displaying it.

Initialization commands for all masked blocks in a model run when you:

• Update the diagram


• Start simulation
• Start code generation.

Initialization commands for an individual masked block run when you:

• Change any of the parameters that define the mask, such as MaskDisplay
and MaskInitialization, by using the Mask Editor or set_param.
• Change the appearance of the masked block, for example by resizing or
rotating the block.
• Change the value of a mask parameter by using the block dialog or
set_param.
• Copy the masked block within the same model or between different models.

The Initialization pane contains the controls described in this section.

Dialog variables
The Dialog variables list displays the names of the variables associated
with the subsystem’s mask parameters, which are defined in the Parameters
pane. You can copy the name of a parameter from this list and paste it into
the adjacent Initialization commands field, using the Simulink keyboard
copy and paste commands. You can also use the list to change the names of
mask parameter variables. To change a name, double-click the name in the
list. An edit field containing the existing name appears. Edit the existing
name and press Enter or click outside the edit field to confirm your changes.

5-23
5 Simulink® Mask Editor

Initialization commands
Enter the initialization commands in this field. You can enter any valid
MATLAB expression, consisting of MATLAB functions and scripts, operators,
and variables defined in the mask workspace. Initialization commands run
in the mask workspace, not the base workspace. Terminate initialization
commands with a semicolon to avoid echoing results to the MATLAB
Command Window.

Allow library block to modify its contents


This check box is enabled only if the masked subsystem resides in a library.
Checking this option allows the block’s initialization code to modify the
contents of the masked subsystem by adding or deleting blocks and setting
the parameters of those blocks. Otherwise, an error is generated when a
masked library block tries to modify its contents in any way. To set this
option at the MATLAB prompt, select the self-modifying block and enter
the following command.

set_param(gcb, 'MaskSelfModifiable', 'on');

Then save the block.

Initialization Command Limitations


Mask initialization commands must observe the following rules:

• Do not use initialization code to create mask dialogs whose appearance


or control settings change depending on changes made to other control
settings. Instead, use the mask callbacks provided specifically for this
purpose.
• Avoid prefacing variable names in initialization commands with L_ and M_
to prevent undesirable results. These specific prefixes are reserved for
use with internal variable names.
• Avoid using set_param commands to set parameters of blocks residing in
masked subsystems that reside in the masked subsystem being initialized.
See “Setting Nested Masked Block Parameters”for details.

5-24
Documentation Pane

Documentation Pane
In this section...
“About the Documentation Pane” on page 5-25
“Mask Type Field” on page 5-26
“Mask Description Field” on page 5-26
“Mask Help Field” on page 5-26

About the Documentation Pane


The Documentation pane enables you to define or modify the type,
description, and help text for a masked block.

The next figure shows the relationship between the values in the
Documentation pane and the appearance of the corresponding Mask
Parameters dialog box and Online Help window.

5-25
5 Simulink® Mask Editor

Mask Type Field


The mask type is a block classification that appears in the masked block’s
Mask Parameters dialog box and on all Mask Editor panes for the block.
When Simulink displays a masked block’s Mask Parameters dialog box, it
suffixes (mask) to the mask type. To define the mask type, enter it in the
Mask type field. The text can contain any legal MATLAB character, but
cannot contain line breaks.

Mask Description Field


The mask description is summary Help text that describe the block’s purpose
or function. The description appears in the masked block’s Mask Parameters
dialog box under the mask type. To define the mask description, enter it
in the Mask description field. The text can contain any legal MATLAB
character. Simulink automatically wraps long lines. You can force line breaks
by using the Enter or Return key.

Mask Help Field


A masked block’s Online Help provides information in addition to that
provided by the block’s Mask type and Mask description fields. This
information appears in a separate window when the user clicks the Help
button on the masked block’s Mask Parameters dialog box. To define the
mask help, enter one of the following in the Mask help field.

• URL specification
• web or eval command
• Literal or HTML text

Providing a URL
If the first line of the Mask help field is a URL, Simulink passes the URL
to your default web browser. The URL can begin with http:, www:, file:,
ftp:, or mailto:. Examples:

http://www.mathworks.com
file:///c:/mydir/helpdoc.html

5-26
Documentation Pane

Once the browser is active, MATLAB and Simulink have no further control
over its actions.

Providing a web Command


If the first line of the Mask help field is a web command, Simulink passes the
command to MATLAB, which displays the specified file in the MATLAB Web
Browser or the MATLAB Online Help browser. Example:

web([docroot '/MyBlockDoc/' get_param(gcb,'MaskType') '.html'])


web('hello.html', '-helpbrowser')

See the MATLAB web command documentation for details. A web command
used for mask help cannot return values.

Providing an eval Command


If the first line of the Mask help field is an eval command, Simulink passes
the command to MATLAB, which performs the specified evaluation. Example:

eval('!Word My_Spec.doc')

See the MATLAB eval command documentation for details. An eval


command used for mask help cannot return values.

Providing Literal or HTML Text


If the first line of the Mask help field is not a URL, or a web or eval
command, Simulink displays the text in the MATLAB Online Help browser
under a heading that is the value of the Mask type field. The text can contain
any legal MATLAB character, line breaks, and any standard HTML tag,
including tags like img that display images.

Simulink first copies the text to a temporary directory, then displays the
text using the web command. If you want the text to display an image, you
can provide a URL path to the image file, or you can place the image file in
the temporary directory. Use tempdir to find the temporary directory that
Simulink uses for your system.

5-27

You might also like