Chapter 3 Petri nets Learning objectives : Introduce Petri nets

Slides:



Advertisements
Similar presentations
Discrete time Markov Chain
Advertisements

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)
Models of Concurrency Manna, Pnueli.
1 SE-561 Formal Methods in Software Petri Nets - I.
An Introduction to Petri Nets
1 Analysis of workflows : Verification, validation, and performance analysis. Wil van der Aalst Eindhoven University of Technology Faculty of Technology.
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
Introduction to Graph “theory”
Timed Automata.
Chapter 3 Petri nets Learning objectives : Introduce Petri nets
IE 469 Manufacturing Systems
Parallel Scheduling of Complex DAGs under Uncertainty Grzegorz Malewicz.
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.
CS447/ECE453/SE465 Prof. Alencar University of Waterloo 1 CS447/ECE453/SE465 Software Testing Tutorial Winter 2008 Based on the tutorials by Prof. Kontogiannis,
12/07/2007Jiacun Wang1 SE-561 Math Foundations Petri Nets - II Dr. Jiacun Wang Department of Software Engineering Monmouth University.
1 Petri Nets Marco Sgroi EE249 - Fall 2001 Most slides borrowed from Luciano Lavagno’s lecture ee249 (1998)
Data Flow Analysis Compiler Design Nov. 8, 2005.
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.
Introduction to Graph “theory” Why do we care about graph theory in testing and quality analysis? –The “flow” (both control and data) of a design, within.
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)
Lecture 11 Algorithm Analysis Arne Kutzner Hanyang University / Seoul Korea.
Petri Nets Lecturer: Roohollah Abdipour. Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2.
Modelling by Petri nets
School of Computer Science, The University of Adelaide© The University of Adelaide, Control Data Flow Graphs An experiment using Design/CPN Sue Tyerman.
Graph Theory and Applications
Learning objectives : Introduce Petri nets Dynamic behavior modeling of manufacturing systems using PN Analysis of Petri net models Textbook : J.-M. Proth.
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.
Review n System dynamics : A sequence of state transition n model : A set of rules for state transition System S X Y Discrete event system FSM (Automata)
Petri-Nets and Other Models
A SUPPORT TOOL FOR THE REACHABILITY AND OTHER PETRI NETS- RELATED PROBLEMS AND FORMAL DESIGN AND ANALYSIS OF DISCRETE SYSTEMS Department of Computers and.
Technology of information systems Lecture 5 Process management.
Process Mining – Concepts and Algorithms Review of literature on process mining techniques for event log data.
Capabilities, Minimization, and Transformation of Sequential Machines
Scheduling with Constraint Programming
EMGT 6412/MATH 6665 Mathematical Programming Spring 2016
Advantages of FSM Their simplicity make it easy for inexperienced developers to implement with little to no extra knowledge (low entry level)
New Characterizations in Turnstile Streams with Applications
Dr. Eng Amr T. Abdel-Hamid
Copyright © Cengage Learning. All rights reserved.
Clockless Computing COMP
Modeling Arithmetic, Computation, and Languages
Design and Analysis of Algorithm
Lectures on Network Flows
Concurrent Systems Modeling using Petri Nets – Part II
Lecture 10 Algorithm Analysis
Turnstile Streaming Algorithms Might as Well Be Linear Sketches
بسمه‌تعالي فصل چهاردهم شبکه‌هاي پتري.
CSCI1600: Embedded and Real Time Software
Linear Equations in Linear Algebra
Introduction to Petri Nets (PNs)
Lectures on Graph Algorithms: searching, testing and sorting
COT 5611 Operating Systems Design Principles Spring 2012
Synthesis and Verification of Finite State Machines
Discrete time Markov Chain
Flow Feasibility Problems
Performance evaluation of manufacturing systems
CSE 380 Lecture Note 12 Insup Lee
Chapter 1. Formulations.
Linear Equations in Linear Algebra
CSCI1600: Embedded and Real Time Software
Presentation transcript:

Chapter 3 Petri nets Learning objectives : Introduce Petri nets Dynamic behavior modeling of manufacturing systems using PN Analysis of Petri net models Textbook : J.-M. Proth and X. Xie, Petri nets: a tool for design and management of manufacturing systems, John Wiley & Sons, 1996 C. Cassandras and S. Lafortune, Introduction to Discrete Event Systems, Springer, 2007

Introduction to Petri nets Formal definitions Plan Introduction to Petri nets Formal definitions Petri net models of manufacturing system Elementary classes of Petri nets Properties of PN models Analysis methods Reduction and Synthesis of ordinary Petri nets Timed Petri nets Modeling repetitive manufacturing systems Time Petri nets 2

Introduction to Petri nets 3

