Simulation - Mechanical, Industrial and Systems...

29
Simulation

Transcript of Simulation - Mechanical, Industrial and Systems...

Page 1: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Simulation

Page 2: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Nature of simulation –

• Numerical approach for investigating models

of systems.

• Data are gathered to estimate the true

characteristics of the model.

• Garbage in – garbage out!

• One of the techniques of operations research

– possibly the most widely used.

Page 3: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Nature of simulation -2/2

• Typical applications:

– Designing and analyzing manufacturing systems.

– Evaluating military weapons systems.

– Evaluating logistics of weapons supply systems.

– Determining hardware and software requirements for a computer system.

– Designing and operating transportation systems.

– Evaluating designs for service organizations.

– Re-engineering business processes.

– Analyzing financial systems (?)

Page 4: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Designing and analyzing manufacturing systems.

Page 5: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 6: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 7: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 8: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 9: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 10: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 11: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Systems, Models and Simulation

• System: collection of entities, acting and interacting towards some logical end.

• The definition of a system depends on the goal of the analysis.

• The state of the system is the collection of

variables necessary to describe the system at a particular time.

• The definitional of the state of a system is conditional on the goals of the study.

Page 12: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Systems, Models and Simulation

• Types of systems:

– Discrete: state variables change instantaneously

at discrete points in time.

• Number of cars in a parking lot.

– Continuous: State variables change continuously

in time.

• Speed of a car.

Page 13: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

• Ways to study a system:

Systems, Models and Simulation

System

Experiment with the system

Experiment with a model of the system

Physical Model

Mathematical Model

Analytical Solution

Simulation

Page 14: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

• Experiment with the system:

• Physical Model

• Analytical solutions vs. Simulation

Systems, Models and Simulation

Page 15: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

• Types of simulations:

– Static vs. Dynamic simulations

• Monte Carlo

– Deterministic vs. Stochastic

• Output is determined given the inputs.

• Output changes given the same inputs.

– Continuous time vs. Discrete Simulation

• Similar to continuous and discrete models.

Systems, Models and Simulation

Page 16: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Discrete event simulation

• The system can change at only a countable

number of points in time.

• Events: cause changes to the simulation.

• Types of events:

– To change the state of the system.

– To change the simulation itself.

• Usually done using computers.

Page 17: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Time advance Mechanism

• All dynamic simulations need a system clock –

a counter to mimic real world time advances.

This is known as the simulation clock.

• Fixed increment time advance:

– Computer Games

• Next event time advance:

– Most commonly used system.

Page 18: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Next event time advance

• Single server queuing system:

Page 19: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Components and organization of

simulations• System state: collection of state variables necessary to describe the

system at a particular time.

• Simulation clock: a variable giving the current value of simulated time.

• Event list: A list containing the next time when each type of event will occur.

• Statistical counters: performance measuring variables.

• Initialization routine: Used at start of simulation.

• Timing routine: Next event selection routine.

• Event routine: Next event handling routine.

• Library routines: used to generate random variables.

• Report Generators: Performance reporting routines.

• Main program:

• Visual interface control routines:

Page 20: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Fowchart for next-event time-advance

Main program:

Invoke initialization routine

Invoke timing routine

invoke event routine

Event routine:

Update system state

Update statistical counters

Generate future events.

Initialization routine:

Set clock = 0

Initialize state variables and

statistical counters

Initialize event list.

Library routines:

Generate random variables

Timing routines:

Determine next event type.

Advance simulation clock.

Report generator:

Compute estimates of interest.

Write report

Start

Stop

Simulation over ?

Page 21: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Simulation approaches

• Event scheduling approach.

• Process approach.

Page 22: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Simulation of single server queuing

system

• Inter-arrival times are independent and identically distributed random variables.

• A customer who arrives and finds the server idle starts service immediately. Service times of successive customers are IID random variables.

• If server is busy, customer joins the waiting queue.

• Server selects customers from queue in a FIFO manner.

• Other issues ?

Page 23: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Simulation of single server queuing

system

• What do we want to study ?

– Customer delays ?

– Average number of customers in the queue:

Page 24: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Single server system

• Where, pi is the fraction of time there are i

customers in the queue.

• This can also be written as:

Page 25: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Single server queuing model

• Fraction of time the server is idle ?

Page 26: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Initialization Routine

Page 27: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Simulation

Page 28: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are
Page 29: Simulation - Mechanical, Industrial and Systems …mcise.uri.edu/sodhi/Courses/S10/ISE525/documents/week1_2.pdfSimulation of single server queuing system •Inter-arrival times are

Homework I

• How would you simulate a 4 way traffic

crossing ?

• Use excel to simulate the single server

queuing system for 100 arrivals.

• What is the mean server utilization ?

• Identify a data structure you would use for

handling the event list.