Simulation algorithms for atomic DEVS explained

Given an atomic DEVS model, simulation algorithms are methods to generate the model's legal behaviors which are trajectories not to reach to illegal states. (see Behavior of DEVS). [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]

.

Since the behavior of a given atomic DEVS model can be defined in two different views depending on the total state and the external transition function (refer to Behavior of DEVS), the simulation algorithms are also introduced in two different views as below.

Common parts

Regardless of two different views of total states, algorithms for initialization and internal transition cases are commonly defined as below.

DEVS-simulator variables: parent // parent coordinator

tl

// time of last event

tn

// time of next event

A=(X,Y,S,ta,\deltaext,\deltaint,λ)

// the associated Atomic DEVS model when receive init-message(Time

t

)

tl\leftarrowt;

tn\leftarrowtl+ta(s);

when receive star-message(Time

t

) if

t\netn

then error: bad synchronization;

y\leftarrowλ(s);

send y-message(

y,t

) to parent;

s\leftarrow\deltaint(s)

tl\leftarrowt;

tn\leftarrowtl+ta(s);

View 1: total states = states * elapsed times

As addressed in Behavior of Atomic DEVS, when DEVS receives an input event, right calling

\deltaext

, the last event time,

tl

is set by the current time,

t

, thus the elapsed time

te

becomes zero because

te=t-tl

.

when receive x-message(

x\inX

, Time

t

) if

(tl\let

and

t\letn)

false then error: bad synchronization;

s\leftarrow\deltaext(s,t-tl,x)

tl\leftarrowt;

tn\leftarrowtl+ta(s);

View 2: total states = states * lifespans * elapsed times

Notice that as addressed in Behavior of Atomic DEVS, depending on the value of

b

return by

\deltaext

, last event time,

tl

, and next event time,

tn

,consequently, elapsed time,

te

, and lifespan

tn

, are updated (if

b=1

) or preserved (if

b=0

).

when receive x-message(

x\inX

, Time

t

) if

(tl\let

and

t\letn)

false then error: bad synchronization;

(s,b)\leftarrow\deltaext(s,t-tl,x)

if

b=1

then

tl\leftarrowt;

tn\leftarrowtl+ta(s);

See also

References