#  1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach.

## Presentation on theme: " 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach."— Presentation transcript:

 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach

 2  A Single-Server Station Machine (Server) Queue (FIFO) 6 1 5 incoming out going 2 3 2 3 4  single-server stations …  performance measures  two types of averages: customer and time

 3  Performance Measures Related to Waiting Time in Queue  N be no. of customers who have ever left the queue and got (at least some) service  WQ i be the time in queue of the ith customer average waiting time in queue = maximum waiting time in queue, WQ* =

 4  Performance Measures Related to Total Time in System  P no. of customers who have completed his service  TS i = time in system of customer i average time in system = maximum time in system, TS * =

 5  Performance Measures Related to Number in Queue  Q(t) be the # of customers in queue at t time-average number in queue = maximum number waiting in queue, Q * = if we simulate only 20 time units

 6  Performance Measures Related to Utilization of Server utilization = again only for simulating for 20 time units

 7  An GI/GI/1 Queue  the simplest single-server station  independent service and arrival processes  inter-arrival times of customers, T n, i.i.d  service times of customers, S n, i.i.d  FCFS discipline  infinite buffer

 8  The State and the Sample Path of an GI/G/1 Queue  state: N(t), number of customers in system N(t)N(t) t

 9  Simulating an GI/GI/1 Queue by Hand  simulate the system for 20 time units to get  total # of customers served (in the time horizon)  average and maximum waiting time in queue  time-average and maximum number in queue  average and maximum total time in system  utilization (proportion of time busy)

 10  Input Data  Initially (time 0) empty and idle  Part NumberArrival TimeInterarrival TimeService Time 10.001.732.90 21.731.351.76 33.080.713.39 43.790.624.52 54.4114.284.46 618.690.704.36 719.3915.522.07 834.913.153.36 938.061.762.37 1039.821.005.38 11 40.82......  Stop when 20 minutes of (simulated) time have passed

 11  Performance Measures  simulate 20 time units  performance measures  average waiting time in queue  time-average number in queue  utilization of drill press  results? results?

 12  Discrete-event Simulation Approach

 13  To Simulate the Sample Path of an GI/G/1 Queue  state: N(t), number of customers in system  events  state changes  arrivals and departures of customers N(t)N(t) t

 14  The Discrete-event Simulation Approach  after defining the states and events, the key is to generate the “ locations of points ” “location”: state N(t)N(t) t How to do that?

 15  The Sample Path of an GI/G/1 Queue  S n = the service time of the the nth customer  T n = the inter-arrival time between the (n-1)st and nth customers; T 0 = 0  possible to deduce S n and T n from the sample path? N(t)N(t) t T2T2 S2S2 T3T3 S1S1 T1T1 S3S3

 16  An Equivalent Representation of the Sample Path  {S n } and {T n }  sample path?  not necessary, if both {S n } & {T n } are discrete  yes otherwise  {S n } & {T n }: always gives a sample path  generate each S n and T n when necessary

 17  To Simulate the Sample Path of an GI/G/1 Queue location of the first point: trivial location of the second point: depending on T 1 and S 1 suppose T 1 < S 1 location of the second and third points: trivial location of the fourth point: depending on T 2 and S 1 -T 1 N(t)N(t) t T1T1 S1S1

 18   variables  system or simulation variables: TNOW, TTERM  state of the machine  performance variable  events: other than initialization and termination  an arrival: update performance measures  a departure: update performance measures  general flow of the program  initialization: initialize variables; set first event, etc.  if not stopping yet,  check next event, execute tasks for the event  termination: execute all house keeping tasks To Simulate an GI/GI/1 Queue by a Computer Program

 19  To Simulate an GI/G/1 Queue  definition of variables definition of variables  definition of events definition of events  flow chart of program flow chart of program  program: JavaJava

 20  Flow Chart for Simulating an GI/G/1 Queue N = L = K = 0; T a = random inter- arrival time; T s = infinity Yes ouput L/T now and L/K L = L + (T s - T now )N; T now = T s ; N = N - 1 L = L + (T a - T now )N; T now = T a ; N = N + 1; K = K +1; T a = T now + random inter-arrival time T s = T now + random service time T now  T max No next event service N = 0 T s = T now + random service time No Yes T s = infinity arrival N = 1 No

 21  Conceptual Structure of an Event Calendar  event: (time, type, tasks to do)  event calendar: a link list with scheduled future events in ascending order of time  example  four events scheduled at epoch 0  event 1: (24.3, type = 4, tasks to do)  event 2: (35.6, type = 1, tasks to do)  event 3: (41.3, type = 2, tasks to do)  event 4: (5000, type = END, tasks to do = end program)

 22  Event Calendar of a Simulation Program Event. Cal. TNOW = 0: 1 24.3type 4 tasks to do 2 35.6type 1 tasks to do 3 41.3type 2 tasks to do 4 5000END End simulation

 23  35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation 24.3type 4 tasks to do 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation Event Calendar of a Simulation Program Event. Cal. move time to TNOW = 24.3 1 2 3 4 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation suppose that no new event is created by a type 4 event execute first event and update event calendar 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation TNOW = 0:

 24  24.3type 4 tasks to do 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation Event Calendar of a Simulation Program Event. Cal. move time to TNOW = 24.3 1 2 3 4 suppose that a new event is created by an type 4 event at 39.1 execute first event and update event calendar TNOW = 0: 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation 39.1type 4 tasks to do 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation 39.1type 4 tasks to do 35.6type 1 tasks to do 41.3type 2 tasks to do 5000END End simulation 39.1type 4 tasks to do

 25  Operations of the Event Calendar  delete an event that has (just) occurred  after completing all tasks at TNOW, remove the first event in the event calendar  insert a new event  get the event time of the new event  check where to insert the event  move backward one rank for events occurring after the new event  insert the new event Describe concept only; actual implementation depends on the data structure used

 26  A Crude Pseudo-Code of GI/G/1 Queue with Event Calendar  1  initialization  set TNOW = 0; initialize variables; set termination event; set initial events  2  get next event type  3  while { next event != termination } {  get next event time and next event details  set TNOW to next event time  update the Event Calendar  execute next event, including updating variables and possibly adding new events to Event Calendar  get next event type }}  4  execute the termination Event

 27  Generic Program Structure for Complex Systems  Initialization Event while (not stopping (e.g., TNOW < TTERM) ) { switch (Next Event Type) { case 1: tasks of type 1 event; break;.... case n: tasks of type n event; break; } } Termination Event keep track of the timing of events by the Event Calendar

 28  Process-Oriented Simulation Approach

 29  World Views of a Simulation Language and Software  event oriented: specify the change of events as the system evolutes  activity scanning oriented: keeps track of time by advancing time in small, fixed time advancement  process oriented: specify the process of a typical entity as it goes through the system Arena is more process oriented

 30  Chapter 2 – Fundamental Simulation ConceptsSlide 30 of 57Simulation with Arena, 5th ed. Process-Oriented World View  non-procedural code defining processes of all types of entities  possible to have artificial entities for logic flow  possibly to have multiple copies of entities at any time Machine (Server) Queue (FIFO) 6 1 5 incoming out going 2 3 2 3 4

 31  Chapter 2 – Fundamental Simulation ConceptsSlide 31 of 57Simulation with Arena, 5th ed. Process-Oriented World View in Arena  common world view adopted by simulation software  event-oriented programs underneath  commonest world view of Arena, with everything executed in SIMAN simulation language underneath commonest world view

 32  Pieces of a Simulation Model  entities  attributes  global variables  Arena built-in  user-defined  resources  queues  statistical accumulators  events  simulation clock  starting and stopping

Download ppt " 1  Outline  performance measures for a single-server station  discrete-event simulation  hand simulation  process-oriented simulation approach."

Similar presentations