Machine Learning-Enabled Power Scheduling in IoT-Based Smart Cities

: Recent advancements in hardware and communication technologies have enabled worldwide interconnection using the internet of things (IoT). The IoT is the backbone of smart city applications such as smart grids and green energy management. In smart cities, the IoT devices are used for linking power, price, energy, and demand information for smart homes and home energy management (HEM) in the smart grids. In complex smart grid-connected systems, power scheduling and secure dispatch of information are the main research challenge. These challenges can be resolved through various machine learning techniques and data analytics. In this paper, we have proposed a particle swarm optimization based machine learning algorithm known as a collaborative execute-before-after dependency-based requirement, for the smart grid. The proposed collaborative execute-before-after dependency-based requirement algorithm works in two phases, analysis and assessment of the requirements of end-users and power distribution companies. In the first phases, a fixed load is adjusted over a period of 24 h, and in the second phase, a randomly produced population load for 90 days is evaluated using particle swarm optimization. The simulation results demonstrate that the proposed algorithm performed better in terms of percentage cost reduction, peak to average ratio, and power variance mean ratio than particle swarm optimization and inclined block rate.


Introduction
The Internet of Things (IoT) and drones have enabled various smart city applications. Drones are dynamic ying nodes whose connectivity is established by intelligent IoT gadgets. The use of smart drones can improve energy utilization, information compilation, security and privacy, disaster management, living standards, and public safety [1]. The quality of life in smart cities rests on health protection, public security, disaster management, traf c tracking, and ef cient power and energy utilization in the smart home. Inef cient use of devices in smart homes consumes much energy. Reinforcement learning can control energy consumption through proper scheduling of appliances, and numerous techniques can be used to learn from the environment and perform intelligent scheduling. For example, Q-learning connects agents to every home appliance and determines a plan to minimize energy consumption [2]. The implementation of renewable energy sources and smart meters has resulted in large-scale changes to the smart grid. The power grids have been improved due to innovation and the use of the latest technologies. However, programmable devices in smart grids need improvements because they still face numerous challenges to perform better. Innovative techniques have improved power grids and made it easy to program power devices Earliglow-based algorithms minimize the usage of household devices, and avoidance of critical peak prices can save on electricity costs [3].
Machine learning techniques, including Q-learning and reinforcement learning, have provable strategies and are considered the best solutions. Fully automatic machines are installed, such as in safety, shipping, water control, and self-instructed smart bins that learn from the environment and reduce energy costs. Optimization is another new paradigm that can be used to reduce electricity bills. Renewable power sources like energy storage systems, wind, and photovoltaic panels can reduce costs. The energy management system is used for renewable energy in smart grids. Some home appliances are used in this scenario to examine loads that are managed by the energy management system (EMS). Three case studies are evaluated, considering parameters such as timeof-use and pricing schemes, where the simulation results clearly show the ef ciency of the EMS [4]. The smart-grid approach varies by context; for instance, Americans focus on the distribution network, service levels, and user interaction, while Europeans stress the use of renewable energy and ease of use. The Chinese have developed a bidirectional power system, where current and data ow from different points on a power grid to clients, and vice versa, which they call a fully automated power system with real-time monitoring [5]. Another important concept in ef cient energy utilization is the use of unmanned aerial vehicles (UAVs) in smart cities. These vehicles play an important role in smart cities because solar and hydrogen energy are used by the aerial vehicles that provide a basis for hybrid power systems. The energy management strategy applied to UAVs is in its infancy, and more research is needed. Similarly, an energy stabilization threshold is introduced in eAntHocNet to preserve drones' energy and improve the meshwork lifespan [6].
The advancements in home energy management systems (HEMSs) have transformed life in the digital world. This paper describes HEMS architecture and functionalities like monitoring, logging, control, management, and alarms, which results in balanced energy prices. We brie y explain renewable energy management, which alters peak load utilization to save power [7]. In smart cities, novel energy-based strategies are used to minimize energy consumption and maximize the sources of renewable energy. The EMS learns from the environment and shifts energy demand during peak hours to reduce energy utilization [8,9]. The community-based home energy-management system is a new model that is applied to renewable energy to reduce the peak-to-average ratio on the smart grid. The technique is based on a circular shifted real-time price, which is a basic moderation in electricity pricing strategy via particle swarm optimization (PSO) in conjunction with other techniques. A HEMS simulation shows a reduction up to 45.3% in electricity cost and 37.98% reduction in PAR [10]. We propose a collaborative execute-before-after dependency-based requirement (CDBR) technique, which performs better than PSO and cluster-based EMS. The contributions of this paper are as follows.
1. The CDBR technique is used in a smart grid to reduce electricity pricing for automatic appliances. 2. The proposed scheme is evaluated in terms of convergence time, peak-to-average ratio, power utilization, and ratio of mean value. 3. Electricity cost is calculated for 90 days using MATLAB-based simulations, and CDBR is compared to benchmark algorithms with and without optimization.
The rest of this article is structured as follows. Section 2 reviews related work. Section 3 introduces the proposed CBDR algorithm for smart cities. Results are discussed in Section 4. Section 5 relates our conclusions and discusses future research directions.

