53
WIPAWEE THARMMAPHORNPHILAS [email protected] Wipawee Tharmmaphornphilas 1 Computer Simulation An Introduction

2104612 Computer Simulation Introduction

  • Upload
    others

  • View
    12

  • Download
    0

Embed Size (px)

Citation preview

Page 1: 2104612 Computer Simulation Introduction

W I P A W E E T H A R M M A P H O R N P H I L A S

W I P A W E E . T @ C H U L A . A C . T H

Wipawee Tharmmaphornphilas

1

Computer SimulationAn Introduction

Page 2: 2104612 Computer Simulation Introduction

System Analysis

Wipawee Tharmmaphornphilas

2

System

Experiment with

actual system

Physical model

MathematicalModel

Analyticalsolution

Simulation

Experiment With model

A system is a collection of component and their relationship

Page 3: 2104612 Computer Simulation Introduction

What is simulation?

Wipawee Tharmmaphornphilas

3

A broad collection of methods and applications to mimic the behavior of real system, usually on a computer

Page 4: 2104612 Computer Simulation Introduction

What’s Being Modeled?

Wipawee Tharmmaphornphilas

4

A manufacturing plant

A bank or other personal-service operation

A distribution network of plants, warehouses, transportation links

A freeway system of road segments, interchanges, controls, and traffic

A theme park

Etc.

Page 5: 2104612 Computer Simulation Introduction

Benefits of using simulation (1)

Wipawee Tharmmaphornphilas

5

Evaluates the system’s behavior under a variety of assumed conditions.

Allows the analyst to draw inferences about new systems without building them, or make changes to existing systems without disturbing them.

Allows the analyst to draw conclusions about expected system behavior, and about the likelihood of departures from expected behavior.

Page 6: 2104612 Computer Simulation Introduction

Benefits of using simulation (2)

Wipawee Tharmmaphornphilas

6

Allows decision-makers to visualize the operation of a new or existing system under a variety of conditions, using computer animation.

Provides understanding of how various components interact with each other and how they affect overall

system performance.

Page 7: 2104612 Computer Simulation Introduction

Limitations of simulation

Wipawee Tharmmaphornphilas

7

Does not provide explicit relationships b/w system input (decision variables) and system output (performance criteria).

Does not provide optimal solutions- only provides the results of what-if questions, from which solutions are inferred.

May lead to incorrect conclusions if not used properly (for example, if the level of detail is too low, or if the run length is too short).

Requires a skilled analyst to be used effectively.

Page 8: 2104612 Computer Simulation Introduction

System characteristics

Wipawee Tharmmaphornphilas

8

Page 9: 2104612 Computer Simulation Introduction

Different kinds of simulations (1)

Wipawee Tharmmaphornphilas

9

Static vs. Dynamic⚫ Static: time plays no role (Monte Carlo)

⚫ Dynamic: model represents a system as it evolves over time

Continuous vs. Discrete ⚫ Continuous simulation concerns with systems whose

parameters vary continuously with respect to space and/or distance. Ex: an airplane moving through the air

⚫ A discrete system concerns with systems whose parameters experience abrupt changes at discrete points in time.

Page 10: 2104612 Computer Simulation Introduction

Different kinds of simulations (2)

Wipawee Tharmmaphornphilas

10

Deterministic vs. Stochastic⚫ Deterministic: model does not contain any probabilistic

⚫ Stochastic: model has at least one random component

Page 11: 2104612 Computer Simulation Introduction

⚫ In discrete event simulation, we calculate the solution for every change of events.

⚫For example, in a queuing system, we calculate the system when an entity arrives, or when an entity leaves the system

Discrete Event Simulation

Page 12: 2104612 Computer Simulation Introduction

Key Modeling Processes

Wipawee Tharmmaphornphilas

12

Real World(Problem)

ConceptualModel

ComputerModel

Solutions/Understanding

Page 13: 2104612 Computer Simulation Introduction

Conceptual Model

Wipawee Tharmmaphornphilas

13

Develop an understanding of the problem situation

Determine the modeling objectives

Design the conceptual model: inputs, outputs, and model content

Collect and analyze the data required to develop the model

Page 14: 2104612 Computer Simulation Introduction

Model Coding

Wipawee Tharmmaphornphilas

14

General-purpose languages (C, Fortran, etc).

Where it all began (origins of simulation).

Use is complicated and time-consuming.

Impractical for large-scale model development.

Simulation languages (SIMAN, GPSS, SLAM, etc.)

Very robust –can be applied to any problem settings.

Automates much of the logic required in a C or Fortran program.

Much easier to learn and to used.

