� � � � 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 simulator implementations Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 1/26
Event Graphs state trajectory states green red yellow 50 100 15 t to_red to_green to_yellow to_red events Finite State Automaton Event (Scheduling) Graph δ schedule schedule in 15 in 50 green to_green to_red to_green to_yellow 100 green red red 50 to_yellow δ to_red yellow δ schedule 15 in 100 yellow Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 2/26
DEVS without external events (FSA) s2 δ _int ta s4 ta s1 δ _int Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 3/26
DEVS without external events (states) S s4 ta (s4) s3 δ_ int(s2) δ_ int(s4) s2 ta (s2) s1 t Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 4/26
DEVS with external events δ _int s3 ta δ _ext s2 δ X _int ta s4 ta s1 δ _int Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 5/26
DEVS with external events (states) X x φ t tx S (s4,e) e (s4,0) s4 ta(s4) _ext((s4,e),x) δ (s3,0) s3 δ _int(s2) ta(s3) _int(s3) δ (s2,e) (s2,0) e (s2,ta(s2)) (s2,0) s2 ta(s2) _int(s4) δ s1 t Y λ (s3) y3 λ (s2) y2 y1 φ t Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 6/26
DEVS essence S δ _ext((s,e),x) (s,0) (s,e) s ta(s) δ _int(s) tx T Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 7/26
✄ ✁ ✟ ✏ ✝ ✝ ✁ ✝ ✄ ✝ ✑ ✟ ✝ ☞ ✠ ✄ ✌ ✌ ✍ ☞ ✎ ✏ ✞ ✠ ✄ ✂ ✁ ✄ ✄ ✄ ✄ ☎ ✄ ✆ δ int δ ext λ DEVS X S Y ta T time base X input set ω : T φ X input segment S state set Y output set δ int : S S internal transition function ta : S time advance function ✆☛✡ ∞ 0 Q s e s S 0 e ta s total state, e is elapsed time δ ext : Q X S external transition function λ : S Y output function Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 8/26
Traffic Lights G R R M Y M B B M M G A R R Y Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 9/26
✁ ✄ ✟ ✁ ✠ ✌ ✁ ✟ ☞ ✄ ✁ ✄ ✌ ☞ ☞ ✄ ✁ ✠ ✌ ☞ ☞ ✌ ✁ ✁ ☞ ✌ ✌ ✞ ✝ ☞ ☞ ✒ ✔ ✄ ✁ ✄ ✌ ✄ ✄ ✄ ✌ ✄ ✓ ✁ ✁ ✆ ✌ ✁ ✟ ☞ ✄ ✁ ✠ ✁ δ int δ ext λ traf ficDEVS X S Y ta T X M A ω : T φ X S RG RY GR YR BB δ int RY ; δ int RG RY GR δ int YR ; δ int GR YR RG ta RG 60 s ; ta RY 10 s ta GR 50 s ; ta YR 10 s ∞ ta BB Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 10/26
✌ ✌ ✄ ✁ ✌ ✁ ✌ ☞ ☞ ☞ ✠ ✄ ✄ ✌ ✄ ✄ ✁ ☞ ✟ ✁ ☞ ☞ ✁ ✄ ✌ ✁ ✄ ✄ ✌ ✁ ✌ ✄ ✌ ✄ ☞ ✌ ✒ ✁ ✄ ✌ ✄ ☞ ✄ ✄ ✄ ✄ ✁ ✓ ✌ ☞ ✌ ☞ ☞ ✁ ☞ ✁ ✌ ☞ ☞ ✄ ✌ ✁ ✄ ☞ δ int δ ext λ traf ficDEVS X S Y ta δ ext RG e M BB δ ext RY e M BB δ ext GR e M BB δ ext YR e M BB δ ext BB e A RY Y GREY YELLOW BLINK λ λ λ RG RY GR GREY λ YR YELLOW λ BB BLINK Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 11/26
✄ ✙ ✎ ✛ ✠ ✟ ✁ ✂ ✞ ✄ ✎ ✄ ✖ ✍ ✠ ✄ ✟ ✄ ✞ ✖ ✎ ✄ ✍ ✟ ✗ ✞ ✟ ✎ ✄ ✕ ✂ ✗ ✄ ✎ ✄ ✜ ✄ ✟ ✠ ✠ ✟ ✟ ✟ ✠ ✄ ✟ ✞ ✖ ✎ ✠ ✄ ✙ ☎ ☎ Coupled DEVS coupledDEVS X sel f Y sel f D M i I i Z i select j M i i D ✠✘✗ δ int δ ext λ i M i S i ta i X i Y i i D i i ✄✚✙ I i i D sel f ✠✘✗ : I i i D sel f D sel f ✠✘✗ i D sel f : i I i Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 12/26
✎ ✠ ✄ ✢ ✖ ✖ ✄ ✄ ✠ ✖ ✎ ✗ ✄ ✎ ✎ ✟ ✞ ✝ ✎ ✄ ✍ ✝ ✖ ✖ ✟ ✝ j output-to-input translation Z i Z i i D sel f j I i j Z sel f : X sel f X j j D j ✄✚✙ Z i : Y i Y sel f i D sel f ✄✚✙ Z i : Y i X j i j D j ✄✚✙ Together, I i and Z i j completely specify the coupling (structure and behaviour) Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 13/26
✎ ☞ ✝ ✗ ✌ Tie-breaking among simultaneous events select : 2 D 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 14/26
✄ ☎ ✄ ✂ ✄ ✄ ✖ ✄ ✄ ✖ ✄ ☎ ✄ ☎ ✄ ✎ ✄ ✂ ✄ ✄ ✄ ✁ ✄ ✄ ✂ ✄ ✄ ✄ ✟ ✠ ✄ ✠ ✟ ✖ ✠ ✟ Closure under coupling From the coupled DEVS X sel f Y sel f D M i I i Z i select j with all components M i atomic DEVS models δ int δ ext λ i M i S i ta i X i Y i i D i i ✄✚✙ the atomic DEVS δ int δ ext λ S ta X Y is constructed. Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 15/26
✗ ✍ ✄ ✠ ✌ ✔ ☞ ✁ ✏ ☞ ✏ ✌ ✄ ✁ ✎ ✟ ✌ ✎ ✁ ✄ ☞ ☞ ✟ ✁ ✍ ✎ ✄ ✠ ✣ ✗ ✑ ✁ ✝ Closure: state and time-advance S D Q i i where Q i s i e i s S i 0 e i ta i s i i D ✄✚✙ ta : S ✆☛✡ ∞ 0 Select the most imminent event time, smallest time remaining until internal transition, of all the components σ i ta s min ta i s i e i i D ✌✥✤ Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 16/26
✗ ✎ ☞ ✦ ✁ ✝ ✍ ☞ ✌ ✌ ✟ ✁ ✌ ✝ ☞ ✦ ✠ Dealing with simultaneous events Imminent components: σ i IMM s i D ta s select one component i of the coupled model 2 D : select D IMM s i Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 17/26
✎ ☞ ✌ ✌ ✧ ✜ ☞ ✧ ✎ ✧ ✧ ✖ ✧ ✗ ✁ ✌ ✦ ☞ ✄ Output (at internal transition time) λ λ i s Z i s i ,if sel f I i sel f φ ,if sel f I i Conceptually, the non-event φ is generated if i is not connected to the output of the coupled model. Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 18/26
✔ ✦ ☞ ✧ ✖ ☞ ☞ ✁ ✄ ✧ ✄ ✁ ✌ ✄ ✌ ✌ ✄ ✌ ☞ ✖ ☞ ✄ ✌ ✧ ✄ ☞ ✧ ✌ ☞ ✖ ✧ ✧ ✎ ✄ ✌ ✧ ☞ ☞ ✩ ✁ ✌ ✄ ★ ✌ ✄ ✌ ★ ✄ ☞ ✗ ✌ ✗ ✗ ☞ ✁ ✌ ✗ ☞ ☞ ✄ ✖ ✄ ✌ ☞ ✁ ✌ ✄ ★ ✁ ☞ ✗ ★ ✄ ☞ ✔ ✄ ✌ ✗ ✗ ✌ Internal transition function δ int s s e where j j δ int s e s j 0 for j i j j j δ ext λ i s j e j ta s Z i s i 0 for j I i j j λ i φ and Z i s i j s j e j ta s otherwise Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 19/26
☞ ✌ ✗ ✌ ✄ ✄ ☞ ✎ ★ ✄ ✄ ★ ✗ ✄ ✌ ✁ ✌ ✌ ✖ ☞ ☞ ✖ ✄ ✗ ✄ ✔ ✗ ☞ ✗ ✄ ✄ ✄ ✌ ✌ ✁ ☞ ✗ ✌ ✗ ✄ ☞ ✔ ★ ✄ ✄ ☞ ★ ✁ ✄ External transition function δ ext s e x s e where i i δ ext s e s i e i e Z sel f x 0 for i I sel f i i i i s i e i e otherwise Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 20/26
� � � � 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 21/26
� � DEVS Solver Iterative simulation of DEVS model Possibly distributed implementation Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 22/26
✲ ✳ ✰ ✵ ✬ ✱ ✮ ✴ ✬ ✰ ✮ ✪ ✭ ✰ ✭ ✭ ✪ ✲ ✪ ✮ ✭ ✬ ✪ ✮ ✬ ✯ ✷ ✶ ✬ ✯ ✬ ✯ ✭ ✭ ✮ ✪ ✬ ✯ ✸ ✪ ✯ ✭ ✪ ✶ ✬ ✭ ✭ message m simulator coordinator from t simulator correct only if t t N ✪✘✫ λ y s sel f t to i send , where ✪✘✫ φ : if y i select imm children λ send s sel f t to parent imm children i D M i t N t δ int s s active children active children i t L t t N t L ta s done sel f t N to parent send Hans Vangheluwe hv@cs.mcgill.ca Modelling and Simulation: DEVS 23/26
Recommend
More recommend