# Discrete-Time Integrator

Perform discrete-time integration or accumulation of signal

Discrete

## Description

### Capabilities of the Discrete-Time Integrator Block

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.

### Output Equations

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.

### 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.

### Define Initial Conditions

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.

### When to Use the State Port

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

### Limit the Integral

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.

IntegralOutput
Less than or equal to the Lower saturation limit and the input is negativeHeld at the Lower saturation limit
Between the Lower saturation limit and the Upper saturation limitThe integral
Greater than or equal to the Upper saturation limit and the input is positiveHeld 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.

### Reset the State

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.

### Reset Trigger Types

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.

### Behavior in Simplified Initialization Mode

Simplified initialization mode is enabled when you set Underspecified initialization detection to `Simplified` on the Configuration Parameters dialog box. 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.

#### Enable and Disable Behavior with Initial Condition Setting set to Output

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 `td`:

``` y(td) = y(td-1) ```

At enable time `te`:

• If the parent subsystem control port has States when enabling set to `reset`:

`y(te) = IC.`
• If the parent subsystem control port has States when enabling set to `held`:

`y(te) = y(td).`

The following figure shows this condition.

#### Iterator Subsystems

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.

#### Triggered Subsystems and Function-Call Subsystems

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.

### Behavior in an Enabled Subsystem Inside a Function-Call Subsystem

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 MethodSample Time Type of Function-Call Trigger PortValue of `delta T` When Function-Call Subsystem Executes for the First Time After EnabledReason for Behavior

Forward Euler

Triggered

`t — tstart`

When the function-call subsystem executes for the first time, the integrator algorithm uses `tstart` as the previous simulation time.

Backward Euler and Trapezoidal

Triggered

`t — tprevious`

When the function-call subsystem executes for the first time, the integrator algorithm uses `tprevious` as the previous simulation time.

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 ```delta T```.

## Data Type Support

The Discrete-Time Integrator block accepts real signals of the following data types:

• Floating point

• Built-in integer

• Fixed point

## Parameters

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

### Show data type assistant

Display the Data Type Assistant.

#### Settings

The Data Type Assistant helps you set the Output data type parameter.

### Integrator method

Specify the integration or accumulation method.

#### Settings

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.

#### Command-Line Information

 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'```

### Gain value

Specify a scalar, vector, or matrix by which to multiply the integrator input. Each element of the gain must be a positive real number.

#### Settings

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.

#### Command-Line Information

 Parameter: `gainval` Type: character vector Value: `'1.0'` Default: `'1.0'`

### External reset

Reset the states to their initial conditions when a trigger event occurs in the reset signal.

#### Settings

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.

#### Command-Line Information

 Parameter: `ExternalReset` Type: character vector Value: `'none'` | `'rising'` | `'falling'` | `'either'` | `'level'` | ```'sampled level'``` Default: `'none'`

### Initial condition source

Get the initial conditions of the states.

#### Settings

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.

#### Tips

Simulink software does not allow the initial condition of this block to be `inf` or `NaN`.

#### Dependencies

Selecting `internal` enables the Initial condition parameter.

Selecting `external` disables the Initial condition parameter.

#### Command-Line Information

 Parameter: `InitialConditionSource` Type: character vector Value: `'internal'` | `'external'` Default: `'internal'`

### Initial condition

Specify the states' initial conditions.

#### Settings

Default: `0`

Minimum: value of Output minimum parameter

Maximum: value of Output maximum parameter

#### Tips

Simulink software does not allow the initial condition of this block to be `inf` or `NaN`.

#### Dependencies

Setting Initial condition source to `internal` enables this parameter.

Setting Initial condition source to `external` disables this parameter.

#### Command-Line Information

 Parameter: `InitialCondition` Type: scalar or vector Value: `'0'` Default: `'0'`

### Initial condition setting

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.

#### Settings

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 Underspecified initialization detection is set to `Classic`, the Initial condition setting parameter behaves as ```State (most efficient)```.

