Introduction to Petri Nets (PNs)

Slides:



Advertisements
Similar presentations
School of Computer Science & Software Engineering
Advertisements

Eager Markov Chains Parosh Aziz Abdulla Noomene Ben Henda Richard Mayr Sven Sandberg TexPoint fonts used in EMF. Read the TexPoint manual before you delete.
On 1-soundness and Soundness of Workflow Nets Lu Ping, Hu Hao and Lü Jian Department of Computer Science Nanjing University
Techniques to analyze workflows (design-time)
1 SE-561 Formal Methods in Software Petri Nets - I.
Knowledge Based Synthesis of Control for Distributed Systems Doron Peled.
An Introduction to Petri Nets
Introduction to Petri Nets Hugo Andrés López
A university for the world real R © 2009, Chapter 3 Advanced Synchronization Moe Wynn Wil van der Aalst Arthur ter Hofstede.
Automatic Verification Book: Chapter 6. What is verification? Traditionally, verification means proof of correctness automatic: model checking deductive:
Petri Nets Section 2 Roohollah Abdipur.
Based on: Petri Nets and Industrial Applications: A Tutorial
PROTOCOL VERIFICATION & PROTOCOL VALIDATION. Protocol Verification Communication Protocols should be checked for correctness, robustness and performance,
Timed Automata.
26 September 2003U. Buy -- SEES 2003 Sidestepping verification complexity with supervisory control Ugo Buy Department of Computer Science Houshang Darabi.
A Novel Method For Fast Model Checking Project Report.
Chapter 3 Petri nets Learning objectives : Introduce Petri nets
Merged Processes of Petri nets Victor Khomenko Joint work with Alex Kondratyev, Maciej Koutny and Walter Vogler.
IE 469 Manufacturing Systems
Lei Bu Petri Nets 11 Dining Philosphier 4 States , 5 transitions.
Petri net modeling of biological networks Claudine Chaouiya.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
Petri Nets Overview 1 Definition of Petri Net C = ( P, T, I, O) Places P = { p 1, p 2, p 3, …, p n } Transitions T = { t 1, t 2, t 3, …, t n } Input.
Using Interfaces to Analyze Compositionality Haiyang Zheng and Rachel Zhou EE290N Class Project Presentation Dec. 10, 2004.
A Schedulability-Preserving Transformation of BDF to Petri Nets Cong Liu EECS 290n Class Project December 10, 2004.
1 Petri Nets H Plan: –Introduce basics of Petri Net models –Define notation and terminology used –Show examples of Petri Net models u Calaway Park model.
FunState – An Internal Design Representation for Codesign A model that enables representations of different types of system components. Mixture of functional.
1 Quasi-Static Scheduling of Embedded Software Using Free-Choice Petri Nets Marco Sgroi, Alberto Sangiovanni-Vincentelli Luciano Lavagno University of.
Models of Computation for Embedded System Design Alvise Bonivento.
1 Petri Nets Marco Sgroi EE249 - Fall 2002.
1 Petri Nets Marco Sgroi EE249 - Fall 2001 Most slides borrowed from Luciano Lavagno’s lecture ee249 (1998)
Mata kuliah :K0362/ Matematika Diskrit Tahun :2008
Petri Nets An Overview IE 680 Presentation April 30, 2007 Renata Kopach- Konrad.
PETRINETS Nipun Devlekar Zauja Lahtau. PETRINETS DEFINITION : DEFINITION :  PETRINET (place/ transition net): a formal, graphical, executable technique.
Lecture #12 Distributed Algorithms (I) CS492 Special Topics in Computer Science: Distributed Algorithms and Systems.
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
Benjamin Gamble. What is Time?  Can mean many different things to a computer Dynamic Equation Variable System State 2.
Modeling with ordinary Petri Nets Events: Actions that take place in the system The occurrence of these events is controlled by the state of the system.
CY2003 Computer Systems Lecture 7 Petri net. © LJMU, 2004CY2003- Week 72 Overview Petri net –concepts –Petri net representation –Firing a transition –Marks.
- 1 -  P. Marwedel, Univ. Dortmund, Informatik 12, 05/06 Universität Dortmund Petri nets Introduced in 1962 by Carl Adam Petri in his PhD thesis. Focus.
Generalized stochastic Petri nets (GSPN)
Hardware Design and The Petri Net Abhijit K. Deb SAM, LECS, IMIT, KTH Kista, Stockholm.
Petri Nets Lecturer: Roohollah Abdipour. Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2.
CAP 4800/CAP 5805: Computer Simulation Concepts
Modelling by Petri nets
CSCI1600: Embedded and Real Time Software Lecture 11: Modeling IV: Concurrency Steven Reiss, Fall 2015.
School of Computer Science & Software Engineering
CAP 4800/CAP 5805: Computer Simulation Concepts
1 Petri Nets Ina Koch and Monika Heiner. 2 Petri Nets(1962) Carl Adam Petri.
High Performance Embedded Computing © 2007 Elsevier Lecture 4: Models of Computation Embedded Computing Systems Mikko Lipasti, adapted from M. Schulte.
Petri-Nets and Other Models
Week 8 Computational Level
Polynomial analysis algorithms for free-choice workflow nets
Advantages of FSM Their simplicity make it easy for inexperienced developers to implement with little to no extra knowledge (low entry level)
CPE555A: Real-Time Embedded Systems
Dr. Eng Amr T. Abdel-Hamid
Clockless Computing COMP
Week 8 Computational Level
COT 5611 Operating Systems Design Principles Spring 2014
Concurrent Systems Modeling using Petri Nets – Part II
CAP 4800/CAP 5805: Computer Simulation Concepts
CAP 4800/CAP 5805: Computer Simulation Concepts
بسمه‌تعالي فصل چهاردهم شبکه‌هاي پتري.
CSCI1600: Embedded and Real Time Software
COT 5611 Operating Systems Design Principles Spring 2012
CAP 4800/CAP 5805: Computer Simulation Concepts
Petri Net :Abstract formal model of information flow Major use:
CSCI1600: Embedded and Real Time Software
Petri Nets Laurie Frazier.
Presentation transcript:

