Discrete Integrator

Purpose

Discrete integration of the input signal

Library

Control / Discrete

Description

../../_images/discreteintegrator.svg

The Discrete Integrator block outputs the integral of its input signal at the current sample time step. The integrator state may saturate at an upper and lower limit, or it can be wrapped between two limits. It can be reset to its initial value by an external trigger signal.

Integration Methods

You can choose between three integration methods using the Integration method parameter: Forward Euler, Backward Euler and Trapezoidal. The output and update equations for these methods are listed below:

Forward Euler

First simulation step:

\[y[0] = x[0]\]
\[x[1] = y[0]\]

Subsequent simulation steps:

\[y[k] = x[k] + T\cdot u[k-1]\]
\[x[k+1] = y[k]\]
Backward Euler

First simulation step:

\[y[0] = x[0]\]
\[x[1] = y[0]\]

Subsequent simulation steps:

\[y[k] = x[k] + T\cdot u[k]\]
\[x[k+1] = y[k]\]
Trapezoidal

First simulation step:

\[y[0] = x[0]\]
\[x[1] = y[0]\]

Subsequent simulation steps:

\[y[k] = x[k] + \frac{T}{2}\cdot(u[k-1] + u[k])\]
\[x[k+1] = y[k]\]

In the above equations, if the block has a fixed-step discrete sample time (either inherited or specified explicitly), \(T\) equals the sample period. If the block is executed within a triggered subsystem, \(T\) equals the time span between the previous and the current trigger.

The first simulation step refers to the first time the block executes after a simulation has been started from the initial block parameters (as opposed to a stored system state) or – if the block is executed within an enabled subsystem – after the block has been enabled. If the block is executed within a triggered subsystem, the first execution after simulation start is always treated as a first simulation step even if the simulation is restarted from a stored system state because the value of \(T\) cannot be determined in this case.

Note

If the Backward Euler or Trapezoidal integration method is used, the input signal has direct feedthrough on the output signal.

Reset Behavior

The integrator may be reset to its initial condition by an external input signal. This is controlled by the External reset parameter. The available options are rising/falling/either edge or level as described below:

Rising Edge Reset

The block output and state are reset to the initial condition if the current reset input value is non-zero and the previous reset input value was zero.

Falling Edge Reset

The block output and state are reset to the initial condition if the current reset input value is zero and the previous reset input value was non-zero.

Either Edge Reset

The block output and state are reset to the initial condition if the current reset input value is non-zero and the previous reset input value was zero or if the current reset input value is zero and the previous reset input value was non-zero.

Level Reset

The block output and state are reset to and held at the initial condition while the current reset input value is non-zero.

Note

Both the external reset input and the initial condition input have direct feedthrough on the output signal. Therefore, feeding back the output signal to create the reset signal or an initial value will create an algebraic loop. This can be avoided by using the state port instead.

Parameters

External reset

The behavior of the external reset input. See Reset Behavior above.

Initial condition source

Specifies whether the initial condition is provided via the Initial condition parameter (internal) or via an input signal (external).

Initial condition

The initial condition of the integrator. The value may be a scalar or a vector corresponding to the width of the component. This parameter is shown only if the Initial condition source parameter is set to internal.

Show state port

Specifies whether to show an additional state output port. The state port is updated at a slightly different point in the block execution order (i.e. before the reset and initial condition inputs are evaluated) and may therefore be used to calculate an input signal for the external reset input or the initial condition input.

Enable wrapping

When set to on, the integrator state is wrapped between the Upper wrapping limit and Lower wrapping limit parameters. The default is off. Note that wrapping is mutually exclusive with saturation.

Upper saturation limit

An upper limit for the integrator state. If the value is inf, the state is unlimited. This parameter is visible only if Enable wrapping is set to off.

Lower saturation limit

A lower limit for the integrator state. If the value is -inf, the state is unlimited. This parameter is visible only if Enable wrapping is set to off.

Upper wrapping limit

The upper wrapping limit for the integrator state. When the state exceeds the upper limit, it is wrapped to the lower limit. This parameter is visible only if Enable wrapping is set to on.

Lower wrapping limit

The lower wrapping limit for the integrator state. When the state exceeds the lower limit, it is wrapped to the upper limit. This parameter is visible only if Enable wrapping is set to on.

Integration method

The method used to integrate the input signal. See Integration Methods above.

Sample time

A scalar specifying the sampling period or a two-element vector specifying the sampling period and offset, in seconds \((\mathrm{s})\). See also the Discrete-Periodic sample time type in section Sample Times.

Probe Signals

State

The internal state of the integrator.