Department of Computer Science and Engineering
Computer Science 177: Simulation and
simulation program. Beware that this example program is
written in an obscure (but vastly underappreciated!) programming
language called Turing.
However, this same "gas station" program was later translated into
several other languages that you may be more familiar with, namely:
Critical Points for Student's t-distribution and Standard Normal
is an online table of critical points for the Student's t-distribution
and Standard Normal distribution. It has the same data as Table T.1 in
our textbook except for simplifying the notation in the row and column
is an online table of critical points for the Chi-Squared distribution.
It has the same data as Table T.2 in our textbook except the column
headings are inverted. Where our textbook labels each column by the
area under the curve to the left of the critical point, this online
table labels each column by the area to the right of the critical
notes provide some programming details on how to generate Q-Q Plots,
including the case where the theoretical distribution is discrete
(which the textbook claims is not possible). Two examples are provided
to show how the technique can be applied to real empirical data.
Programming with CSIM
is an extension to C++ (or
to C, since there are two versions available) with special features to
make it easy to write simulation programs, including the generation of
random variables with many commonly used distributions and a variety of
built-in measurement constructs. Unlike "conventional" methods for
programming an event driven simulation model (i.e, the time-driven or
event-driven program structures) CSIM models rely heavily on concurrent
programming techniques (similar to what you may have seen in CS153
and/or CS160), which in the simulation literature is known as the process-interaction
method for constructing a simulation model. What this means to you is
that you must write a self-contained "program" (more properly a
"process" or "thread") to describe the behavior of a single entity.
we assume that each of the active entities
are executing their respective "programs" concurrently, using
the simulation clock and/or various inter-process communications
programming constructs (such as signal/wait,
etc) to coordinate their activities.
complete CSIM reference
manual is available online at the Mesquite Software website here.
Using CSIM on CS
information has been updated
following the installation of CSIM-19 in April 2003. The CSIM-19
installation package comes with many small example programs to
illustrate the use of different language features. On the CS
Department server "bass", they can be accessed through the directories:
||For C++ versions of the example CSIM programs
||For C versions of the example CSIM programs
programs can be
compiled on the local CS department computers with the following
one-line command or, if you
prefer, a Makefile set up for the airport
shuttle example below.
A First CSIM
Program - "Hello World"
is a discussion about some basic CSIM program features, using a trivial
program that prints a series
of "hello world" messages on the standard output.
Large Sample CSIM
Airport shuttle bus system
is a CSIM program that simulates the shuttle bus to connect the airport
terminal buildings with an offsite rental car center.
is a modification that uses mailboxes
instead of events to control boarding.
Small CSIM Example with facility
sets and inspector methods
Here I've written two
versions (here and there)
control of a few "podiums" (represented by a facility set), where they
can give a short speech (represented by printing a message on the std
output). I purposely chose all times to be integer valued, so multiple
processes often try to reserve the same facility "simultaneously", and
thus show that the "winner" of such a competition is unpredictable. The
second version of the program shows the effect of checking the status
of the facility (which never causes your process to be suspended)
before trying to reserve it (which will suspend execution of your
process if it is occupied).