Petri Nets Lecturer: Roohollah Abdipour. Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2.

Slides:



Advertisements
Similar presentations
School of Computer Science & Software Engineering
Advertisements

Workflow Management Systems © Dr. Rafael A. Calvo – Edited by Mark Aufflick (pumptheory.com) School of Electrical and Information Eng, University of Sydney.
1 SE-561 Formal Methods in Software Petri Nets - I.
An Introduction to Petri Nets
Principles of Engineering System Design Dr T Asokan
Introduction to Petri Nets Hugo Andrés López
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
Interaction Modeling for Testing We would generate the test cases based on our understanding of the interactions that may happen. The source is, again,
6. Deadlocks 6.1 Deadlocks with Reusable and Consumable Resources
Chapter 3 Petri nets Learning objectives : Introduce Petri nets
IE 469 Manufacturing Systems
Discrete Interaction Design Specification Prof. Dr. Matthias Rauterberg Faculty Industrial Design Technical University of Eindhoven
Petri net modeling of biological networks Claudine Chaouiya.
Synthesis of Embedded Software Using Free-Choice Petri Nets.
10. Petri Nets Prof. O. Nierstrasz. Roadmap  Definition: —places, transitions, inputs, outputs —firing enabled transitions  Modelling: —concurrency.
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,
CP — Concurrent Programming 12. Petri Nets Prof. O. Nierstrasz Wintersemester 2005 / 2006.
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.
Data and Knowledge Representation Lecture 6 Qing Zeng, Ph.D.
Models of Computation for Embedded System Design Alvise Bonivento.
1 Petri Nets Marco Sgroi EE249 - Fall 2001 Most slides borrowed from Luciano Lavagno’s lecture ee249 (1998)
Petri Net Modeling for dynamic MM composite Object.
Mata kuliah :K0362/ Matematika Diskrit Tahun :2008
Chapter 3 : Software Process and Other Models Juthawut Chantharamalee Curriculum of Computer Science Faculty of Science and Technology, Suan Dusit University.
02/06/05 “Investigating a Finite–State Machine Notation for Discrete–Event Systems” Nikolay Stoimenov.
PETRINETS Nipun Devlekar Zauja Lahtau. PETRINETS DEFINITION : DEFINITION :  PETRINET (place/ transition net): a formal, graphical, executable technique.
Concurrency: introduction1 ©Magee/Kramer Concurrency State Models and Java Programs Jeff Magee and Jeff Kramer.
程建群 博士(Dr. Jason Cheng) 年03月
From requirements to specification Specification is a refinement of requirements Can be included together as Software Requirements Specifications (SRS)
1 VeriSoft A Tool for the Automatic Analysis of Concurrent Reactive Software Represents By Miller Ofer.
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.
CS6133 Software Specification and Verification
CY2003 Computer Systems Lecture 7 Petri net. © LJMU, 2004CY2003- Week 72 Overview Petri net –concepts –Petri net representation –Firing a transition –Marks.
Stochastic Activity Networks ( SAN ) Sharif University of Technology,Computer Engineer Department, Winter 2013 Verification of Reactive Systems Mohammad.
1 Kyung Hee University Statecharts Spring Kyung Hee University Specifying Objects’ Behaviour  Interaction diagrams show message-passing behaviour.
Generalized stochastic Petri nets (GSPN)
Hardware Design and The Petri Net Abhijit K. Deb SAM, LECS, IMIT, KTH Kista, Stockholm.
Modelling by Petri nets
Ch5: Software Specification. 1 Petri Nets  Introduced by C. Adams Petri in  Widely used in the modeling and analysis of computer systems.  Basic.
CS 5204 Spring 99 1 A Simple Agent A CCS agent is described both by a structural diagram and one or more algebraic equations. The diagram is for readability.
1 Copyright  2001 Pao-Ann Hsiung SW HW Module Outline l Introduction l Unified HW/SW Representations l HW/SW Partitioning Techniques l Integrated HW/SW.
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
Finite State Machines (FSM) OR Finite State Automation (FSA) - are models of the behaviors of a system or a complex object, with a limited number of defined.
Capturing Requirements. Questions to Ask about Requirements 1)Are the requirements correct? 2)Consistent? 3)Unambiguous? 4)Complete? 5)Feasible? 6)Relevant?
Software Systems Verification and Validation Laboratory Assignment 4 Model checking Assignment date: Lab 4 Delivery date: Lab 4, 5.
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
2008/10E-Enterprise Integration - eEI1 Lecture 6 Petri Net Techniques for Modeling Workflows and Their Support of Reuse.
Technology of information systems Lecture 5 Process management.
Process Mining – Concepts and Algorithms Review of literature on process mining techniques for event log data.
Advantages of FSM Their simplicity make it easy for inexperienced developers to implement with little to no extra knowledge (low entry level)
Concurrent Systems Modeling using Petri Nets
Dr. Eng Amr T. Abdel-Hamid
Clockless Computing COMP
Model-Based Testing Model the system
State Machine Diagrams
Workflow Management Systems
CAP 4800/CAP 5805: Computer Simulation Concepts
CAP 4800/CAP 5805: Computer Simulation Concepts
CSCI1600: Embedded and Real Time Software
Introduction to Petri Nets (PNs)
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:

Petri Nets Lecturer: Roohollah Abdipour

Agenda Introduction Petri Net Modelling with Petri Net Analysis of Petri net 2

Introduction Techniques for Evaluating SW / HW: – Simulation – Testing – Deductive Verification – Model Checking 3

Introduction (2) Simulation & Testing: – Needs experiments before system deployment – Simulation is performed on an abstraction of a model of the system – Testing is performed on the real system. – It is very diffucult to evaluate all possible interactions / faults / behaviors / states – 4

Introduction (3) Deductive Verification: – Validate a system’s performance based on deductive rules – Applicable to infinite-state systems – A time-consuming process – Needs expert people with good experiments – Usually is used for critical systems (e.g., security protocols) 5

Introduction (4) Model Checking: – An automated technique to evaluate finite-state systems – Perform a thorough search in the state space of the system in order to determine some properties of the system. 6

Introduction (5) The process of Model Checking: Modeling: Transform a design to formalism (e.g., a state-transition graph of the system) Verification: Perform a thorough search in the state space of the system in order to determine whether some properties of the system are true or not. Is performed automatically 7

Petri Net A ‘Petri Net’ was introduced by a German mathematician and used to model a system – Condition: a Boolean description of the state of the system – Event: an action that depends on the state of the system Petri net is a graphical and mathematical tools for the analysis of discrete event dynamic systems. – The system model is represented by a set of conditions and a set of events – A condition is represented by a place and an event by transition. 8

Petri Net: Building Blocks 9 place counter transition Place for user input Basic Elements PN consists of three types of components: places (circles), transitions (rectangles) and arcs (arrows): –Places represent possible states of the system; –Transitions are events or actions which cause the change of state; And –Every arc simply connects a place with a transition or a transition with a place. arcs inhibitor

Petri Net Building Blocks: An example: 10

Petri Net: Marks (Tokens) A marking M is an assignment of tokens (dots) to places of a petri net. Dots are placed in the circle to represent place in which its condition is satisfied –e.g. a resource is available or operation in a process The marking can be represented as M = (1,1,0) 11

Petri Net: Marks (Tokens) A place can have more than one token and therefore can represent a queue – (e.g. a buffer holding several processes). 12

Petri Net : Firing a transition Executing a marked Petri net causes the number and positions of the token to change. The rules for the execution are: – A transition is enabled if all its input places contain at least one token. – Any enabled transition may fire – Firing of a transition results in one token being removed from each of its input places and being deposited of its output places – Execution halts when there are no enabled transitions. – Each time a transitions fires, the marking of the petri net will change. 13

Petri Net : Example 14

Petri Net: Formal Definition A Petri net (PN) is a 5 tuple PN (P,T,IN,OUT,M) where: P = {p1,p2,....,p~} is a finite set of places, T = {t 1, t 2, …,t n } is a finite set of transitions IN:(PxT)S OUT:(TxP)S M:Marking vector 15

Petri Net: Formal Definition (cont’d) IN are input functions defining directed arcs from places to transitions OUT are output functions defining directed arcs from transitions to places S is a set of all nonnegative integers k such that: If k = 1 a directed arc is drawn without a label If k > 1 a directed arc is drawn with label k. If k = 0 no arc is drawn. 16

Petri Net: Formal Definition (cont’d) An example: 17

Petri Net: Firing Rules for Transitions A specific transition t i is said to be firable or enabled if each input place p i is marked with at least w(p i,t i ) tokens where w(p i,t i ) is the weight of the arc from p i to t i. An enabled transition may or may not fire depending on whether or not the event actually takes place. The firing of an enabled transition t i removes w(p i,t i ) tokens from each input place p i of t i, and adds w(p j,t i ) tokens to each output place p j of t i where w(p i,t i ) is the weight of the arc from input place p i to t i, and w(p j,t i ) is the weight of the arc from t i to output place p j 18

Petri Net: Firing Rules for Transitions 19

Petri Net: Firing Rules for Transitions Firing Examples 20

PN: Firing Rules for Transitions Firing Examples 21

PN: Firing Rules for Transitions Firing of a sequence of transitions: 22

PN: Firing Rules for Transitions Firing of a sequence of transitions: 23

PN: Firing Rules for Transitions Firing of a sequence of transitions: 24

PN: Firing Rules for Transitions Firing of a sequence of transitions: 25

PN: Change of States (1) is denoted by a movement of token(s) (black dots) from place(s) to place(s); and is caused by the firing of a transition. The firing represents an occurrence of the event or an action taken. The firing is subject to the input conditions, denoted by token availability. 26

