Petri Nets models IS Flow graph for Quality Assurance Maintenance productivity
In this example T3 has no input, so it always enabled which means it can always fire.
M0 = (0, 0, 0)
t3 (t3 fires)
t3* M1 = (1, 0, 0)
M2 = (0, 1, 0)
t3 M3 = (1, 1, 0)
*t3 fires again
M0 = (0, 0, 1)
t3 M1=(1,0,1) (0, 0, 0)
M2=(0,1,1)(1, 0, 0)t3
t3 t1 t1
t3 M3 = (1, 1, 1) (0, 1, 0)
(1, 1, 0)
Real Life Example â€“ road passing over a railway with bridge opening and closing when a train passes by.
Oval: 3Oval: 2Gate one way
The gate can be in these 4 situations:
1. Gate Open
2. Gate Open to Close
3. Gate Closed
4. Gate Closed to Open
The train can be in these situations
Tran Away (1) Train passing by (2) Train Leaving (3)
If we want a transition that will not fire if 2 places are marked we draw a dotted line which is known as the inhibitor arc.
Without the inhibitor arc t1 is enabled, the inhibitor disables t1 (if P3 is marked). If only P1 is enabled t1 can fire.
Train far away
Gate Open to Close
If we draw one Petri Net for this situation we will have this diagram:
In our case we are drawing safe Petri nets. Safe Petri nets in each place can have a maximum of one dot only. If it is not a safe Petri net then there is no limit of dots per place. The problem with non safe Petri nets is that if you want to fire the first dot and there are a number of dots it is impossible to recognise the first one. Therefore coloured Petri nets are used.
There are 3 simple steps to know
Workings of a Petri net Draw a Petri net Draw a reach-ability graph
Producer A Producer B
Consumer 1 can buy either from A or from B since there is no priority. If there is a preference if you can buy from A and not from B then the diagram would be like 8.2
E.g. 8.2: Petri Net
Producer A Producer B
P0, P1, P2
(0, 0, 0)
(1, 0, 0) (0, 1, 0)
(0, 0, 1)(1, 1, 0)
(1, 0, 1) (0, 1, 1)
t2 (1, 1, 1)
Flow Graphs (Control Flow Graphs — CFG)
Cyclomatic Statementbranch coveragepath
3 rules that govern a good flow graph (a CFG is valid if)
1. There is one start and one end node (State).
2. For each node there are a maximum of 2 outgoing arrows.
3. For each node N in the CFG there exists at least one path from the start node to N and at least one path from N to the end node.
if s2 than s3
if s2 then s3
for (s2, s3, s4)
if s2 and s3 than s4
if s2 or s3 then s4
case s2 of
s3: s31 break
s4: s41 break
s5: s51 break
How to know that the CFG is valid?
To know that a CFG is valid Cyclomatic complexity is used. There are 3 ways to do this:
D + 1 Ã total decisions + 1
#(regions) Ã number of regions E â€“ N + 2 Ã total edges (arrows) — total nodes (State) + 2
A decision is a state with 2 directed lines (arrows), and a node is a state (circle).