Products & Services Solutions Academia Support User Community Company

Learn more about SimEvents   

sedb.evbreak - Package: sedb

Set breakpoint for execution or cancelation of event

Syntax

evbreak(evid)
bid = evbreak(evid)

Description

evbreak(evid) sets a breakpoint for execution or cancelation of the event with identifier, evid, in the simulation. To obtain a list of events on the event calendar and their identifiers, use sedb.evcal.

bid = evbreak(evid) returns the identifier of the breakpoint.

Examples

Set a breakpoint on a service completion event:

  1. Begin a debugger session for a particular model. At the MATLAB command prompt, enter:

    sedebug('sedemo_server_service_time')
  2. Proceed in the simulation. At the sedebug>> prompt, enter:

    step over

    The output is:

    %==============================================================================%
    Initializing Time-Based Entity Generators
        %..........................................................................%
        Scheduling EntityGeneration Event (ev1)
        : EventTime = 0.000000000000000 (Now)
        : Priority  = 500
        : Block     = Time-Based Entity Generator
        %..........................................................................%
        Scheduling EntityGeneration Event (ev2)
        : EventTime = 0.000000000000000 (Now)
        : Priority  = 500
        : Block     = Time-Based Entity Generator 1
        %..........................................................................%
        Scheduling EntityGeneration Event (ev3)
        : EventTime = 0.000000000000000 (Now)
        : Priority  = 500
        : Block     = Time-Based Entity Generator 3
    %==============================================================================%
    Executing EntityGeneration Event (ev1)                Time = 0.000000000000000
    : Entity = <none>                                     Priority = 500
    : Block  = Time-Based Entity Generator
  3. Proceed further:

    step over

    The output, with bold added, shows that a service completion event with identifier, ev4, appears on the event calendar. The scheduled time of the event is T=1.

        %..........................................................................%
        Generating Entity (en1)
        : Block = Time-Based Entity Generator
        %..........................................................................%
        Entity Advancing (en1)
        : From = Time-Based Entity Generator
        : To   = Single Server
        %..........................................................................%
        Scheduling ServiceCompletion Event (ev4)
        : EventTime = 1.000000000000000
        : Priority  = 500
        : Entity    = en1
        : Block     = Single Server
        %..........................................................................%
        Scheduling EntityGeneration Event (ev5)
        : EventTime = 1.000000000000000
        : Priority  = 500
        : Block     = Time-Based Entity Generator
    %==============================================================================%
    Executing EntityGeneration Event (ev2)                Time = 0.000000000000000
    : Entity = <none>                                     Priority = 500
    : Block  = Time-Based Entity Generator 1
  4. Set a breakpoint that causes the debugger to stop when it is about to execute the service completion event, ev4:

    evbreak ev4

    The output confirms the operation:

    Set b1 : Breakpoint for execution or cancelation of event ev4
  5. Run the simulation until the breakpoint:

    cont

    The partial output shows that the debugger proceeds through a different event at T=1, and stops upon hitting the breakpoint at event ev4. Because that event is not the first event the simulation executes at that time, the example shows how an event breakpoint differs from a timed breakpoint. A timed breakpoint at T=1 would have caused the debugger to stop upon the first event at this time, ev6.

    %==============================================================================%
    Executing ServiceCompletion Event (ev6)               Time = 1.000000000000000
    : Entity = en2                                        Priority = 300
    : Block  = Infinite Server
        %..........................................................................%
        Entity Advancing (en2)
        : From = Infinite Server
        : To   = Entity Sink2
        %..........................................................................%
        Destroying Entity (en2)
        : Block = Entity Sink2
    
    Hit b1 : Breakpoint for execution or cancelation of event ev4
    
    %==============================================================================%
    Executing ServiceCompletion Event (ev4)               Time = 1.000000000000000
    : Entity = en1                                        Priority = 500
    : Block  = Single Server
  6. End the debugger session. At the sedebug>> prompt, enter:

    sedb.quit

See Also

sedb.bdelete | sedb.breakpoints | sedb.cont | sedb.evcal

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS