06.11.2014 Views

GRAFCET and Petri Nets Outline Introduction GRAFCET - EPFL

GRAFCET and Petri Nets Outline Introduction GRAFCET - EPFL

GRAFCET and Petri Nets Outline Introduction GRAFCET - EPFL

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

<strong>Outline</strong><br />

<strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> <strong>Nets</strong><br />

Prof. J.-D. Decotignie<br />

CSEM Centre Suisse d’Electronique et de Microtechnique SA<br />

Jaquet-Droz 1, 2007 Neuchâtel<br />

jean-dominique.decotignie@epfl.ch<br />

introduction<br />

<strong>GRAFCET</strong><br />

GEMMA<br />

<strong>Petri</strong> nets<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 2<br />

© J.-D. Decotignie, 2007<br />

<strong>Introduction</strong><br />

<strong>GRAFCET</strong><br />

Description of process evolution<br />

Description of process interaction<br />

<strong>Petri</strong> nets<br />

Functional specifications<br />

Requirements for automata<br />

<strong>GRAFCET</strong><br />

<br />

<br />

<br />

<br />

<br />

Graphe de Comm<strong>and</strong>e Etape Transition (Step Transition Control<br />

Graph)<br />

2 levels<br />

Functional specification<br />

Operational specification<br />

Described in the international st<strong>and</strong>ard IEC 848 under the name of<br />

function charts<br />

[Dav90] R. David, A. Alla, « <strong>Petri</strong> nets <strong>and</strong> Grafcet", Prentice<br />

Hall, 1992.<br />

R. David, Grafcet: a powerful tool for specification of logic<br />

controllers, IEEE Trans. on Control Systems Technology, vol.<br />

3, Issue 3, Sept. 1995, pp.253 - 268<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 3<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 4<br />

© J.-D. Decotignie, 2007


<strong>GRAFCET</strong><br />

<strong>GRAFCET</strong> - definition<br />

Definition<br />

Evolution rules<br />

Defining actions<br />

Taking time into account<br />

Defining transition conditions<br />

Execution algorithm<br />

Macrostep <strong>and</strong> macroactions<br />

Directed graph derived from PN<br />

Quadruple C = {S, TR, A, M 0 }<br />

N steps s i ∈ S; each step s i may be<br />

active (X i = true) or not (X i =false).<br />

M 0 denotes the set of steps active at startup<br />

L transitions tr i ∈ TR; to each transition is<br />

associated a boolean condition (receptivity)<br />

Steps <strong>and</strong> transitions are linked by arcs a i ∈ A<br />

+ EVOLUTION CONDITIONS<br />

1 L=1<br />

b1<br />

2 L=0<br />

/b1<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 5<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 6<br />

© J.-D. Decotignie, 2007<br />

Exercise - syntax<br />

Exercise - syntax (2)<br />

a<br />

a<br />

a<br />

a<br />

a<br />

b<br />

a<br />

a<br />

A<br />

B<br />

C<br />

D<br />

E<br />

K<br />

L<br />

M<br />

a<br />

a<br />

b<br />

a<br />

b<br />

a<br />

b<br />

a<br />

F<br />

G<br />

H<br />

I<br />

N<br />

O<br />

P<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 7<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 8<br />

© J.-D. Decotignie, 2007


Exercise - syntax (3)<br />

<strong>GRAFCET</strong> – an example<br />

request<br />

Loading place<br />

m<br />

OP<br />

A<br />

B<br />

a<br />

G<br />

D<br />

b<br />

a<br />

b<br />

Q<br />

a<br />

b<br />

R<br />

a<br />

Q<br />

F<br />

O<br />

N<br />

C<br />

T<br />

I<br />

N<br />

A<br />

L<br />

1 Load used / waiting in A<br />

2<br />

3<br />

4<br />

Load requested<br />

Go to right<br />

Arrived at right<br />

loading<br />

Loading terminated<br />

Go to left<br />

Arrived at left<br />

m<br />

Control<br />

part<br />

a b p D G OP<br />

Operative part<br />

