Edge Computing for IoT-Enabled Smart Grid: The Future of Energy

: The explosive development of electrical engineering in the early 19th century marked the birth of the 2nd industrial revolution, with the use of electrical energy in place of steam power, as well as changing the history of human development. The versatility of electricity allows people to apply it to a multitude of ﬁelds such as transportation, heat applications, lighting, telecommunications


Introduction
Nowadays, electrical power is the backbone of all modern technologies.According to the forecast, world electricity consumption will increase by nearly 70% in the coming three decades, going from 25 to 42 thousand terawatt-hours by 2050, in which renewables are expected to be the largest source of global electricity, accounting for some 56% of produced electric power such as that presented in Figure 1 [1].Along with the development of science and technology, electricity is produced from different resources.The power grids are synchronously and seamlessly connected to each other to control, monitor and transmit power safely and seamlessly, and to save power consumption.
Electricity generation, distribution and transmission are the three key activities of a traditional power grid [2].The power flow in systems is unidirectional.Electrical energy is generated by power plants such as hydroelectric, coal-fired, nuclear and diesel, etc.Then, the power flow is transmitted through high-voltage transmissions to load management centers.Finally, power flow is delivered to the end consumer through the power distribution system at a lower voltage.Electricity generation, distribution and transmission are the three key activities of a traditional power grid [2].The power flow in systems is unidirectional.Electrical energy is generated by power plants such as hydroelectric, coal-fired, nuclear and diesel, etc.Then, the power flow is transmitted through high-voltage transmissions to load management centers.Finally, power flow is delivered to the end consumer through the power distribution system at a lower voltage.
A centralized management system is implemented to control and monitor each power grid so that the plant's generated power is sufficient for the demand of the consumer and within the capacity of the power plant.All of these tasks (production, transmission and distribution) are employed by utility providers, which supply electrical energy to consumers through a payment mechanism that is used to recover costs and make a profit.The average price of electric energy consumption has increased significantly period of 1960 to 2021, from 2.6 to 13.19 US cents per kWh [3].
Nowadays, a remarkable amount of electricity is wasted due to inefficient consumer devices, the absence of smart technology, occasional monitoring and communication, and the lack of electricity storage systems [4].Moreover, the existing grids are experiencing challenges such as security and privacy, reliability, diverse renewable energy sources and increasing demand for energy consumption.The smart grid is an optimal solution to solve these challenges.There are many types of smart sensors, IoT devices, and terminals in the smart grids, such as current leak sensors, temperature sensors, vibration sensors, humidity sensors, video sensors, etc.They are supported by IoT-based smart grids [5].
In recent years, the launch of fifth generation mobile communication (5G) realized the concept of IoT, which allows connecting all things such as devices, software, and humans to each other based on the Internet.A series of smart applications are proposed to serve people, such as intelligent transportation systems, smart agriculture, healthcare, smart cities and smart grids [6].
24.99 28.17A centralized management system is implemented to control and monitor each power grid so that the plant's generated power is sufficient for the demand of the consumer and within the capacity of the power plant.All of these tasks (production, transmission and distribution) are employed by utility providers, which supply electrical energy to consumers through a payment mechanism that is used to recover costs and make a profit.The average price of electric energy consumption has increased significantly period of 1960 to 2021, from 2.6 to 13.19 US cents per kWh [3].
Nowadays, a remarkable amount of electricity is wasted due to inefficient consumer devices, the absence of smart technology, occasional monitoring and communication, and the lack of electricity storage systems [4].Moreover, the existing grids are experiencing challenges such as security and privacy, reliability, diverse renewable energy sources and increasing demand for energy consumption.The smart grid is an optimal solution to solve these challenges.There are many types of smart sensors, IoT devices, and terminals in the smart grids, such as current leak sensors, temperature sensors, vibration sensors, humidity sensors, video sensors, etc.They are supported by IoT-based smart grids [5].
In recent years, the launch of fifth generation mobile communication (5G) realized the concept of IoT, which allows connecting all things such as devices, software, and humans to each other based on the Internet.A series of smart applications are proposed to serve people, such as intelligent transportation systems, smart agriculture, healthcare, smart cities and smart grids [6].
A smart grid (SG) is a system that enables two-way communication of electricity and data based on communications technologies and advanced metering infrastructure (AMI) to monitor, control and react to unpredictable changes in the power grid [7][8][9].The IoT-based SGs include six major characteristics such as SDN objects, communication protocols, data analytics based on fog, edge and cloud computing technologies, smart sensors, low cost, and information privacy and security [10].In the power sector, SG is used to make critical decisions such as scheduling of electrical consumption, real-time pricing, self-recovery, energy efficiency usage through automation, two-way communication, high-speed monitoring and control of devices.These are the major goals of the SG to improve power quality and grid efficiency [11].
The success of cloud computing (CC) for grid management applications has been recognized over the past decades [12,13].However, the rapid increase in IoT devices is generating a huge data amount which increases the compute cost and service response time [14].Therefore, processing, computing, and storing this data require new models and approaches.Recently, edge computing (EC) has emerged as a potential solution to solve these problems.EC allows bringing cloud capabilities closer to the end-user, thereby reducing compute cost and service response time.EC is the key technology to truly realtime response for IoT-based SGs [15,16].Our contributions to this study can be summarized as follows: Indication of the inevitable trend of integrating EC with IoT-based SGs.The rest of this work is organized as follows.In Section 2, an overall EC-IoT-based SG architecture is introduced.Section 3 presents a survey of EC-IoT-based SG applications.Section 4 provides the EC-IoT-based SCADA framework, and some major requirements to employ this framework are discussed.Finally, challenges and open issues are provided in Section 5, and Section 6 is the conclusion.

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].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], 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.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 IoTbased SG, as shown in Figure 4. 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. 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 IoTbased SG, as shown in Figure 4.  Figure 4 presents an illustration of the all-in-one computing architecture for IoTenabled 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].After the data are aggregated at the EC layer, it will be sent to the CC layer for computing, statistics, and storage.A comparison of the characteristics of EC with other computational schemes in [33] has shown the outstanding advantages of EC.In a smart grid environment, applying EC to IoT-enabled SG systems to monitor and control the power grid in real-time is a possible solution.
This architecture brings cloud abilities closer to end-users and shortens the distance of the database to things.It allows services to be computed and processed, and decision making to be performed, at the edge instead of in the cloud [34].This highlights the advantages of EC in aspects such as reduced service response times, low transmission latency, real-time services, optimized data, and collaboration computing.All of these realize real-time EC-IoT-based SG applications.

