Internet of Things (IoT) and the Energy Sector

: Integration of renewable energy and optimization of energy use are key enablers of sustainable energy transitions and mitigating climate change. Modern technologies such the Internet of Things (IoT) offer a wide number of applications in the energy sector, i.e, in energy supply, transmission and distribution, and demand. IoT can be employed for improving energy efﬁciency, increasing the share of renewable energy, and reducing environmental impacts of the energy use. This paper reviews the existing literature on the application of IoT in in energy systems, in general, and in the context of smart grids particularly. Furthermore, we discuss enabling technologies of IoT, including cloud computing and different platforms for data analysis. Furthermore, we review challenges of deploying IoT in the energy sector, including privacy and security, with some solutions to these challenges such as blockchain technology. This survey provides energy policy-makers, energy economists, and managers with an overview of the role of IoT in optimization of energy systems.


Concepts
Industrial revolutions can be divided into four phases.In the first revolution, new sources of energy were discovered to run the machines.The mass extraction of coal and the invention of steam power plants were significant development stages in this phase [1].The second revolution known as mass production and electricity generation was a period of rapid development in industry, distinguished by large-scale iron and steel production.During this phase, many large-scale factories with their assembly lines were established and formed new businesses [2].The third revolution introduced computer and the first generation of communication technologies, e.g., telephony system, which enabled automation in supply chains [3].
A wide variety of modern technologies such as communication systems (e.g., 5G), intelligent robots, and the Internet of Things (IoT) are expected to empower the fourth industrial revolution [4][5][6].IoT interconnects a number of devices, people, data, and processes, by allowing them to communicate with each other seamlessly.Hence, IoT can help improving different processes to be more quantifiable and measurable by collecting and processing large amount of data [7].IoT can potentially enhance the quality of life in different areas including medical services, smart cities, construction industry, agriculture, water management, and the energy sector [8].This is enabled by providing an increased automated decision making in real-time and facilitating tools for optimizing such decisions.

Motivation
The global energy demand rose by 2.3% in 2018 compared to 2017, which is the highest increase since 2010 [9].As a result, CO 2 emissions from the energy sector hit a new record in 2018.Compared to the pre-industrial temperature level, global warming is approaching 1.5 • C, most likely before the middle of the 21 Century [10].If this trend prevails, the global warming will exceed the 2 • C target, which will have a severe impact on the planet and human life.The environmental concerns, such as global warming and local air pollution, scarcity of water resources for thermal power generation, and the limitation of depleting fossil energy resources, raise an urgent need for more efficient use of energy and the use of renewable energy sources (RESs).Different studies have shown that a non-fossil energy system is almost impossible without efficient use of energy and/or reduction of energy demand, and a high level integration of RESs, both at a country level [11], regional [12], or globally [13].
Based on the United Nations Sustainable Development Goals agenda [14], energy efficiency is one of the key drivers of sustainable development.Moreover, energy efficiency offers economic benefits in long-term by reducing the cost of fuel imports/supply, energy generation, and reducing emissions from the energy sector.For enhancing energy efficiency and a more optimal energy management, an effective analysis of the real-time data in the energy supply chain plays a key role [15].The energy supply chain, from resource extraction to delivering it in a useful form to the end users, includes three major parts: (i) energy supply including upstream refinery processes; (ii) energy transformation processes including transmission and distribution (T&D) of energy carriers; and (iii) energy demand side, which includes the use of energy in buildings, transportation sector, and the industry [16]. Figure 1 shows these three parts with their relevant components.Under the scope of this paper, we discuss the role of IoT in all different segments of the energy supply chain.Our aim is to show the potential contribution of IoT to efficient use of energy, reduction of energy demand, and increasing the share of RESs.IoT employs sensors and communication technologies for sensing and transmitting real-time data, which enables fast computations and optimal decision-making [17].Moreover, IoT can help the energy sector to transform from a centralized to a distributed, smart, and integrated energy system.This is a key requirement in deploying local, distributed RESs, such as wind and solar energy [18], as well as turning many small-scale end users of energy into prosumers by aggregating their generation and optimizing their demand whenever useful for the grid.IoT-based systems automate, integrate, and control processes through sensors and communication technologies.Large data collection and use of intelligent algorithms for real-time data analysis can help to monitor energy consumption patterns of different users and devices in different time scales and control that consumption more efficiently [19].

