1 Introduction

Nowadays, the development of the world’s electric power industry is associated with the growth of renewable energy sources (RESs), such as photovoltaic (PV), wind energy (WE), and biomass. When designing a power facility, in particular, when determining its installed capacity and the optimal installation location in an electric power system, it is necessary to take into account technological aspects: system topology, methods of connection to the system, requirements for relay protection, automation equipment, economic aspects, and environmental aspects [1,2,3]. Modern energy systems are very complicated, with many controlled and uncontrollable factors. A comprehensive modeling and optimization approach is required to manage a multi-vector energy system successfully. In many areas, the design of appropriate energy resource combinations in climate change mitigation activities is a difficulty [4, 5]. This optimization may be carried out by economic objectives or focusing on techno-operational goals. Numerous other criteria may be used for the design and management within these two major groups [6, 7].

Smart homes combine IoT services and cloud computing, integrating intelligence into sensors and actuators, networking smart things using appropriate technologies, and allowing interactions with smart things using cloud computing [8,9,10,11]. IoT refers to a future networking technology where information is connected to the internet to produce, accumulate, distribute and employ information [12,13,14,15]. However, due to the complexity and variety of the systems and the common issue of inefficient control techniques, the full potential of smart homes remains untapped. As a result, energy usage is greater than necessary, and consumers cannot achieve maximum comfort in their automated homes [16, 17].

IoT technologies have quickly risen in recent world’s market. They offer solutions to such problems and are being used for improving smart grid applications [18, 19]. IoT technologies like advanced metering infrastructure, self-healing, and two-way communication are crucial agents that are helpful for monitoring and controlling smart grid variables to perform adaptable and intelligent EMS [20,21,22]. The advancement of technology, appliances in the home have witnessed an enormous increase. As a result, a strategy for the most up-to-date EMSs is required to meet the electrical demand and ensure the security of residential installations. Demand side management (DSM) is a smart grid solution that plays an important role. Customers can connect with the grid operator through DSM, participate in settlements and help utilities reduce peak power demand during peak periods. Many DSM programs are now being discussed in academic literature, emphasizing EMSs for homes. Various mathematical modeling methods are used to determine the optimal installation site for a renewable generation facility, each of which has its advantages and disadvantages. Today, the most popular are meta-heuristic methods [23], which have been widely used for optimizing industrial processes, complex networks, and electrical tasks scheduling [24,25,26]. This work compares various heuristic optimization strategies with the proposed methodology for minimizing user bills and PAR while maintaining user comfort under operational and power constraints. Although, heuristic optimization algorithms have largely been used for optimization problems. However, some of these suffer drawbacks, including getting stuck in local optima, a low convergence rate, and being unable to provide constantly good solutions. Therefore, we proposed improving the Harris hawks algorithm, denoted as the arithmetic Harris hawks optimization (AHHO) algorithm. The proposed algorithm applies arithmetic and lightweight flight operators to Harris hawks optimization for household energy management. These operators are used in the proposed methodology to enhance the exploration step of HHO. The primary objective is to increase user comfort while reducing energy and PAR costs. Here, all appliances are scheduled to run 24 h a day. Furthermore, we compared our proposed technique with nine state-of-the-art algorithms under the RTP and CPP schemes to estimate the performance of the proposed method. The main contributions of the proposed work are listed below:

  • We proposed a new method for improving the Harris hawks algorithm, referred to as arithmetic Harris hawks optimization (AHHO), using arithmetic and lightweight flight operators.

  • The Lévy flight distribution is a useful mathematical tool for producing a wide range of solutions in the design space and boosting the HHO exploration capabilities.

  • We considered 15 smart appliances that ran over the 24 h period and categorized them based on their energy consumption.

  • The proposed work is compared with other algorithms under the RTP and CPP schemes. The proposed work has shown excellent results when minimizing the electricity cost and PAR.

The rest of this paper is given as follows. Section 2 shows the related works. Section 3 gives a preamble about the optimization method used in this work. Section 4 presents the proposed system method. Mathematical-based problem formulation is given in section 5. Section 6 shows the experiments and results. Parameters settings and algorithms run-time are given in Sect. 7. Section 8 describes the conclusion of this work.

2 Related work

Optimizing residential DR is a typical example of a green computing problem [27]. The aim is to manage the required demand to match the available energy resources [28, 29]. The challenge is made more difficult by the varying loads, energy costs, RESs, and mobile storage energy consumption. Furthermore, the scheme is a non-convex mixed-integer nonlinear programming framework by definition. There have been several efforts to adopt various nature-inspired optimization methods and meta-heuristics in energy management and load scheduling.

