You are on page 1of 10

Snoopy A Unifying Petri Net Tool

Monika Heiner, Mostafa Herajy, Fei Liu, Christian Rohr, and Martin Schwarick
Computer Science Institute, Brandenburg University of Technology Cottbus
Postbox 10 13 44, 03013 Cottbus, Germany
snoopy@informatik.tu-cottbus.de
http://www-dssz.informatik.tu-cottbus.de

Abstract. The tool Snoopy provides a unifying Petri net framework


which has particularly many application scenarios in systems and synthetic biology. The framework consists of two levels: uncoloured and
coloured. Each level comprises a family of related Petri net classes, sharing structure, but being specialized by their kinetic information. Petri
nets of all net classes within one level can be converted into each other,
while changing the level involves user-guided folding or automatic unfolding. Models can be hierarchically structured, allowing for the mastering
of larger networks. Snoopy supports the simultaneous use of several Petri
net classes; the graphical user interface adapts dynamically to the active
one. Built-in animation and simulation (depending on the net class) are
complemented by export to various analysis tools. Snoopy facilitates the
extension by new Petri net classes thanks to its generic design.
Keywords: hierarchical (coloured) qualitative/stochastic/continuous/
hybrid Petri nets, modelling, animation, simulation.

Overview

Petri nets may easily serve as a convenient umbrella formalism integrating qualitative and quantitative (i.e. stochastic, continuous, or hybrid) modelling and
analysis techniques. Thus Petri nets are immediately ready to address distinctive
modelling demands in systems and synthetic biology, which particularly include
the dealing with biochemical reaction networks in several modelling paradigms.
Motivated by this application scenario, Snoopy is set up as a unifying Petri
net framework (see Fig. 1) which can be divided into two levels: uncoloured
[11] and coloured [17]. Each level comprises a family of related Petri net models,
sharing structure, but being specialized by their kinetic information. Specifically,
the uncoloured level contains qualitative (time-free) Place/Transition Petri nets
(QPN ) as well as quantitative (time-dependent) Petri nets such as stochastic
Petri nets (SPN ), continuous Petri nets (CPN ), and generalised hybrid Petri
nets (GHPN ). The coloured level provides coloured counterparts of the uncoloured level, and thus consists of coloured qualitative Petri nets (QPN C ),
coloured stochastic Petri nets (SPN C ), coloured continuous Petri nets (CPN C )
and coloured generalised hybrid Petri nets (GHPN C ).
S. Haddad and L. Pomello (Eds.): PETRI NETS 2012, LNCS 7347, pp. 398407, 2012.
c Springer-Verlag Berlin Heidelberg 2012
!

Snoopy A Unifying Petri Net Tool

399

discrete state space


QPN

continuous state space

molecules/levels
LTS, PO
CTL/LTL
QPN

time-free
timed,
quantitative
molecules/levels
stochastic rates
CTMC
CSL/PLTLc

SPN C

CPN C

SPN

folding

CPN

concentrations
deterministic rates
ODEs
LTLc

GHPN C

unfolding
abstraction
extension
approximation

GHPN

molecules and concentrations


stochastic and deterministic rates
CTMC coupled by Markov jumps
PLTLc

Fig. 1. Paradigms integrated in Snoopys unifying framework

Petri nets of these net classes can be converted into each other. Obviously,
there may be a loss of information in some directions (cf. arrows labelled with
abstraction in Fig. 1). The conversion between coloured and uncoloured net
classes is accomplished by means of user-guided folding or automatic unfolding
(cf. arrows labelled with folding and unfolding in Fig. 1). Moving between the
coloured and uncoloured level changes the style of representation, but does not
change the actual net structure of the underlying reaction network. Therefore, all
analysis techniques available for uncoloured Petri nets can be applied to coloured
Petri nets as well.
Snoopy supports the simultaneous use of different net classes, which provides
the grounds to investigate one and the same case study with different modelling
abstractions in various complementary ways [10], [11], [17].

Basic Functionalities

