Professional Documents
Culture Documents
Solutions of The System Modeling Course Examination: March 7, 2003
Solutions of The System Modeling Course Examination: March 7, 2003
Examination
March 7, 2003
1. Explain the dierence between Untimed, Synchronous and Timed models
of computation in terms of time.(20 points)
2. Consider the alphabet = {a, b, c, d} nd a regular expression for the
language where each sting contains exactly one c or exactly one d.(10
points)
SOLUTION:
(a + b + d)
c(a + b + d)
+ (a + b + c)
d(a + b + c)
1
3. Consider the alphabet = {a, b, c, d} construct a deterministic nite state
machine which recognizes all the strings which contain exactly two c or
exactly two d.(10 points)
SOLUTION:
0
ccdd
c cc
cd ccd d
dd cdd
c
c
c c
c
c
d
d
d
d
d
d
a,b
a,b
a,b
a,b
a,b
a,b
c
c
c
c c
c
d d d
d
d
d
a,b
a,b
a,b
a,b,d
a,b,d a,b,d
a,b,c,d
a,b,c
a,b,c
a,b,c
4. For a nite state machine M = (, , X, x
0
, g, f) where:
= {0, 1}
= {0, 1}
X = {x
0
, x
1
}
g(x
0
, 0) = x
0
g(x
0
, 1) = x
1
g(x
1
, 0) = x
1
g(x
1
, 1) = x
0
f(x
0
, 0) = 0
f(x
0
, 1) = 0
2
f(x
1
, 0) = 0
f(x
1
, 1) = 1
nd a corresponding Petri Net.
0/0
1/0
1/1
x1 x0
0/0
(20 points)
SOLUTION:
P = {x
0
, x
1
, 0
I
, 1
I
, 0
O
, 1
O
}
T{t
x0,0I
, t
x0,1I
, t
x1,0I
, t
x1,1I
}
y = [1, 0, 0, 0, 0, 0]
I(t
x0,0I
) = {x
0
, 0
I
}
I(t
x0,1I
) = {x
0
, 1
I
}
I(t
x1,0I
) = {x
1
, 0
I
}
I(t
x1,1I
) = {x
1
, 1
I
}
O(t
x0,0I
) = {x
0
, 0
O
}
O(t
x0,1I
) = {x
1
, 0
O
}
O(t
x1,0I
) = {x
1
, 0
O
}
O(t
x1,1I
) = {x
0
, 1
O
}
3
0I
1I
0o
1o
x0
x1
tx0,0I
tx0,1I
tx1,0I
tx1,1I
5. Consider the Petri net dened by:
P = {p
1
, p
2
, p
3
, p
4
}
T = {t
1
, t
2
, t
3
, t
4
}
A = {(p
1
, t
2
), (p
2
, t
3
), (p
2
, t
4
), (p
4
, t
1
), (p
4
, t
3
),
(t
1
, p
1
), (t
1
, p
2
), (t
2
, p
3
), (t
2
, p
4
), (t
3
, p
1
), (t
4
, p
3
)}
with weights: w(t
1
, p
1
) = 2,
w(t
1
, p
2
) = 1,
w(t
2
, p
3
) = 1,
w(t
2
, p
4
) = 1,
w(t
3
, p
1
) = 4,
w(t
4
, p
3
) = 1,
w(p
1
, t
2
) = 2,
w(p
2
, t
3
) = 2,
w(p
2
, t
4
) = 2,
w(p
4
, t
1
) = 1,
w(p
4
, t
3
) = 2;
4
Let x
0
= [0, 0, 0, 2] be an initial state:
(a) Write the incidence matrix A. (5 points)
(b) Draw the corresponding Petri net graph. (5 points)
(c) Construct the coverability tree of the Petri net. (10 points)
(d) Find a weighting vector such that the Petri net conserves the number
of tokens and the constant C. (10 points)
SOLUTION:
A =
_
_
2 1 0 1
2 0 1 1
4 2 0 2
0 2 1 0
_
_
vec=[1,0,0,2]
P2
P4
P1
P3
t4
t1
t3
t2
5
[4,w,w,0]
[2,w,w,1]
[0,w,w,2]
[2,w,w,1] [2,w,w,1] [4,w,w,0]
[4,0,1,0]
[2,0,2,1]
[4,w,w,0] [0,0,w,2]
[2,w,w,1]
[4,2,0,0] [0,w,w,2]
[2,1,0,1]
[0,0,0,2]
t1
t1
t1
t1
t1
t1
t2
t2 t4
t2
t2
t3
t2
t2
t4
t4
t4
6. Using the equation x = x
0
+ zA show that x = [3, 2, 4] is not reachable
from x
0
= [2, 2, 4] for the acyclic Petri net dened by:
P = {p
1
, p
2
, p
3
},
T = {t
1
, t
2
, t
3
}
and the incidence matrix:
A =
_
_
1 0 2
0 2 1
3 1 2
_
_
(10 points)
SOLUTION:
[3, 2, 4] = [2, 2, 4] + [n
t1
, n
t2
, n
t3
]
_
_
1 0 2
0 2 1
3 1 2
_
_
_
_
_
3 = 2 n
t1
+ 3n
t3
2 = 2 + 2n
t2
n
t3
4 = 4 + 2n
t1
n
t2
2n
t3
Solving the equation system we get: n
t1
= 5/7,n
t2
= 2/7,n
t3
= 4/7. Since
we can execute transition only an Integer number of times and the given
numbers are not Integers the Petri net can not reach the required state.
6
f
g h
Process P
a
b
c a
b
c a
c
u x
v
7. A process P consists of three sub-processes Q
1
, Q
2
, Q
3
.
The three sub-processes are dened by the following characteristic func-
tions:
F
Q1
= f(a, b) = (a + b)
F
Q2
= g(a, b) = (b a)
F
Q3
= h(a) = (3a)
(a) What is the characteristic function F
P
in the perfectly synchronous
model? (10 points)
SOLUTION:
F
P
(x) = (u, v) = (h(g(f(x, v), u), g(f(x, v), u))
= (h(g(x + v, u)), g(x + v, u))
= (h(u x v), u x v)
= (3u + 3x + 3v, u x v)
_
u = 3u + 3x + 3v
v = u x v
v = u x v v = u/2 x/2
u = 3u + 3x + 3v u = 3x/4 + 3v/4 = 3x/4 + 3/8u 3/8x =
3/8u + 3/8x u = 3/5x
(b) What is the characteristic function F
P
in the clocked synchronous
model? (10 points)
SOLUTION:
F
P
(x
i
) = (u
i
, v
i
) = (h(g(f(x
i
, v
i
), u
i
), g(f(x
i
, v
i
), u
i
))
= (h(g(x
i1
+ v
i1
, u
i
)), g(x
i1
+ v
i1
, u
i
))
= (h(u
i1
x
i2
v
i2
), u
i1
x
i2
v
i2
)
= (3u
i2
+ 3x
i3
+ 3v
i3
, u
i1
x
i2
v
i2
)
8. Given is a synchronous data ow graph:
Determine the following:
(a) The topology matrix and its rank. (10 points)
7
1
2
3 4
5
6
A
B
C
D
8
4
2
1
4
1
1
4
3
12
1
2
(b) The smallest q such that q = 0. (10 points)
(c) A periodic admissible schedule and the initial buer conditions. (10
points)
SOLUTION:
A =
_
_
8 4 0 0
2 1 0 0
0 0 1 4
0 0 3 12
0 4 1 0
2 0 0 1
_
_
Rank(A) = 3
q=[1,2,8,2]
If the schedule = {ABBCCCCCCCCDD} then the b
0
= [0, 2, 0, 24, 0, 2]
_
_
0
2
0
24
0
2
_
_
A
_
8
0
0
24
0
0
_
_
B
_
4
1
0
24
4
0
_
_
B
_
0
2
0
24
8
0
_
_
C
_
0
2
1
21
7
0
_
_
C
_
0
2
2
18
6
0
_
_
C
_
0
2
3
15
5
0
_
_
C
_
0
2
4
12
4
0
_
_
C
_
0
2
5
9
3
0
_
_
C
_
0
2
6
6
2
0
_
_
C
_
0
2
7
3
1
0
_
_
C
_
0
2
8
0
0
0
_
_
D
_
0
2
4
12
0
1
_
_
D
_
0
2
0
24
0
2
_
_
9. pr mealy = mealySY f g s0 denes a Mealy FSM which has next-state
function f, output-function g and initial state value s0. Dene a pro-
cess network in ForSyDe which has the same functionality as the pro-
cess pr mealy without using process constructors mealySY and mooreSY.
8
You are allowed to use the following process constructors : {mapSY, zip-
WithSY, scanlSY, scanl2SY, scanlDelaySY, scanlDelay2SY, delaySY,zipSY,unzipSY}.(20
points)
SOLUTION:
pr2 = scanlDelaySY f s0
pr3 = zipWithSY g
system inA = outp
where
s1 = pr2 inA
outp = pr3 s1 inA
Grading : 141 . . . 160 points 5
111 . . . 140 points 4
81 . . . 110 points 3
0 . . . 80 points Failed
9