sedb.eninfo

Package: sedb

Entity information in discrete-event simulation

Syntax

eninfo(enid)
en_struct = eninfo(enid)

Description

eninfo(enid) displays information about the location, attributes, timers, and timeouts on an entity. enid is the identifier of the entity.

en_struct = eninfo(enid) returns a structure that stores information about the entity.

Input Arguments

enid

String that represents an entity identifier.

Output Arguments

en_struct

Structure that stores information about the entity. The following table describes the en_struct fields.

FieldDescription
TimeCurrent simulation time
LocationPath name of the block containing the entity
AttributesStructure whose field names and values match the names and values of the attributes of the entity
Timers

Structure array, of which each element has these fields:

  • Tag — Timer tag

  • ElapsedTime — Time elapsed since the timer started

Timeouts

Structure array, of which each element has these fields:

  • Tag — Timeout tag

  • TimeOfTimeout — Scheduled time of timeout event

  • Event— Identifier of timeout event

Examples

View the values of the attributes of an entity:

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

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

    tbreak 0.1
    cont

    The partial output shows the entity identifier, en1, in the display:

    Hit b1 : Breakpoint for first operation at or after time 0.1
    
    %==============================================================================%
    Executing ServiceCompletion Event (ev2)               Time = 0.300000000000000
    : Entity = en1                                        Priority = 5
    : Block  = Distribution Center/Infinite Server
  3. Get the ID of an entity:

    % Get ID of current entity.
    enid = gcen

    The workspace variable, enid, holds the same entity identifier, en1, from the display:

    enid =
    
    en1
    
  4. Use the identifier, enid, to display information about the entity in the Command Window:

    % Display information in Command Window.
    eninfo(enid)

    The output is:

    Entity (en1) Current State                            T = 0.300000000000000
    Location: Distribution Center/Infinite Server
    
    Attributes:
      Name                 Value
      CurrentRoute         1
      CurrentServiceTime   2
      CurrentStep          2
      JobClass             1
      JobID                1
      JobServiceStatus     [1x15]
      LastServiceLocation  0
      ServiceProcess       [1x6]
      ServiceTime          [1x6]
    
    Timeouts, Timers: None
    
  5. Store the information in variables:

    % Store information in structure.
    endetails = eninfo(enid)
    % View attributes.
    enattrs = endetails.Attributes
    % View one attribute.
    enServiceProcess = enattrs.ServiceProcess
    % Equivalently, view one attribute starting from endetails.
    enServiceProcess = endetails.Attributes.ServiceProcess;

    The output is:

    endetails =
    
              Time: 0.3000
          Location: 'sedemo_star_routing/Distribution Center/Infinite Server'
        Attributes: [1x1 struct]
            Timers: [0x0 struct]
          Timeouts: [0x0 struct]
    
    
    enattrs =
    
               CurrentRoute: 1
         CurrentServiceTime: 2
                CurrentStep: 2
                   JobClass: 1
                      JobID: 1
           JobServiceStatus: [1x15 double]
        LastServiceLocation: 0
             ServiceProcess: [1 2 4 2 3 5]
                ServiceTime: [2 1 5 3 4 0]
    
    
    enServiceProcess =
    
         1     2     4     2     3     5
    
  6. End the debugger session. At the prompt, enter:

    sedb.quit
Was this topic helpful?