A Novel Dynamic Appliance Clustering Scheme in a Community Home Energy Management System for Improved Stability and Resiliency of Microgrids

Power scheduling of domestic appliances is a vital preference for bridging the gap between demand and generation of electricity in a microgrid. For a stable microgrid, an acceptable mechanism must reduce the peak to average ratio (PAR) of power demand with supplementary benefits for consumers as reduced electricity charges. Recent studies have focused on PAR and cost reduction for a small consumer population. Furthermore, researchers have mainly considered homogeneous consumer loads. This study focuses on residential power scheduling for electricity cost reduction for consumers and load profile PAR curtailment for a relatively large consumer population with non-homogeneous loads. A sample population of 1000 consumers from various classes of society is considered. The proposed dynamic clustered community home energy management system (DCCHEMS) allows the clustering of appliances based on time overlap criteria. Comparatively flatter power demand is attained by utilizing the clustered appliances in conjunction with particle swarm optimization under the influence of user-defined constraints. Modified inclined block rates with real-time electricity pricing strategies are deployed to minimize the electricity costs. DCCHEMS achieved higher efficiency rates in contrast to the traditional non-clustering and static clustering optimization schemes. An improvement of 21% in peak to average ratio, 4% in cost reduction, and 19% in variance to mean ratio is obtained.


