Upload
louisa-kerry-hubbard
View
214
Download
0
Embed Size (px)
DESCRIPTION
Role of Computers in Simulation Computers are critical in simulating complex tasks Three types of computer programming languages are available to help the simulation process General-purpose languages Special-purpose simulation languages 1.These require less programming 2.Are more efficient and easier to check for errors 3.Have random number generators built in Pre-written simulation programs built to handle a wide range of common problems Excel and add-ins can also be used for simulation problems
Citation preview
Simulation enables the study of complex system. Simulation is a good approach when analytic study of a system is not possible or very complex. Informational, organizational, and environmental changes can be simulated. The knowledge gained in designing a simulation model may be of great value toward suggesting improvement in the system under investigation. Simulation can be used to experiment with new designs or policies prior to implementation (what if scenarios). Experiments can be very expensive , dangerous … The modern system is so complex that the interactions can be treated only through simulation.
When and Why to use Simulations?
when the problem can be solved using common sense
when the problem can be solved analytically
when it is easier to perform direct experiments
when the costs exceed the savings
when the resources or time are not available
when the ability to verify and validate the model is very limited
when the system behavior is too complex or cannot be defined
When Simulation Cannot be Used?
Role of Computers in Simulation• Computers are critical in simulating complex tasks• Three types of computer programming languages are
available to help the simulation process• General-purpose languages • Special-purpose simulation languages
1. These require less programming2. Are more efficient and easier to check for errors3. Have random number generators built in
• Pre-written simulation programs built to handle a wide range of common problems
• Excel and add-ins can also be used for simulation problems
• Using simulation, a manager should1. Define a problem2. Introduce the variables associated with the problem3. Construct a numerical model4. Set up possible courses of action for testing5. Run the experiment6. Consider the results7. Decide what courses of action to take
Process of Simulation
Process of SimulationDefine Problem
Introduce Important Variables
Construct Simulation Model
Specify Values of Variables to Be Tested
Conduct the Simulation
Examine the Results
Select Best Course of Action
Simulation Study (detailed vision)
1- Problem formulation: Every study
should begin with a statement of the
problem
2- Setting of objectives and overall
project plan: The objectives indicate
the questions to be answered by
simulation.
3- Model conceptualization: The
construction of a model of a system is
probably as much art as science
Simulation Study (detailed vision)
4- Data collection: There is a
constant interplay between the
construction of the model and the
collection of the needed input data
[Shannon, 1975]. As the
complexity of the model changes,
the required data elements may
also change.
5- Model translation: the model
must be entered into a computer-
recognizable format.
6- Verification: Is the computer
program performing properly?
7- Validation: Does the simulation
model replicate this system measure?
Simulation Study (detailed vision)
8- Experimental design: The
alternatives that are to be simulated
must be determined
9- Production runs and analysis:
Production runs, and their
subsequent analysis, are used to
estimate measures of performance
for the system designs that are being
simulated.
Simulation Study (detailed vision)
10- More runs? determines if
additional runs are needed and what
design those additional experiments
should follow.
11- Documentation and Reporting.
12- Implementation.
Simulation Study (detailed vision)
11
Discrete Event Simulation
• Definition• Time-Advance Mechanisms • Components and Organization of a Discrete -Event
Simulation Model– Components– Logic Organization
12
Definitions
• Discrete-event simulation concerns the modeling of a system as it evolves over time by a representation in which the state variables change instantaneously at separate points in time. Or the system can change at only a countable number of points in time.
• Event is defined as an instantaneous occurrence that may change the state of the system.
13
Example 1.1• Single-server queuing system: a barbershop, to
estimate the (expected) average delay in queue (line) of arriving customers– State variables: the status of the server (busy or idle),
the number of customers waiting in queue to be served, the time of arrival of each person waiting in queue.
– Events: the arrival of a customer and the completion of service for a customer, which results in the customer’s departure.
14
Time-Advance Mechanisms• Simulation clock: the variable in a simulation model that
gives the current value of simulated time. – to keep track of the current value of simulated time as the
simulation proceeds– to advance simulated time from one value to another
• Advancing the simulation clock– next-event time advance (mostly used)– fixed-increment time advance (a special case of the first)
• Next-event time-advance approach– simulation clock is initialized to zero– the times of occurrence of future events are determined.
15
Time-Advance Mechanisms• More on next-event time advance
– Initialize simulation clock to 0– Determine times of occurrence of future events – event list– Clock advances to next (most imminent) event, which is
executed• Event execution may involve updating event list
– Continue until stopping rule is satisfied (must be explicitly stated)
– Clock “jumps” from one event time to the next, and doesn’t “exist” for times between successive events … periods of inactivity are ignored
16
Example 1.2• Notations: – ti: time of arrival of the ith customer (t0=0)
– Ai: interarrival time between (i-1)st and ith arrivals of customers
– Si : time that server actually spends serving ith customer (exclusive of customer’s delay in queue)
– Di : delay in queue of ith customer
– Ci : time that ith customer completes service and departs
– ei : time of occurrence of ith event of any type (ith value the simulation clock takes on, excluding the value )
17
e0 e1 e2 e3 e4 e5
0 t1 t2 c1 t3 c2
A1 A2 A3
S1 S2
Time
18
Components and Organization of a Discrete-Event Simulation Model
• Components (10) Systems state: The 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: Variables used for storing
statistical information about system performance
19
Continue... Initialization routine: A subprogram to initialize the
simulation model at time 0 Timing routine: A subprogram that determines the
next event from the event list and then advances the simulation clock to the time when that event is to occur
Event routine: A subprogram that updates the system state when a particular type of event occurs (there is one event routine for each event type)
20
Continue... Library routines: A set of subprograms used to
generate random observations from probability distributions that were determined as part of the simulation model
Report generator: A subprogram that computes estimates (from the statistical counters) of the desired measures of performance and produces a report when the simulation ends
21
Continue... Main program: A subprogram that invokes the timing
routine to determine the next event and then transfers control to the corresponding event routine to update the system state appropriately. The main program may also check for termination and invoke the report generator when the simulation is over.
22
Start
1. Set simulation clock=02. Initialize system state and statistical counters3. Initialize event list
0. Invoke the initialization routine
1. Invoke the timing routine2. Invoke event routine
1. Determine the next event type, say, i2. Advance the simulation clock
1.Update system state2.Update statistical counters3.Generate future events and add to event list
Repeatedly
Initialization routine Main program Time routine
Event routine i
Generate randomvariates
Library routines
Issimulation
over?
1. Compute estimates of interest2. Write report
Stop
Report generator
10
2
i
No
Yes