38
Introduction into Simulation Basic Simulation Modeling

Introduction into Simulation

  • Upload
    tacita

  • View
    66

  • Download
    0

Embed Size (px)

DESCRIPTION

Introduction into Simulation. Basic Simulation Modeling. The Nature of Simulation. definitions. simulation imitate operations of real-world facilities or processes system facility or process of interest assumptions needed (mathematical, logical) model set of assumptions - PowerPoint PPT Presentation

Citation preview

Page 1: Introduction into  Simulation

Introduction into SimulationBasic Simulation Modeling

Page 2: Introduction into  Simulation

2

The Nature of Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 3: Introduction into  Simulation

3

definitions

• simulation – imitate operations of real-world facilities or processes• system

– facility or process of interest–assumptions needed (mathematical, logical)• model

–set of assumptions–used to gain understanding how corresponding system works

–simple enough? → solve analytically to obtain exact information–mostly too complex → evaluate model numerically using simulation

and estimate desired true characteristics040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 4: Introduction into  Simulation

4

System, Models and Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 5: Introduction into  Simulation

5

system

• set of entities (people, machine, etc.) that (inter)act–example [bank]: tellers, customers, loan officers

• state of system–collection of variables to describe system at particular time–example [bank]: number of busy tellers, number of customers in the

bank, arrival time of each customer

• entities–characterized by data values (attributes)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 6: Introduction into  Simulation

6

types of system

• discrete system–state variables change instantaneously at separated points in time–example: bank• number of customers changes: new customer arrives, service finished

• continuous system–state variables change continuously with respect to time–example: airplane moving through air• position, velocity can change continuously

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 7: Introduction into  Simulation

7

different ways to study a system

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

system

experiment with actual system

experiment with model of the

system

mathematical model

physical model

analytical solution

Simulation

Page 8: Introduction into  Simulation

8

classification of simulation models

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

• static vs. dynamic simulation models–static model: time plays no role–dynamic model: represents model as it evolves over time • deterministic vs. stochastic simulation models

–deterministic: no probabilistic (i.e. random) components–stochastic: random components, output itself is random (estimate of

true models characteristics)• continuous vs. discrete simulation models

–continuous: state variables change instantaneously–discrete: changes only happen at discrete point in time

DSM discrete event simulation models

Page 9: Introduction into  Simulation

9

Discrete Event Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 10: Introduction into  Simulation

10

discrete event simulation

• system evolves over time• state variables change at separate points in time only

–whenever an event occurs

• example [bank]: (single server, estimate average waiting time in queue)

–state variables: • status of server (idle or busy)• number of customers in queue (or in system)• time of arrival of each customer (for calculation of waiting time)–events: customer arrives, service complete (customer leaves)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 11: Introduction into  Simulation

11

simulation clock

• time-advance mechanism–keep track of current value of simulated time–no explicit unit of measurement → same unit as input parameters (be

consistent!!)

• two approaches–next-event time advance• simulation clock initialized at time 0• times of future events are determined• clock is advanced to the next future event (nothing happens/changes

between)– fixed-increment time advance

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 12: Introduction into  Simulation

12

Simulation of Single-Server Queuing System (M/M/1)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 13: Introduction into  Simulation

13

M/M/1

• interarrival times (service times)–A1, A2, A3, …. (S1, S2, S3, ….)

– iid (independent and identically distributed) random variables

• arriving customer (served FCFS/FIFO)–who finds the server idle: is served immediately–who finds the server busy: joins the end of a single queue• upon completion of service

–queue: first customer in queue will be serviced–no queue: server is idle again

• start of simulation: empty and idle040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 14: Introduction into  Simulation

14

M/M/1

• performance measures–expected average delay in queue d(n)–expected average number of customers in queue q(n)–expected utilization of server u(n)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 15: Introduction into  Simulation

15

delay d(n)

• estimator of systems performance from customers point of view

• on a given run: observed average delay –depends on random service and arrival times– is random itself– estimator for d(n)

Di customer delays on a very long (infinite) run

delay of a customer can also be equal to zero (D1 = 0)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 16: Introduction into  Simulation

16

number in queue q(n)

• customers in queue• customers in system (not being served)• again: observation is just an estimator of true expected value

pi expected proportion of time there are i customers in queueT(n) time necessary to observe n delays in queueTi total time during the simulation the queue is of length i

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 17: Introduction into  Simulation

17

utilization u(n)

• measures how busy server is• expected utilization = expected proportion of time server is busy (not

idle)

• busy function

• estimator

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 18: Introduction into  Simulation

18

performance measures

• discrete time statistic–average delay

(defined relative to discrete random variables Di)

• continuous-time statistic–average number in queue–utilization

(defined on continuous random variables Q(t) and B(t))

• other statistics than just averages–minimum, maximum, proportion of time there’re at least 5 customer in

queue040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 19: Introduction into  Simulation

19

simulation “by hand”

necessary random variables(generated from their corresponding probability distribution)

• interarrival timesA1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2

A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9• service times

S1 = 2.0S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7

S6 = 0.6

initializiation (t = 0)system starts emtpy (no customers yet) and idle (server not busy)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 20: Introduction into  Simulation

20

0

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

Arrivals

Departureinitialize system at t = 0

Page 21: Introduction into  Simulation

21

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 Arrivals

Departure

Page 22: Introduction into  Simulation

22

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1 Arrivals

Departure

Page 23: Introduction into  Simulation

23

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1 ea4= 3.8 Arrivals

Departure

Page 24: Introduction into  Simulation

24

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ea4= 3.8 Arrivals

Departure

Page 25: Introduction into  Simulation

25

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8 Arrivals

Departure

Page 26: Introduction into  Simulation

26

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8 Arrivals

Departure

Page 27: Introduction into  Simulation

27

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8

ed4= 4.9

ea5= 4.0

Arrivals

Departure

Page 28: Introduction into  Simulation

28

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8

ed4= 4.9

ea5= 4.0

ea6= 5.6 Arrivals

Departure

Page 29: Introduction into  Simulation

29

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

A1 = 0.4 A2 = 1.2 A3 = 0.5 A4 = 1.7 A5 = 0.2A6 = 1.6 A7 = 0.2 A8 = 1.4 A9 = 1.9

S1 = 2.0 S2 = 0.7 S3 = 0.2 S4 = 1.1 S5 = 3.7 S6 = 0.6

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8

ed4= 4.9

ea5= 4.0

ed5= 8.6

ea6= 5.6 Arrivals

Departure

Page 30: Introduction into  Simulation

30

simulation “by hand”

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

t

Events

0 1 5 9

t

tB(t)

Q(t)

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8

ed4= 4.9

ea5= 4.0

ed5= 8.6

ea6= 5.6

ea7= 5.8

ea8= 7.2 Arrivals

Departure

Page 31: Introduction into  Simulation

31

average waiting time d(n)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

t

Events

0 1 5 9

ea1 = 0.4

ed1= 2.4

ea2= 1.6 ea

3= 2.1

ed2= 3.1

ed3= 3.3

ea4= 3.8

ed4= 4.9

ea5= 4.0

ed5= 8.6

ea6= 5.6

ea7= 5.8

ea8= 7.2 Arrivals

Departure

x x x

Page 32: Introduction into  Simulation

32

average number in queue q(n)

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Q(t)

0.0

1.6

2.1

2.4

3.1

4.0

5.6

4.9

5.8

7.2

8.6

Page 33: Introduction into  Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I 33

average utilization u(n)B(t)

0.0

0.4

3.3

3.8

8.6

fraction of time server

is busy

Page 34: Introduction into  Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I 34

Necessary Steps for Simulation

Page 35: Introduction into  Simulation

35040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

formulate problem and plan the study

collect data anddefine model

assumptions still valid

construct a computer program & verify

test runs

model valid

design experiments

make production runs

analyze output data

present results

yes

no

no

yes

Page 36: Introduction into  Simulation

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I 36

Advantages and Disadvantages of Simulation

Page 37: Introduction into  Simulation

37

advantages

complex models cannot be solved analytically→ only simulation possible

allows to estimate the performance of an existing system under some projected set of operating conditions

alternative proposed system designs (operating policies) can be compared easily

better control over experimental conditions

study system over long time frame

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I

Page 38: Introduction into  Simulation

38

disadvantages

each run of a stochastic modelproduces only estimates of true measures→ several independent runs (or one very long one) needed

expensive and time consuming

need to make sure the model is valid

040669 || WS 2008 || Dr. Verena Schmid || PR KFK PM/SCM/TL Praktikum Simulation I