Вы находитесь на странице: 1из 5

Discrete event simulation

A discrete-event simulation (DES) models the opera- ple for a discrete event simulation.[3]
tion of a system as a discrete sequence of events in time.
Each event occurs at a particular instant in time and marks
a change of state in the system.[1] Between consecutive
events, no change in the system is assumed to occur; thus 2 Components
the simulation can directly jump in time from one event
In addition to the logic of what happens when system
to the next.
events occur, discrete event simulations include the folThis contrasts with continuous simulation in which the
lowing:
simulation continuously tracks the system dynamics over
time. Instead of being event-based, this is called an
activity-based simulation; time is broken up into small
time slices and the system state is updated according to 2.1 State
the set of activities happening in the time slice.[2] Because
discrete-event simulations do not have to simulate every A system state is a set of variables that captures the salient
time slice, they can typically run much faster than the cor- properties of the system to be studied. The state trajectory overtime S(t) can be mathematically represented by
responding continuous simulation.
a step function whose values change in correspondence
A more recent method is the three-phased approach to of discrete events.
discrete event simulation (Pidd, 1998). In this approach,
the rst phase is to jump to the next chronological event.
The second phase is to execute all events that uncondi2.2 Clock
tionally occur at that time (these are called B-events). The
third phase is to execute all events that conditionally occur at that time (these are called C-events). The three The simulation must keep track of the current simulaphase approach is a renement of the event-based ap- tion time, in whatever measurement units are suitable for
proach in which simultaneous events are ordered so as to the system being modeled. In discrete-event simulations,
make the most ecient use of computer resources. The as opposed to real-time simulations, time 'hops because
three-phase approach is used by a number of commercial events are instantaneous the clock skips to the next event
simulation software packages, but from the users point of start time as the simulation proceeds.
view, the specics of the underlying simulation method
are generally hidden.

2.3 Events list

The simulation maintains at least one list of simulation


events. This is sometimes called the pending event set because it lists events that are pending as a result of previously simulated event but have yet to be simulated themselves. An event is described by the time at which it occurs and a type, indicating the code that will be used to
simulate that event. It is common for the event code to
be parametrized, in which case, the event description also
contains parameters to the event code.

Example

A common exercise in learning how to build discreteevent simulations is to model a queue, such as customers
arriving at a bank to be served by a teller. In this example, the system entities are Customer-queue and
Tellers. The system events are Customer-Arrival and
Customer-Departure. (The event of Teller-BeginsService can be part of the logic of the arrival and departure events.) The system states, which are changed by
these events, are Number-of-Customers-in-the-Queue
(an integer from 0 to n) and Teller-Status (busy or
idle). The random variables that need to be characterized to model this system stochastically are CustomerInterarrival-Time and Teller-Service-Time. An agentbased framework for performance modeling of an optimistic parallel discrete event simulator is another exam-

When events are instantaneous, activities that extend over


time are modeled as sequences of events. Some simulation frameworks allow the time of an event to be specied
as an interval, giving the start time and the end time of
each event.
Single-threaded simulation engines based on instantaneous events have just one current event. In contrast,
multi-threaded simulation engines and simulation engines
1

COMMON USES

supporting an interval-based event model may have mul- runs of the model. Condence intervals are usually contiple current events. In both cases, there are signicant structed to help assess the quality of the output.
problems with synchronization between current events.
The pending event set is typically organized as a priority
queue, sorted by event time.[4] That is, regardless of the
order in which events are added to the event set, they are
removed in strictly chronological order. Several generalpurpose priority queue algorithms have proven eective
for discrete-event simulation,[5] most notably, the splay
tree. More recent alternatives include skip lists, calendar
queues,[6] and ladder queues.[7]

2.6 Ending condition


Because events are bootstrapped, theoretically a discreteevent simulation could run forever. So the simulation designer must decide when the simulation will end. Typical
choices are at time t or after processing n number of
events or, more generally, when statistical measure X
reaches the value x.

Typically, events are scheduled dynamically as the simulation proceeds. For example, in the bank example
noted above, the event CUSTOMER-ARRIVAL at time 3 Simulation engine logic
t would, if the CUSTOMER_QUEUE was empty and
TELLER was idle, include the creation of the subsequent
event CUSTOMER-DEPARTURE to occur at time t+s, The main loop of a discrete-event simulation is something
where s is a number generated from the SERVICE-TIME like this:
distribution.

3.1 Start
2.4

Random-number generators

The simulation needs to generate random variables of


various kinds, depending on the system model. This is accomplished by one or more Pseudorandom number generators. The use of pseudo-random numbers as opposed
to true random numbers is a benet should a simulation
need a rerun with exactly the same behavior.
One of the problems with the random number distributions used in discrete-event simulation is that the steadystate distributions of event times may not be known in
advance. As a result, the initial set of events placed into
the pending event set will not have arrival times representative of the steady-state distribution. This problem is
typically solved by bootstrapping the simulation model.
Only a limited eort is made to assign realistic times to
the initial set of pending events. These events, however,
schedule additional events, and with time, the distribution
of event times approaches its steady state. This is called
bootstrapping the simulation model. In gathering statistics
from the running model, it is important to either disregard
events that occur before the steady state is reached or to
run the simulation for long enough that the bootstrapping
behavior is overwhelmed by steady-state behavior. (This
use of the term bootstrapping can be contrasted with its
use in both statistics and computing.)

Initialize Ending Condition to FALSE.


Initialize system state variables.
Initialize Clock (usually starts at simulation time
zero).
Schedule an initial event (i.e., put some initial event
into the Events List).

3.2 Do loop or while loop


While (Ending Condition is FALSE) then do the following:
Set clock to next event time.
Do next event and remove from the Events List.
Update statistics.

3.3 End
Generate statistical report.

4 Common uses
2.5

Statistics
4.1 Diagnosing process issues

The simulation typically keeps track of the systems


statistics, which quantify the aspects of interest. In the
bank example, it is of interest to track the mean waiting times. In a simulation model, performance metrics
are not analytically derived from probability distributions,
but rather as averages over replications, that is dierent

Simulation approaches are particularly well equipped to


help users diagnose issues in complex environments. The
Goal (Theory of Constraints) illustrates the importance
of understanding bottlenecks in a system. Only process
improvements at the bottlenecks will actually improve

3
the overall system. In many organizations bottlenecks be- 5 See also
come hidden by excess inventory, overproduction, variability in processes and variability in routing or sequenc- System modeling approaches:
ing. By accurately documenting the system inside a simulation model it is possible to gain a birds eye view of the
Finite-state machine and a special case, Markov
entire system.
chain
A working model of a system allows management to un Stochastic process and a special case, Markov proderstand performance drivers. A simulation can be built
cess
to include any number of performance indicators such as
worker utilization, on-time delivery rate, scrap rate, cash
Queueing theory and in particular birth-death procycles, and so on.
cess
4.1.1

Hospital applications

Discrete Event System Specication

Transaction-level modeling (TLM)


An operating theater is generally shared between several
surgical disciplines. Through better understanding the
Computational techniques:
nature of these procedures it may be possible to increase
the patient throughput. Example: If a heart surgery takes
Computer experiment
on average four hours, changing an operating room schedule from eight available hours to nine will not increase
Computer simulation
patient throughput. On the other hand, if a hernia procedure takes on average twenty minutes providing an extra
Monte Carlo method
hour may also not yield any increased throughput if the
capacity and average time spent in the recovery room is
Variance reduction
not considered.
Pseudo random number generator

4.2

Lab test performance improvement Software:


ideas

List of computer simulation software


Many systems improvement ideas are built on sound prin List of discrete event simulation software
ciples, proven methodologies (Lean, Six Sigma, TQM,
etc.) yet fail to improve the overall system. A simulation model allows the user to understand and test a per- Disciplines:
formance improvement idea in the context of the overall
system.
Industrial engineering

4.3

Evaluating capital investment decisions


See also: Monte Carlo methods in nance;
Corporate nance #Capital investment decisions and #Quantifying uncertainty.

Simulation modeling is commonly used to model potential investments. Through modeling investments
decision-makers can make informed decisions and evaluate potential alternatives.

4.4

Network simulators

Discrete event simulation is used in computer network to


