Event Sequencing

Processing Sequence for Simultaneous Events

Even if simultaneous events occur at the same value of the simulation clock, the application processes them sequentially. The processing sequence must reflect causality relationships among events. This table describes the multiple-phase approach the application uses to determine a processing sequence for simultaneous events for which causality considerations alone do not determine a unique correct sequence.

PhaseEvents Processed in This PhaseProcessing Sequence for Multiple Events in This Phase
1Events not on the event calendarArbitrary.
2Events with priority SYS1Same as the scheduling sequence (FIFO).
3Events with priority SYS2Same as the scheduling sequence (FIFO).
4Events with numerical priority values

Ascending order of priority values.

For equal-priority events, the sequence is random or arbitrary, depending on the model's Execution order parameter.

When the sequence is arbitrary, you should not make any assumptions about the sequence or its repeatability.

The events with priority SYS1 enable the application to detect multiple signal updates before reacting to any of them. The events with priority SYS2 enable entities to advance in response to state changes.

For suggestions on how to use the information in the table when creating models, see Choosing an Approach for Simultaneous Events.

Role of the Event Calendar

During a simulation, the application maintains a list, called the event calendar, of selected upcoming events that are scheduled for the current simulation time or future times. By referring to the event calendar, the application executes events at the correct simulation time and in an appropriate sequence.

The table below indicates which events appear or might appear on the event calendar. In some cases, you have a choice.

EventOn Event CalendarHow to Cause Event to Appear on Event Calendar
Counter resetYes 
Discrete event subsystem executionMaybeSelect Resolve simultaneous signal updates according to event priority in the dialog box of the Discrete Event Inport block that corresponds to the signal that causes the execution.
Entity advancementNo 
Entity destructionNo 
Entity generationYes 
Entity requestYes 
Function callMaybeSelect Resolve simultaneous signal updates according to event priority, if present, in the dialog box of the block that generates the function call. If the dialog box has no such option, the function call is not on the event calendar.
Gate (opening or closing)Yes 
Memory readMaybeSelect Resolve simultaneous signal updates according to event priority on the Read tab of the Signal Latch block's dialog box.
Memory writeMaybeSelect Resolve simultaneous signal updates according to event priority on the Write tab of the Signal Latch block's dialog box.
Port selectionYes 
PreemptionNo 
ReleaseYes 
Sample time hitNo 
Service completionYes 
Storage completionYes 
TimeoutYes 
TriggerNo 
Value changeNo 

When you use blocks that offer a Resolve simultaneous signal updates according to event priority option, your choice determines whether, or with what priority, particular events appear on the event calendar. For information about this option, see Resolution Sequence for Input Signals and Choosing How to Resolve Simultaneous Signal Updates.

For Further Information

See these sections for additional information about event sequencing:

  


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