Events in SimEvents Models

Types of Supported Events

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.

EventDescription
Counter resetReinitialization of the counter in the Entity Departure Counter block.
Delayed restartCauses a pending entity in the Time-Based Entity Generator block to attempt to depart. The block uses delayed restart events only when you set Response when unblocked to Delayed restart.
Entity advancementDeparture of an entity from one block and arrival at another block.
Entity destructionArrival of an entity at a block that has no entity output port.
Entity generationCreation of an entity, except in the case of an Event-Based Entity Generator block that has suspended the generation of entities.
Entity requestNotification 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 callDiscrete invocation request carried from block to block by a special signal called a function-call signal. For more information, see Function Calls.
Gate (opening or closing)Opening or closing of the gate represented by the Enabled Gate block.
Memory readReading of memory in the Signal Latch block.
Memory writeWriting of memory in the Signal Latch block.
New head of queueScheduled when there is a new entity at the head of a queue. Upon execution, it causes the entity at the head of a queue to attempt to depart.
Port selectionSelection 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.
PreemptionReplacement of an entity in a server by a higher priority entity.
ReleaseOpening of the gate represented by the Release Gate block.
Sample time hitUpdate in the value of a signal that is connected to a block configured to react to signal updates. Be aware that an update in a signal value does not necessarily correspond with a change in that signal value, i.e. the value might be the same for successive sample periods.
Service completionCompletion of service on an entity in a server.
Storage completionChange in the state of the Output Switch block, making it attempt to advance the stored entity.
SubsystemExecution of Atomic Subsystem block caused by an appropriate signal-based event in the input signal of a Event Filter block that connects to the Atomic Subsystem block.
TimeoutDeparture of an entity that has exceeded a previously established time limit.
TriggerRising 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 changeChange in the value of a signal connected to a block that is configured to react to relevant value changes.

During a simulation, SimEvents 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 software executes events at the correct simulation time and in an appropriate sequence. If a model has multiple discrete-event systems (in which signals change when events occur), each discrete-event system maintains its own event calendar. The software executes the event calendar of each discrete-event system independently of the other discrete-event systems.

Signal-Based Events

Sample time hits, value changes, and triggers are collectively called signal-based events. Signal-based events can occur with respect to time-based or s. 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.

  • It is unreliable to induce signal-based events based on sample time hits from a time-based signal connected to the discrete-event system via a gateway block. For more information see Invalid Connections of Gateway Blocks.

  • s 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 Create a Triggered Subsystem . SimEvents blocks configured with tr ports consider any change from zero to a nonzero number to be a trigger edge.

Function Calls

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 best way to make Stateflow® blocks and blocks in the Simulink libraries respond to asynchronous state changes.

Within a discrete-event system, function-calls originate from these kinds of blocks:

  • Entity Departure Function-Call Generator

  • Signal-Based Function-Call Generator

  • Time-Based Function-Call Generator

  • Stateflow blocks

  • MATLAB Function blocks

  • Atomic Subsystem block containing a Function-Call Gererator block

    Note:   The software does not support asynchronous function-calls (see Asynchronous Task Specification) in discrete-event systems. It also does not support asynchronous function-calls at discrete-event system boundaries (as identified by gateway blocks).

You can combine or manipulate function-call signals. To learn more, see Manipulate Events.

Was this topic helpful?