Survey of EC-IoT Smart Grids
One of the main challenges of SG systems is monitoring and control of power grids and power distribution systems.The system consists of abilities such as remote signaling metering and remote control.Consequently, control of power grids and electrical devices is fully automatic and remote.In addition, electrical problems can be detected, and decision making performed, in real-time.In recent times, the IoT-based SG applications have added EC devices.The edge nodes provide flexibility in data processing, storage, and computing to reduce service response times and bandwidth pressure on backbone connections [35].On the other hand, these systems allow real-time analysis of power load status in local areas, reasonable power consumption scheduling, and rapid response to transmission and distribution systems.In recent years, a lot of research has been proposed in this field.We can divide it into three main research directions as in Table 1.This research proposed an aggregator to support communication between the smart meters far from edge servers to improve the grid performance.
[37] Power Distribution Artificial Neural Network This research proposed a novel Volt/VAR control strategy for optimal DER inverters at the edge layer.[38] Power Distribution Hierarchical Hybrid Architecture This research proposed three-layer architecture to optimal Volt/VAR control of power distribution grids to improve coordination of distributed generators.
[39] Power Distribution Hierarchical Hybrid Architecture This research proposed a multi-time scale three-tiered voltage control schema for smart inverters at the grid edge to stabilize the voltage fluctuations. [40]

