- +49 241 80 21906
- Send Email
CPN Tools uses the concept of colored Petri net models, in which their normal Petri net is enriched with different types of tokens (Cases) bonded with time and places. Important concepts are transitions, places, Color (specifying the type of the place, or the type of token that a place can receive, e.g., INT, Unit, String, …), functions (to generate numbers and actions in SML (standard machine language)).
Basically, you need this tool for simulating a process to either keep track of specific KPIs such as a number of serviced cases or generating an event log.
Currently, there are two versions of CPN Tools that can be installed. The official version is CPN Tools 4.0 and is available on the website. The major drawback of this version is a GUI straight out of hell in terms of handling and performance. Fortunately, a version with an improved modern GUI is under development. However, this version neither supports to include external SML files via “use file.sml” nor to create custom SML structures using the integrated SML editor.
To learn about the concepts of colored Petri nets and the syntax that is used to create colored Petri Nets in CPN Tools, a good resource is the book “Coloured Petri Nets. Modelling and Validation of Concurrent Systems” by Kurt Jensen and Lars M. Kristensen. If CPN Tools should be used for generating an event log, chapters 2-6 and 10 are interesting.
Getting started with custom functions
If you, at some point in time, want/have to write you own SML functions, I would strongly recommend a SML tutorial first. Moreover, I would recommend to install a dedicated SML interpreter, a very common one is the Standard ML of New Jersey interpreter, for testing and bug fixing. The major problem with CPN Tools is that its evaluation module for custom SML expressions works completely binary. It either accepts the statement, if it is correct, or fails without any hint about the error. Considering syntax errors, the output of the Standard ML of New Jersey interpreter is more helpful. Unfortunately, besides syntactical errors, bug fixing can be quite tedious as there is, as far as I know, no good debugging tool.
There are two approaches to use event data generated by CPN Tools. The first way is to use the ProM plugin “CPN Simulator” that can load a CPN model.
Be careful! Avoid duplicate place names.
The code requires a bit of hacking to generate both start and complete time stamps as well as capturing the concept of cases.
Unfortunately, this also does not support additional resource fields in addition to the activity name.
The second approach is more versatile as it resides in creating a csv file containing all the relevant events. To this end, while running the simulation of the coloured Petri net, each time a transition, which should be logged fires, this transition is responsible to append a line with the corresponding event information to the file. The event writing itself can be realized by the optional SML code block that can be attached to each transition. The common way to do this is, as each transition execution defines its own “closure”, to call a function that opens the log file, writes the event, and closes the file. The large I/O traffic that is caused by the constant opening and closing of files makes this method very inefficient. The example contains an implementation of the second method.
CPN tools for editing, simulating, and analysing coloured Petri nets (scientific paper)