A two-product system Two types P1 and P2 of products are produced. The production of each product requires two operations. The first operation is performed by a shared machine. The second operation is performed by a dedicated machine. There is at most one product of each type loaded in the system at any time. When a product finishes, a new product of the same type is dispatched. To be modelled using an usual process-resource modelling approach. 4

A two-product system Process modeling Goal: model the manufacturing process of each product, i.e. all possible states of a product including waiting Identify all relevant operations and their precedence constraints. Identify all possible waits for shared resources. wait for shared machine parts under operation 1 parts under operation 2 5

A two-product system Process modelling Goal: model the manufacturing process of each product. Include eventual constraints related to production control. 6

A two-product system Resource modelling Goal: modelling resource contraint + eventual priority constraints Identifies transitions after which the resource is first needed transitions after which the resource is no longer needed 7

Places and transitions A PETRI NET is a bipartite graph which consists of two types of nodes: places and transitions connected by directed arcs. Place = circle, transition = bar or box. An arc connects a place to a transition or a transition to a place. No arcs between nodes of the same type. Input and output places of a transition Input and output transitions of a place

Token and marking system state Each place contains a number of tokens. The distribution of tokens in the Petri net is called the marking.   Representations of a marking: a vector M = (m1, m2, …, mn) where mi = nb of tokens in place pi a multi-set such as M = p1 2p3    The marking of an PN = state of the corresponding system. The initial state of the system = the initial marking, denoted as M0. Example: M = ( ???) = ??? 9

System dynamics by transition firing A transition is said enabled (firable) if each of its input places contains at least one token. An enabled transition can fire. Firing a transition removes a token from each input place and add one token to each ouput place. Firing a transition leads to a new marking that enables other transitions. The dynamic behavior of the corresponding system = evolution of the marking and transition firings Convention: simultaneous transition firings are forbidden. 

11

Sequence of transitions A sequence of transitions that can be fired consecutively starting from the initial marking is said enabled or firable. The sequence of firable transitions is not unique. The set of all firable sequences of transitions = PN language Example: sequence t1t2t1t3 12

Formal definitions 13

Petri Nets A Petri net is a five-tuple PN = (P, T, A, W, M0) where: P = { p1, p2, ..., pn} is a finite set of places T = { t1, t2, ..., tm } is a finite set of transitions A  (P×T)  (T×P) is a set of arcs W : A → { 1, 2, ... } is a weight function M0 : P → { 0, 1, 2, ... } is the initial marking P  T =  and P  T =  PN without the initial marking is denoted by N: N = (P, T, A, W) PN = (N, M0)   A Petri net is said ordinary if w(a) = 1, a  A. 14

Graphic representation   Similar to that of ordinary PN but with default weight of 1 when not explicitly represented. 15

