associate professor dr. raed ibraheem hamed

24
Associate Professor Dr. Raed Ibraheem Hamed University of Human Development, College of Science and Technology Computer Science Department 2015 2016

Upload: others

Post on 21-Apr-2022

6 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Associate Professor Dr. Raed Ibraheem Hamed

Associate Professor Dr. Raed Ibraheem Hamed

University of Human Development, College of Science and Technology

Computer Science Department

2015 – 2016

Page 2: Associate Professor Dr. Raed Ibraheem Hamed

What this Lecture is about:

☼ Petri Net as a Graph

☼ Petri Net Components

☼ Example of Petri Net

☼ Petri Net – terminology

☼ Firing a Transition

☼ Petri Net - Transition enabling

☼ Enabling condition

☼ Initial marking

2Department of Computer Science _ UHD

Page 3: Associate Professor Dr. Raed Ibraheem Hamed

Petri Net as a Graph

Department of Computer Science _ UHD 3

A Petri net is a directed graph, in which the nodes

represent transitions (i.e. events that may occur,

signified by bars) and places (i.e. conditions,signified by circles).

Petri net was developed in the early 1960s by Carl Adam Petri’sdissertation from Germany.

Page 4: Associate Professor Dr. Raed Ibraheem Hamed

Petri Net as a Graph

Department of Computer Science _ UHD 4

• Graph contains 2 types of nodes

– Circles (Places)

– Bars (Transitions)

• Petri net has dynamic properties that result from its execution

– Markers (Tokens)

– Tokens are moved by the firing of transitions of the net.

Page 5: Associate Professor Dr. Raed Ibraheem Hamed

Petri Net Components

Department of Computer Science _ UHD 5

Circles (Places)

Bars (Transitions)

Marker (Tokens)

Arcs

Pi

Ti

Page 6: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 6

Place/Transition Net

Page 7: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 7

Place/Transition Net: Example

Page 8: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 8

Example of Petri Net

p2t1p1

Page 9: Associate Professor Dr. Raed Ibraheem Hamed

Petri Net - terminology

Department of Computer Science _ UHD 9

This Petri net has:

• 2 places: p1, p2

• 1 transition: t1

• p1 has 1 token: f(p1) = 1

• p2 has 0 tokens: f(p2) = 0

p2t1p1

Page 10: Associate Professor Dr. Raed Ibraheem Hamed

Firing a Transition

Department of Computer Science _ UHD 10

When a transition tj fires

• Each pi that has an edge from pi to tj removes a

token from pi

• Each pj that has an edge from tj to pj adds a

token to pj

t1p1

p2t1

Page 11: Associate Professor Dr. Raed Ibraheem Hamed

Firing a Transition

Department of Computer Science _ UHD 11

Petri net before t1 fires: Petri net after t1 fires:

p2t1p1 p2t1p1

Page 12: Associate Professor Dr. Raed Ibraheem Hamed

Firing a Transition

Department of Computer Science _ UHD 12

A transition must be enabled before it fires:

There is a token in each input place pi that

has an edge from place to the transition.

p2t1p1 p2t1p1

the transition t1 can fire the transition t1 cannot fire

Page 13: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 13

Petri net before t1 fires: Petri net after t1 fires:

Firing a Transition

Page 14: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 14

Petri Net - Transition enabling - example

car

wheelsmotorcar body

• weight of the P2 - T3

edge is 4

• place P2 contains only 3

3 tokens

• transition T3 is not

enabled (for one car we

need four wheels)

• transition T3 cannot be

fired

T3

4

P4

P1

P2P3

Page 15: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 15

Weighted Petri Nets

• Generalized the original Petri net to allowmultiple tokens to be added/removed when atransition fires.

• The edges are labeled with the weight (i.e.,number of tokens)

• If there is no label, then the default value is 1

Original Petri Nets

Page 16: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 16

Weighted Petri net

before t1 fires:Weighted Petri net

after t1 fires:

Original Petri Nets

Page 17: Associate Professor Dr. Raed Ibraheem Hamed

Firing a transition

Department of Computer Science _ UHD 17

Transitions consume tokens from the input places and produce

tokens in the output places

Page 18: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 18

Enabling condition

Transitions are the active components and places and tokens are passive.

A transition is enabled if each of the input places contains tokens.

t1 t2

Transition t1 is not enabled, transition t2 is enabled.

Page 19: Associate Professor Dr. Raed Ibraheem Hamed

Initial marking

Department of Computer Science _ UHD 19

p2t1p1 p2t1p1

Petri net before t1 fires: Petri net after t1 fires:

Initial marking M0 = {1 , 0}

New marking M1 = {0 , 1}

Page 20: Associate Professor Dr. Raed Ibraheem Hamed

Initial marking

Department of Computer Science _ UHD 20

Initial marking M0 = {1 , 1 , 0}

New marking M1 = {0 , 0 , 1}

fire

Page 21: Associate Professor Dr. Raed Ibraheem Hamed

Initial marking

Department of Computer Science _ UHD 21

2

•P1

P2

P3

P4

P5

2

•P1

P2

P3

P4

P5

Initial marking M0 = {2 , 2 , 1 , 0 , 0}

New marking M1 = {1 , 0 , 0 , 1 , 1}

Page 22: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 22

Petri net example

Page 23: Associate Professor Dr. Raed Ibraheem Hamed

Department of Computer Science _ UHD 23

Example

Page 24: Associate Professor Dr. Raed Ibraheem Hamed

24Department of Computer Science _ UHD

Questions

Thank you