Introduction

Salabim is a package for discrete event simulation in Python. It follows the methodology of process description as originally demonstrated in Simula and later in Prosim, Must and Tomas.
The process interaction methods are also quite similar to SimPy 2.

The package comprises discrete event simulation, queue handling, resources, statistical sampling and monitoring. On top of that real time animation is built in.

The package comes with a number of sample models.

Requirements

Salabim runs on

  • CPython
  • PyPy platform
  • Pythonista (iOS)

The package runs under Python 2.7 or 3.x.

The following packages are required:

Platform Base functionality Animation Video (mp4, avi) Animated GIF
CPython
Pillow, tkinter opencv, numpy Pillow
PyPy
Pillow, tkinter N/A Pillow
Pythonista
Pillow N/A Pillow
Several CPython packages, like WinPython support Pillow out of the box. If not, install with:
pip install Pillow
Under Linux, Pillow can be installed with:
sudo apt-get purge python3-pil
sudo apt-get install python3-pil python3-pil.imagetk
For, video production, installation of opencv and numpy may be required with
pip install opencv-python
pip install numpy

Running models under PyPy is highly recommended for production runs, where run time is important. We have found 6 to 7 times faster execution compared to CPython. However, for development, nothing can beat CPython or Pythonista.

Installation

The preferred way to install salabim is from PyPI with:
pip install salabim
or to upgrade to a new version:
pip install salabim --upgrade

You can find the package along with some support files and sample models on www.github.com/salabim/salabim. From there you can directly download as a zip file and next extract all files. Alternatively the repository can be cloned.

For Pythonista, the easiest way to download salabim is:

  • Tap ‘Open in…’.
  • Tap ‘Run Pythonista Script’.
  • Pick this script and tap the run button
  • Import file
  • Possibly after short delay, there will be a salabim-master.zip file in the root directory
  • Tap this zip file and Extract files
  • All files are now in a directory called salabim-master
  • Optionally rename this directory to salabim

Salabim itself is provided as one Python script, called salabim.py. You may place that file in any directory where your models reside.

If you want salabim to be available from other directories, without copying the salabim.py script, either install from PyPI (see above) or run the supplied install.py file. In doing so, you will create (or update) a salabim directory in the site-package directory, which will then contain a copy of the salabim package.

Python

Python is a widely used high-level programming language for general-purpose programming, created by Guido van Rossum and first released in 1991. An interpreted language, Python has a design philosophy that emphasizes code readability (notably using whitespace indentation to delimit code blocks rather than curly brackets or keywords), and a syntax that allows programmers to express concepts in fewer lines of code than might be used in languages such as C++ or Java. The language provides constructs intended to enable writing clear programs on both a small and large scale.

A good way to start learning about Python is https://www.python.org/about/gettingstarted/