I. INTRODUCTION
Ever since the deregulation of the electric power industry, smart grids have been envisioned to achieve effective electricity distribution and utilization [1], [2]. The smart grid framework encompasses all the smart appliances that generate and store electricity, thus allowing the consumer to participate and fulfill energy demands [3]. Demand response (DR) strategy is one such way that allows potential residential customers to minimize electrical costs by diverting their power usage preferences from a peak to an off-peak period. The reliability of the smart grid is attributed to the efficiency of this load shifting criteria which in turn contributes to shrinking the peak to the average power.
Microgrid (MG) is an emerging concept in smart grids that enhances the effectiveness and resiliency of power systems by allowing smart control of consumer's power consumption while integrating distributed generation resources such as PV and wind [4]. A home energy management system (HEMS) warrants the steadiness and consistency of microgrids [5]. It is commonly referred to as the technique attributing to the use of home appliances by domestic users. HEMS plays a vital role in a smart grid control system due to the widespread demand for electricity in the domestic sector [6]. It works by allowing variations in the demand curve according to each profile of a user. The variation occurs due to the partaking of a user in the electric VOLUME 4, 2016 power market. The whole process makes use of intelligent sensors that are located at the software running the database. The sensors help save the user's profile at various points of consumption. More specifically, an advanced metering infrastructure (AMI) or smart meter serves as a connecting junction between the electrical grid and appliances to enable the power supply. HEMS prioritizes this load consumption that concerns cost and energy [7].
Today, the integration of HEMS in an MG is an essential part of smart grid control as domestic consumers substantially contribute to the total electricity consumption. Also, there is a need to improve the existing conservative HEMS techniques to shrink the peak to the average power demand of smart grids. This would fulfill the increasing energy demand and overcome power deficit conditions in underdeveloped countries [8]. The grid generates a controlling signal known as demand response (DR) that reflects altered electricity prices during peak hours. HEMS responds to DR while maintaining a balance between power generation and electricity consumption across the entire grid. It reshapes the power usage pattern (PUP) by rescheduling load on the consumer end (demand-side management). The DR process generally comprises three pricing schemes; time of use pricing (TOUP), critical peak pricing (CPP), and real-time electricity pricing (RTEP). TOUP and CPP enable electricity price (EP) calculation in advance. The price calculation process can be performed quarterly in both the schemes. Due to hourly updates in the price, flexibility in RTEP can mirror load profiles or the generation costs. But using RTEP for consumer's electricity cost (EC) reduction may increase PAR during low price time slots. This is because the peak values in PUP will move to low EP slots [9]. Hu et al. have proposed a DR-based energy consumption scheduling scheme [10]. Price reduction is achieved but the customer's comfort is compromised with chances of peak load emergence in low price hours. Du et al. suggest an electricity reduction-based optimization model [11] that combines the two schemes of RTEP and inclined block rate (IBR). Despite achieving significant improvement in cost reduction, the scheme only operates for limited time span of one day or one-month. Also, the sample data set is small i.e. one household. Imran et al. propose a heuristic computation-based load scheduling mechanism. The main objective of the proposed approach is to improve PAR, minimize electricity bills, reduce carbon emissions, and increase user comfort [12]. But the simulations are presented for a small data set of a single house for a day only.
Many studies addressing various energy parameters have been conducted. The parameters studied include the daily energy cost, allowable home temperature ranges, energy usage, peak hours' energy usage, and consumer's comfort [13]- [15]. The effects and analysis of usage plans such as fixed pricing, time-of-use pricing and real-time pricing have also been studied. To meet energy demand in real time, Homod et al. proposed the Takagi-Sugeno fuzzy based method. This energy based operational model was developed for heating, ventilation and air conditioning (HVAC) systems that used distributed energy resources, noncontrollable appliances (NCAs) and battery storage systems. Clustering used by output variables made different groups of temperature average data for the entire year. The method was optimized for HVAC systems but it did not consider rest of the commonly used residential loads [16]. The authors have suggested performance improvements for HVAC systems [17]. Recent studies show the application of cluster-based optimization strategies at the MG level [18], [19]. Yet they fail to consider consumer's preferences at appliance level. Also, the algorithms have limitations in handling a large data set with variations in the types of communities.
Some proposed models use game theory [20] and fuzzy logic-based models [21] to solve energy management problems of residential buildings. But, these models are based on a very small data set of a day, a limited number of houses, and appliances that do not depict practical scenarios. Waseem et al. uses Grey Wolf and Crow Search Optimization (GWCSO) algorithm to reduce PAR and EC [22]. But the proposed technique considers only the HVAC loads for scheduling which limits the scope of GWCSO algorithm. Kim suggests a heuristic computation-based binary backtracking search algorithm to optimize the energy usage of controllable appliances. In comparison with particle swarm optimization (PSO), the algorithm shows higher energy efficiency. But it does not consider EC and PAR [23]. Dong reformulated the economic dispatch problem using data-driven energy management [24]. The model used an optimal algorithm at 30 minutes sampling time and did not consider PAR in the proposed algorithm. Javaid et al. and Hafeez et al. proposed heuristic algorithm-based optimization models for household load scheduling to reduce overall electricity bill and PAR [25]- [27]. But the models performed well for only small data sizes. The performance lowered as the size of the data increased. The models suggested no mechanism to handle large data. Hafeez et al. proposed an optimization scheme exploiting mixed-integer linear programming (MILP), binary backtracking search algorithm (BBSA), and artificial neural network (ANN) [28]. Although the objective of electricity bill reduction and PAR alleviation was attained but at the cost of increased system's complexity and execution time.
Jiang proposes an approach based on genetic algorithms to improve EC and PAR under step tariffs in a power system [29]. The simulation results shown depict a very small data set of three houses. Hussain suggests a genetic harmony-based search scheme to analyze the single-user and the multi-user but with a small population size of 30 [30]. A one-hour sampling time was used. The small data set cannot properly reflect the real-time operation of the appliances. The sampling time used is one hour that cannot reflect proper real time operation of the appliances. Paudyal suggests a load profile's peak reduction using a linear model [31]. But model uses a population of only 25 houses. Aziz This work is licensed under a Creative Commons Attribution 4.0 License. For more information, see https://creativecommons.org/licenses/by/4.0/ This article has been accepted for publication in a future issue of this journal, but has not been fully edited. Content may change prior to final publication.   et al. presents a power scheduling methodology for a large population [32], [33]. However, the technique is based on the assumption of homogeneous consumption. This means that all appliances in the entire population have the same properties and belong to a similar class of consumers.
The literature review suggests that the majority of power scheduling strategies focus on a small population sample size, thus leaving the investigation of their behavior under a larger population size unexplored. In this paper, a dynamic clustered community-based home energy management system has been proposed. The system achieves improved performance for a large population set. The proposed load scheduling scheme decreases consumer EC and PAR of load profile for a large population. Consumers from different classes form communities and their appliances are gathered as clusters. Each cluster undergoes particle swarm optimization, and an optimum starting time is allocated to the appliances. To avoid unwanted peaks during any time slot, the fitness function of PSO also incorporates a modified IBR. PAR is reduced when appliances' overlapping time slots are tailored with IBR. Results of the proposed system are compared with the static clustering techniques suggested by Aziz et al.
The work contributes an efficient dynamic clustered community-based home energy management system (DCCHEMS). The model exhibits the following features; • To make the model meaningful, realistic and practical, it uses a large data set of 1000 houses for three months. It implements a demand response-based strategy based on consumers' preferences for load scheduling of controllable appliances. Also, it considers the various types of consumable appliances that are commonly used in households. • The model uses four classes of consumers i.e., lower class, middle class, upper-middle-class and higher class. Due to the non-identical properties of consumer appliances and distinct user preferences from different classes, the load is non-homogeneous. • The proposed model overcomes the underperformance of static clustering-based techniques. The proposed DCCHEMS algorithm significantly reduces the PAR and cost of electricity. The paper is organized as follows. Section-II presents the structural design of EMS, Section-III presents the models and their equations, Section-IV presents the proposed approach of DCCHEMS, Section-V presents the simulation results and Section-VI is the conclusion.
A brief summary of a few papers from heuristic computation techniques is summarized in Table 1.

