# Behavior of coupled DEVS

DEVS is closed under coupling [Zeigper84] [ZPK00]. In other words, given a coupled DEVS model ${\displaystyle N}$, its behavior is described as an atomic DEVS model ${\displaystyle M}$. For a given coupled DEVS ${\displaystyle N}$, once we have an equivalent atomic DEVS ${\displaystyle M}$, behavior of ${\displaystyle M}$ can be referred to behavior of atomic DEVS which is based on Timed Event System.

Similar to behavior of atomic DEVS, behavior of the Coupled DEVS class is described depending on definition of the total state set and its handling as follows.

## View1: Total States = States * Elapsed Times

Given a coupled DEVS model ${\displaystyle N=}$, its behavior is described as an atomic DEVS model ${\displaystyle M=}$

where

• ${\displaystyle X}$ and ${\displaystyle Y}$ are the input event set and the output event set, respectively.
• ${\displaystyle S={\underset {i\in D}{\times }}Q_{i}}$ is the partial state set where ${\displaystyle Q_{i}=\{(s_{i},t_{ei})|s_{i}\in S_{i},t_{ei}\in (\mathbb {T} \cap [0,ta_{i}(s_{i})])\}}$ is the total state set of component ${\displaystyle i\in D}$ (Refer to View1 of Behavior of DEVS), where ${\displaystyle \mathbb {T} =[0,\infty )}$ is the set of non-negative real numbers.
• ${\displaystyle s_{0}={\underset {i\in D}{\times }}q_{0i}}$ is the initial state set where ${\displaystyle q_{0i}=(s_{0i},0)}$ is the total initial state of component ${\displaystyle i\in D}$.
• ${\displaystyle ta:S\rightarrow \mathbb {T} ^{\infty }}$ is the time advance function, where ${\displaystyle \mathbb {T} ^{\infty }=[0,\infty ]}$ is the set of non-negative real numbers plus infinity.Given ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots )}$,
${\displaystyle ta(s)=\min\{ta_{i}(si)-t_{ei}|i\in D\}.}$

• ${\displaystyle \delta _{ext}:Q\times X\rightarrow S}$ is the external state function. Given a total state ${\displaystyle q=(s,t_{e})}$ where ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots ),t_{e}\in (\mathbb {T} \cap [0,ta(s)])}$, and input event ${\displaystyle x\in X}$, the next state is given by
${\displaystyle \delta _{ext}(q,x)=s'=(\ldots ,(s_{i}',t_{ei}'),\ldots )}$

where

${\displaystyle (s_{i}',t_{ei}')={\begin{cases}(\delta _{ext}(s_{i},t_{ei},x_{i}),0)&{\text{if }}(x,x_{i})\in C_{xx}\\(s_{i},t_{ei})&{\text{otherwise}}.\end{cases}}}$

Given the partial state ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots )\in S}$, let ${\displaystyle IMM(s)=\{i\in D|ta_{i}(s_{i})=ta(s)\}}$ denote the set of imminent components. The firing component ${\displaystyle i^{*}\in D}$ which triggers the internal state transition and an output event is determined by

${\displaystyle i^{*}=Select(IMM(s)).}$
• ${\displaystyle \delta _{int}:S\rightarrow S}$ is the internal state function. Given a partial state ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots )}$, the next state is given by
${\displaystyle \delta _{int}(s)=s'=(\ldots ,(s_{i}',t_{ei}'),\ldots )}$

where

${\displaystyle (s_{i}',t_{ei}')={\begin{cases}(\delta _{int}(s_{i}),0)&{\text{if }}i=i^{*}\\(\delta _{ext}(s_{i},t_{ei},x_{i}),0)&{\text{if }}(\lambda _{i^{*}}(s_{i^{*}}),x_{i})\in C_{yx}\\(s_{i},t_{ei})&{\text{otherwise}}.\end{cases}}}$
• ${\displaystyle \lambda :S\rightarrow Y^{\phi }}$ is the output function. Given a partial state ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots )}$,
${\displaystyle \lambda (s)={\begin{cases}\phi &{\text{if }}\lambda _{i^{*}}(s_{i^{*}})=\phi \\C_{yy}(\lambda _{i^{*}}(s_{i^{*}}))&{\text{otherwise}}.\end{cases}}}$

## View2: Total States = States * Lifespan * Elapsed Times

Given a coupled DEVS model ${\displaystyle N=}$, its behavior is described as an atomic DEVS model ${\displaystyle M=}$

where

• ${\displaystyle X}$ and ${\displaystyle Y}$ are the input event set and the output event set, respectively.
• ${\displaystyle S={\underset {i\in D}{\times }}Q_{i}}$ is the partial state set where ${\displaystyle Q_{i}=\{(s_{i},t_{si},t_{ei})|s_{i}\in S_{i},t_{si}\in \mathbb {T} ^{\infty },t_{ei}\in (\mathbb {T} \cap [0,t_{si}])\}}$ is the total state set of component ${\displaystyle i\in D}$ (Refer to View2 of Behavior of DEVS).
• ${\displaystyle s_{0}={\underset {i\in D}{\times }}q_{0i}}$ is the initial state set where ${\displaystyle q_{0i}=(s_{0i},ta_{i}(s_{0i}),0)}$ is the total initial state of component ${\displaystyle i\in D}$.
• ${\displaystyle ta:S\rightarrow \mathbb {T} ^{\infty }}$ is the time advance function. Given ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots )}$,
${\displaystyle ta(s)=\min\{t_{si}-t_{ei}|i\in D\}.}$

