This post has 683 words. Reading it will take approximately 3 minutes.
CPN Tools is usually known for modeling with colored Petri nets. Colored Petri nets augment standard place-transition Petri nets (PT-nets) with data types, and as such are a real extension that can easily embed PT-nets. PT-nets come with a couple extensions that are crucial for this lower-level formalism, but which can be emulated in colored nets without extensions. Often, it is easier to use the lower-level formalism, however, so CPN Tools 4 adds support for much simpler use of PT-nets. Everything shown here works with CPN Tools 3.9.3 and never – get your copy here.
PT-nets Then and Now
In previous versions of CPN Tools, users had to do a lot of book-keeping to work with PT-nets. They basically had to assign the type UNIT to all places and add an inscription () to all arcs. A simple PT-net model could look like this:
The model has a lot of visual crud, and even worse, adding all those inscriptions takes a lot of time for just constructing a simple model illustrating some simple idea.
CPN Tools 4 assumes that any place with no explicit type has type UNIT and any arc without an inscription has the inscription (). Furthermore, it allows us to just write, say, 2 for 2`() on all arcs connecting to UNIT places and all initial markings of UNIT places. This means, the same model in CPN Tools 4 looks like this:
This is no doubt much cleaner and easier to look at. Most arc inscriptions are gone as are all place types.
Backwards and Forwards Compatiblity
We notice that the model in CPN Tools 4 above is not neatly aligned to the grid, which is strange for a CPN Tools 4 model. This is because the model is actually imported directly from CPN Tools 3.4. CPN Tools 4 reads any CPN Tools 3.4 model and automatically simplifies it if possible.
CPN Tools 4 allows us to change the model without adding any annotations to arcs, except to indicate if more than one token should be consumed. Relayouting and making small visual and semantical changes, we obtain:
Now, the big advantage is that CPN Tools 4 saves the files so that CPN Tools 3.4 can import them; doing so leads to this:
We see that both semantical and syntactical changes have been carried over. CPN Tools 4 can exchange models with previous versions as long as only features available in earlier versions are used.
Reset and Inhibitor Arcs
It has been possible to use design patterns to emulate the behavior of reset and inhibitor arcs (e.g., ). This is a bit cumbersome, but perfectly fine for colored nets. It is not possible to use these constructs for pure PT-nets, however.
For convenience and to allow modeling using patterns well-known to modelers familiar with PT-nets, CPN Tools 4 adds support for reset and inhibitor arcs. These are used exactly like regular arcs:
Now, due to the inhibitor arc, the model is forced to take the upper path first. As soon as the lower path is chosen, all tokens from the initial place are removed (if there are any).
While CPN Tools is arguably the only tool supporting the particular kind of colored nets used in the tool, there are many tools supporting PT-nets. To communicate with those, CPN Tools now supports exporting PT-net models to PNML. Simply change the file type to PNML in the save dialog:
This results in a PNML file, which can be imported into any PNML compliant tool, here ProM:
We see that style and semantics have been carried over (ProM shows the initial marking in very small letters and arc weights not at all).
Mix and Match
As PT-net support is purely syntactical, we can easily mix and match between PT-nets and CP-nets in the same model. For example, we could make a PT-net control flow model manipulating data as here:
For a quick video introduction to PT-nets in CPN Tools 4, you can watch this video (it’s using an older pre-release of CPN Tools, but otherwise everything is the same):
Inhibitor and reset arcs are demonstrated here:
PNML export can be seen here (1:30 after the start of the video):
Time person of the year 2006, Nobel Peace Prize winner 2012.