spfs1

34
Petri Nets: Properties and Analysis Mikael Harkjær Møller [email protected] Department of Computer Science Aalborg University 23. september 2009 Based on: Tadao Murata. ”Petri Nets: Properties, Analysis and Applications.“ Proc. of the IEEE, 77(4), 1989.

Upload: maherkamel

Post on 15-Dec-2015

212 views

Category:

Documents


0 download

DESCRIPTION

Stochastic petri net

TRANSCRIPT

Petri Nets: Properties and Analysis

Mikael Harkjær Mø[email protected]

Department of Computer ScienceAalborg University

23. september 2009

Based on: Tadao Murata. ”Petri Nets: Properties, Analysis andApplications.“ Proc. of the IEEE, 77(4), 1989.

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Outline

1 Introduction

2 Definition and Example

3 Behavioral Properties

4 Analysis

2 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

IntroductionExample

Introduction to Petri nets

First presented by Carl Adam Petri in his dissertation (1962)

Petri nets are both a graphical and mathematical modelingtool.

Can model many different kinds of systems.

Capable of modeling, concurrency, nondeterminism andasynchronous system.

3 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

IntroductionExample

Example of simple Petri net

Directed graph and a marking.p1

p2

p3t1

Input places Transistions Output places

Precondition Event PostconditionInput data Computation Output data

4 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

IntroductionExample

Example of simple Petri net

Directed graph and a marking.p1

p2

p3t1

Input places Transistions Output places

Precondition Event PostconditionInput data Computation Output data

4 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

IntroductionExample

Example of simple Petri net

Directed graph and a marking.p1

p2

p3t1

Input places Transistions Output places

Precondition Event PostconditionInput data Computation Output data

22

4 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Definition: Petri Net

A Petri net is a 5-tuple, PN = (P,T ,F ,w ,M0) where,

P = {p1, p2, . . . , pm}, is a finite set of places.

T = {t1, t2, . . . , tn}, is a finite set of transitions.

F ⊆ (PxT ) ∪ (TxP), is a set of arcs (Flow relation).

w : F → N, is the weight function.

M0 : P → N0 is the initial marking.

P ∩ T = ∅ and P ∪ T 6= ∅.

5 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Firing rule

A transition t is enabled if each input place p has at leastw(p, t) tokens.

A transition may fire or not, there is no urgency in Petri nets.

Firing an enabled transition t, removes w(p, t) tokens fromeach input place p and adds w(t, p′) tokens at each outputplace p′.

6 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 1

Simple example showing the chemical reaction 2H2 + O2 → 2H2O.

H2

O2

H2Ot22

Transitions t is enabled.

7 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 1

Simple example showing the chemical reaction 2H2 + O2 → 2H2O.

H2

O2

H2Ot22

Transitions t has been fired.

7 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 2

Example of a Petri net representing a finite-state machine of acoffee machine.

0 kr.

1 kr.

2 kr.

Dep. 1kr

Dep. 2krDep. 1kr

Get Tea

Get Coffee

8 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 2

Example of a Petri net representing a finite-state machine of acoffee machine.

Decision

0 kr.

1 kr.

2 kr.

Dep. 1kr

Dep. 2krDep. 1kr

Get Tea

Get Coffee

8 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 3

Example of a Petrinet expressing concurrency.

p1

p2

p3

p4

p5

t1

t2

t3

t4

Par Begin Par End

Note: this net is a marked graph.

9 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 3

Example of a Petrinet expressing concurrency.

Concurrent

p1

p2

p3

p4

p5

t1

t2

t3

t4

Par Begin Par End

Note: this net is a marked graph.

9 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Petri NetTransition (Firing) ruleExamples

Example 3

Example of a Petrinet expressing concurrency.

Concurrent

p1

p2

p3

p4

p5

t1

t2

t3

t4

Par Begin Par End

Note: this net is a marked graph. 9 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Behavioral Properties

Reachability

Boundedness and Coverability

Liveness

10 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Reachability

A marking M is said to be reachable from M0 if there exists asequence of firings of transitions σ that transforms M0 to M.