• If Underspecified initialization detection is set to `Simplified`, the Initial condition setting parameter behaves as `Output`.

#### Command-Line Information

 Parameter: `InitialConditionSetting` Type: character vector Value: ```'State (most efficient)'``` | `'Output'` | `'Compatibilty'` Default: `'Output'`

### Sample time (-1 for inherited)

Enter the discrete interval between sample time hits.

#### Settings

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.

#### Tips

• 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.

#### Command-Line Information

 Parameter: `SampleTime` Type: character vector Value: `'1'` Default: `'1'`

### Limit output

Limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.

#### Settings

Default: Off

On

Limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.

Off

Do not limit the block's output to a value between the Lower saturation limit and Upper saturation limit parameters.

#### Dependencies

This parameter enables Upper saturation limit.

This parameter enables Lower saturation limit.

#### Command-Line Information

 Parameter: `LimitOutput` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### Upper saturation limit

Specify the upper limit for the integral.

#### Settings

Default: `inf`

Minimum: value of Output minimum parameter

Maximum: value of Output maximum parameter

#### Dependencies

Limit output enables this parameter.

#### Command-Line Information

 Parameter: `UpperSaturationLimit` Type: scalar or vector Value: `'inf'` Default: `'inf'`

### Lower saturation limit

Specify the lower limit for the integral.

#### Settings

Default: `-inf`

Minimum: value of Output minimum parameter

Maximum: value of Output maximum parameter

#### Dependencies

Limit output enables this parameter.

#### Command-Line Information

 Parameter: `LowerSaturationLimit` Type: scalar or vector Value: `'-inf'` Default: `'-inf'`

### Show saturation port

Add a saturation output port to the block.

#### Settings

Default: Off

On

Add a saturation output port to the block.

Off

Do not add a saturation output port to the block.

#### Command-Line Information

 Parameter: `ShowSaturationPort` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### Show state port

Add an output port to the block for the block's state.

#### Settings

Default: Off

On

Add an output port to the block for the block's state.

Off

Do not add an output port to the block for the block's state.

#### Command-Line Information

 Parameter: `ShowStatePort` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### Ignore limit and reset when linearizing

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.

#### Settings

Default: Off

On

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.

Off

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.

#### Tips

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.

#### Command-Line Information

 Parameter: `IgnoreLimit` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### Lock output data type setting against changes by the fixed-point tools

Select to lock the output data type setting of this block against changes by the Fixed-Point Tool and the Fixed-Point Advisor.

#### Settings

Default: Off

On

Locks the output data type setting for this block.

Off

Allows the Fixed-Point Tool and the Fixed-Point Advisor to change the output data type setting for this block.

#### Command-Line Information

 Parameter: `LockScale` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

For more information, see Use Lock Output Data Type Setting (Fixed-Point Designer).

### Integer rounding mode

Specify the rounding mode for fixed-point operations.

#### Settings

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.

#### Command-Line Information

 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.

### Saturate on integer overflow

Specify whether overflows saturate.

#### Settings

Default: Off

On

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.

Off

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.

#### Tips

• 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.

#### Command-Line Information

 Parameter: `SaturateOnIntegerOverflow` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### State name

Use this parameter to assign a unique name to each state.

#### Settings

Default: `' '`

• If left blank, no name is assigned.

#### Tips

• 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.

#### Dependency

This parameter enables State name must resolve to Simulink signal object when you click the Apply button.

#### Command-Line Information

 Parameter: `StateName` Type: character vector Value: `' '` Default: `' '`

### State name must resolve to Simulink signal object

Require that state name resolve to Simulink signal object.

#### Settings

Default: Off

On

Require that state name resolve to Simulink signal object.

Off

Do not require that state name resolve to Simulink signal object.

#### Dependencies

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.

#### Command-Line Information

 Parameter: `StateMustResolveToSignalObject` Type: character vector Value: `'off'` | `'on'` Default: `'off'`

### Signal object class

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).

#### Settings