(wagon, door,...<br />

O<br />

P<br />

E<br />

R<br />

A<br />

T<br />

I<br />

O<br />

N<br />

A<br />

L<br />

1<br />

2<br />

3<br />

4<br />

m<br />

b<br />

p<br />

a<br />

p<br />

D<br />

OP<br />

G<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 9<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 10<br />

© J.-D. Decotignie, 2007<br />

Evolution Conditions<br />

Evolution Conditions (2)<br />

<br />

Evolution is performed from the initial state defined as M 0 by<br />

clearing transitions according to 5 rules:<br />

all steps immediately preceding the transition must be active, the<br />

transition is then enabled<br />

then, if receptivity is true, the transition may be cleared<br />

all transitions that may be cleared are cleared simultaneously<br />

clearing a transition leads to the activation of all immediately following<br />

steps <strong>and</strong> deactivation of all immediately preceding steps<br />

a step that is activated <strong>and</strong> deactivated remains active<br />

1<br />

(1) a (2) a<br />

2<br />

1<br />

a=1<br />

clearing<br />

3<br />

4<br />

3<br />

(1) a (2) a<br />

5<br />

(3) b (4) b<br />

6<br />

b=1<br />

clearing<br />

5<br />

7<br />

(3) b (4) b<br />

6<br />

(34)<br />

5<br />

b<br />

b=1<br />

clearing<br />

(34)<br />

5<br />

b<br />

7<br />

2<br />

4<br />

6<br />

7<br />

6<br />

7<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 11<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 12<br />

© J.-D. Decotignie, 2007


Exercise - transitions<br />

A. enabled transitions; B. firable transitions if a=1 <strong>and</strong> b=0;<br />

C. state after clearing the transitions when possible<br />

Exercise - transitions (2)<br />

A. enabled transitions; B. firable transitions if a=1 <strong>and</strong> b=0;<br />

C. state after transition when possible<br />

a<br />

A<br />

a<br />

B<br />

/a<br />

C<br />

/a<br />

D<br />

a./b<br />

E<br />

a.b<br />

a<br />

a./b<br />

a./b<br />

a./b<br />

/b<br />

/b<br />

a<br />

I<br />

J<br />

K<br />

L<br />

F<br />

G<br />

H<br />

M<br />

b<br />

N<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 13<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 14<br />

© J.-D. Decotignie, 2007<br />

Conflicts<br />

Exercise: is there a conflict ?<br />

5<br />

(3) a (4) b<br />

6 7<br />

1<br />

a.b<br />

/a.c<br />

4<br />

a.b<br />

a.c<br />

a<br />

7<br />

/a.b<br />

/a./b<br />

5<br />

(3) a./b (4) b<br />

a./b<br />

5<br />

ab<br />

/a.b<br />

2<br />

3<br />

A<br />

5<br />

6<br />

B<br />

8<br />

9<br />

10<br />

C<br />

6<br />

7<br />

6<br />

7<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 15<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 16<br />

© J.-D. Decotignie, 2007


Divider by 2<br />

Examples of logical graphs<br />

(1)<br />

(2)<br />

(3)<br />

(4)<br />

1<br />

2<br />

3<br />

4<br />

a<br />

a'<br />

a<br />

a'<br />

S<br />

S<br />

a<br />

S<br />

↑a<br />

1<br />

(1) ↑a<br />

2 S<br />

(2) ↑a<br />

a<br />

Controlling<br />

system<br />

S<br />

a<br />

m<br />

G<br />

(A)<br />

(1)<br />

(2)<br />

(3)<br />

1<br />

2<br />

3<br />

↑m<br />

D<br />

b<br />

G<br />

a<br />

D<br />

(1) m pressed<br />

b<br />

2 Go to right<br />

(2) Arrived on right<br />

(B)<br />

3 Go to left<br />

1<br />

(3) Arrived on left<br />

(1) ↑m<br />

2 V<br />

1<br />

(2) b<br />

(1) ↑m.a<br />

3<br />

2 V<br />

(3) a<br />

(2) b<br />

1<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 17<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 18<br />

© J.-D. Decotignie, 2007<br />

Example<br />

Increment a counter<br />

reservoir<br />

m<br />

<br />

<br />

<br />

Initial conditions<br />

Tanks empty, valves closed<br />

Sensors <strong>and</strong> actuators<br />

V i , W i = 1 if open<br />

V 1<br />

h i , b i = 1 if level above sensor tank 1<br />

b 1<br />

operations:<br />

W 1<br />

Fill each tank until above h i ,<br />

close valve V i <strong>and</strong> open W i until<br />

level below b i . Procees cannot<br />

be repeated before both tanks<br />

are empty<br />

h 1<br />

h 2<br />

b 2<br />

W 2<br />

tank 2<br />

(1)<br />

(2)<br />

(3)<br />

1<br />

2<br />

3<br />

(C←0)*<br />

=1<br />

↑a<br />

(C←C+1)*<br />

V 2<br />

<strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 20<br />

↑a<br />

a<br />

Stable<br />

situation<br />

(C←0)*<br />

(C←C+1)*<br />

{2} {3} {2} {3}<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 19<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming © J.-D. Decotignie, 2007


Example (cont)<br />

(B)<br />

4 7<br />

(A) 1<br />

(1) ↑m<br />

(1) ↑m<br />

(2)<br />

(3)<br />

2 V 1 5<br />

h 1 (4)<br />

3 W 1 6<br />

/b 1 (5) /b 2<br />

4 7<br />

(6) =1<br />

V 2<br />

h 2<br />

W 2<br />

2<br />

(2)<br />

3<br />

(3)<br />

V 1<br />

h 1<br />

W 1<br />

5<br />

(4)<br />

V 2<br />

h 2<br />

W 2<br />

6<br />

/b 1 (5) /b 2<br />

reservoir<br />

m<br />

V1<br />

V2<br />

h1<br />

b1<br />

tank 1<br />

W1<br />

h2<br />

b2<br />

tank 2<br />

W2<br />

(C)<br />

4 7<br />

(1') ↑m .X 7 (1") ↑m .X 4<br />

(2)<br />

(3)<br />

2<br />

3<br />

V 1<br />

h 1<br />

W 1<br />

/b 1<br />

(1)<br />

1<br />

(4)<br />

(5)<br />

↑m<br />

5<br />

6<br />

2 V 1 5<br />

(2) h 1 (4)<br />

34 W 1if b 1 67<br />

(6) /b 1./b 2<br />

(D)<br />

V 2<br />

h 2<br />

W 2<br />

h 2<br />

/b 2<br />

V 2<br />

W 2if b 2<br />

Taking time into account<br />

5<br />

(2) a<br />

b<br />

6 T=10s<br />

(3) b<br />

a<br />

X 5<br />

X 6<br />

10s<br />

t/6/10s<br />

20s<br />

t/6/20s<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 21<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 22<br />

© J.-D. Decotignie, 2007<br />

Timer behavior<br />

Continuous actions (à niveau)<br />

X i<br />

t/i/Δ<br />

↑t/i/Δ<br />

Δ<br />

Δ Δ Δ Δ<br />

(2)<br />

(3)<br />

5<br />

i<br />

a<br />

b<br />

T=Δ<br />

1<br />

(1) a<br />

2 Action A<br />

(2) b<br />

5<br />

(5)<br />

(6)<br />

6<br />

a<br />

b<br />

X2<br />

action A<br />

a<br />

X6<br />

T=Δ; ActionA<br />

t/6/Δ<br />

if t/6/Δ<br />

b<br />

action A<br />

a<br />

b<br />

3<br />

(3) a<br />

4 Action A<br />

if C<br />

(4) b<br />

a<br />

b<br />

X4<br />

c<br />

action A<br />

7<br />

b<br />

(7) a<br />

X8<br />

Δ 8 T=Δ; ActionA<br />

t/8/Δ<br />

if (t/8/Δ)'<br />

(8) b<br />

action A<br />

a<br />

Δ<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 23<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 24<br />

© J.-D. Decotignie, 2007


Duration of a continuous action<br />

Continuous actions are only defined for stable situations<br />

a<br />

5<br />

b<br />

(2) a<br />

X5<br />

6 Action A X6<br />

(3) b<br />

action A<br />

Pulse shaped actions<br />

c1<br />

3<br />

(2) c1<br />

c2<br />

c3<br />

4 open P*<br />

(3) c2<br />

c4<br />

X3<br />

5<br />

(4)<br />

6<br />

c3<br />

close P*<br />

X4<br />

X5<br />

X6<br />

(5) c4<br />

open P*<br />

close P*<br />

P open<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 25<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 26<br />

© J.-D. Decotignie, 2007<br />

Conditional Pulse Shaped Actions<br />

Actions types<br />

b<br />

(3) a<br />

A* if b=1 when ↑X<br />

3 Action A* if b<br />

3<br />

A* when X 3 =1 as soon as b=1<br />

(4) c<br />

A* when ↑(X 3 .b)<br />

A* if b is ambiguous. Unsufficient notation !!<br />

<br />

We shall not keep this capability<br />

X 3<br />

Continuous actions (à niveau)<br />

unconditional<br />

conditional<br />

Condition is a boolean variable<br />

Condition is based on a timer<br />

Pulse shaped actions<br />

Always unconditional<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 27<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 28<br />

© J.-D. Decotignie, 2007


Exercise: drilling machine<br />

Actions <strong>and</strong> outputs<br />

h<br />

b 1<br />

b 2<br />

b 3<br />

h: upper position<br />

b1: end of approach<br />

b3: end of drilling<br />

High<br />

speed<br />

Working<br />

speed<br />

High<br />

speed up<br />

b1: end of approach<br />

b2: end of deburring<br />

High<br />

speed<br />

Working<br />

speed<br />

h: upper position<br />

High<br />

speed up<br />

b3: end of drilling<br />

Working<br />

speed<br />

High<br />

speed up<br />

E<br />

D<br />

m<br />

Operator or<br />

supervising system<br />

Controlling part<br />

Operative part of the<br />

controlling part<br />

(calculations, timers,..)<br />

C* b<br />

Control part of the<br />

controlling part<br />

(described by the graph)<br />

a A B*<br />

Operative part<br />

(processus to control)<br />

inputs: a,b,m<br />

actions: A, B*, D, C*<br />

outputs: A, B*, D, E<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 29<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 30<br />

© J.-D. Decotignie, 2007<br />

Transition conditions<br />

Events<br />

variables<br />

External boolean variables<br />

Coming from the process or from the external world<br />

relative to time (t/i/Δ)<br />

Internal boolean variables<br />

Relative to the state of a step (Xi)<br />

State of the operative part (of the controlling part)<br />

receptivity R i = C i E i<br />

condition C i = boolean combination of variables<br />

event E i = rising (falling) edge of an external variable (e always<br />

occurring event)<br />

∀a ∈ {0,1} si a(t)=1 when t ∈ [t1, t2[ et t ∈ [t3, t4[<br />

definition 1: ↑a occurs in t1 <strong>and</strong> in t3<br />

definition 2: ↓a occurs in t2 <strong>and</strong> in t4<br />

definition 3: ↑a.b occurs at the same instant as ↑a each time<br />

b=1 at this instant<br />

definition 4: ↑a.↑b occurs when ↑a <strong>and</strong> ↑b occur at the same<br />

instant<br />

Show that<br />

↑a = ↓a' ↑a.a = ↑a ↑a.a' = 0 ↓a.a = 0<br />

↑a.↑a = ↑a ↑a. ↑a' = 0 ↑a.e = ↑a<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 31<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 32<br />

© J.-D. Decotignie, 2007


Graph interpretation<br />

2 persons in front of the same graph <strong>and</strong> assuming the<br />

same sequence of inputs should deduce the same<br />

sequence of outputs.<br />

Asumptions:<br />

2 uncorelated events may not occur at the same time<br />

The graph has enough time to reach a stable state before the<br />

occurrence of the next event<br />

Interpretation Algorithm (without<br />

stability search)<br />

1. Read the state of the inputs<br />

2. evolve (one or more<br />

simultaneous clearings)<br />

3. Execute actions<br />

4. goto 1<br />

a<br />

c<br />

b<br />

(1) ↑b<br />

7 G<br />

(4) c<br />

d<br />

1<br />

(5)<br />

(7)<br />

5<br />

H D<br />

(2)<br />

↑b<br />

c<br />

G<br />

3<br />

↑a<br />

D<br />

(6)<br />

(8)<br />

(3)<br />

6<br />

2<br />

4<br />

=1<br />

d<br />

D<br />

m.a'<br />

G<br />

H<br />

D<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 33<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 34<br />

© J.-D. Decotignie, 2007<br />

Iterated Clearing<br />

Interpretation Algorithm (with<br />

stability search)<br />

4<br />

(1)<br />

5<br />

(2)<br />

6<br />

(3)<br />

a<br />

/b<br />

↑c<br />

4<br />

(1)<br />

5<br />

(2)<br />

6<br />

(3)<br />

↑a<br />

/b<br />

↑c<br />

a<br />

b<br />

c<br />

Stable<br />

situation<br />

{4}<br />

{6}<br />

1. initialization: activation initial step(s), execution of associated<br />

pulse shaped actions; go to 5<br />

2. If an external event Ei occurs, determine the set T 1 of transitions<br />

that can be cleared on Ei; if T 1 ≠∅ goto 3, else modify<br />

conditional actions <strong>and</strong> goto 2<br />

3. Clear transitions that can be. If, after clearing, the state is<br />

unchanged goto 6<br />

4. Execute the pulse shaped actions that are associated to the step<br />

that were activated at step 3 (incl. timers)<br />

5. Determine the set T2 of transitions that can be cleared on<br />

occurrence of e. If T 2 ≠∅, goto 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 35<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 36<br />

© J.-D. Decotignie, 2007


Interpretation Algorithm (with<br />

stability search)(2)<br />

6. A stable situation has been reached<br />

1. Determine the set A 0 of continuous actions that must be<br />

deactivated (incl. conditional actions)<br />

2. Determine the set A 1 of continuous actions that must be<br />

activated (incl. conditional actions)<br />

3. Set to 0 all the actions that belong to A 0 <strong>and</strong> not to A 1 . Set to<br />

1 all the actions that belong to A 1<br />

4. go to 2<br />

Interpretation Algorithm (with<br />

stability search)(3)<br />

stage 1: situation {1,2}<br />

stage 5: (1) (2) et (3) enabled,<br />

cannot be cleared on e, T 2 =∅<br />

stage 6: stable situation {1,2},<br />

A 0 =∅, A 1 = {H,D}<br />

stage 2: m=1, on e, T 1 = {3}<br />

stage 3: clearing (3)<br />

stage 4: no pulse shaped action<br />

stage 5: T 2 =∅<br />

stage 6: A 0 =∅=A 1<br />

stage 2: on ↑a, T 1 = {2}<br />

stage 3: clearing (2)<br />

(1)<br />

↑b<br />

1<br />

7 G<br />

(4) c<br />

(5)<br />

H D<br />

(2)<br />

↑b<br />

stage 4: no pulse shaped action<br />

stage 5: T 2 = {(6)}<br />

stage 3: clearing (6)<br />

stage 4: no pulse shaped action<br />

stage 5: T 2 =∅<br />

stage 6: A 0 = {H,D}, A 1 = {D}<br />

......<br />

3<br />

5 G<br />

(7) c<br />

↑a<br />

D<br />

(6)<br />

(8)<br />

(3)<br />

6<br />

2<br />

4<br />

=1<br />

d<br />

D<br />

m.a'<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 37<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 38<br />

© J.-D. Decotignie, 2007<br />

Non stable cycle<br />

Exercise [Dav90]<br />

1<br />

a'<br />

2<br />

(3) a<br />

(1)<br />

(4)<br />

5 A<br />

4<br />

(5) a'<br />

(6)<br />

b<br />

b'<br />

B<br />

b'<br />

(2)<br />

12<br />

Let H1 <strong>and</strong> H2 be two wagons carrying goods from loading points C1 <strong>and</strong> C2<br />

respectively to an unloaded point D. Variables c1,c2 <strong>and</strong> d correspond to end<br />

of track sensors. They turn to 1 when a wagon is present at the given point.<br />

Variable a1 turns to 1 when the front wheels of wagon H1 are on the tracks<br />

between A1 <strong>and</strong> D (same for a2 if wagon H2 is between A2 <strong>and</strong> D).<br />

If wagon H1 is in C1 <strong>and</strong> if button m1 is pressed, a cycle C1 → D → C1 starts<br />

with a possible wait in A1 until the track common to both wagons is free, then a<br />

wait in D during 100s. Wagon H2 performs the same on C2 → D → C2. The<br />

path C1-D is set when V equals 1, otherwise path C2-D is set.<br />

(3) a<br />

(1)<br />

(4) b<br />

5 A<br />

4 B<br />

(5) a'<br />

(6) b'<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 39<br />

© J.-D. Decotignie, 2007<br />

m1<br />

m2<br />

c1<br />

C1<br />

c2<br />

C2<br />

G1<br />

H1<br />

D1<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 40<br />

© J.-D. Decotignie, 2007<br />

A1<br />

A2<br />

V<br />

G2<br />

H2<br />

D2<br />

d<br />

D


(4)<br />

(5)<br />

4<br />

5<br />

M30<br />

6<br />

Macro-step<br />

A<br />

a.d'<br />

b<br />

G<br />

↑a<br />

32 V1<br />

c<br />

34 D<br />

c'.d<br />

E30 B<br />

S30<br />

b<br />

31 V1<br />

↑a'<br />

33 B<br />

c<br />

(4)<br />

4<br />

↑a<br />

32 V1<br />

c<br />

34 D<br />

c'.d<br />

6<br />

A<br />

a.d'<br />

30 B<br />

30'<br />

(5) b<br />

b<br />

31 V1<br />

↑a'<br />

33 B<br />

c<br />

G<br />

Pseudo macro-step<br />

Represents a set of steps<br />

All arcs do not necessarily go to the same step (no need<br />

for a unique entry step)<br />

All arcs do not necessarily go to the same step (no need<br />

for a unique exit step)<br />

All arcs entering or leaving the pseudo macro-step need<br />

be represented<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 41<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 42<br />

© J.-D. Decotignie, 2007<br />

Pseudo macro-step<br />

1<br />

5<br />

P1<br />

start<br />

end<br />

System stopped<br />

Start of units<br />

2 Normal operations<br />

Stop request<br />

P2 5<br />

end<br />

Stop units<br />

P1<br />

P2<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 43<br />

© J.-D. Decotignie, 2007<br />

1<br />

3<br />

4<br />

start<br />

end<br />

System stopped<br />

Start unit 1<br />

2 Normal operations<br />

Stop request<br />

5<br />

6<br />

end<br />

end<br />

end<br />

Start unit 2<br />

Stop unit 1<br />

Stop unit 2<br />

restart<br />

restart<br />

Macro actions<br />

Globaly act on a <strong>GRAFCET</strong><br />

Do not increase the expression power<br />

But ease specification<br />

Exhibit same properties as actions<br />

Continuous<br />

Forçage(forcing), figeage(freezing), masquage(masking)<br />

Pulse shaped<br />

Forcer (force), masquer(mask), démasquer(unmask), figer(freeze),<br />

libérer(release)<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 44<br />

© J.-D. Decotignie, 2007


Macroaction: Forcing (Forçage)<br />

Macroaction: Freezing (Figeage)<br />

11<br />

11<br />

11<br />

11<br />

5<br />

d<br />

forçage<br />

G2:{12}<br />

d'<br />

G 1 G 2<br />

a<br />

12 A<br />

b<br />

13 B*<br />

/a<br />

⇔<br />

d<br />

5<br />

d'<br />

G 12<br />

12 A<br />

13<br />

a<br />

b./X 5<br />

/a<br />

B*<br />

X 5<br />

X 5<br />

X 5<br />

<strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 46<br />

6<br />

d<br />

d'<br />

figeage G2<br />

G 1 G 2<br />

12 A<br />

13<br />

a<br />

b<br />

/a<br />

B*<br />

⇔<br />

d<br />

6<br />

d'<br />

G 12<br />

a./X 6<br />

12 A<br />

b./X 6<br />

13 B*<br />

/a./X 6<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 45<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming © J.-D. Decotignie, 2007<br />

Macroaction: Masking (Masquage)<br />

Macrocaction : Force (Forcer)<br />

11<br />

11<br />

11<br />

11<br />

a<br />

a<br />

a<br />

↑X 4<br />

a<br />

↑X 4<br />

7<br />

d<br />

Masquage<br />

G2:{A}<br />

d'<br />

G 1 G 2<br />

12 A<br />

b<br />

13 B*<br />

/a<br />

⇔<br />

d<br />

7<br />

d'<br />

G 12<br />

12 A if /X 7<br />

b<br />

13 B*<br />

/a<br />

4<br />

d<br />

forcer<br />

G2:{12}<br />

d'<br />

G 1 G 2<br />

12 A<br />

b<br />

13 B*<br />

/a<br />

⇔<br />

d<br />

4<br />

d'<br />

G 12<br />

12 A<br />

b<br />

13 B*<br />

/a<br />

↑X 4<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 47<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 48<br />

© J.-D. Decotignie, 2007


<strong>Outline</strong><br />

GEMMA<br />

introduction<br />

<strong>GRAFCET</strong><br />

GEMMA<br />

<strong>Petri</strong> nets<br />

Guide d'Etude des Modes de Marche et d'Arrêt<br />

Problems with <strong>GRAFCET</strong><br />

Objectives<br />

Concepts<br />

How to use GEMMA<br />

Advantages<br />

Drawbacks<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 49<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 50<br />

© J.-D. Decotignie, 2007<br />

Problems with <strong>GRAFCET</strong><br />

Objectives of GEMMA inventors<br />

<strong>GRAFCET</strong> is good to describe normal operation but:<br />

Not well suited to describe<br />

Emergency cases<br />

Manual modes<br />

Degraded modes<br />

Does not favor a good separation of operating modes<br />

Does not give a clear vocabulary concerning modes<br />

Does not include any security aspect<br />

Create a graphical tool that can deal with:<br />

Emergency cases<br />

Manual modes<br />

Degraded modes<br />

Estblish a precise vocabulary<br />

Tool show present itself as a guide (checklist)<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 51<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 52<br />

© J.-D. Decotignie, 2007


GEMMA concepts<br />

Assumes that controlling part is operational<br />

Separate production states from other states<br />

Distinguishes 3 categories of operating modes<br />

Working procedures<br />

Stopping procedures<br />

Failure procedures<br />

control<br />

part<br />

power<br />

off<br />

control<br />

part<br />

power<br />

off<br />

PC<br />

power<br />

on<br />

CP<br />

power<br />

off<br />

PC<br />

power<br />

on<br />

CP<br />

power<br />

off<br />

A<br />

A6<br />

D1<br />

<br />

A7<br />

D2<br />

<br />

A1 <br />

D3<br />

A4<br />

<br />

A5 <br />

F<br />

PRODUCTION<br />

F4<br />

<br />

F5<br />

<br />

F6<br />

WORKING PROCEDURES<br />

<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 53<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 54<br />

© J.-D. Decotignie, 2007<br />

How to use GEMMA<br />

Example – joint test bed<br />

Selection of modes<br />

Showing relationships<br />

Search for evolution conditions<br />

<br />

<br />

<br />

3 tested values V, C, β<br />

Long tests on a typical run<br />

Periodic request for withdraw<br />

<strong>and</strong> check<br />

ß<br />

cardan<br />

V C β<br />

Frein couple C<br />

on off ack AU<br />

moteur<br />

vitesse V<br />

Verrin pour réglage<br />

angle ß<br />

man.<br />

auto<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 55<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 56<br />

© J.-D. Decotignie, 2007


partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

mise hors<br />

énergie<br />

de PC<br />

mise en<br />

énergie<br />

de PC<br />

mise hors<br />

énergie<br />

de PC<br />

A<br />

PROCEDURES D'ARRET DE LA PARTIE OPERATIVE (PO)<br />

A6 <br />

all setpoints to 0<br />

<br />

power on OP,<br />

clear default<br />

D2<br />

<br />

en fin de dans état<br />

clear setpoints<br />

cycle> déterminé><br />

end of tests<br />

or<br />

end for check<br />

stop<br />

stop<br />

²V/V or<br />

²C/C or<br />

²ß/ß>10%<br />

ack<br />

from any<br />

state<br />

F1<br />

F<br />

F2 <br />

time<br />

setup<br />

auto.marche<br />

PROCEDURES DE FONCTIONNEMENT<br />

< production normale><br />

TEST according to<br />

program<br />

<br />

PRODUCTION<br />

Em.Stop or Vmax or Cmax exceeded<br />

Détection<br />

défaillances<br />

F PROCEDURES DE FONCTIONNEMENT<br />

F4<br />

<br />

check<br />

feedback<br />

loops for V, C<br />

<strong>and</strong> ß by<br />

displaying min<br />

<strong>and</strong> max<br />

performances<br />

Tests with<br />

display of<br />

setpoints<br />

V,C <strong>and</strong> ß<br />

[duration<br />

test]<br />

F6<br />

<br />

Example – valve test<br />

C<br />

C<br />

E<br />

z y<br />

D<br />

z y<br />

D<br />

A<br />

x V<br />

Before feeding<br />

B<br />

x<br />

V<br />

After feeding<br />

B<br />

E<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 57<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 58<br />

© J.-D. Decotignie, 2007<br />

GUIDE DES MODES DE MARCHE ET D'ARRET (GEMMA)<br />

GUIDE DES MODES DE MARCHE ET D'ARRET (GEMMA)<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

A<br />

PROCEDURES D'ARRET DE LA PARTIE OPERATIVE (PO)<br />

A6 <br />

par boutons poussoirs<br />

avec les sécurités<br />

b+ si e- et a+ si /z /y<br />

D2<br />

A7<br />

<br />

CI<br />

A1<br />

<br />

<br />

A4<br />

dem<strong>and</strong>e<br />

de marche<br />

F<br />

F2 <br />

PROCEDURES DE FONCTIONNEMENT<br />

F3<br />

<br />

F4<br />

<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

A<br />

PROCEDURES D'ARRET DE LA PARTIE OPERATIVE (PO)<br />

A6 <br />

par boutons poussoirs<br />

avec les sécurités<br />

b+ si e- et a+ si /z /y<br />

A7<br />

<br />

A1<br />

<br />

<br />

A4<br />

/m2<br />

m2<br />

dem<strong>and</strong>e<br />

de marche<br />

F<br />

F2 <br />

PROCEDURES DE FONCTIONNEMENT<br />

F3<br />

<br />

F4 <br />

par boutons<br />

poussoirs avec<br />

les sécurités<br />

b+ si e- et<br />

a+ si /y /z<br />

mise hors<br />

énergie<br />

de PC<br />

<br />

PRODUCTION<br />

dem<strong>and</strong>e<br />

d'arrêt<br />

F1<br />

< production normale><br />

F5<br />

<br />

F5<br />

<br />

D3<br />

<br />

PRODUCTION<br />

D PROCEDURES EN DEFAILLANCE DE LA PARTIE OPERATIVE<br />

Détection<br />

défaillances<br />

F<br />

PRODUCTION<br />

F6 <br />

cycle de test<br />

du dispositif<br />

de contrôle<br />

d'étanchéité<br />

PROCEDURES DE FONCTIONNEMENT<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

mise hors<br />

énergie<br />

de PC<br />

D2


GUIDE DES MODES DE MARCHE ET D'ARRET (GEMMA)<br />

GUIDE DES MODES DE MARCHE ET D'ARRET (GEMMA)<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

A<br />

PROCEDURES D'ARRET DE LA PARTIE OPERATIVE (PO)<br />

A6 <br />

par boutons poussoirs<br />

avec les sécurités<br />

b+ si e- et a+ si /z /y<br />

A7<br />

<br />

CI<br />

A1<br />

<br />

<br />

A4<br />

m1<br />

dem<strong>and</strong>e<br />

de marche<br />

F<br />

F2 <br />

PROCEDURES DE FONCTIONNEMENT<br />

F3<br />

<br />

F4<br />

<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

A<br />

PROCEDURES D'ARRET DE LA PARTIE OPERATIVE (PO)<br />

A6<br />

<br />

par boutons poussoirs<br />

avec les sécurités<br />

b+ si e- et a+ si /z /y<br />

A7<br />

D2<br />

<br />

CI<br />

A1<br />

<br />

<br />

A4<br />

T<br />

m2<br />

/m2<br />

m1<br />

dem<strong>and</strong>e<br />

de marche<br />

F<br />

F2<br />

<br />

PROCEDURES DE FONCTIONNEMENT<br />

F3<br />

<br />

F4 <br />

par boutons<br />

poussoirs avec<br />

les sécurités<br />

b+ si e- et<br />

A1 si /z /y<br />

mise hors<br />

énergie<br />

de PC<br />

Fcyraz<br />

<br />

PRODUCTION<br />

dem<strong>and</strong>e<br />

d'arrêt<br />

F1<br />

< production normale><br />

cycle de contrôle de<br />

l'étanchéité des soupapes<br />

F5<br />

<br />

cycle de contrôle de<br />

l'étanchéité des soupapes<br />

F5<br />

<br />

D3<br />

coupure de l'alimentation de la partie<br />

opérative PO<br />

<br />

PRODUCTION<br />

D PROCEDURES EN DEFAILLANCE DE LA PARTIE OPERATIVE<br />

Détection<br />

défaillances<br />

Système de test d'étanchéité de soupapes: arrêt d'urgence<br />

PRODUCTION<br />

F6 <br />

F PROCEDURES DE FONCTIONNEMENT<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 61<br />

© J.-D. Decotignie, 2007<br />

AU<br />

partie<br />

comm<strong>and</strong>e<br />

hors<br />

énergie<br />

mise en<br />

énergie<br />

de PC<br />

mise hors<br />

énergie<br />

D2


How to manage an automation<br />

project<br />

Phases according to GEMMA tenants<br />

Define requirements<br />

Use GEMMA for start/stop operations<br />

Create <strong>GRAFCET</strong><br />

Select control technology<br />

Technological realization<br />

Trial <strong>and</strong> commissioning<br />

<strong>Outline</strong><br />

introduction<br />

<strong>GRAFCET</strong><br />

GEMMA<br />

<strong>Petri</strong> nets<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 65<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 66<br />

© J.-D. Decotignie, 2007<br />

<strong>Petri</strong> nets<br />

<strong>Petri</strong> <strong>Nets</strong><br />

<br />

<br />

<br />

<br />

<br />

Invented by C. <strong>Petri</strong> in 1962 in his PhD thesis ("Kommunikation<br />

mit Automaten)<br />

J. Peterson, "<strong>Petri</strong> Net Theory <strong>and</strong> the Modelling of Systems",<br />

Prentice Hall, 1981.<br />

R. David, A. Alla, "Du Grafcet aux réseaux de <strong>Petri</strong>", Hermes,<br />

1990.<br />

T. Murata, <strong>Petri</strong> nets: Properties, analysis <strong>and</strong> applications, Proc.<br />

of the IEEE, Vol. 77 (4), April 1989, pp.541 - 580<br />

2 view points<br />

Theoretical<br />

Definitions <strong>and</strong> evolution rules<br />

Properties<br />

Application to functional specifications<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 67<br />

© J.-D. Decotignie, 2007<br />

Definition<br />

Marking<br />

PN types<br />

Modelling with <strong>Petri</strong> nets<br />

Modelling synchronization <strong>and</strong> cooperation between<br />

tasks<br />

Design<br />

Analysis <strong>and</strong> validation<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 68<br />

© J.-D. Decotignie, 2007


<strong>Petri</strong> nets - definition<br />

<strong>Petri</strong> net example<br />

Directed graph<br />

tuple C={P, T, I, O}<br />

N places p i ∈ P<br />

L transitions t i ∈ T<br />

Input matrix I [LxN]<br />

places → transitions<br />

Output matrix O [LxN]<br />

transitions → places<br />

p 1 p 2 p 3<br />

t 1<br />

p 4 p 5<br />

I=<br />

O=<br />

P = {p 1 , p 2 , p 3 , p 4 , p 5 }<br />

T = {t 1 , t 2 }<br />

p 1 p 2 p 3 p 4 p 5<br />

1 1 2 0 0 t 1<br />

0 0 0 0 1 t 2<br />

p 1 p 2 p 3 p 4 p 5<br />

0 0 0 1 2 t 1<br />

0 0 1 0 0 t 2<br />

p 1 p 2 p 3<br />

2<br />

t 1 t 2<br />

2<br />

p 4 p 5<br />

#(p i , I(t j )) weight of arc p i → t j<br />

#(p i , O(t j )) weight of arc t j → p i<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 69<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 70<br />

© J.-D. Decotignie, 2007<br />

<strong>Petri</strong> nets - marking<br />

PN – evolution rules<br />

marking<br />

M = {m(p 1 ),....., m(p i ), ....., m(p N )}<br />

with m(p i ) = number of tokens<br />

in place p i<br />

Initial marking M 0 ,<br />

example M 0 ={2,1,3,0,1}<br />

Evolution by firing transitions<br />

Can then represent behavior (dynamic)<br />

p 1 p 2 p 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 71<br />

© J.-D. Decotignie, 2007<br />

t 1<br />

t 2<br />

2<br />

p 4 p 5<br />

2<br />

a transition t i may be fired iif for all i<br />

m(p i ) ≥ #(p i , I(t j ))<br />

Only one transition may fired at a time<br />

A transition is fired instantaneously by:<br />

Removing in each place that immediately preceeds the transition<br />

a number of tokens equal the weight of arc that links them<br />

Adding in each place that immediately follows the transition a<br />

number of tokens equal the weight of arc that links them<br />

m(p i ) := m(p i ) - #(p i , I(t j )) + #(p i , O(t j ))<br />

EVOLUTION IS NOT DETERMINISTIC<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 72<br />

© J.-D. Decotignie, 2007


Evolution rules<br />

p 1 p 2 p 3<br />

2<br />

Exercise - syntax<br />

For each of the graphs below, answer the following questions:<br />

1. Is it a PN ? 2. What are the validated transitions ?<br />

3. What will be the marking after firing ? 4. What are the validated transitions<br />

t 1<br />

t 2<br />

2<br />

p 4 p 5<br />

p 1 p 2 p 3<br />

p 1 p 2 p 3<br />

A B C D E<br />

2<br />

2<br />

t 1<br />

t 2<br />

t 1<br />

t 2<br />

2<br />

2<br />

p 4 p 5<br />

p 4 p 5<br />

F G H I<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 73<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 74<br />

© J.-D. Decotignie, 2007<br />

Exercise – syntax (2)<br />

PN types<br />

For each of the graphs below, answer the following questions:<br />

1. Is it a PN ? 2. What are the validated transitions ?<br />

3. What will be the marking after firing ? 4. What are the validated transitions<br />

Generalized PNs<br />

There a weight on each arc<br />

Can be transformed into ordinary PN<br />

PNs with predicates<br />

Cannot be transformed into ordinary PN<br />

J K L<br />

Marc<br />

X<br />

Y father of X t 1<br />

Y<br />

X<br />

t 1<br />

Y<br />

Luc<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 75<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 76<br />

© J.-D. Decotignie, 2007


PN types (2)<br />

PN types (3)<br />

PNs with capacity<br />

Can be<br />

transformed<br />

into ordinary PN<br />

t 1<br />

p 2<br />

t 2<br />

p 2<br />

t 1 fired t 1 fired<br />

t 1<br />

t 1<br />

t 1<br />

cap(p 2 )=2<br />

t 2<br />

t 2<br />

t 2<br />

t 1 fired t 1 fired<br />

t 1<br />

t 1<br />

p 2 ' p 2 ' p 2 '<br />

t 2<br />

t 2<br />

Colored PNs<br />

Tokens have colors<br />

Any colored PN with a finite number of colors may be<br />

transformed into an ordinary PN<br />

PNs with priorities<br />

Cannot be transformed into ordinary PN<br />

Continuous PNs<br />

The number of tokens can be a real number<br />

Cannot be transformed into ordinary PN<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 77<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 78<br />

© J.-D. Decotignie, 2007<br />

PN types (4)<br />

Exercise<br />

PNs with inhibiting arcs<br />

Cannot be transformed into<br />

ordinary PNs<br />

No autononous PNs<br />

Several types<br />

Synchronized PNs<br />

Time PNs<br />

Stochastic PNs<br />

Stochastic Time PNs<br />

....<br />

Cannot be transformed into ordinary PNs<br />

p 1 p 2 p 3<br />

t 1<br />

p 4 p 5<br />

2<br />

2<br />

t 2<br />

Transform this PN into an ordinary PN<br />

t 1 p 1<br />

p 2<br />

t 2<br />

cap(p 3 )=3<br />

t 3<br />

p 3 t 5<br />

t 4<br />

p 4<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 79<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 80<br />

© J.-D. Decotignie, 2007


Modelling with PNs<br />

Conditions « <strong>and</strong>" & « or"<br />

actions associated to places<br />

Activated by token presence<br />

actions associated to<br />

transitions (short duration)<br />

Activated by transition<br />

firing<br />

Task<br />

waiting<br />

Start of<br />

execution<br />

executing p 3<br />

End of<br />

execution<br />

Tasked<br />

ended<br />

p 1 p 2<br />

p 4<br />

Processor<br />

free<br />

type "AND" type "OR"<br />

p 1 p 2 p 3<br />

p 1 p 2 p 3<br />

x 1 x 2 x 3<br />

x 1 x 2 x 3<br />

y<br />

p 4<br />

t 1<br />

t 1<br />

p 4<br />

t<br />

t 3<br />

2<br />

y<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 81<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 82<br />

© J.-D. Decotignie, 2007<br />

<strong>Introduction</strong> of external conditions<br />

When synchronisation is required<br />

controlled system →<br />

controlling system<br />

Label on the transition<br />

(if condition, action)<br />

Transition may be fired iif<br />

external condition satisfied<br />

Timers (extern or<br />

minimal sejourn duration in a place)<br />

Task<br />

waiting<br />

(.,begin_exec)<br />

executing<br />

p 3<br />

(end_exec,.)<br />

Task<br />

terminated<br />

p 1 p 2<br />

p 4<br />

Processor<br />

free<br />

<strong>Introduction</strong> of external conditions<br />

(2)<br />

Task<br />

waiting<br />

(.,begin_exec)<br />

executing<br />

p 3<br />

(end_exec,.)<br />

Task<br />

terminated<br />

p 1 p 2<br />

p 4<br />

Processor<br />

free<br />

p 13<br />

p 14<br />

t 11<br />

p 17<br />

(.,end_exec)<br />

p 11<br />

t 12 t 13<br />

(begin_exec, .)<br />

p 15<br />

t 14<br />

t 15<br />

p 16<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 83<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 84<br />

© J.-D. Decotignie, 2007


<strong>Introduction</strong> of external conditions<br />

(3)<br />

p 1<br />

Modelling task synchronisation<br />

mechanisms<br />

Mutual synchronisation (rendez-vous)<br />

t 1<br />

(.,start_timer)<br />

A<br />

A 1<br />

A 2<br />

t 2<br />

p 3<br />

(end_timer,.)<br />

timer<br />

A 1<br />

t 2 t 3<br />

t 1<br />

B 1<br />

B B 1<br />

A<br />

A 1<br />

OR<br />

B 2<br />

A 2<br />

A 2 B 2<br />

p 4<br />

B B 1<br />

B 2<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 85<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 86<br />

© J.-D. Decotignie, 2007<br />

Modelling task synchronisation<br />

mechanisms(2)<br />

Modelling task synchronisation<br />

mechanisms(3)<br />

mailbox<br />

A 1<br />

t 2 t 3<br />

t 1<br />

A 2 B 2<br />

B 1<br />

A<br />

A 1<br />

B B 1<br />

A 2<br />

B 2<br />

Interrupt driven task<br />

As an external<br />

condition<br />

on a transition<br />

t<br />

Interrupt h<strong>and</strong>ler 1<br />

modeled using<br />

2 places<br />

A<br />

p 3<br />

t 5<br />

t 2<br />

B<br />

p 4<br />

(interrupt,...) t 3 (interrupt,...)<br />

p 2<br />

B p 1<br />

t 4<br />

t 6<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 87<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 88<br />

© J.-D. Decotignie, 2007


Modelling task synchronisation<br />

mechanisms (4)<br />

Mutual exclusion through semaphore<br />

Mutual exclusion<br />

Modeled by a single<br />

token<br />

P(S): AND condition on<br />

a transition<br />

V(S): OR condition on<br />

a transition<br />

Critical section<br />

synchronized by an auxiliary<br />

place<br />

P(S)<br />

V(S)<br />

t 11<br />

t 1<br />

S<br />

S<br />

p 1<br />

p 1<br />

Task<br />

waiting<br />

t 1<br />

Critical<br />

section<br />

t 3<br />

p 0<br />

p 3<br />

p 5<br />

S<br />

p 1<br />

p 2<br />

t 2<br />

p 4<br />

t 4<br />

Task<br />

waiting<br />

p 6<br />

Critical<br />

section<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 89<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 90<br />

© J.-D. Decotignie, 2007<br />

Readers – writers problem<br />

Producers - consumers<br />

READERS<br />

WRITERS<br />

PRODUCERS<br />

CONSUMERS<br />

Task<br />

waiting<br />

p 0<br />

Task<br />

waiting<br />

p 3<br />

p 5<br />

s<br />

t 1<br />

p 1<br />

t 2<br />

t 3<br />

messages<br />

t 2<br />

p 2<br />

reading p 3 S s p 4 writing<br />

t 3<br />

t<br />

s 4<br />

p 5 p 6<br />

production p 4<br />

p 1<br />

t 1 s p 2<br />

positions<br />

p 6<br />

t 4<br />

use<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 91<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 92<br />

© J.-D. Decotignie, 2007


Dining Philosophers<br />

t 7<br />

Exercise<br />

t 8<br />

eat p 11<br />

t 4<br />

p 4<br />

p 5<br />

p 10 p 6<br />

t 1<br />

p 7<br />

p 1<br />

meditate<br />

p 8<br />

t 2<br />

p 3<br />

p 2<br />

t 3<br />

p 12<br />

t 6<br />

<br />

A consulate let its clients enter then the entrance door is closed<br />

<strong>and</strong> the client may be served. After being served, each client<br />

leaves the consulate through another door. The entrance door<br />

cannot be opened again before all the clients have left.<br />

Design a PN with inhibitor arcs that represents this specification<br />

Modify the first solution so that only one client may enter at a time<br />

Describe the same case using an ordinary PN<br />

A maximum of 4 clients may enter before the door is closed. Model this<br />

case using an ordinary PN<br />

p 13<br />

p 5<br />

t 5<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 93<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 94<br />

© J.-D. Decotignie, 2007<br />

Design <strong>and</strong> validation<br />

<strong>Petri</strong> nets properties<br />

<strong>Petri</strong> nets properties<br />

Design by successive refinements<br />

Analysis by reduction<br />

Structural properties<br />

Are only dependent on the topology<br />

Behavioral properties<br />

Depend on the initial marking<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 95<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 96<br />

© J.-D. Decotignie, 2007


Structural properties<br />

Structural properties (2)<br />

State graph<br />

Event graph<br />

Without conflict<br />

Free choice<br />

Extended free choice<br />

simple<br />

pure<br />

Without loop<br />

State graph<br />

iif each transition<br />

has exactly one input<br />

<strong>and</strong> one output place<br />

Event graph<br />

iif each place<br />

has exactly one input<br />

<strong>and</strong> one output<br />

transition<br />

p k<br />

p 1<br />

p 1<br />

t i<br />

t i<br />

p 2 p 3 p 2<br />

t i<br />

t 1 t 3<br />

p 1<br />

t j<br />

t 2<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 97<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 98<br />

© J.-D. Decotignie, 2007<br />

Structural properties (3)<br />

Structural properties (4)<br />

Without conflit<br />

Each place has at most<br />

one output transition<br />

simple<br />

Each transition is<br />

involved in at most<br />

one conflict<br />

p 3<br />

p 3 p 2<br />

t 1<br />

t 2<br />

p 4<br />

p 3<br />

t 2<br />

p 3<br />

t 1 t 2<br />

t 1<br />

p 4<br />

t 2<br />

Free choice<br />

In case of conflict,<br />

< p j , {t 1 , t 2 ,..}><br />

none of the transitions<br />

has another input place<br />

than p j<br />

Extended free choice<br />

In case of conflict, all<br />

the involved transitions<br />

have the same input places<br />

p 3<br />

t 1<br />

p 3<br />

t 1<br />

t 2<br />

p 3<br />

p 4<br />

t 2<br />

t 1<br />

p 4<br />

t 2<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 99<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 100<br />

© J.-D. Decotignie, 2007


Structural properties (5)<br />

Exercise - properties<br />

Pure PN<br />

p 3<br />

There is no transition<br />

that has an input<br />

place that is also an<br />

output place<br />

Without loop<br />

If there exists t j <strong>and</strong> p i that<br />

is at the same time input<br />

<strong>and</strong> output place for t j<br />

then t j has at least another<br />

input place<br />

t 1<br />

p 3<br />

p 3 t 1<br />

p 4<br />

t 1 '<br />

p 4 p 0<br />

t 1 ''<br />

For each PN below, respond to the following questions:<br />

1. Is it a state graph ? 2. Is it an event graph ?<br />

3. Is it without conflict ? 4. It is simple ?<br />

5. Is it pure ? 6. Is it without loop ?<br />

p 1<br />

t 1<br />

p 2<br />

t 2<br />

p 1 t 1<br />

p 2<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 101<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 102<br />

© J.-D. Decotignie, 2007<br />

Behavioral properties<br />

Reachability<br />

Reachability<br />

Boundedness<br />

Conservativeness<br />

Liveness<br />

Reversibility, home state<br />

Coverability<br />

Persistence<br />

Synchronic distance<br />

Fairness<br />

Can the system reach a given state or exhibit a given<br />

behavior (correct or not) ?<br />

To answer this question, one has to find a sequence of firing<br />

that brings from M 0 to M i<br />

A marking M i is said reachable from M 0 , if there exists a<br />

sequence of firings that transforms M 0 in M i<br />

M i is said immediately reachable from M 0 , if there is a unique<br />

firing that transforms M 0 en M i<br />

R(M 0 ): set of all reachable markings from M 0<br />

L(M 0 ): set of all firing sequences from M 0<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 103<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 104<br />

© J.-D. Decotignie, 2007


Bounded <strong>and</strong> safe<br />

Bounded <strong>and</strong> safe (2)<br />

Places are often used to represent:<br />

Information storage in communication systems <strong>and</strong> computers<br />

Products <strong>and</strong> tools in production systems<br />

The boundedness property is useful to detect overflows<br />

in resource usage<br />

A PN is said k-bounded if the number of tokens<br />

whichever the place does not exceed k for all markings<br />

in R(M 0 )<br />

A PN is said safe if k=1 (1-bounded)<br />

p 1<br />

t 1<br />

p 3 p 2<br />

t 2<br />

p 4<br />

t 3<br />

p 1<br />

t 1<br />

p 3 p 2<br />

t 2<br />

p 4<br />

t 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 105<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 106<br />

© J.-D. Decotignie, 2007<br />

Exercise<br />

Conservativeness<br />

2 tasks T1 <strong>and</strong> T2 execute on the same processeur in<br />

time sharing (part of T1 is executed, then part of T2 is,<br />

then part of T1, …)<br />

Model the same behavior with 4 tasks<br />

Is the resulting PN bounded ?<br />

In a real system, the number of resources is limited. If<br />

tokens represent resources, it may be a desired properties<br />

that the number of tokens remains constant whichever<br />

the marking in R(M 0 )<br />

A PN is said strictly conservative if the number of tokens is<br />

constant<br />

A PN is said conservative if there exists a weighting vector<br />

w=[w 1 ,....., w i , ....., w N ] such that for each marking in R(M 0 ),<br />

∑w i m(p i ) remains constant.<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 107<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 108<br />

© J.-D. Decotignie, 2007


Conservativeness - example<br />

Liveness<br />

p 1<br />

t 1<br />

t 3<br />

p 3 p 2<br />

p 3<br />

t 2<br />

p 4<br />

PRODUCERS<br />

t 3 messages<br />

production p 4<br />

p 1<br />

t 1 s p 2<br />

positions<br />

CONSUMERS<br />

p 5<br />

t 2<br />

p 6 use<br />

t 4<br />

The idea of liveness is closely related to blocking <strong>and</strong><br />

interblocking cases<br />

Necessary conditions (all 4 together)<br />

Limited access<br />

Resources can only be shared by a finite number of tasks<br />

No preemption<br />

Once allocated, a resource cannot be withdrawn from the task<br />

Multiple requests<br />

Tasks already own resources when they additional resource requests<br />

The request graph has circular paths<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 109<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 110<br />

© J.-D. Decotignie, 2007<br />

Liveness (2)<br />

Liveness - example<br />

A transition t of a PN is said :<br />

L0-live (dead) if t does not belong to any sequence of L(M 0 )<br />

L1- live (potentialy firable) if t may fired at least once in a<br />

sequence of L(M 0 )<br />

L2- live if t may be fired k times (k integer >1) in a sequence<br />

of L(M 0 )<br />

L3- live if t may be fired an infinite number of times in a<br />

sequence of L(M 0 )<br />

L4- live (live) if t is L1- live for any marking in R(M 0 )<br />

live<br />

p 1<br />

t 1<br />

t 3<br />

p 2<br />

t 2 , t 3 are L1, L2 et L3<br />

live<br />

t 1 is L1 live<br />

t 2<br />

p 3<br />

p 1<br />

t 3<br />

p 2<br />

t 2<br />

t 1<br />

p 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 111<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 112<br />

© J.-D. Decotignie, 2007


Exercise<br />

Reversibility <strong>and</strong> home state<br />

2 computers share a common memory. It is assumed that<br />

each computer may be in one of the following states:<br />

Does not need the shared memory<br />

Needs the shared memory, but it has not yet been assigned<br />

Uses the shared memory<br />

Your assignment<br />

Model this behavior<br />

Is the result conservative<br />

Show that the resulting PN is live<br />

For a real-time system, it is of prime importance to<br />

recover in case of error <strong>and</strong> then return to a correct state<br />

A PN is said reversible if the initial marking M 0 may be<br />

reached from any marking in R(M 0 )<br />

A given state M i of a PN is said « home state » if for any<br />

marking M of R(M 0 ), M i can be reached from M<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 113<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 114<br />

© J.-D. Decotignie, 2007<br />

Reversibility <strong>and</strong> home state -<br />

example<br />

Exercise - properties<br />

<br />

reversible<br />

p 1<br />

t 1<br />

t 3<br />

<br />

Home state<br />

For each PN below, please indicate if it is:<br />

1. bounded ? 2. live ? 3. Without blocking? 4. conservative ?<br />

p 2<br />

p 3<br />

p 0<br />

p 1<br />

t 2<br />

t 2<br />

t 0<br />

t 1<br />

<br />

Not<br />

reversible<br />

p 1<br />

t 3<br />

p 2<br />

t 1<br />

t 1<br />

p 3 p 2<br />

p 4<br />

t 3<br />

p 1<br />

t 1<br />

p 1 p 1<br />

t 1<br />

p 1<br />

t 1 p1<br />

t 1<br />

A B C p 2<br />

D t 2<br />

E<br />

t 2<br />

p 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 115<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 116<br />

© J.-D. Decotignie, 2007


PN Properties<br />

PN Properties (2)<br />

Reachable marking<br />

A marking that can reached from M 0<br />

K-bounded (if K=1, safe)<br />

Maximum number of tokens ∀place =K<br />

reversible<br />

M 0 may be reached from any marking<br />

conservative (same weights, strictly conservative)<br />

Weighted sum of tokens in places = Constant<br />

live<br />

All transitions are live<br />

Well shaped<br />

live + bounded + reversible<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 117<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 118<br />

© J.-D. Decotignie, 2007<br />

Design by refinement<br />

Design by refinement (2)<br />

p 1<br />

p 1<br />

First step<br />

Simple net<br />

Complex tasks associated to transitions<br />

validation<br />

Second step<br />

Transitions are replace by a block (a PN that begins with an<br />

initial transition <strong>and</strong> ends with a final transition) t 11<br />

p<br />

validation<br />

13<br />

t 12 t 13<br />

Following steps<br />

p 14<br />

Repeat step 2<br />

t 14<br />

p 2<br />

p 3<br />

t 1<br />

t 2<br />

t 3<br />

1st STEP<br />

BLOCK<br />

p 15<br />

p 16<br />

p 1<br />

t 1<br />

p 2<br />

t 2<br />

p 3<br />

t 3<br />

1st STEP<br />

p 13<br />

p 14<br />

t 11<br />

t 12 t 13<br />

t 14<br />

BLOCK<br />

p 15<br />

p 16<br />

p 13<br />

p 14<br />

t 1<br />

p 2<br />

t 11<br />

t 12 t 13<br />

t 14<br />

p 3<br />

t 3<br />

p 15<br />

p 16<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 119<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 120<br />

© J.-D. Decotignie, 2007


Structure approach<br />

Analysis by reduction<br />

We only use blocks that have good properties<br />

p k<br />

t i<br />

Sequence simplification<br />

Eliminate sequences of places<br />

Concatenate parallel paths<br />

Suppress identity transitions<br />

t j<br />

SEQUENCE<br />

IF THEN ELSE<br />

WHILE DO<br />

ORIGINAL PROPERTIES MUST BE<br />

PRESERVED<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 121<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 122<br />

© J.-D. Decotignie, 2007<br />

Analysis by reduction (2)<br />

Reduction techniques<br />

p 1<br />

Preserving boundedness <strong>and</strong> liveness properties<br />

p 1<br />

R1: place substitution<br />

p 1<br />

R2: implicit place<br />

p 2<br />

p 2<br />

R3: neutral transition<br />

R4: identical transitions<br />

Preserving invariants<br />

p 1<br />

Ra: non pure transition for ordinary PN<br />

p 1<br />

p 1<br />

Rb: pure transition for ordinary PN<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 123<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 124<br />

© J.-D. Decotignie, 2007


Reduction R1: place substitution<br />

Reduction R1- example<br />

Place Pi can be removed if it complies with the 3<br />

following conditions<br />

Pi output transitions have no other input place than Pi<br />

There is no transition Tj that is at the same time input <strong>and</strong><br />

output transition of Pi<br />

At least one output transition of Pi is not a sink transition<br />

P 1<br />

P 2<br />

T 1 T 2<br />

P 3<br />

T 3 T 4<br />

P 4 P 5<br />

P 1<br />

P 2<br />

T 23<br />

T 13 T 24<br />

P 4 P 5<br />

T 14<br />

Keeps: bounded, safe, live, without blocking, home state,<br />

conservative. However, bound <strong>and</strong> home state are not<br />

always known<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 125<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 126<br />

© J.-D. Decotignie, 2007<br />

Reduction R2: implicit place<br />

Reduction R2- example<br />

Place Pi is implicit if it fulfils the following 2 conditions<br />

Marking of this place may never block the firing of its output<br />

transitions<br />

Its marking may be deducted from the marking of other places<br />

according to<br />

M<br />

( P ) = ∑α M ( P ) + β<br />

i<br />

k≠i<br />

k<br />

k<br />

P 1<br />

P 1<br />

T 1 P 3 T 1<br />

P 2<br />

p 2<br />

p 3<br />

Keeps: bound, live, without blocking, home state,<br />

conservative. May be safe after reduction even if original<br />

is not. It is not always possible to know the home state<br />

<strong>and</strong> the bound.<br />

t 1<br />

t 2<br />

t 3<br />

p 1<br />

p 2<br />

p 3<br />

t 1<br />

t 2<br />

t 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 127<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 128<br />

© J.-D. Decotignie, 2007


Reduction R3: neutral transition<br />

Reduction R4 – identical transitions<br />

Transition T is neutral iif the set of all its input places is<br />

identical to the set of all its output places<br />

2 transtions are identical if they have the same set of<br />

input places <strong>and</strong> the same set of output places<br />

T 1<br />

T 3<br />

T 1<br />

T 3<br />

p 3<br />

p 4<br />

p 3<br />

p 4<br />

P 1<br />

T 5<br />

P 2<br />

P 1<br />

P 2<br />

t 1<br />

T 2<br />

T 4<br />

Keeps: bounded, safe, live, without blocking, home state,<br />

conservative. It is not always possible to know the home<br />

state <strong>and</strong> the bound.<br />

T 2<br />

T 4<br />

<strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 130<br />

t 2<br />

t 1<br />

p 3<br />

Keeps: bounded, safe, live, without blocking, home state,<br />

conservative. It is not always possible to find the home<br />

state <strong>and</strong> the bound.<br />

p 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 129<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming © J.-D. Decotignie, 2007<br />

Reduction Ra – non pure transition<br />

Reduction Rb – pure transition<br />

T 1<br />

P 1<br />

Transition Tj with place Pi <strong>and</strong> arcs Tj->Pi <strong>and</strong> Pi->Tj<br />

Reduction<br />

Suppress arcs Tj->Pi <strong>and</strong> Pi->Tj<br />

Suppress transition Tj if it is isolated<br />

P 2 T 1<br />

P 2<br />

T 3 P 1<br />

T 3<br />

p 1<br />

The transition must possess at least one input <strong>and</strong> one<br />

output place<br />

Reduction<br />

p 1<br />

Suppress transition<br />

Each couple of places Pi,Pk such that Pi<br />

p 2<br />

is an input place <strong>and</strong> Pk is an output place,<br />

is replaced by a place Pi+Pk (union of places)<br />

T 2 P 2<br />

T 2<br />

P 2<br />

p 1<br />

p 1<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 131<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 132<br />

© J.-D. Decotignie, 2007


Reduction Rb- example<br />

Exercise<br />

Reduce the following PN<br />

p 1<br />

t 1<br />

p 2<br />

T 1<br />

T 2<br />

T 1<br />

T 2<br />

t 11<br />

P 1<br />

P 2<br />

T 5<br />

P 1+4<br />

P 2+4<br />

P 1+3<br />

P 2+3<br />

p 13<br />

t 12 t 13<br />

p 15<br />

P 4 P 3<br />

p 14<br />

p 16<br />

t 14<br />

T 3<br />

T 4<br />

T 3<br />

T 4<br />

p 3<br />

t 3<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 133<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 134<br />

© J.-D. Decotignie, 2007<br />

Exercise<br />

PN Formal analysis<br />

Reduce the PN below <strong>and</strong> find its place invariants<br />

t 1<br />

P 1<br />

t 2<br />

P 2<br />

P 3<br />

t 3<br />

Systematic evolution from the initial marking<br />

Gives the set of reachable markings<br />

From which the properties are derived<br />

3 techniques<br />

Reachability graph<br />

Reachability tree<br />

Matrix analysis<br />

Place invariant<br />

Transition invariant<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 135<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 136<br />

© J.-D. Decotignie, 2007


Reachability graph<br />

Reachability tree<br />

We create a graph of<br />

reachable markings<br />

Exhaustive search<br />

Risk of combinatorial<br />

explosion<br />

t 1<br />

p 1<br />

t 2 t 3<br />

t 1<br />

p 2 p 3<br />

t 3 t 2 t 1<br />

[2,0,0] [1,0,1] [0,1,1] [1,0,0]<br />

<br />

If we want to show that<br />

the PN is not bounded,<br />

it might be useless to continue<br />

p 1<br />

This is the case if M 1<br />

that has been reached from M,<br />

M 1 ≥M (∀i: m 1 (p i ) ≥m(p i ))<br />

if M 1 =M, we are back to the<br />

same marking<br />

t 2<br />

if M 1 >M, it is possible to repeat<br />

[1,0,1]<br />

the same firing sequence <strong>and</strong><br />

increment again the number of tokens<br />

t 2 t 3<br />

t 1<br />

p 2 p 3<br />

[1,0,0]<br />

t 1<br />

[0,1,1]<br />

t 3<br />

[1,1,0]<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 137<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 138<br />

© J.-D. Decotignie, 2007<br />

Analyis by reachability tree<br />

Matrix analysis<br />

The tree is always finite<br />

The tree permits to check the following properties<br />

Not bounded if there exsists M1>M<br />

Conservative if the number of tokens is constant<br />

L1-Live is each transitions appears at least once in the tree<br />

Reversibility <strong>and</strong> home state<br />

Complex to use<br />

Uses I <strong>and</strong> O matrices<br />

Look for a non trivial solution to<br />

| O-I |.x T =0 avec x= | x 1 , ...., x i , ...., x N | (1)<br />

Let M et M 1 be two successive markings<br />

M 1 = M + O[t j ] – I[t j ] after firing t j (2)<br />

Let ρ = | ρ 1 , ...., ρ i , ...., ρ N | be a solution of (1)<br />

Let multiply each term of (2) by ρ i <strong>and</strong> sum up on i<br />

N<br />

N<br />

N<br />

∑m<br />

pi<br />

i = ∑ im<br />

pi<br />

+ ∑ i O t j pi<br />

− I t j pi<br />

i=<br />

1 1 ρ ρ ρ , ,<br />

i=<br />

1 i=<br />

1<br />

( ) ( ) [ ( ) ( )]<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 139<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 140<br />

© J.-D. Decotignie, 2007


Place invariant<br />

result:<br />

If all ρ i have the same sign <strong>and</strong> are non zero<br />

The PN is conservative (strictly is ρ i are all equal)<br />

The PN is bounded<br />

N<br />

∑m<br />

= N<br />

i i i<br />

i=<br />

1 1 ρ<br />

i=<br />

1<br />

( p ) ρ ∑ m( p )<br />

If all ρ i have the same sign <strong>and</strong> some are zero<br />

A subset of the PN is conservative<br />

i<br />

Place invariant - example<br />

I=<br />

O=<br />

⏐O-I⏐.x T =<br />

0 1 0 1 0 0<br />

1 0 0 0 1 0<br />

0 0 1 0 0 0<br />

0 0 0 0 0 1<br />

1 0 1 0 0 0<br />

0 1 0 0 0 1<br />

0 0 0 1 0 0<br />

0 0 0 0 1 0<br />

1 -1 1 -1 0 0<br />

-1 1 0 0 -1 1<br />

0 0 -1 1 0 0<br />

0 0 0 0 1 -1<br />

PRODUCTEURS<br />

p 3<br />

messages<br />

Possible solution x i =1 , invariant = s+2; bounded,<br />

strictly conservative<br />

t 3<br />

production<br />

. x T =0<br />

p 4<br />

p 1<br />

t 1 s p 2<br />

positions<br />

CONSOMMATEURS<br />

p 5<br />

t 2<br />

t 4<br />

p 6<br />

utilisation<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 141<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 142<br />

© J.-D. Decotignie, 2007<br />

Exercise – readers-writers<br />

Transition invariant<br />

Task<br />

waiting<br />

READERS<br />

t 1<br />

p 0<br />

reading p 3<br />

S<br />

p 1<br />

s<br />

s<br />

WRITERS<br />

p 2<br />

Task<br />

waiting<br />

t 2<br />

p 4<br />

writing<br />

Look for a non trivial solution to<br />

| O-I | T .x T =0 avec x= | x 1 , ...., x i , ...., x M | (1)<br />

M is the number of transitions<br />

Gives an indication of liveness<br />

Sequence of transitions that can be fired repeatedly<br />

t 3<br />

s<br />

t 4<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 143<br />

© J.-D. Decotignie, 2007<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 144<br />

© J.-D. Decotignie, 2007


Interesting information<br />

http://www.informatik.uni-hamburg.de/TGI/<strong>Petri</strong><strong>Nets</strong>/<br />

http://home.arcor.de/henryk.a/petrinet/e/hpsim_e.htm<br />

Real-Time Programming <strong>GRAFCET</strong> <strong>and</strong> <strong>Petri</strong> nets 145<br />

© J.-D. Decotignie, 2007

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!