|On this page…|
You can configure the SimEvents® debugger to include or omit certain kinds of messages in its simulation log. You can focus on the messages that are relevant to you by omitting irrelevant messages.
The overall configuration regarding including or omitting messages is called the debugger's detail settings. Each individual category of messages that you can include or omit corresponds to an individual detail setting. A particular detail setting is on if the simulation log includes messages in the corresponding category.The setting is off if the simulation log omits messages in the category.
The detail function lets you configure and view detail settings. The following table lists the available detail settings and the programmatic names that you see as inputs or field names when you use the detail function.
|Category of Messages||Programmatic Name in detail Function||Further Information About Messages in Category|
|Event operations, except independent operations representing event executions||ev||Event Scheduling, Execution, and Cancelation Messages|
|Entity operations||en||Entity Operation Messages|
|Event calendar information||cal||Optional Displays of Event Calendar in the Simulation Log|
|Signal operations||sig||Signal Operation Messages|
Messages that you cannot selectively omit from the simulation log include messages about independent operations, such as the execution of events on the event calendar. Messages about independent operations appear whenever any of the detail settings is on. The reason for including messages about independent operations is that they provide a context in which you can understand other messages. To learn more about independent operations, see Independent Operations and Consequences in the Debugger.
Different debugging scenarios benefit from different detail settings. Use these suggestions to help you choose appropriate settings for your needs:
When using step to proceed in the simulation, include event or entity operations in the simulation log if you want the debugger to suspend the simulation at such operations to let you inspect states.
When using breakpoints to skip a large portion of the simulation that is irrelevant to you, omitting all messages (detail none) can prevent the Command Window from accumulating a lot of simulation log text that does not interest you.
Tip If you use step from a breakpoint onward, turn on at least one of the detail settings, or else you will likely step too far. For details, see Effect of Detail Settings on Stepping.
If you want to inspect final states but are not interested in the simulation log, omit all messages (detail none) and then enter cont. The simulation proceeds until the built-in breakpoint at the end of the simulation, with minimal text in the simulation log.
If you want to focus on entities instead of events, try detail('en',1,'ev',0, 'sig', 0). The simulation log still shows independent operations, but the dependent operations in the simulation log exclude event scheduling, cancelation, and execution operations.
If you want to focus on events instead of entities, try detail('en',0,'ev',1, 'sig', 0) or detail('en',0,'ev',1,'sig',0,'cal',1).
If you want to focus on signals instead, try detail('en',0,'ev',0,'sig',1) or detail('en',0,'ev',0,'sig',1,'cal',1).
If you are not sure which messages in the simulation log might be useful for later reference, consider these approaches:
If you include less information in the simulation log, the simulation might run more quickly and the simulation log might be more manageable. However, you risk missing important information and having to run the simulation again to see that information.
If you include more information in the simulation log, it might be harder for you to find the relevant portions. Using Edit > Find in the Command Window might help you see the portions of interest to you.
Reducing textual output in the Command Window can save time.
The behavior of detail and step are related. If you change the detail settings from their default values to cause the simulation log to omit entity messages or event messages, then you cannot step to an operation that corresponds to an omitted message, unless a breakpoint coincides with the operation. A specific example of this behavior follows.
If your detail settings cause the simulation log to omit all messages (equivalent to the detail none command), you cannot step to anything other than breakpoints. In the absence of breakpoints, a step causes the simulation to proceed until the end. If you inadvertently reach the end of the simulation in this way and want to return to the point in the simulation from which you tried to step, use a time or event identifier that appears in the Command Window to set a breakpoint in a subsequent debugging session. For example, if the last message in the simulation log, before you inadvertently stepped too far, indicates the execution of event ev5, then you can exit the debugger session, restart it, and enter evbreak ev5; cont.
Skip Entity Operations When Stepping
When the detail setting for entity operations is off, the simulation log omits messages about entity operations and you cannot step to entity operations.
Open and debug a model. At the MATLAB® command prompt, enter:
Omit entity operation messages. At the sedebug>> prompt, enter:
Proceed with the simulation. At the sedebug>> prompt, enter the following command six times in succession:
The output reflects that when you step through the simulation, the debugger does not suspend the simulation upon the entity's generation, advancement, attribute assignment, or destruction. The reason is that the detail setting for entity operations is off.
Detected Sample Time Hit Time = 0.000000000000000 : Block = Subsystem/Event-Based Entity Generator sedebug>> step %..........................................................................% Scheduling EntityGeneration Event (ev1) : EventTime = 0.000000000000000 (Now) : Priority = SYS1 : Entity = <none> : Block = Subsystem/Event-Based Entity Generator %==============================================================================% Executing EntityGeneration Event (ev1) Time = 0.000000000000000 : Entity = <none> Priority = SYS1 : Block = Subsystem/Event-Based Entity Generator sedebug>> step %..........................................................................% Scheduling ServiceCompletion Event (ev2) : EventTime = 0.055383948677907 : Priority = 500 : Entity = en1 : Block = Subsystem/Infinite Server %==============================================================================% Executing ServiceCompletion Event (ev2) Time = 0.055383948677907 : Entity = en1 Priority = 500 : Block = Subsystem/Infinite Server %==============================================================================% Detected Sample Time Hit Time = 0.100000000000000 : Block = Subsystem/Event-Based Entity Generator
End the debugger session. At the sedebug>> prompt, enter:
To view the current detail settings in the Command Window, at the sedebug>> prompt, enter:
The output looks like this, where the on and off values depend on your current detail settings:
Event Operations (ev) : on Entity Operations (en) : off Signal Operations (sig) : on Event Calendar (cal) : off
If a line in the output says on, the simulation log shows the corresponding type of message. Otherwise, the simulation log omits the corresponding type of message.
To change detail settings, enter a detail command that includes one or more inputs. For available syntaxes, see the reference page for the sedb.detail function.
Tips to help you select a suitable syntax are:
To change one or more detail settings but not all detail settings, use inputs that specify the name and new value of the detail settings you want to change. Detail settings you omit from the syntax remain unchanged.
To change all detail settings, use inputs that specify the name and new value of all detail settings. One way to ensure that you include all settings in the command is to use a structure variable containing the current settings as a starting point. For an example, see Include Event Calendar Information Using a Structure.
To make it easier to restore previous settings later, use a syntax that includes an output. For details, see How to Save and Restore Detail Settings.
To learn which messages in the simulation log correspond to each detail setting, see Customizable Information in the Simulation Log.
For suggestions on choosing which messages to include or omit based on your debugging situation, see Tips for Choosing Appropriate Detail Settings.
Include Event Calendar Information Using a Parameter/Value Pair
To cause the simulation log to include event calendar information but not change any other detail settings, at the sedebug>> prompt, enter:
The output includes the following line confirming the change:
Event Calendar (cal) : on
Include Event Calendar Information Using a Structure
Entering these commands at the sedebug>> prompt has the same effect as the example above and also creates a structure variable, s, that records the new detail settings:
s = detail; % Get current detail settings. s.cal = 1; % Change value of cal field of structure s. detail(s); % Use s to change cal detail setting.
If you expect to change detail settings frequently or temporarily during a debugger session, you can use an output from the detail function to facilitate restoring previous settings. Use this procedure:
When changing detail settings, enter a detail command that includes an output. The output variable records the settings before they change to correspond to the inputs that you specify in your command.
When you want to restore the earlier detail settings, use the variable as an input to detail.
As a special case, you can restore default detail settings. At the sedebug>> prompt, enter detail default.
Omit and Reinstate Entity Messages
To cause the simulation log to include event calendar information and also create a structure variable, prev, that records the previous detail settings, at the sedebug>> prompt, enter:
prev = detail('cal',1) % Record settings and then change them.
The next command restores the earlier settings:
detail(prev) % Restore previous settings.