Simulation algorithms for coupled DEVS explained

Given a coupled DEVS model, simulation algorithms are methods to generate the model's legal behaviors, which are a set of trajectories not to reach illegal states. (see behavior of a Coupled DEVS model.) [Zeigler84] originally introduced the algorithms that handle time variables related to lifespan

ts\in[0,infty]

and elapsed time

te\in[0,infty)

by introducing two other time variables, last event time,

tl\in[0,infty)

, and next event time

tn\in[0,infty]

with the following relations:

te=t-tl

and

ts=tn-tl

where

t\in[0,infty)

denotes the current time. And the remaining time,

tr=ts-te

is equivalently computed as

tr=tn-t,

apparently

tr\in[0,infty]

.Based on these relationships, the algorithms to simulate the behavior of a given Coupled DEVS are written as follows.

Algorithm

algorithm DEVS-coordinator Variables: parent // parent coordinator

tl

: // time of last event

tn

: // time of next event

N=(X,Y,D,\{Mi\},Cxx,Cyx,Cyy,Select)

// the associated Coupled DEVS model when receive init-message(Time t) for each

i\inD

do send init-message(t) to child

i

tl\leftarrowmax\{tli:i\inD\}

;

tn\leftarrowmin\{tni:i\inD\}

; when receive star-message(Time t) if

t\netn

then error: bad synchronization;

i*\leftarrowSelect(\{i\inD:tni=tn\});

send star-message(t)to

i*

tl\leftarrowmax\{tli:i\inD\}

;

tn\leftarrowmin\{tni:i\inD\}

; when receive x-message(

x\inX

, Time t) if

(tl\let

and

t\letn)

false then error: bad synchronization; for each

(x,xi)\inCxx

do send x-message(

xi

,t) to child

i

tl\leftarrowmax\{tli:i\inD\}

;

tn\leftarrowmin\{tni:i\inD\}

; when receive y-message(

yi\inYi

, Time t) for each

(yi,xi)\inCyx

do send x-message(

xi

,t) to child

i

if

Cyy(yi)\ne\phi

then send y-message(

Cyy(yi)

, t) to parent;

tl\leftarrowmax\{tli:i\inD\}

;

tn\leftarrowmin\{tni:i\inD\}

;

See also

References