## 4 Approach
### Level Hierarchy and Structure  
Expanding DEVS  
To define the proposed approach in terms of the DEVS specification, a new kind of model is introduced. Hereafter, it is called Hierarchical Atomic. It is a combination of an atomic and a network DEVS model that additionally provides functions to transfer one model's state into another and to select, which one should be the currently active:  
\[\textit{hatomic}\equiv\langle\textit{atomic},\textit{network},\{transport\}, \textit{select}\rangle, \tag{1}\]  
where atomic and network are the contained atomic and network DEVS model, respectively. {transport} is the set of transport functions that transfer the models' state and select is the function that chooses the currently active model. In more detail, the new type of model--in the following called _Hierarchical Atomic_--is defined:  
\[\begin{split}\textit{hatomic}\equiv&\langle S_{A},X_{A},X_{N},Y_{A},Y_{N},\\ &\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad \quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad\quad \quad\quad\quadeasily be treated just as plain atomic DEVS model that is part of a network model in all positions in the tree structure. Moreover, the atomic models that belong to the contained network model can be exchanged with the new model as well, thus forming the different levels of hierarchy within the level of detail and time advancement of the simulation. The consequences of this also tree-like organization of the simulation's levels are of importance for the general approach to modeling with the proposed simulator and influence the possible parallelization of the sequential approach. First, regarding the approach to modeling, a bottom-up procedure is recommended, where the deepest and most detailed level is designed in its whole and then partitioned into smaller leaves of the tree. As the performance gain of the dynamic exchange between models with varying level of detail is dependent on the specific scenario, it is possible that more efficient partitions of models along the tree are only eventually evaluated under simulation. The bottom-up construction here ensures that the main part of the scenario has to be developed only once and then merely has to be partitioned accordingly. In addition, if the models that are to be exchanged are the kind of whole protocol-stacks or space-divided parts of the environment, they in turn can be heavily be reused. If the capabilities of exchanging models with more or less elaborated representations of the system under simulation are used efficiently, in this way, the environment of smart home scenarios could be simulated following a user of a service through his way through a smart city, exchanging models on the fly, as soon as they are needed. In the implementation of the proposed approach, it is of importance where in this tree the integrated domain specific simulators are placed. Obviously, a placement along the nodes of the tree as well as a simple hierarchy of one domain specific simulation kernel per level is conceivable. Second, regarding possible partitioning techniques that could be used in a parallelized employment, it has to be taken into consideration how the different networks are placed. A high density of encapsulated networks in unluckily partitioned models could negatively affect the simulations performance. Therefore, modeling for a parallel scenario could be prolongated in comparison to other approaches. During the implementation of the here proposed simulator, it was decided to place multiple instances of a simulator across the tree. The placement of simulators inside the introduced hierarchical atomics allowed them a more flexible implementation of their functionality. At the same time, it is ensured that the simulator that advances a specific model and the model itself remains separated. Figure 2: The model tree and organization of hierarchy levels.