II. STRUCTURAL DESIGN OF ENERGY MANAGEMENT SYSTEM IN A HOME AREA NETWORK
The aim of an energy management system (EMS) is to limit electricity expenses and reduce PAR. It does so by scheduling power consumption in response to priority settled electricity prices. Such energy management systems warrant the stability and reliability of the power system. So, the main goal of any DR-based scheme is to reduce PAR and EC that profits utility as well as the consumer. An EMS consists of AMI, home gateway (HG), energy management controller (EMC), home appliances, and in-home display (IHD) appliances.
This paper proposes a community-based system architecture that is compatible with MGs. The proposed system is applicable for a community within an MG where several MGs are assumed to be connected to the grid. These MGs behave as substations that convey DR to users in the community center as per their proportion. The structure of the community-based scheme for HEMS utilization in smart grid is shown in Fig.1a. The proposed scheme can apply in a power system that has multiple MGs, where each VOLUME 4, 2016

Models of Energy Management Techniques Objectives Limitations
Efficient Load scheduling for residential loads [12] GA, MILP

Reduces energy expenses and PAR
Simulations presented for small data set of a single house for a day Reduces CO2 emissions and consumer discomfort level Multi-objective bi-level optimization model [18] MILP, IABC algorithm  Fig.1b. AMI is the most essential part of a smart grid. It connects the smart metering system to the utility of two-way communication and autonomous operations [34]. AMI is also responsible for collecting and transmitting real-time smart meter consumption data details and provides them to the utility. It also communicates DR pricing signals back to the smart meter after receiving from utility [35]. A smart meter is usually mounted outside of residential homes. It establishes a connection between EMC and AMI by receiving EMC consumption data and transmitting it to the utility. It also sends DR signals to EMC for further analysis.
This paper addresses two types of appliances; controllable appliances (CA) and non-controllable appliances (NCA). CA can run on their own and do not need any manual interruptions e.g. washing machines, dishwashers, clothes dryers, or air conditioners. The appliances can further be categorized into interruptible (clothes dryer) and noninterruptible (rice cooker) classes [36]. The NCA is consumer dependent and can be operated during use, e.g., Television, computer, and lawnmower. So CA can only be scheduled while NCA requires manual interference. Furthermore, the CA considered in this paper are assumed to be smart home appliances. In the architecture presented here, CAs do not have any interaction with each other, but only with HG. The HG would have scheduled all the CAs connected in the residential home at the start of the day.
Various wireless options are available to establish communication between the smart meter and HG. Possibilities include Wi-Fi, Z-Wave, Zig-Bee, or a wired (home plug) protocol [37]. HG via HAN can transmit an optimal power usage schedule to each CA. IHD or remotecontrolled appliances such as laptops, mobile phones, etc., can be used to monitor the scheduling process.
The proposed technology assumes that smart meter and HG are merged as EMC that receives RTEP data from utility. Hour of the Day

III. SYSTEM MODEL AND PROBLEM FORMULATION
This section presents a load scheduling optimal approach for all CAs in the house. It exploits RTEP and modified IBR pricing schemes.