For instance, Qiao et al. [30], who demonstrated how the suggested method may improve results in systems with 10-unit generators, used a self-adaptive multi-objective differential evolution (DE) algorithm on a novel dynamic economic emission dispatching approach that integrated both electric vehicles (EVs) and wind farms. Habibi et al. [31] used a multi-objective particle swarm optimization method to tackle the economic emission dispatch problem in multi-area power systems by maximizing the goal function of storage and additional cost. Jiang et al. [32] utilized a gravitational particle swarm optimization method to address economic emission dispatch for the wind-thermal power system while considering WE availability. A model predictive control technique is proposed [33] to manage the joint composition of the DR program and optimal power flow. The authors also considered the large penetration of RESs to minimize the economic costs and overall variations in load. According to the authors of [34], a load scheduling algorithm that takes into account cost-effectiveness and end-user preferences can be used to influence a user’s consumption habits and provide the best pattern for energy consumption. A Lagrange multiplier selection based on a neural network is proposed in [35] to overcome the slow convergence issue in DR techniques by reducing the iteration steps.

A new algorithm has been proposed for managing energy hubs connected to electricity, gas, and heating networks [36]. The algorithm is based on ant-lion optimizer and krill herd optimization algorithms. It aims to provide a robust optimal solution for energy management of energy hubs. In [37], a DE method is proposed to tackle a problem of the current stochastic optimal power flow in optimal active-reactive power dispatch. The goal of employing this technique is to use the information of inferior persons as a starting point for developing new good solutions. A rule-based EMS was optimized for a grid-off microgrid made up of wind generators, photovoltaic, battery energy storage, and diesel engines using a nature-inspired GOA in [38]. A rule-based algorithm is used to prioritize RES and coordinate power flow between microgrid components, minimizing energy costs and the probability of power supply shortages. The HHO algorithm determines microgrid components’ optimal capacities to achieve low cost and reliability targets while including true autonomous elements for an efficient microgrid design [39]. In [40], a cross-entropy strategy with several goals is proposed in order to enhance the dispatch performance while maintaining high RES penetration. With the addition of a crowding-distance method of calculation and a special external archive mechanism, the conventional cross-entropy approach is improved. An operator incorporating self-adaptive parameters is introduced to accelerate the population update process, while a crossover operator results in a larger range of solutions and more adaptability. The two-stage evolutionary process, coupled with various combinations of RESs, improves diversity and speed of convergence.

A modified shuffled frog leaping strategy is recommended in [41]. By using the movement inertia equation from particle swarm optimization, the local search procedure is changed. The GA’s crossover and mutation functions are also employed to alter the method of global search. Additionally, a formulation of the combined heat, emission, and the economic dispatch problem with the availability of solar and wind power is given. A price penalty function is used to combine the objective functions into a single objective function. A modified shuffle frog is then used to address the economic dispatch problem using PV and WE. The authors in [42] adopted the bat algorithm (BA) to solve the maximum power point tracker problem that deals with optimizing power versus voltage curves of partial shading PV systems containing several local peaks and one global peak (GP). The BA is improved by selecting the initial values of bats heuristically to reduce the convergence time and enhance the chance of capturing the global peak, performing BA re-initialization, and updating the memorized GP. In [43] proposed a modified DE algorithm for performing DR between the aggregator and the customer. The algorithm employs a secondary population archive containing unsuitable solutions rejected by the primary DE archive. Candidates are initialized, mutated, and recombined in the secondary archive to increase their fitness before returning to the primary archive for prospective selection. The algorithm is tested for a multi-objective optimization issue, including a smart house with a DR aggregator and RESs (battery bank and PV panels). The algorithm optimizes energy use by balancing load scheduling and renewable source contribution while optimizing user comfort and reducing the PAR.

A novel energy management strategy is suggested based on a recent optimization approach known as the salp swarm algorithm. It considers that the load demand is entirely supplied within the limits of each energy source [44]. The suggested strategy’s major goal is to reduce the system’s total hydrogen consumption. The energy supplied by the batteries and supercapacitors is optimized to minimize the energy acquired from the fuel cells. In [45], an algorithm for maximizing energy flows between energy storage systems (ESSs) and EVs was presented that has been adapted to include traditional generators (e.g., reciprocating engines) and loads with DR capabilities. In [46], a particle swarm optimization (PSO) method is adapted for optimum power-sharing across multiple RESs such as WE, PV, and combined heat and power plants. To assess the suggested technique, it is initially used to best schedule RESs in a microgrid with the goal of cost reduction while minimizing uncertainty. The scenario-based stochastic programming is then used to build it under load uncertainty and the random character of demand. The dragonfly algorithm was created by the authors of [47] to accomplish two key objectives: lower customer power bills and lower PAR while taking into account a specified waiting time limitation as a result of the appliance scheduling process. Researchers in [48] suggest a hybrid approach to modeling home EMSs for residential consumers that combines GWO with a GA, called a hybrid grey wolf GA. The goal is to lower energy consumption costs and PAR while ensuring high-quality energy performance. Based on essential and real-time peak pricing signals, an analysis of the scheme’s performance for homeowners using a number of domestic appliances and their preferred schedules was done.

