| Contents | Index |
Event calendar of discrete-event simulation
evcal
cal_struct = evcal
evcal enID
evcal evID
evcal blkID
evcal blkname
evcal all
evcal merged
evcal displays the list of events on the event calendar of the discrete-event system in progress. If no discrete-event system is in progress, this command displays the event calendar for each discrete-event system in the model. The listing for the event in progress or the event selected for execution includes the characters =>. These characters appear to the left of the event identifier. The display includes this event unless all its immediate consequences are complete.
cal_struct = evcal returns a structure that stores information about the events in the event calendar of the requested discrete-event system, cal_struct.
evcal enID displays the list of events on the event calendar for the discrete-event system that contains the entity, enID.
evcal evID displays the list of events on the event calendar for the discrete-event system that contains the event, evID.
evcal blkID displays the list of events on the event calendar for the discrete-event system that contains the block identifier, blkID.
evcal blkname displays the list of events on the event calendar for the discrete-event system that contains the block name, blkname.
evcal all displays all event calendars for each discrete-event system in the model with a list of pending events in each event calendar.
evcal merged displays a merged list of events from all event calendars in the model. This function displays the events in the order in which they will execute.
View the event calendar and then manipulate a structure variable that stores the same information:
Begin a debugger session for a particular model. At the MATLAB command prompt, enter:
sedebug('sedemo_timeout')Establish a breakpoint and proceed in the simulation. At the sedebug>> prompt, enter:
tbreak 2 detail none cont
The output ends with a message describing the context of the simulation at T=2:
Set b1 : Breakpoint for first operation at or after time 2 Event Operations (ev) : off Entity Operations (en) : off Signal Operations (sig) : off Event Calendar (cal) : off Hit b1 : Breakpoint for first operation at or after time 2 %==============================================================================% Executing EntityGeneration Event (ev10) Time = 2.000000000000000 : Entity = <none> Priority = 1 : Block = Time-Based Entity Generator
View the event calendar:
% View event calendar.
evcalThe following output lists all events on the event calendar for the current discrete-event system:
Event Calendar for Discrete-Event System ID: 0 at T = 2.000000000000000
%------------------------------------------------------------------------------%
Discrete-Event System ID: 0 Highlight
ID EventTime EventType Priority Entity Block
=> ev10 2.000000000000000 EntityGeneration 1 <none> Time-Based Entity Generator
ev5 2.000000000000000 Timeout 1700 en2 Infinite Server
ev6 2.730384939625469 ServiceCompletion 1 en2 Infinite ServerStore the event calendar as a structure and get more information about the first pending event:
% Store event calendar as a structure.
cal_struct = evcal
ev5struct = cal_struct.PendingEvents(1)The output is:
cal_struct =
Time: 2
DiscreteEventSystemID: 0
ExecutingEvent: [1x1 struct]
PendingEvents: [2x1 struct]
ev5struct =
ID: 'ev5'
EventType: 'Timeout'
EventTime: 2
Priority: '1700'
Entity: 'en2'
Block: 'sedemo_timeout/Infinite Server'
Find the types of pending events whose scheduled time is the current simulation time:
idx = find([cal_struct.PendingEvents.EventTime] == simtime);
simult_event_types = {cal_struct.PendingEvents(idx).EventType}'The output is:
simult_event_types =
'Timeout'
Store all event times in a vector:
ev_times = cal_struct.ExecutingEvent.EventTime; ev_times = [ev_times, cal_struct.PendingEvents.EventTime]'
The output is:
ev_times =
2.0000
2.0000
2.7304
End the debugger session. At the sedebug>> prompt, enter:
sedb.quit
After the debugger session ends, cal_struct and the other variables remain in the workspace.

Model electronic system architectures, process flows, and logistics as queuing systems or agent-based systems.
Get free kit| © 1984-2012- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |