Date post: | 24-May-2015 |
Category: |
Technology |
Upload: | habibur-rahman |
View: | 1,848 times |
Download: | 0 times |
Simulation examplesSimulation examples
Presented by:
Md. Habibur Rahman (11-94853-2)Adnan Mehedi (12-95467-1)
Course:Simulation and Modeling Techniques
Instructor:Dr. Md. Shamim Akhter
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
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 Discrete-Event Simulation (cont.)(cont.)
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 Discrete-Event Simulation (cont.)(cont.)
Consider this scenario at Bagha Simulation clock: 15
Discrete-Event Simulation Discrete-Event Simulation (cont.)(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
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 Statistics – Performance MeasuresMeasures
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 Statistics – Performance MeasuresMeasures
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 StatisticsMore Statistics
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 StatisticsMore Statistics
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 bankThe queue in the bank
A typical simulation resultA typical simulation result
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 ListEvent Notice, Event List
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 ListThe Event List
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 ListThe Event List
The Event ListThe 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
Simulation AlgorithmSimulation Algorithm
Simulation AlgorithmSimulation Algorithm
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
TimingTiming
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
ConclusionConclusion
Thank you