主要内容

Steady State Detection

R2026b

Detect when systems reach steady-state operation during simulation

Since R2026b

  • Steady State Detection block

Libraries:
Simulink Extras / Steady State

Description

The Steady State Detection block monitors the input signal to determine when a system reaches steady-state operation during simulation. To detect steady-state operation, connect an input signal that converges to either a constant value or a constant period. The block can automatically detect steady-state operation, or you can explicitly define what constitutes steady-state operation for a given system by specifying block parameters.

If the input signal converges to a constant period, specify:

  • The target period

  • The tolerance for the period and amplitude

  • The number of consecutive peaks or samples that must satisfy the steady-state criteria

If the input signal converges to a constant value, specify:

  • The target value

  • The tolerance for the target value

  • The number of consecutive input signal values that must fall within the specified tolerance of the target value

The block produces two outputs that change value when the system reaches steady-state operation. Use the output signals to trigger downstream logic. For example, you can switch control logic or stop the simulation to save an operating point.

Ports

Input

expand all

Connect the signal you want to monitor to detect steady-state operation.

Tips

To stabilize the block outputs for periodic steady-state detection, add a lowpass filter upstream of the Steady State Detection block.

Data Types: double

Output

expand all

The output value indicates when the system is in steady-state operation.

  • 0 — The system is not in steady-state operation.

  • 1 — The system is in steady-state operation.

Tips

To maintain the steady-state status for downstream logic, latch this output value after the system first transitions to steady-state operation.

Data Types: Boolean

When the block detects steady-state operation, the output value indicates the measured period of the input signal. Otherwise, the output value is zero.

Dependencies

This port is present only when Detection mode is Periodic.

Data Types: double

When the block detects steady-state operation, the output value indicates the converged value of the input signal. Otherwise, the output value is zero.

Dependencies

This port is present only when Detection mode is Constant.

Data Types: double

Parameters

expand all

To edit block parameters interactively, use the Property Inspector. From the Simulink® Toolstrip, on the Simulation tab, in the Prepare gallery, select Property Inspector.

Select the mode that matches the steady-state behavior of the input signal.

  • Periodic — Detect steady-state operation when the input signal converges to a steady period and amplitude.

  • Constant — Detect steady-state operation when the input signal converges to a constant value.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: DetectionMode
Values: 'Periodic' (default) | "Constant"

Example: set_param(blk,DetectionMode="Constant")

Specify the expected period of the input signal when the system reaches steady-state operation. By default, the block automatically detects the steady-state period of the input signal.

Dependencies

To enable this parameter, set Detection Mode to Periodic.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: TargetPeriod
Values: 'auto' (default) | positive scalar
Data Types: string | char

Example: set_param(blk,TargetPeriod="0.5")

If the measured period is not within the specified tolerance, the block resets the stability count.

Dependencies

To enable this parameter, set Detection Mode to Periodic.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: PeriodTolerance
Values: '1e-3' (default) | positive scalar
Data Types: string | char

Example: set_param(blk,PeriodTolerance="1e-2")

The block considers the signal periodic when the value of the consecutive detected peaks falls within the specified tolerance.

Dependencies

To enable this parameter, set Detection Mode to Periodic.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: AmplitudeTolerance
Values: '1e-3' (default) | positive scalar
Data Types: string | char

Example: set_param(blk,AmplitudeTolerance="1e-2")

The block detects steady-state operation when the specified number of input signal measurements satisfy the steady-state criteria. The counted measurement depends on the value of the Target Period parameter.

  • If Target Period is auto, the block counts the number of consecutive peaks that satisfy the amplitude tolerance.

  • If Target Period is a positive number, the block counts the number of consecutive samples that satisfy the amplitude tolerance when compared to the corresponding sample from the previous period.

    The stability count increments if the difference between the current sample u(t) and the corresponding sample from the previous period u(t-T) is smaller than the amplitude tolerance.

Dependencies

To enable this parameter, set Detection Mode to Periodic.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: PeriodicStabilityCount
Values: '5' (default) | positive integer
Data Types: string | char

Example: set_param(blk,StableCycles="3")

Expected constant input value when the system reaches steady-state operation. By default, the block determines the constant value as the value of the signal that satisfies the specified stability count.

Dependencies

To enable this parameter, set Detection Mode to Constant.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: TargetValue
Values: 'auto' (default) | real scalar
Data Types: string | char

Example: set_param(blk,TargetValue="10")

The block resets the stability count if the difference between the input signal and target value exceeds the specified tolerance.

Dependencies

To enable this parameter, set Detection Mode to Constant.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ConstantTolerance
Values: '1e-3' (default) | positive scalar
Data Types: string | char

Example: set_param(blk,ConstantTolerance="1e-2")

The block detects steady-state operation when the input value satisfies the target value criteria for the specified number of time steps. To reduce the likelihood of premature steady-state detection, specify a larger value.

Dependencies

To enable this parameter, set Detection Mode to Constant.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

Parameter: ConstantStabilityCount
Values: '5' (default) | positive integer
Data Types: string | char

Example: set_param(blk,StabilityCount="10")

In normal mode simulations, this parameter specifies how the Steady State Detection block executes. By default, the block executes interpreted code.

  • Interpreted execution — Choose this option for faster compilation time in short simulations. Interpreted code compiles faster but executes more slowly during simulation.

  • Code generation — Choose this option to speed up longer simulations. Code generation increases compilation time but generated code executes much faster during simulation.

Programmatic Use

To set the block parameter value programmatically, use the set_param function.

To get the block parameter value programmatically, use the get_param function.

Parameter: SimulateUsing
Values: 'Interpreted execution' (default) | "Code generation"
Data Types: string | char

Example: set_param(blk,SimulateUsing="Code generation")

Version History

Introduced in R2026b