In GUI mode, the debugger Sorted List pane
displays lists of blocks for a models root system and each nonvirtual
subsystem. Each list lists the blocks that the subsystems contains
sorted according to their computational dependencies, alphabetical
order, and other block sorting rules. In command-line mode, you can
use the slist
command to display a model's sorted
lists.
---- Sorted list for 'vdp' [11 nonvirtual block(s), directFeed=0] Total number of tasks = 2 - Sorted list of task index [0], 10 nonvirtual block(s) (0)0:1 'vdp/x1' (Integrator) Input ports: [0] Output ports: [0] (0)0:2 'vdp/Out1' (Outport) Input ports: [0] Output ports: [] (0)0:3 'vdp/x2' (Integrator) Input ports: [0] Output ports: [0] (0)0:4 'vdp/Out2' (Outport) Input ports: [0] Output ports: [] (0)0:5 'vdp/Scope' (Scope) Input ports: [0] Output ports: [] (0)0:6 'vdp/Square' (Math) Input ports: [0] Output ports: [0] (0)0:7 'vdp/Sum1' (Sum) Input ports: [0 1] Output ports: [0] (0)0:8 'vdp/Product' (Product) Input ports: [0 1] Output ports: [0] (0)0:9 'vdp/Mu' (Gain) Input ports: [0] Output ports: [0] (0)0:10 'vdp/Sum' (Sum) Input ports: [0 1] Output ports: [0] - Sorted list of task index [1], 1 nonvirtual block(s) (1)0:1 'vdp/Constant' (Constant) Input ports: [] Output ports: [0] ----- Task Index Legend ----- Task Index [0]: Cont Task Index [1]: Constant -----------------------------
These displays include the block index for each command. You can use them to determine the block IDs of the models blocks. Some debugger commands accept block IDs as arguments.
If a block belongs to an algebraic list, the slist
command
displays an algebraic loop identifier in the entry for the block in
the sorted list. The identifier has the form
algId=s#n
where s
is the index of the subsystem containing
the algebraic loop and n
is the index of the algebraic
loop in the subsystem. For example, the following entry for an Integrator
block indicates that it participates in the first algebraic loop at
the root level of the model.
0:1 'test/ss/I1' (Integrator, tid=0) [algId=0#1, discontinuity]
When the debugger is running, you can use the ashow
command
at the debugger command-line interface to highlight the blocks and
lines that make up an algebraic loop. See Displaying Algebraic Loops for more information.
To determine the block in a models diagram that corresponds
to a particular index, enter bshow s:b
at the command
prompt, where s:b
is the block index. The bshow
command
opens the system containing the block (if necessary) and selects the
block in the systems window.
The systems
command displays a list of the
nonvirtual systems in the model that you are debugging. For example,
the sldemo_clutch
model contains the following
systems:
open_system('sldemo_clutch') set_param(gcs, 'OptimizeBlockIOStorage','off') sldebug sldemo_clutch (sldebug @0): %----------------------------------------------------------------% [TM = 0 ] simulate(sldemo_clutch) (sldebug @0): >> systems 0 'sldemo_clutch' 1 'sldemo_clutch/Locked' 2 'sldemo_clutch/Unlocked'
Note
The systems
command does not list subsystems
that are purely graphical. That is, subsystems that the model diagram
represents as Subsystem blocks but that are solved as part of a parent
system. are not listed. In Simulink® models, the root system and
triggered or enabled subsystems are true systems. All other subsystems
are virtual (that is, graphical) and do not appear in the listing
from the systems
command.
The slist
command displays a list of the
nonvirtual blocks in a model. The listing groups the blocks by system.
For example, the following sequence of commands produces a list of
the nonvirtual blocks in the Van der Pol (vdp
)
example model.
sldebug vdp %----------------------------------------------------------------% [TM = 0 ] simulate(vdp) sldebug @0): >> slist ---- Sorted list for 'vdp' [9 nonvirtual blocks, directFeed=0] 0:0 'vdp/x1' (Integrator) 0:1 'vdp/Out1' (Outport) 0:2 'vdp/x2' (Integrator) 0:3 'vdp/Out2' (Outport) 0:4 'vdp/Scope' (Scope) 0:5 'vdp/Fcn' (Fcn) 0:6 'vdp/Product' (Product) 0:7 'vdp/Mu' (Gain) 0:8 'vdp/Sum' (Sum)
Note
The slist
command does not list blocks that
are purely graphical. That is, blocks that indicate relationships
between or groupings among computational blocks.
The zclist
command displays a list of blocks
in which nonsampled zero crossings can occur during a simulation.
For example, zclist
displays the following list
for the clutch sample model:
(sldebug @0): >> zclist 0 0:4:0 F HitCross 'sldemo_clutch/Friction Mode Logic/Lockup Detection/Velocities Match' 1 0:4:1 F 2 0:10:0 F Abs 'sldemo_clutch/Friction Mode Logic/Lockup Detection/Required Friction for Lockup/Abs' 3 0:12:0 F RelationalOperator 'sldemo_clutch/Friction Mode Logic/Lockup Detection/Required Friction for Lockup/Relational Operator' 4 0:19:0 F Abs 'sldemo_clutch/Friction Mode Logic/Break Apart Detection/Abs' 5 0:20:0 F RelationalOperator 'sldemo_clutch/Friction Mode Logic/Break Apart Detection/Relational Operator' 6 2:3:0 F Signum 'sldemo_clutch/Unlocked/slip direction'
The ashow
command highlights a specified
algebraic loop or the algebraic loop that contains a specified block.
To highlight a specified algebraic loop, enter ashow s#n
,
where s
is the index of the system (see Identifying Blocks in Algebraic Loops) that contains the
loop and n
is the index of the loop in the system.
To display the loop that contains the currently selected block, enter ashow
gcb
. To show a loop that contains a specified block, enter ashow s:b
, where s:b
is the block's
index. To clear algebraic-loop highlighting from the model diagram,
enter ashow clear
.
In GUI mode, the debugger displays the settings of various debug
options, such as conditional breakpoints, in its Status panel.
In command-line mode, the status
command displays
debugger settings. For example, the following sequence of commands
displays the initial debug settings for the vdp
model:
sim('vdp', 'StopTime', '10', 'debug', 'on') %----------------------------------------------------------------% [TM = 0 ] simulate(vdp) (sldebug @0): >> status %----------------------------------------------------------------% Current simulation time : 0.0 (MajorTimeStep) Solver needs reset : no Solver derivatives cache needs reset : no Zero crossing signals cache needs reset : no Default command to execute on return/enter : "" Break at zero crossing events : disabled Break on solver error : disabled Break on failed integration step : disabled Time break point : disabled Break on non-finite (NaN,Inf) values : disabled Break on solver reset request : disabled Display level for disp, trace, probe : 1 (i/o, states) Solver trace level : 0 Algebraic loop tracing level : 0 Animation Mode : off Execution Mode : Normal Display level for etrace : 0 (disabled) Break points : none installed Display points : none installed Trace points : none installed