Javascript required
Skip to content Skip to sidebar Skip to footer

Maximum of Continuous Signal in Simulink

Integrator

Integrate a 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 y 0, where y and u are vector functions of the current simulation time t.

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

Simulink 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 currently 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.

The parameter dialog box also allows you to

  • Define upper and lower limits on the integral
  • Create an input that resets the block's output (state) to its initial value, depending on how the input changes
  • Create an optional state output that allows you to use the value of the block's output to trigger a block reset

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:

  • To define the initial conditions as a block parameter, specify the Initial condition source parameter as internal and enter the value in the Initial condition parameter field.
  • To provide the initial conditions from an external source, specify the Initial condition source parameter as external. An additional input port appears under the block input, as shown in this figure.

    Note    If the integrator limits its output (see Limiting the Integral), the initial condition must fall inside the integrator's saturation limits. If the initial condition is outside the block's saturation limits, the block displays an error message.

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:

  • When the integral is less than or equal to the Lower saturation limit and the input is negative, the output is held at the Lower saturation limit.
  • When the integral is between the Lower saturation limit and the Upper saturation limit, the output is the integral.
  • When the integral is greater than or equal to the Upper saturation limit and the input is positive, the output is 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 saturation port appears below the block output port, as shown on this figure.

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.

When this option is selected, 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, as shown in this figure.

  • Select rising to trigger the state reset when the reset signal has a rising edge.
  • Select falling to trigger the state reset when the reset signal has a falling edge.
  • Select either to trigger the reset when either a rising or falling signal occurs.
  • Select level to trigger the reset and hold the output to the initial condition while the reset signal is nonzero.

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 (see Algebraic Loops). The Integrator block's state port allows you to feed back the block's output without creating an algebraic loop.

About the State Port

Selecting the Show state port option on the Integrator block's parameter dialog box causes an additional output port, the state port, to appear atop 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. This allows you to avoid creating algebraic loops in the following modeling scenarios:

  • Self-resetting integrators (see Creating Self-Resetting Integrators)
  • Handing off a state from one enabled subsystem to another (see Handing Off States Between Enabled Subsystems)

    Note    The state port is intended to be used specifically in these two scenarios. When updating a model, Simulink checks to ensure that the state port is being used in one of these two scenarios. If not, Simulink signals an error.

Creating Self-Resetting Integrators

The Integrator block's state port allows you to avoid creating algebraic loops 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. In so doing, however, the model creates an algebraic loop. To compute the integrator block's output, Simulink needs to know the value of the block's reset signal, and vice versa. Because the two values are mutually dependent, Simulink cannot determine either. It therefore signals an error 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 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 allows you to 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. This 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 the two subsystems. However, the connection creates an algebraic loop. To compute the output of A, Simulink needs to know the output of B, and vice versa. Because the outputs are mutually dependent, Simulink cannot compute them. It therefore generates an error if you attempt to update or simulate 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 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 clutch model.

    Note    Simulink does not permit three or more enabled subsystems to hand off a model state. If Simulink detects that a model is handing off a state among more than two enabled subsystems, it generates an error.

Specifying the Absolute Tolerance for the Block's Outputs

By default Simulink uses the absolute tolerance value specified in the Simulation Parameters dialog box (see 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.

Choosing All Options

When all options are selected, the icon looks like this.

Data Type Support

An Integrator block accepts and outputs signals of type double on its data ports. Its external reset port accepts signals of type double or boolean.

Parameters and Dialog Box

External reset
Resets the states to their initial conditions when a trigger event (rising, falling, either, or level) occurs in the reset signal.
Initial condition source
Gets the states' initial conditions from the Initial condition parameter (if set to internal) or from an external block (if set to external).
Initial condition
The states' initial conditions. Set the Initial condition source parameter value to internal.
Limit output
If selected, limits the states to a value between the Lower saturation limit and Upper saturation limit parameters.
Upper saturation limit
The upper limit for the integral. The default is inf.
Lower saturation limit
The lower limit for the integral. The default is -inf.
Show saturation port
If selected, adds a saturation output port to the block.
Show state port
If selected, adds an output port to the block for the block's state.
Absolute tolerance
Absolute tolerance used to compute the block's outputs. You can enter auto or a numeric value. If you enter auto, Simulink determines the absolute tolerance (see Error Tolerances). If you enter a numeric value, Simulink uses the specified value to compute the block's outputs. Note that a numeric value overrides the setting for the absolute tolerance in the Simulation Parameters dialog box.

Characteristics

Direct Feedthrough
Yes, of the reset and external initial condition source ports
Sample Time
Continuous
Scalar Expansion
Of parameters
States
Inherited from driving block or parameter
Dimensionalized
Yes
Zero Crossing
If the Limit output option is selected, one for detecting reset, one each to detect upper and lower saturation limits, one when leaving saturation

 Inport Interpolation (n-D) Using PreLook-Up

bertiesquam1976.blogspot.com

Source: http://www.ece.northwestern.edu/local-apps/matlabhelp/toolbox/simulink/slref/integrator.html