{'fraction_non_alphanumeric': 0.0351162691105306, 'fraction_numerical': 0.010235107704166845, 'mean_word_length': 4.846770155232849, 'pattern_counts': {'":': 0, '<': 0, '<?xml version=': 0, '>': 0, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 1, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
A Heuristics-based Home Energy Management System for Demand Response

The so-called Internet of Things (IoT) and advanced communication technologies have already demonstrated a great potential to manage residential energy resources via demand-side management. This work presents a home energy management system in that focused on the energy reallocation problem where consumers shall shift their energy consumption patterns away from peak periods and/or high electricity prices. Our solution differentiates residential loads into two categories: (i) fixed power appliances and (ii) flexible ones. Therefrom, we formulate our problem as a constraint optimization problem, which is non-linear and cannot be mathematically solved in closed-form. We then employ and compare two well-known heuristics, the genetic algorithm (GA) and the harmony search algorithm (HSA), to minimize electricity expense and peak to average ratio. These two approaches are compared to the case where no reallocation happens. Our numerical results show that both methods; GAand HSA can effectively reduce the electricity cost by 0.9%, 3.98%, and PAR by 15%, 5.8%, respectively


I. INTRODUCTION
Smart grid technologies, smart meters and demand response have enabled consumers to know their demand profile in more details, while helping the system operator to improve the efficiency and reliability of the power system [1]. In particular, demand-side management (DSM) has great impact on grid operation by, for example, facilitating the incorporation of renewable resources, and by allowing the consumers to actively participate in electricity dispatch. As part of this broader concept, demand-response (DR) is defined as [2]: "Changes in electric usage by end-use customers from their normal consumption patterns in response to changes in the price of electricity over time, or to incentive payments designed to induce lower electricity use at times of high wholesale market prices or when system reliability is jeopardized".
In this context, DR can categorized into two aspects, viz. incentive and price-based programs [3]. Incentive based programs involve customers' participation to reallocate their energy consumption in off peak hours in response to which a reward (bill credit payment) is given to them for their participation in the program. Incentive programs are direct load control (DLC), curtailable load, demand bidding & buy back, emergency & demand. On the other hand, price-based programs involve various pricing signals at different times to reduce energy consumption by providing monetary benefits to the consumers. It includes time of use, real time pricing, inclined block rate, critical peak pricing and day ahead pricing [4]. In a recent research, price-based DR has been studied widely in residential sector, particularly, in home energy management system (HEMS). For instance [4]- [8], various HEMS models in the context of DR have investigated to achieve optimal energy consumption of household appliances using optimization model, aiming to reduce electricity cost, balance energy demand, and improve energy efficiency.
In general, HEMS plays a significant role in energy management of residential sector and allows exchange of energy consumption information with the utility to improve energy profile as well as the reliability of power grid. The work in [4] comprehensively described HEMS architecture, DR programs, smart grid technologies, communication protocols, and various decision making algorithms like artificial intelligence (AI) and heuristic scheduling algorithms. These algorithms are considered as an essential part towards the energy optimization and load shifting operations in HEMS. Fan-Lin and Xiao-Jun in [5], designed a residential energy usage framework using genetic algorithm (GA) which attempts to maximize re-trailer's profit. The home appliances are classified in two groups (shift able and curtail able) and hourly energy usage is predicted in accordance with the electricity price and temperature signal. In another work [6], a multi-objective problem is applied to control energy consumption of household micro-grid and hybrid differential evolution is used to solve the scheduling problem. In a similar context with a recent work [7] authors have been explored the HEMS based on hybrid optimization technique to manage energy consumption of smart appliances in 24 hours time slots depending upon pricing tariffs and coordination among appliances. In [8], authors extended their previous work and incorporated various time slots, peak to average ratio (PAR), and multiple homes scenarios with much improved hybrid technique bacterial flower pollination algorithm (BFPA).
Kai Ma et al. further developed an optimization problem in [9] and investigated the trade-off between electricity cost and discomfort cost. In [10], a generalize HEMS discussed based on GA to schedule energy consumption and minimize operational cost of electricity considering user satisfaction constraints. Similarly, reference [11] adopted GA based on DSM (GA-DSM) strategy to distribute the power in industrial area effectively. In an other contribution [12], authors interested to analyze scheduling mechanism in domestic sector using binary particle swarm optimization (BPSO) to optimize energy consumption of household in pre define time intervals. Different from GA and BPSO, authors in [13] have been proposed an improved algorithm binary backtracking search algorithm (BBSA) to balance energy usage and effectively control cost. The simulation results of BBSA and BPSO are compared which shows effectiveness of BBSA. In the same fashion authors in [14], [15] introduced practical pricing and green energy scheduling plan with an aim of minimizing overall electricity cost while applying different approaches such as, non linear programming and game theory algorithm, respectively. In the same sense, but with different approach, we develop here an efficient DR strategy to lessen the cost and the peak-to-average ratio of energy usage, which is expect to contribute towards the green house emissions and fuel wastage.
Our goal here is to explore the energy consumption behaviour for residential consumer in order to shift some specific loads trying to shape the load curve, accordingly. This paper proposes an optimization model for scheduling energy consumption of various kind of appliances, which are classified into two groups based on their features and parameters, namely fixed power and flexible power appliances. We compare the performance of three different approaches: optimization via GA, optimization via harmony search algorithm (HSA), and no optimization (i.e., no load shift is performed). Our results compare the cost and the peak-to-average ratio in the three scenarios, showing that designed algorithms have the best performance. Our contributions are summarized as: ‚ We develop DR strategy to address the peak load shaving problem and flexibly control the household appliances specifically, at times when prices of electricity are high.
‚ To address the problem, we develop system model considering the household appliances and classifying them into two types; fixed power and flexible power appliances. The energy consumption of the appliances are managed and controlled considering the time of use pricing model.
‚ In order to solve the problem, we establish optimization model along with two well known heuristics; GA and HSA.
‚ We analyze three different scenario: Without HEMS, With HEMS-GA, and With HEMS-HSA. For example, with HSA-HEMS the cost and PAR are reduced to 3.98% and 5.8 %, respectively.
‚ We demonstrate the proposed solution is scalable for various scenarios by testing the designed algorithm with multiple users case i.e., 10 users and 50 users considering different time resolutions (60 minutes and 30 minutes). The rest of the paper is organizes as follows. Section II states the system model used here, including the problem formulation, its input parameters and the optimization methods used. Section III presents the numerical results and the performance evaluation of the three different scenarios. Section IV conclude this paper and propose some potential future work.

II. SYSTEM MODELING
In this work, we investigate the energy reallocation problem of peak hours based on DR strategy. We consider home energy management environment where each home is equipped with HEMS with the function of optimizing energy consumption of household appliances based on different input parameters as electricity price and type of load. The two way of communication between HEMS and utility enabled the consumers to alter the energy usage based on electricity price signal. The electricity price depends on the demand of energy, higher the demand the higher will be the electricity cost and vice versa. The demand information of energy is transmitted by smart meters to utility via IoT network. The peak energy demand (of home appliances) can be controlled appropriately by addressing the PAR. So that, we assorted home appliances into two types based on their features and priorities, namely, fixed and flexible loads [16], [17].
In order to support the communication infrastructure, advance metering infrastructure (AMI) is an essential element in smart grid. AMI combines multi-way communication, data management system and particularly, smart metering system. This enables smart meters (SM) to measure and collect the information of energy consumption in an accurate and precise way. Moreover, this information is also exchanged between HEMS and utility industry simultaneously in a real time scenario. The communication between HEMS and utility industry also enables the user to take part in DR strategies and manage the energy demand effectively. On the other side, users in home can monitor the information such as available energy, energy consumption, price of energy in the next hour, etc., using various interfaces e.g., smart phones, computers etc., and adjust energy consumption based on a DR strategy.

A. Appliances classification
Appliances are classified here into two types, namely fixed power and flexible power appliances, as discussed next.
1) Fixed power appliances: pA f ixed S q fixed power appliances are ceiling fan, lamp, or TV, these have fixed power consumption profile and operational time and due to continuous power supply HEMS will not schedule fixed power appliances i.e., A f ixed S,h " E f ixed 2) Flexible power appliances: pA F S q Flexible power appliances can be controlled and their energy consumption profile are scheduled by HEMS. Their operation is attributed as incentive-based pA F S,I ) and price-based (A F S,P ). The energy usage of (A F S,I ) is curtailed considering DR strategy. Various pricing signals can be adopted to reallocate the load demand from peak to off-peak hours to achieve cost reduction. The price based flexible appliances are of two types (i) noninterruptible and (ii) interruptible. The operation time interval of non-interruptible appliance must not be halted during their operating time by HEMS such as, washing machine and iron. Interruptible appliances can be interrupted in any time period like, during the peak demand or high cost of electricity generation e.g., air condition and water heater. The energy usage of interruptible appliances are presented below: The power rating (PR) and operational time interval (OTI) are shown in the Table I B. Electricity pricing model Pricing tariff refers to various pricing scheme for designated time frame. DR based pricing tariff plays important role to allow active participation of consumer in residential sector. Among various pricing tariffs discussed in the literature [3], [4], [17], we opted time of use pricing model in our simulation results. It is briefly discussed below: Time of use: Time of use (TOU) pricing scheme reflects price of electricity in different time of interval including, off peak, mid peak, and peak hours. TOU tariff imparts the average electricity cost of power generation during different time periods and allows the consumers to manage their energy usage voluntarily instead of being forced by utility. In the same way, consumers have the flexibility either to use the electricity in peak time interval (which yields higher cost) or off peak (lower cost due to less stress on generation resources). Typically, TOU is spreading widely and used in many countries for residential sector consumers. For instance, TOU tariff is implemented in USA, Canada, and Ireland, and customers pay their bill according to fixed prices in different time periods i.e., during off , mid, and peak hours [3], [18], [19]. We have used TOU taken from [20]. An example of TOU is given in Fig. 1.
The total cost of electricity can be expressed using ToU pricing γ, and states of the household appliances π as: Eptqˆπptqˆγptq. (1)

C. Cost function and energy demand
Let A S represents set of appliances and P f ixed ptq, P F ptq denote the energy consumption of fixed and flexible power appliance in time ptq. The total energy consumption pP T ptqq in each time period t ǫ T S ={1,2,....T }, then considering this definition total energy usage during t ǫT can be calculated as Eptq " ř AS A " 1 pP T ptqq. The overall cost is expressed mathematically as: In above equation, the first term on the right side computes the cost of electricity in each time slot t; the second term computes amount of energy used in t-th hour of the day; π is the decision variable that represents ON and OFF states of the appliances. As we are interested in reducing electricity cost, nevertheless the reallocation of energy into off peak hours is also an imperative step to improve the functionality of the grid. Therefore, PAR is computed as: where G peak and G avg indicate the maximum and average aggregated load in any time slot (t).

D. Objective function
In general, the focus of this work is to jointly minimize the cost of energy and PAR. To accomplish the objective, HEMS is considered to schedule the energy usage of A S using optimization problem.
The E T represents the total energy usage cost; PAR is the fraction of maximum aggregated energy consumed and mean value of the total energy. The constraints related to objective are as follow: The equations (4) to (8) represents the constraints of the designed model. The constraint (4) illustrates the total cost of the energy "With-HEMS" must be less or equal to "Without HEMS". Constraint (5) shows appliances states, "1" indicates ON and "0" OFF state. The constraint (6) means the OTI of each appliance should be completed before and after scheduling. The constraint (7) reflects that PAR should be remained less or equal to case (Without-HEMS). The last constraint describes that energy consumption of household should not exceed the total available energy.

E. Optimization techniques 1) Genetic Algorithm (GA):
is meta heuristic algorithm and inspired by the theory of natural evolution. GA is one of the most applied algorithm in various field of computer science and engineering due to the fast computational time and easy implementation of many complex problems. Among them GA is one of the most applied algorithm in various field of computer science and engineering [21]. GA is influenced by biological evolution process which is based on genetic inheritance and natural selection. GA is population based heuristic algorithm and starts with the initialization of population then each candidate in the population (known as genes) is evaluated using objective function. To select better candidate for the next iteration, we introduce tournament selection. The role of selection is to select best individuals (parent) for recombination and replacement process. Usually, recombination (crossover) and replacement (mutation) are the main driving agents to modify the population and provide diverse search space. In our designed model, we implemented GA that is associated with binary representation where "0" indicates the OFF and "1" shows ON state. Then, each candidate in the population is tested by objective function. Two point crossover and uniform mutation are introduced to achieve better results. After crossover and mutation the new set of candidates again evaluated and compared with previous candidates. The stopping criteria is maximum number of population size, and the allocation is the best candidate that satisfies the objective function.