Introduction to Petri Nets (PNs) PNs Applications in Decision Making & Project Management

Outline Petri nets Introduction Examples Applications of Petri nets in Decision Making & Project Management Properties Analysis techniques Outline

Petri Nets (PNs) Model introduced by C.A. Petri in 1962 Ph.D. Thesis: “Communication with Automata” Applications: distributed computing, manufacturing, control, communication networks, transportation… PNs describe explicitly and graphically: sequencing/causality conflict/non-deterministic choice concurrency Asynchronous model (partial ordering) Main drawback: no hierarchy Thesis of Petri Many applications Used because it allows to represent many different constructs It is an asynchronous model and imposes only a partial order among cocncurrent operations. Now also used in System design Problem is that there is no hierarchy

Petri Net Graph 2 3 Bipartite weighted directed graph: Places: circles Transitions: bars or boxes Arcs: arrows labeled with weights Tokens: black dots p2 t2 2 t1 Describe graph Place contain tokens, they an contain an infinite number p1 p4 3 t3 p3

Petri Net Places/Transition: conditions/events 2 3 A PN (N,M0) is a Petri Net Graph N places: represent distributed state by holding tokens marking (state) M is an n-vector (m1,m2,m3…), where mi is the non-negative number of tokens in place pi. initial marking (M0) is initial state transitions: represent actions/events enabled transition: enough tokens in predecessors firing transition: modifies marking …and an initial marking M0. What places and transitions represent. Places represent state Transitions actions See also as condition/event p2 t2 2 t1 p1 p4 3 Places/Transition: conditions/events t3 p3

Transition firing rule A marking is changed according to the following rules: A transition is enabled if there are enough tokens in each input place An enabled transition may or may not fire The firing of a transition modifies marking by consuming tokens from the input places and producing tokens in the output places Firing rule: only PN rule. May or may not fire: asynchronicity 2 2 2 2 3 3

