Download as pdf or txt
Download as pdf or txt
You are on page 1of 29

Introduction to Computer

Simulation

Dr. Jeff Hong


IELM Dept, HKUST
Fall 2010

Note 04: Intro to Simulation 1


The case of The Darker Image

„ The Darker Image is a small photocopying shop


„ Current store configuration:
‰ One photocopying machine
‰ One clerk
„ Current operation rules:
‰ Arriving customers stand in single line to wait for the clerk
‰ The clerk completes the customers’ photocopying jobs one at a
time, first-come-first-served, including collecting payment for the
job.

Note 04: Intro to Simulation 2


The case of The Darker Image

„ Current situation

Queue

Note 04: Intro to Simulation 3


The case of The Darker Image
„ Business is good enough, the store plans to add a
second photocopying machine and possibly hiring a
second clerk
„ Customers with small copying jobs, e.g., jobs without
special handling (special paper, stapling), have
complained about having to wait a long time
„ There are two options the store may take:
‰ The second copier can be operated by the new clerk
‰ The second copier is for self-service copying only.
„ The store wants to know which option will deliver a better
service.

Note 04: Intro to Simulation 4


The case of The Darker Image

„ Proposed option I:
‰ Two full-service copiers
‰ Customers can use either copier

Queue

Note 04: Intro to Simulation 5


The case of The Darker Image
„ Proposed option II:
‰ Adding a self-service copier
‰ customers with special handling can only use the full-service
copier

Self-service queue

Full-service queue

Note 04: Intro to Simulation 6


The case of The Darker Image

„ How to define better service?

„ Which option is better?

„ How to study it?

Note 04: Intro to Simulation 7


The case of The Darker Image
„ Time-study record
Time What happened Comment Time What happened Comment
9:00 shop opens 10:16 customer 12 arrived
9:12 customer 1 arrived 10:19 customer 13 arrived
9:14 customer 2 arrived 10:24 customer 10 finished two-sided, staple
9:17 customer 3 arrived 10:26 customer 11 finsihed
9:19 customer 1 finished collate, staple 10:28 customer 14 arrived
9:21 customer 2 finshed 10:36 customer 12 finished
9:22 customer 3 finished 10:36 customer 15 arrived
9:38 customer 4 arrived 10:38 customer 13 finished
9:39 customer 5 arrived 10:39 customer 14 finished
9:41 customer 4 finished 10:42 customer 15 finished collate, staple
9:43 customer 6 arrived 10:45 customer 16 arrived
9:45 customer 7 arrived 10:47 customer 16 fished
9:52 customer 8 arrived 10:48 customer 17 arrived
9:57 customer 5 finished speical paper 10:50 customer 17 finished
9:58 customer 9 arrived 10:53 customer 18 arrived
10:00 customer 6 finished 10:58 customer 19 arrived
10:01 customer 7 finished 11:00 customer 20 arrived
10:08 customer 8 finished 11:01 customer 18 finished special paper
10:11 customer 9 finished collate, covers 11:07 customer 19 finished two-sided, staple
10:13 customer 10 arrived 11:09 customer 20 finished collate, staple
10:14 customer 11 arrived
Note 04: Intro to Simulation 8
Sample-path decomposition

„ Sample path is a record of the time-dependent behavior


of a system
„ Sample path = inputs + logic
„ The Darker Image:
‰ Sample path: time-study record
‰ Inputs: characteristics of the customers (arrival times and service
times), which are not under the control of The Darker Image
‰ System logic: First-come-first-served
„ Simulation generates new sample paths without building
the new system

Note 04: Intro to Simulation 9


The case of The Darker Image

„ Inputs: service times and interarrival times


„ How to find service times ?
‰ ai: arrival time of customer i
‰ di: departure time of customer i
‰ si: service time of customer i
si =

„ How to find interarrival times?


gi =

Note 04: Intro to Simulation 10


The case of The Darker Image
„ Interarrival times and service times (in minutes) for customers in the
time study (An * indicates special handling.)

