PetriSim - Discrete Simulation Environment

 »  PetriSim 5 has been released !

[ What is PetriSim & History | Why PetriSim | What Types of Petri Nets | Download & Installation | Requirements]
[ Using old models | PetriSim Manual | PetriSim screens | The Author  ]

What is PetriSim & History

PetriSim (My Pet reasonably interactive Simulator) is a generator of discrete simulation models that can also be used as an editor and simulator of Petri Nets. Simulation models are created by adding Pascal code snippets into the net created by PetriSim. To do this you need Turbo or (better) Borland Pascal 7. There is only a PC version.

PetriSim 1 was originally created as a graphical editor and simulator of Petri Nets (exactly the so called Place/Transition Nets). So PetriSim enables intuitive, very user friendly creation, editing, and simulation of practically any number of Petri Nets at a time. Most operations are performed by drawing by mouse on the screen. It was possible to add Pascal code snippets to build user models, but time control was entirely the user's responsibility.

PetriSim 2 introduced the so called Time Nets. PetriSim nets use the firing delay concept (there can be a certain delay between removing tokens from input places and adding tokens to output places of a firing transition). The delay is generated by a user code snippet activated when the firing starts. By applying this very simple concept of firing delays together with the graphical language of Petri Nets, it is possible to create complex timing and synchronizing structures that are typical for discrete simulation models. So PetriSim 2 is a generator of discrete simulation models. The Time net is used as a skeleton that controls sequencing and timing of all activities. User code generates delays and performs all operations on user data. The user is supposed to know only basic ideas of Petri Nets and intermediate Pascal programming.

PetriSim 3 brought two major improvements: Visual programming gave a clear link between transitions and code snippets. Clicking a transition opens a menu whose two options start a text editor to enter or edit the starting and the ending code snippets. So user code can be written during a PetriSim session. PetriSim automatically generates all Pascal source code files. After editing user code, the whole PetriSim program has to be recompiled in Pascal IDE. Inheritance structure was made open. It is possible to write subclasses with a modified behavior of basic net objects (places, transitions, arcs). So it is possible to write PetriSim based simulation environments that still make use of the powerful PetriSim editing and simulation control facilities. So far this has been used to implement nets with inhibitor arcs and a simple simulator of Queuing Nets.

PetriSim 3.1 had some bugs removed and it added more types of arcs. First the inhibitor arc was generalized. It has a weight now so it is possible to test whether a place has less than a certain number of tokens. Then it is possible to define a testing arc that just tests whether a place has at least a certain number of tokens.

PetriSim 4 is based on the same net model as the previous version, but there is more functionality in order to facilitate creation of user models. First there is a transparent collection and evaluation of statistics on: number of tokens in a places, time that a token spends in a place, firing duration of a transition. So if a place is used as a queue and if a transition is used as a server, all usual statistics on the G/G/1 model made of the place and the transition (including variances) is automatically available. There is a suite of procedures that support model initialization and experiment evaluation. User programming is thus reduced very much. If the user is satisfied with standard outputs, the only programming is writing the code snippets.

PetriSim 5 eliminates the need to write user code, at least for most models. All parameters of Timed Nets like random delays of firing, branching probabilities, etc. are entered directly in screen editing mode. So most simulation models do not need any Pascal programming. Of course things like state-dependent behavior have to be programmed. 

PetriSim also contains some supporting units with typical simulation facilities like automatic collection and evaluation of statistical data, generation of random numbers, and working with linked lists (queues). These units are supposed to be used when writing user code snippets, but their general use is possible.

Back to Top

Why PetriSim ?

PetriSim was created as a tool to support education of:

PetriSim 5 enables creation of discrete simulation models by creating a Timed Net on the screen. All you need is elementary knowledge of Petri Nets. In special cases intermediate Pascal programming is required. This makes discrete simulation available to almost everyone. The problem is that mastering of simulation languages can not be expected with students during one semester course or with people who do not simulate regularly. PetriSim is thus a free easy to use alternative to professional visual simulation tools like ArenaTM or ExtendTM.

Back to Top

What types of Petri Nets are supported ?

Directly Place/Transition Nets and in the "user mode" Timed Nets. User written procedures can modify the net's behavior, so it is possible to implement other high-level Petri Nets models. From PetriSim 3 onwards all these can be done in a clear consistent way as user defined methods of net objects. You can add data to each place to generalize tokens in any way. You can implement predicates to enable certain activities, etc.

Note that PetriSim uses Petri and Timed Nets as descriptive tools only ! It does not perform any automatic analysis on net models. All you can do (without creating a user model) is simulation in various modes to analyze the net's behavior and to search for deadlocks.
This has two reasons. First there are enough good tools that offer net analysis. Another reason is the fact, that a "perfect" Petri Net can model a totally wrong system from user's point of view. That's why PetriSim is oriented to simulation for which the Timed Net model is a way how to solve model timing and synchronization, the most demanding simulation tasks.

Back to Top

Download & Installation

PetriSim is free. You can use it in any way provided you inform the author about your PetriSim use - see the following e-mail reference. To get it just download the file (2 MB) and follow these instructions, where we assume installation in drive C:

 Back to Top


PetriSim is an MS DOS application that works practically on any PC compatible computer. Any mouse (or any other pointing device) driver that supports MS DOS mouse functions may be used. PetriSim also works without mouse but it is not recommended. PetriSim can be started without any problems in Windows 3.x/95/98/NT/Me/XP platforms.

To create models that contain user source code, you need Turbo or Borland Pascal 7 (older versions can not be used because PetriSim uses open array parameters). If you have Borland Pascal, use protected target to avoid any memory problems. With Turbo Pascal there is the problem of limited conventional memory. PETRISIM.EXE files are about 210KB (the exact length depends on the USER.PAS unit). Then there has to be some space for graphics, DOS Shell, and especially the text editor to edit user code snippets. In case of memory problems try to tune the heap size (in PETRISIM.PAS), remove all TSR's that you don't need, or use some short text editor (the demo examples use C:\WINDOWS\SYSTEM32\EDIT.COM). There are more details in README.TXT distributed with source files and in the manual.

Back to Top

Using old models

There should not be any problems with loading the net files created with older versions. It will be necessary to modify the unit USER because now it is much shorter, most user related declarations have been moved into the unit USERPART. Look at the unit USER of one of the demo models supplied with version 5. Generally you should be able to use the code snippets. From the old version of the unit USER, you can use the model evaluation part, but consider also using the standard evaluation that is now available in the version 5. If you had problems, contact the author for help.

Back to Top

Browse the PetriSim manual

Browse the On-line PetriSim 5 manual now.

Back to Top

Have a look at PetriSim screens

The PetriSim tour assumes that you know basic ideas of Petri Nets. So consider visiting this page first.

Start a PetriSim Tour that can be also used as a tutorial to create a simple user model in version 4. For version 5 you can just enter the Timed Net parameters and simulate the net to get standard outputs.

Back to Top

The Author

In case of any problems do not hesitate to contact me:

Jaroslav Sklenar
Associate Professor
Department of Statistics and Operations Research
University of Malta
Msida MSD 06


Phone: (+356) 2340 3070     Fax: (+356) 2131 2110

Back to Top

This page is translated to Bulgarian by Borisa Kovacevic.

This page is translated to Swedish by Weronika Pawlak.

This page is translated to Spanish by Rishi Aravinda.

This page is translated to Chinese by Austin Cole.

[ Home | University of Malta | Department of Statistics & OR ]