Multivalued Signals

Zero-Duration Values of Signals

Some output signals from SimEvents® blocks produce a new output value for each departure from the block. When multiple departures occur in a single time instant, the result is a multivalued signal. That is, at a given instant in time, the signal assumes multiple values in sequence. The sequence of values corresponds to the sequence of departures. Although the departures and values have a well-defined sequence, no time elapses between adjacent events.

Scenario: Server Departure and New Arrival

For example, consider the scenario in which an entity departs from a single server at time T and, consequently, permits another entity to arrive from a queue that precedes the server. The statistic representing the number of entities in the server is 1 just before time T because the first entity has not completed its service. The statistic is 1 just after time T because the second entity has begun its service. At time T, the statistic is 0 before it becomes 1 again. The value of 0 corresponds to the server's empty state after the first entity has departed and before the second entity has arrived. Like this empty state, the value of 0 does not persist for a positive duration.

Scenario: Queue Length

Another example of zero-duration values is in Plot the Queue-Length Signal, which discusses a signal that indicates the length of a queue. At time 3, the queue length increases by 1 because a new entity arrives. Subsequently but still at time 3, the queue length decreases by 1 because an entity advances from the queue to the server. That is, the larger value at time 3 does not persist for a positive duration.

Importance of Zero-Duration Values

The values of signals, even values that do not persist for a positive duration, can help you understand or debug your simulations. In the example described in Scenario: Server Departure and New Arrival, the zero-duration value of 0 in the signal tells you that the server experienced a departure. If the signal assumed only the value 1 at time T (because 1 is the final value at time T), then the constant values before, at, and after time T would fail to indicate the departure. While you could use a departure count signal to detect departures specifically, the zero-duration value in the number-in-block signal provides you with more information in a single signal.

Detect Zero-Duration Values

These topics describe ways to detect and examine zero-duration values:

Plot Signals that Exhibit Zero-Duration Values

One way to visualize event-based signals, including signal values that do not persist for a positive duration, is to use the Signal Scope or X-Y Signal Scope block. Either of these blocks can produce a plot that includes a marker for each signal value (or each signal-based event, in the case of the event counting scope). For example, the figure below uses a plot to illustrate the situation described in Scenario: Server Departure and New Arrival.

When multiple plotting markers occur along the same vertical line, it means that the signal assumes multiple values at a single time instant. The callouts in the figure describe the server states that correspond to a few key points of the plot.

Plot the Number of Signal Changes Per Time Instant

To detect the presence of zero-duration values, but not the values themselves, use the Instantaneous Event Counting Scope block with the Type of change in signal value parameter set to Either. When the input signal assumes multiple values at an instant of time, the plot shows a stem of height of two or greater.

For an example using this block, see Plot Event Counts to Check for Simultaneity.

View Zero-Duration Values in the MATLAB Workspace

If an event-based signal assumes many values at one time instant and you cannot guess the sequence from a plot of the signal versus time, then you can get more information by examining the signal in the MATLAB® workspace. By creating a variable that contains each time and signal value, you can recover the exact sequence in which the signal assumed each value during the simulation.

See Send Data to the MATLAB Workspace for instructions and an example.

Was this topic helpful?