| Products & Services | Solutions | Academia | Support | User Community | Company |
| Download Product Updates | | | Get Pricing | | | Trial Software |
| Documentation → SimEvents |
| Contents | Index |
| Learn more about SimEvents |
Event calendar of discrete-event simulation
evcal
cal_struct = evcal
evcal displays the list of events on the event calendar. 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 event calendar.
cal_struct |
Structure that stores information about the event calendar. The cal_struct fields are in the following table.
|
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')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.000000 Event Operations (ev) : off Entity Operations (en) : off Event Calendar (cal) : off Hit b1 : Breakpoint for first operation at or after time 2.000000 %==============================================================================% Executing EntityGeneration Event (ev10) Time = 2.000000000000000 : Entity = <none> Priority = 1 : Block = Time-Based Entity Generator
View the event calendar:
% View event calendar. evcal
The following output lists all events on the event calendar:
Current Time = 2.000000000000000
%------------------------------------------------------------------------------%
Events in the Event Calendar
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
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.7304End 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.
![]() | sedb.evbreak | sedb.evinfo | ![]() |

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 |