Page 77 - DCAP601_SIMULATION_AND_MODELING
P. 77
Unit 5: Discrete System Simulation (II)
Statistics Notes
The simulation typically keeps track of the system’s statistics, which quantify the aspects of
interest. In the bank example, it is of interest to track the mean service times.
Ending Condition
Because events are bootstrapped, theoretically a discrete-event 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”.
Simulation Engine Logic
The main loop of a discrete-event simulation is something like this:
Start
1. Initialize Ending Condition to FALSE.
2. Initialize system state variables.
3. Initialize Clock (usually starts at simulation time zero).
4. Schedule an initial event (i.e., put some initial event into the Events List).
“Do loop” or “While loop”
While (Ending Condition is FALSE) then do the following:
1. Set clock to next event time.
2. Do next event and remove from the Events List.
3. Update statistics.
End
Generate statistical report.
5.3 Generation of Random Numbers
A sequence of pseudo random numbers can be generated by a computer algorithm, such as the
Linear Congruential Method. Such sequences are not random, since each number is completely
determined from a set of numerical seeds. The sequences “appear” to be random, however, and
are useful in calculations and simulations. The following Java applet demonstrates random
number generation with the Linear Congruential Method. You can change the multiplier (a),
modulus (m), and the initial seed (I). The algorithm produces random numbers between 0 and 1.
You can see the distribution of 5000 random numbers develop as they are produced, by pressing
the Run button.
You may also choose from three ways to show the random number distributions:
1. 1D: shows the frequency distribution of all random numbers as a histogram divided into
20 bins from 0 to 1.
LOVELY PROFESSIONAL UNIVERSITY 71