Simulation algorithms for coupled DEVS

From HandWiki

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=t−tl

and

ts=tn−tl

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

tr=ts−te

is equivalently computed as

tr=tn−t,

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 i∈D do
            send init-message(t) to child i
        tl←max⁡{tli:i∈D};
        tn←min⁡{tni:i∈D};
    when receive star-message(Time t)
        if t≠tn then
            error: bad synchronization;
        i*←Select({i∈D:tni=tn});
        send star-message(t)to i*
        tl←max⁡{tli:i∈D};
        tn←min⁡{tni:i∈D};
    when receive x-message(x∈X, Time t)
        if (tl≤t and t≤tn) == false then
            error: bad synchronization;
        for each (x,xi)∈Cxx do
            send x-message(xi,t) to child i
        tl←max⁡{tli:i∈D};
        tn←min⁡{tni:i∈D};
    when receive y-message(yi∈Yi, 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;
        tl←max⁡{tli:i∈D};
        tn←min⁡{tni:i∈D};

See also

  • Coupled DEVS
  • Behavior of Coupled DEVS
  • Simulation Algorithms for Atomic DEVS

References

  • [Zeigler84] Bernard Zeigler (1984). Multifacetted Modeling and Discrete Event Simulation. Academic Press, London; Orlando. ISBN 978-0-12-778450-2. 
  • [ZKP00] Bernard Zeigler; Tag Gon Kim; Herbert Praehofer (2000). Theory of Modeling and Simulation (second ed.). Academic Press, New York. ISBN 978-0-12-778455-7.