Activity: The Single-Model App

KSL Applications Activities

Author

Manuel D. Rossetti, PhD P.E.

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.

Open the install guide.

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.

  1. 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?

  2. 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?

  3. 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?

  4. 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.

  1. 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).

  2. Predict Num Served, the number of cars served in a replication. Careful: the statistics are collected only after the warm-up.

  3. 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?

  1. In the base report, write down the half-width of System Time. Predict its half-width if you run 120 replications instead of 30.

  2. 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?

  3. How many replications would you need to cut the base half-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.

  1. 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?

  2. 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 for System Time contain the value the formula predicts? If it does not, is the simulation wrong?

  3. Compare the half-width of System Time with the one in base. Why did it change so much, when you ran the same number of replications?

  4. Run busy again with 120 replications, Output Name busy120. What happens to the interval now?

  5. Keep the 0.8 service time and 30 replications, and on the Control Overrides tab set Pharmacy.numPharmacists to 2. Predict the time in the system, then run it as twopharm. Is a second pharmacist worth it?

5. A run is a text file

  1. 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?

  2. Find the report for twopharm on disk. In which folder under KSLWork is 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?