Power Distribution Security
This research designed a false data-injection attack schema into SE modules of the unbalanced power distribution grid systems to indicate challenges in the operator of smart grid systems.
[41] Micro-Grid Systems Edge computing, mutation strategy Propose an evolution energy control algorithm based on edge computing and mutation strategy to trade off other metrics for optimal energy efficiency in smart factories.
[42] Micro-Grid Systems Harmonic signature analysis and Fuzzy rule Propose the load feature extraction technique based on the support of the current harmonic signature analysis and the intelligent identification method to monitor different electrical loads.
[43] Micro-Grid Systems Energy Management Model Propose the self-managing energy system model, called SES, to save energy for households and buildings.
[44] Micro-Grid Systems Blockchain Propose an autonomous energy transactions model to sell excess power from solar grids.
[45] Micro-Grid Systems Private Distributed Ledger Propose an autonomous energy binding mechanism to transaction households' excess power.[46] Metering Systems Cloud/Edge computing Propose a collaboration mechanism to identify outlier users and correct connections.
[47] Metering Systems Probability and Gaussian model Propose a solution to improve volatility of load and enhance disaggregation ability behind the smart meter.

Power Distribution Monitor Systems
The power distribution monitor system is one of the most important applications of smart grids.Today, with the robust development of science, and the open support policies of governments, the power sources are increasingly diverse.Some emerging renewable energy sources such as solar power and wind power are increasingly high, distributed in a variety of locations, from the rooftop of households to manufacturing enterprises, from small-scale power sources to large-scale power generation corporations.The monitoring and control of power grids to operate safe, stable and efficient is increasingly complex and requires real-time responsive services.Many solutions have been proposed to address these challenges.
In the power distribution monitor sector, one of the key challenges is monitoring real-time smart meter nodes.Tom et al. (2020) [36] proposed an efficient aggregation RPL scheme based on fog computing and 6LoWPAN routing protocol to improve system performance for low power lossy area networks.Specifically, in a power distribution system, all the smart meters form the 6LoWPAN network.This led to some nodes far from the fog/edge servers having high delay and low packet delivery ratio.To solve this problem, the author used the aggregator to support communication between these smart meters to fog/edge servers.The results have demonstrated that the proposed solution improved over 35.6% of packet delivery ratio and 13.24% of delay compared to existing RPL-based solutions.
The development of science and technology leads to the birth of renewable energy sources for humanity.Nowadays, energy sources such as solar power and wind power are ubiquitous and connected to power distribution systems.This has led to Volt/VAR control (VVC) becoming increasingly complex and a significant challenge in distribution systems.The existing solutions use DER inverters.However, this led to DER inverters conflicting with each other when autonomously operating under grid voltage control.To solve this problem, Li et al. (2019) [37] proposed a novel VVC strategy based on an artificial neural network at the edge layer.Simulation results indicated that the proposed solution could control DER inverters to achieve VVC goals at the grid edge.
Additionally, in this direction, the diversity of renewable energy sources leads to an increasingly rapid proliferation of distributed generators (DGs).Consequently, Volt/VAR control in power distribution systems is increasingly complex.To solve this problem, Malekpour et al. (2020) [38] proposed a hierarchical hybrid architecture for Volt/VAR control of power distribution grids.Specifically, the authors proposed a three-layer architecture in which the top layer performs central optimization based on an optimal scheduling schema with a 15 min cycle to minimize power losses.The middle layer controls voltage for DGs based on the distributed approach to reduce service response time.The bottom layer aims for real-time exact decision making based on edge computing.Simulation results demonstrated that the proposed architecture improved coordination at 80% penetration of DGs.
In order to stabilize the voltage on the power distribution grids, smart inverters are used to control the voltage of grids fluctuations within a predefined range.However, controlling these inverters requires an intelligent, flexible and real-time control scheme.To address these challenges, Fard et al. (2021) [39] proposed a multi-time scale three-tiered voltage control schema for dispersed smart inverters at the grid edge to stabilize the voltage fluctuations.Specifically, the top layer for the purpose to balance total generation and consumption on the cluster, minimizing power distribution losses and stabilizing the voltage across the grid within the permissible range.The middle layer aims to stabilize the voltage across the cluster in a subsecond timeframe based on the cooperative operations of the smart inverters.The lowest layer operates based on the local predictive model to real-time fulfil the commands of the upper layers.Simulation results demonstrated that the proposed schema could stabilize rapid voltage fluctuations while keeping the optimal entire operating distribution grid system for the long term compared to existing power distribution schemas.
Smart grid systems are one of the key participants of smart cities.To balance the residential distribution grid, the power providers use edge computing-based IoT applications to state estimation and monitor grid systems, the so-called SE module.In reality, the accuracy results of this module are completely dependent on the integrity of the provided data.To describe the vulnerability and the attacked ability of SE modules, Tran et al. (2021) [40] have designed a false data-injection attack schema into SE modules of the unbalanced power distribution grid systems.Simulation results demonstrated the serious physical consequences and posed challenges for the operators in maintaining the integrity of measurement data of EC-based IoT applications for power distribution grid systems in smart cities.