customer # 1* 2 3 4 5* 6 7 8 9* 10*
service time 7 2 1 3 16 3 1 7 3 11
Interarrival time 12 2 3 21 1 4 2 7 6 15
customer # 11 12 13 14 15* 16 17 18* 19* 20*
service time 2 10 2 1 3 2 2 8 6 2
Interarrival time 1 2 3 9 8 9 3 5 5 2

Note 04: Intro to Simulation 11


The case of The Darker Image

„ Simulating the proposed self-service system


‰ Inputs: service times and interarrival times from the time study
‰ System logic:
„ Two queues for customers, one for full service and one for self service.
Customers will not change queues after they join one.
„ Self-service customers (without special handling) will always join the
self-service queue. Full-service customers (with special handling) will
always join the full-service queue.
„ Service times for self-service customers will be the same as they
would have been in the original one-copier system.

Note 04: Intro to Simulation 12


CURRENT TIME: 0 CURRENT TIME: 12

Full Service Self-Service Full Service Self-Service


1

NEXT SYSTEM EVENT TIME NEXT SYSTEM EVENT TIME


customer arrival 0+12=12 customer arrival 12+2=14
full-service finish full-service finish 12+7=19
self-service finish self-service finish

CURRENT TIME: 14 CURRENT TIME: 16

Full Service Self-Service Full Service Self-Service


1 2 1

NEXT SYSTEM EVENT TIME NEXT SYSTEM EVENT TIME


customer arrival 14+3=17 customer arrival 17
full-service finish 19 full-service finish 19
self-service finish 14+2=16 self-service finish

Note 04: Intro to Simulation 13


CURRENT TIME: 43 CURRENT TIME: 45

Full Service Self-Service Full Service Self-Service


5 6 5 6
7

NEXT SYSTEM EVENT TIME NEXT SYSTEM EVENT TIME


customer arrival 43+2=45 customer arrival 45+7=52
full-service finish 55 full-service finish 55
self-service finish 43+3=46 self-service finish 46

CURRENT TIME: 46

Full Service Self-Service


5 7

NEXT SYSTEM EVENT TIME


customer arrival 52
full-service finish 55
self-service finish 46+1=47

Note 04: Intro to Simulation 14


CURRENT TIME: 79 CURRENT TIME: 84

Full Service Self-Service Full Service Self-Service


10 12
12
13 13

NEXT SYSTEM EVENT TIME NEXT SYSTEM EVENT TIME


customer arrival 79+9=88 customer arrival 88
full-service finish 84 full-service finish
self-service finish 86 self-service finish 86

CURRENT TIME: 86

Full Service Self-Service


13

NEXT SYSTEM EVENT TIME


customer arrival 88
full-service finish
self-service finish 86+2=88

Note 04: Intro to Simulation 15


The case of The Darker Image

„ Summary of the simulation


‰ Self-service customers 7 and 13 experience delays of 1 and 7
minutes, respectively.
‰ Full-service customers 19 and 20 experience delays of 3 and 7
minutes, respectively.
‰ All other customers have delays of 0 minutes.

Note 04: Intro to Simulation 16


The case of The Darker Image

„ Simulating the proposed full-service system


‰ Inputs: service times and interarrival times from the time study
‰ System logic:
„ There will be one queue of customers with service delivered first-
come-first-served by the next available copier.

„ Summary of the simulation


‰ Self-service customers 7 and 13 experience delays of 1 and 5
minutes, respectively.
‰ Full-service customer 20 experiences delay of 1 minute.
‰ All other customers have delays of 0 minutes.

Note 04: Intro to Simulation 17


The case of The Darker Image
„ Summary:
‰ Proposed self-service system
„ Self-service customers 7 and 13 wait 1 and 7 minutes, respectively
„ Full-service customers 19 and 20 wait 3 and 7 minutes, respectively
‰ Proposed full-service system
„ Self-service customers 7 and 13 wait 1 and 5 minutes, respectively
„ Full-service customer 20 waits 1 minute

„ Discussions
‰ Which system is better?

