Skip to Main Content Skip to Search
Product Documentation

Second-Order Integrator, Second-Order Integrator Limited - Integrate input signal twice

Library

Continuous

Description

The Second-Order Integrator block and the Second-Order Integrator Limited block solve the second-order initial value problem:

where u is the input to the system. The block is therefore a dynamic system with two continuous states: x and dx/dt.

The Second-Order Itegrator Limited block is identical to the Second-Order Integrator block with the exception that it defaults to limiting the states based on the specified upper and lower limits. For more information, see Limiting the States.

Simulink software can use a number of different numerical integration methods to compute the outputs of the block. Each has advantages for specific applications. Use the Solver pane of the Configuration Parameters dialog box to select the technique best suited to your application. (For more information, see Choosing a Solver.) The selected solver computes the states of the Second-Order Integrator block at the current time step using the current input value.

Use the block parameter dialog box to:

Defining Initial Conditions

You can define the initial conditions of each state individually as a parameter on the block dialog box or input one or both of them from an external signal.

If you choose to use an external source for both state initial conditions, your block appears as follows.

Limiting the States

When modeling a second-order system, you may need to limit the block states. For example, the motion of a piston within a cylinder is governed by Newton's Second Law and has constraints on the piston position (x). With the Second-Order Integrator block, you can limit the states x and dx/dt independent of each other. You can even change the limits during simulation; however, you cannot change whether or not the states are limited. An important rule to follow is that an upper limit must be strictly greater than its corresponding lower limit.

The block appearance changes when you limit one or both states. Shown below is the appearance of the block with both states limited.

For each state, you can use the block parameter dialog box to set appropriate saturation limits.

Limiting x only

If you use the Second-Order Integrator Limited block, both states are limited by default. But you can also manually limit state x on the Second-Order Integrator block by selecting Limit x and entering the limits in the appropriate parameter fields.

The block then determines the values of the states as follows:

You can choose to reinitialize dx/dt to a new value at the time when x reaches saturation. See Reinitializing dx/dt when x reaches saturation

Limiting dx/dt only

As with state x, state dx/dt is set as limited by default on the dx/dt pane of the Second-Order Integrator Limited parameter dialog box. You can manually set this parameter, Limit dx/dt, on the Second-Order Integrator block. In either case, you must enter the appropriate limits for dx/dt.

If you limit only the state dx/dt, then the block determines the values of dx/dt as follows:

When state dx/dt is held at it upper or lower limit, the value of x is governed by the first-order initial value problem:

where L is the dx/dt limit (upper or lower), tL is the time when dx/dt reaches this limit, and xL is the value of state x at that time.

Limiting Both States

When you limit both states, Simulink maintains mathematical consistency of the states by limiting the allowable values of the upper and lower limits for dx/dt. Such limitations are necessary to satisfy the following constraints:

Consequently, for such cases, the upper limit of dx/dt must be strictly positive and the lower limit of dx/dt must be strictly negative.

When both states are limited, the block determines the states as follows:

When you limit both states, you can choose to reinitialize dx/dt at the time when state x reaches saturation. If the reinitialized value is outside specified limits on dx/dt, then dx/dt is reinitialized to the closest valid value and a consistent set of initial conditions is calculated. See Reinitializing dx/dt when x reaches saturation

Resetting the State

The block can reset its states to the specified initial conditions based on an external signal. To cause the block to reset its states, select one of the External reset choices on the Attributes pane. A trigger port appears on the block below its 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).

Enabling Zero-Crossing Detection

This parameter controls whether zero-crossing detection is enabled for this block. By default, the Enable zero-crossing detection parameter is selected on the Attributes pane. However, this parameter is only in affect if the Zero-crossing control, on the Solver pane of the Configuration Parameters dialog, is set to Use local settings. For more information, see Zero-Crossing Detection.

Reinitializing dx/dt when x reaches saturation

For certain modeling applications, dx/dt must be reinitialized when state x reaches its limits in order to pull x out of saturation immediately. You can achieve this by selecting Reinitialize dx/dt when x reaches saturation on the Attributes pane.

If this option is on, then at the instant when x reaches saturation, Simulink checks whether the current value of the dx/dt initial condition (parameter or signal) allows the state x to leave saturation immediately. If so, Simulink reinitializes state dx/dt with the value of the initial condition (parameter or signal) at that instant. If not, Simulink ignores this parameter at the current instant and sets dx/dt to zero to make the block states consistent.