An Example of Transition Firing

Concurrency, causality, choice Sequencing Conflict t3 t4 t6

Concurrency, causality, choice

Concurrency, causality, choice Causality, sequencing t3 t4 t6

Concurrency, causality, choice conflict t3 t4 t6

Concurrency, causality, choice conflict t3 t4 t6

Communication Protocol Send msg Receive msg P1 P2 Simple communication protocol Send Ack Receive Ack

Communication Protocol Send msg Receive msg P1 P2 Send Ack Receive Ack

Communication Protocol Send msg Receive msg P1 P2 Send Ack Receive Ack

Communication Protocol Send msg Receive msg P1 P2 Send Ack Receive Ack

Communication Protocol Send msg Receive msg P1 P2 Send Ack Receive Ack

Communication Protocol Send msg Receive msg P1 P2 Send Ack Receive Ack

Producer-Consumer Problem Buffer Unbounded channel PNs are an infinite state model but most properties are decidable with finite time and memory Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Bounded channel with complementary arcs Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer Problem Buffer Consume

Producer-Consumer with priority A Consumer B can consume only if buffer A is empty Inhibitor arcs B Unbounded channel PNs are an infinite state model but most properties are decidable with finite time and memory

Decision Making Activities represented by Petri Nets

Decision Trees as Petri Nets

Project Networks as Petri Nets (Activities on Arrows Representation)

Example of Transformation of a Project Network Model Into a Petri Net

A Scenario of Commencement of Project Work (1)

A Specific Instance of the First Scenario

A Scenario of Commencement of Project Work (2)

A Specific Instance of the Second Scenario

PN properties Behavioral: depend on the initial marking (most interesting) Reachability Boundedness Schedulability Liveness Conservation Structural: do not depend on the initial marking (often too restrictive) Consistency Structural boundedness Most interesting properties are behavioral because we know the initial marking of the system and we are interested in analysis that start from there. Structural properties are properties that hold for any initial marking, therefore they are too restrictive. Usually we know the initial marking of the system we design.

Reachability Marking M is reachable from marking M0 if there exists a sequence of firings s = M0 t1 M1 t2 M2… M that transforms M0 to M. The reachability problem is decidable. p2 t2 M0 = (1,0,1,0) t3 M1 = (1,0,0,1) t2 M = (1,1,0,0) p1 t1 p4 The reachability problem is decidable. t3 p3 M0 = (1,0,1,0) M = (1,1,0,0)

Liveness Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Not live The transition is not live because it can be fired only once and after that is dead. The net is not live but it is deadlock free because I can keep firing the two transitions on the right

Liveness Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Not live

Liveness Deadlock-free Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Deadlock-free

Liveness Deadlock-free Liveness: from any marking any transition can become fireable Liveness implies deadlock freedom, not viceversa Deadlock-free

Boundedness Unbounded Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Finite number of token can accumulate Unbounded

Boundedness Unbounded Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

Boundedness Unbounded Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

Boundedness Unbounded Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

Boundedness Unbounded Boundedness: the number of tokens in any place cannot grow indefinitely (1-bounded also called safe) Application: places represent buffers and registers (check there is no overflow) Unbounded

Conservation Not conservative Conservation: the total number of tokens in the net is constant Not conservative

Conservation Not conservative Conservation: the total number of tokens in the net is constant Not conservative This net is not coservative

Conservation Conservative 2 2 Conservation: the total number of tokens in the net is constant Conservative This is conservative 2 2

Analysis techniques Structural analysis techniques Incidence matrix T- and S- Invariants State Space Analysis techniques Coverability Tree Reachability Graph Let us consider now analysis techniques. They are of two types. Structural: incidence matrix and algebraic techniques. PNs firing rules have links to linear algebra. State-based: Reachability tree State-based are exhaustive but expensive.

