Products & Services Solutions Academia Support User Community Company

Learn more about SimEvents   

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.

Outputs

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. 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.blkinfo | sedb.currentop | sedb.evinfo | sedb.gcen

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