1/30
Generating Behavioral Model of Coupled SP-DEVS DEVS Symposium 2005 San Diego, CA, USA Aprial 6, 2005
i P
2 3 L2 3M 33 22
Moon H. Hwang Department of Electrical and Computer Engineering, Wayne State University Detroit, MI 48202, USA
?
E-mail:
[email protected],
Homepage: http://kalman.eng.wayne.edu/mhhwang
Contents
2/30
1. Introduction 2. Review of Schedule-Preserved DEVS (SP-DEVS) a) Atomic SP-DEVS, Behavior of Atomic SP-DDEVS b) Coupled SP-DDEVS, Behavior of Coupled SP-DDEVS 3. Generating Global Behavior of Coupled SP-DEVS
i P
2 3 L2 3M 33 22
a) Concept of Finite-State Space of SP-DEVS network b) Abstract Simulation Algorithms (ASA) c) ASA-based Behavior Generation of Coupled DEVS d) Complexity of Behavior Generation 4. Experimental Results ?
5. Conclusion
Introduction 3/30
i P
2 3 L2 3M 33 22
• For formal verification base on DEVS[Zeigler et al., 2000], one possible approach might be restricting DEVS so that it is closed under coupling with the finite state space.
?
Introduction 3/30
• For formal verification base on DEVS[Zeigler et al., 2000], one possible approach might be restricting DEVS so that it is closed under coupling with the finite state space. • Schedule-Preserved DEVS is a restricted version of DEVS such that [Hwang and Cho, 2004]
i P
2 3 L2 3M 33 22
1. it has a non-empty and finite set of states 2. its internal transition is scheduled by a rational number rather than a real number
?
3. any external event cannot change any schedule of internal transition
Introduction 4/30
i P
2 3 L2 3M 33 22
• It is proven that a SP-DEVS network can be described by an atomic SP-DEVS by the relative-schedule abstraction [Hwang and C
?
Introduction 4/30
• It is proven that a SP-DEVS network can be described by an atomic SP-DEVS by the relative-schedule abstraction [Hwang and C • However, the algorithm of achieving the finite-states behavior of SP-DEVS networks is unknown.
i P
2 3 L2 3M 33 22
?
Introduction 4/30
• It is proven that a SP-DEVS network can be described by an atomic SP-DEVS by the relative-schedule abstraction [Hwang and C • However, the algorithm of achieving the finite-states behavior of SP-DEVS networks is unknown.
i P
2 3 L2 3M 33 22
• This paper introduces an algorithm generating finite-state behavioral model from a coupled SP-DEVS.
?
Review of Schedule-Preserved DEVS (SP-DEVS) 5/30
Definition of Atomic SP-DEVS An atomic SP-DEVS specifies the dynamic behavior. Definition 1 (Atomic SP-DEVS) An atomic model of SP-DEVS is a 9-tuple, M =< X, Y, S, τ, δx , δτ , λ, S0 , SF > where,
i P
2 3 L2 3M 33 22
• X is a finite set of input events. • Y is a finite set of output events.
?
• S is a non-empty and finite states set. S can be partitioned into two sets: rescheduling states set Sτ whose states reschedule their remaining time, and continued scheduling states set Sc whose states preserve their remaining time. Relations between Sτ and Sc are Sτ ∩ Sc = ∅ and Sτ ∪ Sc = S.
• τ : S → Q[0,∞] is the maximum sojourning time to the next scheduled state where Q[0,∞] denotes a set of non-negative rational numbers with infinity. • δx : S × X → Sc is the external transition function.
6/30
• δτ : S → Sτ is the internal transition function. • λ : S → Y is the internal output function where Y means Y ∪ {}. • S0 ⊆ Sτ is a non-empty set of initial states.
a
• SF ⊆ S is a set of acceptable states.
i P
2 3 L2 3M 33 22
a
?
This paper allows more than one initial states |S0 | ≥ 1 that includes only one initial state as a special case |S0 | = 1.
State Transition of Atomic SP-DEVS Given M =< X, Y, S, τ, δx , δτ , λ, S0 , SF >, the total states set 7/30
Q = {(s, r)|s ∈ S, 0 ≤ r ≤ τ (s)}
(1)
considers the remaining time r at s ∈ S. Based on the total state set, the state transition function δ : Q × X → Q is represented as follows: for (s, r) ∈ Q, x ∈ X ,
i P
2 3 L2 3M 33 22
(δ (s, x), r) if x ∈ X ∧ δx (s, x) is defined x δ((s, r), x) = (s0 , r0 ) = (δτ (s), τ (δτ (s))) if x = ∧ r = 0 (s, r) otherwise
?
(2)
Behavior Description using General System Theory Given M =< X, Y, S, τ, δx , δτ , λ, S0 , SF > is a SP-DEVS, then its dynamics is defined as follows.
8/30
G =< T, XG , YG , Ω, Q, ∆, Λ > where • The time base T = R[0,∞] (the set of non-negative real numbers with infinity) . • The input (output) segments is the input (output) event segments, that is, XG = X(YG = Y ).
i P
2 3 L2 3M 33 22
• The set of allowable input segments Ω = ΩX = (X ∗ , T ) where X ∗ is the Kleene closure of X [Hopcroft et al., 2000]. • The states set Q is the total states set of M .
?
Behavior Description using General System Theory • The total state transition trajectory ∆ : Q × ΩX → Q; For (s, r) ∈ Q, ω1 , ω2 ∈ ΩX and x ∈ X and t ∈ T , δ((s, r), x) for ω1 = (x, t) (3) ∆((s, r), ω1 ) = δ(∆((s, r), ω2 ), x) for ω1 = ω2 (x, t)
9/30
i P
2 3 L2 3M 33 22
• The total output function Λ : Q → Y is that for (s, r) ∈ Q λ(s) for r = 0 Λ(s, r) = otherwise
?
(4)
Example of Atomic SP-DEVS Cross-Road System 10/30
• G:1 = green-light on; G:0 = green-light off; • W:1 = walk-light on; W:0 = walk-light off; • P = push-button;
i P
2 3 L2 3M 33 22
?
Figure 1: Cross Road Example
Trajectories of the Cross-Road System .
11/30
i P
2 3 L2 3M 33 22
?
Figure 2: Trajectories of the Cross Road System
Coupled SP-DEVS 12/30
A SP-DEVS network is a 7-tuple, N =< X, Y, C, Zxx , Zyx , Zyy , select > where • X(Y ) is the finite set of input (output) events.
i P
2 3 L2 3M 33 22
• C = {Mi |Mi =< Xi , Yi , Si , τi , δxi , δτ i , λi , S0i , SF i >} is the finite set of subcomponent SP-DEVSs which can be atomic SP-DEVS or coupled SP-DEVS models. It is assumed that all of the leaf nodes are atomic SP-DEVS models and hierarchical depth to all leaf notes are finite. S • Zxx ⊆ X × Xi is the external input coupling relation. Mi ∈C
• Zyx ⊆
S Mi ∈C
• Zyy = ?
S
Yi ×
S
Xi is the internal coupling relation.
Mi ∈C
Yi → Y is the external output coupling function.
Mi ∈C
• select : 2C − ∅ → C is a tie-breaking function.
Example of SP-DEVS Network 13/30
i P
2 3 L2 3M 33 22
Figure 3: SP-DEVS Network for Cross Road
?
Behavior of SP-DEVS 14/30
Given a SP-DEVS network, N =< X, Y, C, Zxx , Zyx , Zyy , select >, the global behavior of N called a coupled SP-DEVS model is MN =< X, Y, S, τ, δx , δτ , λ, S0 , SF > where • X(Y ) is the set of input events (output events) defined in N • S = {(. . . , (si , ri ), . . .)|(si , ri ) ∈ Qi , Mi ∈ C}. • τ : S → R[0,∞] ; τ (s) = τ ((. . . , (si , ri ), . . .)) = M inimum ri Mi ∈C
i P
2 3 L2 3M 33 22
Let the set of imminents, IM M (s) = {Mi |Mi ∈ C ∧ ri = τ (s)}. Imminents are the set of components that have minimum remaining time qi .r and Mi∗ = select(IM M (s)). • λ : S → Y is defined as λ((. . . , (si , ri ), . . .)) = Zyy (λi∗ (si∗ )).
?
• δx : S×X → S isdefined as follows. δx ((. . . , (si , ri ), . . .), x) = (. . . , (s0i , ri0 ), . . .) (δ (s , x ), r ) if (x, x ) ∈ Z xi i i i i xx where (s0i , ri0 ) = (si , ri ) otherwise
• δτ : S → S is defined as follows.
15/30
δτ ((. . . , (si , ri ), . . .)) = (. . . , (s0i , ri0 ), . . .) (δ ∗ (s ∗ ), τi∗ (δτ i∗ (si∗ ))) if Mi = Mi∗ τi i where (s0i , ri0 ) = (δxi (si , xi ), ri ) if (λi∗ (si∗ ), xi ) ∈ Zyx (si , ri ) otherwise • S0 = {(. . . , (si , τi (si )), . . .)|∀Mi ∈ C, si ∈ S0i }. • SF = {(. . . , (si , ri ), . . .)|∀Mi ∈ C, (si , ri ) ∈ QF i }.
i P
2 3 L2 3M 33 22
?
Generating Finite-Behavior of SP-DEVS 16/30
i P
2 3 L2 3M 33 22
State Trajectory
?
Figure 4: Atomic SP-DEVS and Its State Trajectories
Relative-Schedule Equivalence 17/30
i P
2 3 L2 3M 33 22
Figure 5: The Concept of Relative Schedule Equivalence ?
Relative Schedule Abstraction of SP-DEVS Networks 18/30
i P
2 3 L2 3M 33 22
Figure 6: Relative Schedule Abstraction
?
Time advance in discrete event system simulation is jumping to times when discrete events occur!
Abstract Simulation Algorithms of SP-DEVS 19/30
i P
2 3 L2 3M 33 22
Abstract Simulation of Atomic SP-DEVS SP-DEVS-Simulator: public DEVS-Simulator 1 when receive x-msg (x, t) 2 if not (tl ≤ t ≤ tn) then 3 ERROR: Bad Synchronization 4 s ← δx (s, x); 5 when receive s-msg (s0 , r0 , tl0 , t) 6 s0 ← s and r0 ← tl + τ (s) − t; 7 tl0 ← tl; 8 when receive r-msg (s0 , r0 , tl0 , t) 9 s ← s0 and r ← r0 ; 10 tl ← tl0 and tn ← t + r; End SP-DEVS-Simulator
?
• s-msg: store message
• r-msg: roll-back message
Abstract Simulation of Coupled SP-DEVS 20/30
i P
2 3 L2 3M 33 22
SP-DEVS-Coordinator: public DEVS-Coordinator 1 when receive x-msg (x, t) 2 if not (tl ≤ t ≤ tn) then 3 ERROR: Bad Synchronization 4 ∀Mi ∈ {Mj |Zxx (x, xMj )} 5 send x-msg(xMi , t) to simulatori 6 when receive s-msg ((. . . , (s0i , ri0 , tli0 ), . . .),t) 7 ∀Mi ∈ C 8 send s-msg (s0i , ri0 , tli0 , t) to simulatori 9 when receive r-msg ((. . . , (s0i , ri0 , tli0 ), . . .)) 10 ∀Mi ∈ C 11 send r-msg (s0i , ri0 , tli0 ) to simulatori 12 tl ← M ax{tli } and tn ← M in {tni }; Mi ∈C
End SP-DEVS-Coordinator
?
Mi ∈C
Generating Behavior of SP-DEVS Network SP-DEVS-Behavior-Generator 1 variables: 2 N =< X, Y, C, Zxx , Zyx , Zyy , select >; 3 child // Coordinator of N ; 4 make_behavior() 5 M =< X, Y, S, τ, δτ , δx , λ, S0 , SF >; 7 ∀Mi ∈ C, ∀si0 ∈ Si0 6 B // a set of (. . . , (si , ri , tli ), . . .) 8 send i-msg((. . . , (si0 ), . . . ), 0) to child; 9 update_s(M, B, (. . . , (si0 , τi (si0 ), 0), . . .),0) 10 add (. . . , (si0 , τi (si0 )), . . .) to S0 ; 11 while(|B| > 0) 12 (. . . , (si , ri , tli ), . . .) ← B.pop_front(); 13 send r-msg((. . . , (si , ri , tli ), . . .)) to child; 14 tn = child’s tn; 15 if tn 6= ∞ then 16 send *-msg (*, tn) to child; 17 update_s(M, B, (. . . , (s0i , ri0 , tli0 ), . . .), tn); 18 δτ ((. . . , (si , ri ), . . .)) ← (. . . , (s0i , ri0 ), . . .); 19 λ((. . . , (si , ri ), . . .)) ← y; 20 ∀x ∈ X then 21 send r-msg((. . . , (si , ri , tli ), . . .)) to child; 22 tl = child’s tl; 23 send x-msg (x, tl) to child; 24 update_s(M, B, (. . . , (s0i , ri0 , tli0 ), . . . , ), tl); 25 δx ((. . . , (si , ri ), . . .), x) ← (. . . , (s0i , ri0 ), . . .); 26 return M ; 27 update_s(M, B, (. . . , (si , ri , tli ), . . . , ), t) 28 send s-msg((. . . , (si , ri , tli ), . . . )),t) to child; 29 if (. . . , (si , ri ), . . .) 6∈ S then 30 add (. . . , (si , ri ), . . .) to S; τ ((. . . , (si , ri ), . . .)) ← M in {ri } Mi ∈C
31 if ∀Mi ∈ C, si ∈ SFi then add (. . . , (si , ri ), . . .) to SF ; 32 add (. . . , (si , ri , tli ), . . .) to B; 33 when receive y-message (yd , t) 34 y ← Zyy (yd ); End SP-DEVS-Behavior-Generator
Complexity of Generation • ∀Mi ∈ C, |Si | is finite. 22/30
i P
2 3 L2 3M 33 22
• Since τi (si ) ∈ Q[0,∞] , there exists the greatest common divisor g such that g ∗ nsi = τi (si ) (nsi is a nonnegative natural number) for si ∈ Si s.t. 0 < τi (si ) < ∞. • At state si , ri can be sampled as many as c : Si → Q+ 0 1 if tai (si ) = 0 c(si ) = 1 if tai (si ) = ∞ tai (si )/g + 1 otherwise
?
23/30
i P
2 3 L2 3M 33 22
Figure 7: c(si ) • Therefore, the state tracing is terminated at most Y X O( ( c(si ))) Mi ∈C si ∈Si
?
(5)
.
Implementation 24/30
• Hardware Platform: Presario, X1000, Compaq with 1 GHz Intel centrinoTM CPU and 1 GByte RAM • Language: C++ • Compiler: Microsoft VC++.NetTM • Library: Standard Template Library [Silicon Graphics, 2004] for vector, list, hash, hashmap
i P
2 3 L2 3M 33 22
?
Experiments 25/30
Cross-Road System (Fig.3) Table 1: Generating Traffic-Light Behavior
i P
2 3 L2 3M 33 22
?
1/τ (s)
QP c(si )
|S|
|E|
Time
Mem.
1
7.963E+3
100
131
3.E-5
20.3
10
2.015E+5
691
993
2.E-4
38.8
100
2.015E+7
6316
9318
2.E+0
1397.3
1000
2.015E+9
62556
92568
3.E+1
13870.8
26/30
i P
2 3 L2 3M 33 22
Figure 8: |S| and |E| in Traffic-Light Behavior
?
Machining Center 27/30
i P
2 3 L2 3M 33 22
?
Table 2: Generating Machining Center Behavior 28/30
i P
2 3 L2 3M 33 22
1/τ (s)
QP c(si )
|S|
|E|
Time
Mem.
1
702000
3877
6130
3
903.7
5
40625712
33053
48606
31
7294.8
10
1572655392
102058
145036
149
21959.3
20
33578883072
348518
482346
975
73539.8
?
Figure 9: |S| and |E| in Machining Center Behavior
Conclusion 29/30
i P
2 3 L2 3M 33 22
?
• Based-on abstract simulation algorithms, this paper introduced an algorithm generating finite-state behavior of coupled SP-DEVS.
Conclusion 29/30
• Based-on abstract simulation algorithms, this paper introduced an algorithm generating finite-state behavior of coupled SP-DEVS. Q P • Complexity of the generation algorithm is bounded in O( ( c(si ))) where Mi ∈C si ∈Si
i P
2 3 L2 3M 33 22
1 c(si ) = 1 tai (si )/g + 1
if tai (si ) = 0 if tai (si ) = ∞ otherwise
where g is the greatest common divisor such that g ∗ nsi = τi (si ) (nsi is a nonnegative natural number) for si ∈ Si s.t. 0 < τi (si ) < ∞.
?
Conclusion 29/30
• Based-on abstract simulation algorithms, this paper introduced an algorithm generating finite-state behavior of coupled SP-DEVS. Q P • Complexity of the generation algorithm is bounded in O( ( c(si ))) where Mi ∈C si ∈Si
c(si ) =
i P
2 3 L2 3M 33 22
1
1 tai (si )/g + 1
if tai (si ) = 0 if tai (si ) = ∞ otherwise
where g is the greatest common divisor such that g ∗ nsi = τi (si ) (nsi is a nonnegative natural number) for si ∈ Si s.t. 0 < τi (si ) < ∞.
• This behavior generating algorithm has been easily extended to that of scheduledcontrollable DEVS with checking routine of partially-rescheduled state [Hwang, 200 ?
References 30/30
[Hopcroft et al., 2000] Hopcroft, J., Motwani, R., and Ullman, J. (2000). Introduction to Automata Theory, Languages, and Computation. Addison Wesley, second edition. [Hwang, 2005] Hwang, M. (2005). Qunatitative Verification of Reconfigurable Automation Systems:DEVS Approach. In Proceed. of 2005 IEEE-CASE, pages Edmonton,Canada. IEEE. Submitted.
i P
2 3 L2 3M 33 22
[Hwang and Cho, 2004] Hwang, M. and Cho, S. (2004). Timed Analysis of Schedule Preserved DEVS. In Bruzzone, A. and Williams, E., editors, 2004 Summer Computer Simulation Conference, pages 173–178, San Jose, CA. SCS. [Silicon Graphics, 2004] Silicon Graphics (1993-2004). Standard Template Library Programmer’s Guide. http://www.sgi.com/tech/stl.
?
[Zeigler et al., 2000] Zeigler, B., H.Praehofer, and Kim, T. (2000). Theory of Modelling and Simulation: Integrating Discrete Event and Continuous Complex Dynamic Systems. Academic Press, London, second edition.