Micro-Grid Systems
One of the most important drivers of the economic development of a country is energy resources.A stable energy source will improve the living quality of humans.To solve this Energies 2022, 15, 6140 8 of 16 problem, the government and energy suppliers are making efforts to build and deploy SG infrastructures.In terms of management, SGs consist of two main components: (1) power distribution grid systems which are operated by power suppliers; (2) micro-grid systems which are grid systems in a building, home or enterprise.Micro-grid systems need to be optimized for efficient power distribution and management.In this subsection, we present the state-of-the-art EC-IoT-based SG applications for smart homes and buildings and highlight related challenges to energy management in micro-grid systems.
The smart grid is one of the factors that determine the success of a smart factory.Currently, smart factories often use battery energy storage systems to ensure supply stability and power quality.However, calculating the load, energy storage capacity, and timing are the main challenges of this solution.To solve this problem, Xu et al. (2021) [41] introduced an adaptive evolution energy control algorithm based on edge computing and mutation strategy to trade-off between load, cost, timing, and other metrics aimed at optimal energy efficiency for smart factories.The experiment results demonstrated that the proposed solution enhances the effectiveness compared to the existing solutions.
The smart home is emerging as an inevitable trend in modern cities.In these homes, energy optimization and load management are increasing concerns by homeowners.Nowadays, the smart grid uses the nonintrusive load monitoring (NILM) technique to monitor the energy consumption for individual electrical loads of households at a certain measurement point.In this technique, the accuracy of household electrical loads is a significant challenge.To address this problem, Ghosh et al. ( 2021) [42] proposed the load feature extraction technique, improved from the NILM technique, based on the support of the current harmonic signature analysis and fuzzy rule-based intelligent identification method to monitor different electrical loads.The simulation results demonstrated that the proposed solution enhances the accuracy of household electrical loads compared to existing solutions.
Obviously, energy plays a particularly important role in each household as well as for the whole society.According to the authors, buildings are the biggest electricity consumers.In order to highlight the green energy trend for smart homes and buildings, Mir et al. (2021) [43] presented a full picture of smart grids for smart apartments and buildings.Specifically, they have introduced different solutions, techniques, approaches and challenges to save energy for households and buildings.In addition, they have also proposed the self-managing energy system model, called SES.
Aiming to drive renewable energy solutions for households and provide smart transaction mechanisms for excess power from solar grids, Markakis et al. (2021) [44] have proposed an autonomous commercial architecture based on blockchain to transact excess power from solar micro-grids of households.Additionally, in this direction, Gajić et al. (2022) [45] have proposed an autonomous energy distribution mechanism to sell households' excess power based on private distributed ledgers.This solution allows automatic bidding, ensuring openness and transparency and real-time trading.
The analysis results have shown an overview picture of micro-grid systems for smart homes and buildings as well as challenges and open issues.