Related Work
The idea of solar energy management was introduced in the early 1980s [11], and optimization techniques were formulated to manage power scheduling and reduce electricity cost [12]. In 2003, Japan launched a new architecture in which home appliances are connected to an energy management controller that is controlled by a personal computer [13]. In 2006, a patent was led by Whirlpool, in which an HEMS controller was designed for home appliances [14]. Researchers around the world worked on improvements including fuzzy systems and scheduling optimization, such as the arti cial bee colony [15] to schedule home devices. Honda implemented hardware equipment to control, schedule, and monitor home appliances [16].
In smart grid architecture, automated metering infrastructure was implemented between electric power utilities and end users [17]. Smart cities provide energy-management utilities for energy storage and monitoring using smart home energy-management systems [18]. Devices in IoT-based smart homes are controlled through PCs or mobile phones, and unmanned aerial vehicles (UAVs) read smart meters. Some houses schedule their loads at lower-priced times. A HEMS is connected wirelessly using 802.11 technology. Every home's optimized power usage is acquired by inclined block rate (IBR), CDBR, and circular shift real-time electricity pricing, and with little shift each gets real-time electricity pricing. Using our proposed CDBR technique, the power grid distributes the load among homes according to their needs. In this way, the electricity usage of every home is supervised and a fair share is guaranteed. However, some home appliances have device operating systems using a tariff structure in periodic time slots (TSs). The energy price in each TS is different according to its usage and the tariff structure. A TS with a predicted low price may result in higher usage of electricity in the next TS, causing peak utilization. This is due to circular shift where other community population devices will inhabit the slot, which will build the peak. Fig. 1 shows a drone-assisted IoT-enabled secure smart city.

Machine Learning and IoT-Enabled Smart Cities
Machine learning in smart homes uses datasets as input to forecast output values. Smart homes use machine learning and sensors to gather information from nodes that can be utilized to nd broken links or sensors. The system learns and improves from experience to make better decisions. Residential energy management systems use automatic switches. Switching decisions are based on arti cial neural networks (ANNs) and support vector machines (SVMs) that will ef ciently switch the load to local energy storage called renewable energized systems, which results in reduced power utilization in the power grid. A simulation analysis using SVM shows better results in terms of convergence time, peak-to-average ratio, power utilization, and ratio of mean value compared to arti cial neural networks [19]. Smart homes use IoT and local area network connectivity using 802.11 technology to allow sensor nodes to exchange information. In [20], the authors presented a model with three parts: 1. Raspberry Pi; 2. Google Colab; and 3. Matplotlib. A Raspberry Pi-based smart plug reads the information from each home appliance, and Google Colab stores the trained data for monitoring. Matplotlib records the energy consumption of end-users. The proposed model is better in terms of accuracy.

Smart Cities
The integration of various devices and applications leads to the concept of smart homes, and new dynamics of this area will cover security and data privacy. Some key long-term goals include secrecy, authenticity, availability, and authorization [21]. At the abstract level in a smart grid, the demand-side unit uses a security protocol to control a home area network (HAN). Securing communication over the HAN network is endorsed by end-user connectivity with the internet, which directly compromises security [22]. In addition to the development process of the microgrid, renewable energy systems with improper energy management systems are particularly ineffective and inef cient. Current systems cannot be deployed on existing home infrastructures without compromising security to home appliances due to the low cost of home energy. Cloud computing techniques use renewable energy capacity to schedule home devices by designing and implementing information-centric HEMS (iHEMS) systems [23,24]. Secure communication between network nodes in a smart grid is the main issue. To solve this issue, a secure communication protocol using key management (public and private key) is implemented in information-centric networking for home data, and researchers have developed information-centric HEMS (iHEMS) [25]. Wireless technology such as 802.11 or Zigbee is used to connect different nodes, or to establish a secure connection between two workstations. An authentication protocol is designed to authenticate the devices and broadcast the information securely using Zigbee devices. The Zigbee device monitor, control, and record information are broadcast by any device [26].