`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).

### Code generation storage class

Select state storage class for code generation.

#### Settings

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`.

#### Dependencies

State name enables this parameter.

#### Command-Line Information

Command-Line Information

 Parameter: `StateStorageClass` Type: character vector Value: `'Auto'` | `'ExportedGlobal'` | `'ImportedExtern'` | `'ImportedExternPointer'` | `'SimulinkGlobal'` | `'Custom'` Default: `'Auto'`

### Code generation storage class

Select state storage class for code generation.

#### Settings

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`.

#### Dependencies

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`.

#### Settings

• Default: ```' '``` (empty character vector)

• `const`

• `volatile`

#### Dependency

Setting Code generation storage class to `ExportedGlobal`, `ImportedExtern`, `ImportedExternPointer`, or `SimulinkGlobal` enables this parameter. This parameter is hidden unless you previously set its value.

#### Command-Line Information

 Parameter Name: `RTWStateStorageTypeQualifier` Value Type: character vector Default: `' '` (empty character vector)

### Output minimum

Lower value of the output range that Simulink checks.

#### Settings

Default: `[]` (unspecified)

Specify this number as a finite, real, double, scalar value.

Simulink uses the minimum to perform:

### Note

Output minimum does not saturate or clip the actual output signal. Use the Saturation block instead.

#### Command-Line Information

 Parameter: `OutMin` Type: character vector Value: `'[ ]'` Default: `'[ ]'`

### Output maximum

Upper value of the output range that Simulink checks.

#### Settings

Default: `[]` (unspecified)

Specify this number as a finite, real, double, scalar value.

Simulink uses the maximum value to perform:

### Note

Output maximum does not saturate or clip the actual output signal. Use the Saturation block instead.

#### Command-Line Information

 Parameter: `OutMax` Type: character vector Value: `'[ ]'` Default: `'[ ]'`

### Output data type

Specify the output data type.

#### Settings

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`.

#### Command-Line Information

 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'```

### Mode

Select the category of data to specify.

#### Settings

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.

#### Dependency

Clicking the button enables this parameter.

#### Command-Line Information

 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'```

### Data type override

Specify data type override mode for this signal.

#### Settings

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.

#### Tip

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.

#### Dependency

This parameter appears only when the Mode is ```Built in``` or `Fixed point`.

### Signedness

Specify whether you want the fixed-point data as signed or unsigned.

#### Settings

Default: `Signed`

`Signed`

Specify the fixed-point data as signed.

`Unsigned`

Specify the fixed-point data as unsigned.

#### Dependencies

Selecting Mode > ```Fixed point``` enables this parameter.

### Word length

Specify the bit size of the word that holds the quantized integer.

#### Settings

Default: `16`

Minimum: `0`

Maximum: `32`

#### Dependencies

Selecting Mode > ```Fixed point``` enables this parameter.

### Scaling

Specify the method for scaling your fixed-point data to avoid overflow conditions and minimize quantization errors.

#### Settings

Default: ```Best precision```

`Binary point`

Specify binary point location.

`Slope and bias`

Enter slope and bias.

`Best precision`

Specify best-precision values.

#### Dependencies

Selecting Mode > ```Fixed point``` enables this parameter.

Selecting `Binary point` enables:

• Fraction length

Selecting `Slope and bias` enables:

• Slope

• Bias

### Fraction length

Specify fraction length for fixed-point data type.

#### Settings

Default: `0`

Binary points can be positive or negative integers.

#### Dependencies

Selecting Scaling > ```Binary point``` enables this parameter.

### Slope

Specify slope for the fixed-point data type.

#### Settings

Default: `2^0`

Specify any positive real number.

#### Dependencies

Selecting Scaling > ```Slope and bias``` enables this parameter.

### Bias

Specify bias for the fixed-point data type.

#### Settings

Default: `0`

Specify any real number.

#### Dependencies

Selecting Scaling > ```Slope and bias``` enables this parameter.

## Examples

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.

## Characteristics

 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