A. HOME ELECTRIC APPLIANCES USAGE PATTERN
The EMC can make decisions for appliances load scheduling once the utility sends DR information and RTEP profile to the HG. Consumers generally prefer to avoid peak hours and require certain tasks to be completed before some specific time slots. Some tasks, e.g., washing machines, can operate during the night when EP is low as the residents are sleeping at that time. So, consumers must set time parameters for each CA. Time parameters include activation time slot (ATS) t a k , appliance operation time start (AOTS) α a k , appliance operation time end (AOTE) β a k , appliance operation time length (AOTL) l a k , appliance operation time interval (AOTI) [α a k , β a k ] during which the appliance is valid to be scheduled and appliance rating x a k as depicted in Fig.2. The IHD appliance takes these parameters' information and transmits it to EMC via HG. The proposed scheme only schedules CAs and does not schedule NCAs. However, the simulation results reflect that the scheme is still effective if NCAs are involved. The power scheduling of CAs follows a specific pattern that is presented in the following section.

B. SELECTED PRICING SCHEME AND MODIFIED INCLINED BLOCK RATE
RTEP being superior in flexibility as compared to both TOUP and CPP, but has the drawback of concentrating many appliances at low EP areas. Considering this constraint, the proposed system combines IBR with RTEP which can vary EP rates in the low EP time slot based on the power consumption of the appliances [38]. This prevents another peak that can occur in low EP time slots.
Application of IBR pricing scheme affects RTEP rates by multiplying it with a factor λ >1. This occurs whenever the PUP of any house goes beyond a predefined threshold range at any time slot. Otherwise, RTEP remains unaffected. IBR operates as a monitoring term to keep the scheduling algorithm from inducing sharp peaks in PUP. Undesired power peaks can occur in response to the scheduling algorithm optimization. This may occur when several appliances of a house operate with overlapping α a k and β a k . They may get scheduled to identical time slots where RTEP is offering low electricity prices. Thus, undesired power peaks get created. Occurrences of these undesired peaks increase the PAR of PUP. IBR controls such a situation by involving the penalty term and prevents the scheduling algorithm from creating power peak patterns. In the proposed approach, IBR is modified to reflect the penalty term which applies only when PUP crosses a γ c scaled threshold i.e. the number of houses lying under the current community. Two EP levels are considered and there is a change in EP every hour. Modified IBR control is incorporated into the RTEP formulated as: where, Here rtep (τ ) is the real-time EP received from electricity supply company for time slot τ , rtep pc (τ ) is the EP based on the power consumption p c of the community being optimized, th is the threshold set to 2 kWh, and γ c is the count of houses under current community. C h represents a set of houses in the current community of consumers and C c refers to the current cluster of CAs.
Though it seems impractical to propose EP ahead of a day, several price prediction schemes have been presented in the literature [39], [40]. The electricity pricing data: RTEP for 9th July 2015, accessed from Illinois is shown in Fig. 3 [41].