Proposed Scheme
Smart homes include automatically operating devices like air conditioners, washing machines, fans, televisions, water pumps, solar panels, and windmills. A real-time pricing (RTP) model is used that charges consumers on a time-slot basis. One hour is divided into six slots of 10 min, which makes 144 time slots in a day. The proposed algorithm is used to schedule power in smart homes, showing a tendency to reduce and smooth high load peaks to attain a preferable peakto-average ratio. The proposed technique works in two phases. In the rst stage, a xed load is adjusted over a period of 24 h, and the second stage is evaluated using a rand function to randomly produce a population load for 90 days using PSO. The technique is repeatedly used to obtain simulation results for CDBR optimization, which results in a reduction in the peak-toaverage ratio. In the proposed scenario, a house can have a minimum of eight appliances, and a maximum of 16. Appliances may run 24 h on a daily basis, i.e., continuous usage. The proposed collaborative execute-before-after dependency-based requirement is shown in Fig. 2.
Algorithm 1: Proposed algorithm for smart cities (CDBR) Input: Requirements, Pri (a, b, c, d, e, f, g, h, i, j), 1: initialization of particles with random priorities (Pri). 2: Adjust the limitations for positions and velocity 3: Regulate no. of iterations 4: Default value of global best (g best ) will be in nity (∞) 5: Disagreement must be zero at the initial stage 6: while (the main objective is to minimize the disagreement value) 7: for Pri (a, b, c, d, e, f, g, h, i, j) each iteration 8: Population do 9: Compute disagreement using Eqs. (1)-(5) 10: else 11: Update g best = p best if g best > p best 12: end if 13: Update best_position = Pri, position for which g best > p best 14: for every particle 15: Update the particle's velocity using Eq. (6) 16: else 17: Updating of particle's position according to velocity 18: Calculation and nding limits for random priorities using Eq. (7) 19: end if 20: Return the nal minimized disagreement value, which is equal to gbest and Pri (disagreement is lowest or near zero) 21: Return to line 7

22: End
Providing the optimal solution in a smart grid, the PSO plays a vital role. However, to get a better decision support system, CDBR is the best strategy by which to secure the communication channel. CBDR incorporates PSO to get better results, while the disagreement in a priority value pair is calculated using Eqs. (1)- (5).
Here, Eqs. (1) and (2) calculate the disputed pairs, which means the values representing a dispute or variation between two standard values (P i and S i ).
Similarly the disagreement between Pi and Si is calculated using Eq. (3).
The current solution represents the prime concern list, which is the basic requirement for available iterations in the sequence using the position vector. V is the particle velocity, and p best and g best are the best possible solutions to be obtained individually. In Eq. (6), the rand function is used to initiate random values in the interval (0, 1). Two parameters are used; cognition (c1) shows the last position a particle visited, and social (c2) indicates information about the locality of the optimal position.  The electricity prices using IBR are better because the price of electricity is computed based on the actual usage and real-time estimation. The RTP-IBR electricity pricing scheme for every time slot is different. Some end users know when electricity prices will be low, and try to make use of home appliances during those periods. Many people use electricity simultaneously, thinking that this is the low-price time based on IBR estimation. This results in a high load. Consequently, prices are driven higher before IBR can signal this to consumers/users.

Simulation Results and Discussion
A description of the simulation results is presented in the form of graphs and tables to verify the performance of the proposed scheme compared to traditional evolutionary algorithms with IBR. Various metrics are used, such as power usage patterns, cost of electricity, and average-tomean ratio.

Con guration for PSO
We used MATLAB for simulation to evaluate computational techniques such as PSO and CDBR. The group size, i.e., the number of houses, was about 100, with 16 subcomponents. The results shown are the average of many simulations. We ran simulations 50 times and present the average values here.

Con guration for CDBR
We trained our proposed CDBR techniques using the data of four months, from May 27, 2018, to August 24, 2018, from a U.S.-based company named Ameren. The power usage pattern for 45 days is shown in Fig. 3, which depicts that PSO and IBR reduce the PAR slightly, while the proposed scheme reduces the PAR signi cantly.
The proposed CDBR in combination with IBR gives better results than PSO in conjunction with IBR. The mean values are tabulated in Tab. 1. The simulation results of the proposed CDBR scheme show a reduction compared to PSO. CDBR gives an average improvement of 0.26 in peak-to-average ratio (PAR), and without optimization it gives an improved average of 0.866. Tab. 3 shows the mean values of PSO and CDBR. Fig. 7 shows the power average usage pattern of consumers. Without optimization, the usage is high, and with PSO, it is better that without optimization. However, the proposed CDBR outperforms all schemes.
The peak-to-average ratio of power usage is better when using CDBR than with PSO. It also increases the number of users, as shown in Figs. 8 and 9.

Conclusion and Future Directions
Smart cities are a promising area of research. Smart cities must provide cost-effective and ef cient solutions to make humans comfortable. One such solution is energy management, i.e., a smart grid. It is achieved by knowing the demand-to-supply ratio in a locality using machine learning algorithms. To balance demand and response at the power generation side, we have proposed a CDBR algorithm based on particle swarm optimization. The algorithm helps to maintain a smooth power usage pattern and reduce the peak-to-average ratio. The algorithm shows signi cant improvements in simulation-based results in terms of fast convergence. In the future, CDBR can be used with a cluster community home energy management system. The entities in a smart home and smart grid are interconnected using IoT. Wireless communication among these devices is an easy target of intruders. Securing the smart grid from cyber-attacks is mandatory, and warrants future work.

Funding Statement:
The authors received no speci c funding for this study.

Con icts of Interest:
The authors declare that they have no con icts of interest to report regarding the present study.