Show algebraic loops in a model
returns a list of algebraic loops in a
model as a vector of
The Algebraic Loops viewer provides a tabular list of all algebraic loops in the model. Use the Algebraic Loops viewer to control the display of algebraic loops in your model.
Highlight all algebraic loops in model
In the Diagnostics pane of Model Configuration
Parameters, set Algebraic loop to
warning. Setting this
error prevents the model from compiling.
Compile the model without any errors. The model must compile before you can highlight any algebraic loops.
At the MATLAB command prompt, enter:
mdl = 'ex_sldemo_hydcyl'; load_system(mdl); Simulink.BlockDiagram.getAlgebraicLoops(bdroot)
AlgebraicLoop with properties: Model: [1×1 Simulink.BlockDiagram] Id: [0 1] VariableBlockHandles: [198.0001 145.0001] BlockHandles: [9×1 double] IsArtificial: 0
The resulting output shows that the model has one algebraic loop, which contains three blocks.
getAlgebraicLoops function also opens the Algebraic
Loop viewer. Use the Algebraic loop viewer to highlight specific algebraic loops in your
model or all the loops.
The selected loops are highlighted in the corresponding model, in.
model — Model to highlight
string scalar | character vector
Name of the model being tested, specified as a string scalar or character vector.
You can also pass the most recently opened model using
The model must be loaded into memory using either
loops — Algebraic loops
Every algebraic loop in the model returned as an
object that contains the following information:
Simulink.BlockDiagramobject representing the model
Id— Index of the algebraic loop in the model
VariableBlockHandles: Handles to blocks that have been assigned algebraic variables
BlockHandles—Handles to all the blocks contained in the algebraic loop
IsArtificial— Boolean value indicating whether the loop is an artificial algebraic loop.
h — Handle to control UI
The control UI is a MATLAB® figure window. Use the UI handle
h to control it
programmatically. For more information, see Figure Properties.
Introduced before R2006a