Snoopy offers for its net classes a graphical, unified modelling environment. See
Fig. 2 for a snapshot of the user interface with a famous textbook example, the
prey predator system. The user interface mainly consists of:
graphical elements window (the top left tree control): listing all graphical
elements, e.g. node elements and edge elements,
hierarchy window (the middle left tree control): showing the model hierarchy,

400

M. Heiner et al.

declarations window (the bottom left tree control): containing all declarations, e.g. colour sets, constants, and variables for coloured Petri nets,
drawing canvas (the right window): drawing and showing models.

Fig. 2. User modelling interface

Basic modelling functions provided by Snoopy include:


define declarations (only for coloured Petri nets),
add graphical elements, i.e. places and transitions, from the graphical elements window to the canvas and connect them using edges,
edit or modify properties of nodes (e.g. name, initial marking) and edges
(multiplicity) in their property dialogues.
Snoopy supplies two features for the design and systematic construction of larger
Petri nets. Logical nodes (places/transitions) serve as connectors, and coarse
transitions (coarse places) help to hide transition-bordered (place-bordered) subnets in order to design hierarchically structured nets.
Further features consistently available for all Petri net classes include: editing
(cut, copy, paste), colouring of individual net elements and of computed node
sets (e.g. support of place/transition invariants, siphons, traps, Parikh vectors),
layouting (mirror, flip, rotate, and automatic layouting using OGDF [5]), graphical export to eps, Xfig and FrameMaker (selected net classes), and print.
Additionally, Snoopy offers execution capabilities for each net class, see next
section for details.

Snoopy A Unifying Petri Net Tool

401

Net Class Specific Functionalities

3.1

Overview

The hierarchy of the Petri net classes supported by Snoopy is given in Fig. 3.

Netclass
+ name

QPN

+ discrete places
+ discrete transitions
+ standard edges

+
+
+
+

SPN
immediate transitions
deterministic transitions
scheduled transitions
modifier edges

SPN C
+ color declarations

+
+
+
+

X PN
read edges
inhibitor edges
equal edges
reset edges

X PN C
+ color declarations

QPN C

+ color declarations

+
+
+
+
+
+

+
+
+
+
+
+

CPN
continuous places
continuous transtions
standard edges
read edges
inhibitor edges
modifier edges

GHPN

continuous places
continuous transitions
immediate transitions
deterministic transitions
scheduled transitions
modifier edges

CPN C
+ color declarations

GHPN C

+ color declarations

Fig. 3. Snoopys class hierarchy

Qualitative Petri nets (QPN ). QPN contain standard Place/Transition nets


(P/T nets) and extended Petri nets (X PN ). They do not involve any timing
aspects; so they allow a purely qualitative modelling of, e.g., biomolecular networks. Tokens may represent molecules or abstract concentration levels [11].
X PN enhance standard Petri nets by four special edge types: read edges (often
also called test edges), inhibitor edges, equal edges, and reset edges, see [13], [22]
for details.
Stochastic Petri nets (SPN ). This net class extends QPN by assigning to
transitions exponentially distributed waiting times, specified by firing rate functions. A rate function is generally state-dependent; it can be an arbitrary arithmetic function deploying the pre-places of a transition as integer variables and
user-defined, real-valued constants (often called parameters). Pre-places can be
associated with transitions by special modifier edges [22]. They may modify
the transitions firing rate, but do not have an influence on the transitions
enabledness.
Popular kinetics, e.g. mass-action semantics, level semantics [11], are supported by pre-defined function patterns. Each transition gets its own rate function, making up together a list of rate functions. Moreover, several rate functions
lists and parameter lists as well as multiple initial markings can be maintained,

402

M. Heiner et al.