C. FINAL OBJECTIVE OF PROPOSED APPROACH
In an RTEP setup, EP rates are varied on an hourly basis. If the CAs are scheduled as per RTEP's hourly basis then the Hours of the Day  [42]. PSO-based optimization problem becomes computationally efficient when a day is divided into 144 time slots. Therefore, 10 minutes time interval is selected to be the shortest operation time of any appliance. The operation times should be the numbers that denote integer multiples of 10.
A is used to denote CAs. We assume that each appliance a k ϵ A has the power consumption profile as, where p a k (τ ) represents power consumption value for a th appliance of k th house, during τ th time slot, and the unit is kWh. Since, there are 16 appliances considered for each house; a ϵ {1, 2, ....., 16}. We assume that power consumption value for each appliance is fixed per hour as there exists a certain specification of each appliance, as shown in Fig. 8.
When the power consumption value per hour for appliance a k is denoted by x a k , then the corresponding power consumption during τ th time slot is Here, x a k is the a th appliance power rating for k th house. The power vector P a k will be scheduled for the a th appliance of k th house. This information is to be transmitted to the a th appliance by HG through a suitable wireless connection. As mentioned before, user preferences parameters are taken from consumers for each CA. Toward this aim, we assume α a k and β a k ϵ U (α a k < β a k ), as the indexes of the start and the end time slots, respectively. The power consumption of appliances is assumed to be valid for appropriate scheduling within this operation time interval. Let l a k be the AOTL, i.e., required time slots for appliance operation. The above-mentioned parameters are decided based on user preferences received through IHD and are transmitted to EMC later. In addition, β a k -α a k should be either equal to or greater than l a k . For example, if the washing machine needs one hour to finish its work, then the value of β a k -α a k could be any numbers that are greater than or equal to 6, and in the meantime less than or equal to 144. The greater the value of β a k -α a k is, the more possibilities for load scheduling there would be.
We define a variable t a k as the activation time slot (ATS) for the a th appliance of k th house. Since, α a k , β a k , l a k and x a k are all known already, the power consumption scheduling vector of an appliance 'a' can only be determined once t a k is known. Fig. 4 represents these relationships of the above-mentioned parameters for four different kinds of CAs for k th house. Now for each appliance a k ϵ A, there exists a group of parameters comprising of AOTS α a k , AOTE β a k , AOTI [α a k , β a k ] , AOTL l a k and power consumption value per hour x a k . In addition, we also set ATS t a k as a variable. Having α a k , β a k , and l a k known already, t a k should be greater than or equal to α a k , and less than or equal to β a k − l a k . In other words, the adjustable parameter t a k is denoted as The range of t a k , as an example for a th appliance of fourth house, is shown in Fig. 5. For ATS of a th appliance and k th house, we need to find its optimum value for every CA subject to the constraint given in (4). A variable vector [t a1 , t a2 , . . . t a k ] is constructed that consists of ATS for all the CAs. Therefore, a load profile based on power consumption scheduling matrix P for all CAs is defined as where P denotes a matrix, each row of which carries power scheduling pattern of a certain appliance and variable τ represents the index of column. The term τ / ∈ [t a k , t a k + l a k ] indicates that τ belongs to T excluding the range [t a k , t a k + l a k ]. By summing up all the values of each column vector in the power consumption scheduling matrix, a total power consumption scheduling vector P scd would be determined as In Eq. (6), P (τ ) stands for the τ th column in the power consumption scheduling matrix.
The objective function of the power consumption scheduling problem when defined for a single house can be presented as the following optimization problem where In Eq. (8), rtep denotes the EC at the τ th time slot. The EP presented in (8) can be minimized through an optimization technique.

IV. PROPOSED PARTICLE SWARM OPTIMIZATION BASED APPROACH FOR MANAGEMENT OF ENERGY CONSUMPTION A. PARTICLE SWARM OPTIMIZATION (PSO)
The PSO is an iterative method, proposed by Kennedy and Eberhart [43] is based on the concept of population of particles. The optimization is initiated by assigning initial values to position and velocities of the particles. PSO allows the candidate solutions; particles, to gather up around the optimum solution space. Particle best solution and the local best position are defined by global best (gbest) and particle best (pbest), respectively, to monitor the flight curves of the particles.
In our problem, EC is reduced using PSO for optimum ATS allocation of each house in the community. Optimization is aimed to work within the constraint of keeping AOTL within the range of AOTS and AOTE as given in (4). Here, AOTS is used as the initial value for optimization which is the user preference provided by the consumers. Then the cost function is saved that minimizes EC as shown in (8) and adjusts pbest location. This process continues until terminated due to the termination condition.
The velocity of particle i is updated as it moves around the search space as per (9). Suppose x t i denotes the position vector of particle i in the multidimensional search space (i.e R n ) at the time step t then the position of each particle is updated in the search space by (10) V t ij and x t ij are the velocity and position vectors of particle i in dimension j at time t. pbest t ij is the personal best position of particle i in dimension j found from initialization through time t. Similarly, gbest t j is the global best in dimension j found from initialization through time t. Uniformly generated random numbers in the interval [0, 1] are represented by r 1 and r 2 , respectively. The particle weight is represented by the coefficients ω, momentum of pbest by c 1 and pull towards gbest is represented by c 2 , respectively. The constraint defined in (4) is used for random initialization of velocities and particles. The same initially generated population is expected to improve upon each iteration. Each particle improves its own version by keeping a check on pbest. If a newer version of pbest is better than the previous then it is replaced with the improved one. Also, if pbest better than gbest, it replaces gbest as well. The gbest is returned as the final solution when the process is completed after fulfilling any of the termination criteria as shown in Fig. 6.