Advanced Metering Systems
SGs are emerging as the next generation to replace the traditional operations of the existing grids.Advanced metering systems are one of the important components of a smart grid.This system is responsible for collecting and analyzing data from smart meters.Therefore, it plays an important role for the smart grid to operate safely, stably and efficiently.In this subsection, we surveyed the recent proposed solutions and techniques for advanced electrical measuring systems.
Distribution grids often have to change to match the development of local electricity loads.Consequently, connection verification is one of the significant challenges of the smart grid.To solve this problem, Si et al. (2021) [46] have introduced a cloud-based collaboration mechanism to determine outlier users and valid connections.Specifically, they use the relationship propagation clustering-based local outlier factor algorithm to analyze the metrics provided by smart meters in order to identify and verify edge transformer voltage outliers.Moreover, they also proposed a mechanism for information exchange between edge transformers to improve accuracy in identifying outliers.The results have indicated that the proposed solution improves 66% of the service response time compared to other algorithms.
The green energy trend leads to the installation of solar photovoltaic panels becoming more and more popular in households.As a result, households will use combined solar and grid power sources.In some cases, households with excess electricity can even sell it to electricity suppliers.This presents a significant challenge in separating indigenous demand and solar production from net demand.To solve this issue, Bu et al. (2021) [47] have proposed using smart meters that have low-resolution but are popular to measure data.Specifically, they construct a joint probability density function (PDF) of monthly diurnal and nocturnal native demands for consumers based on the Gaussian model.Then, they use a maximum likelihood prediction scheme to determine hourly solar power generation.The results have demonstrated that the proposed solution improves the volatility of load and enhanced accurate disaggregation compared to other solutions.

EC-IoT SCADA Application
In recent years, IoT has been applied in various areas of energy management systems, including power generation systems, distribution systems, advanced metering systems, intelligent energy management systems for smart homes, smart buildings and smart cities, etc. [2,4].Combining edge computing and IoT provides huge possibilities for optimizing and managing the energy transmission systems.In this section, we discuss one of the important applications of smart grids based on IoT and EC, the well-known SCADA (Supervisory Control and Data Acquisition) system [48].The detailed information is presented as follows.
The SCADA system collects data and information from sensors, cameras and IoT devices from the power grid system and supervises automation procedures to monitor and control and regulate different system parameters for the optimal energy grids.The SCADA system is formed with the integration of computing and IoT technologies [49].The SCADA architecture consists of three layers, presented in Figure 5.
The Things layer consists of terminal devices such as sensors, IoT devices, actuators and appliances.These IoT devices are interconnected with each other based on different efficient communication technologies, including Wi-Fi, Bluetooth, ZigBee, NB-IoT, LTE-A, NFC, etc.
To enhance the ability of IoT-enabled SCADA systems, the EC layer is added to its architecture.In this model, the EC layer includes various network devices such as gateway, access points, switches, routers, and local SCADA servers to analyze, process, compute and storage [50].The SCADA system shortens the distance between the database and terminal devices, reducing service response time.On the other hand, it brings the capabilities of the cloud closer to the user and realizes real-time SGs.
The cloud layer consists of cloud SCADA data servers that are responsible for analytics and aggregating whole statistics and obtained information from the edge layer of SCADA.Thanks to these results, an autonomous process or electric personnel making-decision to monitor, control, and adjust parameters to optimize SGs.The overall architecture of the SCADA system is presented in Figure 5.
Although there are many advantages, SCADA systems have still existed some limitations in aspects of cybersecurity.At the Things layer, attacks can focus on IoT and PLC devices to collect or fake information.Furthermore, SCADA applications often operate on Windows operating systems, and attacks are possibly employed through vulnerabilities of Windows operating systems [51].
On the other hand, with the limited capacities of IoT devices, it is infeasible to implement complex security and encryption protocols.Therefore, lightweight encryption algorithms need to be researched.In [52], the authors have introduced a multi-layer lightweight cryptography architecture that relies on both symmetric and asymmetric key cryptographic algorithms for real-time SCADA systems.
ing and managing the energy transmission systems.In this section, we discuss one of the important applications of smart grids based on IoT and EC, the well-known SCADA (Supervisory Control and Data Acquisition) system [48].The detailed information is presented as follows.
The SCADA system collects data and information from sensors, cameras and IoT devices from the power grid system and supervises automation procedures to monitor and control and regulate different system parameters for the optimal energy grids.The SCADA system is formed with the integration of computing and IoT technologies [49].The SCADA architecture consists of three layers, presented in Figure 5.At the network layer, the variety of communication protocols led to facing a series of potential cyberattack risks of SCADA systems.In [53], the authors have presented a series of communication protocols used in SCADA systems and attack types and solutions, respectively.
On the one hand, adding the edge layer to the traditional SCADA architecture enables the realization of the real-time computing concept.On the other hand, EC systems require network expansion, including IoT devices and edge servers relying on autonomous distributed computing.This leads to the cybersecurity threats.DoS attacks can target edge computing centers, as presented in [54].The above analyses have shown that the security issue of EC-based SCADA systems needs further research.
The cloud layer provides powerful computing and storage capabilities for cloud-based SCADA systems.However, the authors [55] have presented a variety of security issues in the cloud, such as attacks on user interfaces through the SICADD-MTU Web portal or communication channels to the RTUs.
The above analyses have shown that security for SCADA applications will continue to be a topical and exciting research issue in the future.

