# Edge Computing for IoT-Enabled Smart Grid: The Future of Energy
## 2 Architecture of EC-IoT-Based SGs  
In this section, we present the main three services of IoT-based SG, including power distribution monitor systems, micro-grid systems, and advanced metering systems. Then, we introduce an IoT-based SG architecture. Finally, we propose an EC architecture for IoT-based SGs and highlight its advantages. Figure 2 presents three typical services of smart grids, including power distribution monitor systems, micro-grid systems, and advanced metering systems [17]. In traditional SGs, relying on IoT and CC technology, SGs are becoming smarter. Data collected from different terminals will be processed, analyzed and aggregated, and decision making will be performed at cloud. One main limitation of these systems is the high service response time [18; 19]. Figure 2: The three key services of IoT-based smart grids. In recent times, EC has emerged as a potential real-time computing solution and applied widely in sectors [20; 21; 22]. With the help of deep learning [23] and distributed AI technologies [24], EC provides distributed computing capabilities for SGs. Consequently, this model allows responding to real-time services of devices and users in SGs [25]. In addition, EC also provide advanced applications for SGs such as smart metering [26], smart scheduling [27], smart maintenance [28], smart user feedback [29], and real-time price information response [30]. In this study, we introduce an IoT-based smart grid architecture, consisting of four layers, reference from IoT architecture [6] as shown in Figure 3 and briefly described as follows:  
1. _Things layer_: Defined as all things, including terminals, smart sensors and actuators that aim to obtain data, then provide them to upper layers or execute sent tasks by upper layers. 2. _Network layer_: Defined as an intermediate layer for the connection between the Things layer and the upper layers. The main tasks of the network layer are to access control and establish real-time, secure, and efficient end-to-end connections. This layer is divided into two sublayers: 5G's backhaul connections and low-power wide area (LPWANs) technologies such as Sigfox, NB-IoT, ZigBee and LoRa. 3. _Middleware layer_: Defined as the heart of the IoT-based SG. This layer covers emerging advanced technologies and solutions such as fog computing, edge computing, big data processing and analysis. The AI vision is implemented on this layer. 4. _Application layer_: This layer covers IoT-based SG applications that are implemented in a series of domains such as cities, industrial factories, residential buildings, farms, traffic systems, and IoT ecosystems. This layer combines all solutions, technologies, and applications to interact with humans through network communications. Analysis of this architecture has shown that the sensors of the Things layer collect and send data to the middleware layer for processing, computation, and storage through the wired and wireless connections of the network layer. To optimize the computation for IoT-based SG applications, we propose an all-in-one computing architecture for an IoT-based SG, as shown in Figure 4.  
Figure 3: An illustration of the IoT-based SG architecture. Figure 4 presents an illustration of the all-in-one computing architecture for IoT-enabled SG platforms. This architecture has added an EC layer. First, the data are collected by IoT devices and sensors of the things layer. Then, it is sent to the EC layer instead of the cloud layer, such in the traditional computing architecture. The EC layer consists of servers, network devices, and gateways [31]. These devices are deployed at the network's edge for processing, computing, and storage, aiming to minimize service response time, real-time decision making, and data preprocessing to reduce bandwidth traffic load on backbone connections and gateways. The CC layer consists of communication servers with powerful configuration, processing ability, and bandwidth to provide high-performance computing services [32].