Introduction to the SimPy Discrete-Event Simulation Package

Professor Norm Matloff
University of California, Davis

Contents:

About SimPy:

SimPy (rhymes with "Blimpie") is a public-domain package for process-oriented discrete-event simulation, developed originally by Klaus Miller and Tony Vignaux. It is written in, and called from, Python. I like the clean manner in which SimPy is designed, its use of Python generators, and for that matter, Python itself.

If you haven't used Python before, you can learn enough about it to use SimPy quite quickly; see my quick tutorial on Python. The first chapter should suffice.

Version

This site is devoted to provided quick access to SimPy 2.1. Version 3.0 brought a major redesign, unfortunately not backward-compatible.

Where to obtain it:

Download it from this archive .

How to install it:

Create a directory, say /usr/local/SimPy. You need to at least put the code files Simulation.* and __init__.* in that directory, and I will assume here that you also put in the test and documentation subdirectories which come with the package, say as subdirectories of /usr/local/SimPy.

You'll need that directory to be in your Python path, which is controlled by the PYTHONPATH environment variable. Set this in whatever manner your OS/shell set environment variable. For example, in csh on Linux or a Mac, type

setenv PYTHONPATH /usr/local/

Modify accordingly for bash, Windows, etc.

One way or the other, you need to be set up so that Python finds the library files correctly. Both the SimPy example programs and our example programs here include the line

from SimPy.Simulation import *

which instructs the Python interpreter to look for the module Simulation in the package SimPy. Given the setting of PYTHONPATH above, Python would look in /usr/local/ for a directory SimPy, i.e. look for a directory /usr/local/SimPy, and then look for Simulation.py and __init__.py (or their .pyc compiled versions) within that directory.

Test by copying testSimPy to some other directory and then running

python testSimPy.py

A message like "Run 84 tests..." will appear.

More information:

SimPy comes with quite a bit of documentation, including a number of examples.

Links to my SimPy tutorial:

I have a SimPy tutorial embedded in my online course on discrete-event simulation. The course is in the PDF files in http://heather.cs.ucdavis.edu/~matloff/156/PLN, with the first unit of the SimPy tutorial being in the file http://heather.cs.ucdavis.edu/~matloff/156/PLN/DESimIntro.pdf. See the above directory of PDF files for the remainder of the tutorial.

The .tex source files are in that directory too. To run the example programs yourself, just download the .tex file and edit to the example program code.