Documentation Center

  • Trials
  • Product Updates


Package: sedb

Identifier of currently executing block in discrete-event simulation


blkid = gcebid


blkid = gcebid returns the identifier of the block associated with the current operation. If the current operation is not associated with a block, blkid is an empty string. If an entity is advancing, blkid indicates the block from which the entity departs.


View information about a block:



    tbreak 2.51


    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

    blkname = gceb
    blkid = gcebid

    The output is:

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



        Entity Advancing (en4)
        : From = Infinite Server
        : To   = Read Timer

    % Display information in Command Window.

    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'
        'In Service'

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

    The output is:

    time_in_system =


See Also

Was this topic helpful?