Challenges and Open Issues
In recent years, edge computing and IoT technologies have been applied robustly to smart grids.However, smart grid applications are still primitive.In order to force the development of smart grids, many challenging problems need to be solved in the near future.We have summarized these problems in Figure 6, as follows:

Scalability and Reliability.
In the IoT-5G era, SGs will be becoming popular, leading to the breakout increase in sensors, actuators, and other smart IoT devices.Consequently, data traffic will be increased rapidly, with pressure on backbone bandwidth and high latency.EC provides a solution to solve these challenging problems.However, to establish a scalable and reliable EC infrastructure, we must consider the breakout increase in smart IoT devices, diversity of network environment, power sources and consumers [56].The robustness and reliability of EV infrastructure can be achieved by adding the new coverage points and secure technologies [57].However, reliability and scalability are the main challenges of EC-based SG infrastructure due to its hardware/software security vulnerability and the high dynamic characteristics of SGs.

Sustainability
One of the other important challenges for designing EC-based SG infrastructure is sustainability.In [58], the authors have introduced a novel sustainable development goals architecture (SDGs) based on four metrics.According to this architecture, the sustainability of SGs relies on aspects of energy, materials, money and manpower.This issue also considers the exploitation of renewable resources and the design of energy-efficient systems to reduce the universal carbon footprint.The three major related factors to the sustainability of EC-based SGs are energy-efficient systems [59], smart energy harvesting management systems [60], and the utilization of renewable energy sources [61].Relying on EC and IoT, The sustainability of SG systems can be deployed through balance load, enforce computational resource allocation schemes, and offload to optimize the system.

Security and Privacy
Security and privacy are the main challenges of SG in the IoT era.There are two main aspects of insecurity issues in EC-IoT-based SGs: physical security and cyber-security.These issues are related to authentication algorithms, protection of data, networks, IoT devices, and computing infrastructure to resist attacks [62,63].The privacy problems define some rules to determine and provide protection levels.Limitations are set up by privacy on the authorization of data access.An EC-IoT-based SG uses a series of technologies and solutions such as deep learning, virtualization, D2D communications and distributed systems.The nature operating of edge nodes is distributed.Consequently, security and privacy problems for edge servers are urgent and are challenges that are solved in near time.In recent

Scalability and Reliability
In the IoT-5G era, SGs will be becoming popular, leading to the breakout increase in sensors, actuators, and other smart IoT devices.Consequently, data traffic will be increased rapidly, with pressure on backbone bandwidth and high latency.EC provides a solution to solve these challenging problems.However, to establish a scalable and reliable EC infrastructure, we must consider the breakout increase in smart IoT devices, diversity of network environment, power sources and consumers [56].The robustness and reliability of EV infrastructure can be achieved by adding the new coverage points and secure technologies [57].However, reliability and scalability are the main challenges of EC-based SG infrastructure due to its hardware/software security vulnerability and the high dynamic characteristics of SGs.

Sustainability
One of the other important challenges for designing EC-based SG infrastructure is sustainability.In [58], the authors have introduced a novel sustainable development goals architecture (SDGs) based on four metrics.According to this architecture, the sustainability of SGs relies on aspects of energy, materials, money and manpower.This issue also considers the exploitation of renewable resources and the design of energy-efficient systems to reduce the universal carbon footprint.The three major related factors to the sustainability of EC-based SGs are energy-efficient systems [59], smart energy harvesting management systems [60], and the utilization of renewable energy sources [61].Relying on EC and IoT, The sustainability of SG systems can be deployed through balance load, enforce computational resource allocation schemes, and offload to optimize the system.

