Discrete EVent System specification (DEVS) Bernard Zeigler (1976 - - PowerPoint PPT Presentation

discrete event system specification devs
SMART_READER_LITE
LIVE PREVIEW

Discrete EVent System specification (DEVS) Bernard Zeigler (1976 - - PowerPoint PPT Presentation

Discrete EVent System specification (DEVS) Bernard Zeigler (1976 Theory of Modelling and Simulation) A formal basis for (low-level) representation of all discrete event modelling formalisms (and even others, after approximation)


slide-1
SLIDE 1

Discrete EVent System specification (DEVS)

Bernard Zeigler (1976 “Theory of Modelling and Simulation”)

  • A formal basis
  • for (low-level) representation
  • of all discrete event modelling formalisms

(and even others, after approximation)

  • and simulator implementations

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 1/37

slide-2
SLIDE 2

DEVS’s central place in the Formalism Transformation Graph

DEVS

Process Interaction Discrete Event state trajectory data (observation frame) Petri Nets Statecharts scheduling-hybrid-DAE Bond Graph a-causal Bond Graph causal DAE non-causal set DAE causal set PDE Transfer Function Difference Equations System Dynamics KTG Cellular Automata Event Scheduling Discrete Event 3 Phase Approach Discrete Event DAE causal sequence (sorted) DEVS&DESS Activity Scanning Discrete Event Timed Automata Causal Block Diagram Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 2/37

slide-3
SLIDE 3

Event Graphs

red 50 green 100 yellow 15 δ δ δ to_red to_yellow to_green

schedule in 15 schedule in 50 schedule in 100

yellow red green to_red to_green to_yellow to_red

states events t 50 100 15

state trajectory Finite State Automaton Event (Scheduling) Graph red green yellow to_green to_yellow to_red

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 3/37

slide-4
SLIDE 4

DEVS without external events (model)

s2 s1 s4 ta ta _int _int δ δ

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 4/37

ΖΕςΜΕΦΠΙΩ ΞΜΘΙ! ΓΨςςΙΡΞΧΩΞΕΞΙ!Ω ΩΜΘΨΠΕΞΣς [ΛΜΠΙ8ςΨΙ ΞΜΘΙ!ΞΕΓΨςςΙΡΞΧΩΞΕΞΙ ΓΨςςΙΡΞΧΩΞΕΞΙ! ΗΙΠΞΕΧΜΡΞΓΨςςΙΡΞΧΩΞΕΞΙ 3ΤΙςΕΞΜΣΡΕΠ7ΙΘΕΡΞΜΓΩ

slide-5
SLIDE 5

DEVS without external events (trajectories)

S t s1 s2 s3 s4 ta (s2) ta (s4)

δ_int(s2) δ_ int(s4)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 5/37

slide-6
SLIDE 6

DEVS with external events (model)

s2 s1 s4 ta ta _int _int δ δ

s3 _int ta _ext X δ δ

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 6/37 ΖΕςΜΕΦΠΙΩ ΞΜΘΙ! ΓΨςςΙΡΞΧΩΞΕΞΙ!Ω ΩΜΘΨΠΕΞΣς [ΛΜΠΙ8ςΨΙ ΡΙ∴ΞΧΞΜΘΙ!ΞΜΘΙΞΕΓΨςςΙΡΞΧΩΞΕΞΙ ΜϑΞΜΘΙΧΡΙ∴ΞΧΙ∴ΞΧΙΖ !ΡΙ∴ΞΧΞΜΘΙ ΓΨςςΙΡΞΧΩΞΕΞΙ! ΗΙΠΞΕΧΙ∴ΞΓΨςςΙΡΞΧΩΞΕΞΙΙΡΙ∴ΞΧΙ∴ΞΧΙΖ ΞΜΘΙ!ΞΜΘΙΧΡΙ∴ΞΧΙ∴ΞΧΙΖ ΙΠΩΙ ΞΜΘΙ!ΡΙ∴ΞΧΞΜΘΙ ΤςΣΗΨΓΙΣΨΞΤΨΞΙΖΙΡΞΠΕΘΦΗΕΓΨςςΙΡΞΧΩΞΕΞΙ ΓΨςςΙΡΞΧΩΞΕΞΙ!ΗΙΠΞΕΧΜΡΞΓΨςςΙΡΞΧΩΞΕΞΙ

3ΤΙςΕΞΜΣΡΕΠ7ΙΘΕΡΞΜΓΩ

slide-7
SLIDE 7

DEVS with external events (trajectories)

S

t

s1 s2 s3 s4 (s2,0) (s2,e) e e (s4,e) _ext((s4,e),x) _int(s2) _int(s4) (s4,0) ta(s4) ta(s2) (s2,0) δ δ δ

t

X x tx

t

Y

y2 y3 y1 λ(s2) λ(s3) ta(s3) _int(s3) δ (s2,ta(s2)) (s3,0) φ φ

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 7/37

Υ!ΩΙ

slide-8
SLIDE 8

DEVS essence

s S T _ext((s,e),x) _int(s) ta(s) (s,e) (s,0) δ δ

tx

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 8/37

slide-9
SLIDE 9

DEV S = X, S, Y, δint, δext, λ, ta T = R time base X input set ω : T → X ∪ {φ} input segment S state set Y

  • utput set

δint : S → S internal transition function ta : S → R+ 0, ∞ time advance function Q = {(s, e)|s ∈ S, 0 ≤ e ≤ ta(s)} total state, e is elapsed time δext : Q × X → S external transition function λ : S → Y

  • utput function

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 9/37

slide-10
SLIDE 10

Traffic Lights

M M A M M

R R R G Y Y B B G R

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 10/37

slide-11
SLIDE 11

trafficDEV S =< X, S, Y, δint, δext, λ, ta > T = R X = {M, A} ω : T → X ∪ {φ} S = {RG, RY, GR, Y R, BB} δint(RG) = RY ; δint(RY ) = GR δint(GR) = Y R; δint(Y R) = RG ta(RG) = 60s; ta(RY ) = 10s ta(GR) = 50s; ta(Y R) = 10s ta(BB) = +∞

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 11/37

slide-12
SLIDE 12

trafficDEV S =< X, S, Y, δint, δext, λ, ta > δext((RG, e), M) = BB δext((RY, e), M) = BB δext((GR, e), M) = BB δext((Y R, e), M) = BB δext((BB, e), A) = RY Y = {GREY, Y ELLOW, BLINK} λ(RG) = λ(RY ) = λ(GR) = GREY λ(Y R) = Y ELLOW λ(BB) = BLINK

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 12/37

slide-13
SLIDE 13

Coupled DEVS

coupledDEV S ≡ Xself, Yself, D, {Mi}, {Ii}, {Zi,j}, select {Mi|i ∈ D}. Mi = Si, tai, δint,i, Xi, δext,i, Yi, λi, ∀i ∈ D. {Ii|i ∈ D ∪ {self}}. ∀i ∈ D ∪ {self} : Ii ⊆ D ∪ {self}. ∀i ∈ D ∪ {self} : i / ∈ Ii. Ii are the influencee sets describing the connection topology

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 14/37

slide-14
SLIDE 14

Zi,j output-to-input translation

{Zi,j|i ∈ D ∪ {self}, j ∈ Ii}, Zself,j : Xself → Xj , ∀j ∈ D, Zi,self : Yi → Yself , ∀i ∈ D, Zi,j : Yi → Xj , ∀i, j ∈ D. Together, Ii and Zi,j completely specify the coupling (structure and behaviour)

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 16/37

slide-15
SLIDE 15

Tie-breaking among simultaneous events

select : 2D → D Choose a unique component from any non-empty subset E of D: select(E) ∈ E. E corresponds to the set of all components having a state transition simultaneously (collisions).

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 18/37

slide-16
SLIDE 16

Closure under coupling

From the coupled DEVS Xself, Yself, D, {Mi}, {Ii}, {Zi,j}, select, with all components Mi atomic DEVS models Mi = Si, tai, δint,i, Xi, δext,i, Yi, λi, ∀i ∈ D the atomic DEVS S, ta, δint, X, δext, Y, λ is constructed.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 20/37

slide-17
SLIDE 17

Closure: state and time-advance

S = ×i∈DQi, where Qi = {(si, ei)|s ∈ Si, 0 ≤ ei ≤ tai(si)}, ∀i ∈ D. ta : S → R+ 0, +∞ Select the most imminent event time, = smallest time remaining until internal transition, of all the components ta(s) = min{σi = tai(si) − ei|i ∈ D}.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 22/37

slide-18
SLIDE 18

Dealing with simultaneous events

Imminent components: IMM(s) = {i ∈ D|σi = ta(s)}. select one component i∗ of the coupled model select : 2D → D IMM(s) → i∗

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 24/37

slide-19
SLIDE 19

Output (at internal transition time)

λ(s) = Zi∗,self(λi∗(si∗)) ,if self ∈ Ii∗, φ ,if self / ∈ Ii∗. Conceptually, the non-event φ is generated if i∗ is not connected to the

  • utput of the coupled model.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 26/37

slide-20
SLIDE 20

Internal transition function

δint(s) = (. . . , (s′

j, e′ j), . . .), where

(s′

j, e′ j)

= (δint,j(sj), 0) , for j = i∗, = (δext,j(sj, ej + ta(s), Zi∗,j(λi∗(si∗))), 0) , for j ∈ Ii∗ (and Zi∗,j(λi∗(si∗)) = φ = (sj, ej + ta(s)) , otherwise.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 28/37

slide-21
SLIDE 21

External transition function

δext(s, e, x) = (. . . , (s′

i, e′ i), . . .), where

(s′

i, e′ i)

= (δext,i(si, ei + e, Zself,i(x)), 0) , for i ∈ Iself, = (si, ei + e) , otherwise.

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 30/37

slide-22
SLIDE 22

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 31/37

slide-23
SLIDE 23

DEVS limitations

  • a conflict due to simultaneous internal and external events is

resolved by ignoring the internal event. It should be possible to explicitly specify behaviour in case of conflicts;

  • there is limited potential for parallel implementation;
  • the select function is an artificial legacy of the semantics of

traditional sequential simulators based on an event list;

  • it is not possible to explicitly describe variable structure.

Some of these are resolved in parallel DEVS

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 32/37

slide-24
SLIDE 24

DEVS Solver

  • Iterative simulation of DEVS model
  • Possibly distributed implementation

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 33/37

slide-25
SLIDE 25

message m simulator coordinator (∗, from, t) simulator correct only if t = tN y ← λ(s) send (∗, self, t) to i∗, where if y = φ : i∗ = select(imm children) send (λ(s), self, t) to parent imm children = {i ∈ D|Mi.tN = t} s ← δint(s) active children ← active children ∪ {i∗} tL ← t tN ← tL + ta(s) send (done, self, tN) to parent

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 34/37

slide-26
SLIDE 26

message m simulator coordinator (x, from, t) simulator correct only if tL ≤ t ≤ tN (ignore δint to resolve a t = tN conflict) e ← t − tL ∀i ∈ Iself : s ← δext(s, e, x) send (Zself,i(x), self, t) to i tL ← t active children ← active children ∪ {i} tN ← tL + ta(s) send (done, self, tN) to parent

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 35/37

slide-27
SLIDE 27

message m simulator coordinator (y, from, t) ∀i ∈ Ifrom \ {self} : send (Zfrom,i(y), from, t) to i active children ← active children ∪ {i} if self ∈ Ifrom : send (Zfrom,self(y), self, t) to parent (done, from, t) active children ← active children \ {from} if active children = ∅: tL ← t tN ← min{Mi.tN|i ∈ D} send (done, self, tN) to parent

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 36/37

slide-28
SLIDE 28

DEVS simulator main loop

t ← tN of topmost coordinator repeat until t ≥ tend (or some other termination condition) send (∗, main, t) to topmost coupled model top wait for (done, top, tN) t ← tN

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 37/37

slide-29
SLIDE 29

DEVS simulator main loop

t ← tN of topmost coordinator repeat until t ≥ tend (or some other termination condition) send (∗, main, t) to topmost coupled model top wait for (done, top, tN) t ← tN

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 37/37

slide-30
SLIDE 30

DEVS simulator main loop

t ← tN of topmost coordinator repeat until t ≥ tend (or some other termination condition) send (∗, main, t) to topmost coupled model top wait for (done, top, tN) t ← tN

Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 37/37