Quantcast

Documentation Center

  • Trial Software
  • Product Updates

sedb.blkbreak

Package: sedb

Set breakpoint for discrete-event simulation block

Syntax

blkbreak(blkid)
blkbreak(blkname)
bid = blkbreak(blkid)
bid = blkbreak(blkname)

Description

blkbreak(blkid) sets a breakpoint for the SimEvents® block with identifier blkid. To obtain a list of blocks and their identifiers, use sedb.blklist.

blkbreak(blkname) sets a breakpoint for the SimEvents block with path name blkname.

bid = blkbreak(blkid) or bid = blkbreak(blkname) returns the identifier of the breakpoint.

The following blocks are exceptions that do not support block breakpoints:

  • Conn

  • Event-Based Random Number

  • Event-Based Sequence

  • Initial Value

Input Arguments

blkid

String that represents an identifier of a SimEvents block.

blkname

String that represents the path name of a SimEvents block.

Output Arguments

bid

String that represents a breakpoint identifier.

Examples

Examine a routing decision using a breakpoint on an Output Switch block:

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

    sedebug('sedemo_arq_selective_repeat')
  2. Double-click the Receiver subsystem to open it. On the Output Switch block inside the Receiver subsystem, establish a breakpoint. At the sedebug>> prompt, enter:

    blkbreak('sedemo_arq_selective_repeat/Receiver/Output Switch')

    The output confirms the creation of the block breakpoint:

    Set b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
  3. Proceed until the simulation reaches the breakpoint:

    cont

    The end of the partial output indicates that a sample time hit has been detected:

    %..........................................................................%
        Entity Advancing (en2)
        : From = Forward Channel/Infinite Server
        : To   = Addition of Errors/Set Attribute
        %..........................................................................%
        Setting Attribute on Entity (en2)
        : crc_check = 0
        : Block = Addition of Errors/Set Attribute
        %..........................................................................%
        Entity Advancing (en2)
        : From = Addition of Errors/Set Attribute
        : To   = Receiver/Get Attribute
        %..........................................................................%
        Entity Advancing (en2)
        : From = Receiver/Get Attribute
        : To   = Receiver/Zero Delay
        %..........................................................................%
        Scheduling ServiceCompletion Event (ev7)
        : EventTime = 1.100000000000000 (Now)
        : Priority  = 10
        : Entity    = en2
        : Block     = Receiver/Zero Delay
        %..........................................................................%
        Scheduling Subsystem Event (ev8)
        : EventTime = 1.100000000000000 (Now)
        : Priority  = 1
        : Entity    = <none>
        : Block     = Receiver/Discrete Event Subsystem/tp63efdc8c_2b3b_442f_9f27_f5
    %==============================================================================%
    Executing Subsystem Event (ev8)                       Time = 1.100000000000000
    : Entity = <none>                                     Priority = 1
    : Block  = Receiver/Discrete Event Subsystem/tp63efdc8c_2b3b_442f_9f27_f5
    
    Hit b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
    
        %..........................................................................%
        Detected Sample Time Hit
        : Block = Receiver/Output Switch
  4. Examine the source of the new value, 1. In the Receiver subsystem, the blocks and signal connections indicate that the p signal arises from a computation in the Discrete Event Subsystem virtual subsystem. The computation involves an attribute of an entity. The Get Attribute block dialog box indicates that the name of the attribute is crc_check. To determine which entity has the attribute in this particular computation, use the output from the preceding step. An entity with identifier en2 departed from the Get Attribute block. Inspect the attributes of this entity, as follows:

    eninfo en2

    The output shows a crc_check value of 0. According to the main description of the model, a CRC value of 0 indicates an error.

    Entity (en2) Current State                            T = 1.100000000000000
    Location: Receiver/Zero Delay
    
    Attributes:
      Name       Value
      crc_check  0
      seqNum     1
    
    Timeouts, Timers: None
    
  5. Proceed in the simulation to the next operation of the switch block:

    cont

    The switch block is about to respond to the new value of the p input signal by scheduling a port selection event:

    Hit b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
    
        %..........................................................................%
        Scheduling PortSelection Event (ev9)
        : EventTime = 1.100000000000000 (Now)
        : Priority  = SYS1
        : Entity    = <none>
        : Block     = Receiver/Output Switch
  6. Proceed further in the simulation to the next operation:

    cont

    The output shows that the switch block is about to execute the port selection event. Executing that event causes the switch to select the entity output port corresponding to the new value of the p input signal.

    Hit b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
    
    %==============================================================================%
    Executing PortSelection Event (ev9)                   Time = 1.100000000000000
    : Entity = <none>                                     Priority = SYS1
    : Block  = Receiver/Output Switch
  7. Continue to proceed further in the simulation to the next operation:

    cont

    The output shows that the entity with identifier en2 is about to advance to the switch block:

    %==============================================================================%
    Executing ServiceCompletion Event (ev7)               Time = 1.100000000000000
    : Entity = en2                                        Priority = 10
    : Block  = Receiver/Zero Delay
        %..........................................................................%
        Entity Advancing (en2)
        : From = Receiver/Zero Delay
        : To   = Receiver/Entity Departure Event to Function-Call Event
    
    Hit b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
    
        %..........................................................................%
        Entity Advancing (en2)
        : From = Receiver/Entity Departure Event to Function-Call Event
        : To   = Receiver/Output Switch
  8. Continue to proceed further in the simulation to the next operation:

    cont

    The output shows that the entity advances to the Discarded Frames block, consistent with a CRC value of 0, indicating an error:

    Hit b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
    
        %..........................................................................%
        Entity Advancing (en2)
        : From = Receiver/Output Switch
        : To   = Receiver/Discarded Frames
  9. Disable the breakpoint for the Output Switch block by referencing its breakpoint identifier:

    disable b1

    Disabling a block breakpoint, when you are done investigating the block, helps you focus on operations that are relevant to you. The output confirms the disabling of the block breakpoint:

    Disabled b1 : Breakpoint for block (blk6) sedemo_arq_selective_repeat/Receiver/Output Switch
  10. End the debugger session. At the sedebug>> prompt, enter:

    sedb.quit

See Also

| | |

Was this topic helpful?