Simulation algorithms for atomic DEVS
# Simulation algorithms for atomic DEVS

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). originally introduced the algorithms that handle time variables related to lifespan $t_{s}\in [0,\infty ]$ and elapsed time $t_{e}\in [0,\infty )$ by introducing two other time variables, last event time, $t_{l}\in [0,\infty )$, and next event time $t_{n}\in [0,\infty ]$ with the following relations:

$\,t_{e}=t-t_{l}$

and

$\,t_{s}=t_{n}-t_{l}$

where $t\in [0,\infty )$ denotes the current time. And the remaining time,

$\,t_{r}=t_{s}-t_{e}$

is equivalently computed as

$\,t_{r}=t_{n}-t$

, apparently $t_{r}\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.

## View 1: total states = states * elapsed times

As addressed in Behavior of Atomic DEVS, when DEVS receives an input event, right calling $\delta _{ext}$, the last event time,$t_{l}$ is set by the current time,$t$, thus the elapsed time$t_{e}$ becomes zero because $t_{e}=t-t_{l}$.

## 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 $\delta _{ext}$, last event time,$t_{l}$, and next event time,$t_{n}$,consequently, elapsed time, $t_{e}$, and lifespan$t_{n}$, are updated (if $b=1$) or preserved (if $b=0$).