Transition firing Rule 1: A transition t is enabled at a marking M if M (p) ≥ w(p, t) for any p  ot where ot is the set of input places of t Rule 2: An enabled transition may or may not fire. Rule 3: Firing transition t results in: removing w(p, t) tokens from each p  ot adding w(t, p) tokens to each p  to where to is the set of output places of t M(t> M' denotes firing t at marking M with  

Transition firing 17

Basic concepts Source transition: transition without input places, i.e. ot = . Sink transition: transition without output places, i.e. to = . Source place: place without input transitions, i.e. op = . Sink place: place without output transitions, i.e. po = . Self-loop: a couple (p, t) such that t is both input and output transition of p Path: a sequence of nodes s1s2…sn such that si+1 is an output node of si. Circuit: a path such that sn = s1. Online illustration

Incidence matrices Pre incidence matrix: Post incidence matrix: Incidence matrix : C = Post – Pre. C(., t) = Token flow balance after firing t Pre and Post define the Petri net For Petri nets without self-loops, i.e. ot to = , C defines the Petri net with Pre(p,t) = max{0, C(p,t)} and Post(p,t) = max{0, C(p,t)}

Incidence matrices Example: Pre = ???, Post = ???, C = ???

Incidence matrices Enabled transition: A transition t is enabled at a marking M if M ≥ Pre(●, t) Transition firing: Firing a transition t at marking M leads to M’ = M + C(●, t) Sequence of transitions: Firing a sequence s = t1t2…tn of transition starting from marking M leads to: where is the counting vector of the sequence s. (proof) Equation (1) is also called « state equation ». Question: can this equation be used to checked the feasibility of a sequence and the reachability of a marking?

Incidence matrices Example: Markings after s = t1t5t2t3t5 Observe the state equation of s’ = t5t5t1t2t3. What conclusion?

Petri net models of manufacturing systems

PN models of key characteristics Precedence relation: Parallel processes: Alternative processes: Synchronization: 24

PN models of key characteristics Buffer of finite capacity (4): FIFO system: 25

PN models of key characteristics Shared resources: 26

PN models of key characteristics Shared machine: Dedicated machine: 27

PN models of key characteristics Unreliable machines: Assembly operation: 28

A robotic cell 29

A two-product system Two types P1 and P2 of products are produced. The production of each product requires two operations. The first operation is performed by a shared machine. The second operation is performed by a dedicated machine. There is at most one product of each type loaded in the system at any time. When a product finishes, a new product of the same type is dispatched. To be modelled using an usual process-resource modelling approach. 30

Process modeling Goal: model the manufacturing process of each product. Identify all relevant operations and their precedence constraints. Identify all possible waits for shared resources. wait for shared machine parts under operation 1 parts under operation 2 31

Process modelling Goal: model the manufacturing process of each product. Include eventual constraints related to production control. 32

Resource modelling Identifies Goal: modelling resource contraint. Identifies transitions after which the resource is first needed transitions after which the resource is no longer needed 33

Elementary classes of Petri nets 34

Pure Petri nets Definition: A Petri net free of self loop is said pure, i.e. ot to = . Theorem : All impure Petri nets can be transformed into pure Petri nets. Sequential firing 35

Ordinary Petri nets EVENT GRAPHS (OR MARKED GRAPHS) STATE MACHINES Each place has exactly one input and one output transition. Property: The total number of tokens in each elementary circuit is constant STATE MACHINES Each transition has exactly one input place and one output place.   Property: The total number of token is constant. choice synchronization 36

Ordinary Petri nets FREE-CHOICE NETS card(p°) > 1  °(p°) = {p},  p  P   EXTENDED FREE-CHOICE NETS p1°p2° ≠   p1° = p2°, p1, p2  P Can be transformed into a free-choice net. Property: Conflicting transitions are either all enabled or all not enabled. 37

Ordinary Petri nets p3 vs r r used by more transitions ASYMMETRIC CHOICE NETS p1°p2° ≠   p1°  p2° or p2°  p1° ,  p1, p2  P Property : The set {p1, p2, …, pk} of input places of any transition can be renumbered such that p1°  p2°  …  pk°.   p3 vs r r used by more transitions 38

Relations between different classes PN = Petri Net AC = Assymmetric choice EFC = Extended Free Choice FC = Free Choice SM = State Machine EG = Event Graph Modeling power 39

Properties of PN models 40

Reachability Reachable marking: A marking M is said reachable from another marking M’ if there exists a seqence s of transitions such that M’(s >M.   Reachable set: R(M0) = set of markings reachable from the initial marking M0. Reachability is important for verification of the reachability of some desired (proper termination) or undesired markings (deadlock). Example: R(M0) = {(1, 0, 0, 0), (0, 1, 0, 0), (0, 0, 1, 0), (0, 0, 0, 1)} but (1, 0, 1, 0) not reachable. Reachability = Petri net language 41

Reachability Theorem1 (monotonicity) : Any sequence s of transitions firable starting from a marking M0 is also firable starting from M0’ such that M0' ≥ M0.   Theorem2 (necessary condition) : The equation system CY = M - M0 with Y ≥ 0 has a solution for all reachable marking M. Theorem3 (Acyclic PN) : For any PN free of cycles, a marking M is reachable iff the equation system C Y = M - M0 with Y ≥ 0 has a solution. Ex: Find a PN and a marking that is not reachable but for which condition of Theorem 2 holds. 42

Boundedness A place p is said k-bounded if the number of tokens in p never exceed k, i.e. M(p) ≤ k, M Œ R(M0).   A Petri net is said k-bounded if all places are k-bounded, i.e. M(p) ≤ k, p and M Œ R(M0). A Petri net is said bounded if it is k-bounded for some k > 0. A Petri net is said safe if it is 1-bounded, M(p) ≤ 1, p and M Œ R(M0). Boundedness is often needed for a well-designed system as, without this property, goods could accumulated without limit, which is often a design error. 43

Boundedness 44

Boundedness Theorem (monotonicity) : If (N, M0) is bounded, then (N, M0’) such that M0' ≤ M0 is bounded.   Theorem (necessary condition) : A Petri net (N, M0) is k-bounded if M(p) ≤ k, p and M such that M = M0 + CY for some Y ≥ 0. 45

Liveness A transition t is said live if it can always be made enabled starting from any reachable marking, i.e. M Œ R(M0), M' Œ R(M) such that M‘(t>.   A Petri net is said live if all transitions are live. A transition is said quasi live if it can be fired at least once, i.e.   M Œ R(M0) such that M(t>. A Petri net is said quasi live if all transitions are quasi live.  A marking M is said a deadlock or dead marking if  no transition is enabled at M. A Petri net is said deadlock-free if it does not contain any deadlock.  46

Liveness Liveness implies the absence of total or partial deadlock and is often required for well-designed systems. But the reverse is not true. Deadlock often results from resource sharing and synchronization of parallel processes. No monotonicity of liveness as the Petri net below is not live if M0(R1) = 0, live if M0(R1) = 1, and not live if M0(R1) = 2. PN1 PN2 47

Reversibility A Petri net (N, M0) is said reversible if the initial marking remains reachable from any reachable marking, i.e. M0 Œ R(M), M Œ R(M0)   A marking M* is said a home state if it is reachable from all reachable markings, i.e. M* Œ R(M), M Œ R(M0) . Existence of the reversibility ensures that the system can always recover the normal behavior and is important for systems subject to failures. Existence of home state is important for systems requiring proper termination. Reversiblity implies existence of home states but the reverse is not true. 48

Reversibility Reversibility, liveness and boundedness are independent 49

Analysis methods 50

Reachability tree Definition: The reachability tree, also called marking graph, of a Petri net (N, M0) is a graph in which nodes corresponds to reachable markings arcs correpond to feasible transitions. Remark: the reachability tree of an unbounded PN is unlimited.

w > n, w ± n = w, for all integer n and w ≥ w. Coverability tree Symbol "w" implying « as great as possible » with the following properties: w > n, w ± n = w, for all integer n and w ≥ w.   M1 covers M0 Repeat t1 leads to w tokens in p2. Replace M1 by [0, w] Step1 Step2 Step3 52

Coverability tree Algorithm of coverability tree (Self-reading) 1. Initiate the tree by a root node labeled M0 and marked as "new". 2. While there exists "new" nodes : 2.1. Select a "new" node A. Let M be its marking. 2.2. If there exists a node B with marking M on the path from the root to A, then mark A as "old" and go to 2. 2.3. If M is a dead marking, then mark A"dead-end" and go to 2. 2.4. Otherwise, for each transition t enabled at M, 2.4.1. Add a node C, an arc from A to C with label t, mark C "new". 2.4.2. Determine the marking M’ of node C. 2.4.3. If, on the path from the root to node C, there exists a node D with marking M" such that M' ≥ M" & M'(p) > M"(p) for some p, then M'(p) = w for all p such that M'(p) > M"(p). 2.5. Go to 2. 53

Coverability tree Theorem (boundedness) : A Petri net (N, M0) is bounded iff the symbol w does not appear in the coverability tree.   Theorem (bounded PN) : For a bounded Petri net, it is deadlock-free iff any node of the reachability tree has a successor. It is reversible iff the reachability tree is strongly connected. A transition t is live iff it appears a all strongly connected components that do not have arcs going out. Remark: Liveness and reversibility of unbounded PN cannot be checked with coverability trees. 54

p-invariants Definition: A integer vector X≥0 of dimension n = |P| is a p-invariant if Xt C = 0. The set of places pi with Xi > 0 is called the support of the p-invariant and is denoted ||X||. A p-invariant X is said minimal if there does not exist another p-invariant X’ such that X' ≠ X and X' ≤ X. Exampel:   55

p-invariants Theorem: X is a p-invariant iff, for all M0, Xt M = Xt M0,  M Œ R(M0). Theorem : Any linear combination of p-invariants is a p-invariant. Theorem : All p-invariant is a non negative linear combination of minimal p-invariants.   Remark : For PN models of real systems, a minimal p-invariant has clear physical significance (resource, production control strategies, ...) and can be derived by inspection of resources and processes. Exampe: Identification of p-invariants by inspection by resource-oriented decomposition 56

t-invariants Definition: A integer vector Y≥0 of dimension m = |T| is a t-invariant if CY = 0. The set of transitions ti with Yi > 0 is called the support of the t-invariant and is denoted ||Y||. A t-invariant Y is said minimal if there does not exist another t-invariant Y’ such that Y' ≠ Y and Y' ≤ Y. Exampel:   57

t-invariants Theorem: Let s be a sequence of transitions tranforming M0 into M and Y its counting vector. Then M = M0 iffY is an t-invariant. Theorem : Any linear combination of t-invariants is a t-invariant. Theorem : All t-invariant is a non negative linear combination of minimal t-invariants.   Remark : In general, a minimal t-invariant corresponds to a process that can be repeat for ever. They can be identified by neglecting resources. Exampe: Identification of p-invariants by inspection by removing resource constraints 58

Determination of p- and t-invariants (optional) Algorithm of minimal p-invariants 1. Set A = In×n with n = |P| and B = C (incidence matrix). Construct matrix [A | B]. 2. For each transition tj: 2.1. Add to [A | B] non negative linear combination of any two lines that zeros the entry of column tj 2.2. Remove in the matrix [A | B] all lines i such that the entry (i, j) is not zero. 3. p-invariants correspond to lines of matrix A. The algorithm of t-invariants is similar with C replaced by CT. 59

Siphons and traps A siphon is a subset of places such that any input transition of a place is an output transition of some other place. A trap is a subset of places such that any ouput transition of a place is an input transition of some other place. 60

Siphons and traps Theorem: For any ordinary PN, A siphon free of tokens at a marking remains token-free A trap marked by a marking remains marked The empty places of a dead marking form a siphon for any marking such that no transition is enabled. A Petri net is deadlock-free if no siphon eventually becomes empty. 61

Siphons and traps Theorem: A connected event graph (N, M0) is live iff every circuit contains a token. A live event graph is reversible. A connex event graph is bounded iff it is strongly connected. Theorem: A connected state machine is always bounded. It is live and reversible iff it is strongly connected. Theorem : A free-choice (extended or not) (N, M0) is live iff all siphon contains a trap marked at M0. Theorem : An assymetric net (N, M0) is live iff no siphon can become unmarked. Remarks: Whether all siphons remain marked can be checked by integer programming. For usual manufacturing systems, both liveness and reversibility are ensured if no siphon can become unmarked 62

Siphons and traps Siphons to care: Minimal siphons that are not traps Live as it is an AC net and any siphon contain a trap marked at M0 {R2, R3, p3} = siphon that can be unmarked The AC net is life iff n1 < n2+n3. 63

Siphons and traps optional Theorem: A Petri net (N, M0) is deadlock-free if G = 0 where G = max ∑pŒP up such that - S is a siphon, i.e. zt ≤ ∑pŒ•t up, t Œ T up ≤ zt,  t, p / t Œ •p up , zt Œ  {0, 1} - S can become unmarked: 1{M(p)} + up ≤ 1 , p Œ P (NL) M = M0 + CY M ≥ 0, Y ≥ 0.   The nonlinear constraint (NL) can be replaced by (NL) <=> M(p) / SB(p) + up ≤ 1 where SB(p) is the upper bound of the marking of place p.

Structural properties STRUCTURAL BOUNDEDNESS A Petri net N is structurally bounded if it is bounded starting from any M0. Criterion : N is structurally bounded   X > 0, XTC ≤ 0.   Theorem: (N, M0) is bounded if it is structurally bounded. CONSERVATIVENESS A Petri net N is conservative if there exists a vector X > 0 associated with places such that XTM = XTM0, M0, M R(M0). Criterion : N is conservative   X > 0, XTC = 0. Theorem: (N, M0) is bounded if it is conservative. A Petri net is conservative if all places are covered by some p-invariant. 65

Structural properties  REPETITIVENESS A Petri net N is repetitive if there exists M0 and a feasible firing sequence such that each transition appears infinitely often. Criterion : N is repetitive   Y > 0, CY ≥ 0. Theorem: A live Petri net (N, M0) is repetitive. CONSISTENCY A Petri net N is consistent if there exist an initial marking M0 and a firing sequence s such that > 0 and M0 [s >M0. Criterion : N is consistent   Y > 0, CY = 0. Theorem : A live Petri net (N, M0) with a home state is consistent. A live and bounded Petri net (N, M0) is consistent. It is also conservative if it is live and structurally bounded. 66

Structural properties In practice, boundedness reduces to conservativeness. Consistency and conservativeness provide necessary conditions for liveness and resersibility. Unfortunately, liveness and resersibility remain difficult to check. 67

Reduction and synthesis of ordinary Petri nets 68

Petri net reduction R1 : Merging of serial places Conditions : p1• = {t}, •t = {p1}, t• = {p2} 69

Petri net reduction R2 : Merging of serial transitions Conditions : M0(p) = 0, •p = {t1}, p• = {t2}, •t2 = {p}. 70

Petri net reduction R3 : Removal of identical places Conditions : M0(p1) = M0(p2), •p1 = •p2, p1• = p2•. 71

Petri net reduction R4 : Removal of identical transitions Conditions : •t1 = •t2, t1• = t2•. 72

Petri net reduction R5 : Removal of implicit places Conditions : •p = p•, M0(p) > 0. 73

Petri net reduction R6 : Removal of neutral transitions Conditions : •t = t• = {p}, p•  •p ≠ {t}. 74

Petri net reduction Thereom (property perservation of reduction rules) : Let N be a Petri net and N' be a reduced net obtained by rules R1-R6. Then, N is live iff (if and only if) N' is live; N is bounded iff N' is bounded; N is safe iff N' is safe, if place p of rule R5 is such that M0(p) = 1; N is reversible iff N' is reversible, if place p2 of rule R1 has a single input transition. 75

Petri net reduction Example (homework): t1 p1 p2 t3 t2 p5 t7 p7 t8 p8 R2: (t1,p1,t2), (t4,p3,t5), (t7, p7, t8), (t9, p9, t10) R2: (t78, p8, t9,10) + R5 Bounded, not live, not reversible, not safe. 76

Petri net reduction Example: t1 p1 p2 t3 t2 p5 t7 p7 t8 p8 t9 p9 t10 Bounded Live reversible R2: (t1,p1,t2), (t4,p3,t5), (t7, p7, t8), (t9, p9, t10) R2: (t78, p8, t9,10) + R5 R2: (t12, p2, t3), (t45, p4, t6) + R5 R1: (r2, t123, p5), (r3, t456, p6) + R5 77

Top-down Petri net synthesis Principle: Top-down synthesis starts from an initial PN that is expanded progressive. At each step, a place or a transition is replaced by a Petri net. Expansion of a transition t Assumption : t is not 2-firable, i.e. it cannot be simultaneously fired twice. Definitions : • A bloc is a PN with a source transition Tin and a sink transition Tout • The associated PN of a bloc is a PN obtained by connecting Tout to Tin with an place p0 containing 1 token. • A bloc is said well-formed if its associated PN is live, M0 is the only reachable marking such that p0 is marked, and Tin is the only firable transition at M0. 78

Top-down Petri net synthesis Examples of well-formed blocs. Tin Tin Tout Tout 79

Top-down Petri net synthesis Theorem : Let N, B and N' be an initial PN, associated PN of a well-formed bloc, and the PN obtained by expansion. Then N' is live (resp. bounded or reversible) of N and B are live (resp. bounded or reversible). Expansion of a place equivalent to the expansion of a transition Bottom-up Petri net synthesis approaches also exist. 80

Timed Petri nets 81

P-timed Petri nets Definition: A P-timed Petri net is a triplet (N, M0, tempo) where (N, M0) is a marked Petri net with N = (P, T, Pre, Post); tempo : P  R+ is a temporization function that associates with each place pi a time tempo(pi) = di. 82

P-timed Petri nets Evolution of the marking over time 83

P-timed Petri nets Firing rules: R1: Each token arriving in a place pi should stay at least for a time di. It is said unavailable during this time and becomes available after. R2: At any time, the marking M is the sum of two markings Mu and Ma corresponding to respectively unavailable tokens and available ones. R3: A transition is firable if it is at marking Ma. R4: The firing of a transition is the same as for untimed Petri nets. Assumption : transitions fire as soon as they are enabled (earliest operating mode). 84

P-timed Petri nets Reachability of a P-timed Petri net: The state of the PN is represented by the number of tokens in each place and the remaining sojourn time of each token. Transition from marking M1 to M2 is labeled as tj / d where tj is the transition and d the sojourn time in M1. When several transitions fires simultaneously, it is marked (ti, tj …) / d. 85

P-timed Petri nets Theorem: If the underlying PN (N, M0) is bounded and the temporizations are rational numbers, then reachability graph is finite; the earliest operating mode leads to a periodic regime (also called stationary regime) in finite time for any given priority rule for conflict transitions sorting. 86

C(g) = ∑p  Œg tempo(p) / M0(g). P-timed Petri nets Definitions: Firing frequency fi of a transition ti is the number of times ti fires during a time unit; - Cycle time Ci = 1 / fi. Thereom 1: For any periodic regime of a bounded PN, the firing frequency vector F = (f1, f2, …, fm) is a t-invariant. Theorem 2: For any strongly connected P-timed event graph, the firing frequency is the same for all transitions and the cycle time is given by C = max{C(g), g  G} where G is the set of elementary circuits and C(g) = ∑p  Œg tempo(p) / M0(g). Example: 87

T-timed Petri nets Definition: A T-timed Petri net is a triplet (N, M0, tempo) where (N, M0) is a marked Petri net with N = (P, T, Pre, Post); tempo : T  R+ is a temporization function that associates with each transition ti a time tempo(ti) = di. 88

T-timed Petri nets Evolution of the marking over time 89

T-timed Petri nets Firing rules: R1: Each token is either reserved for the firing of a transition tj or not reserved. R2: At any time, the marking M is the sum of two markings Mr and Mn of reserved tokens and not reserved ones. R3: A transition is firable if it is at marking Mn. R4: During the firing of a transition tj, tokens needed for its firing are reserved in its input places. The firing completes after a time dj. At this moment, reserved tokens are removed and not reserved tokens are added to its output places. Assumption : transitions fire as soon as they are enabled (earliest operating mode). 90

T-timed Petri nets Reachability of a T-timed Petri net: The state of the PN is represented by the number of tokens in each place and the remaining firing time of each transition firing. Transition from marking M1 to M2 is labeled as tj / d where tj is the transition and d the sojourn time in M1. When several transitions fires simultaneously, it is marked (ti, tj …) / d. 91

T-timed Petri nets Theorem: If the underlying PN (N, M0) is bounded and the temporizations are rational numbers, then reachability graph is finite; the earliest operating mode leads to a periodic regime (also called stationary regime) in finite time for any given priority rule for conflict transitions sorting. 92

C(g) = ∑t  Œg tempo(t) / M0(g). T-timed Petri nets Definitions: Firing frequency fi of a transition ti is the number of times ti fires during a time unit; - Cycle time Ci = 1 / fi. Thereom 1: For any periodic regime of a bounded PN, the firing frequency vector F = (f1, f2, …, fm) is a t-invariant. Theorem 2: For any strongly connected T-timed event graph, the firing frequency is the same for all transitions and the cycle time is given by C = max{C(g), g  G} where G is the set of elementary circuits and C(g) = ∑t  Œg tempo(t) / M0(g). Example: 93

Equivalence of P-timed and T-timed Petri nets 94

Algebra representation of T-timed event graphs Notation: xi(k) : starting time of k-th firing of transition ti Recursive equations: x1(k) = max{x1(k-1)+d1, x2(k-1) + d2} x2(k) = x1(k-1)+d1 x1(1) = x2(1) = 0 (max, +) linear algebra representation: x1(k) = x1(k-1)d1x2(k-1)  d2 x2(k) = x1(k-1)d1x2(k-1)  e where = +,  = max, e = - (nul element) Matrix representation: 95

Algebra representation of T-timed event graphs Notation: xi(k) : starting time of k-th firing of transition ti mij : initial marking of place connecting ti to tj Recursive equations: xi(k) = max{xj(k-mij)+dj, (i,j)P} (max, +) linear algebra representation: Results hold also for P-timed event graphs Extended theory of (max, +) linear algebra available in the book "Synchronization and Linearity: An Algebra for Discrete Event Systems" 96

Modeling repetitive manufacturing systems with timed Petri nets 97

System specifications System: a manufacturing system composed of three machines M1, M2, M3 producing two types of parts P1 and P2. Part routing: P1 : (M1, 4), (M2, 2), (M3, 1) P2 : (M3, 2), (M2, 1) Product mix: 50% P1 and 50% P2. Transportation resources: Each on-going part requires a pallet. There are 2 pallets for P1 and one for P2. Assumptions: Repetitive or cyclic production: One P1 and one P2 are produced in each production cycle; Each machine serves the parts cyclically according to the following input sequences: M1: <P1>, M2: <P1, P2>, M3: <P1, P2>. 98

Modeling repetitive manufacturing systems Step 1 : Modeling part routings Repeat twice the model of P1 if a production cycle is (2*P1, 1*P2). 99

Modeling repetitive manufacturing systems Step 2 : Modeling transportation resources (process circuits) 100

Modeling repetitive manufacturing systems Step 3 : Modeling input sequences of the machines (command circuits) 101

Results Strongly connected t-timed event graph; Live, bounded, reversible; Cycle time of elementary circuits : g M(g) C(g) t1p1t2p2t3p3t1 2 7/2 t4p4t5p5t4 1 3/1 t1p6t1 1 4/1 t2p8t5p7t2 1 3/1 t3p10t4p9t3 1 3/1 t2p2t3p10p4t5p7t2 1 6/1 t2p8t5p5t4p9t3p3t1p1t2 4 10/4 System cycle time : C = max{C(g), g  G} = 6. System throughput rate: one P1 + one P2 per 6 time units. Maximum thoughput rate with C = 4 reached if M0(p2) = M0(p3) = 1, i.e. start with an on-going P1 at time 0. 102

Time Petri nets 103

Definition Assumption: A time Petri net is a triplet (N, M0, INT) where (N, M0) is a marked Petri net with N = (P, T, Pre, Post); INT : T  R+ x R+ is a temporization function that assicates with each transition t an interval [a, b]. INTi = [ai, bi] = time interval associated with transition ti is such that ai ( 0 ≤ ai) is the minimal time during which ti remains firable before it actually fires bi (0 ≤ b ≤ ∞) is the maximum time during which ti remains firable before it is forced to fire. Assumption: No transition is two-firable, i.e. can initiate two simultaneous firings. (relaxable assumption) 104

Example Initial state: M0 = [1000101], 1 ≤ t1 ≤ 6 • t1 fires at q1 • State : M1 = [0111101], 1 ≤ t2 ≤ 6, 2 ≤ t3 ≤ 3, 1 ≤ t5 ≤ 4 Case t2 fires next at q1+ q2 1 ≤ q2 ≤ 3, M2 = [1011101], 1 ≤ t1 ≤ 6, max{0, 2 -q2} ≤ t3 ≤ 3 - q2, max{0, 1 -q2} ≤ t5 ≤ 4 - q2. Case t3 fires next at q1+ q2 2 ≤ q2 ≤ 3, M2 = [0101011], 1 ≤ t4 ≤ 4, max{0, 1 - q2} ≤ t2 ≤ 6 - q2, max{0, 1 - q2} ≤ t5 ≤ 4 - q2. Case t5 fires next at q1+ q2 1 ≤ q2 ≤ 4, M2 = [0110101], max{0, 1 - q2} ≤ t2 ≤ 6 - q2, max{0, 1 - q2} ≤ t5 ≤ 4 - q2. 105

State of a time Petri net at any time t S = (M, I) where M is the marking at time t; I indicate, for each firable transition ti, the interval (EFTi, LFTi) of remaining time to actual firing, i.e. ti can fire at any time in [t + EFTi, t + LFTi].   Example : At time t=0, S = (M0, I1 = (1, 6)). At time t = q1, S = (M1, I2 = (1, 6), I3 = (2, 3), I5 = (1, 4)). 106

Firing rules R1 : With any given state S = (M, I) at time t, transition ti is the next transition at time t + q if ti is firable at M, EFTi ≤ q ≤ mink{LFTk}.   R2 : Firing ti leads to the state S' = (M', I') with M(t> M', EFTi' = max(0, EFTi - q), LFTi' = LFTi - q, for all other on-going transitions ti, EFTi' = ai, LFTi' = bi, for all newly enabled transitions ti. Remark: Starting from a state, an infinite number of states can be reached by choosing different q. 107

State classes A state class is a group of states reachable by firing the same transition ti. Class representation: C = (M, D) where M is the marking and D the domain of remaining times of all firable transitions   Canonic form of a class C = (M, D) where D is expressed as follows: ai ≤ ti ≤ bi, for any firable transition ti; tj - tk ≤ gjk, for all couples of firable transitions tj and tk where ai = earliest date of ti ai = latest date of ti gjk = largest difference of tj - tk. 108

State class graph Initial state: M0 = [1000101], 1 ≤ t1 ≤ 6 • t1 fires at q1 • State : M1 = [0111101], 1 ≤ t2 ≤ 6, 2 ≤ t3 ≤ 3, 1 ≤ t5 ≤ 4 Case t2 fires next state class C2 = {M2 = [1011101], D2} D2 = {1 ≤ t1 ≤ 6 (new transition), D2(a) (old transitions)} D2(a) = 1 ≤ t2 ≤ 6 t2 ≤ t3 2 ≤ t3 ≤ 3 t2 ≤ t5 1 ≤ t5 ≤ 4 change of variables by t3 = t2+t3', t5 = t2+t5' 1 ≤ t2 ≤ 6 t2 ≤ t2+t3' 2 ≤ t2 + t3' ≤ 3 t2 ≤ t2+t5' 1 ≤ t2+t5' ≤ 4 Fourier-Motzkin elimination of t2 Fourier-Motzkin elimination D2 = 1 ≤ t1 ≤ 6 0 ≤ t3 ≤ 2 0 ≤ t5 ≤ 3 -2 ≤ t3-t5 1 ≤ t2 ≤ 6 2-t3' ≤ t2 ≤ 3-t3' 1-t5' ≤ t2 ≤ 4-t5' 0 ≤ t3' 0 ≤ t5' 1 ≤ 3- t3' 1  4-t5' 2-t3' ≤ 4-t5' 2-t3' ≤ 6 1-t5' ≤ 6 1-t5' ≤ 3- t3' 0 ≤ t3' 0 ≤ t5' D2(a)= 109

A producer-consumer data transfer protocole prod Ready to send a message p1 Sending a message p2 Arrival of the message at the consumer site cons Consumer reading the message BE Buffer empty BF Buffer full t1 producer sending a message t2 transmission medium t5 message reading t3 normal arrival at an empty buffer t4 Arrival at a full buffer and overwriting existing message (undesired situation) Specification 1 : INT1 = [4, 6], INT2 = [2, 3], INT3 = INT4 = [0, 0], INT5 = [0, 2]. Specification 2 : INT1 = [4, 6], INT2 = [2, 3], INT3 = INT4 = [0, 0], INT5 = [0, 4]. 110

Topics not addressed in Chapters 2-3 Supervisory control with automata theory Color Petri nets Petri net controls Petri net models synthesis 111

Topics not addressed in Chapters 2-3 Supervisory control with automata theory Timed Petri nets Color Petri nets Petri net controls Petri net models synthesis 112