Simulation algorithms for coupled DEVS

From testwiki
Revision as of 19:47, 22 December 2022 by imported>Frap (Algorithms)
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search

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[0,]

and elapsed time

te[0,)

by introducing two other time variables, last event time,

tl[0,)

, and next event time

tn[0,]

with the following relations:

te=ttl

and

ts=tntl

where t[0,) denotes the current time. And the remaining time,

tr=tste

is equivalently computed as

tr=tnt,

apparently

tr[0,]

.

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 iD do
            send init-message(t) to child i
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive star-message(Time t)
        if ttn then
            error: bad synchronization;
        i*Select({iD:tni=tn});
        send star-message(t)to i*
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive x-message(xX, Time t)
        if (tlt and ttn) == false then
            error: bad synchronization;
        for each (x,xi)Cxx do
            send x-message(xi,t) to child i
        tlmax{tli:iD};
        tnmin{tni:iD};
    when receive y-message(yiYi, Time t)
        for each (yi,xi)Cyx do
            send x-message(xi,t) to child i
        if Cyy(yi)ϕ then
            send y-message(Cyy(yi), t) to parent;
        tlmax{tli:iD};
        tnmin{tni:iD};

See also

References