Documentation Center

  • Trials
  • Product Updates

sedb.gcen

Package: sedb

Identifier of entity currently undergoing operation

Syntax

enid = gcen

Description

enid = gcen returns the identifier of the entity that undergoes the current operation. If the current operation does not apply to a unique entity, enid is empty.

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

See Also

Was this topic helpful?