This parameter only applies at the time when x actually reaches saturation limit. It does not apply at any future time when x is being held at saturation.

Refer to the sections on limiting the states for more information. For an example, see the sldemo_bounce demo.

Disregarding State Limits and External Reset for Linearization

For cases where you simplify your model by linearizing it, you can have Simulink disregard the limits of the states and the external reset by selecting Ignore state limits and the reset for linearization.

Specifying the Absolute Tolerance for the Block Outputs

By default Simulink software uses the absolute tolerance value specified in the Configuration Parameters dialog box (see Specifying Error Tolerances for Variable-Step Solvers) to compute the output of the integrator blocks. If this value does not provide sufficient error control, specify a more appropriate value for state x in the Absolute tolerance x field and for state dx/dt in the Absolute tolerance dx/dt field of the parameter dialog box. Simulink uses the values that you specify to compute the state values of the block.

Specifying the Display of the Output Ports

You can control whether or not to display the x or the dx/dt output port using the ShowOutput parameter. You can display one output port or both; however, you must select at least one.

Specifying the State Names

You can specify the name of x states and dx/dt states using the StateNameX and StateNameDXDT parameters. However, you must specify names for either both or neither; you cannot specify names for just x or just dx/dt. Both state names must have identical type and length. Furthermore, the number of names must evenly divide the number of states.

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.

For more information, see Data Types Supported by Simulink in the Simulink documentation.

Parameters and Dialog Box

The x pane of the Second-Order Integrator block dialog box appears as follows:

The dx/dt pane of the Second-Order Integrator block dialog box appears as follows:

The Attributes pane of the Second-Order Integrator block dialog box appears as follows:

Initial condition source x

Specify the initial condition source for state x.

Settings

Default: internal

internal

Get the initial conditions of state x from the Initial condition x parameter.

external

Get the initial conditions of state x from an external block.

Tip

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

Dependencies

Selecting internal enables the Initial condition x parameter.

Selecting external disables the Initial condition x parameter..

Command-Line Information

Parameter: ICSourceX
Type: string
Value: 'internal' | 'external'
Default: 'internal'

Initial condition x

Specify the initial condition of state x.

Settings

Default: 0.0

Tip

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

Dependencies

Setting Initial condition source x to internal enables this parameter.

Setting Initial condition source x to external disables this parameter.

Command-Line Information

Parameter: ICX
Type: vector or scalar
Value: any valid real value
Default: 0.0

Limit x

Limit state x of the block to a value between the Lower limit x and Upper limit x parameters.

Settings

Default: Off for Second-Order Integrator, On for Second-Order Integrator Limited

On

Limit state x to a value between the Lower limit x and Upper limit x parameters.

Off

Do not limit the state x output to a value between the Lower limit x and Upper limit x parameters.

Dependencies

This parameter enables Upper limit x parameter.

This parameter enables Lower limit x parameter.

Command-Line Information

Parameter: LimitX
Type: string
Value: 'on' | 'off'
Default: 'off' | 'on'

Upper limit x

Specify the upper limit of state x.

Settings

Default: inf for Second-Order Integrator, 1 for Second-Order Integrator Limited

Tip

The upper saturation limit for state x must be strictly greater than the lower saturation limit.

Dependency

Limit x enables this parameter.

Command-Line Information

Parameter: UpperLimitX
Type: scalar or vector
Value: any valid real value
Default: 'inf' | 1

Lower limit x

Specify the lower limit of state x.

Settings

Default: –inf for Second-Order Integrator, 0 for Second-Order Integrator Limited

Tip

The lower saturation limit for state x must be strictly less than the upper saturation limit.

Dependencies

Limit x enables this parameter.

Command-Line Information

Parameter: LowerLimitX
Type: scalar or vector
Value: any valid value
Default: '-inf' | 0

Absolute tolerance x

Specify the absolute tolerance for computing state x.

Settings

Default: auto

Command-Line Information

Parameter: AbsoluteToleranceX
Type: string, scalar, or vector with same dimension as x
Value: any positive real scalar or vector | {'auto'} | {-1}
Default: 'auto'

State name x

Assign a unique name to state x.

Settings

Default: ''

Tips

Command-Line Information

Parameter: StateNameX
Type: string
Value: any valid expression
Default: ''

Initial condition source dx/dt

Specify the initial condition source for state dx/dt.

Settings

Default: internal

internal

Get the initial conditions of state dx/dt from the Initial condition dx/dt parameter.

