Identify and highlight algebraic loops in simulation debugging session
ashow displays in the MATLAB® Command Window a list of algebraic loops in the model for the current
simulation debugging session.
You can use this function in a simulation debugging session started:
This function is available only for simulation debugging sessions started programmatically and for interactive simulation debugging sessions while paused within a time step.
ashow displays in the MATLAB Command Window information about the algebraic loop that contains the block
blk. When the block
blk is part of an algebraic
loop, this command also highlights the algebraic loop that contains the block
blk in the block diagram.
ashow displays in the MATLAB Command Window information about the algebraic loop
and highlights the algebraic loop in the block diagram.
ashow clear removes algebraic loop highlighting from the block
Examine Algebraic Loops in Simulation Debugging Session
ashow function to examine algebraic
loops in the model
Open the model
Start a simulation debugging session for the model using the
sldebug function. The MATLAB Command Prompt (
>>) becomes the Simulink debugger prompt (
(sldebug @0): >> ).
(sldebug @0): >>
step function to step to the first method in the first
major time step for the simulation.
%----------------------------------------------------------------% [TM = 0 ] sldemo_hydcyl.Outputs.Major
ashow function to show a list of algebraic loops in the
Found 1 Algebraic loop(s): System number#Algebraic loop id, number of blocks in loop - (0)0#1, 9 block(s) in loop
Use the algebraic loop identifier in the information returned by the
ashow function to get more information about the algebraic loop.
ashow function lists the paths to the nine blocks in the loop
and identifies which blocks correspond to algebraic variables in the loop.
- sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/IC - sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/Sqrt - sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/Product - sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/laminar flow pressure drop - sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Sum7 - sldemo_hydcyl/Pump/IC - sldemo_hydcyl/Valve//Cylinder//Piston//Spring Assembly/Control Valve Flow/Sum1 (algebraic variable) - sldemo_hydcyl/Pump/Sum1 - sldemo_hydcyl/Pump/leakage (algebraic variable)
ashow function also highlights the specified loop in the
block diagram. In this model, the loop includes blocks in two different levels of the
model hierarchy so only the blocks in the
Control Valve Flow masked
subsystem are visible.
When you have finished analyzing and debugging the model, use the
stop function to end the simulation debugging session.
blk — Block in model
Block in model, specified as one of these options:
gcb— Current block
(t)s:b— Block ID, where
tis the index of the task that contains the block,
sis the index of the system that contains the block, and
bis the block index
aloop — Algebraic loop
algebraic loop ID
Algebraic loop, specified as an algebraic loop ID. Algebraic loop IDs have the form
t is the index of the task that
contains the algebraic loop,
s is the index of the system that
contains the algebraic loop, and
n is the index of the algebraic loop
in the system.
To start a simulation debugging session interactively, add one or more breakpoints to your model and in the Breakpoints List, check that Pause within time step is selected. When the simulation pauses on a breakpoint, some of the programmatic debugging commands, such as the
stop command, are available for use in the MATLAB Command Window.
Introduced before R2006a