Methodology
The application of IoT in different sectors and industries has been widely discussed and reviewed in the literature (for example [20][21][22].Moreover, challenges and opportunities with respect to the deployment of one or a group of IoT technologies have received a high level of technical assessment, e.g., sensors [23] or 5G network [24].With respect to the energy sector, most of survey studies have focused on one specific subsector, e.g., buildings or the technical potential of a certain IoT technology in the energy sector.For example, Stojkoska et al. [25] reviews smart home applications of IoT and the prospect of integrating those applications into an IoT enabled environment.In a study by Hui et al. [26], the methods, recent advances, and implementation of 5G are studied only with focusing on the energy demand side.The role of IoT in improving energy efficiency in buildings and public transport has been discussed in [27,28], respectively.Khatua et al. [29] reviews the key challenges in the suitability of IoT data transfer and communication protocols for deployment in smart grids. However, unlike the reviewed literature where the focus is commonly either on a specific subsector in the energy sector or certain IoT technologies, this paper reviews the application of IoT in the energy sector, from energy generation to transmission and distribution (T&D) and demand side.As such, the main contribution of this paper is to extend the existing body of literature by providing energy policy-makers, economists, energy experts, and managers with a general overview of the opportunities and challenges of applying IoT in different parts of the entire energy sector.In this respect, we briefly introduce the IoT framework and its enabling technologies to form a basis for discussing their role in the energy sector.
To conduct this survey, a systematic search was carried out to collect and review the recent body of literature on the role of IoT in the energy sector.First, we searched the terms "Internet of Things" and "Energy", case non-specific, in the title, abstract, and keywords of publications stored in SCOPUS, IEEE, Hindawi, and Google Scholar databases.Then, we limited the scope of search results to engineering, economics and management branches where possible.Next, papers published before 2012 and most of conference papers with no information on the peer-review process were excluded.Finally, we clustered the relevant papers in sub-categories of energy generation (including power plants, ancillary services, and centralized renewable energy), T&D systems (including electricity, gas and district heating networks, and smart grids), and the demand side (including energy use in buildings, transportation, and the industry sector).We focus on the IoT applications that can be generally applicable to most of energy systems without discussing specific cases and their boundary conditions.For example, we discuss the role of IoT in smart buildings, without falling into the details of building typology, building material, occupants' energy consumption pattern, type and number of home appliances, etc.
The rest of this paper is structured as follows.Sections 2 and 3 introduces IoT and enabling technologies, including sensors and communication technologies, cloud computing, and data analytic platforms.Section 4 reviews the role of IoT in the energy sector.Section 5 discusses the opportunities and challenges of deploying IoT, while Section 6 portrays future trends.The paper concludes in Section 7.

Internet of Things (IoT)
IoT is an emerging technology that uses the Internet and aims to provide connectivity between physical devices or "things" [30].Examples of physical devices include home appliances and industrial equipment.Using appropriate sensors and communication networks, these devices can provide valuable data and enable offering diverse services for people.For instance, controlling energy consumption of buildings in an smart fashion enables reducing the energy costs [31].IoT has a wide range of applications, such as in manufacturing, logistics and construction industry [32].IoT is also widely applied in environmental monitoring, healthcare systems and services, efficient management of energy in buildings, and drone-based services [33][34][35][36].
When planning an IoT application which is the first step in designing IoT systems, the selection of components of IoT such as sensor device, communication protocol, data storage and computation needs to be appropriate for the intended application.For example, an IoT platform planned to control heating, cooling, and air conditioning (HVAC) in a building, requires utilizing relevant environmental sensors and using suitable communication technology [37].Figure 2 shows the different components of an IoT platform [38].IoT devices which are the second components of the IoT platforms, could be in the form of sensors, actuators, IoT gateways or any device that joins the cycle of data collection, transmission, and processing.For example, an IoT gateway device enables routing the data into the IoT system and establishing bi-directional communications between the device-to-gateway and gateway-to-cloud.The communication protocols that are the third component of the IoT platform, enable the different devices to communicate and share their data with the controllers or the decision making centers.IoT platforms offer the flexibility to select the type of the communication technologies (each having specific features), according to the needs of the application.The examples of these technologies include Wi-Fi, Bluetooth, ZigBee [39] and cellular technology such as LTE-4G and 5G networks [40].The data storage is the fourth component of the IoT platform which enables management of collected data from the sensors.
In principle, the data collected from the devices is very large.This necessitates planning an efficient data storage that can be in cloud servers or at the edge of an IoT network.The stored data which is used for analytical purposes, forms the fifth component of the IoT platforms.The data analytics can be performed off-line after storing the data or it can be in form of real-time analytics.The data analytic is performed for decision making about the operation of the application.Based on the need, the data analytics can be performed off-line or real-time.In off-line analytics, the stored data is first collected and then visualized on premises using visualization tools.In case of real-time analytics, the cloud or edge servers are used to provide visualization, e.g.stream analytics [41].

Enabling Technologies
IoT is a paradigm in which objects and elements of a system that are equipped with sensors, actuators, and processors can communicate with each other to provide meaningful services.In IoT systems, sensors are used to sense and collect data, and through gateways route the collected data to control centers or the cloud for further storage, processing, analytics, and decision-making.After the decision is made, a corresponding command is then sent back to the actuator installed on the system in response to the sensed data.As there are variety of sensor and actuator devices, communication technologies, and data computing approached, in this section, we explain the existing technologies which enable IoT.Then, we provide examples from the literature how these technologies are used in the energy sector.

Sensor Devices
Sensors are the key drivers of IoT [42].They are employed to collect and transmit data in real-time.The use of sensors enhances effectiveness, functionality, and plays a critical role in success of IoT [43].Different types of sensors exist that are developed for various application purposes.The examples of these applications include agriculture industry, environmental monitoring, healthcare systems and services, and public safety [44].In practice, in the energy sector including energy production, transmission and distribution, and production, many these sensors are used.In the energy sector, sensors are used to create savings in both cost and energy.Sensors enable smart energy management system and provide real-time energy optimization and facilitate new approaches for energy load management.The research and future trends of the sensor devices are also aims at development of sensor applications to improve load shaping and consumers' awareness as well as development of specific facilities to enhance production of renewable energies [45].In nutshell, the use of sensor devices within IoT, in the energy sector largely improves diagnostics, decision-making, analytics, optimization processes and integrated performance metrics.Due to the large number of sensors used in the energy sector, in the following we explain few examples of commonly applied sensor devices in energy production and consumption.
Temperature sensors are used to detect the fluctuations in heating and cooling a system [46].Temperature is an important and common environmental parameter.In the energy sector, the basic principle of power generation is the process of changing mechanical energy into electrical energy, whereas mechanical energy is achieved from heat energy, e.g., thermal power plants, wind, water flow, and solar power plants.These energy conversions are obtained using thermal, i.e., temperature.In the energy consumption side, the temperature sensors are used to maximize the performance of a system when temperature changes during normal operations.For example, in residential areas the best time for turning on or off the ventilation and cooling systems is recognized by temperature sensors; thus, the energy can be managed correctly in order to save energy [42].
Humidity sensors are used to distinguish the amount moisture and air's humidity.The ratio of moisture in the air to the highest amount of moisture at a particular air temperature is called relative humidity [47].The applications of humidity sensors in the energy sector are wide.For example, they are generally used in wind energy production.The use of humidity sensors on wind turbines are even vital, if the turbines are located offshore (due to the high level of moisture in the air).Humidity sensors can be placed in the nacelle and in the bottom of wind turbines and offer continuous moisture monitoring.This enables the operators to take actions to changes or deviations in the turbine operation conditions, leading to more consistent operations, optimized performance, and lower costs of energy.
Light sensors are used to measure luminance (ambient light level) or the brightness of a light.In energy consumption, light sensors have several uses in industrial and everyday consumer applications.As a main source of energy consumption in buildings relates to lighting, which, respectively, account for nearly 15% of total electricity usage [48].On global scale, approximately 20% of electricity is consumed for lighting [49].Therefore, light sensors can be utilized to automatically control lighting levels indoors and outdoors by turning on-and-off or dimming the light levels, such that the electric light levels automatically can be adjusted in response to changes in ambient light.In this fashion, the energy required for the lighting for the indoor environments can be reduced [19].
Passive Infrared (PIR) sensors, also known as motion sensors, are used for measuring the infrared light radiation emitted from objects in their surroundings.In energy consumption, these sensors are used to reduce the energy consumption in buildings.For example, by using PIR sensors, the presence of humans inside spaces can be detected.If there is no movement detected in the space then the light control of the space turns off the light, i.e., smart control of lighting.In this fashion, the electricity consumption of the buildings are reduced [50].Similarly, this can be applied for air conditioning systems which consume nearly 40% of the energy in buildings [48].
Proximity sensors are utilized to detect the presence of nearby objects without any physical contact [51].The example application of proximity sensors is in wind energy production.These sensors provide longevity and reliable position sensing performance in wind turbines.In wind turbines, the applications of proximity sensors include blade pitch control, yaw position, rotor, and yaw brake position; brake wear monitoring; and rotor speed monitoring [52].

Actuators
Actuators are devices that transform a certain form of energy into motion.They take electrical input from the automation systems, transform the input into action, and act on the devices and machines within the IoT systems [53].Actuators produce different motion patterns such as linear, oscillatory, or rotating motions.Based on the energy sources, actuators categorized as the following types [54].
Pneumatic actuators use compressed air for generating motion.Pneumatic actuators are composed of a piston or a diaphragm in order to generate the motive power.These actuators are used to control processes which require quick and accurate response, as these processes do not need a large amount of motive force.
Hydraulic actuators utilize the liquid for generating motion.Hydraulic actuators consist of cylinder or fluid motor that uses hydraulic power to provide mechanical operation.The mechanical motion gives an output in terms of linear, rotatory, or oscillatory motion.These actuators are used in industrial process control where high speed and large forces are required.
Thermal actuators use a heat source for generating the physical action.Thermal actuators convert thermal energy into kinetic energy, or motion.Generally, thermostatic actuators are composed of a temperature-sensing material sealed by a diaphragm which pushes against a plug for moving a piston.The temperature-sensing material can be any type of liquid, gas, wax-like substance, or any material that changes volume based on temperature.
Electric actuators apply external energy sources, e.g., batteries to generate motion.Electric actuators are mechanical devices capable of converting electricity into kinetic energy in either a single linear or rotary motion.The designs of these actuators are based on the intended tasks within the processes.
In the energy sector, for example, in power plants, pneumatic actuators are traditionally applied to control valves.Electric control-valve actuator technology enables achieving energy efficiency.They are also often used as the final control element in the operation of a power plant [55].In addition, there are variety of actuators developed for energy industry, e.g., LINAK electric actuator (https://www.linak.com/business-areas/energy/)that offer solutions for example for minimizing the energy waste when opening hatches and locking brakes in wind turbines and creating motion in solar tracking panels.In the literature there are also many studies aimed to illustrate the applications of the actuators within IoT.For instance, the research in [56] proposes a wireless sensor and actuator network to provide an IoT-based automatic intelligent system.Whereas, by optimizing the operation of devices and machines in the IoT, the proposed system achieves reduction in their overall energy consumption at a given time.

Communication Technologies
Wireless communication systems play the major role in activating IoT.Wireless systems connect the sensor devices to IoT gateways and perform end-to-end data communications between these elements of IoT.Wireless systems are developed based on different wireless standards and the use of each one depends on the requirement of the application such as communication range, bandwidth, and power consumption requirements.For example, often renewable sources of energy, including wind and solar power plants are mostly located in very remote areas.Therefore, ensuring a reliable IoT communications in remote places is challenging.Employing IoT systems on these sites requires selection of suitable communication technology that can guarantee a continues connection link and support real-time data transfer in an energy efficient manner.Due to the importance of communication technologies in IoT, in this subsection we review some of these technologies.We also indicate to few examples to show their role in the energy sector.Then, we provide a comparison in Table 1 to show the difference of each of the technologies when applied with IoT.
The short range wireless technologies, e.g., Wireless Fidelity (Wi-Fi) (https://www.wi-fi.org/)for IoT applications in the energy sector has been widely studies.In the energy sector, the obvious cases of using Wi-Fi include energy metering and building energy management [57][58][59][60][61].However, due to high power requirements of Wi-Fi, this technology is not the best solution in the energy sector.Low power wide area network (LPWAN) communication technologies such as narrowband IoT (NB-IoT); ZigBee; Bluetooth low energy (BLE) technologies; as well as the emerging LPWAN technologies such as LoRa, Sigfox, and LTE-M operating in unlicensed band [62] are better solutions to be used in the energy sector.Because, these emerging LPWAN technologies enable establishing a reliable, low-cost, low-power, long-range, last-mile technology for smart energy management solutions [63].Therefore, in this paper, we explain the short range and emerging LPWAN technologies and review some examples for their applied cases in the energy sector.We also explain the satellite technology which plays an important role in providing global IoT connectivity for industrial sectors located remote areas.In addition, in Table 1, we illustrate the different features of these technologies.
Bluetooth Low Energy (BLE) is a short range wireless communication technology for IoT that enables exchanging data using short radio wavelengths (https://www.bluetooth.com/).BLE is less costly to deploy, with a typical range of 0 to 30 m, which enables creating an instant personal area network [64].BLE targets small-scale IoT applications that require devices to communicate small volumes of data consuming minimal power.Industries in the energy sector with a well-designed IoT strategy can create new forms of machine-to-machine and machine-to-human communication using this technology.In the energy sector, BLE is widely used on the energy consumption in residential and commercial buildings.For instance, the authors of [65] describe a smart office energy management system that reduces the energy consumption of PCs, monitors, and lights using BLE.Another study proposes an energy management system for smart homes that utilizes BLE for communication among home appliances aiming at decreasing the energy at homes [66].Similarly, using BLE the research in [67] introduces a fuzzy-based solution for smart energy management in a home automation, aiming improving home energy management scheme.
Zigbee is a communication technology, which is designed to create personal area network and targets small scale applications (https://zigbee.org/).Zigbee is easy to implement and planned to provide low-cost, low-data rate, and highly reliable networks for low-power applications [68,69].Zigbee also utilizes a mesh network specification where devices are connected with many interconnections.Using the mesh networking feature of Zigbee, the maximum communication range, which is up to 100 m, is extended significantly.In the energy sector, the example IoT applications of Zigbee include lighting systems (buildings and street lighting), smart grids, e.g., smart electric meters, home automation systems and industrial automation.These applications aim to provide approaches for consuming energy in an efficient way.In literature, aiming to minimize the energy expenses of the consumers, the research in [70] evaluates the performance of home energy management application through establishing a wireless sensor network using Zigbee.The authors of [71] also introduce smart home interfaces to allow interoperability among ZigBee devices, electrical equipment, and smart meters to utilize the energy more efficiently.The work in [72] presents a ZigBee-based monitoring system which is used to measure and transfer the energy of home appliances at the outlets and the lights, aiming at reducing the energy consumption.Another study [73] presents field tests using ZigBee technologies for monitoring photovoltaic and wind energy systems.The results of the study demonstrate the proficiency of ZigBee devices applied in distributed renewable generation and smart metering systems.
Long Range (LoRa) LoRa is a wireless communication technology designed for IoT (https://loraalliance.org/).LoRA is a cost-effective communication technology for large deployment of IoT, it can add many years to battery life.LoRa is also used to establish long-distance broadcasts (more than 10 km in rural areas) with very low power consumption [74].The features of this technology make it a suitable communication technology to be used in the energy sector mainly in smart cities, such as smart grids and building automation systems, e.g., smart metering.
In literature, the work in [75] aims at optimizing energy consumption by deploying building energy management system using LoRa.The work proposes a platform by integrating multiple systems, such as air-conditioning, lighting, and energy monitoring to perform building energy optimization.The outcome of platform resulted in a 20% energy saving.In [76], the authors developed a machine-learning-based smart controller for a commercial buildings HVAC utilizing LoRa.The smart controller identifies when a room is not unoccupied and turns off the HVAC, reducing its energy consumption up to 19.8%.Using LoRa technology, another study [77] presents implementation of an electronic platform for energy management in public buildings.Through a test, the developed platform allows saving the energy for a lighting system by 40%.
Sigfox is a wide area network technology which uses an ultra narrow band (https://www.sigfox.com/).Sigfox allows devices to communicate with low power for enabling IoT applications [78].For the appropriateness of this technology in the energy sector for example, the study in [79] reviews the technological advances and presents Sigfox as one of the best low power candidates for smart metering for enabling real-time energy services for households.In addition, the study in [80] compare different low power wide area network technologies and conclude that Sigfox is a suitable solution to be used with electric plugs sensors alert in smart buildings.
Narrowband IoT (NB-IoT) is a LPWAN communication technology that supports large number of IoT devices and services with a high data rate with very low latency (https://www.3gpp.org/newsevents/1733-niot/).NB-IoT is a low-cost solution that has long battery life and provides enhanced coverage.According to the authors of [81], due to the latency features of NB-IoT, this technology is a potential solution for smart energy distribution networks by providing low-cost communications for smart meters.In addition, the study in [82] demonstrates the NB-IoT technology for smart metering.As another application of NB-IoT in the energy sector, the work in [83] introduces NB-IoT as a potential solution for smart grid communications by comparing NB-IoT with other communication technologies in terms of data rate, latency, and communication range.
Long Term Evolution for Machine-Type Communications (LTE-M) is the 3GPP (the third-generation partnership project) standardization, which is designed to reduce the device complexity for machine-type communication (MTC) [84].LTE-M supports secure communication, provides ubiquitous coverage, and offers high system capacity.LTE-M also offers services of lower latency and higher throughput than NB-IoT [85].In addition, this technology offers energy efficiency resource allocation for small powered devices, making it to be a potential solution for smart meter [86] and smart grid communications [87].
Weightless is LPWAN open wireless standard that is developed to establish communication among great number of IoT devices and machines (http://www.weightless.org/).Weightless is a potential solution for smart metering in the energy sector [88].Based on the study in [89], Weightless is a suitable wireless technology can be used in smart home IoT applications for smart metering and smart grid communications.
Satellite is another communication technology that has a very wide-area coverage and can support low data rate applications in machine-to-machine (M2M) fashion [90].Satellite technology is suitable for supporting IoT devices and machines in remote places.The study in [91] presents an IoT-based machine-to-machine satellite communication that is applicable to the smart grid, particularly for the transmission and distribution (T&D) sector.A similar study highlights the importance of using satellite-based IoT communications in energy domain such as solar and wind power plants [92].

IoT Data and Computing
Computing and analyzing the data generated by IoT allows gaining deeper insight, accurate response to the system, and helps making suitable decisions on energy consumption of the systems [99].However, computing IoT data is a challenging issue.Because, IoT data known as Big data refers to huge amount of structured and unstructured data, generated from various elements of IoT systems such as sensors, software applications, smart or intelligent devices, and communication networks.Due to the characteristics of Big data, which are big volume, high velocity, and high variety [100], it needs to be efficiently processed and analyzed [101].Processing the Big data is beyond the capacity of traditional methods, i.e., storing it on local hard drives, computing, and analyzing them afterwards.Advanced computing and analytic methods are needed to manage the Big data [102,103].In the followings, we explain cloud computing and fog computing, which are widely used for processing and computing the Big data.

Cloud Computing
Cloud computing is a data processing approach that offers services, applications, storage, and computing through the internet and allows computation of data streamed from IoT devices.In cloud computing, cloud refers to the "Internet" and computing refers to computation and processing services offered by this approach [104].Cloud computing consists of both application services that are accessed via the Internet and the hardware systems, which are located in data centers [105].Using these characteristics, cloud computing enables processing the big data, and provides complex computation capabilities [106].The main benefits of using cloud systems relies on [107] (i) significantly reducing the cost of hardware; (ii) enhancing the computing power and storage capacity; and (iii) having multi-core architectures, which eases the data management.Moreover, cloud computing is a secured system, which provides resources, computing power, and storage that is needed from a geographical location [108].These features of cloud computing enables the big data resulted from the growing applications of IoT to be easily analyzed, controlled and sorted efficiently [109].In addition, cloud computing eliminates the costs needed for purchasing hardware and software and running the algorithms for processing the IoT data, resulting in considerably minimization of electricity needed for local data computation.

Fog Computing
Although cloud computing is one of the best computing paradigms for data processing for IoT applications.Due to the delay and bandwidth limitation of centralized resources that are used for data processing, more efficient ways are required.Fog computing is a distributed paradigm and an extension of the cloud, which moves the computing and analytic services near to the edge of the network.Fog computing is a paradigm that expands the cloud at a greater scale and can support larger workload [110].In fog computing, any device with computing, storage, and network connection capability works as fog node.The examples of these devices include, but are not limited to, personal computers, industrial controllers, switches, routers, and embedded servers [111].In this computing paradigm, fog provides IoT data processing and storage locally at IoT devices instead of sending them to the cloud.The advantages of this approach include enhanced secure services required for many IoT applications as well as reducing network traffic and latency [112].Therefore, in contrast to the cloud computing, fog offers processing and computing services with faster response with higher security.This enables faster decision-making and taking appropriate actions.

IoT in the Energy Sector
Today, the energy sector is highly dependent on fossil fuels, constituting nearly 80 % of final energy globally.Excessive extraction and combustion of fossil fuels has adverse environmental, health, and economic impacts due to air pollution and climate change to name a few.Energy efficiency, i.e., consuming less energy for delivering the same service, and the deployment of renewable energy sources are two main alternatives to diminish the adverse impacts of fossil fuel use [12,13].
In this section, we discuss the role of IoT in the energy sector, from fuel extraction, operation, and maintenance (O&M) of energy generating assets, to T&D and end use of energy IoT can play a crucial role in reducing energy losses and lowering CO 2 emissions.An energy management system based on IoT can monitor real-time energy consumption and increase the level of awareness about the energy performance at any level of the supply chain [15,113].This section discusses the application of IoT in energy generation stages first.Then, we continue with the concept of smart cities, which is an umbrella term for many IoT-based subsystems such as smart grids, smart buildings, smart factories, and intelligent transportation.Next, we discuss each of the above-mentioned components separately.Finally, we summarize the findings of this section in Tables 2 and 3.

IoT and Energy Generation
Automating industrial processes and supervisory control and data acquisition systems became popular in the power sector in 1990s [37].By monitoring and controlling equipment and processes, early stages of IoT started to contribute to the power sector by alleviating the risk of loss of production or blackout.Reliability, efficiency, environmental impacts, and maintenance issues are the main challenges of old power plants.The age of equipment in the power sector and poor maintenance problems can lead to high level of energy losses and unreliability.Assets are sometimes more than 40 years old, very expensive, and cannot be replaced easily.IoT can contribute to reducing some of these challenges in the management of power plants [37].By applying IoT sensors, Internet-connected devices are able to distinguish any failure in the operation or abnormal decrease in energy efficiency, alarming the need for maintenance.This increases reliability and efficiency of the system, in addition to reducing the cost of maintenance [114].According to [115], a new IoT-based power plant can save 230 million USD during the lifetime and an existing plant with the same size can save 50 million USD if equipped with the IoT platform.

Energy democratization Regulation
Providing access to the grid for many small end users for peer to peer electricity trade and choosing the supplier freely.
Alleviating the hierarchy in the energy supply chain, market power, and centralized supply; liquifying the energy market and reducing the prices for consumers; and creating awareness on energy use and efficiency.
Aggregation of small prosumers (virtual power plants)

Energy market
Aggregating load and generation of a group of end users to offer to electricity, balancing, or reserve markets.
Mobilizing small loads to participate in competitive markets; helping the grid by reducing load in peak times; Hedging the risk of high electricity bills at peak hours; and improving flexibility of the grid and reducing the need for balancing assets; Offering profitability to consumers.

Preventive maintenance
Upstream oil and gas industry/ utility companies Fault, leakage, and fatigue monitoring by analyzing of big data collected through static and mobile sensors or cameras.
Reducing the risk of failure, production loss and maintenance downtime; reducing the cost of O&M; and preventing accidents and increasing safety.

Upstream oil and gas industry/ utility companies
Identifying failures and problems in energy networks and possibly fixing them virtually.
Improving reliability of a service; improving speed in fixing leakage in district heating or failures in electricity grids; and reducing maintenance time and risk of health/safety.

Industrial suppliers or utility companies
Analyzing market data and possibilities for activating flexibility options such as energy storage in the system.
Reducing the risk of supply and demand imbalance; increasing profitability in energy trade by optimal use of flexible and storage options; and ensuring an optimal strategy for storage assets.

Utility companies & system operator
Analyzing big data of and controlling many generation units at different time scales.
Improving security of supply; improving asset usage and management; reducing the cost of provision of backup capacity; accelerating the response to the loss of load; and reducing the risk of blackout.
For reducing fossil fuel use and relying on local energy resources, many countries are promoting RESs.Weather-dependent or variable renewable energy (VRE) sources, such as wind and solar energy, pose new challenges to the energy system known as "the intermittency challenge".In an energy system with a high share of VRE, matching generation of energy with demand is a big challenge due to variability of supply and demand resulting in mismatch in different time scales.IoT systems offer the flexibility in balancing generation with demand, which in turn can reduce the challenges of deploying VRE, resulting in higher integration shares of clean energy and less GHG emissions [116].In addition, by employing IoT, a more efficient use of energy can be achieved by using machine-learning algorithms that help determine an optimal balance of different supply and demand technologies [37].For instance, the use of artificial intelligence algorithms can balance the power output of a thermal power plant with the sources of in-house power generation, e.g., aggregating many small-scale solar PV panels [117].
Table 2 summarizes the applications of IoT in the energy sector, from energy supply regulation and markets.

Smart grids Electric grid management
A platform for operating the grid using big data and ICT technologies as opposed to traditional grids.
Improving energy efficiency and integration of distributed generation and load; improving security of supply; and reducing the need for backup supply capacity and costs.

Electric grid operation & management
Using big data at different points of the grid to manage the grid more optimally.
Identifying weak points and reinforcing the grid accordingly and reducing the risk of blackout.

Electric grid operation & management
Analyzing data of charging stations and charge/discharge cycles of EVs.
Improving the response to charging demand at peak times; analyzing and forecasting the impact of EVs on load; and identifying areas for installing new charging stations and reinforcement of the distribution grid.
Control and management of vehicle to grid (V2G)

Electric grid operation & management
Analyzing load and charge/discharge pattern of EVs to for supporting the grid when needed.
Improving the flexibility of the system by activating EVs in supplying the grid with electricity; Reducing the need for backup capacity during peak hours Control and management of EV fleet to offer optimal interaction between the grid and EVS.

Microgrids Electricity grid
Platforms for managing a grid independent from the central grid.
Improving security of supply; creating interoperability and flexibility between microgrids and the main grid; and offering stable electricity prices for the consumers connected to the microgrid.

Control and management of the District heating (DH) network DH network
Analyzing big data of the temperature and load in the network and connected consumers.
Improving the efficiency of the grid in meeting demand; reducing the temperature of hot water supply and saving energy when possible; and identifying grid points with the need for reinforcement.
Reducing demand at peak time, which itself reduces the grid congestion.
Demand response (demand side management)

Residential/ commercial & industry
Central control (i.e., by shedding, shifting, or leveling; load of many consumers by analyzing the load and operation of appliances.
Reducing demand at peak time, which itself reduces the grid congestion; reducing consumer electricity bills; and reducing the need for investment in grid backup capacity.

Advanced metering infrastructure End users
Using sensors and devices to collect and analyze the load and temperature data in a consumer site.
Having access to detailed load variations in different time scale; identifying areas for improving energy efficiency (for example overly air-conditioned rooms or extra lights when there is no occupants); and reducing the cost of energy use.

Battery energy management End users
Data analytics for activating battery at the most suitable time Optimal strategy for charge/discharge of battery in different time scale; improving energy efficiency and helping the grid at peak times; and reducing the cost of energy use.

Smart buildings End users
Centralized and remote control of appliances and devices.
Improving comfort by optimal control of appliances and HVAC systems; reducing manual intervention, saving time and energy; increasing knowledge on energy use and environmental impact; improving readiness for joining a smart grid or virtual power plant; and improved integration of distributed generation and storage systems.

Smart Cities
Nowadays, the staggering rate of urbanization as well as overpopulation has brought many global concerns, such as air and water pollution [118], energy access, and environmental concerns.In this line, one of the main challenges is to provide the cities with clean, affordable and reliable energy sources.The recent developments in digital technologies have provided a driving force to apply smart, IoT based solutions for the existing problems in a smart city context [119].Smart factories, smart homes, power plants, and farms in a city can be connected and the data about their energy consumption in different hours of the day can be gathered.If it is found that a section, e.g., residential areas, consumes the most energy in the afternoon, then automatically energy devoted to other sections, e.g., factories, can be minimized to balance the whole system at a minimum cost and risk of congestion or blackout.
In a smart city, different processes, i.e., information transmission and communication, intelligent identification, location determination, tracing, monitoring, pollution control, and identity management can be managed perfectly by the aid of IoT technology [120].IoT technologies can help to monitor every object in a city.Buildings, urban infrastructure, transport, energy networks, and utilities could be connected to sensors.These connections can ensure an energy-efficient smart city by constant monitoring of data gathered from sensors.For example, by monitoring vehicles with IoT, street lights can be controlled for optimal use of energy.In addition, the authorities can have access to the gathered information and can make more informed decisions on transportation choices and their energy demand.

Smart Grid
Smart grids are modern grids deploying the most secure and dependable ICT technology to control and optimize energy generation, T&D grids, and end usage.By connecting many smart meters, a smart grid develops a multi-directional flow of information, which can be used for optimal management of the system and efficient energy distribution [121].The application of smart grid can be highlighted in different subsectors of the energy system individually, e.g., energy generation, buildings, or transportation, or they can be considered altogether.
In traditional grids, batteries were recharged by adapters through electricity cables and AC/DC inverter [121].These batteries can be charged wirelessly in a smart grid, using an inductive charging technology.In addition, in a smart grid, the energy demand pattern of end users can be analyzed by collecting data through an IoT platform, for example, the time of charging of mobile phones or electric cars.Then, the nearest wireless battery charge station can allocate the right time-slot and that device/vehicle can be charged.Another advantage is that the use of IoT will lead to better control and monitoring of the battery equipped devices, and therefore, first, the energy distribution can be adjusted, and second, the delivery of electricity to these vehicles can be guaranteed.This will reduce unnecessary energy consumption considerably.
Moreover, IoT can be applied in isolated and microgrids for some islands or organizations, especially when energy is required every single moment with no exception, e.g., in databases.In such systems, all the assets connected to the grid can interact with each other.Also, the data on energy demand of any asset is accessible.This interaction can assure the perfect management of the energy distribution whenever and everywhere needed.In terms of collaborative impact of smart grids, as it is shown in Figure 3, in a smart city equipped with IoT-based smart grids, different sections of the city can be connected together [121].
During the collaborative communication between different sectors, the smart grid can alert operators through smart appliances before any acute problem occurs [113,122].For example, through constant monitoring, it can be detected if energy demand exceeds the capacity of the grid.Therefore, by acquiring real-time data, different strategies can be adopted by authorities and energy consumption can be rescheduled to a different time when there is lower expected demand.In some regions, smart (or dynamic) pricing tariffs have been considered for variable energy prices in this regard [123].Real-time pricing (RTP) tariffs as well as the energy price will be higher at a certain time when the consumption of energy is likely to be higher.Through the data gathered from the components of the smart grid, energy consumption and generation can be perfectly optimized and managed by far-sighted strategies.Reduction of transmission losses in T&D networks through active voltage management or reduction of non-technical losses using a network of smart meters are other examples of applying IoT [37].

Smart Buildings
The energy consumption in cities can be divided into different parts; residential buildings (domestic); and commercial (services), including shops, offices, and schools, and transport.The domestic energy consumption in the residential sector includes lighting, equipment (appliances), domestic hot water, cooking, refrigerating, heating, ventilation, and air conditioning (HVAC) (Figure 4).HVAC energy consumption typically accounts for half of energy consumption in buildings [124].Therefore, the management of HVAC systems is important in reducing electricity consumption.With the advancement of technology in the industry, IoT devices can play an important role to control the energy losses in HVAC systems.For example, by locating some wireless thermostats based on occupancy, unoccupied places can be realized.Once an unoccupied zone is detected, some actions can be taken to lower energy consumption.For instance, HVAC systems can reduce the operation in the unoccupied zone, which will lead to significant reduction in energy consumption and losses.IoT can also be applied to manage the energy losses of lighting systems.For example, through applying IoT-based lighting systems, the customers will be alerted when the energy consumption goes beyond the standard level.Furthermore, by an efficient analysis of the real-time data, load from high-peak will be shifted to low-peak levels.This makes a significant contribution to optimal use of electrical energy [119,125] and reducing related greenhouse gas emissions.Using IoT, the demand response will be more agile and flexible, and the monitoring and demand side management will become more efficient.

Smart Use of Energy in Industry
IoT can be employed to design a fully connected and flexible system in the industry to reduce energy consumption while optimizing production.In traditional factories, a lot of energy is spent to produce the end product and control the quality of the end product.Moreover, monitoring every single process requires human resources to be involved.However, using an agile and flexible system in smart factories helps to recognize failures at the same time rather than recognizing them by monitoring the products at the end of production line.Therefore, a suitable action can be taken promptly to avert wasteful production and associated waste energy.
In terms of monitoring processes during manufacturing, IoT, and its enabling technology play a crucial role.Gateway devices, IoT hub networks, web servers, and cloud platforms, which are accessible with smart mobile devices (e.g., smart phones or personal computers) can be examples of monitoring equipment.Wireless communications such as Wi-Fi, Bluetooth, ZigBee, Z-wave, or wired communications, such as Local Area Network (LAN) can be used to connect all pieces of equipment [126].Moreover, to use IoT more efficiently, by installing sensors on each component of an industrial site, the components that consume more energy than their nominal energy level can be detected.Thus, every single component can be easily managed, the faults of components can be fixed, and the energy consumption of each component can be optimized.This eminently results in reducing the energy losses in smart factories.
In a smart factory, data processing is the key element in the whole system, through which data in the cloud platform (acts as a brain) will be analyzed to help managers making more efficient decisions in time [127].In terms of monitoring and maintaining assets of manufacturing, the big problem in factories is the depreciation of machines and mechanical devices.With an appropriate IoT platform and tools, the proper device size can be selected to reduce wear and tear and the associated maintenance costs.IoT-based conditional monitoring ensures the mechanical device never reaches its threshold limit.This simply means the device lasts longer and suffers fewer failures.Moreover, the failures that cause energy loss can be anticipated to be tackled.
IoT-based agile systems can provide a smart system for collaboration between customers, manufactures, and companies.Therefore, a specific product will be manufactured directly according to customers' order.Therefore, energy consumed during the process of storing spare parts as well as the energy wasted in warehouses to keep the spare parts will be dwindled significantly.Only a certain number of products in various kinds will be manufactured and stored, which enhances the management of energy consumption and production efficiency [126].

Intelligent Transportation
One of the major causes of air pollution and energy losses in big cities is overuse of private vehicles instead of public transportation.As opposed to a traditional transportation system where each system works independently, applying IoT technologies in transportation, so called "smart transportation", offers a global management system.Also, the real-time data processing plays a significant role in traffic management.All the components of the transportation system can be connected together, and their data can be processed together.Congestion control and smart parking systems using online maps are some applications of smart transportation.Smart use of transportation enables passengers to select a more cost-saving option with shorter distance and the fastest route, which saves a significant amount of time and energy [120].Citizens will be able to determine their arrival time and manage their schedule more efficiently [125].Therefore, time of city trips will be shortened, and the energy losses will be reduced significantly.This can remarkably reduce CO 2 emissions and other air polluting gases from transportation [119].
Table 3 summarizes the applications of IoT in the energy sector, from smart energy grids to the end use of energy.The IoT-based digitalization transforms an energy system from a unidirectional direction, i.e., from generation through energy grids to consumers, to an integrated energy system.Different parts of such an integrated smart energy system are depicted in Figure 5.

Challenges of Applying IoT
Besides all the benefits of IoT for energy saving, deploying IoT in the energy sector represents challenges that need to be addressed.This section addresses the challenges and existing solutions for applying IoT-based energy systems.In addition, in Table 4, we summarize the challenges and current solutions of using IoT in the energy sector.

Energy Consumption
In the energy systems, the major effort of IoT platforms are saving the energy.In energy systems to enable communication using IoT, massive number of IoT devices transmit data.To run the IoT system and transmit huge amount of data generated from the IoT devices considerable amount of energy is needed [128].Therefore, the energy consumption of IoT systems remains as an important challenge.However, various approaches have tried to reduce the power consumption of IoT systems.For example, by setting the sensors to go to sleep mode and just work when necessary.Designing efficient communication protocols which allow distributed computing techniques that enables energy efficient communications has been studied greatly.Applying radio optimization techniques such as modulation optimization and cooperative communication has been considered as a solution.Moreover, energy-efficient routing techniques such as cluster architectures and employing multi-path routing techniques was understood as another solution [129][130][131].

Integration of IoT with Subsystems
A main challenge includes the integration of an IoT system in subsystems of the energy system.Because subsystems of the energy sector are unique employing various sensor and data communication technologies.Therefore, solutions are needed for managing the data exchange among subsystems of a IoT-enabled energy system [132][133][134].An approach for finding solutions for the integration challenge, taking into account the IoT requirements of a subsystem, pertains to modeling an integrated framework for the energy system [132].Other solutions propose designing co-simulation models for energy systems to integrate the system and minimize synchronization delay error between the subsystems [135,136].

User Privacy
Privacy refers to the right of individual or cooperative energy consumers to maintain confidentiality of their personal information when it is shared with an organization [137,138].Therefore, accessing to proper data such as the number of energy users as well as the number and types of appliances which use energy become impossible.Indeed, these types of data which can be gathered using IoT enables better decision-making that can influence the energy production, distribution and consumption [139].However, to decrease the violation of users' privacy, it is recommended that the energy providers ask for user permission to use their information [140], guaranteeing that the users' information will not be shared with other parties.Another solution would also be a trusted privacy management system where energy consumers have control over their information and privacy is suggested [141].

Security Challenge
The use of IoT and integration of communication technologies in energy systems enhances the threat and cyber-attacks to information of users and the energy systems from production, transmission, and distribution to consumption [142,143].These threads define the security challenge in the energy sector [144].Moreover, IoT-based energy systems are widely deployed in large geographical areas within the energy sector to offer services.The large deployment of IoT systems puts them in more risk of being under cyberattacks.To overcome the challenge, a study introduces an encryption scheme to secure energy information from the cyberattacks [145].In addition, distributed control systems which enable control at different IoT system level are suggested to reduce the risk of cyberattack and increasing the security of system [146].

IoT Standards
IoT uses a variety of technologies with different standards to connect from a single device to a large number of devices.The inconsistency among IoT devices that utilize different standards forms a new challenge [147].In IoT-enabled systems, there are two types of standards, including network protocols, communication protocols, and data-aggregation standards as well as regulatory standards related to security and privacy of data.The challenges facing the adoption of standards within IoT include the standards for handling unstructured data, security and privacy issues in addition to regulatory standards for data markets [148].An approach for overcoming the challenge of standardization of IoT-based energy system is to define a system of systems with a common sense of understanding to allow all actors to equally access and use.Another solution pertains to developing open information models and protocols of the standards by the cooperating parties.This shall result in standards which are freely and publicly available [149].

Architecture Design
IoT-enabled systems are composed of variety of technologies with increasing number of smart interconnected devices and sensors.IoT is expected to enable communications at anytime, anywhere for any related services, generally, in an autonomic and ad hoc fashion.This means that the IoT systems based on their application purposes are designed by complex, decentralized, and mobile characteristics [149].Taking into account the characteristics and needs of an IoT application, a reference architecture cannot be a unique solution for all of these applications.Therefore, for IoT systems, heterogeneous reference architectures are needed which are open and follow standards.The architectures also should not limit the users to use fixed and end-to-end IoT communications [149,150].

Future Trends
Applying current IoT systems for providing energy efficient solutions in the energy sector has many advantages highlighted in previous sections.However, for deploying IoT in the energy domain, new solutions and trends are needed to improve the performance of IoT and overcome the associated challenges.In this section, we present the Blockchain technology and Green-IoT as two approaches that can help to tackle some of the challenges.

Blockchain and IoT
Current IoT systems mostly rely on centralized cloud systems [151,152].In most IoT applications, thousands of IoT devices and machines need to be connected, which is hard to synchronize.Moreover, due to the centralized and server-client nature of IoT when server is vulnerable, all the connected objects are easy to be hacked and compromised, which result in security concerns for the system and privacy issues for users [153].Fortunately, Blockchain can be a solution for this challenge [154].
Blockchain provides a decentralized and democratized platform with no need for third party's intervention.The consensus platform of blockchain requires every IoT node proves that it pursues the same goal as others.Verified transactions is also stored in the form of a block, which is linked to the previous one in a way information can never be erased.Moreover, the history of every single transaction at every node can be recorded and is accessible by everyone.Therefore, any member in blockchain becomes aware of any changes in each block immediately [155][156][157].Moreover, due to the distributed ledger of blockchain, even thousands of IoT devices can be synchronized easily.The consensus algorithms of blockchain based on peer-to-peer networks can provide a secure distributed database [153].Therefore, decentralized and private-by-design IoT that can guarantee the privacy can be promised by blockchain [158].
More importantly, blockchain can store and share software updates between objects.There are innocuousness checking nodes that approve the accuracy of update information as a new node and guarantee its protection from any threats, once an update added to the blockchain as a valid block, it is impossible to erase or change it.Therefore, IoT-based platforms can be provided with updates availability and innocuousness through blockchain [159].
In the energy sector, the application of blockchain will accelerate the IoT effectiveness by providing a decentralized platform for distributed power generation and storage systems enhancing energy security and efficiency.Real and high-qualified data can be exchanged freely between devices and people can directly have access to energy information without the involvement of any third party.Neighbors can simply trade energy with one another.Therefore, without involvement of authorities, not only trust will be enhanced among people, but also many costs of this connection to the centralized grids can be saved.Another advantage is that by monitoring the usage statistics of an area, Blockchain enables the energy distribution to remotely control energy flow to that particular area.Furthermore, blockchain-based IoT systems helps in the diagnosis and maintenance of equipment within smart grid [154].
Currently, the direct application of blockchain technology in an IoT-based system is impossible due to lack of enough computational resources, insufficient bandwidth and the need to preserve power.However, cloud and fog computing platforms can ease the way for blockchain services in IoT [160].

Green IoT
The energy consumption of IoT devices is an important challenge, especially in large-scale deployment of these technologies in near future.To run billions of devices that will be connected to the Internet significant amount of energy is required.The big number of IoT devices will also produce a great deal of electronic waste [161].To tackle these challenges, a low-carbon and efficient communication networks are needed.Fortunately, these necessities has led to the appearance of the green IoT (G-IoT) [162,163].The key component of G-IoT is its energy-efficient characteristics throughout the life cycle, i.e., design, production, deployment, and ultimately disposal [129].
G-IoT cycle can be applied in different IoT technologies.For example, in radio frequency identification (RFID) tags.To decrease the amount of material in each RFID tag, which is difficult to be recycled, the size of RFID tags are reduced [161,[164][165][166][167][168].Green M2M communications is another example, which enables adjusting power transmission the minimum level, facilitates more efficient communication protocols using algorithmic and distributed computing techniques [129].In wireless sensor networks also the sensors nodes can be in the sleep mode and just work when necessary.In addition, radio optimization techniques, such as, modulation optimization or cooperative communication can be applied to reduce the power consumption of the nodes.Moreover, energy-efficient routing techniques, such as, cluster architectures or multi-path routing can provide efficient solutions [130,131].In conclusion, the above-mentioned approaches and examples can reduce the energy needs of IoT systems.

Conclusions
Energy systems are on the threshold of a new transition era.Large-scale deployment of VRE in distributed energy systems and the need for efficient use of energy calls for system-wide, integrated approaches to minimize the socio-economic-environmental impacts of energy systems.In this respect, modern technologies such as IoT can help the energy sector transform from a central, hierarchical supply chain to a decentralized, smart, and optimized system.In this paper, we review the role of IoT in the energy sector in general, and in the context of smart grids particularly.

Figure 2 .
Figure 2. Diagram describing the components of an IoT platform.

Figure 3 .
Figure 3.A centralized data connectivity in a smart city concept.

Figure 4 .
Figure 4. Share of residential energy consumption.

Figure 5 .
Figure 5. Applications of IoT in an integrated smart energy system.

Table 2 .
Applications of IoT in the energy sector (1): regulation, market, and energy supply side.

Table 3 .
Applications of IoT in the energy sector (2): energy grids and demand side.

Table 4 .
Challenges and current solutions of using IoT in the energy sector.