Main Content

Algebraic loop

Diagnostic behavior when algebraic loop detected during compilation

Model Configuration Pane: Diagnostics

Description

This parameter specifies the diagnostic behavior when the software detects an algebraic loop while compiling a model.

Settings

warning (default) | error | none
warning

The software issues a warning and tries to solve the algebraic loop during simulation. If the solver is unable to solve the algebraic loop during simulation, the software issues an error and terminates the simulation.

error

The software issues an error, terminates the simulation, and highlights the algebraic loop in the block diagram when an algebraic loop is detected.

none

The software does not issue a diagnostic when it detects an algebraic loop. If the software is unable to solve the algebraic loop during simulation, the software issues an error and terminates the simulation.

Tips

  • An algebraic loop generally occurs when both these conditions are true:

    • The output value for a block depends on one or more of the input values.

    • The output port for the block drives an input port on the same block through a direct connection or an indirect connection, such as a feedback loop that contains other blocks with input ports that have direct feedthrough.

    For example, this scalar algebraic loop is created by connecting the output of a Subtract block to its negative input port.

    The portion of a block diagram that represents this algebraic loop.

    For more information, see Algebraic Loop Concepts.

  • When a model contains an algebraic loop, the software calls a loop-solving routine to solve the loop at each time step. The loop solver performs iterations to determine the solution. As a result, algebraic loops can negatively affect simulation performance.

  • To identify and analyze algebraic loops in your model, use the Simulink.BlockDiagram.getAlgebraicLoops function.

Recommended Settings

ApplicationSetting
Debuggingerror
TraceabilityNo impact
EfficiencyNo impact
Safety precautionerror

Programmatic Use

Parameter: AlgebraicLoopMsg
Value: 'none' | 'warning' | 'error'
Default: 'warning'

Version History

Introduced before R2006a