A binary PSO with a quadratic transfer function [49], known as quadratic binary PSO, is used for scheduling shiftable appliances in smart homes. The suggested approach is used for optimum scheduling in a smart house with ten appliances and up to 264 decision factors for real-time pricing (RTP) and time-of-use tariffs, both with and without customer satisfaction. The findings show that optimum scheduling can lower power bills while having little impact on customer comfort. Ravindra et al. proposed the GWO algorithm to address the DSM minimization problem [50]. The authors applied GWO to address the optimization problem. They validated its efficacy in 3 distinct scenarios, including domestic, commercial, and industrial loads utilizing and not utilizing solar energy under a time-of-use pricing scheme. A hybrid GWO and crow search optimization technique has been presented for scheduling the multi-objective optimization problem [51]. Two objectives were considered: the electricity cost and the appliance’s waiting time related to user comfort. One study discussed an intelligent home having adjustable appliances, a hybrid heating system, an ESS, a solar panel, and an EV [52]. This study formulated and resolved a multi-objective optimization problem using the CPLEX software to minimize gas and energy expenses while improving thermal comfort. An optimal schedule in [53] is proposed for household appliance usage based on an enhanced multi-objective ant lion optimization (ALO) to reduce electricity costs and user comfort. The PAR limits the energy cost function. To calculate energy prices, the authors additionally used two different tariff signals. In addition to RTP, energy tariffs cover peak pricing. The results of the simulations demonstrate the superiority of the suggested method. The final results reveal that implementing the recommended method cuts power expenses by more than 20%. In [54], the optimum scheduling of household appliances in home EMSs is presented as a restricted, multi-objective optimization problem with integer decision variables, and a strong variation of particle swarm optimization is proposed to solve it.

In summary, various heuristic algorithms such as DE, PSO, GA, GOA, BA, cuckoo search, and many others have been used to optimize the design of EMSs. Specific of these methods, meanwhile, fail to account for some equipment’s high volatility. Furthermore, because these algorithms were usually caught in local minimum solutions, the convergence rate is frequently excessively slow in several circumstances. Therefore, new heuristic and nature-inspired algorithms should be explored to solve the abovementioned issues. This paper presents an improved Harris hawks optimization algorithm, named arithmetic Harris hawks optimization, for efficient residential DR load management with intuition to minimize the user’s bill and PAR with maximum user comfort while considering operational and power constraints. The proposed algorithm applies arithmetic and lightweight flight operators to Harris hawks optimization for household energy management. These operators are used in the proposed methodology to enhance the exploration step of Harris hawks.

3 Preliminaries

3.1 Levy operator

Random operations have a non-Gaussian distribution function known as Lévy flights distribution. This distribution can be calculated using this formula: \(L(s) \sim |s|^{-1-\beta }\), where \(\beta \) is a parameter value between 0 and 2. The Lévy flight is mathematically expressed as follows:

$$\begin{aligned} L(s, \gamma , \mu )= {\left\{ \begin{array}{ll}\sqrt{\frac{r}{2 \pi }} \exp \left( -\frac{\gamma }{2(s-\mu )}\right) \frac{1}{(s-\pi )^{\frac{3}{2}}}, & \,\,0 <\mu < \infty \\ 0 & \text{ otherwise. } \end{array}\right. } \end{aligned}$$
(1)

The Lévy flight distribution in the previous distribution is adjusted using the scale parameter gamma, where mu and s are local parameters and samples. The Fourier transform, in Eq. (2), defines the Lévy flight distribution.

$$\begin{aligned} F(k)=\exp \left( -\alpha |k|^{\beta }\right) , \beta \in [0,2]. \end{aligned}$$
(2)

The integral’s analytical formula can be found for a select few beta peculiar circumstances. Mantegna’s algorithm determines the step length (s) by Eq. (3).

$$\begin{aligned} s=\frac{u}{|v|^{\frac{1}{\beta }}}, \end{aligned}$$
(3)

where the Gaussian distribution of the u and v parameters can be calculated as follows.

$$\begin{aligned} u \sim N\left( 0, \sigma _{u}^{2}\right) , v \sim N\left( o, \sigma _{u}^{2}\right) . \end{aligned}$$
(4)

Following that, the step size is calculated using:

$$\begin{aligned} \text{ stepsize } = \text{ scale } \times s. \end{aligned}$$
(5)

A search area’s step size is determined by the parameter Stepsize, while the dimension of a problem is determined by the factor s. Lévy flight is mostly used outside the design area for the development of new solutions. In order to update the HHO method to find new locations, as is seen in the subsequent sections, the Stepsize value is introduced into the equations. The HHO exploration capabilities can be improved by using the Lévy flight distribution, a practical mathematical technique for generating a variety of solutions in the design space.

3.2 Arithmetic operators

Abualigah et al. created a brand-new optimizer known as the arithmetic optimization algorithm (AOA) in [55]. AOA works based on using several operators such as division (Div), Multiplication (Mult), Addition (Add), and Subtraction (Sub) [56, 57]. The arithmetic operators’ pseudo-code is detailed in algorithm 1.

figure a
$$\begin{aligned} {\begin{matrix} x_{t + 1}^i = \left\{ \begin{array} {*{20}{c}} x_{Rabbit}/(MOP+\epsilon )*((ub-lb)*\mu +lb) \\ +rand(1,dim)*lv(dim) \;\; {if\;{\tau } \ge 0.5\;} \end{array} \right\} ; \\ {x_{Rabbit}}*MOP*((ub-lb)*\mu +lb)+\\ rand(1,dim)*lv(dim) \;\; {if\;{\tau } \le 0.5\;}. \end{matrix}} \end{aligned}$$
(6)

3.3 Harris Hawks optimization

The cooperative behavior of Harris Hawks inspired Harris hawks optimization (HHO) during hunting and escaping prey in designing the HHO algorithm [58]. Depending on the environment and the pattern of prey escape, it displays various chasing styles. It is a highly intelligent strategy where several Harris hawks attack a discovered escape rabbit at once using various tactics, demonstrating various hunting techniques. Harris hawks are candidate solutions, and the most preferable candidate solution in each step is the intended prey. Exploration, transition from exploration to exploitation, and exploitation are the three stages that make up the HHO algorithm. The flow chart of the HHO algorithm can be seen in Fig. 1.

Fig. 1
figure 1

Flowchart of the HHO algorithm

The hunting model is mathematically written as follows:

$$\begin{aligned} { \begin{array}{l} x_{t + 1}^i = \left\{ {\begin{array}{*{20}{ll}} {{x_{rand}} - {\tau _1}\left| {{x_{rand}} - 2{\tau _2}x_t^i} \right| } &\,\, {if\;{\tau _5} \ge 0.5\;} \\ {\left( {{x_{Rabbit}} - \overline{{x_t}} } \right) - {\tau _3}\left| {l{b^j} + {\tau _4}\left( {u{b^j} - l{b^j}} \right) } \right| } & \,\,{else\;} \end{array}} \right. \\ t \in \left[ {1 \cdots T} \right] ,i \in \left[ {1 \cdots N} \right] . \\ \end{array}} \end{aligned}$$
(7)

In Eq. (7), the \(i\)th hawk’s current location is represented by \(x_t^i\), and its new position is calculated at iteration \(t+1\) by \(x_{t + 1}^i\), while \(x_{Rand}\) and \(x_{Rabbit}\) denote the hawk location that was chosen at random and the optimal solution, respectively. As you can see, \(lb^j\) is the lower bounds and \(ub^j\) shows the upper bounds of \(j\)th dimension, while \(\tau _1\) to \(\tau _5\) represent random numbers that fall within the range [0, 1]. A typical hawk position \( \overline{{x_t}}\) is defined as:

$$\begin{aligned} \overline{x_t}=\frac{1}{N}\sum _{i=1}^{N}x_{t}(i). \end{aligned}$$
(8)

Hawks have a chance to hunt randomly when they are dispersed over the intended space, according to the Eq. (8). The second scenario, on the other hand, demonstrates what happens when Hawks go for the hunting alongside family members near to the prey. During the transition from exploration to exploitation, the prey tries to flee from the catch, and the amount of escaping energy \(E_n\) that the prey had gradually dropped. Equation (9) gives a mathematical definition of energy.

$$\begin{aligned} E_n=2* E_{no}*\left(1-\frac{t}{T}\right), \end{aligned}$$
(9)

wherein T is the maximum amount of iterations and the starting energy (\((E_{no}\)) is given by \(E_{no}= 2*rand -1\), which is adjusted at random inside \((-1,1)\). HHO continues to be exploratory until \(|E_n|\ge 1\). Hawks keep investigating the world while switching to an exploitative mode when \(|E_n|<1\). R is the target’s likelihood of escape. During the exploitation phase, it is important to stay out of local optima.

The initial energy (\((E_{no})\)) has been defined as \(E_{no} = 2*rand -1\), where \((-1,1)\) is the random change interval and T is the maximum iteration. HHO operates in exploratory mode until \(|E_n|\ge 1\). The Hawks explore global regions continuously until \(|E_n|<1\) switches to an exploitative mode. R represents the chance of escaping from an attack. Extraction aims at avoiding optimum local situations.

3.3.1 The first task-surrounding soft

When \(R\ge \frac{1}{2}\) is bigger than \(\frac{1}{2}\) (i.e., \(|E_n| \ge \frac{1}{2}\)), the following mathematical expression for the surrounding soft can be created:

$$\begin{aligned} \begin{array}{l} x_{t + 1}^i = \Delta x_t^i - E_n\left| {J{x_{Rabbit}} - x_t^i} \right| \\ \Delta x_t^i = {x_{Rabbit}} - x_t^i,\;J = 2\left( {1 - {\tau _6}} \right) \\ \end{array}, \end{aligned}$$
(10)

\(\Delta x_t^i\) is the distance between the position of the \(i^{th}\) hawk and the best agent (such as a rabbit). The random strength of the jump of the prey is indicated by J, while \(\tau _6\) represents the random number within the range [0, 1].

3.3.2 The second task-surrounding hard

When the level of energy is less than \(\frac{1}{2}\) \((|E_n|< \frac{1}{2})\) & \(R\ge \frac{1}{2}\), the rabbit becomes exhausted and the possibility of escaping low (or escaping becomes hard) because the level of energy is decreased. This behavior can be modeled as follows.

$$\begin{aligned} x_{t + 1}^i = {x_{Rabbit}} - E_n\left| {\Delta x_t^i} \right| . \end{aligned}$$
(11)

3.3.3 The third task-surrounding soft beside advanced rapid dives

When the level of energy is higher, this task is applicable. When this task is completed, the rabbit can still run if the energy level is greater than \(\frac{1}{2}\) \((|E_n|> \frac{1}{2})\) & \(R < \frac{1}{2}\). The hawk attempts progressive dives and wanting to get into a better position to catch its prey. To model this behavior, the L/’evy flight function is integrated [59].

To update the position of the hawk for \(i^{th}\), perform the following:

$$\begin{aligned} \begin{array}{l} {x_{t+1}^{i} =\left\{ \begin{array}{cc} {y} &{} {if\; fit\left( y\right)< fit\left( x_{t}^{i} \right) } \\ {z} &{} {if fit\left( z\right) < fit\left( x_{t}^{i} \right) , } \end{array}\right. }\\ {y=x_{rabbit} -E_{n} \left| Jx_{rabbit} -x_{t}^{i} \right| ,} \\ { z=y+r_{v} \times Lv\left( D\right) }, \end{array} \end{aligned}$$
(12)

where,

$$\begin{aligned} {{Lv\left( D\right) =0.01\times \frac{rand\left( 1,D\right) \times \sigma }{\left| rand\left( 1,D\right) \right| ^{\frac{1}{\beta } } } }}, \end{aligned}$$
(13)
$$\begin{aligned} {\sigma =\left( \frac{\Gamma \left( 1+\beta \right) \times \sin \left( \frac{\pi \beta }{2} \right) }{\Gamma \left( \frac{1+\beta }{2} \right) \times \beta \times 2^{\left( \frac{\beta -1}{2} \right) } } \right) ^{{}^{\frac{1}{\beta } } } }, \end{aligned}$$
(14)

where D denotes the dimensional space, \( r_{v}\) includes D components obtained at random within (0,1), Lv denotes the Lévy flight function, \(\beta \) is a constant term having a default value of \(\beta =1.5\) and fit denotes the fitness function calculated by Eq. (14).

3.3.4 The fourth task-surrounding hard beside advanced rapid dives

This task supposed that \(R < \frac{1}{2}\) and the energy level is less than \(\frac{1}{2}\) \((|E_n|<\frac{1}{2})\), the prey has a lower level of energy to evade and Hawks are close to realizing successive dives for catching. This process can be described as follows:

$$\begin{aligned} \begin{array}{l} x_{t + 1}^i = \left\{ {\begin{array}{*{20}{ll}} y &{} {if\;fit\left( y \right)< fit\left( {x_t^i} \right) \;} \\ z &{} {if\;fit\left( z \right) < fit\left( {x_t^i} \right) \;} \\ \end{array}} \right. ; \\ \;\;y = {x_{Rabbit}} - E_n\left| {J{x_{Rabbit}} - \overline{x} } \right| ; \\ \;\;z = y + r_{v} \times Lv\left( D \right) \\ \end{array} \end{aligned}$$
(15)

3.4 Arithmetic Harris Hawks optimizer (AHHO)

The AOA is a novel optimization algorithm based on arithmetic operators. It uses division and multiplication in the exploration phase, and subtraction and addition in the exploitation phase due to their low dispersion [55]. AOA’s worldwide search capabilities and rapid convergence speed are enhanced by the properties of these activities. However, the designated search space is not thoroughly searched during the exploitation phase. The role of fundamental strategies in late iterations frequently leads to premature convergence. Thus, while the AOA algorithm can rapidly converge and explore, it is challenging to escape local optima during exploitation.

Additionally, the inclusion of the levy operator enhances the search space significantly. The experimental results for the HHO method indicate flaws in the exploration phase due to insufficient population diversification and slow convergence speed. Four distinct hunting tactics apply various position-updating methods throughout the exploitation phase. These strategies are determined by the energy and escape likelihood of the prey. Additionally, the transition process from exploration to exploitation enables animal features to be adapted. The energy of the prey decreases as the amount of iterations rises, suggesting that the algorithm has reached the exploitation stage.

Fig. 2
figure 2

The flowchart of AHHO

For enhancing the exploration step of HHO, two arithmetic operators are used in the proposed method. In particular, division and multiplication operators are employed according to the value of probability \((\tau )\), which are boosted by the levy function in Eq. (6). The proposed method AHHO is described in Figs. 2 and 3.

Fig. 3
figure 3

Different steps of AHHO

4 System model

A metering infrastructure, self-healing, and two-way communication are IoT technologies that are vital for monitoring and controlling smart grid parameters for an intelligent and adaptable EMS. A graphical representation of the proposed system model is shown in Fig. 4 in which an intelligent home integrates a smart energy meter, EMS, intelligent appliances, and home area network technology. Smart meters serve as electronic devices that record electric energy consumption information near real-time. It plays an intermediate relationship between the utility grid and the consumer. A wide area network directly connects it to the utility grid. First, the utility sends a pricing signal using a wide area network to the smart meter, and then the smart meter passes this pricing signal to home EMS through the home area network. The EMS helps improve energy balance and understand energy demand and consumption in real-time by optimizing energy management techniques and methods. Therefore, EMSs can reduce energy consumption effectively. This study looked at fifteen smart appliances and classified them according to their energy consumption. We used RTP and CPP to calculate the electricity price in this study. This project aims to minimize the cost of energy and PAR while improving the user’s comfort. Here, all appliances are scheduled to run 24 h a day.

Sometimes, the LOT of an appliance is less than 60 min. We, therefore, divide a day into 120 equal time blocks of 12 min each. Two decisions are taken into account: (1) within 1 h and (2) every 12 min.

Fig. 4
figure 4

A smart home based system model describing energy management strategy

Table 1 Appliances specifications [60]

5 Problem formulation

This work categorizes appliances into three different types based on their time of use and energy consumption pattern. The list of appliance types is given below:

  • Interruptible appliances

  • Non-interruptible appliances

  • Must-run appliances

5.1 Interruptible appliances

Interruptible appliances can be shifted at any time slot, and their operation can also be interrupted. Interruptible appliances and their energy consumption pattern are denoted as “IA” and “\(E_{IA}\)” respectively. Energy consumption of each appliance “\(ia \in IA\)” having power rating “\(P_{ia}\)” is formulated as given below:

$$\begin{aligned} E_{ia} = \sum _{ia \in IA} \left( \sum _{t=1}^{24} P_{ia}^t \times S_{ia}(t)\right), \end{aligned}$$
(16)

\(S_{ia}(t)\) is the appliance status at time slot t. It is written as 1 if the appliance is in the ON state and 0 in the OFF state.

5.2 Non-interruptible appliances

It is easy shift these appliances at any time, but their operation will never be interrupted. Non-interruptible appliances and their energy consumption pattern are denoted as “SA” and “\(E_{SA}\)” respectively. Energy consumption of each appliance “\(sa \in SA\)” having power rating “\(P_{sa}\)” is formulated as given below:

$$\begin{aligned} E_{sa} = \sum _{sa \in SA} \left( \sum _{t=1}^{24} P_{sa}^t \times S_{sa}(t) \right), \end{aligned}$$
(17)

\(S_{sa}(t)\) is the appliance status at time slot t. It is written as 1 if the appliance is in the ON state and 0 in the OFF state.

5.3 Must-run/Base load appliances

Must-run appliances are those that remain working all time. Must-run appliances and their energy consumption pattern are denoted as “MA” and “\(E_{MA}\)” respectively. Energy consumption of each appliance “\(ma \in MA\)” having power rating “\(P_{ma}\)” is formulated as given below:

$$\begin{aligned} E_{ma} = \sum _{ma \in MA} \left( \sum _{t=1}^{24} P_{ma}^t \times S_{ma}(t)\right ) \end{aligned},$$
(18)

\(S_{ma}(t)\) is the appliance status at time slot t. It is written as 1 if the appliance is in the ON state and 0 in the OFF state.

5.4 Objective function

This work aims to minimize the total cost of the user’s energy consumption while maximizing user comfort by reducing the waiting time.

The mathematical model of our objective function is given below:

$$\begin{aligned} min \sum _{t=1}^{T} \Bigg ( \sum _{a=1}^{Ap} P_{ap} \times S_{t} \times E_{a,t}^{cost} \Bigg ) \end{aligned}.$$
(19)

Subject to:

$$\begin{aligned} X(t) = E_{ia}(t) + E_{sa}(t) + E_{ma}(t) \end{aligned}.$$
(20)
$$\begin{aligned} X(t) \le \wp _{th} \end{aligned}.$$
(21)
$$\begin{aligned} X_{Tot}^{Schedule} = X_{Tot}^{unschedule} \end{aligned}.$$
(22)
$$\begin{aligned} C_{Tot}^{Schedule} \le C_{Tot}^{unschedule} \end{aligned}.$$
(23)
$$\begin{aligned} S(t) \in \big [ 0,1 \big ] \end{aligned}.$$
(24)

A summary of all constraints for the proposed optimization problem is found in Eq. (20) to (24). A calculation of the total energy consumption of all appliances can be found in Eq. (20). Equation (21) demonstrates that the total energy consumption of all appliances in a given time slot must be less than or equal to the preset threshold value. All appliances’ total energy consumed must be matched before and after the scheduling, which is represented in Eq. (22). According to Eq. (23), appliances’ scheduling costs must be lower than unscheduled costs. Based on Eq. (24), Boolean variables 0 and 1 are used to indicate whether an appliance is OFF or ON.

The following equation can compute total energy consumption:

$$\begin{aligned} Energy_{con}= \sum _{t=1}^{T} \Bigg ( \sum _{a=1}^{Ap} P_{ap} \times S_{t} \Bigg ) \end{aligned}.$$
(25)

A stable power grid is crucial to ensuring service continuity and maintaining high customer satisfaction. Whenever a PAR value decreases, load balancing is recommended and electricity prices are lower.

According to Eq. (26), it can be calculated mathematically.

$$\begin{aligned} PAR = \frac{max(X_{Tot}^{Schedule})}{avg(X_{Tot}^{Schedule})} \end{aligned}.$$
(26)
Table 2 Cost comparison with the unscheduled scheme

6 Results and discussion

This section aims to develop a simulation to compare the proposed algorithm with various other algorithms concerning reducing energy bills, minimizing PAR, and increasing the user’s comfort in terms of low appliance waiting time. This work considers fifteen smart appliances in a single smart home (D = 15) and runs at 1-h operational time intervals. Table 1 illustrates the appliance categories, their names, power ratings, and the operating slots. Furthermore, nine other algorithms, including HHO, AOA, GA, GWO, ACO, PSO, ALO, MFO, and GOA, are implemented under both pricing schemes, such as RTP and CPP schemes, to estimate the performance of the proposed technique. The proposed scheme is simulated with MATLAB R2021a on a machine with an Intel Core i5-4300 CPU and a 2.50 GHz processor with four gigabytes of RAM. The following sections illustrate the results and provide a suitable explanation.

Fig. 5
figure 5

Pricing schemes and energy consumption profiles

Fig. 6
figure 6

Results of RTP scheme

Fig. 7
figure 7

Results of CPP scheme

6.1 Energy consumption pattern of RTP and CPP

The RTP and CPP scheme is shown in Fig. 5a, b. As depicted in Fig. 5c, d, in RTP and CPP, the high energy price hours are from 6 pm to 1 am and from 9 pm to 4 am, respectively. Any load that consumes energy in those time slots accounts for the high electricity charges. According to the RTP and CPP schemes, Fig. 5c, d show data on load consumption patterns for scheduled and unscheduled cases. It is depicted that load consumes more energy in an unscheduled case because users did not participate in the DSM program and shifted most of the load from 7 pm to 12 pm in both RTP and CPP schemes. Load consumes more energy in those slots, as shown in Fig. 5c, d, consequently costing them high electricity charges. While in the scheduled cases under both RTP and CPP, algorithms shift most of the loads other than peak energy price hours, which consume less energy and avoid peak creation. In RTP and CPP, the time from 6 pm to 1 am and 9 pm to 4 am are the high energy price hours, respectively. The next subsections will further discuss each parameter associated with Fig. 5c, d, such as electricity cost, PAR comparison, and waiting time.

6.2 Cost comparison between RTP and CPP

Figure 5c, d show that energy consumption patterns are almost identical during the whole day in scheduled cases because algorithms shift most of the electricity load in low-price hours. This is a reason for showing similar behaviour. However, in unscheduled instances where the user did not participate in the DSM program, energy consumption behaviour spikes during the night hours from 12 am to 1 am and 7 pm to 12 am under both RTP and CPP schemes. Correspondingly, these time slots consider as high energy price times as shown in Fig. 5a, b. Hence, the electricity usage will cost the end-user higher electricity charges and the PAR, as shown in Fig. 6b, c. Our proposed algorithm (AHHO) performed well compared with other algorithms as it reduces the electricity cost by 1100 cents and 3500 cents, 55.17% and 50% PAR reduction, and 2.2 and 1.3 appliance waiting time in both RTP and CPP, respectively. Other algorithms do not perform well in all parameters. For instance, HHO significantly reduces the PAR value but at the cost of higher waiting time and electricity costs. Similarly, AOA increases waiting time and electricity costs while reducing the PAR value. The proposed AHHO algorithm significantly reduces energy consumption by avoiding peak load creation and maintaining load at an acceptable level, as shown in Figs. 6a, 7a. All other algorithms exhibit modest peak hours during different time slots, leading to higher electricity costs, PAR values, and longer appliance waiting times than AHHO. As per Fig. 5c, unscheduled and scheduled loads utilize over 13 KWh and 5 KWh of energy at their peak, respectively. This 8 KWh difference reduces the electricity charge and PAR. Figure 5b illustrates that the off-peak hours are from 3 am to 12 am and from 12 am to 7 pm, where AHHO moves a significant portion of the electrical load during these time intervals. This load shifting results in a greater energy consumption curve during these periods, which is depicted in black line in Fig. 5c. AHHO, on the other hand, shifts less load between 8 pm and 3 am due to on-peak hours and has a lower energy consumption curve, resulting in a considerable reduction in overall cost.

The on-peak time frames are 10 am to 4 am, and everything else is off-peak as shown in Fig. 5b. The electricity consumption pattern of scheduled and unscheduled cases based on the CPP is illustrated in Fig. 5d. Each algorithm’s energy consumption profile varies concerning its load profile; therefore, electricity cost varies accordingly. The electricity consumption patterns of all scheduled cases are quite similar and are demonstrated in Fig.  5d. Nonetheless, some algorithms eventually consume a lot of energy, while others consume a lot less. The unscheduled case experienced a slight peak of energy consumption between 12 am to 1 am and 8 pm to 9 pm. As a result, this peak leads high electricity costs. As per Fig. 5d, it is also evident that most of the processing takes place in the early morning from 4 am to 12 am. Load consumes a high amount of energy because users shift most of the loads in those time slots and according to the CPP scheme, these are off-peak hours. Similar to RTP, the proposed AHHO algorithm remains the most energy-efficient design under the CPP scheme by ignoring peak formation and maintaining a balanced load profile. Other algorithms, such as HHO, AOA, GA, GWO, ACO, PSO, ALO, MFO, and GOA, shift most of the load in relatively high peak hours from 9 pm to 4 am. As shown in Fig. 5b, the electricity charge are higher during these time slots, and consequently, these algorithms estimate both higher energy costs and PAR than AHHO. The cost comparison between all algorithms under RTP and CPP schemes is shown in Table 2. The proposed technique (AHHO) surpasses other algorithms by achieving maximum cost savings of 42.10% and 30% under RTP and CPP schemes, respectively. ACO and ALO are the second best after AHHO, achieving 31.57% cost savings under the RTP program. MFO is the second best in CPP, with a percentage of cost savings of 30%, followed by GWO, with a portion of cost savings of 28%. At the same time, AOA performed poorly, with cost savings of only 10.52% and 21% in RTP and CPP, respectively.

6.3 PAR comparison between RTP and CPP

Table 3 shows the comparison of PAR reduction in both RTP and CPP schemes. The tested algorithms have demonstrated good performance in terms of reducing PAR. Among all, AHHO ranks first by achieving maximum PAR reduction of 55.17% and 50% in both RTP and CPP schemes, respectively. Other algorithms, such as HHO and GOA, also perform better under both pricing schemes, the first one attains 48.96% and 34.61% PAR reduction, and the latter reduces the PAR by 44.82% and 30.76% in RTP and CPP, respectively. On the other side, some algorithms show good outcomes in one scheme and perform worse in another. For instance, in RTP, AOA minimizes the PAR reduction by 46.55% and performs well, and at the same time, it shows worse performance in CPP by achieving only 15.38% PAR reduction. In a nutshell, AHHO has outperformed all other algorithms by achieving a maximum percentage reduction in PAR value.

In both, a slight difference of 5% is observed; the AHHO can avoid the peak formation and managing the load under a reasonable level. When calculating house prices, simulation results demonstrate that the AHHO algorithm saved more money on electricity than other algorithms.

Table 3 PAR comparison with the unscheduled scheme

6.4 Waiting time

The amount of comfort experienced by an end-user depends on how long it takes the appliance to run. The appliance waiting time should be as short as possible to make the end-user as pleasant as possible. It is feasible to compromise between overall electricity costs and appliance wait times. Consumers must pay more in electricity prices to meet their demands for more comfort and the ability to run appliances without delay. A user’s waiting time is zero in an unscheduled case since the appliance is run on demand. As shown in Figs. 6d and 7d, both pricing schemes compare waiting times between the proposed and the other algorithms. As per this parameter, the proposed AHHO algorithm also showed better results by taking less time to run the appliances.

AHHO outperforms other algorithms by reducing waiting times significantly, thus maximizing user satisfaction. Additionally, the difference between before and after scheduling is virtually equivalent to the daily total scheduled load.

7 Parameters settings and algorithm run time

This section discusses the algorithm-specific parameter setting. As recommended in their original publications, the settings are set to their default values. The population size is set to 50, and the total number of iterations is 100 for all algorithms. Other parameters such as appliances power rating, length of operation time, pricing signals, number of appliances are given in Table 1 and Fig. 5a, b.

The results are averaged over 30 separate runs. Run times for all these algorithms are provided in Table 4 for Matlab 2021A on Core i5-4300 CPU, 2.50 GHz processor, and 4 GB of RAM. Table 4 provides the run times of all optimization algorithms applied in this research.

Table 4 Run-time of algorithms

8 Conclusion

This paper presented an improved HHO with arithmetic and a levy flight operator for residential energy management while taking operational and power constraints into account. We assess the proposed algorithms under RTP and CPP based on two pricing schemes. A 60-min operating time interval is also taken into account when estimating end-user demand and social behavior. Based on the cost of electricity, PAR, and waiting time, this paper compares the performance of various meta-heuristic optimization algorithms, including HHO, AOA, GA, GWO, ACO, PSO, ALO, MFO, GOA, and the proposed AHHO algorithm. The simulation outcomes indicate that the proposed AHHO outperformed other comparable methods. The proposed algorithm (AHHO) significantly reduces energy consumption by ignoring peak load formation and keeping it under acceptable range in both RTP and CPP schemes. All other algorithms produce smaller peak hours during various time slots, resulting in higher electricity costs and PAR than AHHO.

According to the results, the proposed technique achieves greater cost savings of 42.10% and 30% in both the RTP and CPP schemes. With maximum PAR reductions of 55.17% and 50% in both the RTP and CPP schemes, the proposed technique also ranks top among all. There is a trade-off between appliances waiting time and electricity cost. In an unscheduled case, appliances waiting time is zero as appliances turn on at any time; however, it incurs higher electricity charges. In scheduled case, the proposed AHHO algorithm exhibited better performance as compared to other algorithms by taking less time to run the appliances.