Simulators (ARENA, PRO-MODEL, Simio etc.)

Very easy to learn and use.

Page 15: 2104612 Computer Simulation Introduction

Experimentation

Wipawee Tharmmaphornphilas

15

What-if analysis

Key issues⚫ Obtaining sufficiently accurate results

⚫ Performing a thorough search of potential solutions (searching the solution space)

⚫ Testing the robustness of the solution (sensitivity analysis)

Page 16: 2104612 Computer Simulation Introduction

Implementation

Wipawee Tharmmaphornphilas

16

Implementing the finding from a simulation study in the real world

Implementing the model rather than the finding

Page 17: 2104612 Computer Simulation Introduction

The Model-Building Process

Wipawee Tharmmaphornphilas

17

1. Define the problem and its goals.

2. Gather data

3. Develop a preliminary project plan

4. Formulate the simulation model

5. Run the model

6. Verify the model (does it simulate the model right?)

7. Validate the model (does it simulate the right model?)

8. Analyze the results

9. Draw conclusion.

10. Recommend alternatives to the decision maker.

Page 18: 2104612 Computer Simulation Introduction

An Example Simulation (A computer IT help desk)

Help-desk operator has two states Busy helping someone

Waiting for a call to come in

Events Customer starts describing problem to help desk

Customer completes conversation

Wipawee Tharmmaphornphilas

18

Page 19: 2104612 Computer Simulation Introduction

Working it out

Simulation starts at t = t0 = 0

First customer arrives at t1, simulation time now t = t0 + t1

Help desk requires ts to resolve the issue

First simulation leaves at t = t0 + t1 + ts

Second customer arrives at t2

If t2 < t0 + t1 + ts, then customer must wait

It t2 > t0 + t1 + ts, then customer starts service

Wipawee Tharmmaphornphilas

19

Page 20: 2104612 Computer Simulation Introduction

Simulate a bank system

Wipawee Tharmmaphornphilas

20

At a bank, let arrivals occurring at times 0.4, 1.6, 2.1, 3.8, 4.0, 5.6, 5.8, and 7.2.

Departures (service completions) occur at times 2.4, 3.1, 3.3, 4.9, and 8.6, and the simulation ends at time 8.6

Compute ⚫ the expected average delay

⚫ the expected average number of customers in the queue

⚫ the expected utilization of the server

Page 21: 2104612 Computer Simulation Introduction

Wipawee Tharmmaphornphilas

21

Simulation Model (Cinema)

Page 22: 2104612 Computer Simulation Introduction

Conceptual Modeling--Problem Situation (1)

Wipawee Tharmmaphornphilas

22

Got complaints about the telephone enquiries and booking service

The telephone system was installed at the time the cinema was opened. With the rising demand the queues are now often full; especially on Saturday.

Customer either balk, or wait for some time and hang up

The 3 booking clerks are lambasted by irate customers who have waited up to 15 min or more

Page 23: 2104612 Computer Simulation Introduction

Conceptual Modeling--Problem Situation (2)

Wipawee Tharmmaphornphilas

23

The manager is concerned about the loss of goodwill. He has decided to purchase and install a digital system.

Call router(4 lines)

Information(4 lines)

CSR(4 lines)

Ticket sales(4 lines)

Call arrival

Page 24: 2104612 Computer Simulation Introduction

Conceptual Modeling-- Modeling Objectives

Wipawee Tharmmaphornphilas

24

Determine the number of resources (info lines and ticket sales lines) required so that less than 5% of calls are lost on busy days and total waiting time is less than 2 minutes for 80% of calls (mean less than 1 minute)

Determine the maximum capacity of the system (number of calls that can be handled) while maintaining service level

CSR staff requirements can be determined in second phase of work

Page 25: 2104612 Computer Simulation Introduction

Conceptual Modeling-- Project Objectives

Wipawee Tharmmaphornphilas

25

Time-scale: a final report must be available in 3 weeks

Nature of model display: 2D schematic, showing flow of calls through the system

Nature of model use: by modeler

Page 26: 2104612 Computer Simulation Introduction

Conceptual Modeling-- Model inputs and outputs

Wipawee Tharmmaphornphilas

26

Experimental factors⚫ Number of information lines (4,6,8)

⚫ Number of ticket sales lines (4,6,8)

⚫ Call arrival rate

Responses (to determine achievement)⚫ Percentage of lost calls

⚫ Percentage of completed calls with a total waiting time of less than 2 minutes

⚫ Histogram of total waiting time for all completed calls including mean, s, max, min

Page 27: 2104612 Computer Simulation Introduction

Conceptual Modeling-- Model inputs and outputs

