Modeling and Simulation Simulation of queuing systems • Discrete Types of systems – State variables change instantaneously at separated points in time – Bank model: State changes occur only when a customer arrives or departs – Continuous • State variables change continuously as a function of time • Head of water behind the dam : State variables Head amount change continuously • Many systems are partly discrete, partly continuous Types of simulation models • Physical simulation models • Mathematical simulation models Simulation models Physical Simulation models Mathematical Simulation models Discrete-event Simulation models Static or dynamic Simulation models Continuous Simulation models Deterministic and stochastic Simulation models – Static vs. dynamic – Deterministic vs. stochastic – Continuous vs. discrete (Most operational models are dynamic, stochastic, and discrete – will be called discrete-event simulation models) Discrete-event simulation models Single server queuing system simulation What are the event of this system? What are the system status ? Single server queuing system simulation • In the single-channel queue, the calling population is infinite. • Arrivals and services are defined by the distribution of the time between arrivals and the distribution of service times, respectively. • For any simple single-or multi-channel queue, the overall effective arrival rate must be less than the total service rate, or the waiting line will grow without bound. When queues grow without bound, they are termed (explosive) or unstable. • Prior to introducing several simulations of queuing systems, it is necessary to understand the concepts of system state, events, and simulation clock. – The state of the system is the number of units in the system and the status of the server, busy or idle. – An event is a set of circumstances that cause an instantaneous change in the state of the system. In a single-channel queuing system there are only two possible events that can affect the state of the system. They are the entry of a unit into the system (the arrival event) or the completion of service on a unit (the departure event). – The queuing system includes the server, the unit being serviced (if one is being serviced), and units in the queue (if any are waiting). – The simulation clock is used to track simulated time. Simulation &Modeling 6 Simulation &Modeling 7 Simulation &Modeling 8 Simulation &Modeling 9 Examples Simulation &Modeling 10 Simulate Bank system: with 6 expected customers In a single-channel queuing system interarrival times and service times are generated from the distributions of these random variables. For simplicity, assume that the times between arrivals were generated by rolling a die five times and recording the up face. These five interarrival times are used to compute the arrival times of six customers at the queuing system. Simulation table : Bank teller example customer Inter arrival arrival Time Ser. Begins Service time Duration Time ser. ends Time in queue Time cust. Idle Spends in time sys. service 1 0 0 0 2 2 0 2 0 2 2 2 2 1 3 0 1 0 3 4 6 6 3 9 0 3 3 4 1 7 9 2 11 2 4 0 5 2 9 11 1 12 2 3 0 6 6 15 15 4 19 0 4 3 Total 15 39 Average 3 6.5 43 13 2.1 56 4 17 6 0.67 2.8 1 The average time between arrival = (sum time between arrival) /total number of arrivals (customers)-1 Compare between the expected and calculated average time between arrival E(A)= the mean of the discrete uniform distribution for rolling a die whose endpoints are a = 1 and b = 6. is equal 3.5 !!! ( (1+6)/2 =3.5 ) The average time Customer spends on the system , will be compare with the total of: Average service time+ time in queue