Perform discrete-time integration or accumulation of signal
Discrete
You can use the Discrete-Time Integrator block in place of the Integrator block to create a purely discrete system. With the Discrete-Time Integrator block, you can:
Define initial conditions on the block dialog box or as input to the block.
Define an input gain (K) value.
Output the block state.
Define upper and lower limits on the integral.
Reset the state depending on an additional reset input.
The block starts from the first time step, n = 0
,
with either initial output y(0) = IC
or initial
state x(0) = IC
, depending on the Initial
condition setting parameter value.
For a given step n > 0
with simulation
time t(n)
, Simulink^{®} updates output y(n)
as
follows:
Forward Euler method:
y(n) = y(n-1) + K*[t(n)-t(n-1)]*u(n-1)
Backward Euler method:
y(n) = y(n-1) + K*[t(n)-t(n-1)]*u(n)
Trapezoidal method:
y(n) = y(n-1) + K*[t(n)-t(n-1)]*[u(n)+u(n-1)]/2
Simulink automatically selects a state-space realization
of these output equations depending on the block sample time, which
can be explicit or triggered. When using explicit sample time, t(n)-t(n-1)
reduces
to the sample time T
for all n > 0
.
For more information on these methods, see Integration and Accumulation Methods.
The block can integrate or accumulate using the forward Euler,
backward Euler, and trapezoidal methods. Assume that u
is
the input, y
is the output, and x
is
the state. For a given step n
, Simulink updates y(n)
and x(n+1)
.
In integration mode, T
is the block sample time
(delta T
in the case of triggered sample time).
In accumulation mode, T = 1
. The block sample time
determines when the output is computed but not the output value. K
is
the gain value. Values clip according to upper or lower limits.
Forward Euler method (default), also known as forward rectangular, or left-hand approximation
For this method, the software approximates 1/s
as T/(z-1)
.
The expressions for the output of the block at step n
are:
x(n+1) = x(n) + K*T*u(n) y(n) = x(n)
The block uses the following steps to compute the output:
Step 0: y(0) = IC (clip if necessary) x(1) = y(0) + K*T*u(0) Step 1: y(1) = x(1) x(2) = x(1) + K*T*u(1) Step n: y(n) = x(n) x(n+1) = x(n) + K*T*u(n) (clip if necessary)
Using this method, input port 1 does not have direct feedthrough.
Backward Euler method, also known as backward rectangular or right-hand approximation
For this method, the software approximates 1/s
as T*z/(z-1)
.
The resulting expression for the output of the block at step n
is
y(n) = y(n-1) + K*T*u(n).
Let x(n) = y((n)-1)
. The block uses these
steps to compute the output.
If the parameter Initial condition setting is
set to Output
:
Step 0: y(0) = IC (clipped if necessary) x(1) = y(0)
If the parameter Initial condition setting is
set to State (most efficient)
:
Step 0: x(0) = IC (clipped if necessary) x(1) = y(0) = x(0) + K*T*u(0) Step 1: y(1) = x(1) + K*T*u(1) x(2) = y(1) Step n: y(n) = x(n) + K*T*u(n) x(n+1) = y(n)
Using this method, input port 1 has direct feedthrough.
Trapezoidal method
For this method, the software approximates 1/s
as T/2*(z+1)/(z-1)
.
When T
is fixed (equal to the sampling period),
the expressions to compute the output are:
x(n) = y(n-1) + K*T/2 * u(n-1) y(n) = x(n) + K*T/2*u(n)
If the Initial condition setting parameter
is set to Output
:
Step 0: y(0) = IC (clipped if necessary) x(1) = y(0) + K*T/2*u(0)
If the Initial condition setting parameter
is set to State (most efficient)
:
Step 0: x(0) = IC (clipped if necessary) y(0) = x(0) + K*T/2*u(0) x(1) = y(0) + K*T/2*u(0) Step 1: y(1) = x(1) + K*T/2*u(1) x(2) = y(1) + K*T/2*u(1) Step n: y(n) = x(n) + K*T/2*u(n) x(n+1) = y(n) + K*T/2*u(n)
Here, x(n+1)
is the best estimate of the
next output. It is not the same as the state, in that x(n)
is
not equal to y(n)
.
If T
is variable (for example, obtained from
the triggering times), the block uses these steps to compute the output.
If the Initial condition setting parameter
is set to Output
:
Step 0: y(0) = IC (clipped if necessary) x(1) = y(0)
If the Initial condition setting parameter
is set to State (most efficient)
:
Step 0: x(0) = IC (clipped if necessary) x(1) = y(0) = x(0) + K*T/2*u(0) Step 1: y(1) = x(1) + T/2*(u(1) + u(0)) x(2) = y(1) Step n: y(n) = x(n) + T/2*(u(n) + u(n-1)) x(n+1) = y(n)
Using this method, input port 1 has direct feedthrough.
You can define the initial conditions as a parameter on the block dialog box or input them from an external signal:
To define the initial conditions as a block parameter,
set the Initial condition source parameter to internal
and
enter the value in the Initial condition text
box.
To provide the initial conditions from an external
source, set the Initial condition source parameter
to external
. An additional input port appears on
the block.
Use the state port instead of the output port:
When
the output of the block is fed back into the block through the reset
port or the initial condition port, causing an algebraic loop. For
an example, see the sldemo_bounce_two_integrators
model.
When you want to pass the state from one conditionally
executed subsystem to another, which can cause timing problems. For
an example, see the sldemo_clutch
model.
You can work around these problems by passing the state through the state port rather than the output port. Simulink generates the state at a slightly different time from the output, which protects your model from these problems. To output the block state, select the Show state port check box. The state port appears on the top of the block
To keep the output within certain levels, select the Limit output check box and enter the limits in the corresponding text box. Doing so causes the block to function as a limited integrator. When the output reaches the limits, the integral action turns off to prevent integral windup. During a simulation, you can change the limits but you cannot change whether the output is limited. The table shows how the block determines output.
Integral | Output |
---|---|
Less than or equal to the Lower saturation limit and the input is negative | Held at the Lower saturation limit |
Between the Lower saturation limit and the Upper saturation limit | The integral |
Greater than or equal to the Upper saturation limit and the input is positive | Held at the Upper saturation limit |
To generate a signal that indicates when the state is being limited, select the Show saturation port check box. A new saturation port appears below the block output port:
The signal has one of three values:
1 indicates that the upper limit is being applied.
0 indicates that the integral is not limited.
-1 indicates that the lower limit is being applied.
The block can reset its state to the initial condition you specify, based on an external signal. To cause the block to reset its state, select one of the External reset parameter options. A reset port appears that indicates the reset trigger type:
The reset port has direct feedthrough. If the block output feeds back into this port, either directly or through a series of blocks with direct feedthrough, an algebraic loop results. To resolve this loop, feed the output of the block state port into the reset port instead. To access the block state, select the Show state port check box.
The External reset parameter lets you determine the attribute of the reset signal that triggers the reset. The trigger options include:
rising
– Resets
the state when the reset signal has a rising edge. For example, this
figure shows the effect that a rising reset trigger has on backward
Euler integration.
falling
– Resets
the state when the reset signal has a falling edge. For example, this
figure shows the effect that a falling reset trigger has on backward
Euler integration.
either
– Resets
the state when the reset signal rises or falls. For example, the following
figure shows the effect that an either reset trigger has on backward
Euler integration.
level
– Resets and
holds the output to the initial condition while the reset signal is
nonzero. For example, this figure shows the effect that a level reset
trigger has on backward Euler integration.
sampled level
–
Resets the output to the initial condition when the reset signal is
nonzero. For example, this figure shows the effect that a sampled
level reset trigger has on backward Euler integration.
The sampled level
reset option requires
fewer computations, making it more efficient than the level
reset
option. However, the sampled level
reset
option can introduce a discontinuity when integration resumes.
Note: For the discrete-time integrator block, all trigger detections are based on signals with positive values. For example, a signal changing from -1 to 0 is not considered a rising edge, but a signal changing from 0 to 1 is. |
Simplified initialization mode is enabled when you set Configuration Parameters > All
Parameters > Underspecified initialization
detection to Simplified
.
If you use simplified initialization mode, the behavior of the Discrete-Time
Integrator block differs from classic initialization mode. The new
initialization behavior is more robust and provides more consistent
behavior in these cases:
In algebraic loops
On enable and disable
When comparing results using triggered sample time against explicit sample time, where the block is triggered at the same rate as the explicit sample time
Simplified initialization mode enables easier conversion from Continuous-Time Integrator blocks to Discrete-Time Integrator blocks, because the initial conditions have the same meaning for both blocks.
For more information on classic and simplified initialization modes, see Underspecified initialization detection.
When you use simplified initialization mode with Initial
condition setting set to Output
,
the enable and disable behavior of the block is simplified as follows:
At disable time t_{d}
:
y(t_{d}) = y(t_{d}-1)
At enable time t_{e}
:
If the parent subsystem control port has States
when enabling set to reset
:
y(t_{e}) = IC.
If the parent subsystem control port has States
when enabling set to held
:
y(t_{e}) = y(t_{d}).
The following figure shows this condition.
When using simplified initialization mode, you cannot place the Discrete-Time Integrator block in an Iterator Subsystem.
In simplified initialization mode, Iterator subsystems do not maintain elapsed time. Thus, if a Discrete-Time Integrator block, which needs elapsed time, is placed inside an Iterator Subsystem block, Simulink reports an error.
Simulink does not support model simulation when all the following conditions are true:
A Discrete-Time Integrator block is placed within a triggered subsystem or a function-call subsystem.
The block's Initial condition setting parameter
is set to State (most efficient)
.
Simplified initialization mode is enabled.
Suppose that you have a function-call subsystem that contains an enabled subsystem, which contains a Discrete-Time Integrator block. The following behavior applies.
Integrator Method | Sample Time Type of Function-Call Trigger Port | Value of delta T When Function-Call
Subsystem Executes for the First Time After Enabled | Reason for Behavior |
---|---|---|---|
Forward Euler | Triggered |
| When the function-call subsystem executes for the first
time, the integrator algorithm uses |
Backward Euler and Trapezoidal | Triggered |
| When the function-call subsystem executes for the first
time, the integrator algorithm uses |
Forward Euler, Backward Euler, and Trapezoidal | Periodic | Sample time of the function-call generator | In periodic mode, the Discrete-Time Integrator block
uses sample time of the function-call generator for |
The Discrete-Time Integrator block accepts real signals of the following data types:
Floating point
Built-in integer
Fixed point
For more information, see Data Types Supported by Simulink in the Simulink documentation.
During simulation, the block uses the following values:
The initial value of the signal object to which the state name is resolved
Min
and Max
values
of the signal object
For more information, see Discrete Block State Naming in Generated Code (Simulink Coder) in the Simulink Coder™ documentation.
Display the Data Type Assistant.
The Data Type Assistant helps you set the Output data type parameter.
For more information, see Control Signal Data Types.
Specify the integration or accumulation method.
Default: Integration:
Forward Euler
Integration: Forward Euler
Integrator method is Forward Euler.
Integration: Backward Euler
Integrator method is Backward Euler.
Integration: Trapezoidal
Integrator method is Trapezoidal.
Accumulation: Forward Euler
Accumulation method is Forward Euler.
Accumulation: Backward Euler
Accumulation method is Backward Euler.
Accumulation: Trapezoidal
Accumulation method is Trapezoidal.
Parameter: IntegratorMethod |
Type: character vector |
Value: 'Integration:
Forward Euler' | 'Integration: Backward Euler' | 'Integration:
Trapezoidal' | 'Accumulation: Forward Euler' | 'Accumulation:
Backward Euler' | 'Accumulation: Trapezoidal' |
Default: 'Integration:
Forward Euler' |
Specify a scalar, vector, or matrix by which to multiply the integrator input. Each element of the gain must be a positive real number.
Default: 1.0
Specifying a value other than 1.0 (the default) is semantically equivalent to connecting a Gain block to the input of the integrator.
Valid entries include:
double(1.0)
single(1.0)
[1.1 2.2 3.3 4.4]
[1.1 2.2; 3.3 4.4]
Using this parameter to specify the input gain eliminates a multiplication operation in the generated code. However, this parameter must be nontunable to realize this benefit. If you want to tune the input gain, set this parameter to 1.0 and use an external Gain block to specify the input gain.
Parameter: gainval |
Type: character vector |
Value: '1.0' |
Default: '1.0' |
Reset the states to their initial conditions when a trigger event occurs in the reset signal.
Default: none
none
Do not reset the state to initial conditions.
rising
Reset the state when the reset signal has a rising edge.
falling
Reset the state when the reset signal has a falling edge.
either
Reset the state when the reset signal rises or falls.
level
Reset and holds the output to the initial condition while the reset signal is nonzero.
sampled level
Reset the output to the initial condition when the reset signal is nonzero.
Parameter: ExternalReset |
Type: character vector |
Value: 'none' | 'rising' | 'falling' | 'either' | 'level' | 'sampled
level' |
Default: 'none' |
Get the initial conditions of the states.
Default: internal
internal
Get the initial conditions of the states from the Initial condition parameter.
external
Get the initial conditions of the states from an external block.
Simulink software does not allow the initial condition
of this block to be inf
or NaN
.
Selecting internal
enables the Initial
condition parameter.
Selecting external
disables the Initial
condition parameter.
Parameter: InitialConditionSource |
Type: character vector |
Value: 'internal' | 'external' |
Default: 'internal' |
Specify the states' initial conditions.
Default: 0
Minimum: value of Output minimum parameter
Maximum: value of Output maximum parameter
Simulink software does not allow the initial condition
of this block to be inf
or NaN
.
Setting Initial condition source to internal
enables
this parameter.
Setting Initial condition source to external
disables
this parameter.
Parameter: InitialCondition |
Type: scalar or vector |
Value: '0' |
Default: '0' |
Specify whether to apply the Initial condition parameter to the block state or output. This initial condition is also used as the reset value. This parameter was named Use initial condition as initial and reset value for in Simulink before R2014a.
Default: State
(most efficient)
State (most efficient)
Use this option in all situations except when the block is in a triggered subsystem or a function-call subsystem and Integrator method is set to an integration method.
Set the following initial conditions:
x(0) = IC
At reset:
x(n) = IC
Output
Use this option when the block is in a triggered subsystem or a function-call subsystem and Integrator method is set to an integration method.
Set the following initial conditions:
y(0) = IC
At reset:
y(n) = IC
Compatibility
This option is present to provide backward compatibility. You cannot select this option for Discrete-Time Integrator blocks in Simulink models but you can select it for Discrete-Time Integrator blocks in a library. Use this option to maintain compatibility with Simulink models created before R2014a.
Prior to R2014a, the option State (most efficient)
was
known as State only (most efficient)
. The
option Output
was known as State
and output
. The behavior of the block with the option Compatibility
is
as follows.
If Configuration Parameters > All Parameters > Underspecified
initialization detection is set to Classic
,
the Initial condition setting parameter behaves
as State (most efficient)
.
If Configuration Parameters > All Parameters > Underspecified
initialization detection is set to Simplified
,
the Initial condition setting parameter behaves
as Output
.
Parameter: InitialConditionSetting |
Type: character vector |
Value: 'State (most
efficient)' | 'Output' | 'Compatibilty' |
Default: 'Output' |
Enter the discrete interval between sample time hits.
Default: 1
By default, the block uses a discrete sample time of 1. To set a different sample time, enter another discrete value, such as 0.1.
See also Specify Sample Time in the online documentation for more information.
Do not specify a sample time of 0. This value specifies a continuous sample time, which the Discrete-Time Integrator block does not support.
Do not specify a sample time of inf
or NaN
because
these values are not discrete.
If you specify -1 to inherit the sample time from an upstream block, verify that the upstream block uses a discrete sample time. For example, the Discrete-Time Integrator block cannot inherit a sample time of 0.
Parameter: SampleTime |
Type: character vector |
Value: '1' |
Default: '1' |
Limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.
Default: Off
Limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.
Do not limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.
This parameter enables Upper saturation limit.
This parameter enables Lower saturation limit.
Parameter: LimitOutput |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Specify the upper limit for the integral.
Default: inf
Minimum: value of Output minimum parameter
Maximum: value of Output maximum parameter
Limit output enables this parameter.
Parameter: UpperSaturationLimit |
Type: scalar or vector |
Value: 'inf' |
Default: 'inf' |
Specify the lower limit for the integral.
Default: -inf
Minimum: value of Output minimum parameter
Maximum: value of Output maximum parameter
Limit output enables this parameter.
Parameter: LowerSaturationLimit |
Type: scalar or vector |
Value: '-inf' |
Default: '-inf' |
Add a saturation output port to the block.
Default: Off
Add a saturation output port to the block.
Do not add a saturation output port to the block.
Parameter: ShowSaturationPort |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Add an output port to the block for the block's state.
Default: Off
Add an output port to the block for the block's state.
Do not add an output port to the block for the block's state.
Parameter: ShowStatePort |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Cause Simulink linearization commands to treat this block as not resettable and as having no limits on its output, regardless of the settings of the block reset and output limitation options.
Default: Off
Cause Simulink linearization commands to treat this block as not resettable and as having no limits on its output, regardless of the settings of the block reset and output limitation options.
Do not cause Simulink linearization commands to treat this block as not resettable and as having no limits on its output, regardless of the settings of the block reset and output limitation options.
Ignoring the limit and resetting allows you to linearize a model around an operating point. This point may cause the integrator to reset or saturate.
Parameter: IgnoreLimit |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.
Default: Off
Locks the output data type setting for this block.
Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.
Parameter: LockScale |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
For more information, see Use Lock Output Data Type Setting (Fixed-Point Designer).
Specify the rounding mode for fixed-point operations.
Default: Floor
Ceiling
Rounds both positive and negative numbers toward positive infinity.
Equivalent to the MATLAB^{®} ceil
function.
Convergent
Rounds number to the nearest representable value. If a tie occurs,
rounds to the nearest even integer. Equivalent to the Fixed-Point Designer™ convergent
function.
Floor
Rounds both positive and negative numbers toward negative infinity.
Equivalent to the MATLAB floor
function.
Nearest
Rounds number to the nearest representable value. If a tie occurs,
rounds toward positive infinity. Equivalent to the Fixed-Point Designer nearest
function.
Round
Rounds number to the nearest representable value. If a tie occurs,
rounds positive numbers toward positive infinity and rounds negative
numbers toward negative infinity. Equivalent to the Fixed-Point Designer round
function.
Simplest
Automatically chooses between round toward floor and round toward zero to generate rounding code that is as efficient as possible.
Zero
Rounds number toward zero. Equivalent to the MATLAB fix
function.
Parameter: RndMeth |
Type: character vector |
Value: 'Ceiling' | 'Convergent' | 'Floor' | 'Nearest' | 'Round' | 'Simplest' | 'Zero' |
Default: 'Floor' |
For more information, see Rounding (Fixed-Point Designer) in the Fixed-Point Designer documentation.
Specify whether overflows saturate.
Default: Off
Overflows saturate to either the minimum or maximum value that the data type can represent.
For example, an overflow associated with a signed 8-bit integer can saturate to -128 or 127.
Overflows wrap to the appropriate value that the data type can represent.
For example, the number 130 does not fit in a signed 8-bit integer and wraps to -126.
Consider selecting this check box when your model has a possible overflow and you want explicit saturation protection in the generated code.
Consider clearing this check box when you want to optimize efficiency of your generated code.
Clearing this check box also helps you to avoid overspecifying how a block handles out-of-range signals. For more information, see Check for Signal Range Errors.
When you select this check box, saturation applies to every internal operation on the block, not just the output or result.
In general, the code generation process can detect when overflow is not possible. In this case, the code generator does not produce saturation code.
Parameter: SaturateOnIntegerOverflow |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Use this parameter to assign a unique name to each state.
Default: ' '
If left blank, no name is assigned.
A valid identifier starts with an alphabetic or underscore character, followed by alphanumeric or underscore characters.
The state name applies only to the selected block.
This parameter enables State name must resolve to Simulink signal object when you click the Apply button.
For more information, see Discrete Block State Naming in Generated Code (Simulink Coder).
Parameter: StateIdentifier |
Type: character vector |
Value: ' ' |
Default: ' ' |
Require that state name resolve to Simulink signal object.
Default: Off
Require that state name resolve to Simulink signal object.
Do not require that state name resolve to Simulink signal object.
State name enables this parameter. This
parameter appears only if you set the model configuration parameter Signal
resolution to a value other than None
.
Selecting this check box disables Code generation storage class.
Parameter: StateMustResolveToSignalObject |
Type: character vector |
Value: 'off' | 'on' |
Default: 'off' |
Choose a custom storage class package by selecting a signal
object class that the target package defines. For example, to apply
custom storage classes from the built-in package mpt
,
select mpt.Signal
. Unless you use an ERT-based
code generation target with Embedded Coder^{®}, custom storage classes
do not affect the generated code.
To programmatically set this parameter, use StateSignalObject
.
For examples and more information about storage classes, see Control Signals and States in Code by Applying Storage Classes (Simulink Coder). For information about custom storage classes, see Control Data Representation by Applying Custom Storage Classes (Embedded Coder).
Simulink.Signal
Use custom storage classes from the built-in package Simulink
.
Package
.Class
Use custom storage classes from the package that defines the class that you select.
If the class that you want does not appear in the list, select Customize
class lists
. For instructions, see Apply Custom Storage Classes Directly to Signal Lines, Block
States, and Outport Blocks (Embedded Coder).
Select state storage class for code generation.
Default: Auto
Auto
Auto
is the appropriate storage class for
states that you do not need to interface to external code.
StorageClass
Applies the storage class or custom storage class that you select from the list. For information about storage classes, see Control Signals and States in Code by Applying Storage Classes (Simulink Coder). For information about custom storage classes, see Control Data Representation by Applying Custom Storage Classes (Embedded Coder).
Use Signal object class to select custom
storage classes from a package other than Simulink
.
State name enables this parameter.
Command-Line Information
Parameter: StateStorageClass |
Type: character vector |
Value: 'Auto' | 'ExportedGlobal' | 'ImportedExtern' | 'ImportedExternPointer' | 'SimulinkGlobal' | 'Custom' |
Default: 'Auto' |
Select state storage class for code generation.
Default: Auto
Auto
Auto
is the appropriate storage class for
states that you do not need to interface to external code.
StorageClass
Applies the storage class or custom storage class that you select from the list. For information about storage classes, see Control Signals and States in Code by Applying Storage Classes (Simulink Coder). For information about custom storage classes, see Control Data Representation by Applying Custom Storage Classes (Embedded Coder).
Use Signal object class to select custom
storage classes from a package other than Simulink
.
State name enables this parameter.
Note: TypeQualifier will be removed in a future release. To apply storage type qualifiers to data, use custom storage classes and memory sections. Unless you use an ERT-based code generation target with Embedded Coder, custom storage classes and memory sections do not affect the generated code. |
Specify a storage type qualifier such as const
or volatile
.
Default: '
'
(empty character vector)
const
volatile
Setting Code generation storage class to ExportedGlobal
, ImportedExtern
, ImportedExternPointer
,
or SimulinkGlobal
enables this parameter.
This parameter is hidden unless you previously set its value.
Parameter Name: RTWStateStorageTypeQualifier |
Value Type: character vector |
Default: ' ' (empty
character vector) |
Lower value of the output range that Simulink checks.
Default: []
(unspecified)
Specify this number as a finite, real, double, scalar value.
Simulink uses the minimum to perform:
Parameter range checking (see Specify Minimum and Maximum Values for Block Parameters) for some blocks.
Simulation range checking (see Signal Ranges and Enable Simulation Range Checking).
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values.
Note: Output minimum does not saturate or clip the actual output signal. Use the Saturation block instead. |
Parameter: OutMin |
Type: character vector |
Value: '[ ]' |
Default: '[ ]' |
Upper value of the output range that Simulink checks.
Default: []
(unspecified)
Specify this number as a finite, real, double, scalar value.
Simulink uses the maximum value to perform:
Parameter range checking (see Specify Minimum and Maximum Values for Block Parameters) for some blocks.
Simulation range checking (see Signal Ranges and Enable Simulation Range Checking).
Automatic scaling of fixed-point data types.
Optimization of the code that you generate from the model. This optimization can remove algorithmic code and affect the results of some simulation modes such as SIL or external mode. For more information, see Optimize using the specified minimum and maximum values.
Note: Output maximum does not saturate or clip the actual output signal. Use the Saturation block instead. |
Parameter: OutMax |
Type: character vector |
Value: '[ ]' |
Default: '[ ]' |
Specify the output data type.
Default: Inherit:
Inherit via internal rule
Inherit: Inherit via internal rule
Simulink chooses a data type to balance numerical accuracy, performance, and generated code size, while taking into account the properties of the embedded target hardware. If you change the embedded target settings, the data type selected by the internal rule might change. It is not always possible for the software to optimize code efficiency and numerical accuracy at the same time. If the internal rule doesn't meet your specific needs for numerical accuracy or performance, use one of the following options:
Specify the output data type explicitly.
Explicitly specify a default data type such as fixdt(1,32,16)
and
then use the Fixed-Point Tool to propose data types for your model.
For more information, see fxptdlg
.
To specify your own inheritance rule, use Inherit:
Inherit via back propagation
and then use a Data Type Propagation block. Examples
of how to use this block are available in the Signal Attributes library Data
Type Propagation Examples block.
Inherit: Inherit via back propagation
Use data type of the driving block.
double
Output data type is double
.
single
Output data type is single
.
int8
Output data type is int8
.
uint8
Output data type is uint8
.
int16
Output data type is int16
.
uint16
Output data type is uint16
.
int32
Output data type is int32
.
uint32
Output data type is uint32
.
fixdt(1,16,0)
Output data type is fixed point fixdt(1,16,0)
.
fixdt(1,16,2^0,0)
Output data type is fixed point fixdt(1,16,2^0,0)
.
<data type expression>
Use a data type object, for example, Simulink.NumericType
.
Parameter: OutDataTypeStr |
Type: character vector |
Value: 'Inherit:
Inherit via internal rule' | 'Inherit: Inherit
via back propagation' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' |
Default: 'Inherit:
Inherit via internal rule' |
For more information, see Control Signal Data Types.
Select the category of data to specify.
Default: Inherit
Inherit
Inheritance rules for data types. Selecting Inherit
enables
a second menu/text box to the right. Select one of the following choices:
Inherit via internal rule
(default)
Inherit via back propagation
Built in
Built-in data types. Selecting Built in
enables
a second menu/text box to the right. Select one of the following choices:
double
(default)
single
int8
uint8
int16
uint16
int32
uint32
Fixed point
Fixed-point data types.
Expression
Expressions that evaluate to data types. Selecting Expression
enables
a second menu/text box to the right, where you can enter the expression.
Clicking the Show data type assistant button enables this parameter.
Parameter: OutDataTypeStr |
Type: character vector |
Value: 'Inherit:
Inherit via internal rule' | 'Inherit: Inherit
via back propagation' | 'double' | 'single' | 'int8' | 'uint8' | 'int16' | 'uint16' | 'int32' | 'uint32' | 'fixdt(1,16,0)' | 'fixdt(1,16,2^0,0)' |
Default: 'Inherit:
Inherit via internal rule' |
See Specify Data Types Using Data Type Assistant.
Specify data type override mode for this signal.
Default: Inherit
Inherit
Inherits the data type override setting from its context, that
is, from the block, Simulink.Signal
object or Stateflow^{®} chart
in Simulink that is using the signal.
Off
Ignores the data type override setting of its context and uses the fixed-point data type specified for the signal.
The ability to turn off data type override for an individual data type provides greater control over the data types in your model when you apply data type override. For example, you can use this option to ensure that data types meet the requirements of downstream blocks regardless of the data type override setting.
This parameter appears only when the Mode is Built
in
or Fixed point
.
Specify whether you want the fixed-point data as signed or unsigned.
Default: Signed
Signed
Specify the fixed-point data as signed.
Unsigned
Specify the fixed-point data as unsigned.
Selecting Mode > Fixed
point
enables this parameter.
For more information, see Specifying a Fixed-Point Data Type.
Specify the bit size of the word that holds the quantized integer.
Default: 16
Minimum: 0
Maximum: 32
Selecting Mode > Fixed
point
enables this parameter.
For more information, see Specifying a Fixed-Point Data Type.
Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.
Default: Best
precision
Binary point
Specify binary point location.
Slope and bias
Enter slope and bias.
Best precision
Specify best-precision values.
Selecting Mode > Fixed
point
enables this parameter.
Selecting Binary point
enables:
Fraction length
Calculate Best-Precision Scaling
Selecting Slope and bias
enables:
Slope
Bias
Calculate Best-Precision Scaling
For more information, see Specifying a Fixed-Point Data Type.
Specify fraction length for fixed-point data type.
Default: 0
Binary points can be positive or negative integers.
Selecting Scaling > Binary
point
enables this parameter.
For more information, see Specifying a Fixed-Point Data Type.
Specify slope for the fixed-point data type.
Default: 2^0
Specify any positive real number.
Selecting Scaling > Slope
and bias
enables this parameter.
For more information, see Specifying a Fixed-Point Data Type.
Specify bias for the fixed-point data type.
Default: 0
Specify any real number.
Selecting Scaling > Slope
and bias
enables this parameter.
For more information, see Specifying a Fixed-Point Data Type.
The sldemo_fuelsys
model
uses a Discrete-Time Integrator block in the fuel_rate_control/airflow_calc
subsystem.
This block uses the Forward Euler integration method.
When the Switch block feeds a nonzero value into the Discrete-Time Integrator block, integration occurs. Otherwise, integration does not occur.
For more information, see the model description.
Data Types | Double | Single | Base Integer | Fixed-Point |
Sample Time | Specified in the Sample time parameter |
Direct Feedthrough | Yes, of the reset and external initial condition source ports. The input has direct feedthrough for every integration method except Forward Euler and accumulation Forward Euler. |
Multidimensional Signals | No |
Variable-Size Signals | No |
Zero-Crossing Detection | No |
Code Generation | Yes |