Search code examples
pythonpycharmsimulationutilization

System Simulation - Utilization and average waiting time and length


I've created a simulation project in Pycharm of a drive thru restaurant with a single order window staffed by one employee. This is the results of a single run of the simulation: Drive Thru Simulation

How do I find what the utilization of the employee is during this time interval? And how would I find the average waiting time and the average line length during this interval?


Solution

  • Utilization is (total_simulation_time - total_idle_time) / total_simulation_time), where total_idle_time is the sum of all the periods where the server was idle. The server is idle between the start of the simulation and the arrival of the first customer, and between any time where a customer arrived and experienced no wait in the queue (start service time == arrival time for the same customer id) and the time of the prior customer's departure.

    Waiting time in queue is the difference between when a customer starts service and when that customer arrived. Average line length can then be determined by Little's Law, since you must know the arrival rate you used to build your simulation.

    Now for the bad news. Queueing systems are notorious for the impact that serial dependence of the observations has on statistical estimates of their behaviors. To get even moderately precise estimates of the steady-state behavior you may need run lengths ranging up to hundreds of thousands of customers, depending on the traffic intensity (arrival rate / service rate) of your system. You can't just treat the observations as independent and identically distributed, which is the underlying assumption for the statistics most people are familiar with.