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 simulator implementations


slide-1
SLIDE 1

Discrete EVent System specification (DEVS)

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

  • A formal basis
  • for (low-level) representation
  • f all discrete event modelling formalisms
  • and simulator implementations

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

slide-2
SLIDE 2

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 2/26

slide-3
SLIDE 3

DEVS without external events (FSA)

s2 s1 s4 ta ta _int _int δ δ

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

slide-4
SLIDE 4

DEVS without external events (states)

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

δ_int(s2) δ_ int(s4)

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

slide-5
SLIDE 5

DEVS with external events

s2 s1 s4 ta ta _int _int δ δ

s3 _int ta _ext X δ δ

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

slide-6
SLIDE 6

DEVS with external events (states)

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 6/26

slide-7
SLIDE 7

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 7/26

slide-8
SLIDE 8

DEVS

✁ ✂

X

✄

S

✄

Y

✄

δint

✄

δext

✄

λ

✄

ta

☎

T

✁ ✆

time base

X

input set

ω : T

✝

X

✞ ✟

φ

✠

input segment

S

state set

Y

  • utput set

δint : S

✝

S

internal transition function

ta : S

✝ ✆☛✡ ✄

∞

time advance function

Q

✁ ✟ ☞

s

✄

e

✌ ✍

s

✎

S

✄ ✏

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 8/26

slide-9
SLIDE 9

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 9/26

slide-10
SLIDE 10

traf ficDEVS

✁ ✒

X

✄

S

✄

Y

✄

δint

✄

δext

✄

λ

✄

ta

✓

T

✁ ✆

X

✁ ✟

M

✄

A

✠

ω : T

✝

X

✞ ✟

φ

✠

S

✁ ✟

RG

✄

RY

✄

GR

✄

YR

✄

BB

✠

δint

☞

RG

✌ ✁

RY; δint

☞

RY

✌ ✁

GR δint

☞

GR

✌ ✁

YR; δint

☞

YR

✌ ✁

RG ta

☞

RG

✌ ✁

60s; ta

☞

RY

✌ ✁

10s ta

☞

GR

✌ ✁

50s; ta

☞

YR

✌ ✁

10s ta

☞

BB

✌ ✁ ✔

∞

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

slide-11
SLIDE 11

traf ficDEVS

✁ ✒

X

✄

S

✄

Y

✄

δint

✄

δext

✄

λ

✄

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

slide-12
SLIDE 12

Coupled DEVS

coupledDEVS

✕ ✂

Xsel f

✄

Ysel f

✄

D

✄ ✟

Mi

✠ ✄ ✟

Ii

✠ ✄ ✟

Zi

✖

j

✠ ✄

select

☎ ✟

Mi

✍

i

✎

D

✠✘✗

Mi

✁ ✂

Si

✄

tai

✄

δint

✖

i

✄

Xi

✄

δext

✖

i

✄

Yi

✄

λi

☎ ✄✚✙

i

✎

D

✗ ✟

Ii

✍

i

✎

D

✞ ✟

sel f

✠ ✠✘✗ ✙

i

✎

D

✞ ✟

sel f

✠

: Ii

✛

D

✞ ✟

sel f

✠✘✗ ✙

i

✎

D

✞ ✟

sel f

✠

: i

✜ ✎

Ii

✗

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

slide-13
SLIDE 13

Zi

✢

j output-to-input translation

✟

Zi

✖

j

✍

i

✎

D

✞ ✟

sel f

✠ ✄

j

✎

Ii

✠ ✄

Zsel f

✖

j

: Xsel f

✝

Xj

✄✚✙

j

✎

D

✄

Zi

✖

sel f

: Yi

✝

Ysel f

✄✚✙

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 13/26

slide-14
SLIDE 14

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 14/26

slide-15
SLIDE 15

Closure under coupling

From the coupled DEVS

✂

Xsel f

✄

Ysel f

✄

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 15/26

slide-16
SLIDE 16

Closure: state and time-advance

S

✁ ✑

i

✣

DQi

✄

where

Qi

✁ ✟ ☞

si

✄

ei

✌ ✍

s

✎

Si

✄ ✏

ei

✏

tai

☞

si

✌ ✠ ✄✚✙

i

✎

D

✗

ta : S

✝ ✆☛✡ ✄ ✔

