Department of Computer Science and Engineering

Computer Science 177:  Simulation and Modeling

Winter 2007

Course Information

Sample Midterms and Exams

Supplementary Lecture Notes

These notes describe the development of a "gas station" model as a detailed example of an event-driven 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:
These 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.

Information about Programming with CSIM

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. The combined behavior of the simulation model is obtained by the magic of concurrent execution: 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, mutual exclusion, etc) to coordinate their activities.
 
The complete CSIM reference manual is available online at the Mesquite Software website here.
This 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 "eon", they can be accessed through the directories:
 
/usr/csshare/src/csim_cpp-19.0/examples  For C++ versions of the example CSIM programs
/usr/csshare/src/csim_c-19.0/examples For C versions of the example CSIM programs
CSIM/C++ 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.

Here is a CSIM program that simulates the shuttle bus to connect the airport terminal buildings with an offsite rental car center.