allowing for quite flexible models and their systematic evaluation by series of
related computational experiments.
SPN have been extended to generalised stochastic Petri nets (GSPN ) and
deterministic and stochastic Petri nets (DSPN ). In our extended stochastic Petri
nets (X SPN )[12], there are the four special edge types as for QPN , and three
special transition types: immediate transitions (zero waiting time), deterministic
transitions (deterministic waiting time, relative to the time point where the
transition gets enabled), and scheduled transitions (scheduled to fire, if any, at
single or equidistant, absolute points of the simulation time). The unrestricted
use of these extended features destroys the Markov property, but the adaptation
of the simulation algorithms is rather straightforward.
To simplify our life, Snoopy does not distinguish between these stochastic net
classes. Thus, Snoopys SPN net class is actually X SPN ; see Figure 3.
Continuous Petri nets (CPN ). Continuous Petri nets offer a graphical way to
specify unambiguously systems of ordinary differential equations (ODEs) [10].
The real-valued tokens may denote concentrations. The continuous rate functions have to obey similar rules as for SPN . Likewise, the concepts of function
lists, parameter lists and initial marking lists are also applied to CPN . Snoopy
generates automatically the underlying system of ODEs. CPN and SPN provide
an approximation of each other as it is depicted in Fig. 1.
Generalised hybrid Petri nets (GHPN ). Snoopy integrates all functionalities of
its stochastic and continuous Petri nets into one net class, yielding generalised
hybrid Petri nets [14]. GHPN are specifically tailored (but not limited) to models that require an interplay between stochastic and continuous behaviour. They
provide a trade-off between accuracy and runtime of model simulation by adjusting the number of stochastic transitions appropriately, which can be done
either statically (by the user) or dynamically (by the simulation algorithms). A
typical application of GHPN is the hybrid representation of stiff biochemical
reactions, where slow reactions are represented by stochastic transitions while
fast reactions are modelled by continuous transitions.
Coloured extensions. Each uncoloured net class has a coloured counterpart [17]
which inherits all features of its corresponding uncoloured net class, e.g., SPN C
enjoy all special edge types and transition types of SPN .
Snoopy provides various flexible ways to define declarations to be used in the
annotations of coloured Petri nets. Data types for colour set definitions include:
(1) simple types: dot, integer, string, boolean, enumeration and index, and (2)
compound types: product and union. Variables, constants and functions can be
defined to specify arc expressions, guards, and markings. By defining hierarchical
colour sets using the product type, one can conveniently model a (biological)
system evolving in multi-dimensional, e.g. 2- or 3-dimensional space [8]. Concise
initial marking specifications for larger colour sets and individual rate function
definitions for each transition instance are supported. Syntax checking ensures
the syntactical correctness of constructed models.

Snoopy A Unifying Petri Net Tool

3.2

403

Executability

Animation. Snoopy offers built-in animation for QPN , SPN , QPN C and SPN C ,
see Fig. 2 for a snapshot of the animation of a SPN C model. Animation visualizes the token flow, which may give first insights in the behaviour and may
help to better understand the inherent causality of the model. Animation can
be triggered manually or be done in automatic mode with different firing strategies (single/intermediate/maximal step). Snoopy supports a similar animation
within a standard web browser for QPN ; see Snoopys website for a sampler.
Stochastic simulation. The underlying core semantics of SPN and SPN C are
continuous time Markov chains (CTMC); so the simulation follows the standard
Gillespie algorithm [9] enhanced by deterministic events of X SPN . Simulation
results are available as tables and can be visualized in diagrams, showing the
evolution over time of the token numbers on selected places or the firing rates
of selected transitions.
Simulation traces can be checked on-the fly for reachability of certain states
specified by logical expressions over places. Additionally, simulation traces can
be exported as averaged/single/exact traces, to be, e.g., evaluated by simulative
model checking of PLTLc with the Monte Carlo Model Checker MC2 [4].
Continuous simulation. Snoopy provides 14 stiff/unstiff solvers for the numerical
integration of CPN and CPN C . These ODE solvers range from simple fixed-stepsize unstiff solvers (e.g. Euler) to more sophisticated variable-order, variable-step,
multi-step stiff solvers (e.g Backward Differentiation Formulas (BDFs)). In the
latter case, we use SUNDIALS CVODE [15] to solve the underlying ODEs. Deterministic simulation traces are available as tables, can be visualized in diagrams,
and written to files to be, e.g., checked against LTLc properties with MC2, see,
e.g., [11].
Hybrid simulation. The simulation of GHPN can be carried out using either
static or dynamic partitioning. In the former case, transition types are decided
off-line by the user before the simulation starts, while in the latter case, the running simulation decides on-the-fly which transitions are considered as stochastic
or continuous ones based on their current rates. In both cases, continuous transitions are simulated using an ODE solver with event detection, while stochastic
transitions are simulated using Gillespies direct method.
Moreover, the user can choose to simulate a net completely as stochastic or
continuous one despite of the original place and transition types. Then transitions and places are automatically converted to the required type. This functionality gives the opportunity to experiment with different simulation algorithms
without having to change the net. For instance, if the users Petri net model
is drawn to contain only stochastic transitions, later on, it could be simulated
using stochastic (e.g. Gillespie) or continuous (e.g. BDFs) algorithms. In the
latter case, stochastic transitions will be converted into continuous ones, while
transitions of other types (immediate, deterministic, or scheduled) will remain
unchanged.

404

M. Heiner et al.

Coloured extensions. Snoopy supports animation for QPN C and SPN C , which
can be run in automatic mode or manually controlled, e.g. with single-step animation by manually choosing a binding.
Simulation of coloured Petri nets (SPN C , CPN C , GHPN C ) is done on automatically unfolded Petri nets, and thus all simulation algorithms for uncoloured
Petri nets are available for coloured Petri nets as well. In order to improve efficiency, the unfolding adopts a constraint satisfaction approach, which is implemented using the Gecode library [2]. Simulation results of coloured or uncoloured
places/transitions can be shown separately or together. In-depth behaviour exploration is supported by auxiliary variables (observers) which depend on coloured
places, allowing for extra measures, e.g. the sum of a group of related places.
3.3

Import/Export

All net classes can be converted into each other through export, which permits to
easily switch from one net class to another one and thus to investigate a system
under study with different modelling abstractions by deploying simultaneously
several Petri net classes.
Additionally, there is export to numerous external analysis tools, among them
Snoopys close friends Charlie [24] and Marcie [23] ; see Snoopys website for a
complete list. Charlies features for P/T nets include structural analysis, P/T
invariants computation, and explicit CTL/LTL model checking. Marcie supports
qualitative analysis and symbolic CTL model checking based on Interval Decision
Diagrams. It also allows a quantitative investigation of SPN by means of CSL
and PLTLc model checking based on numerical and simulative analysis engines.
A crucial point for the addressed main application area is Snoopys import and
export of the standard exchange format SBML, Level 2, Version 3 [7]. The Petri
Net Markup Language [21] is not yet supported, but shortlisted for future plans.
Complementary, we developed the Colored Abstract Net Definition Language
(CANDL) [18] as a human-readable exchange format for our own toolbox.
The ODEs induced by a given CPN or GHPN can be written in Latex format
and as plain ASCII text.

Architecture

Snoopys architecture has been designed to gain three distinguished characteristics. (1) It is extensible; its generic design facilitates the implementation of new
Petri net classes. (2) It is adaptive by supporting the simultaneous use of several
models, with the graphical user interface adapting dynamically to the net class
in the active window. (3) It is platform-independent.
Snoopy is written in the programming language C++ using the Standard
Template Library and the cross-platform toolkit wxWidgets [6]. The main object
in the data structure, see Fig. 4, is the graph object which contains modification
methods and holds the associated node, edge and metadata classes. Every node
class has one prototype and contains a number of nodes that are copied from

Snoopy A Unifying Petri Net Tool


0..*

0..*

0..*
1
edge

nodeclass
0..*

1
node

1
prototype

edgeclass

prototype

prototype

0..*

graph

metadataclass
0..*

1
attribute

edge

node
0..*

0..*
1
1

metadata

0..*
0..*

405

0..*

graphic

0..*

0..1
0..*

attribute

(a)

attribute

1
1

metadata

(b)

0..*
widget

(c)

Fig. 4. (a) Internal data structure of Snoopy. (b) Graphics assigned to the graph elements. (c) Attributes connected with window interactions controls.

this prototype. The edge and metadata class are similarly structured, compare
Fig. 4a. Every node, edge and metadata can have a list of attributes defining
the properties of the graph elements. A graphics is assigned to every displayed
element, see Fig. 4b. Attributes of graph elements may be manipulated with
widgets as it is shown in Fig. 4c.
The object-oriented design uses several design patterns (Model View Controller, Prototype, and Builder), thus special requirements may be added easily.
Due to a strict separation of internal data structures and graphical representation it is straightforward to extend Snoopy by a new graph class; see [13] for
a demonstration how to do it. Fig. 3 gives the hierarchy of net classes which
Snoopy currently supports.

Applications

Snoopy is in worldwide use for teaching (see, e.g., [16], [20]) and research (see,
e.g., [8], [10], [11], [12], [14]); see Snoopys website for more references. In the
last year, Snoopy has been downloaded about 1,400 times.
Snoopys coloured Petri nets have been applied to investigate a variety of largescale biological systems, proving its capability to solve many challenges imposed
by biological multi-scale modelling, e.g. repetition, variant, and organization of
cells [17]. Case studies deploying coloured Petri nets usually require stochastic
and/or continuous simulations over very large underlying uncoloured Petri nets;
for specific case studies and related figures see [8].

Comparison with Other Tools

There is no tool on the market which supports a comparable family of Petri


nets classes as Snoopy does. Usually, modelling tools confine themselves to a
few net classes. Contrary, Snoopy provides a set of related net classes: time-free,
stochastic, continuous, hybrid and their coloured extensions, as well as plenty
of analysis techniques, e.g. built-in animation/simulation and export to external
analysis tools. This provides an excellent approach to accomplish the analysis of
a (biological) system from different perspectives by relating all these net classes.

406

M. Heiner et al.

Herein, we compare Snoopy with three popular tools providing similar functionalities for selected net classes: CPN Tools, GreatSPN, and Cell Illustrator.
CPN Tools [1] are tailored to coloured (timed) Petri nets. They established
a landmark in modelling convenience. Their concept of fusion places inspired
Snoopys logical nodes, and the hierarchical organization of substitution transitions triggered Snoopys coarse nodes. However, there are no special arcs, and
CPN Tools do not explicitly support any of the quantitative net classes, which
are mandatory for systems and synthetic biology, such as continuous, stochastic
or hybrid Petri nets.
GreatSPN [3] supports modelling and analysis of GSPN and a coloured extension, but no other net classes. There are neither logical nodes nor hierarchy,
but an interesting layer concept.
Cell Illustrator [19] is a commercially licensed software tool utilising Hybrid
Functional Petri Nets with extensions (HFPNe) to model and simulate biochemical pathways. While Cell Illustrator combines discrete and continuous parts in
one model, it does not offer the full interplay between continuous and stochastic
transitions as it is given in Snoopy. Crucial features such as modifier edges and
immediate or scheduled transitions are not supported. A model can only be simulated using static partitioning. Advanced modelling features like logical nodes,
hierarchy, or colour which are imperative when considering large scale models
or models with repeated components are not provided.
In summary, Snoopys rich modelling capabilities make it competitive and
particularly well suited for scenarios suggesting the simultaneous and consistent
use of several modelling paradigms enabling different modelling abstractions.

Installation

Snoopy is available for Windows, Mac OS X and Linux. It can be obtained free
of charge for academic use from its website http://www-dssz.informatik.
tu-cottbus.de/snoopy.html. Installation packages contain all dependencies;
no other libraries need to be manually installed. See Snoopys website for more
information how to install and use it on different platforms, for Petri net examples in Snoopys proprietary file format, and for Snoopys bibliography.
Snoopy comes with several further Petri net classes, including time(d) Petri
nets and modulo Petri nets, as well as a couple of other graph types; see [13].
Snoopy is still evolving we are open for suggestions.
Acknowledgement. Substantial contributions to Snoopys development have
been done by former staff members and numerous student projects at Brandenburg University of Technology, chair Data Structures and Software Dependability.

References
1. CPN Tools website, http://cpntools.org/ (accessed: March 30, 2012)
2. Gecode website, http://www.gecode.org/ (accessed: March 30, 2012)

Snoopy A Unifying Petri Net Tool

407

3. GreatSPN website, http://www.di.unito.it/~ greatspn/index.html (accessed:


March 30, 2012)
4. MC2 website, http://www.brc.dcs.gla.ac.uk/software/mc2
(accessed: March 30, 2012)
5. OGDF - Open graph drawing framework website,
http://www.ogdf.net/doku.php/start (accessed: March 30, 2012)
6. Wxwidgets website, http://www.wxwidgets.org (accessed: March 30, 2012)
7. Bornstein, B.J., Keating, S.M., Jouraku, A., Hucka, M.: LibSBML: an API library
for SBML. Bioinformatics 24(6) (2008)
8. Gilbert, D., Heiner, M.: Petri nets for multiscale Systems Biology. Brunel University, Uxbridge/London (2011), http://multiscalepn.brunel.ac.uk/
9. Gillespie, D.T.: Exact stochastic simulation of coupled chemical reactions. Journal
of Physical Chemistry 81(25), 23402361 (1977)
10. Heiner, M., Gilbert, D.: How Might Petri Nets Enhance Your Systems Biology
Toolkit. In: Kristensen, L.M., Petrucci, L. (eds.) PETRI NETS 2011. LNCS,
vol. 6709, pp. 1737. Springer, Heidelberg (2011)
11. Heiner, M., Gilbert, D., Donaldson, R.: Petri Nets for Systems and Synthetic Biology. In: Bernardo, M., Degano, P., Zavattaro, G. (eds.) SFM 2008. LNCS, vol. 5016,
pp. 215264. Springer, Heidelberg (2008)
12. Heiner, M., Lehrack, S., Gilbert, D., Marwan, W.: Extended Stochastic Petri Nets
for Model-Based Design of Wetlab Experiments. In: Priami, C., Back, R.-J., Petre, I. (eds.) Transactions on Computational Systems Biology XI. LNCS (LNBI),
vol. 5750, pp. 138163. Springer, Heidelberg (2009)
13. Heiner, M., Richter, R., Schwarick, M., Rohr, C.: Snoopy-a tool to design and
execute graph-based formalisms. Petri Net Newsletter 74, 822 (2008)
14. Herajy, M., Heiner, M.: Hybrid representation and simulation of stiff biochemical
networks through generalised hybrid Petri nets. Tech. Rep. 0211, BTU Cottbus,
Computer Science Institute (2011)
15. Hindmarsh, A., Brown, P., Grant, K., Lee, S., Serban, R., Shumaker, D., Woodward, C.: Sundials: Suite of nonlinear and differential/algebraic equation solvers.
ACM Trans. Math. Softw. 31, 363396 (2005)
16. Kafura, D., Tatar, D.: Initial experience with a computational thinking course for
computer science students. In: Proc. SIGCSE 2011, pp. 251256. ACM (2011)
17. Liu, F.: Colored Petri Nets for Systems Biology. Ph.D. thesis, BTU Cottbus, Computer Science Institute (January 2012)
18. Liu, F., Heiner, M., Rohr, C.: Manual for Colored Petri Nets in Snoopy. Tech. Rep.
0212, BTU Cottbus, Computer Science Institute (March 2012)
19. Nagasaki, M., Saito, A., Jeong, E., Li, C., Kojima, K., Ikeda, E., Miyano, S.: Cell
Illustrator 4.0: a Comp. Platform for Systems Biology. Silico Biology 10 (2010)
20. Petre, I.: Introduction to Computational and Systems Biology, Collection of Modelling Reports,
Abo Akademi, Department of IT (2011)
21. Petri Net Markup Language (PNML): Systems and software engineering Highlevel Petri nets Part 2: Transfer format, ISO/IEC 159092:2011 (2009)
22. Rohr, C., Marwan, W., Heiner, M.: Snoopy - a unifying Petri net framework to
investigate biomolecular networks. Bioinformatics 26(7), 974975 (2010)
23. Schwarick, M., Rohr, C., Heiner, M.: MARCIE - Model checking And Reachability
analysis done effiCIEntly. In: Proc. QEST 2011. pp. 91100 (2011)
24. Wegener, J., Schwarick, M., Heiner, M.: A Plugin System for Charlie. In: Proc.
CS&P 2011, pp. 531554. Bia#lystok University of Technology (2011)

You might also like