Documentation

Explore Simulation Results Using Plots

Explore the D/D/1 System Using Plots

The dd1 model that you created in Build a Discrete-Event Model plots the number of entities that depart from the server. This section modifies the model to plot other quantities that can reveal aspects of the simulation. The topics are as follows:

View Statistics for Waiting Times and Utilization

The queue length is an example of a statistic that quantifies a state at a particular instant. Other statistics, such as average waiting time and server utilization, summarize behavior between simtime=0 and the current time. To modify the model so that you can view the average waiting time of entities in the queue and server, as well as the proportion of time that the server spends storing an entity, use the following procedure:

  1. Double-click the Entity Queue block to open its dialog box. Click the Statistics tab, set the Average wait parameter to On, and click OK. This causes the block to have a signal output port for the signal representing the average duration that entities wait in the queue. The port label is w.

  2. Double-click the Entity Server block to open its dialog box. Click the Statistics tab, set both the Average wait and Utilization parameters to On, and click OK. This causes the block to have a signal output port labeled w for the signal representing the average duration that entities wait in the server, and a signal output port labeled u for the signal representing the proportion of time that the server spends storing an entity.

  3. Copy the Scope1 block and paste it into the model window.

  4. Double-click the new copy to open its dialog box.

  5. Copy the Scope2 block that you just modified and paste it into the model window twice. You now have four scope blocks.

    Each copy assumes a unique name. If you want to make the model and plots easier to read, you can click the names underneath each scope block and rename the block to use a descriptive name like Queue Waiting Time, for example.

  6. Connect the u signal output port and the two w signal output ports to the in signal input ports of the unconnected scope blocks by dragging the mouse pointer from port to port.

  7. Save the model.

  8. Run the simulation with different values of the Period parameter in the Entity Generator block. Look at the plots to see how they change if you set the intergeneration time to 0.3 or 1.1, for example.

    Note:   Scope blocks do not support bus objects. SimEvents® software supports Scope blocks with only single inputs.

Observations from Plots

  • The average waiting time in the server does not change after the first departure from the server because the service time is fixed for all departed entities. The average waiting time statistic does not include partial waiting times for entities that are in the server but have not yet departed.

  • The utilization of the server is nondecreasing if the intergeneration time is small (such as 0.3) because the server is constantly busy once it receives the first entity.

    The utilization might decrease if the intergeneration time is larger than the service time (such as 1.5) because the server has idle periods between entities.

  • The average waiting time in the queue increases throughout the simulation if the intergeneration time is small (such as 0.3) because the queue gets longer and longer.

    The average waiting time in the queue is zero if the intergeneration time is larger than the service time (such as 1.1) because every entity that arrives at the queue is able to depart immediately.

Visualize and Animate Simulations

You can explore the following elements of a SimEvents model with these tools.

Items to ObserveVisualization Tool

Statistics

  • Simulation Data Inspector

  • Simulink® To Workspace block

  • Simulink Scope block

  • Simulink Display block

  • Simulink To File block

  • Simulink dashboard blocks

Entities passing through model

Entity animation

Display > Message Animation

Step through Simulation

Simulink Simulation Stepper

Custom animation

Use SimEvents custom visualization API.

The Simulink Floating Scope does not support SimEvents models.

Simulation Data Inspector is a powerful and unified user interface for viewing both entities and signal (for example, statistics) data. For more information, see Inspect and Analyze Simulation Results.

Animate Simulations

During simulation, animation provides visual verification that your model behaves as you expect. Animation highlights active entities in a model as execution progresses. You can control the speed of entity activity animation during simulation, or turn animation off. In the Simulink editor, select Display > SimEvents Animation Menu, then select:

  • Fast

  • Medium

  • Slow

  • None

The Fast animation speed shows the active highlights at each time step. To add delay with each time step, set the animation speed to Medium or Slow. To turn off animation, in the Simulink editor, select Display > Message Animation > None.

Animation is disabled by default in SimEvents models.

Explore the System Using the Simulink Simulation Stepper

Simulation Stepper enables you to step through major time steps of a simulation. Use this tool to explore your discrete-event system. For more information, see Simulation Stepper.

Information About Race Conditions and Random Times

You can vary the processing sequence for simultaneous events or make the intergeneration times or service times random.

See Also

Related Examples

Was this topic helpful?