∞

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 16/26

slide-17
SLIDE 17

Dealing with simultaneous events

Imminent components:

IMM

☞

s

✌ ✁ ✟

i

✎

D

✍

σi

✁

ta

☞

s

✌ ✠ ✗

select one component i

✦
  • f the coupled model

select : 2D

✝

D IMM

☞

s

✌ ✝

i

✦

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

slide-18
SLIDE 18

Output (at internal transition time)

λ

☞

s

✌ ✁

Zi

✧ ✖

sel f

☞

λi

✧ ☞

si

✧ ✌ ✌

,if sel f

✎

Ii

✧ ✄

φ ,if sel f

✜ ✎

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 18/26

slide-19
SLIDE 19

Internal transition function

δint

☞

s

✌ ✁ ☞ ✗ ✗ ✗ ✄ ☞

s

★

j

✄

e

★

j

✌ ✄ ✗ ✗ ✗ ✌ ✄

where

☞

s

★

j

✄

e

★

j

✌ ✁ ☞

δint

✖

j

☞

sj

✌ ✄ ✌ ✄

for j

✁

i

✦ ✄ ✁ ☞

δext

✖

j

☞

sj

✄

ej

✔

ta

☞

s

✌ ✄

Zi

✧ ✖

j

☞

λi

✧ ☞

si

✧ ✌ ✌ ✌ ✄ ✌ ✄

for j

✎

Ii

✧ ☞

and Zi

✧ ✖

j

☞

λi

✧ ☞

si

✧ ✌ ✌ ✩ ✁

φ

✌ ✄ ✁ ☞

sj

✄

ej

✔

ta

☞

s

✌ ✌ ✄
  • therwise
✗

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

slide-20
SLIDE 20

External transition function

δext

☞

s

✄

e

✄

x

✌ ✁ ☞ ✗ ✗ ✗ ✄ ☞

s

★

i

✄

e

★

i

✌ ✄ ✗ ✗ ✗ ✌ ✄

where

☞

s

★

i

✄

e

★

i

✌ ✁ ☞

δext

✖

i

☞

si

✄

ei

✔

e

✄

Zsel f

✖

i

☞

x

✌ ✌ ✄ ✌ ✄

for i

✎

Isel f

✄ ✁ ☞

si

✄

ei

✔

e

✌ ✄
  • therwise
✗

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

slide-21
SLIDE 21

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

slide-22
SLIDE 22

DEVS Solver

  • Iterative simulation of DEVS model
  • Possibly distributed implementation

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

slide-23
SLIDE 23

message m simulator coordinator

✪✘✫ ✬

from

✬

t

✭

simulator correct only if t

✮

tN y

✯

λ

✪

s

✭

send

✪✘✫ ✬

sel f

✬

t

✭

to i

✰

, where if y

✱ ✮

φ : i

✰ ✮

select

✪

imm children

✭

send

✪

λ

✪

s

✭ ✬

sel f

✬

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

✬

sel f

✬

tN

✭

to parent

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

slide-24
SLIDE 24

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

✳

Isel f : s

✯

δext

✪

s

✬

e

✬

x

✭

send

✪

Zsel f

✼

i

✪

x

✭ ✬

sel f

✬

t

✭

to i

tL

✯

t active children

✯

active children

✷ ✲

i

✶

tN

✯

tL

✸

ta

✪

s

✭

send

✪

done

✬

sel f

✬

tN

✭

to parent

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

slide-25
SLIDE 25

message m simulator coordinator

✪

y

✬

from

✬

t

✭ ✻

i

✳

If rom

✽ ✲

sel f

✶

:

send

✪

Zf rom

✼

i

✪

y

✭ ✬

from

✬

t

✭

to i

active children

✯

active children

✷ ✲

i

✶

if sel f

✳

If rom :

send

✪

Zf rom

✼

sel f

✪

y

✭ ✬

sel f

✬

t

✭

to parent

✪

done

✬

from

✬

t

✭

active children

✯

active children

✽ ✲

from

✶

if active children

✮

/ 0: tL

✯

t tN

✯

min

✲

Mi

✵

tN

✴

i

✳

D

✶

send

✪

done

✬

sel f

✬

tN

✭

to parent

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

slide-26
SLIDE 26

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 26/26