B. FORMULATION OF DCCHEMS
The IBR has been used as a pricing scheme from a long time by many companies like California Edison & Pacific Gas & Electric [44], [45]. PAR is reduced by the application of IBR which can control the power demand of one appliance by implying its penalty factor. But if many appliances appear in the same time slot then the PUP of the whole power grid will rise enormously. This scenario can be explained with the help of Fig. 7  around a time slot which has the lowest EP than its successor slots. In such a situation, the application of any scheduling algorithm in conjunction with the IBR will tend to settle down t a k of all houses towards the slot of lowest EP. Despite the fact, IBR succeeds to limit the PUP of each house under the desired threshold. But the constellation of appliances t a k scheduled around the lowest EP will produce a PUP peak in the overall community. Ultimately it occurs for the entire power grid. If we consider the RTEP in Fig. 3, EP is the lowest around hour 5 of the day, and the appliances of Fig.  7 will tend to be scheduled around hour 5 resulting in a higher peak. This situation demands for a power scheduling methodology that can look around in the neighborhood while optimizing ATS for all the appliances. Therefore, the proposed algorithm handles the situation as follows. It is assumed that grid or electricity supply company VOLUME 4, 2016 communicates DR-related tasks to the substations. And they further communicate it to the respective communities. For incorporating analysis of non-homogeneous loads, the entire population of 1000 houses is divided into four types of community classes; lower-class (LC), middle class (MC), upper-middle-class (UMC), and higher class (HC). These classes consist of equal number of houses. All these four classes have their own user preferences as per their daily routines. For example, HC, usually the business class, has late-night routines as their morning chores start around noon. Their houses usually have heavy-duty loads, e.g., 2 to 5 tons ACs, automatic washing machines requiring plenty of water that enables longer water pump operation, generally enabled with automatic water heating. All these appliances are high-powered as compared to other classes of community types. In comparison, MC makes it a bit earlier with somewhat reduced power-rated appliances connected at their homes. For example, appliances like automatic washing machines and dishwashers are installed without electric water heating. So they use lesser power for their operation as compared to HC or UMC [46]. Power ratings used for CAs of all four classes are shown in Fig. 8. As a general trend, LC starts the day at 4 a.m. and ends up with all the chores around 9 p.m. These details for all four classes are reflected in Table 2. We have assumed different percentages of CAs in each class. LC community is assumed to have 20% of CA, 40% for MC, 60% for UMC, and HC is assumed to have 80% of CA.
A randomly generated one-day load profile is subjected to PSO to find the best clustering set among all possible clustering combinations of C1, C2, and C3 as presented in Fig. 9. The C3 is varied from 2 to 7 clusters per community with both uniform and unequal cluster sizes [33]. Based on PARR best clustering combination is employed in randomly generated population load profile for 90 days as presented in simulations Section-V. The entire population of each class having 250 houses, is divided into their respective communities of size C1, the appliances within the communities are sorted as per C2 and then grouped into C3 clusters. Each community consists of 50 houses as per C1 optimum value. AOTE is selected to be the sorting criterion under C2. The number of clusters of appliances in each community denoted by C3 is selected to be 5 as per the optimum value. The developed algorithm broadly consists of two steps. First, a dynamic clustering based pre-processing stage for the data formulation. Second, dynamic clustering is employed on the formulated data for load scheduling of the CAs.
Pre-processing stage is highlighted in Fig. 10 that involves sorting of all houses before making sets of communities according to C1. The selection of houses into communities is dynamic as it is based on average PAR of each cluster. There are 16 appliances in each house. These 16 appliances per house are divided into 5 clusters as per their AOTS and AOTE. PAR is calculated for 5 clusters and all houses are sorted in ascending order based on maximum PAR. Secondly, entire population of 1000 houses is divided into 5 sets of 200 houses each. And all sets are sorted according to their second maximum PAR. Thirdly, the 10 sets of 100 houses each are sorted according to third maximum PAR. In order to bring variations of data under one community, every 21 st house is picked out of the sorted list. Selection of houses at turns of 20 s is carried out in order to populate each community with a good diversity based on PARs. It facilitates the dynamic clustering due to availability of   houses with diversified PAR values. Since the size of one community is 50 houses, therefore, the LC consists of 5 communities of 250 houses. Similarly, each of the other three classes consists of 250 houses. Therefore, the 5 communities belong to each class. One community of 50 houses has a total of 800 appliances, i.e 50 × 16. These appliances of each community are further divided into 5 clusters of various configurations as per criterion C3. Borders of cluster with highest average PAR is varied with even multiple of integer interval [-3, +3]. The combination resulting in lowest PAR is selected.
Following steps are followed by DCCHEMS: Step 1: Entire population is divided into equal sized classes; lower class, middle class, upper-middle-class and higher class.
Step 2: C2 is used for sorting the appliances of each house.
Step 3: C3 decides a number of clusters of appliances in each house.
Step 4: For the entire population, sorting population with a staggered set of houses having to descend PARs in respective clusters.
Step 5: Selection of optimum clustering criterion.
Step 6: C2 is used for sorting appliances under each community.
Step 7: C3 decides a number of clusters of appliances in each community.
Step 8: The parameters t a k belongs to the current cluster within the range [α a k , β a k − l a k ] are initialized and Step 6 till end is repeated until all clusters done. Sets of t a k are used as particles.
Step 9: Eq. (11) is used to calculate fitness for each cluster by evaluating P cc and EC.
Step 10: The pbest is updated in case the new particle's fitness is better than that of the previous pbest. In case later is better, update gbest with pbest.
Step 11: Update velocities and positions of particles according to (9) and (10).
Step 12: Go to Step 6 if the termination criterion is not reached.
Step 13: Repeat Step 8 to Step 11 until all communities scheduled. Step 14: Terminate once the entire population is scheduled.
The steps followed by the algorithm are shown in the flow diagram of Fig. 10. Overall power scheduling objective can be summarized as follows: Here EC(P cc ) is the total EC based on PUP. The PUP for the cluster of the community being scheduled is denoted by P cc , rtep pc (τ ) represents electricity rate for the τ th time slot according to (1). p a k (τ ) is the power rating of CA for k th house and a th appliance. The houses in the current community are represented by C h . Current cluster is denoted by C c . Therefore, the objective function of our proposed algorithm is to minimize overall consumer EC of power consumption. IBR is applied on the entire community to keep the PAR under control, as the population is divided into several smaller communities.

