Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Discrete-Time Integrator - Perform discrete-time integration or accumulation of signal

Library

Discrete

Description

You can use the Discrete-Time Integrator block in place of the Integrator block to create a purely discrete system.

For the Discrete-Time Integrator block, you can:

These features are described below.

Integration and Accumulation Methods

The block can integrate or accumulate using the Forward Euler, Backward Euler, and Trapezoidal methods. For a given step n, Simulink software updates y(n) and x(n+1). In integration mode, T is the block's sample time (delta T in the case of triggered sample time). In accumulation mode, T = 1; the block's sample time determines when the block's output is computed but not the output's value. K is the gain value. Values are clipped according to upper or lower limits.

The block reflects the selected integration or accumulation method.

Defining Initial Conditions

You can define the initial conditions as a parameter on the block dialog box or input them from an external signal:

Using the State Port

In two situations, you must use the state port instead of the output port:

You can correct these problems by passing the state through the state port rather than the output port. Although the values are the same, Simulink software generates them at slightly different times, which protects your model from these problems. You output the block state by selecting the Show state port check box.

By default, the state port appears on the top of the block.

Limiting the Integral

To prevent the output from exceeding specifiable levels, select the Limit output check box and enter the limits in the appropriate parameter fields. Doing so causes the block to function as a limited integrator. When the output reaches the limits, the integral action is turned off to prevent integral wind up. During a simulation, you can change the limits but you cannot change whether the output is limited. The output is determined as follows:

To generate a signal that indicates when the state is being limited, select the Show saturation port check box. A saturation port appears below the block output port, as shown in this figure.

The signal has one of three values:

Resetting the State

The block can reset its state to the specified initial condition, based on an external signal. To cause the block to reset its state, select one of the External reset parameter choices. A trigger port appears below the block's input port and indicates the trigger type, as shown in this figure.

The reset port has direct feedthrough. If the block output is fed 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's state port into the reset port instead. To access the block's 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:

Selecting All Options

When you select all options, the icon looks like this.

Using Simplified Initialization Mode

If you use simplified initialization mode, the behavior of the Discrete-Time Integrator block differs from its behavior in classic initialization mode. The new initialization behavior is more robust, and provides more consistent behavior in these cases:

In addition, the simplified initialization behavior makes it easier to convert Continuous-Time Integrator blocks to Discrete-Time Integrator blocks, since the initial conditions have the same meaning for both blocks.

For more information on classic and simplified initialization modes, see Underspecified initialization detection.

Initial Conditions in Simplified Initialization Mode

When you use simplified initialization mode, the Initial conditions parameter is applied only to the integrator output.

In addition, the Use initial condition as initial and reset value for parameter is disabled. The initial condition is always used as the initial and reset value for the output.

Input-Output Equations in Simplified Initialization Mode

When you use simplified initialization mode, the block starts from first time step n = 0 with initial output y(0) = IC ( clipped if necessary).

For a given step n > 0 with simulation time t(n), Simulink updates output y(n) as follows:

Simulink automatically selects a state-space realization of these input-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.

Enable and Disable Behavior in Simplified Initialization Mode

When you use simplified initialization mode, 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:

Iterator Subsystems

When using simplified initialization mode, you cannot place the Discrete-Time Integrator block within an Iterator Subsystem.

In simplified initialization mode, Iterator subsystems do not maintain elapsed time, so Simulink reports an error if any block needing elapsed time, such as the Discrete-Time Integrator, is placed inside an Iterator Subsystem.

Data Type Support

The Discrete-Time Integrator block accepts real signals of any numeric data type supported by Simulink software, including fixed-point data types.

Parameters and Dialog Box

The Main pane of the Discrete-Time Integrator block dialog box appears as follows:

The Signal Attributes pane of the Discrete-Time Integrator block dialog box appears as follows:

During simulation, the block uses the following values:

See Block State Storage and Interfacing Considerations in the Real-Time Workshop User's Guide for more information.

Show data type assistant

Display the Data Type Assistant.