This is denoted M0[σ〉M, where σ = t1t2 · · · tm.

The set of all reachable markings from M0 is written R(N,M0) orsimply R(M0).

The reachability problem is shown to be decidable, but inEXPTIME.

11 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Boundedness and Coverability

Boundedness

A Petri net (N,M0) is said to be k-bounded,if

M(p) ≤ k for all p ∈ P and M ∈ R(M0).

If a net is 1-bounded is said to be safe.

Coverability

A marking M is said to be coverable from M0 if there exists amarking M ′ ∈ R(M0) such that M(p) ≤ M ′(p) for all places p inthe net.

12 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Boundedness and Coverability

Boundedness

A Petri net (N,M0) is said to be k-bounded,if

M(p) ≤ k for all p ∈ P and M ∈ R(M0).

If a net is 1-bounded is said to be safe.

Coverability

A marking M is said to be coverable from M0 if there exists amarking M ′ ∈ R(M0) such that M(p) ≤ M ′(p) for all places p inthe net.

12 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Liveness

A Petri net is said to be live if it is deadlock-free. We definedifferent levels of liveness. A transition t is said to be:

Dead (L0-live) if t can never be fired.

L1-live if t can be fired at least once in some firing sequence.

L2-live if given any k ∈ N, then t can be fired at least k-timesin some firing sequence.

L3-live if t appears infinitely often in some firing sequence.

L4-live(live) if t is L1-live for every marking M ∈ R(M0).

A Petri net is said to be Lk-live if every t ∈ T is Lk-live, wherek ∈ {0, 1, 2, 3, 4}.

13 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

ReachabilityBoundedness and CoverabilityLiveness

Liveness

A Petri net is said to be live if it is deadlock-free. We definedifferent levels of liveness. A transition t is said to be:

Dead (L0-live) if t can never be fired.

L1-live if t can be fired at least once in some firing sequence.

L2-live if given any k ∈ N, then t can be fired at least k-timesin some firing sequence.

L3-live if t appears infinitely often in some firing sequence.

L4-live(live) if t is L1-live for every marking M ∈ R(M0).

A Petri net is said to be Lk-live if every t ∈ T is Lk-live, wherek ∈ {0, 1, 2, 3, 4}.

13 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Coverability tree (infinite)

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1}

t1

{1, 1, 0}

{0, 1, 1}

{0, 0, 1}

t2

t1

{1, 2, 0}

{0, 2, 1}

{0, 1, 1}

.

.

.

t2

t2

t1

.

.

.

t3

t3

t3

14 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Coverability tree (finite)

To keep the tree finite, we introduce the symbol ω. It can bethought of as ”infinity“, and has the properties for each integer n

ω > n, ω ± n = ω and ω ≤ ω.

Main idea

Whenever you reach a marking M, if there exists a marking M ′ onthe path from M0 to M such that M(p) ≥ M ′(p) for every placeand M 6= M ′, i.e. M’ is coverable, then replace M(p) with ω foreach p where M(p) > M ′(p).

15 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}new

t1 t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} new

t1 t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} new

t1

{1, ω, 0} new

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0} new

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0}

t1 t3

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0}

{0, ω, 1} new

t1

{1, ω, 0} new

t3

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0}

{0, ω, 1}

{0, ω, 1} new

t2

t1

{1, ω, 0} new

t3

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0}

{0, ω, 1}

{0, ω, 1} old

t2

t1

{1, ω, 0} new

t3

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Example

p1

p2

p3

t0t1

t3

t2

{1, 0, 0}

{0, 0, 1} dead-end

t1

{1, ω, 0}

{0, ω, 1}

{0, ω, 1} old

t2

t1

{1, ω, 0} old

t3

t3

16 / 18

IntroductionDefinition and Example

Behavioral PropertiesAnalysis

Coverability tree (infinite)Coverability tree (finite)ExampleProperties of Coverability tree

Properties of Coverability tree

Let T be a coverability tree for a Petri net (N,M0) then

The net is bounded and thus R(M0) is finite iff ω does notappear in node labels of T .

The net is safe iff only 1’s and 0’s appear in node labels of T .

A transition in N is dead iff it does not appear as an edgelabel in T .

M is reachable if there exists a node labeled M ′ such thatM ≤ M ′.

17 / 18

Thank you for your attention

Questions?

These slides are available athttp://www.cs.aau.dk/~mikaelhm/slides/spfs1.pdf