Incidence Matrix t2 p1 t1 p2 p3 t1 t2 t3 p1 t3 p2 p3 -1 0 0 1 1 -1 -1 0 0 1 1 -1 0 -1 1 p2 p3 Build an incidence matrix that gives info about the PN structure: I/O relationship between nodes. Necessary condition is that exists a solution. Not sufficient! Necessary condition for marking M to be reachable from initial marking M0: there exists firing vector v s.t.: M = M0 + A v

State equations t2 p1 p2 p3 t1 t3 E.g. reachability of M =|0 0 1|T from M0 = |1 0 0|T t2 p1 p2 p3 t1 t3 A= -1 0 0 1 1 -1 0 -1 1 v1 = 1 1 + -1 0 0 1 1 -1 0 -1 1 = The solution is one of the vectors but also v2 = | 1 1 2 |T or any vk = | 1 (k) (k+1) |T

Necessary Condition only Explain why it is only CN. Because we do not know if there are enough initial tokens 2 2 Firing vector: (1,2,2) Deadlock!!

State equations and invariants Solutions of Ax = 0 (in M = M0 + Ax, M = M0) T-invariants sequences of transitions that (if fireable) bring back to original marking periodic schedule in SDF e.g. x =| 0 1 1 |T Cyclic execution. Return to the initial state. Solutions are called T-invariants. t2 p1 t1 p2 p3 A= -1 0 0 1 1 -1 0 -1 1 t3

Application of T-invariants Scheduling Cyclic schedules: need to return to the initial state i *k2 + o *k1 Schedule is example of application of T-invariants. Need to return to the initial state for infinite execution. T-invariant: (1,1,1,1,1) Schedule: i *k2 *k1 + o

State equations and invariants Solutions of yA = 0 S-invariants sets of places whose weighted total token count does not change after the firing of any transition (y M = y M’) e.g. y =| 1 1 1 |T t2 p1 S-invariants. Gives the set of places whose total token count does not change after firing any transition. It is a weighted count. t1 p2 p3 -1 1 0 0 1 -1 0 -1 1 AT= t3

Application of S-invariants Structural Boundedness: bounded for any finite initial marking M0 Existence of a positive S-invariant is CS for structural boundedness initial marking is finite weighted token count does not change Application is structural boundedness. We can guarantee that for any initial marking there is no infinite accumulation of tokens. It is a CS. They can be used to prove unreachability of some markings, if they cannot be expressed as the linear combination of the basis of S-invariants

Summary of algebraic methods Extremely efficient (polynomial in the size of the net) Generally provide only necessary or sufficient information Excellent for ruling out some deadlocks or otherwise dangerous conditions Can be used to infer structural boundedness Efficient. Only partial information. Give first pass to verify simple properties

Coverability Tree Build a (finite) tree representation of the markings Karp-Miller algorithm Label initial marking M0 as the root of the tree and tag it as new While new markings exist do: select a new marking M if M is identical to a marking on the path from the root to M, then tag M as old and go to another new marking if no transitions are enabled at M, tag M dead-end while there exist enabled transitions at M do: obtain the marking M’ that results from firing t at M on the path from the root to M if there exists a marking M’’ such that M’(p)>=M’’(p) for each place p and M’ is different from M’’, then replace M’(p) by w for each p such that M’(p) >M’’(p) introduce M’ as a node, draw an arc with label t from M to M’ and tag M’ as new. Build coverability tree starting from initial marking

Coverability Tree 1000 p1 p2 p3 p4 t1 t2 t3 Boundedness is decidable with coverability tree 1000 p1 p2 p3 p4 t1 t2 t3 Build coverability tree starting from initial marking

Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 p4 t3 Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 p4 t3

Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 p4 t3 Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 p4 t3

Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 p4 0101 t3 Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 p4 0101 t3