Settings

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

See Specifying Block Output Data Types for more information.

Command-Line Information

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

Command-Line Information

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

Use initial condition as initial and reset value for

Specify whether to apply the initial condition as the initial and reset value for the state and output, or the state only.

Settings

Default: State and output

State and output

Set the following for initial

y(0) = IC

x(0) = IC

or at reset

y(n) = IC

x(n) = IC

State only (most efficient)

Set the following for initial

x(0) = IC

or at reset

x(n) = IC

Command-Line Information

See Block-Specific Parameters for the command-line information.

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.

See also How to Specify the Sample Time in the online documentation for more information.

Tips

Command-Line Information

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

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

See Block-Specific Parameters for the command-line information.

See Also

For more information, see Fixed-Point Tool and Fixed-Point Advisor in the Simulink Fixed Point documentation.

Integer rounding mode

Select the rounding mode for fixed-point operations.

Settings

Default: Floor

Ceiling

Round both positive and negative numbers toward positive infinity.

Convergent

Round number to the nearest representable value. If a tie occurs, round to the nearest even stored value.

Floor

Round both positive and negative numbers toward negative infinity.

Nearest

Round number to the nearest representable value. If a tie occurs, round toward positive infinity.

Round

Round number to the nearest representable value. If a tie occurs, round positive numbers toward positive infinity and round negative numbers toward negative infinity.

Simplest

This option provides for an optimization of the rounding code for several blocks.

Zero

Round number toward zero.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

For more information, see Rounding in the Simulink Fixed Point User's Guide.

Saturate on integer overflow

Specify whether overflows saturate.

Settings

Default: Off

On

Overflows saturate.

Off

Overflows do not saturate.

Tips

Command-Line Information

See Block-Specific Parameters for the command-line information.

State name

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

Settings

Default: ' '

Tips

Dependencies

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

Command-Line Information

See Block-Specific Parameters for the command-line information.

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 enables Real-Time Workshop storage class.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Real-Time Workshop storage class

Select state storage class.

Settings

Default: Auto

Auto

Auto is the appropriate storage class for states that you do not need to interface to external code.

ExportedGlobal

State is stored in a global variable

ImportedExtern

model_private.h declares the state as an extern variable.

ImportedExternPointer

model_private.h declares the state as an extern pointer.

Dependencies

State name enables this parameter.

Setting this parameter to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables Real-Time Workshop storage type qualifier.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

Block State Storage Classes in the Real-Time Workshop User's Guide.

Real-Time Workshop storage type qualifier

Specify Real-Time storage type qualifier.

Settings

Default: ' '

If left blank, no qualifier is assigned.

Dependencies

Setting Real-Time Workshop storage class to ExportedGlobal, ImportedExtern, or ImportedExternPointer enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Output minimum

Specify the minimum value that the block should output.

Settings

Default: []

The default value, [], is equivalent to -Inf.

Simulink software uses this value to perform:

Tip

This number must be a double scalar value.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Output maximum

Specify the maximum value that the block should output.

Settings

Default: []

The default value, [], is equivalent to Inf.

Simulink software uses this value to perform:

Tip

This number must be a double scalar value.

Command-Line Information

See Block-Specific Parameters for the command-line information.

Output data type

Specify the output data type.

Settings

Default: Inherit: Inherit via internal rule (Discrete-Time Integrator, Gain, Product, Sum, Switch block), Inherit: Inherit from 'Constant value' (Constant block), Inherit: Inherit via back propagation (Data Type Conversion block), Inherit: Same as input (Saturation block)

Inherit: Inherit via internal rule

