|On this page…|
Discrete-event simulations often involve signals that change when events occur; for example, the number of entities in a server is a statistical output signal from a server block and the signal value changes when an entity arrives at or departs from the server. An event-based signal is a signal that can change in response to discrete events. A discrete-event system is one in which signals change when events occur. One model can have one or more discrete-event systems.
Most output signals from SimEvents® blocks are event-based signals. Exceptions are the output signals from the Event to Timed Signal and Event to Timed Function-Call blocks, whose explicit purpose is to convert event-based signals into time-based signals.
Unlike time-based signals, event-based signals:
Do not have a true sample time.
Might be updated at time instants that do not correspond to time steps determined by time-based dynamics.
Might undergo multiple updates in a single time instant.
For example, consider a signal representing the number of entities in a server. Computing this value at fixed intervals is wasteful if no entities arrive or depart for long periods. Computing the value at fixed intervals is inaccurate if entities arrive or depart in the middle of an interval, because the computation misses those events. Simultaneous events can make the signal multivalued; for example, if an entity completes its service and departs, which permits another entity to arrive at the same time instant, then the count at that time equals both 0 and 1 at that time instant. Furthermore, if an updated value of the count signal causes an event, then the processing of the signal update relative to other operations at that time instant can affect the processing sequence of simultaneous events and change the behavior of the simulation.
When you use output signals from SimEvents blocks to examine the detailed behavior of your system, you should understand when the blocks update the signals, including the possibility of multiple simultaneous updates. When you use event-based signals for controlling the dynamics of the simulation, understanding when blocks update the signals and when other blocks react to the updated values is even more important.
The sample time coloration feature makes the signal connection line gray, which normally indicates fixed in minor step. Also, querying the sample time indicates that the signal is fixed in minor step.
If your model includes both event-based and time-based signals, see Time-Based and Event-Based Signal Conversion.
In the SimEvents libraries, most blocks process only signals whose data type is double. (Exceptions are the Timed to Event Signal and Event to Timed Signal blocks. These blocks accept input signals of any data type and produce output signals of the same data type.)
To convert between data types, use the Data Type Conversion block.
In the SimEvents libraries, blocks process only fixed-size signals and do not support variable-size signals.
An event-based signal cannot be an element of a nonvirtual bus while retaining event-based timing. The reason is that a nonvirtual bus is an inherently time-based signal.