Download presentation
Presentation is loading. Please wait.
Published byNeil Blankenship Modified over 8 years ago
1
Simulation modelling real processes to make predictions
2
D. Goforth, COSC 2006, fall 20032 Simulation topics industrial processes information systems transportation systems environments for people
3
D. Goforth, COSC 2006, fall 20033 Simulation topics – example Self-serve gas station
4
D. Goforth, COSC 2006, fall 20034 Simulation topics – example Self-serve gas station service queue
5
D. Goforth, COSC 2006, fall 20035 Simulation topics – example Self-serve gas station 5 services, 3 queues data gathered: length of queues waiting time (customers) idle time (servers)
6
D. Goforth, COSC 2006, fall 20036 Simulation topics – example Self-serve gas station how good is service: average waiting time longest waiting time time pumps idle time cashier idle average queue length maximum queue length
7
D. Goforth, COSC 2006, fall 20037 Simulation topics – example Self-serve gas station plans: add pumps? add another cash? change layout?
8
D. Goforth, COSC 2006, fall 20038 Typical simulation scenario proposal to build new service station: how many pumps? cashiers? what layout? from market study: expected customer numbers input to simulation simulation: try different layouts, number of pumps, cashiers service levels and costs output from simulation decide station design
9
D. Goforth, COSC 2006, fall 20039 Typical simulation data ScenarioAvg service Max service pumps idle cashiers idle 2 pumps 1 cash 14 min21 min8%19% 2 pumps 2 cash 13 min19 min8%57% 4 pumps 1 cash 8 min20 min52%14% 4 pumps 2 cash 6 min12 min50%47%
10
D. Goforth, COSC 2006, fall 200310 Designing simulations processing objects (cashiers, pumps) objects to be processed (customers/cars) queues for objects awaiting processing (lines of cars, line of people) what properties do objects need to have?
11
D. Goforth, COSC 2006, fall 200311 Designing simulations properties of objects processed related to timing in simulation: colour of car? NO amount of gas pumped? YES data to keep about objects processed arrival time (join a queue) begin service time (leave queue, start service) end service time
12
D. Goforth, COSC 2006, fall 200312 Designing simulations input required: data about service (how long to pump n litres, how long to process payment at cash) rate of arrival of objects to process (how many cars per hour) litres of gas per car
13
D. Goforth, COSC 2006, fall 200313 Designing simulations Running simulation of a time period randomize activity based on input data: arrival rate of cars size of gas purchase time to pump gas time to pay at cash
14
D. Goforth, COSC 2006, fall 200314 Designing simulations Gather data (simulated) times of events for each object processed and each processing object (customer arrives, customer starts pumping, cashier starts to process a sale, etc.)
15
D. Goforth, COSC 2006, fall 200315 Designing simulations Analyzing data after simulation cumulative times, average times, extreme times (total time cashier working, average time customer at station, longest wait before starting to pump gas)
16
D. Goforth, COSC 2006, fall 200316 Designing simulations Timing in a simulation ‘clock’ runs for a time interval to simulate a period of operation events occur at a specific time two models of timing in simulations ‘clock driven’ – every second is simulated ‘event-driven’ – only analyze times when an event happens; skip over other times
17
D. Goforth, COSC 2006, fall 200317 Designing simulations models of timing clock driven event-driven
18
D. Goforth, COSC 2006, fall 200318 Designing simulations What is an event? ‘instantaneous’, not an interval events at beginning and end of interval e.g.:joining a queue is an event leaving a queue is an event waiting in a queue is NOT an event e.g.:starting to pump gas is an event finishing pumping is an event pumping gas is NOT an event
19
D. Goforth, COSC 2006, fall 200319 Designing simulations example of events events for a customer arrive at station and join queue leave queue and start pumping gas finish pumping and line up to pay leave queue and start payment finish paying and return to car leave station
20
D. Goforth, COSC 2006, fall 200320 Another example: Bookstore checkout one line-up of customers and many cashiers question: how many cashiers should be working simulate level of service with n = 2,3,4
21
D. Goforth, COSC 2006, fall 200321 Bookstore checkout objects Queuew Customer CashierStation s[i] EventQueue Event 1. 2. 3. w s[2] s[1] s[0]
22
D. Goforth, COSC 2006, fall 200322 Bookstore checkout Events: 1.arrival: customer arrives at checkout area (joins queue) 2.beginService(k): customer leaves queue, goes to cashier k 3.endService(k): customer finishes purchase at cashier k and leaves store 1. 2. 3. w s[2] s[1] s[0]
23
D. Goforth, COSC 2006, fall 200323 Event arrival create c = new Customer object insert c into Queue schedule arrival event if some s[k] is not busy, schedule beginService(k) 1. 2. 3. w s[2] s[1] s[0] c
24
D. Goforth, COSC 2006, fall 200324 Event beginService(k) getFront cNext from Queue put cNext in s[k] make s[k] busy schedule endService(k) event 1. 2. 3. w s[2] s[1] s[0] cNext
25
D. Goforth, COSC 2006, fall 200325 Event endService(k) remove Customer from s[k] make s[k] idle if (w not empty) schedule beginService(k) event 1. 2. 3. w s[2] s[1] s[0]
26
D. Goforth, COSC 2006, fall 200326 The main algorithm of simulation simulation (endTime) EventQueue q; Event f = new Event(arrival) q.insert(f) while ( q not empty and not endTime) Event e = q.getFront() process(e) // includes scheduling other events analyze statistics
27
D. Goforth, COSC 2006, fall 200327 Bookstore checkout Input data frequency of customer arrival time for cashier to serve a customer 1. 2. 3. w s[2] s[1] s[0]
28
D. Goforth, COSC 2006, fall 200328 Bookstore checkout frequency of customer arrival simple model – uniform distribution of time between arrivals e.g. if range is [5, 15] customer arrives between 5 and 15 seconds after previous customer if arrival time of one customer is 432, the next arrival could be scheduled for 432 + 9(random in 5,15) = 441
29
D. Goforth, COSC 2006, fall 200329 Bookstore checkout time for cashier to serve a customer same simple model – uniform distribution of time for service e.g. if range is [10, 40] customer remains at cashier station for a random time between 10 & 40 seconds if beginService of a customer is at 304, endService could be scheduled for 304 + 29(random in 10,40) = 333
30
D. Goforth, COSC 2006, fall 200330 EventQueue manages the sequence of events in the simulation duration of simulation processed events current event events scheduled but not processed yet
31
D. Goforth, COSC 2006, fall 200331 EventQueue - example two events on event queue current event: arrival(135) current event events scheduled but not processed yet 135 141144 in arrival: schedule next arrival at 148 some cashier s[k] is idle so schedule beginService at 135 135 141144 148 135 141144 148 135
32
D. Goforth, COSC 2006, fall 200332 Bookstore checkout analyzing service arrival begin Service end Service service time from input waiting?
33
D. Goforth, COSC 2006, fall 200333 Data in simulation objects Customer object goal: analyze ‘experience’ of customer store times: arrivalTime beginServiceTime endServiceTime
34
D. Goforth, COSC 2006, fall 200334 Data in simulation objects Cashier object goal: analyze ‘busyness’ store data: currentCustomer totalIdleTime // accumulate time without customer isIdle // boolean, busy or not lastEndServiceTime // used in beginService to calculate last period of idleness
35
D. Goforth, COSC 2006, fall 200335 Data in simulation objects Event object goal: activity store data: time eventType // arrival, beginService or endService cashierIndex // which cashier (for service events only)
36
D. Goforth, COSC 2006, fall 200336 Data in simulation objects CashierSimulation object (main program) goal: the big picture store data: parameters(arrival constants, simulation duration, etc) customerCount totalWaitTime maxWaitTime queues (next slide)
37
D. Goforth, COSC 2006, fall 200337 Data in simulation objects queues: Waiting queue: Customer objects Event queue Event objects in time priority
Similar presentations
© 2025 SlidePlayer.com. Inc.
All rights reserved.