2) Harmony Search Algorithm (HSA)
: is a popular meta heuristic algorithm inspired from musical improvisation process [22]. It is developed with an aim to search best state of harmony. This (best) harmony in the music is similar to optimization process to find global optimal solutions for a given objective function. HSA is an idealising mapping from the qualitative improvisation into quantitative formulation, and hence transforming musical harmony into optimization process. The HSA steps are given in the following.
Step 2: In the second step, initial random population is generated using Eq (4). This uniformly random distributed population is stored and analyzed in HM then evaluated using objective function.
where X max j and X min j are the upper and lower limits and j=1,2,3,..HM.
Step 3: In this step, a set of new vectors known as harmony vectors are generated based on the criteria, HMCR, (1-HMCR), and Par. The stored values in HM are then selected with HMCR and Par probability or it can be opted randomly from HM with the probability of (1-HMCR). In the designed model, it is important to select the best set of candidates from HM in order to effectively minimize objective function. The above discussion can be mathematically expressed as [23]: # Aǫta 1i , a 2i , a 3i . . . a HM u, W ith P pHM CRq Aǫta 1 , a 2 , a 3 . . . A N u, W ith P p1´HM CRq (10) In each iteration this process searches new best harmony (solution) and replaces the worst individual in HM. The process is terminated when stopping criteria (total number of improvisation) is met.