This option appears for some blocks. Simulink software chooses a combination of output scaling and data type that requires the smallest amount of memory consistent with accommodating the calculated output range and maintaining the output precision of the block and with the word size of the targeted hardware implementation specified for the model. If the Device type parameter on the Hardware Implementation configuration parameters pane is set to ASIC/FPGA, Simulink software chooses the output data type without regard to hardware constraints. Otherwise, Simulink software chooses the smallest available hardware data type capable of meeting the range and precision constraints. For example, if the block multiplies an input of type int8 by a gain of int16 and ASIC/FPGA is specified as the targeted hardware type, the output data type is sfix24. If Unspecified (assume 32-bit Generic), i.e., a generic 32-bit microprocessor, is specified as the target hardware, the output data type is int32. If none of the word lengths provided by the target microprocessor can accommodate the output range, Simulink software displays an error message in the Simulation Diagnostics Viewer.

Inherit: Inherit from 'Constant value'

Use data type of Constant value parameter. This option appears for some blocks.

Inherit: Inherit via back propagation

Use data type of the driving block.

Inherit: Same as input

Use data type of sole input signal. This option appears for some blocks.

Inherit: Same as first input

Use data type of first input signal. This option appears for some blocks.

Inherit: Same as accumulator

Output data type is the same as accumulator data type. This option appears for some blocks.

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

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

Enum: <class name>

Use an enumerated data type, for example, Enum: BasicColors. This option appears for some blocks.

<data type expression>

Use a data type object, for example, Simulink.NumericType.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying Block Output Data Types in the Simulink User's Guide for more information.

Mode

Select the category of data to specify.

Settings

Default: Inherit (Constant, Data Type Conversion, Discrete Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch), Built in (Logical Operator, Relational Operator)

Inherit

Inheritance rules for data types. Selecting Inherit enables a second menu/text box to the right. The following list is the possible values, which can vary by block:

  • Inherit from 'Constant value' (Constant block default)

  • Inherit via internal rule (Discrete-Time Integrator, Gain, Product, Sum, Switch block default)

  • Inherit via back propogation (Data Type Conversion block default)

  • auto (Inport, Outport block default)

  • Logical (see Configuration Parameters: Optimization)

  • Same as first input

  • Same as input (Saturation block default)

  • Same as accumulator

Built in

Built-in data types. Selecting Built in enables a second menu/text box to the right. The following list is the possible values, which can vary by block:

  • double (Constant, Data Type Conversion, Discrete-Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch block default)

  • single

  • int8

  • uint8

  • int16

  • uint16

  • int32

  • uint32

  • boolean (Logical Operator, Relational Operator block default)

Fixed point

Fixed-point data types.

Enumerated

Enumerated data types. This option is available on some blocks. Selecting Enumerated enables a second menu/text box to the right. The following list is the possible values, which can vary by block:

  • <class name>

Expression

Expressions that evaluate to data types. Selecting Expression enables a second menu/text box to the right. The following list is the possible values, which can vary by block:

  • <data type expression>

Dependency

Clicking the Show data type assistant button enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Using the Data Type Assistant in the Simulink User's Guide.

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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

Word length

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

Settings

Default: 16

Minimum: 0

Maximum: 32

Large word sizes represent large values with greater precision than small word sizes.

Dependencies

Selecting Mode > Fixed point enables this parameter.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

Scaling

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

Settings

Default: Best precision (Constant), Binary point (Data Type Conversion, Discrete-Time Integrator, Gain, Inport, Outport, Product, Saturation, Sum, Switch), Integer (Logical Operator, Relational Operator)

Binary point

Specify binary point location.

Slope and bias

Enter slope and bias.

Best precision

Specify best-precision values. This option appears for some blocks.

Integer

Specify integer. This setting has the same result as specifying a binary point location and setting fraction length to 0. This option appears for some blocks.

Dependencies

Selecting Mode > Fixed point enables this parameter.

Selecting Binary point enables:

Selecting Slope and bias enables:

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

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.

Command-Line Information

See Block-Specific Parameters for the command-line information.

See Also

See Specifying a Fixed-Point Data Type in the Simulink User's Guide for more information.

Characteristics

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.

Sample Time

Specified in the Sample time parameter

Scalar Expansion

Yes, of parameters

States

Inherited from driving block and parameter

Dimensionalized

Yes

Zero-Crossing Detection

No

See Also

Integrator

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS