# Petri Net

Petri Net是对离散并行系统的数学表示，在1960年代由卡尔·亚当·佩特里发明的，适合于描述异步的、并发的计算机系统模型。Petri Net既有严格的数学表述方式，也有直观的图形表达方式。

由于Petri Net能表达并发的事件，被认为是自动化理论的一种。研究领域趋向认为Petri网是所有流程定义语言之母。

Like industry standards such as UML activity diagrams, BPMN and EPCs, Petri nets offer a graphical notation for stepwise processes that include choice, iteration, and concurrent execution. Unlike these standards, Petri nets have an exact mathematical definition of their execution semantics, with a well-developed mathematical theory for process analysis.

## 1. Petri Net Basics

A Petri net consists of places, transitions, and arcs.

**Arc**s run from a**Place**to a**Transition**or vice versa, never between places or between transitions;The places from which an arc runs to a transition are called the

**Input**places of the transition;the places to which arcs run from a transition are called the

**Output**places of the transition.

Graphically, places in a Petri net may contain a discrete number of marks called **Token**s. Any distribution of tokens over the places will represent a configuration of the net called a **Marking**. In an abstract sense relating to a Petri net diagram, a transition of a Petri net may fire if it is enabled, i.e. there are sufficient tokens in all of its input places; when the transition fires, it consumes the required input tokens, and creates tokens in its output places. A firing is atomic, i.e., a single non-interruptible step.

Unless an execution policy is defined, the execution of Petri nets is nondeterministic: when multiple transitions are enabled at the same time, any one of them may fire.

Since firing is nondeterministic, and multiple tokens may be present anywhere in the net (even in the same place), Petri nets are well suited for modeling the concurrent behavior of distributed systems.

## 2. Extensions

There are many extensions to Petri nets. Some of them are completely backwards-compatible (e.g. coloured Petri nets) with the original Petri net, some add properties that cannot be modelled in the original Petri net formalism (e.g. timed Petri nets). Although backwards-compatible models do not extend the computational power of Petri nets, they may have more succinct representations and may be more convenient for modeling. Extensions that cannot be transformed into Petri nets are sometimes very powerful, but usually lack the full range of mathematical tools available to analyse ordinary Petri nets.

### 2.1. Coloured Petri Nets

- CASE ID is an integer which is simply incremented for each generated process instance