III. SIMULATION AND EXPERIMENT RESULTS
In this section, we conduct the simulation results based on metrics energy consumption, electricity cost, and PAR. To present the performance of optimization algorithms, we investigate the experimental results of particularly eight appliances including; four fixed power, two non-interrupt-able, and two interrupt-able flexible power appliances. The fixed power appliances consume fixed power and cannot be scheduled by HEMS (e.g., fan, lamp, TV, and oven). However, noninterrupt-able appliances operate on fixed power and can not stop their operation during scheduling time period (e.g., washing machine and iron) we assume that HEMS will schedule the iron operation after washing machine. While, interrupt-able To present our results, we consider energy consumption of household appliances for one day with time resolution of one hour (t) (starting from 12 am to the next day 12 am) and the TOU pricing tariff for Winter season (November 1, 2018 -April 30, 2019). Moreover, we also demonstrate that above scenario can be used for multiple users and various time resolutions such as; 10 users with time resolution 60 and 30 minutes and 50 users with time resolution 60 and 30 minutes.
As mentioned earlier, energy scheduling is one of the core motivation of this work, therefore, HEMS is designed based on the optimization algorithms; GA and HSA. Fig. 2 represents load profile (a and b), PAR (c) , and electricity cost (d) in one day. It is seen in Fig. 2 that each algorithm attempts to schedule energy profile in off peak time (i.e., 21-th hour evening time to 7-the morning time) when the price of energy is low (6.5 cents/kWh). While in peak hours (7 to 11 and 5 to 7 (am)) with price 13.2 cents/kWh, the maximum energy is consumed 8.72 kWh by "Without HEMS" whereas, GA-HEMS and HSA-HEMS accounted for 8.67 kWh and 7.14 kWh, respectively. On the other hand, Fig. 3a and Fig. 3b illustrate the energy consumption of the household appliances for 10 and 50 users with time horizon of 60 and 30 minutes. The maximum energy consumption is 9.35 kWh for single user and 93.5 kWh for 10 users with time span of 60 and 30 minutes while these consumption are flexibly control and shifted to offpeak times in order to reduce the electricity bill. Furthermore, the maximum consumption in case of 50 users (both time interval) are also optimized by GA-HEMS and HSA-HEMS by 9.82 % and 6.20 %, respectively.
The effectiveness of designed HSA-HEMS and GA-HEMS is also evaluated by the PAR, defined as the maximum aggregated load (i.e., peak load) to average load used by consumer.
The PAR values is reduced to 15% and 5.8% by GA and HSA, respectively, compared to the scenario i.e., "Without HEMS". Moreover, in Fig. 4 (left side) , we demonstrate the PAR for scenarios ;multiple users (10 and 50) with the time resolution of 60 and 30 minutes. Out of all maximum reduction of PAR is 17.41 %, which can be seen for 50 homes with time interval 60 minute. Thus, It shows that the energy consumption is shifted from peak to off-peak time period, proving that GA-HEMS and HSA-HEMS can manage energy consumption adeptly . Fig. 4 (right side) presents the comparison of electricity. It can be observed that the deployment of HSA-HEMS and GA-HEMS reduces the cost in contrast to the case "Without HEMS". Since both algorithms attempt to reduce the cost of the electricity, however, among all (a), (b), (c), and (d) the maximum cost is reduced 1.83% by HSA-HEMS in case of 50 users and 60 minutes time slots. It is also seen that cost of energy is maximum (13285 cents for 50 users and 30 minutes time slots) for one complete day "Without HEMS", because most of the energy is used either in peak time or mid peak, while on the contrary, HSA-HEMS and GA-HEMS reduce the cost (1.64%) and (1.34%), respectively, in response to pricing tariff. The statistical analysis of the designed scenarios is provided in Table II. IV. CONCLUSION In this paper we designed heuristic model combing with DR strategies for optimizing energy consumption in residential sector. Considering HEMS environment, we modeled our optimization problem using various types of household appliances, electricity pricing tariffs, and energy demand. The results show that designed algorithms; GA and HSA can effectively optimize energy consumption, reduce electricity cost by 0.9 %, 3.98 %, and PAR by 15 %, 5.8 %, respectively. Also with the different number of users and timescales, the relative performance of both algorithms is effective and minimized the cost and PAR accordingly. As a result, efficient management of resources, peak shaving (power grid), and improve energy usage rate of power grid can be achieved. Simulation results illustrate that both heuristics illustrated the potential of those heuristics in terms of electricity cost and PAR. Besides, it is also shown that DR-based strategies encourage the consumer to manage their energy consumption by shifting the peak hours into off peaks.
In future works, we expect to include distributed energy resources and also incorporate pollution emitted at time of electricity generation, then it would become multi-objective problem (cost and pollution minimization). We also plan to analyze the impact of cyber-attacks in the price signals used by the HEMS.