20
Slide - 1 An example of a Simulation Simulation of a bank: Three tasks or processes: 1. Customer arrives 2. Customer served 3. Customer leaves Customer Arrives Customer Served Customer Leaves

Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Embed Size (px)

Citation preview

Page 1: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 1

An example of a Simulation

Simulation of a bank:

Three tasks or processes:

1. Customer arrives

2. Customer served

3. Customer leaves

Customer Arrives

Customer Served

Customer Leaves

Page 2: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 2

An example of a Simulation

Let’s describe task 1

Customer Arrives

• Arrival rate – rate that customers arrive at bank

1 customer every 3 minutes or so

i.e. Inter-arrival rate IAT = 3

• Time period customers can arrive

Bank Hours: 9 to 5

Customer Arrives

Page 3: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 3

An example of a Simulation

Task 2

Customer Served

• Time to serve a customer

Approx 6 minutes per customer

Select sample from for example a normal distribution

mean = 6 and standard deviation = 2

Choice of distribution ?

Customer Served

Page 4: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 4

An example of a Simulation

Task 3

Customer Leaves

• Record the time customer leaves

• No further interest in customer

Customer Leaves

Page 5: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 5

An example of a Simulation

What else affects this flow of customers?

Number of bank staff on duty

Lunchtime crowd

Customer Arrives

Customer Served

Customer Leaves

Page 6: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 6

An example of a Simulation

What information would be useful to collect?

– Employee utilisation

– Waiting times

– Length of queue

Is there a way to get this information?

Customer Arrives

Customer Served

Customer Leaves

Page 7: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 7

An example of a SimulationTo performing this analysis without micro-

simulation:

– Only use mean times or averages rates or

– Run the experiment in real life.

– Using micro-simulation every individual is computed taking account of stochastic behaviour – hence more realistic analysis possible - e.g maximum delay not obtained from an average

Customer Arrives

Customer Served

Customer Leaves

Page 8: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 8

Essentials of Discrete-Event Micro-Simulation

• Tasks• Events – start and end of tasks• Entities• Entity flow• Resources• Queues• Clock• Scenario events

Page 9: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 9

Tasks or processes• The building block of any discrete-event

simulation• A task represents a single step in the process

that makes up the discrete event simulation• A task may require a certain amount of time

in order to execute• Tasks & Events have three main parts:

– Pre-condition or Release condition– Start condition or Beginning effect– End condition or Ending effect

• Events trigger subsequent actions

Page 10: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 10

Conditions• Release condition

– The conditions that need to be satisfied so this task may begin

• Beginning effect– Things that take place when this task begins

execution

• Ending effect– Things that take place this task completes

execution

• You are responsible for writing code to achieve these logical conditions

Page 11: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 11

Task Flow• For every discrete-event simulation, there is a

basic entity flow• Here is an example of the flow of a bank:

• When one task completes the following can happen to the entity at same simulation time:– Nothing– Join a queue– Another activity starts– Several activities start simultaneously

Customer Arrives

Customer Served

Customer Leaves

Page 12: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 12

Resources• In any process some tasks require a resource to

be available in order to begin execution– Example: A task may require the availability of a

trained operator in order for that task to begin

• Many processes are constrained by limited resources– Without resources, steps in the process may be held

up until those resources are available– Without resources, the flow of the entities might

change

Page 13: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 13

Entities• Entities flow through a simulation and are involved in

the execution of any task – Examples of entities:

• Customers in a bank• Cars going through a toll both• Parts being manufactured

• When an entity arrives at a task the system:– Checks the release condition and if accepted– Executes the beginning effect– Waits the appropriate amount of time (simulation

time or clock time)– Executes the ending effect

Page 14: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 14

Queues• What happens when the release condition of

a task is not met (such as when all bank staff are busy)?– The entity must wait in a queue until the release

condition is met

• Sometimes, the behavior of the queue is important– FIFO (e.g. queue for bank staff)– LIFO (e.g. stocked shelves)– Sorted based on priority (e.g. A&E Department)

QueueCustomer

Served

Page 15: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 15

The Simulation Clock

• Since we are interested in time based behaviour, a clock is needed to keep the system in synchronism

• As events in your simulation occur, the simulation clock will advance based upon how long each task or process takes – not fixed small steps as in continuous dynamic systems

Page 16: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 16

How a Simulation is Executed• As a simulation executes, all scheduled

events are kept in an event queue or time line• The simulation begins by taking the first event

that is scheduled to occur from the event queue (e.g. start the first task)

• That event may place other events later in the event queue, ordered of time

• When that event is completed, the simulation takes the next event from the queue, updates the clock, and processes that event

Page 17: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 17

Running a SimulationLet’s step through a simulation of a bank. Using the

task rules we defined for customer served• Here are other rules to follow

– Bank is open for 8 hours (480 minutes)– Customers arrive about every 3 minutes– It takes around 6 minutes to serve a customer– We have 2 bank staff on duty

Page 18: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 18

Running a SimulationUsing this diagram below let’s step through

this simulation

Time Task Staff People Waiting 0 Customer Arrives 2 0

Customer Arrives

Customer LeavesQueue

Customer Served

Page 19: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 19

Simulation

What else affects this flow of customers?

– Number of bank staff on duty

– Lunchtime crowd

Customer Arrives

Customer Served

Customer Leaves

Page 20: Slide - 1 Dr Terry Hinton 6/9/05UniS - Based on Slides by Micro Analysis & Design An example of a Simulation Simulation of a bank: Three tasks or processes:

Slide - 20

Scenario Events

• What happens if we want to:– Model customers arriving faster at lunchtime?– Put another bank teller on duty at lunchtime?

• Events that don’t necessarily fall into any one task can be defined as a scenario events

• Scenario events are defined by– The time when the scenario event occurs– What happens