• ${\displaystyle \delta _{ext}:Q\times X\rightarrow S\times \{0,1\}}$ is the external state function. Given a total state ${\displaystyle q=(s,t_{s},t_{e})}$ where ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots ),t_{s}\in \mathbb {T} ^{\infty },t_{e}\in (\mathbb {T} \cap [0,t_{s}])}$, and input event ${\displaystyle x\in X}$, the next state is given by
${\displaystyle \delta _{ext}(q,x)=((\ldots ,(s_{i}',t_{si}',t_{ei}'),\ldots ),b)}$

where

${\displaystyle (s_{i}',t_{si}',t_{ei}')={\begin{cases}(s_{i}',ta_{i}(s_{i}'),0)&{\text{if }}(x,x_{i})\in C_{xx},\delta _{ext}(s_{i},t_{si},t_{ei},x_{i})=(s_{i}',1)\\(s_{i}',t_{si},t_{ei})&{\text{if }}(x,x_{i})\in C_{xx},\delta _{ext}(s_{i},t_{si},t_{ei},x_{i})=(s_{i}',0)\\(s_{i},t_{ei})&{\text{otherwise}}\end{cases}}}$

and

${\displaystyle b={\begin{cases}1&{\text{if }}\exists i\in D:(x,x_{i})\in C_{xx},\delta _{ext}(s_{i},t_{si},t_{ei},x_{i})=(s_{i}',1)\\0&{\text{otherwise}}.\end{cases}}}$

Given the partial state ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots )\in S}$, let ${\displaystyle IMM(s)=\{i\in D|t_{si}-t_{ei}=ta(s)\}}$ denote the set of imminent components. The firing component ${\displaystyle i^{*}\in D}$ which triggers the internal state transition and an output event is determined by

${\displaystyle i^{*}=Select(IMM(s)).}$
• ${\displaystyle \delta _{int}:S\rightarrow S}$ is the internal state function. Given a partial state ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots )}$, the next state is given by
${\displaystyle \delta _{int}(s)=s'=(\ldots ,(s_{i}',t_{si}',t_{ei}'),\ldots )}$

where

${\displaystyle (s_{i}',t_{si}',t_{ei}')={\begin{cases}(s_{i}',ta_{i}(s_{i}'),0)&{\text{if }}i=i^{*},\delta _{int}(s_{i})=s_{i}',\\(s_{i}',ta_{i}(s_{i}'),0)&{\text{if }}(\lambda _{i^{*}}(s_{i^{*}}),x_{i})\in C_{yx},\delta _{ext}(s_{i},t_{si},t_{ei},x_{i})=(s',1)\\(s_{i}',t_{si},t_{ei})&{\text{if }}(\lambda _{i^{*}}(s_{i^{*}}),x_{i})\in C_{yx},\delta _{ext}(s_{i},t_{si},t_{ei},x_{i})=(s',0)\\(s_{i},t_{si},t_{ei})&{\text{otherwise}}.\end{cases}}}$
• ${\displaystyle \lambda :S\rightarrow Y^{\phi }}$ is the output function. Given a partial state ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots )}$,
${\displaystyle \lambda (s)={\begin{cases}\phi &{\text{if }}\lambda _{i^{*}}(s_{i^{*}})=\phi \\C_{yy}(\lambda _{i^{*}}(s_{i^{*}}))&{\text{otherwise}}.\end{cases}}}$

## Time Passage

Since in a coupled DEVS model with non-empty sub-components, i.e., ${\displaystyle |D|>0}$, the number of clocks which trace their elapsed times are multiple, so time passage of the model is noticeable.

For View1

Given a total state ${\displaystyle q=(s,t_{e})\in Q}$ where ${\displaystyle s=(\ldots ,(s_{i},t_{ei}),\ldots )}$

If unit event segment ${\displaystyle \omega }$ is the null event segment, i.e. ${\displaystyle \omega =\epsilon _{[t,t+dt]}}$, the state trajectory in terms of Timed Event System is

${\displaystyle \Delta (q,\omega )=((\ldots ,(s_{i},t_{ei}+dt),\ldots ),t_{e}+dt).}$
For View2

Given a total state ${\displaystyle q=(s,t_{s},t_{e})\in Q}$ where ${\displaystyle s=(\ldots ,(s_{i},t_{si},t_{ei}),\ldots )}$

If unit event segment ${\displaystyle \omega }$ is the null event segment, i.e. ${\displaystyle \omega =\epsilon _{[t,t+dt]}}$, the state trajectory in terms of Timed Event System is

${\displaystyle \Delta (q,\omega )=((\ldots ,(s_{i},t_{si},t_{ei}+dt),\ldots ),t_{s},t_{e}+dt).}$

## Remarks

1. The behavior of a couple DEVS network whose all sub-components are deterministic DEVS models can be non-deterministic if ${\displaystyle Select(IMM(s))}$ is non-deterministic.