## 2 Related Work
### Academic Solutions
#### 2.2.2 Fog Computing Architectures and Applications  
Many recent user-centric IoT applications are latency sensitive or require real-time data analysis and decision making. Cloud computing solutions usually cannot fulfill such requirements in many context-aware applications, so, in the last few years, different researchers proposed alternative approaches and optimizations in terms of scalability, economic and environmental effects [52; 53]. One such approach is fog computing, originally coined by Cisco in 2012 [4], which was introduced to alleviate some of the above-mentioned problems and to provide a solution to support geographically distributed, end-device mobile, heterogeneous, latency sensitive, and Quality of Service (QoS) aware IoT applications.  
A comparison between cloud and fog computing together with a performance evaluation is presented in [54]. This article also identifies some key research directions for fog computing such as fog federation, mobile fog computing or semantic-aware fog computing. Regarding fog computing based architectures, [PERSON] et al. [55] provide a comprehensive survey of recent implementations. In the paper, it is distinguished among the following architectures:  
* Generic three-tier architecture [56]: it is one of the most widely used in fog computing. It consists of an IoT node layer, a fog layer and a cloud server.
* Layered approach [57]: it consists of six layers (physical/virtualization, monitoring, pre-processing, temporary storage, security and transport layers).
* Combined fog-cloud architecture [58]: it is used when there is a different storage and computing capacity in the fog nodes. It is detailed later, since it was the fog architecture selected for implementing ZiWi.
* Virtualized fog data centers [59]: this architecture enables adding multiple virtualized edge data centers to offload services from traditionally massive data centers.
* Fog Radio Access Networks (F-RANs) [60; 61]: they use remote radio units with caching and signal processing capabilities.
* Software-Defined Networking (SDN) fog architecture [62; 63]: the main difference between the traditional fog architecture and an SDN-based fog is the fog-SDN controller used to support dynamic QoS.  
A detailed description on the inner workings of the different fog computing architectures is out of the scope of this paper, but the interested readers can find interesting overviews in [54; 64]. Nonetheless, it is worth mentioning that such architectures have been used in multiple fields like smart grids [65; 66], smart cities [67; 68] or smart health [69]. However, with respect to the application of fog computing to home automation, just a few very recent papers describe practical implementations explicitly conceived for fog computing [70; 71]. Such developments make use of an architecture similar to the generic fog computing architecture illustrated in Figure 2. In such a figure, three different IoT networks (A, B and C) exchange data with a fog layer that allows for communicating them with the services provided by the cloud. In the fog layer, there are two sub-layers. The bottom sub-layer is made of gateways that respond quickly because of their proximity to the IoT nodes. However, the gateways of the bottom sub-layer usually embed less powerful hardware than the gateways of the fog upper sub-layer. In addition, in such an upper sub-layer, the gateway at the top is the point of entry to the fog, while the other gateways provide different services or share among them certain data in order to reduce the latency response from the cloud.