Products & Services Solutions Academia Support User Community Company

Learn more about SimEvents   

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. Proceed in the simulation. At the sedebug>> 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.100000
    
    %==============================================================================%
    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 get information about the entity:

    % Display information in Command Window.
    eninfo(enid)
    % 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:

    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       [6x1]
      ServiceTime          [6x1]
    
    Timeouts, Timers: None
    
    
    endetails = 
    
              Time: 0.3
          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: [0 NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN NaN]
        LastServiceLocation: 0
             ServiceProcess: [6x1 double]
                ServiceTime: [6x1 double]
    
    
    enServiceProcess =
    
         1
         2
         4
         2
         3
         5
  5. End the debugger session. At the sedebug>> prompt, enter:

    sedb.quit

See Also

sedb.eninfo

How To

  


Related Products & Applications

Learn more about Simulink through this collection of videos, articles, technical literature and the Getting Started with Simulink Guide.

 © 1984-2009- The MathWorks, Inc.    -   Site Help   -   Patents   -   Trademarks   -   Privacy Policy   -   Preventing Piracy   -   RSS