CIS 3051 Information Systems Engineering

 















 —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  — —
Sup­port this Page: http://amzn.to/2kgnzrf
 — —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  —  — —

CIS 3051 Inform­a­tion Sys­tems Engin­eer­ing

Naudi

 

40% assign­ment

60% Exam

 

Pet­ri Nets mod­els IS
Flow graph for Qual­ity Assur­ance
Main­ten­ance pro­ductiv­ity

Pet­ri net

 

 

e.g:

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

In this example T3 has no input, so it always enabled which means it can always fire.

 

Reach­ab­il­ity Graphs

 

 

P1 P2 P3

M0 = (0, 00)

t3 (t3 fires)

t3*
M1 = (1, 00)

t1

 

 

M2 = (0, 10)

t3
M3 = (1, 10)

*t3 fires again

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

P1 P2 P3

M0 = (0, 01)

t3

t2

t3
M1=(1,0,1) (0, 00)

 

 

M2=(0,1,1)(1, 0, 0)t3

t3 t1 t1

t3
M3 = (1, 1, 1) (0, 10)

 

t3

 

(1, 10)

 

 

 

 

 

 

 

 

 

 

Real Life Example – road passing over a rail­way with bridge open­ing and clos­ing when a train passes by.

 
Oval: 1

Train

 

Oval: 3Oval: 2Gate one way

 

 

 

 

 

 

 

 

The gate can be in these 4 situ­ations:

1. Gate Open

2. Gate Open to Close

3. Gate Closed

4. Gate Closed to Open

 

The train can be in these situ­ations

Tran Away (1)
Train passing by (2)
Train Leav­ing (3)

If we want a trans­ition that will not fire if 2 places are marked we draw a dot­ted line which is known as the inhib­it­or arc.

 

P2

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Without the inhib­it­or arc t1 is enabled, the inhib­it­or dis­ables t1 (if P3 is marked). If only P1 is enabled t1 can fire.

 

 

 

Gate Open

Gate Train

Train far away

Gate Open to Close

Gate Closed

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

If we draw one Pet­ri Net for this situ­ation we will have this dia­gram:

 

Train Gate

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Train passing

 

 

 

 

 

 

 

Train away

 

 

 

 

 

 

 

 

 

 

In our case we are draw­ing safe Pet­ri nets. Safe Pet­ri nets in each place can have a max­im­um of one dot only. If it is not a safe Pet­ri net then there is no lim­it of dots per place. The prob­lem with non safe Pet­ri nets is that if you want to fire the first dot and there are a num­ber of dots it is impossible to recog­nise the first one. There­fore col­oured Pet­ri nets are used.

 

 

There are 3 sim­ple steps to know

Work­ings of a Pet­ri net
Draw a Pet­ri net
Draw a reach-abil­ity graph

E.g. 8.1:

 

Pro­du­cer A Pro­du­cer B

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Con­sumer 1 can buy either from A or from B since there is no pri­or­ity. If there is a pref­er­ence if you can buy from A and not from B then the dia­gram would be like 8.2

 

E.g. 8.2: Pet­ri Net

 

Pro­du­cer A Pro­du­cer B

 

t0 t2

 

 

P0P1

 

 

t1 t3

 
P2

 

 

Reach­ab­il­ity Graph

 

P0, P1P2

(0, 00)

t0t2

t0

(1, 0, 0) (0, 10)

t1t2

 

(0, 0, 1)(1, 10)

t1

t0t2

t0

(1, 0, 1) (0, 11)

t2t1

t0

t2 (1, 11)

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Flow Graphs (Con­trol Flow Graphs — CFG)

 

Aim:

P

Flow Graph

 

Cyc­lo­mat­ic State­ment­branch cov­er­age­path

Com­plex­ity

 
State

 

 

Dir­ec­ted line

 

3 rules that gov­ern a good flow graph (a CFG is val­id if)

1. There is one start and one end node (State).

2. For each node there are a max­im­um of 2 out­go­ing 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.

 

 

 

 

 

 

 

 

 

a. x

 

 

x

 

 

 

 

R

 

E.g. 1:

s1

if s2 than s3

else s4

s5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

E.g. 2:

s1

if s2 then s3

s5

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

E.g. 3:

s1

repeat s2

until s3

s4

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

e.g. 4:

s1

for (s2, s3, s4)

s5

end­for

s6

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

E.g. 5

s1

if s2 and s3 than s4

else s5

s6

 

 

 

 

 

 

 

 

 

F T

 

F

 

 

T

 

 

 

 

E.g. 6:

s1

if s2 or s3 then s4

else s5

s6

 

 

 

 

 

 

 

TF

 

 

 

T

 

 

 

 

 

 

 

 

 

 

E.g. 7:

s1

case s2 of

s3: s31 break

s4: s41 break

s5: s51 break

else s6

end case

s7

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

 

Cyc­lo­mat­ic Com­plex­ity

 

How to know that the CFG is val­id?

To know that a CFG is val­id Cyc­lo­mat­ic com­plex­ity is used. There are 3 ways to do this:

D + 1 Ã total decisions + 1
#(regions) ànum­ber of regions
E â€“ N + 2 Ã total edges (arrows) — total nodes (State) + 2

A decision is a state with 2 dir­ec­ted lines (arrows), and a node is a state (circle).