## 3 Materials and Methods
### Composed SPD Multi-Metric  
In this subsection, we describe the composed SPD multi-metric method which it is proposed in this paper. The SPD evaluation is applied as the basic metric to assess the defense level of the distinct system components. Then, the core security concept of the medieval castle analysis is extended with the SPD perspective. SPD multi-metrics are incorporated in the medieval castle approach, acting as a systematic methodology to estimate the protection of the castle's \"_SPD doors_\". The result is the integral SPD of the currently composed system, which progresses the medieval castle composition analysis and covers the requirements of two premier real-time SPD modelling features, as they are detailed below. However, only static system instances can be examined under the medieval castle approach. On the other hand, the proposed method assesses dynamic systems with de/composition events changing the overall composition and SPD aspects at runtime. For instance, two sub-systems could be secure in some aspect, but their composition might not be necessarily safe in the same aspect. The composed SPD multi-metric enforces pre- and post-composition validation. Initially, it derives if the composition is feasible. Afterwards, it concludes the composition's result and its side-effects. Decomposition events are handled in a similar manner. In an actual system, the deployed defenses at the various layers could interact with each other. This concept is not covered sufficiently by the castle analysis. In the proposed method, the missing controls of the SPD multi-metric are covered by the related controls which have been deployed in the adjacent outer layers, capturing the increasing defense of the interacting subsequent protection layers. Such as, consider an insecure data exchange service which can be defended by a secure communication service performed at the network layer, offering integrity, authentication, and confidentiality. The total SPD reflects the overall control coverage which is accomplished by the current composition. The method is mounted in the ambient intelligence filed of a smart home. The idea is that every business that provides a smart home component (e.g., embedded equipment or software applications) will calculate the main SPD multi-metric features in advance. Then, the user buys on-the-self products. The in-house composed SPD multi-metric evaluates the final SPD, once these products are getting installed. In a common installation, the deployed smart devices observe ubiquitous factors and interchange data. The user manages to the overall setting with computer or smart phone. We implement a smart home system with smart devices for assisting living conditions. The house includes a laptop and several smart devices (i.e., surveillance cameras, TV, air-condition, printer, fridge, etc.). A wireless router creates a LAN, interconnecting all equipment, and permits external connection with Internet. This smart home composition is depicted in Figure 3.  
Initially, the SPD multi-metric of each distinct element (i.e., laptop, smart devices, and router) is measured. Afterwards, these ingredients can be integrated based on the medieval castle composition operations (the composed SPD assessment is detailed in Sections 3 and 4). These components are composed to a LAN with MEAN-operations, the LAN is composed with the router with an OR-operation, while the router is composed to Internet with an OR-operation. Figure 3A illustrates the overall composition. Attackers could penetrate the home router via Internet and then attack the rest components in the LAN. In Figure 3B, the legitimate user connects the LAN with a smart phone (MEAN-operation). The SPD is measured as in Figure 3A. However, in Figure 3C, the user connects the LAN similarly as Figure 3B (MEAN-operation), but here the phone also deploys its own mobile Internet connection (AND-operation with Internet). Hackers are given now an alternative port to infiltrate the system via the mobile Internet connection.