Security and Privacy
Security and privacy are the main challenges of SG in the IoT era.There are two main aspects of insecurity issues in EC-IoT-based SGs: physical security and cyber-security.These issues are related to authentication algorithms, protection of data, networks, IoT devices, and computing infrastructure to resist attacks [62,63].The privacy problems define some rules to determine and provide protection levels.Limitations are set up by privacy on the authorization of data access.An EC-IoT-based SG uses a series of technologies and solutions such as deep learning, virtualization, D2D communications and distributed systems.The nature operating of edge nodes is distributed.Consequently, security and privacy problems for edge servers are urgent and are challenges that are solved in near time.In recent times, powerful cryptographic techniques such as blockchain [64] and fully homomorphic encryption [65] have been introduced to prevent attacks and enhance data privacy.

Flexibility
Flexibility is one of the other challenges of EC-based SGs through the optimal system resource allocation [66] and delivering flexible services according to the demand dynamically and QoS requirements [67].
Aiming toward real flexibility in an EC-based SG, the system needs to predict the demands of end-users and respond to the ability of service providers and real-time system factors before allocating and offloading computational resources such as storage, bandwidth, and processing power.In [68], dual prediction schemes have been introduced to optimize the data transmissions of sensors.
In [69], the authors present an autonomic resource provisioning framework that is based on computing methods and machine learning techniques.Auto-scaling solutions can be implemented in horizontal, vertical, or hybrid [70].The horizontal solutions allow resizing the resource allocation between nodes in a cluster, whereas vertical solutions allow resizing the resource allocation in a node.An advanced hybrid autonomic resource provisioning framework that combines both vertical and horizontal is introduced in [71].

Conclusions
The smart grid (SG) is a foundation technology that will provide breakout evolution to the existing power grids, energy resources, and consumers.It is a solution to deal with the increasing energy demand, energy wastage, security and privacy, and the reliability that the traditional grids are infeasible.SG includes a huge number of smart sensors, IoT devices, and terminals that continuously obtain data.Consequently, SG has been putting pressure on backbone bandwidth, with huge energy consumption, high service response time, and infeasible real-time monitoring and control of applications.To solve these problems, EC is added to the SG architecture.SG applications based on EC and IoT provide comprehensive control and monitoring solutions to improve energy efficiency, energy stability, reliability, and real-time service response time.Therefore, it is considered the future of energy in the digital era.In this work, we have introduced a comprehensive picture of EC-IoT-based SGs.A framework for SG applications has been discussed, and crucial requirements to deploy the EC-IoT-based SG applications are presented.Finally, challenges and open issues of EC-IoT-based SG applications are identified.Hopefully, this survey provides useful guidelines for future EC-IoT-enabled SG applications.

Figure 1 .
Figure 1.The forecast of worldwide electricity consumption, for the period of 2020 to 2050 [1].

Figure 1 .
Figure 1.The forecast of worldwide electricity consumption, for the period of 2020 to 2050 [1].

Figure 2 .
Figure 2. The three key services of IoT-based smart grids.

Figure 3 .
Figure 3.An illustration of the IoT-based SG architecture.

Figure 3 .
Figure 3.An illustration of the IoT-based SG architecture.

Figure 4 .
Figure 4.The all-in-one computing architecture for IoT-based SG.Figure 4. The all-in-one computing architecture for IoT-based SG.

Figure 4 .
Figure 4.The all-in-one computing architecture for IoT-based SG.Figure 4. The all-in-one computing architecture for IoT-based SG.

Figure 5 .
Figure 5.An illustration of the overall SCADA architecture based on edge-cloud computing.

Figure 5 .
Figure 5.An illustration of the overall SCADA architecture based on edge-cloud computing.

Table 1 .
Statistics of recently proposed EC-IoT-based SG applications.