Department of Computer Science and Engineering

Computer Science 177:  Simulation and Modeling

Spring 2003

Course Information

Sample Midterms and Exams

Supplementary Lecture Notes on Simulation and Modelling

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:

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.
 

CSIM Reference Manual

The complete CSIM reference manual is available online at the Mesquite Software website here.

Using CSIM on CS Department Computers

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 computers, they can be accessed through the directories:
 
/usr/local/pkgs/csim19/c++/examples  For C++ versions of the example CSIM programs
/usr/local/pkgs/csim19/c/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.

Large Sample CSIM Program - Airport shuttle bus system

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