Presentation is loading. Please wait.

Presentation is loading. Please wait.

CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT 745 Class Location:

Similar presentations


Presentation on theme: "CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT 745 Class Location:"— Presentation transcript:

1 CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT 745 Email: mahanti@cpsc.ucalgary.ca Class Location: TRB 101 Lectures: TR 15:30 – 16:45 hours Class web page: http://pages.cpsc.ucalgary.ca/~mahanti/teaching/F05/CPS C531/ Notes derived from “Simulation Modeling and Analysis” by A. Law and W. Kelton, Third edition, McGraw Hill, 2000.

2 CPSC 531: DES Overview2 Objective r Learn the basics of discrete-event simulation r We will focus on a simple single-server service center. Possible examples: m Convenience store: customers, cashiers m Airport: runways, airplanes ServerCustomers in queue Arriving customer Departing customer Customer in service

3 CPSC 531: DES Overview3 What is Discrete-Event Simulation (DES)? r Modeling of a system as it evolves over time by a representation where the state variables change instantaneously at separated points in time m More precisely, state can change at only a countable number of points in time m These points in time are when events occur r What is an event? Instantaneous occurrence that may change the state of the system m Arrival of a customer m Service completion (and departure) of a customer m End of simulation (a “fake” event)

4 CPSC 531: DES Overview4 Single-Server Service Center r Performance measures of interest: m Average customer waiting time m Average number of customers in queue m Average server utilization r How do we simulate this system and obtain measures of interest? m Need to simulate “time” … Server Customers in queue Arriving customer Departing customer Customer in service

5 CPSC 531: DES Overview5 Time Advance Mechanism r Simulation clock: Variable that keeps the current value of (simulated) time in the model m Must decide on, be consistent about, time units m Usually no relation between simulated time and (real) time needed to run a model on a computer r Two approaches for time advance m Fixed-increment time advance m Next-event time advance

6 CPSC 531: DES Overview6 Fixed-Increment Time Advance r Events occur at a fixed increment r Events occurring between time increments must be moved to an increment boundary r Simple to implement, but not an accurate realization of occurrence of events Time ΔtΔt 03Δt3Δt 2Δt2Δt 4Δt4Δt 5Δt5Δt 6Δt6Δt e0e0 e1e1 e2e2

7 CPSC 531: DES Overview7 Next-event Time Advance r Initialize simulation clock to 0 r Determine times of occurrence of future events – event list r Clock advances to next (most imminent) event, which is executed m Event execution may involve updating event list r Continue until stopping rule is satisfied (must be explicitly stated) r Clock “jumps” from one event time to the next, and doesn’t “exist” for times between successive events … periods of inactivity are ignored

8 CPSC 531: DES Overview8 Next-event time-Advance (cont’d.) r Consider the single-server service center example t i = time of arrival of ith customer (t 0 = 0) A i = t i – t i-1 = interarrival time between (i-1)st and ith customers S i = time spent serving the ith customer D i = delay in queue of ith customer C i = t i + D i + S i = time ith customer completes service and departs

9 CPSC 531: DES Overview9 Want to write a next-event program? r Determine the events and understand what happens when it occurs r Generate events and keep a time-ordered list of the events r Based on the time-ordered list, we will have to schedule events r Track information of interest during the simulation r Finally, generate report when simulation ends

10 CPSC 531: DES Overview10 Components of a DES Program r Simulation clock – current value of simulated time r System state – variables to describe state m Server status, number in queue, arrival times, etc r Event list – times of future events for each event type r Statistical counters – to accumulate performance measures m Waiting time in queue, server utilization, …

11 CPSC 531: DES Overview11 Components of a DES Program (cont’d.) r Initialization routine m Start simulation at time 0 r Timing routine m determines next event time, type; advances clock r Event routines m carry out logic for each event type r Library routines m utility routines to generate random variates, etc. r Report generator r Main program m ties routines together, executes them in the correct order

12 CPSC 531: DES Overview12 Organization of a DES Program Start Main Routine Event Routines Simulation Done? Report Generator Initialization Routine Timing Routine Library Routines Yes No Stop

13 CPSC 531: DES Overview13 DES Program Flow Start Main Routine Initialization Routine 1. Set clock = 0 2. initialize state & counters 3. Initialize event list 4. Return to main program

14 CPSC 531: DES Overview14 DES Program Flow Main Routine Timing Routine 1. Determine next event type i 2. Advance simulation clock 3. Return to main program

15 CPSC 531: DES Overview15 DES Program Flow Event routine iLibrary Routine 1. update system state 2. update counters 3. generate future events & add them to the event list Main Routine

16 CPSC 531: DES Overview16 DES Program Flow Main Routine Event Routines Simulation Done? Timing Routine No Return to main; Invoke timing routine

17 CPSC 531: DES Overview17 Hand Simulation of a Single Server Service Center r Interarrival times (all times are in minutes): 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … r service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … r n = 6 delays in queue desired r “Hand” simulation: m Display system, state variables, clock, event list, statistical counters … all after execution of each event m Use above lists of interarrival, service times to “drive” simulation m Stop when number of delays hits n = 6, compute output performance measures

18 CPSC 531: DES Overview18 Performance Measures r “Expected” average delay in queue (excluding service time) of the n customers completing their delays r Expected average number of customers in queue (excluding any in service) m A continuous-time average r Expected utilization (proportion of time busy) of the server m Another continuous-time average

19 CPSC 531: DES Overview19 Time = 0 Status shown is after all changes have been made in each case … Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

20 CPSC 531: DES Overview20 Time = 0.4 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

21 CPSC 531: DES Overview21 Time = 1.6 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

22 CPSC 531: DES Overview22 Time = 2.1 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

23 CPSC 531: DES Overview23 Time = 2.4 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

24 CPSC 531: DES Overview24 Time = 3.1 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

25 CPSC 531: DES Overview25 Time = 3.3 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

26 CPSC 531: DES Overview26 Time = 3.8 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

27 CPSC 531: DES Overview27 Time = 4.0 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

28 CPSC 531: DES Overview28 Time = 4.9 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

29 CPSC 531: DES Overview29 Time = 5.6 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

30 CPSC 531: DES Overview30 Time = 5.8 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

31 CPSC 531: DES Overview31 Time = 7.2 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, …

32 CPSC 531: DES Overview32 Time = 8.6 Interarrival times: 0.4, 1.2, 0.5, 1.7, 0.2, 1.6, 0.2, 1.4, 1.9, … Service times: 2.0, 0.7, 0.2, 1.1, 3.7, 0.6, … Final output performance measures: Average delay in queue = 5.7/6 = 0.95 min./customers Time-average number in queue = 9.9/8.6 = 1.15 customers Server utilization = 7.7/8.6 = 0.90 (dimensionless)

33 CPSC 531: DES Overview33 DES Programming Issues r Program termination rules m Number of events, total time r Client balking – leave the queue without service r Time breaking during event scheduling m Choose departure before arrival m Two arrivals at the same time? Randomly choose one m Other defined rules


Download ppt "CPSC 531: DES Overview1 CPSC 531:Discrete-Event Simulation Instructor: Anirban Mahanti Office: ICT 745 Class Location:"

Similar presentations


Ads by Google