Activity: The Tool Crib in the KSL

Discrete-Event Modeling Activities

Author

Manuel D. Rossetti, PhD P.E.

We write this program together: the instructor types the code, and you type along. Before each run, write down a prediction; then run and check it.

The situation. The tool crib of the hand simulation activity, with the same 15 mechanics. This time the data are given as times between arrivals: 3, 8, 2, 1, 3, 2, 2, 6, 5, 3, 3, 7, 5, 3, 2 minutes; and the service times: 4, 4, 4, 3, 2, 4, 3, 2, 2, 4, 3, 2, 3, 4, 4 minutes. A KSL model driven by these data should reproduce the hand simulation exactly, which makes it a check on both.

Setup. Get the starter file ToolCrib.kt from the code/ folder beside this activity, and put it in src/main/kotlin/student/activities. The ToolCrib model is given; main, marked TODO, is what we write.

1. Read the model

  1. The model’s events are written as EventAction classes rather than functions. Which events are there, and what does each do?

  2. Where do the times between arrivals and the service times come from? Why does the model take them as GetValueIfc rather than as random variables?

2. Code along

  1. TODO 1 to TODO 3. We put the data in arrays and wrap them in HistoricalVariables, which return the values in order. What does a HistoricalVariable write to disk, and why?

  2. TODO 4. We trace the number in the system and the number in the queue with ResponseTraces. What does a trace record that the statistics do not?

  3. TODO 5. Before running one replication of length 31, use your hand simulation to predict the printed NumBusy, ServiceQ:NumInQ, System Time, and Num Served.

3. Run and compare

  1. Run the model. Do the printed statistics match your hand simulation?

  2. ServiceQ:TimeInQ was not in your table. Compute it from your table, and check it.

  3. TODO 6. We plot the two traces with StateVariablePlots. Compare the plot of the number in the queue with your table. Where do they differ, and does the difference change any statistic?