V. SIMULATION RESULTS
This section describes the simulation results of our energy management system. We have used PSO that exploits tested parameters for a randomly generated house population of 1000 houses for 90 days. Out of these 1000 houses, each class of community consists of 250 houses. The clustering parameters are tuned for one day's load profile as proposed by Aziz et al. [33]. This section presents the results and simulation outcomes for the proposed algorithm. Results reflect improvement in PAR of PUP and EC as compared to existing techniques in the literature. To present the comparison with the existing techniques, three performance metrics have been used; cost reduction percentage (CRP), PAR reduction percentage (PARR), and PUP variance to mean ratio (PVMR). These metrics are calculated as: Here, EC and PSEC are the electricity costs before and after power scheduling, PAR and PARPS are peak to average ratios before and after power scheduling, µ PUP reflects mean PUP. The percentage improvements in the proposed technique as compared to reference techniques for these three performance metrics are shown in Table  3. For simulation purposes, maximum 16 and minimum of 8 appliances are considered for population load profile generation.
Some appliances can operate more than once a day according to the daily routines of the users. Table 2 represents the possible time slots utilized for power consumption of CAs. MATLAB is used for all the simulations carried out in this study. As per optimization algorithm requirements, PSO uses parameters as swarm size of 100, 0.25 as a neighbor minimum fraction, variable count 16, relative change tolerance value as 10-16 and the iteration terminates at 3200.
The best clustering set among all possible combinations of the clustering parameters as presented in Fig. 9 is generated using PSO when applied on a randomly generated load profile for a day. To achieve both uniform and unequal cluster sizes, C3 can achieve values ranging from 2 to 7 clusters per community. Results presented here are generated for 50 houses for each community for all four types of community classes. Home appliances are sorted based on AOTE. The number of clusters is decided to be 5. The selected parameters are claimed to be the best clustering combination for randomly generated load profiles for a period of 90 days [33].
In this study, following four types of profiles are generated. Profile for unoptimized data, profile with IBR included with PSO for load scheduling [33], profile with CCHEMS based appliance clustering [33] and profile with the proposed dynamic appliance clustering. Note that the electricity pricing data is taken from Ameren Illinois Power Company (2015) for the duration of 11th April 2015 to 9th July 2015.
An optimization for the 45 th day PUP against time slots (TS), is shown in Fig. 11 which shows that proposed algorithm improves on PAR significantly as compared to static clustering-based approaches. The peak of 215 kW/TS in CCHEMS at TS 109 is reduced down to 168 kW/TS at the TS of 87 in DCCHEMS. The difference can be observed with an unoptimized and PSO-IBR techniques where sharp power consumption peaks are replaced by either no or very low power consumption peaks. The algorithm shifts the consumers' load from peak hours to off peak hours while preventing building up of new peaks. This witnesses the benefit of combining IBR with RTEP as claimed in the pricing scheme Section-IV-B. Once dynamic clustering applied, the diversity factor of the load curve improves. The load varies smoothly which leads to peak shaving and desert filling. In contrast to the static clustering-based approach, significant improvement in PAR is observed for the proposed technique as presented in Fig. 12(b) where mean PAR for unoptimized technique, optimized with PSO and IBR, CCHEMS and DCCHEMS are 3.78, 3.65, 2.51, and 1.71, respectively, as shown in Fig. 12(b). The EC reduction for the reference and proposed technique in $/Day for a period of 90 days is presented in Fig 12(a)  The PAR effects are presented in Fig. 12(b). Nondynamic clustering reduces PAR by 33.49%, whereas dynamic clustering reduces PAR by 54.75%. The proposed DCCHEMS is 4.11% better than non-dynamic optimization in terms of cost reduction capability. Results are more encouraging when the PAR reduction is considered with DCCHEMS where an improvement of 21.26% as compared to the non-dynamic optimization is achieved. Considering the improvement of PAR and cost reduction, utility is encouraged to offer more incentives to the consumers for taking part in DR events. The last parameter PUP variance to mean ratio (PVMR) reveals that DCCHEMS is 19% superior to non-dynamic optimization in the smoothness of PUP. Therefore, our proposed DCCHEMS enables PUP smoothness as reflected in Fig. 12(c). Ideally, zero PVMR leads to a flat PUP and DCCHEMS brings PVMR further down to 0.11 from 0.3 in the case of CCHEMS, which was reduced only up to 0.85 on average for non-dynamic clustering. Stability and reliability of the entire system are ensured by smooth PUP and reduced PAR. Averaged results for 90 days of PSO optimization are shown in Table 3. This significant reduction in PAR and EC with the proposed technique is due to two design improvements. Firstly, the segregation of consumers into various types of communities. Secondly, by further dividing the clusters of the appliances into various sets based on their operating time overlap and respective PAR values. The reduction in PAR ensures improvement in demand and supply balance which must be obtained for an MG to work resiliently [47].

