Download presentation

Presentation is loading. Please wait.

Published byNathanael Nurse Modified over 2 years ago

2
1 SE-561 Formal Methods in Software Petri Nets - I

3
2 Petri nets The classical Petri net was invented by Carl Adam Petri in 1962. A lot of research has been conducted (>10,000 publications). Until 1985 it was mainly used by theoreticians. Since the 80-ties the practical use is increasing because of the introduction of high-level Petri nets and the availability of many tools. High-level Petri nets are Petri nets extended with –color (for the modeling of attributes) –time (for performance analysis) –hierarchy (for the structuring of models)

4
3 The classical Petri net model A Petri net is a network composed of places ( ) and transitions ( ). t2 p1 p2 p3 p4 t3 t1 Connections, called arcs, are directed and between a place and a transition. Tokens ( ) are the dynamic objects. The state of a Petri net, called marking, is determined by the distribution of tokens over the places. Initial marking (1, 2, 0, 0)

5
4 Transition t1 has three input places (p1, p2 and p3) and two output places (p3 and p4). Place p3 is both an input and an output place of t1. p1 p2 p3 p4 t1

6
5 Enabling condition Transitions are the active components, while places and tokens are passive. A transition is enabled if each of the input places contains tokens. t1t2 Transition t1 is not enabled, transition t2 is enabled.

7
6 Firing An enabled transition may fire. Firing corresponds to consuming tokens from the input places and producing tokens for the output places. t2 Firing is atomic.

8
7 Example

9
8 Petri Net Structures sequence of events/actions: concurrent execution: t1 t2t3 t1 t2 t3 t4 t5

10
9 Non-determinism Two transitions fight for the same token: conflict. Even if there are two tokens, there is still a conflict. t1 t2 t1 Synchronization

11
10 Modeling States of a process or a system are modeled by tokens in places and state transitions leading from one state to another are modeled by transitions. Tokens represent objects (humans, goods, machines), information, conditions or states of objects. Places represent buffers, channels, geographical locations, conditions or states. Transitions represent events, transformations or transportations.

12
11 Example: Traffic light rg red yellow green yr gy

13
12 Two traffic lights rg1 red1 yellow1 green1 yr1 gy1 rg2 red2 yellow2 green2 yr2 gy2

14
13 Two safe traffic lights rg1 red1 yellow1 green1 yr1 gy1 rg2 red2 yellow2 green2 yr2 gy2 safe

15
14 Two safe and fair traffic lights rg1 red1 yellow1 green1 yr1 gy1 rg2 red2 yellow2 green2 yr2 gy2 safe2 safe1

16
15 Reachability Reachable marking A marking is said to be reachable if it can be reached by firing a sequence of enabled transitions form the initial marking of a Petri net. Petri net token game http://psim.tm.tue.nl/staff/wvdaalst/Downloads/pn_applet/pn_applet.html

17
16 Exercise: readers and writers How many states are reachable? How to model the situation with 2 writers and 3 readers? How to model a "bounded mailbox" (buffer size =4)? rest mail_box receive_mail type_mail ready rest begin send_mail read_mail

18
17 Restaurant Scenario Waiter free Customer 1 Customer 2 Take order Take order Order taken Tell kitchen wait Serve food eating

19
18 A Puzzle: Crossing River A ferry-man has to bring a goat, a cabbage, and a wolf safely from the left bank to the right bank of a river. The ferry-man can cross the river alone or with exactly one of these three passengers. At any time, either the ferry-man should be on the same bank as the goat, or the goat should be alone on a bank. Otherwise, the goat could go ahead and eat the cabbage or the wolf may eat the goat

20
19 Modeling We are going to model the situation with a Petri net. The puzzle mentions the following objects: –Man, wolf, goat, cabbage, boat. The puzzle mentions the following actions: –Crossing the river, wolf eats goat, goat eats cabbage. Objects and their states are modeled by places. Actions are modeled by transitions. Actually, we can omit the boat, because it is always going to be on the same side as the man.

21
20 Places

22
21 Crossing the river (left to right)

23
22 Crossing the river (left to right)

24
23 Crossing the river (left to right)

25
24 Crossing the river (right to left)

26
25 Wolf eats goat

27
26 Formal Definition of a Petri Net A Petri net N is a tuple N = {P, T, I, O, M 0 }, where P is a finite set of places, T is a finite set of transitions, Places P and transitions T are disjoint (P ∩ T = ), I: P × T N ( N = {0, 1, 2, …})is the pre-incidence function representing input arcs, O: T × P N ( N = {0, 1, 2, …})is the post-incidence function representing output arcs, M 0 : P N is the initial marking representing the initial distribution of tokens.

28
27 Example P = {p1, p2} T = {t1, t2, t3} I(t1) = (1, 1), I(t2) = (2, 0), I(t3) = (0, 2) O(t1) = ? M 0 = (3, 2) p2p1 t3t2 t1

29
28 Transition firing A transition t is enabled at marking M i if and only if M i ≥ I(t) Suppose that the firing of t takes the Petri net from M i to M i. Then M j = M i - I(t) + O(t)

30
29 p2p1 t3t2 t1 P = {p1, p2} T = {t1, t2, t3} I(t1) = (1, 1), I(t2) = (2, 0), I(t3) = (0, 2) O(t1) = (1, 0), O(t2) = (0, 1), O(t3) = (0, 1) M 0 = (3, 2) M j = M i - I(t) + O(t)

Similar presentations

OK

Based on: Petri Nets and Industrial Applications: A Tutorial

Based on: Petri Nets and Industrial Applications: A Tutorial

© 2017 SlidePlayer.com Inc.

All rights reserved.

Ads by Google

Ppt on vegetarian and non vegetarian buffet Ppt on pre ignition problems Ppt on electricity for class 10th date Ppt on south african culture music Ppt on indian defence services Ppt on thermal power plants in india Ppt on formal education vs self Ppt on polynomials in maths what is pi Ppt on fourth and fifth state of matter summary Ppt on sea level rise simulation