Quantcast

Documentation Center

  • Trial Software
  • Product Updates

sedb.blkinfo

Package: sedb

Block information in discrete-event simulation

Syntax

blkinfo(blkid)
blkinfo(blkname)
blk_struct = blkinfo(blkid)
blk_struct = blkinfo(blkname)

Description

blkinfo(blkid) displays information about the SimEvents® block with identifier blkid. To obtain a list of blocks and their identifiers, use sedb.blklist.

blkinfo(blkname) displays information about the SimEvents block with path name blkname.

blk_struct = blkinfo(blkid) or blk_struct = blkinfo(blkname) returns a structure that stores information about the block.

The following blocks are exceptions that do not provide information:

  • 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

blk_struct

Structure that stores information about the block. The following table describes the blk_struct fields and the blocks for which each field appears. Some fields appear for all blocks, while other fields appear only for certain blocks.

FieldBlockDescription
TimeAll blocksCurrent simulation time
BlockAll blocksPath name of the block
BlockIDAll blocks Block identifier
BlockTypeAll blocksType of block
CapacityAll queue and server blocksNumber of entities that the block can store at any one time
SelectedInputPortInput SwitchIndex of selected entity input port
SelectedOutputPortOutput SwitchIndex of selected entity output port
GateStatusEnabled Gate'open' or 'closed'
InputEntityReplicateIdentifier of the entity that the block is replicating
CurrentReplicaReplicateIdentifier of the copy of the input entity that the block created and that is about to advance
StatusReplicate, Entity Combiner, and Entity Splitter

Status of block

Values for Replicate Block:

  • 'Inactive'

  • 'Replicating X/Y'. X is the index of the entity output port through which the replica will depart. Y is the Number of entity output ports parameter of the block

Values for Entity Combiner Block:

  • 'Inactive'

  • 'Combining'

Values for Entity Splitter Block:

  • 'Inactive'

  • 'Splitting'

MemoryValueSignal LatchValue of the internal memory of the block
CountEntity Departure CounterNumber of entities that have departed from this block and arrived at subsequent storage blocks, since the simulation start or the last reset, whichever occurred later.
EntitiesAll blocks that possess an entity input port

Structure array, of which each element has these fields:

  • ID — Entity identifier

  • Status (queue and server blocks only) — Status of the entity with respect to the block.

    Entity Status Values in Queue Blocks:

    • 'Advancing'

    • 'Queuing'

    • 'Queued'

    • 'Timed Out'

    Entity Status Values in Server Blocks:

    • 'Advancing'

    • 'In Service'

    • 'Service Completed'

    • 'Preempted'

    • 'Timed Out'

  • Event (server blocks only) — Identifier of the service completion event for the entity

  • EventTime (server blocks only) — Time of the service completion event for the entity

  • TimeInQueue (queue blocks only) — Length of time the entity has been in the queue

Examples

View information about a block:

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

    sedebug('sedemo_start_timer_read_timer')
  2. Establish a breakpoint and proceed in the simulation. At the prompt, enter:

    tbreak 2.51
    cont

    The partial output indicates that the server is about to execute a service completion event:

    Hit b1 : Breakpoint for first operation at or after time 2.51
    
    %==============================================================================%
    Executing ServiceCompletion Event (ev8)               Time = 2.581301297500028
    : Entity = en4                                        Priority = 1
    : Block  = Infinite Server
  3. View information about the block that is about to execute the event:

    blkname = gceb
    blkid = gcebid

    The output is:

    blkname =
    
    sedemo_start_timer_read_timer/Infinite Server
    
    
    blkid =
    
    blk4
    
  4. Proceed further in the simulation:

    step

    The output shows that the entity is about to depart from the server:

        %..........................................................................%
        Entity Advancing (en4)
        : From = Infinite Server
        : To   = Read Timer
  5. Use the identifier, blkid, to display information about the block and the status of entities in it:

    % Display information in Command Window.
    blkinfo(blkid)

    The output is:

    InfiniteServer Current State                          T = 2.581301297500028
    Block (blk4): Infinite Server
    
    Entities (Capacity = Inf):
     Pos     ID        Status                   Event     EventTime
     1       en2       In Service               ev4       2.7303849396254689
     2       en4       Advancing                ev8       2.581301297500028
     3       en5       In Service               ev10      2.974736350905304
    
  6. Store the information in variables:

    % Store information in structure.
    blkdetails = blkinfo(blkid)
    % Store status of entities in cell array.
    blkentities = {blkdetails.Entities.Status}'

    The output is:

    blkdetails =
    
             Time: 2.5813
            Block: 'sedemo_start_timer_read_timer/Infinite Server'
          BlockID: 'blk4'
        BlockType: 'InfiniteServer'
         Capacity: Inf
         Entities: [1x3 struct]
    
    
    blkentities =
    
        'In Service'
        'Advancing'
        'In Service'
    
  7. Get more information about one of the entities by using data from the blkdetails structure as an input argument to the eninfo function:

    adv_eninfo = eninfo(blkdetails.Entities(1).ID);
    time_in_system = adv_eninfo.Timers.ElapsedTime

    The output is:

    time_in_system =
    
        1.5813
    
  8. End the debugger session. At the prompt, enter:

    sedb.quit

See Also

| |

Was this topic helpful?