Upcoming SlideShare
×

# Simulation and modeling

2,448 views

Published on

1 Like
Statistics
Notes
• Full Name
Comment goes here.

Are you sure you want to Yes No
• Be the first to comment

Views
Total views
2,448
On SlideShare
0
From Embeds
0
Number of Embeds
2
Actions
Shares
0
189
0
Likes
1
Embeds 0
No embeds

No notes for slide

### Simulation and modeling

1. 1. Simulation examples Presented by: Md. Habibur Rahman (11-94853-2) Adnan Mehedi (12-95467-1) Course: Simulation and Modeling Techniques Instructor: Dr. Md. Shamim Akhter
2. 2.  Example: Bagha • Today, Bilal works alone at the bar at Bagha in Gulshan 2, Road 44 • When a customer arrives, he/she is served if Bilal is free. • Otherwise, he/she joins the queue. • Customers are served using a “first come, first served” logic. • When Bilal has finished serving a customer, • he starts serving the next customer in line, or • waits for the next customer to arrive if the queue is empty. Discrete-Event Simulation
3. 3.  The amount of time required by Bilal to serve a customer is a random variable Xs with pdf fs.  unt of time between the arrival of two customers is a random variable Xa with pdf fa.  Bagha does not accept the arrival of customers after time T. Discrete-Event Simulation (cont.)
4. 4. Possible questions:  In average, how much time does a customer wait after his/her arrival, until being served?  Data needed: • Inter-arrival times of customers • Service times Discrete-Event Simulation (cont.)
5. 5.  Consider this scenario at Bagha  Simulation clock: 15 Discrete-Event Simulation (cont.) Arrival interval Customer arrives Begin service Service duration Service complete 5 5 5 2 7 1 6 7 4 11 3 9 11 3 14 3 12 14 1 15
6. 6.  What can we calculate at the end of simulation?  Average waiting time for a customer: 1.25  P(customer has to wait): 0.75  P(Server busy): 0.66  Average queue length: 0.33 Statistics – Performance Measures
7. 7. Average Wait time for a customer = total time customers wait in queue total number of customers Average wait time of those who wait = total time of customers who wait in queue number of customers who wait Statistics – Performance Measures
8. 8. Proportion of server busy time = number of time units server busy total time units of simulation Average service Time = total service time number of customers serviced More Statistics
9. 9. Average time customer spends in system = total time customers spend in system total number of customers Probability a customer has to wait in queue = number of customers who wait total number of customers More Statistics
10. 10.  One possible problem formulation: • "Customers have to wait too long in my bank"  A typical objective: • Determine the effect of an additional cashier on the mean queue length The queue in the bank
11. 11. A typical simulation result
12. 12.  Event notice: A data record specifying an event • The event notice must contain all the information necessary to execute the event (in particular the time it is scheduled to occur)  (Future) event list: A list of event notices for future events • The event list is the main data structure in a discrete-event simulator Event Notice, Event List
13. 13.  The (future) event list (FEL) controls the simulation  The FEL contains all future events that are scheduled  The FEL is ordered by increasing time of event notice  Example FEL (at some simulation time ≤ t1): The Event List
14. 14.  Example: Simulation of the Mensa:  Some state variables: • # people in line 1 • # people at meal line 1 & 2 • # people at cashier 1 & 2 • # people eating at tables The Event List
15. 15. The Event List  Operations on the FEL: • Insert an event into FEL (at appropriate position!) • Remove first event from FEL for processing • Delete an event from the FEL  The FEL is thus usually stored as a linked list
16. 16. Simulation Algorithm
17. 17. Simulation Algorithm
18. 18.  Usually, activities last for varying amounts of time: • Inter-arrival times at bank • Service times at bank • Time to failure for a machine • Time that a user program runs  Such times are random or stochastic Timing
19. 19.  The simulator will need to use random variables  We will need to do some statistics  For event list, we will need more advanced data structures (trees): O(log n)  Improve understanding of system  Study new designs without interrupting real system Conclusion
20. 20. Thank you 