Wipawee Tharmmaphornphilas

27

Responses ( to determine reasons for failure)⚫ Percentage of lost calls by area

⚫ Queue sizes

⚫ Resource utilization

⚫ Time-series of calls arriving at call router by hour

⚫ Time-series of mean resource utilization by hour

⚫ Time-series of mean size of each queue by hour

Page 28: 2104612 Computer Simulation Introduction

Conceptual Modeling-- Model Content

Component In/Ex Justification

Calls In Flow through the telephone system

Service process

Call router

Information

Ticket sales

CSR

In

In

In

In

In

Statistics on queue and resource utilization

Connects call arrival to service process

Experimental factor

Experimental factor

Affects total waiting time

Queues In Required for waiting time, Q size

CSR staff In Affects total waiting time

Wipawee Tharmmaphornphilas

28

Page 29: 2104612 Computer Simulation Introduction

Conceptual Modeling --Model level of detail (1)

Wipawee Tharmmaphornphilas

29

Component Detail In/Ex Comment

Calls Customer inter-arrival time

Rate varying by hour of day

Rate varying by day of week

Inter-arrival time rate fixed

In

Ex

In

Dist. changing parameter every 2hrs

Model busiest

Determine system capacity

Service

Process

Number of lines

Service time

Failure

Routing

In

In

Ex

In

Affects speed of service

Distribution

Rarely occur

Page 30: 2104612 Computer Simulation Introduction

Conceptual Modeling --Model level of detail (2)

Component Detail In/Ex Comment

Queues Capacity

Queue priority

Leaving threshold

Individual caller behavior

In

In

In

Ex

Affect balking

Affect WT

Affect lost calls

Not well understood

CSR staff Number

Staff rosters

In

Ex

Represent as total lines available

Wipawee Tharmmaphornphilas

30

Page 31: 2104612 Computer Simulation Introduction

Conceptual Modeling -- Assumptions

Wipawee Tharmmaphornphilas

31

Sufficient call router lines

No requirement to increase # CSR lines

Arrival pattern defined in 2-hour slots

Equipment failure occur rarely

Individual customer behavior is not modeled

Historical data is accurate to predict future

Page 32: 2104612 Computer Simulation Introduction

Model data -- Calls

Negative exponential distribution

Time of day Mean arrival rate

per hour

Mean inter-arrival time (minutes)

8:00-10:00

10:00-12:00

12:00-14:00

14:00-16:00

16:00-18:00

18:00-20:00

20:00-22:00

120

150

200

240

400

240

150

0.5

0.4

0.3

0.25

0.15

0.25

0.4

Wipawee Tharmmaphornphilas

32

Nature of call: Info 60%, Ticket sales 30%, CSR 10%

Page 33: 2104612 Computer Simulation Introduction

Model Data -- Others (1)

Wipawee Tharmmaphornphilas

33

Call Router⚫ Number of lines 4

⚫ Service time Lognormal (location = 0.71, spread =0.04, giving mean = 0.5, SD =0.1)

Information⚫ Number of lines 4

⚫ Service time Erlang (mean = 2, k =5)

⚫ Routing out leave 73%, ticket sales 25%, CSR 2%

Page 34: 2104612 Computer Simulation Introduction

Model Data -- Others (2)

Wipawee Tharmmaphornphilas

34

Ticket sales⚫ Number of lines 4

⚫ Service time Lognormal (location = 1.09, spread =0.02, giving mean =3.0, SD =0.4)

⚫ Routing out leave 98%, CSR 2%

CSR

⚫ Number of lines 4

⚫ Service time Erlang (mean 3, k=3)

Page 35: 2104612 Computer Simulation Introduction

Model Data -- Others (3)

Wipawee Tharmmaphornphilas

35

Queues⚫ Capacity 10

⚫ Queue priority FIFO

⚫ Leaving threshold time 3 minutes

CSR staff⚫ Number 3

Page 36: 2104612 Computer Simulation Introduction

Model Coding

Wipawee Tharmmaphornphilas

36

Page 37: 2104612 Computer Simulation Introduction

Verification and Validation -- Deterministic model (1)

Wipawee Tharmmaphornphilas

37

Fixed arrival rate 214 per hour = inter-arrival time 0.28 minutes

Customers leave after receiving their first service

Service time at each point is fixed at mean

Info. 0.6, ticket sales 0.3, CSR lines 0.1

Run simulation model 100 hours with a warm-up period 1 hr

Page 38: 2104612 Computer Simulation Introduction

Metric Calculation Router Info. Ticket CSR

Arrival rate per hr (a)