VI. CONCLUSION
In this paper, a dynamic clustered community HEMS-based strategy is proposed to perform efficient energy management of residential consumers by involving demand response and user preferences. The proposed technique results in incentivized consumer and utility companies by exploiting the difference in user preferences and load consumption behaviors of various classes in society. Consumers relish the benefit of reduced EC and electricity supply company benefits through efficiently trimmed PAR augmenting reliability and stability in MGs. For performance validation, simulations were carried out and results of the proposed framework of DCCHEMS were compared with CCHEMS based strategy and PSO-IBR-based optimization. The proposed DCCHEMS based technique improves PAR by 21.26% and EC is improved by 4.11%. Variance to mean ratio is also improved by 19%. Set of houses in current community. l a k AOTL for appliance a of house k . P a k Power consumption profile for appliance a of house k . p a k (τ ) Power consumption value for a th appliance of k th house, during τ th time slot. p c Power consumption of community being optimized. r 1 , r 2 Random number in the interval [0, 1]. t a k ATS for appliance a of house k . th

Abbreviations
Threshold set for PUP at 2 kWh. V t ij Velocity vectors of particle i in dimension j at time t.
x t ij Position vectors of particle i in dimension j at time t.
x a k Appliance rating for appliance a of house k .

ACKNOWLEDGMENTS
I am grateful to late Dr. Ijaz Mansoor Qureshi, who has been a great supervisor during my PhD research. Mutual effort always brings productive results, for this I am really indented to my fellows Nimra Noor and Bareera Qaseem for their support and help.