external

Get the initial conditions of state dx/dt from an external block.

Tip

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

Dependencies

Selecting internal enables the Initial condition dx/dt parameter.

Selecting external disables the Initial condition dx/dt parameter.

Command-Line Information

Parameter: ICSourceDXDT
Type: string
Value: 'internal' | 'external'
Default: 'internal'

Initial condition dx/dt

Specify the initial condition of state dx/dt.

Settings

Default: 0.0

Tip

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

Dependencies

Setting Initial condition source dx/dt to internal enables this parameter.

Setting Initial condition source dx/dt to external disables this parameter.

Command-Line Information

Parameter: ICDXDT
Type: scalar or vector
Value: any valid real value
Default: 0.0

Limit dx/dt

Limit the dx/dt state of the block to a value between the Lower limit dx/dt and Upper limit dx/dt parameters.

Settings

Default: Off for Second-Order Integrator, On for Second-Order Integrator Limited

On

Limit state dx/dt of the block to a value between the Lower limit dx/dt and Upper limit dx/dt parameters.

Off

Do not limit state dx/dt of the block to a value between the Lower limit dx/dt and Upper limit dx/dt parameters.

Tip

If you set saturation limits for x, then the interval defined by the Upper limit dx/dt and Lower limit dx/dt must contain zero.

Dependencies

This parameter enables Upper limit dx/dt.

This parameter enables Lower limit dx/dt.

Command-Line Information

Parameter: LimitDXDT
Type: string
Value: 'On' | 'Off'
Default: 'Off' | 'On'

Upper limit dx/dt

Specify the upper limit for state dx/dt.

Settings

Default: 'inf'

Tip

If you limit x, then this parameter must have a strictly positive value.

Dependencies

Limit dx/dt enables this parameter.

Command-Line Information

Parameter: UpperLimitDXDT
Type: scalar or vector
Value: any valid real value
Default: 'inf'

Lower limit dx/dt

Specify the lower limit for state dx/dt.

Settings

Default: '-inf'

Tip

If you limit x, then this parameter must have a strictly negative value.

Dependencies

Limit dx/dt enables this parameter.

Command-Line Information

Parameter: LowerLimitDXDT
Type: scalar or vector
Value: any valid real value
Default: '-inf'

Absolute tolerance dx/dt

Specify the absolute tolerance for computing state dx/dt.

Settings

Default: auto

Command-Line Information

Parameter: AbsoluteToleranceDXDT
Type: scalar
Value: any valid positive real value
Default: 'auto'

State name dx/dt

Assign a unique name to state dx/dt.

Settings

Default: ''

Tips

Command-Line Information

Parameter: StateNameDXDT
Type: string
Value: any valid expression
Default: ''

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 zero to a nonzero value or changes sign.

Command-Line Information

Parameter: ExternalReset
Type: string
Value: 'none' | 'rising' | 'falling' | 'either'
Default: 'none'

Enable zero-crossing detection

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

Settings

Default: On

On

Enable zero-crossing detection.

Off

Do not enable zero-crossing detection.

Command-Line Information

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

Reinitialize dx/dt when x reaches saturation

At the instant when state x reaches saturation, reset dx/dt to its current initial conditions.

Settings

Default: Off

On

Reset dx/dt to its initial conditions when x becomes saturated.

Off

Do not reset dx/dt to its initial conditions when x becomes saturated.

Tip

The dx/dt initial condition must have a value that enables x to leave saturation immediately. Otherwise, Simulink ignores the initial conditions for dx/dt to preserve mathematical consistency of block states.

Command-Line Information

Parameter: ReinitDXDTwhenXreachesSaturation
Type: string
Value: 'on' | 'off'
Default: 'off'

Ignore state limits and the reset for linearization

For linearization purposes, have Simulink ignore the specified state limits and the external reset.

Settings

Default: Off

On

Ignore the specified state limits and the external reset.

Off

Apply the specified state limits and the external reset setting.

Command-Line Information

Parameter: IgnoreStateLimitsAndResetForLinearization
Type: string
Value: 'on' | 'off'
Default: 'off'

Show output

Specify the output ports on the block.

Settings

Default: both

both

Show both x and dx/dt output ports.

x

Show only the x output port.

dx/dt

Show only the dx/dt output port.

Command-Line Information

Parameter: ShowOutput
Type: string
Value: 'both' | 'x' | 'dxdt'
Default: 'both'
  


Related Products & Applications

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

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