Calls handled per hr (b)

Utilization

Total calls per hr * proportion

60m/service time* #lines

(a)/(b)

214*1.0=214

60/0.5*4

=480

44.58%

214*0.6=128.4

60/2*4

=120

100%

214*0.3=64.2

60/3*4

=80

80.25%

214*0.1=21.4

60/3*3

=60

35.67%

Simulation 44.58% 100% 80.25% 35.67%

Wipawee Tharmmaphornphilas

38

Verification and Validation-- Deterministic model (2)

Page 39: 2104612 Computer Simulation Introduction

Experimentation-- Obtaining accurate results

Wipawee Tharmmaphornphilas

39

Model is terminating simulation

There are 3 key output statistics⚫ Percentage of lost calls

⚫ Percentage of calls completed with WT < 2 min

⚫ Mean total waiting time

Initial Condition = 0 call

10 Replications of 14 hours

Page 40: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Percentage of Lost Calls

Wipawee Tharmmaphornphilas

40

Page 41: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Time Series of the Percentages of Lost Calls

Wipawee Tharmmaphornphilas

41

Page 42: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Percentage of completed calls WT< 2 min

Wipawee Tharmmaphornphilas

42

Page 43: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Mean total waiting time

Wipawee Tharmmaphornphilas

43

Page 44: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Searching the solution space

4 6 8

4 Scenario 1 Scenario 2 Scenario 3

6 Scenario 4 Scenario 5 Scenario 6

8 Scenario 7 Scenario 8 Scenario 9

Wipawee Tharmmaphornphilas

44

Information lines

Tic

ket

sale

s lin

es

Experiment is performed on “blue” scenarios

Page 45: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Percentage of Lost Calls

Wipawee Tharmmaphornphilas

45

4 6 8

4 19.11

(18.20,20.03)

10.84

(10.21,11.47)

6 6.70

(6.21,7.20)

8 11.43

(10.50,12.37)

1.69

(1.25,2.13)

Information lines

Tic

ket

sale

s lin

es

Page 46: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Percentage of completed calls WT< 2 min

Wipawee Tharmmaphornphilas

46

4 6 8

4 63.23

(60.81,65.66)

79.85

(78.64,81.07)

6 80.23

(78.96,81.51)

8 77.27

(74.82,79.72)

90.75

(89.09,92.41)

Information lines

Tic

ket

sale

s lin

es

Page 47: 2104612 Computer Simulation Introduction

Experimentation (objective 1)-- Mean total waiting time

Wipawee Tharmmaphornphilas

47

4 6 8

4 1.45

(1.37,1.52)

0.85

(0.82,0.89)

6 0.88

(0.83,0.93)

8 0.96

(0.89,1.03)

0.49

(0.44,0.55)

Information lines

Tic

ket

sale

s lin

es

Page 48: 2104612 Computer Simulation Introduction

Experimentation-- run scenarios 6 & 8

Results Scenario 6 Scenario 8

Lost calls

Calls with WT < 2

Mean total WT

4.38 (3.78,4.98)

85.86 (84.18,87.53)

0.67 (0.61,0.73)

4.26 (3.97,4.55)

85.36 (84.41,86.31)

0.69 (0.65,0.73)

Wipawee Tharmmaphornphilas

48

•Perform statistical analysis•Scenarios 6 & 8 are not significantly different,but they are significantly different from scenario 9

•The management need to select one scenario

Page 49: 2104612 Computer Simulation Introduction

Experimentation (objective 2)

Wipawee Tharmmaphornphilas

49

Scenario 9 is used

Sensitivity Analysis is performed ⚫ Increase arrival rate in steps of 5% to 40%

Page 50: 2104612 Computer Simulation Introduction

Experimentation (objective 2)-- Percentage of Lost Calls

Wipawee Tharmmaphornphilas

50

Page 51: 2104612 Computer Simulation Introduction

Experimentation (objective 2)-- Percentage of completed calls WT< 2 min

Wipawee Tharmmaphornphilas

51

Page 52: 2104612 Computer Simulation Introduction

Experimentation (objective 2)-- Mean total waiting time

Wipawee Tharmmaphornphilas

52

Page 53: 2104612 Computer Simulation Introduction

Building Model: A barbershop

⚫ Customers visit a barbershop for a haircut. The inter-arrival time is exponentially distributed with the average of 10 min. The barber takes 8-10 min uniformly distributed for each haircut. Simulate the system for 200 min❑ How many customers can be processed?❑ What is the average num of customers waiting to get a haircut?

What is the maximum?

❑ What is the average time spent by a customer in the salon?❑ What is the utilization of the barber