Activity: The Single-Model App
KSL Applications Activities
Work in pairs. Each question asks you to predict before you run the model; write the prediction down, then check it. A prediction that turns out wrong is worth more than one you skipped.
Setup. Install the KSL applications first, following the install guide, Installing the KSL Applications.
Start KSL Single, and in the Pick a Model window choose the KSL Book Examples bundle and the DriveThroughPharmacyWithQ model, but do not click Pick yet.
Each time you click Simulate, the app writes a report into a folder named by the Output Name box in the toolbar. Give every run its own Output Name (base, reps120, and so on) so that each report is kept and the app does not ask about an existing folder.
1. Meet the model
This is the drive-through pharmacy of Chapter 4: cars arrive, wait in a single line, and are served by the pharmacists in order.
Before you click Pick, read the Selected model summary. Write down the model’s two inputs and its three run defaults: the number of replications, the length of a replication, and the warm-up length. The model’s time unit is minutes. About how many days does one replication simulate, and how much of it is thrown away as warm-up?
Click Pick, then open the Control Overrides tab and find the row whose key is
Pharmacy.numPharmacists. What are its type, its default, and its lower bound? Nobody typed this row into the app. What in the model’s Kotlin code makes it appear here?Open the RV Overrides tab. One row is the mean of the service time. Before you look for the other rows, predict what the random variable for the time between arrivals will be called. Then find it. Why does one random variable have a readable name and the other a name with a number in it? What does that tell you about naming the model elements in your own code?
A control and a random-variable parameter both change the model without changing its code. Which one is
Pharmacy.numPharmacists, and which one is the mean service time? Give a reason why the app keeps them on separate tabs.
2. Predict, then run
With the defaults, cars arrive at a mean rate of 1 per minute, and one pharmacist serves a car in 0.5 minutes on average. Both times are exponential, so the pharmacy is an M/M/1 queue.
Use the M/M/1 formulas (Appendix C, the section Summary of Queueing Formulas) to predict the long-run values of these five responses: the utilization of the pharmacist (
NumBusy), the number in the system (Num in System), the time in the system (System Time), the time waiting in line (PharmacyQ:TimeInQ), and the probability that a car spends 4 minutes or more in the system (SysTime >= 4 minutes).Predict
Num Served, the number of cars served in a replication. Careful: the statistics are collected only after the warm-up.Set the Output Name to
base, leave every input at its default, and click Simulate. Compare each prediction with the report’s 95% confidence interval. Which of your predictions does the interval contain?
3. How many replications?
In the
basereport, write down the half-width ofSystem Time. Predict its half-width if you run 120 replications instead of 30.On the Run Control tab, set the number of replications to 120, set the Output Name to
reps120, and simulate. How close was your prediction? Why is the answer not one quarter of the old half-width?How many replications would you need to cut the
basehalf-width to one tenth of its size?
4. A busier pharmacy
Suppose a new insurance check makes the mean service time 0.8 minutes instead of 0.5, an increase of 60%. Set the number of replications back to 30.
Without any formula, guess the new time in the system. Then use the M/M/1 formula to predict it. How far apart are your guess and the formula?
On the RV Overrides tab, override the mean service time to 0.8, set the Output Name to
busy, and simulate. Does the 95% confidence interval forSystem Timecontain the value the formula predicts? If it does not, is the simulation wrong?Compare the half-width of
System Timewith the one inbase. Why did it change so much, when you ran the same number of replications?Run
busyagain with 120 replications, Output Namebusy120. What happens to the interval now?Keep the 0.8 service time and 30 replications, and on the Control Overrides tab set
Pharmacy.numPharmaciststo 2. Predict the time in the system, then run it astwopharm. Is a second pharmacist worth it?
5. A run is a text file
Choose File > Save Configuration and save your last setup as
twopharm.toml, noting the folder it goes in. Open the file in a plain text editor (TextEdit, Notepad, or IntelliJ). Find the number of replications, the service time override, and the pharmacist override. How is the service time override written differently from the pharmacist override?Find the report for
twopharmon disk. In which folder underKSLWorkis it?
If you finish early
Find the warm-up for the busy pharmacy yourself. Reset to the defaults, override the mean service time to 0.8, set the warm-up length to 0, and on the Run Control tab click Configure Warm-Up Analysis… to capture Welch data for Num in System. Simulate, then open Welch Report… on the Post-Run Reporting tab. Where would you cut off the warm-up? Is the model’s default of 5000 minutes too short, about right, or generous?