| SimEvents® | ![]() |
| On this page… |
|---|
An event is an instantaneous discrete incident that changes a state variable, an output, and/or the occurrence of other events. SimEvents® software supports the events listed below.
| Event | Description |
|---|---|
| Counter reset | Reinitialization of the counter in the Entity Departure Counter block. |
| Discrete event subsystem execution | Execution of Discrete Event Subsystem block contents caused by an appropriate signal-based event at one of the subsystem's inports. |
| Entity advancement | Departure of an entity from one block and arrival at another block. |
| Entity destruction | Arrival of an entity at a block that has no entity output port. |
| Entity generation | Creation of an entity. |
| Entity request | Notification that an entity input port has become available. A preceding block's response to the notification might result in an entity advancement. After each entity advancement, an Enabled Gate block or a switch block reissues the notification until no further entity advancement can occur. |
| Function call | Discrete invocation request carried from block to block by a special signal called a function-call signal. For more information, see Function Calls. |
| Gate event | Opening or closing of the gate represented by the Enabled Gate block. |
| Memory read | Reading of memory in the Signal Latch block. |
| Memory write | Writing of memory in the Signal Latch block. |
| Port selection | Selection of a particular entity port in the Input Switch, Output Switch, or Path Combiner block. In the case of the Path Combiner block, the selected entity input port is the port that the block notifies first, whenever its entity output port changes from blocked to unblocked. |
| Preemption | Replacement of an entity in a server by a higher priority entity. |
| Release | Opening of the gate represented by the Release Gate block. |
| Sample time hit | Update in the value of a signal that is connected to a block configured to react to signal updates. |
| Service completion | Completion of service on an entity in a server. |
| Storage completion | Change in the state of the Output Switch block, making it attempt to advance the stored entity. |
| Timeout | Departure of an entity that has exceeded a previously established time limit. |
| Trigger | Rising or falling edge of a signal connected to a block that
is configured to react to relevant trigger edges. A rising edge is an increase from a negative or zero value to a positive value (or zero if the initial value is negative). A falling edge is a decrease from a positive or a zero value to a negative value (or zero if the initial value is positive). |
| Value change | Change in the value of a signal connected to a block that is configured to react to relevant value changes. |
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.
Sample time hits, value changes, and triggers are collectively called signal-based events. Signal-based events can occur with respect to time-based or event-based signals. Signal-based events provide a mechanism for a block to respond to selected state changes in a signal connected to the block. The kind of state change to which the block responds determines the specific type of signal-based event.
When comparing the types of signal-based events, note that
The updated value that results in a sample time hit could be the same as or different from the previous value of the signal.
Event-based signals do not necessarily undergo an update at the beginning of the simulation.
Every change in a signal value is also an update in that signal's value. However, the opposite is not true because an update that merely reconfirms the same value is not a change in the value.
Every rising or falling edge is also a change in the value of the signal. However, the opposite is not true because a change from one positive value to another (or from one negative value to another) is not a rising or falling edge.
Triggers and value changes can be rising or falling. You configure a block to determine whether the block considers rising, falling, or either type to be a relevant occurrence.
Blocks in the Simulink® libraries are more restrictive than blocks in the SimEvents libraries regarding trigger edges that rise or fall from zero. Simulink blocks in discrete-time systems do not consider a change from zero to be a trigger edge unless the signal remained at zero for more than one time step; see Triggered Subsystems in the Simulink documentation. SimEvents blocks configured with tr ports consider any change from zero to a nonzero number to be a trigger edge.
Consider the signal representing the number of entities stored in a FIFO queue. This is the #n output signal from the FIFO Queue block in the model below. The #n signal is connected to the Event-Based Entity Generator block, which reacts to different types of signal-based events. Parameters in its dialog box determine whether the block has a ts, vc, or tr input port, as well as the types of events to which the block reacts.

In the following figures, a staircase plot shows the values of the #n signal, starting from the first entity's arrival at T=0. Based on those values of #n, the stem plots indicate when signal-based events occur at the Event-Based Entity Generator block if it is configured with a ts, vc, or tr signal input port.
Sample Time Hits of #n Signal Connected to ts Port

Value Changes of #n Signal Connected to vc Port

Trigger Edges of #n Signal Connected to tr Port

Function calls are discrete invocation requests carried from block to block by a special signal called a function-call signal. A function-call signal appears as a dashed line, not a solid line. A function-call signal carries a function call at discrete times during the simulation and does not have a defined value at other times. A function-call signal is capable of carrying multiple function calls at the same value of the simulation clock, representing multiple simultaneous events.
In SimEvents models, function calls are the recommended way to make Stateflow® blocks and blocks in the Simulink libraries respond to asynchronous state changes.
Function calls and signal-based events are often interchangeable in their ability to elicit reactions from various SimEvents blocks, such as the Event-Based Entity Generator block and the Signal-Based Event to Function-Call Event block.
Function-call signals can be combined, as described in Creating a Union of Multiple Events.
![]() | Working with Events | Example: Event Calendar Usage for a Queue-Server Model | ![]() |
| © 1984-2008- The MathWorks, Inc. - Site Help - Patents - Trademarks - Privacy Policy - Preventing Piracy - RSS |