PN: Change of States (2) A transition is firable or enabled when there are sufficient tokens in its input places. After firing, tokens will be transferred from the input places (old state) to the output places, denoting the new state. Note that the examples are Petri nets representation of a finite state machine (FSM). PNs are much more powerful to model systems beyond FSMs. 27

Modelling with petri net Petri net is mainly used for modelling. –Many systems can be modelled by petri net. The system may be of many different kinds like computer hardware, computer software, physical system and so on. –Petri net is used to model the occurrence of various events and activities in the system. 28

Modelling with petri net Sequential Execution: 29

Modelling with petri net – Concurrency: two events could take place in parallel, without interfering with one another. 30

Modelling with petri net Synchronisation: By having two places as input conditions to the same transition, these two conditions become synchronised. 31

Modelling with petri net Example : Concurrency and Synchronisation 32

Modelling with petri net Confilincts: Two transitions t 1 and t 2 are said to be conflict if either t 1 or t 2 can occur but not both of them, –i.e., when there is one place that is acting as input condition to a number of transitions. –Therefore, only one transition can be fire. 33

Modelling with petri net Merging: 34

Modelling with petri net Example: Font Selection 35 Bold on Bold off User presses bold T1 T2 Italic on User presses italic T3 T4 User presses italic

Modelling with petri net Another Example: a finite-state machine – Consider a vending machine It accepts either nickels or dimes Sells 15c or 20c candy bars The vending machine can hold up to 20c Coin return transitions are omitted the next slides are the state diagram of this vending machine which represented by the Petri net Any finite-state machine (or its state diagram) can be modeled with a state machine. 36

Modelling with petri net Another Example: a finite-state machine 37

© LJMU, 2004CY2003- Week 738 Modelling with petri net Mutual exclusion – Recall: Mutual exclusion is a technique of defining entry and exit code so that at most one process is allowed to access the critical region at the same time. The idea is that no process is allowed to enter the critical region, unless it checks that no other process is executing its own critical region. – Mutual exclusion can be represented in Petri net using conflict.

© LJMU, 2004CY2003- Week 739 Mutual exclusion The place s represents the permission to enter the critical region and there must be token in p 1 and p 2. – If both processes want to enter the critical region simultaneously, then transition t 1 and t 2 are in conflict – i.e., only one of them can fire.

© LJMU, 2004CY2003- Week 740 Producer consumer problem bounded buffer

© LJMU, 2004CY2003- Week 741 Analysis of Petri net Petri nets are capable of modelling a large variety of systems and properly representing the interactions between the various actions which can occur. – The strength of Petri net is its capability to model the system. However, modelling by itself is of little use and its necessary to analyse the modelled system. This could lead to important insights into the behaviour of the modelled system.

© LJMU, 2004CY2003- Week 742 Reachibility Given a Petri net, one would like to know which marking M r can be reached from an initial marking M 0. Example: For the Petri net of the bounded buffer consumer producer problem, M 0 = (1, 0, 1, 0, 0, n) and M 1 = (0, 1, 1, 0, 0, n) – is immediately reachable from the marking of M 0.

© LJMU, 2004CY2003- Week 743 Analysis of Petri net : Safeness A place in a Petri net is safe if the number of tokens in that place never exceeds one. – A petri net is same if all its places are safe. what does this Petri net do? Is it safe?

© LJMU, 2004CY2003- Week 744 Analysis of Petri net : Boundedness A place is k-safe or k-bounded if the number of tokens in that place cannot exceed an integer k. – Therefore a place is 1-bounded is simply a safe place. Example: – The Petri net for the producer/consumer problem with a bounded buffer, is it safe? Bounded? – The Petri net for the producer/consumer problem with a unbounded buffer, is it bounded? Why?

© LJMU, 2004CY2003- Week 745 Analysis of Petri net : Conservation A Petri net with an initial marking M 0, is strictly conservative, – if for all the reachable marking, the total number of tokens in each marking is exactly the same as the initial marking. A Petri net can be used to model resource allocation systems. In this systems some tokens may represents the resources. – Therefore, in such Petri nets conservation is an important property such that resources can neither be created nor destroyed.

© LJMU, 2004CY2003- Week 746 Analysis of Petri net : Liveness Another problem that could occur in resource allocation is deadlock. – A deadlock in a Petri net is a transition (or a set of transition) which cannot fire. – A transition is alive if it is not deadlock. – A transition is live in a marking M if it is potentially fireable in every marking in the Petri net.

© LJMU, 2004CY2003- Week 747 Exercises For the above Petri net, indicate whether each is bounded, live, and conservative or not and show why?

© LJMU, 2004CY2003- Week 748 Summary Petri net – concepts – Petri net representation – Firing a transition – Marks (Tokens) Modeling with Petri net – Events and condition