Products & Services Solutions Academia Support User Community Company

Learn more about Simulink   

Integrator - Integrate signal

Library

Continuous

Description

The Integrator block outputs the integral of its input at the current time step. The following equation represents the output of the block y as a function of its input u and an initial condition y0, where y and u are vector functions of the current simulation time t.

Simulink software can use a number of different numerical integration methods to compute the Integrator block's output, each with advantages in particular applications. Use the Solver pane of the Configuration Parameters dialog box (see Solver Pane) to select the technique best suited to your application.

Simulink software treats the Integrator block as a dynamic system with one state, its output. The Integrator block's input is the state's time derivative.

The selected solver computes the output of the Integrator block at the current time step, using the current input value and the value of the state at the previous time step. To support this computational model, the Integrator block saves its output at the current time step for use by the solver to compute its output at the next time step. The block also provides the solver with an initial condition for use in computing the block's initial state at the beginning of a simulation run. The default value of the initial condition is 0. The block's parameter dialog box allows you to specify another value for the initial condition or create an initial value input port on the block.

Use the parameter dialog box to:

Use the Discrete-Time Integrator block to create a purely discrete system.

Defining Initial Conditions

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

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. This action 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 block determines output 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.

The signal has one of three values:

When you select this check box, the block has three zero crossings: one to detect when it enters the upper saturation limit, one to detect when it enters the lower saturation limit, and one to detect when it leaves saturation.

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 choices. A trigger port appears below the block's input port and indicates the 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 (see Algebraic Loops). Use the Integrator block's state port to feed back the block's output without creating an algebraic loop.

About the State Port

Selecting the Show state port check box on the Integrator block's parameter dialog box causes an additional output port, the state port, to appear at the top of the Integrator block.

The output of the state port is the same as the output of the block's standard output port except for the following case. If the block is reset in the current time step, the output of the state port is the value that would have appeared at the block's standard output if the block had not been reset. The state port's output appears earlier in the time step than the output of the Integrator block's output port. Use the state port to avoid creating algebraic loops in these modeling scenarios:

Creating Self-Resetting Integrators

The Integrator block's state port helps you avoid an algebraic loop when creating an integrator that resets itself based on the value of its output. Consider, for example, the following model.

This model tries to create a self-resetting integrator by feeding the integrator's output, subtracted from 1, back into the integrator's reset port. However, the model creates an algebraic loop. To compute the integrator block's output, Simulink software needs to know the value of the block's reset signal, and vice versa. Because the two values are mutually dependent, Simulink software cannot determine either. Therefore, an error message appears if you try to simulate or update this model.

The following model uses the integrator's state port to avoid the algebraic loop.

In this version, the value of the reset signal depends on the value of the state port. The value of the state port is available earlier in the current time step than the value of the integrator block's output port. Thus, Simulink software can determine whether the block needs to be reset before computing the block's output, thereby avoiding the algebraic loop.

Handing Off States Between Enabled Subsystems

The state port helps you avoid an algebraic loop when passing a state between two enabled subsystems. Consider, for example, the following model.

In this model, a constant input signal drives two enabled subsystems that integrate the signal. A pulse generator generates an enabling signal that causes execution to alternate between the two subsystems. The enable port of each subsystem is set to reset, which causes the subsystem to reset its integrator when it becomes active. Resetting the integrator causes the integrator to read the value of its initial condition port. The initial condition port of the integrator in each subsystem is connected to the output port of the integrator in the other subsystem.

This connection is intended to enable continuous integration of the input signal as execution alternates between two subsystems. However, the connection creates an algebraic loop. To compute the output of A, Simulink software needs to know the output of B, and vice versa. Because the outputs are mutually dependent, Simulink software cannot compute them. Therefore, an error message appears if you try to simulate or update this model.

The following version of the same model uses the integrator state port to avoid creating an algebraic loop when handing off the state.

In this model, the initial condition of the integrator in A depends on the value of the state port of the integrator in B, and vice versa. The values of the state ports are updated earlier in the simulation time step than the values of the integrator output ports. Thus, Simulink software can compute the initial condition of either integrator without knowing the final output value of the other integrator. For another example of using the state port to hand off states between conditionally executed subsystems, see the sldemo_clutch model.

Specifying the Absolute Tolerance for the Block's Outputs

By default Simulink software uses the absolute tolerance value specified in the Configuration Parameters dialog box (see Specifying Variable-Step Solver Error Tolerances) to compute the output of the Integrator block. If this value does not provide sufficient error control, specify a more appropriate value in the Absolute tolerance field of the Integrator block's dialog box. The value that you specify is used to compute all of the block's outputs.

Selecting All Options

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

Data Type Support

The Integrator block accepts and outputs signals of type double on its data ports. The external reset port accepts signals of type double or Boolean.

Parameters and Dialog Box

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 rises from a zero to a positive value or from a negative to a positive value.

falling

Reset the state when the reset signal falls from a positive value to zero or from a positive to a negative value.

either

Reset the state when the reset signal changes from a zero to a nonzero value or changes sign.

level

Reset the state when the reset signal is nonzero at the current time step or changes from nonzero at the previous time step to zero at the current time step.

level hold

Reset the state when the reset signal is nonzero at the current time step.

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

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.

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.

Absolute tolerance

Specify the absolute tolerance for computing the block output.

Settings

Default: auto

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 unresettable and as having no limits on its output, regardless of the settings of the block's reset and output limitation options.

Settings

Default: Off

On

Cause Simulink linearization commands to treat this block as unresettable and as having no limits on its output, regardless of the settings of the block's reset and output limitation options.

Off

Do not cause Simulink linearization commands to treat this block as unresettable and as having no limits on its output, regardless of the settings of the block's reset and output limitation options.

Tip

Use this check box to linearize a model around an operating point that causes the integrator to reset or saturate.

Command-Line Information

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

Enable zero-crossing detection

Select to enable zero-crossing detection. For more information, see Zero-Crossing Detection.

Settings

Default: On

On

Use zero crossings to detect and take a time step at any of the following events: reset, entering or leaving an upper saturation state, entering or leaving a lower saturation state.

Off

Do not use zero crossings to detect and take a time step at any of the following events: reset, entering or leaving an upper saturation state, entering or leaving a lower saturation state.

If you select this check box, Limit output, and zero-crossing detection for the model as a whole, the Integrator block uses zero crossings as described.

Command-Line Information

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

State Name (e.g., 'position')

Assign a unique name to each state.

Settings

Default: ' '

If this field is blank, no name assignment occurs.

Tips

Command-Line Information

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

Characteristics

Direct Feedthrough

Yes, of the reset and external initial condition source ports

Sample Time

Continuous

Scalar Expansion

Yes, of parameters

States

Inherited from driving block or parameter

Dimensionalized

Yes

Zero-Crossing Detection

Yes, if enabled and you select the Limit output option, one for detecting reset, one each to detect upper and lower saturation limits, and one when leaving saturation

See Also

Discrete-Time 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