Explore Statistics and Visualize Simulation Results

The main purpose of creating a discrete-event simulation is to understand the underlying system or inform decisions about the underlying system.

Statistical data gathered during simulation can be important for interpreting the behavior of a model. For example:

  • If you simulate the operation and maintenance of equipment on an assembly line, you can use the computed production and defect rates to help decide whether to change your maintenance schedule.

  • If you simulate a communication bus under varying bus loads, you might use computed average delays in high- or low-priority messages to help determine whether a proposed architecture is viable.

The number of entities departing a block, the average wait time of entities, utilization, and the average number of entities being served in anEntity Serverblock are a subset of statistics you would want to visualize.

Many SimEvents®blocks have aStatisticstab, from which you can select the relevant data.

This procedure shows you how to access a statistical output signal for a given SimEvents block.

  1. Determine which statistical output signal you want to access and find the associated parameter in the block dialog box. To see which statistics are available, open the block dialog box. The list of available statistics appears as a list of parameters on theStatisticstab of the dialog box.

  2. Select the check box. After you apply the change, the block has a new signal output port corresponding to that statistic.

    For example, theEntity Queueblock can display:

    • Number of entities departed, d

    • Number of entities in the block, n

    • Average wait time of the entities, w

    • Average queue length of entities, l

  3. To display the statistics, connect those signal output ports to a Simulink®Scopeblock.

    Note

    Use scopes and other observer blocks to observe individual statistic ports. However, you cannot use the same scope to observe multiple statistics ports nor use a Scope Viewer for a statistics port. To observe multiple statistic ports, consider using a dashboard or the Simulation Data Inspector.

    SeeVisualization and Animation for Debuggingfor a table showing all the visualization tools.

You can use the built-in statistical signals from SimEvents blocks to derive more specialized or complex statistics. One approach is to use a万博1manbetx仿真软件的功能block, and another approach is to compute statistics using MATLAB®code after the simulation is complete. For more information about using statistics for run-time control, seeInterpret SimEvents Models Using Statistical Analysis. For an example to save statistics data to workspace, seeOptimize SimEvents Models by Running Multiple Simulations.

Explore a D/D/1 System Using Plots

This example shows how to modify a simple queuing system and plot statistical quantities to interpret its behavior. In the example, add1queuing model, which represents the tank filling process of the vehicles arriving at a gas station, is used to view the statistics for entity waiting time and server utilization. For more information about thedd1queuing model, seeCreate a Discrete-Event Model.

To open the model directly without performing the configuration steps, seeVisualize and Explore Simulation Results.

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 betweensimtime=0and the current time. Take these steps to modify the model so that you can view the average waiting time of entities in the queue and server, and the proportion of time that the server spends storing an entity.

  1. Double-click theEntity Queueblock. SetCapacitytoInf. Click theStatisticstab, setAverage waittoOn, and clickOK.

    An output port,w, representing the average duration that entities wait in a queue appears.Connect the statistic to a scope block and rename it to Average Wait Queue.

  2. Double-click theEntity Serverblock. Click theStatisticstab, set both theAverage waitandUtilizationparameters toOn, and clickOK.

    Two output ports,wandutilappear.wrepresents the average duration that entities wait in the server.util代表比例的时间服务器spends storing an entity.

  3. Add twoScopeblocks. Rename all theScopeblocks with descriptive names, for example, Utilization, Number of entities departed, Average Wait Server.

  4. 连接theutilsignal output port and the twowsignal output ports to theinsignal input ports of the unconnected scope blocks. Save the model.

  5. Simulate the model with different values of thePeriodparameter for the entity intergeneration times in theEntity Generatorblock. Observe the plots to see how they change if you set the intergeneration time to0.3,1.1, or1.5, for example.

Note

Scopeblocks do not support bus objects. SimEvents software supportsScopeblocks with only single inputs.

Visualize and Explore Simulation Results

Open the example to explore simulation results.

Observations from Plots

  • For intergeneration time0.3or1.1, the average wait timewin the服务器block does not change after the first departure from the block because the service time is fixed for all departed entities. The average waiting time statistic does not include partial wait times for entities that are in the server but have not yet departed.

  • For intergeneration time0.3, the utilization of the serverutilis nondecreasing because the server is constantly busy once it receives the first entity.

  • For intergeneration time1.5, which is larger than the service time (1), the utilization may decrease because the server has idle periods between entities.

  • For intergeneration time0.3, the average waiting timewin the queue increases throughout the simulation because the queue gets longer and longer.

  • For intergeneration time1.1, which is larger than the service time (1), the average waiting timewin the queue is zero because every entity that arrives at the queue is able to depart immediately.

See Also

|||

Related Topics