simulate new protocols for dierent network trac scenarios before deployment.

Network simulation

6 References
[1] Stewart Robinson (2004). Simulation The practice of
model development and use. Wiley.
[2] Matlo, Norm. Introduction to Discrete-Event Simulation and the SimPy Language (PDF). Retrieved 24 January 2013.
[3] Aditya Kurve; Khashayar Kotobi; George Kesidis. An
agent-based framework for performance modeling of an
optimistic parallel discrete event simulator. Complex
Adaptive Systems Modeling. 1: 12. doi:10.1186/21943206-1-12.
[4] Douglas W. Jones, ed. Implementations of Time, Proceedings of the 18th Winter Simulation Conference,
1986.

7 FURTHER READING

[5] Douglas W. Jones, Empirical Comparison of Priority


Queue and Event Set Implementations, Communications
of the ACM, 29, April 1986, pages 300311.
[6] Kah Leong Tan and Li-Jin Thng, SNOOPy Calendar
Queue, Proceedings of the 32nd Winter Simulation Conference, 2000
[7] Tom Dickman, Sounak Gupta and Philip A. Wilsey, , Proceedings of the 2013 ACM SIGSIM conference on Principles of advanced discrete simulation

Further reading
Myron H. MacDougall (1987). Simulating Computer Systems: Techniques and Tools. MIT Press.
William Delaney; Erminia Vaccari (1988). Dynamic Models and Discrete Event Simulation.
Dekker INC.
Roger W. McHaney (1991). Computer Simulation:
A Practical Perspective. Academic Press.
Michael Pidd (1998). Computer simulation in management science fourth edition. Wiley.
A, Alan Pritsker, Jean J. O'Reilly (1999). Simulation with Visual SLAM and AweSim. Wiley.
Averill M. Law; W. David Kelton (2000). Simulation modeling and analysis third edition. McGraw
Hill.
Bernard P. Zeigler; Herbert Praehofer; Tag Gon
Kim (2000). Theory of modeling and simulation:
Integrating discrete event and continuous complex dynamic systems second edition. Academic Press.
Jerry Banks; John Carson; Barry Nelson; David
Nicol (2005). Discrete-event system simulation
fourth edition. Pearson.
James J. Nutaro (2010). Building software for simulation: theory and algorithms, with applications in
C++. Wiley.

Text and image sources, contributors, and licenses

8.1

Text

Discrete event simulation Source: https://en.wikipedia.org/wiki/Discrete_event_simulation?oldid=742837428 Contributors: The Anome,


Michael Hardy, RainbowOfLight, Alkarex, BD2412, Rjwilmsi, Dmccreary, Alpt, StefanMangold, Wiki alf, Grafen, A.bit, Royalguard11,
Eug, Kuru, Robbins, Lorikeet, Iridescent, Nczempin, Mark Kilby, Yaris678, Cydebot, Omicronpersei8, RichardVeryard, LannerGroup,
Haralame, EyeSerene, Nono64, Thedrow, Mange01, Choihei, Sdudah, Insight55, Bry9000, OptRicardo, Erichoward82, Getonyourfeet,
Pmjones, WereSpielChequers, Bentogoa, Facsimiler, ClueBot, PipepBot, DanielDeibler, Moshep, Lbertolotti, Mhhwang2002, Ts4079,
Anerxelda, Akshaygs, Addbot, ViseMoD, Howard Landman, VSteiger, Maennlein, MrOllie, LaaknorBot, Jimsve, Yobot, Killiesucks,
Roger.mchaney, Denispir, KamikazeBot, Bab dz, AnomieBOT, Simulation123simulation123, Anima007, Eallik, Shulini, Dlb19338, Iwjnichol, Obankston, Onel5969, Iandola, EmausBot, Jimbojimbo2, JaeDyWolf, Dcirovic, ZroBot, ClueBot NG, Rustysawdust, Djkrahl,
BG19bot, Lingathoor, Brennonbrimhall, JYBot, Me, Myself, and I are Here, Mark viking, FloydtheChimp, SimUser and Anonymous:
69

8.2

Images

8.3

Content license

Creative Commons Attribution-Share Alike 3.0

Вам также может понравиться