Note 04: Intro to Simulation 18


The case of The Darker Image
„ Multiple sample paths
‰ Finding the average waiting times
‰ A more fair comparison

„ How much data do we need to generate 1000 sample


paths?
„ Computer simulation
‰ Generate arrival times, customer types and service times
‰ Simulate as many sample paths as we want

Note 04: Intro to Simulation 19


The case of The Darker Image

„ The Arena Model


Assign Self Self Service
Service Time Copying

Arrival Self Service?


0 T ru e
0 D epa rtu e
r

0 0
0 Fa ls e Assign Full Full Service
Service Time Copying

Proposal One 0

Assign Self
Service Time

0 T ru e
Arrival Self Service? Copy Machine Departure
0 0
0 0
Fa ls e Assign Full
Service Time

Proposal Two

Note 04: Intro to Simulation 20


The case of The Darker Image

„ The outputs and the conclusions

„ The business is good and the company forecasts that


the business will double in a year. What will happen?

Note 04: Intro to Simulation 21


Arena World View
„ Arena takes the process interaction world view.
„ Entities flow through a network of modules that describe
their logical behavior.
„ We describe the network by developing a process
flowchart.
Assign Self
Service Time

0 T ru e
Arrival Self Service? Copy Machine Departure
0 0
0 0
Fa ls e Assign Full
Service Time

Note 04: Intro to Simulation 22


About Modules…

„ Arena contains a very large number of modules that are


organized into panels.
„ The panels are structured from high level to low level
concepts:
‰ Basic Process
‰ Advanced Process & Advanced Transfer
‰ Blocks & Elements (a programming language)

Note 04: Intro to Simulation 23


Entities
„ Entities are dynamic elements that pass through the
system.
„ Entities are distinguished by their attributes.
„ Ex: people, parts, information, paperwork, etc.
„ Entities must be Created to get them into the model,
and are Disposed when they leave.

Note 04: Intro to Simulation 24


Queueing
„ Entities queue when they need processing.

„ In Arena…
‰ An entity tries to Seize a Resource.
‰ The time the entity uses the resource is the Delay.
‰ If the resource is not available, the entity waits in a Queue.
‰ The entity Releases the resource when processing is
complete.

„ Queues are created automatically by some modules


(e.g., Process).

Note 04: Intro to Simulation 25


Resources
„ Resources have…
‰ A Name (up to you)
‰ A Capacity (number of identical units of this resource).
‰ And can have a Schedule (how many available when).

„ Resources are automatically defined by some


modules (e.g., Process)
„ Resources can also be defined manually, and the
properties of all resources are changed, via the
Resources spreadsheet on the Basic Process panel.

Note 04: Intro to Simulation 26


Basic Process Modules
Push (possibly) batches of entities into
the model with a (possibly) random time
Create 1
between.
0

Models Queue-Seize-Delay-Release of
Proc ess 1 Resource, or any part of this (like pure
Delay).
0
Make decisions about where to go next
D ecide 1
0 True
based on conditions or chance.

0 False

Take entities out of the model and


Dispose 1 (perhaps) record statistics.
0

Note 04: Intro to Simulation 27


Basic Process Modules
Assign values (especially Attributes)
when an entity passes through.
Assign 1

Record information when entities pass


Record 1
through, typically statistics on entities.

Combine multiple entities into a single


entity.
Batch 1

Split multiple entities that were combined,


0
Separate 1 or duplicate a single entity.
Original

0 Duplicate

Note 04: Intro to Simulation 28


Example
Dark er Image Copy Shop: Self-Serv ice Proposal
Create arrival
of jobs Determine types of Processing
jobs, self-service or delay and queue
full-service
Assign Self
Service Time

0 T ru e

Arrival Self Service? Copy Machine Departure


0 0
0
0 Fa ls e Assign Full
Service Time

Assign service
times to self Customers

09:00:00 Assign service


times to full
service jobs
service jobs leave

Animation
clock

Note 04: Intro to Simulation 29

You might also like