Activity: The Tool Crib in the KSL
Discrete-Event Modeling Activities
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
The model’s events are written as
EventActionclasses rather than functions. Which events are there, and what does each do?Where do the times between arrivals and the service times come from? Why does the model take them as
GetValueIfcrather than as random variables?
2. Code along
TODO 1 to TODO 3. We put the data in arrays and wrap them in
HistoricalVariables, which return the values in order. What does aHistoricalVariablewrite to disk, and why?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?TODO 5. Before running one replication of length 31, use your hand simulation to predict the printed
NumBusy,ServiceQ:NumInQ,System Time, andNum Served.
3. Run and compare
Run the model. Do the printed statistics match your hand simulation?
ServiceQ:TimeInQwas not in your table. Compute it from your table, and check it.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?