The definition of a petri net is basically a bipartite graph, the first partition are nodes called places while the second are transitions. There are only direct edges from places to transitions and from transitions to places. A finite integer non negative number of tokens can be placed in every place, and firing rules move tokens around places trough transitions. Building a simulator in Java does not seam too hard to me, you can start with Place and Transition classes, then the main class will contain a set of Place and a set of Transition and something that describes how they are connected, but you have to deal with nondeterminism, that is, which transition rules will a chose among all the enabled rules? That depends on what you want to do with this kind of nets.
we use an extended petri net that we proposed to represent agent and multi-agent plans (see : Hierarchical Multi-Agent Plans Using Model-Based Petri Net)
One of the attractive techniques which can be used is Model Driven Architecture using the GMF (Graphical Modelling Framework) under Eclipse. This GMF allows the programmer to build, speedily, a simple editor. However, implementing simulation and verification processes is a little bit.
Currently, I supervise students in this work and they find the xmof packages that can be used to implement the simulation of PNs.
briefly, with GMF you will have an editor in few minutes, then you need some more days (or months) to add simulation and verification procedures.
As said Gilbert there are a lot of existing tools accessible at the given url ; the large number of tools shows the large number of Petri Nets variety and the large kinds of usage that this formalism provides.
The Petri net simulator can be made as a trial run using a free open source - WOPED. it has all built in properties of petri nets. just draw and connect your tokens in petri nets to find amazing results.
Consider “making a simulation of a petri net” to be the same as “writing a computer program using petri nets”. To use petri nets for writing a computer program is to organize a computer program using Petri Net elements and annotations. To create this organization, first establish the relations of computations in terms of places, transitions, inputs and outputs. Second create annotations of places, transitions, inputs and outputs for the computations.
An Example
Consider making a simulation of a countdown timer. The countdown timer begins from a specified value (say, 10). Using some interval, the timer value decreases by one. When the timer value reaches zero, the countdown ends.
This computation may be modeled in terms of a place, an input and a transition. The place has a mark annotation, a value that represents the timer value – the place is the timer. The input has a “fire” annotation, a computation that deducts one from the input place mark annotation. The input also has a status annotation, a ‘true’ value means the computation may proceed and a ‘false’ value means that the computation should not proceed. The input has an “is enabled” annotation, a computation that determines the value of the status annotation – in this case, if the mark annotation of the input place is greater than zero, the status annotation of the input is ‘true’ and ‘false’ otherwise. The transition has “fire” annotation, a computation that delegates the “fire” computation by “firing” its input. The transition has an annotation status, a true value means that the value of its input status annotation is ‘true’ and ‘false’ otherwise. Consider too visual annotations of the net elements: a circle for the place, a square for the transition and an arrow from the circle to the square for the transition, and dots for the mark annotations of places – empty for 0 mark, one black dot for 1 mark, two black dots for 2 marks, etc. [The types of annotations considered so far are those found on Place/Transition nets, a kind of Petri Net.]
To make the “simulation” interactive, consider an event annotation for the transition, a computation that delegates a user event (such as a mouse up event) to “fire” the transition. Furthermore, consider a visual annotation for the status of the transition – green if the status annotation is true and empty otherwise.
Based on this example, I created an interactive “simulation” of this system in PDF. Graphics were created using PowerPoint and exported as PDF. Computation logic was implemented as JavaScript programs. And interactions were integrated with the computation logic using the Acrobat/JavaScript API. [See link attached to this reply].
A Reference
For petri nets with many net elements and annotations, several other issues (such as naming conventions, high-level graphics conventions, and software engineering workflow processes) must be addressed. Here is a research paper related to this topic – Net Elements and Annotations: Computations and Interactions in PDF. [See link attached to this reply].