simulation and modeling

20
Simulation examples 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

Upload: habibur-rahman

Post on 24-May-2015

1.860 views

Category:

Technology


0 download

TRANSCRIPT

Page 1: Simulation and modeling

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

Page 2: Simulation and modeling

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

Page 3: Simulation and modeling

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.)

Page 4: Simulation and modeling

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.)

Page 5: Simulation and modeling

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

Page 6: Simulation and modeling

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

Page 7: Simulation and modeling

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

Page 8: Simulation and modeling

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

Page 9: Simulation and modeling

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

Page 10: Simulation and modeling

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

Page 11: Simulation and modeling

A typical simulation resultA typical simulation result

Page 12: Simulation and modeling

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

Page 13: Simulation and modeling

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

Page 14: Simulation and modeling

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

Page 15: Simulation and modeling

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

Page 16: Simulation and modeling

Simulation AlgorithmSimulation Algorithm

Page 17: Simulation and modeling

Simulation AlgorithmSimulation Algorithm

Page 18: Simulation and modeling

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

Page 19: Simulation and modeling

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

Page 20: Simulation and modeling

Thank you