Simulation algorithms for coupled DEVS


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. Simulation_Algorithms_for_Coupled_DEVS#References| originally introduced the algorithms that handle time variables related to lifespan and elapsed time by introducing two other time variables, last event time,, and next event time with the following relations:

and

where denotes the current time. And the remaining time,
is equivalently computed as
apparently.
Based on these relationships, the algorithms to simulate the behavior of a given Coupled DEVS are written as follows.

Algorithms

DEVS-coordinator
Variables:
parent // parent coordinator
: // time of last event
: // time of next event
// the associated Coupled DEVS model
when receive init-message
for each do
send init-message to child
;
;
when receive star-message
if then
error: bad synchronization;

send star-messageto
;
;
when receive x-message
if and false then
error: bad synchronization;
for each do
send x-message to child
;
;
when receive y-message
for each do
send x-message to child
if then
send y-message to parent;
;
;