Coverability Tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 010 p4 t3 Boundedness is decidable with coverability tree 1000 t1 0100 t2 p1 t1 p2 p3 t3 0011 t2 010 p4 t3 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

 Coverability Tree t1 t1 p1 t2 t1 p1 t2 2 2 Is (1) reachable from (0)? t1  t1 p1 t2 t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

 Coverability Tree t1 t1 p1 t2 (0) (1) (2)… t1 p1 t2 2 2 Is (1) reachable from (0)? t1  t1 p1 t2 (0) (1) (2)… t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

 Coverability Tree t1 t1 p1 t2 (0) (1) (2)… (0) (2) (0)… t1 p1 t2 2 2 Is (1) reachable from (0)? Cannot solve the reachability problem t1  t1 p1 t2 (0) (1) (2)… (0) (2) (0)… t1 p1 t2 2 2 Introduce the omega symbol that means infinite accumulation of tokens. It cannot solve reachability problems

Reachability graph p1 p2 p3 t1 t2 t3 100 For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3 For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3 t3 001 For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Reachability graph t2 p1 t1 p2 p3 100 t1 010 t3 t2 t3 001 For bounded nets the Coverability Tree is called Reachability Tree since it contains all possible reachable markings

Subclasses of Petri nets Reachability analysis is too expensive State equations give only partial information Some properties are preserved by reduction rules e.g. for liveness and safeness Even reduction rules only work in some cases Must restrict class in order to prove stronger results In general reachability is too expensive, requires to build a reachability tree too big. State equations give only partial information. How do we do? Use reduction rules that preserve properties. Or restrict class.

Subclasses of Petri nets: SMs State machine: every transition has at most 1 predecessor and 1 successor Models only causality and conflict (no concurrency, no synchronization of parallel activities)

Subclasses of Petri nets: MGs Marked Graph: every place has at most 1 predecessor and 1 successor Models only causality and concurrency (no conflict) Same as underlying graph of SDF

Subclasses of Petri nets: FC nets Free-Choice net: every transition after choice has exactly 1 predecessor

Free-Choice Petri Nets (FCPN) Free-Choice (FC) t1 t2 Confusion (not-Free-Choice) Extended Free-Choice Free-Choice: the outcome of a choice depends on the value of a token (abstracted non-deterministically) rather than on its arrival time. Easy to analyze

Free-Choice nets Introduced by Hack (‘72) Extensively studied by Best (‘86) and Desel and Esparza (‘95) Can express concurrency, causality and choice without confusion Very strong structural theory necessary and sufficient conditions for liveness and safeness, based on decomposition exploits duality between MG and SM

Petri Net extensions Add interpretation to tokens and transitions Colored nets (tokens have value) Add time Time/timed Petri Nets (deterministic delay) type (duration, delay) where (place, transition) Stochastic PNs (probabilistic delay) Generalized Stochastic PNs (timed and immediate transitions) Add hierarchy Place Charts Nets Stochastic PNs have exponentially distributed random variable expressing the delay between the enabling and the firing of a transition. GSPNs have immediate transitions that take negligible amount of time. Place Charts Nets: exponential reduction in size. Good for preemption.

Summary of Petri Nets Graphical formalism Distributed state (including buffering) Concurrency, sequencing and choice made explicit Structural and behavioral properties Analysis techniques based on linear algebra structural analysis (necessary and sufficient only for FC) linear algebra (only sufficient) structural analysis (necessary and sufficient only for FC)

References http://www.informatik.uni-hamburg.de/TGI/PetriNets/introductions/ http://wwwis.win.tue.nl/~wvdaalst/petri_nets.htm http://www.informatik.uni-hamburg.de/TGI/PetriNets/introductions/aalst/ V. C. Gerogiannis, A. Kameas & P. Pintelas, “Classification and Comparative Study of High-Level Petri Nets”, Journal of Systems and Software, Vol. 43, November 1998, pp. 133-160. For Petri Nets application in Decision Making & Project Management refer to “A Petri Net model view of decision making: an operational management analysis” (A. Mehrez, M. Muzumdar, W. Acar and G. Weinroth), Omega, Vol. 23, Issue 1, 1995, pp. 63-78 (figures in slides 7, 34-41 have been reproduced from this article)