A Novel Multiobjective Optimization Algorithm for Home Energy Management System in Smart Grid

Demand response (DR) is an effective method to lower peak-to-average ratio of demand, facilitate the integration of renewable resources (e.g., wind and solar) and plug-in hybrid electric vehicles, and strengthen the reliability of power system. In smart grid, implementing DR through home energy management system (HEMS) in residential sector has a great significance. However, an algorithm that only optimally controls parts of HEMS rather than the overall system cannot obtain the best results. In addition, single objective optimization algorithm that minimizes electricity cost cannot quantify user’s comfort level and cannot take a tradeoff between electricity cost and comfort level conveniently. To tackle these problems, this paper proposes a framework of HEMS that consists of grid, load, renewable resource (i.e., solar resource), and battery. In this framework, a user has the ability to sell electricity to utility grid for revenue. Different comfort level indicators are proposed for different home appliances according to their characteristics and user preferences. Based on these comfort level indicators, this paper proposes amultiobjective optimization algorithm for HEMS that minimizes electricity cost and maximizes user’s comfort level simultaneously. Simulation results indicate that the algorithm can reduce user’s electricity cost significantly, ensure user’s comfort level, and take a tradeoff between the cost and comfort level conveniently.


Introduction
Over the past several decades, with the development of economy, the electricity demand of the whole world increased dramatically, which makes the power system encounter stress conditions frequently.At the same time, the pressure of natural resources and environmental problems have attracted great attention to incorporation of clean, renewable generation sources, such as wind and solar power [1,2].However, due to the variable and uncertainty characteristics, the increasing penetration of renewable generation sources introduces further challenges to the power system [3].In addition to these factors, the emergence of a large number of plug-in hybrid electric vehicles (PHEVs) has the potential to increase peak demand significantly, overload distribution lines, degenerate distribution transformers, and threaten the reliability of the power system [4][5][6].To alleviate these problems, demand response (DR) plays an important role.
DR is an effective method to lower peak-to-average ratio of demand, improve the utilization of power assets, strengthen the reliability of power system, and facilitate the integration of renewable resources and PHEVs [7][8][9][10][11].DR has been successfully applied in industrial and commercial sectors.On the other hand, in residential sector, it is difficult to implement DR effectively because of little power consumption of single residential customer, large numbers of customers, and the lack of corresponding technologies and incentives in conventional power grid.However, take the USA, as example, according to the report of the US Energy Information Administration (EIA), the residential sector consumes 20% of the total energy supply and dominates 60% of peak load in certain parts of the country [12].From this point of view, implementing DR in the residential sector has a great significance.
In recent years, with the emergence of smart grid, DR in residential sector is getting more and more attention.Different from the conventional grid, the smart grid has twoway energy and information flows, which provides the base to implement DR in the residential sector.Residents can control the operations of their home appliances, batteries, PHEVs, and distributed generation through home energy management system (HEMS).Optimal scheduling algorithm is one of the key components of HEMS and a hot topic in smart grid.
Many papers have been published about the optimal scheduling algorithms in HEMS.Most papers [1,[13][14][15][16][17][18][19][20][21] focus on minimizing users' electricity usage cost, while retaining users' comfort level at a predefined range.For example, in [16], the authors developed a smart-grid strategy that matches renewable energy generation (i.e., wind and solar power) with the heating, ventilation, and air conditioning (HVAC) load.In [19], the thermostatically controlled household loads are scheduled based on electricity price and energy consumption forecasts by considering users' comfort level to minimize electricity cost.In order to minimize the energy payment, the authors in [20] proposed a multistage optimization-based real-time residential load management algorithm that takes into account load uncertainty.These algorithms are single objective optimization algorithms, where user comfort is transformed into a set of constraints.These algorithms do not quantitatively consider users' comfort level during operation.However, from the users' point of view, in addition to monetary expense, high comfort level is another objective that they pursue.Unfortunately, the objectives of cost and comfort level are conflicting.Therefore, compared with single objective optimization algorithms that only consider energy payment, the multiobjective optimization algorithm that not only minimizes monetary expense but also maximizes comfort level simultaneously is more attractive and natural.
For the moment, the multiobjective optimal scheduling algorithm for HEMS has not been well investigated.In [22], the authors proposed an optimal residential energy consumption scheduling framework to achieve a tradeoff between minimizing payment and waiting time for the operation of each household appliance.In [22], waiting time is used to indicate user's comfort level.Although this method is suitable to washing machine (WM), clothes dryer (CD), and dishwasher (DW), it is meaningless for HVAC and electric water heater (EWH), where the user's concern is temperature.In [23], the authors developed a multiobjective air conditioning control algorithm based on immune clonal selection programming to determine the day-ahead 24 h temperature schedule for air conditioning.In addition to electricity cost, the expected error for the desired indoor temperature is introduced as a user comfort level indicator and optimized as an objective of the algorithm.However, this indicator cannot reflect users' temperature preferences in different seasons.
In smart grid, a residential customer not only has home appliances that consume electricity, but also may have distributed renewable generation (e.g., wind and PV) and batteries which may have extra electricity sold to the grid for revenue as presented [1,14].However, the optimal scheduling algorithms proposed in those papers did not consider the power distribution relationships among loads, batteries, distributed renewable generation, and grid.For example, the algorithms in [17][18][19][20][21][22][23] only schedule the operation of loads.The systems proposed in [13][14][15][16] include load, storage system, and distributed renewable generation, where the ability to sell electricity to the grid is not considered.Although the system described in [1,14] consists of loads, batteries, and renewable generation and the user has the ability to sell electricity to the grid, the power distribution relationships among different components of HEMS are not thoroughly investigated.
This paper proposes a HEMS framework that includes loads, batteries, and renewable generation interconnected with the grid through a smart mater.In this framework, the user can sell the electricity generated by renewable sources or stored in batteries to the grid for profit.A set of comfort level indicators are proposed for different home appliances.Based on these indicators, a multiobjective optimal schedule model is built, which minimizes monetary expense and maximizes user comfort level simultaneously.An improved hybrid discrete particle swarm optimization (PSO) is employed to solve the model, and a multiobjective optimization algorithm for HEMS is proposed.The algorithm schedules the operation of home appliances, batteries, and renewable generation (i.e., PV) as well as the optimal power distribution among loads, batteries, renewable generation, and grids.
The rest of this paper is organized as follows.Section 2 proposes a framework of HEMS and presents models and constraints of home appliances and batteries.Section 3 describes the comfort level indicators for different home appliances and the formulation of the HEMS optimization problem, including the optimization objectives and constraints.Section 4 presents a multiobjective optimization algorithm based on an improved hybrid discrete PSO technique.Section 5 provides a case study and compares the simulation results of the proposed algorithm with other algorithms proposed in the literature.Section 6 concludes the paper.

DR Abilities of Different Home Appliances.
In terms of the schedulability, home appliances can be divided into two categories: schedulable appliances (SAs) and nonschedulable appliances (NSAs).SAs refer to the appliances whose operations can be scheduled to a certain extent without reducing user's comfort level, such as WM, CD, DW, HVAC, and EWH.On the contrary, NSAs are the appliances whose operations must be started immediately when users need their services, such as computer, television, microwave oven, and light.NSAs are also called critical loads.SAs can be further classified into two groups: interruptible loads and uninterruptible loads.For example, PHEVs are interruptible loads.Uninterruptible loads refer to the appliances whose operations can be delayed, but after being started, they must be kept working until the tasks are completed, such as WM and DW.
Although several papers investigate the controlling methods for low power consumption appliances, such as refrigerators and coffee maker, they are not evident for DR due to their low power consumption compared with the overall household power consumption [24].In this paper, we choose HVAC, EWH, PHEV, WM, CD, and DW as scheduling objects to implement DR in household.
Battery is another important kind of interruptible SA.The battery can be used to store surplus energy generated by renewable sources (e.g., PV) or the energy from the grid when the electricity price is low.The stored electric energy can be supplied to loads or sold back to the grid for revenue when the price is high.Therefore, battery is another scheduling object in this paper.

Framework of the HEMS.
The framework of HEMS proposed in this paper is shown in Figure 1.As mentioned above, the framework includes loads (i.e., NSAs, SAs, and PHEV), home energy storage battery, and renewable generation (i.e., PV).It must be pointed out that PHEV is a special kind of loads.Different from other loads, a PHEV not only can act as a load that absorbs electricity from the grid or renewable generation, but also, in some special cases, acts as a power source through the vehicle-to-grid (V2G) or vehicleto-home (V2H) function [25,26].In this paper, the PHEV is considered as a load only.
The two-way energy and information exchange between HEMS and the grid is realized through a smart meter.The smart meter is responsible for transmitting consumption data from home appliances to the utility company and it also relays the electricity price signal from the utility company back to a controller.For the moment, there are different timebased pricing tariffs including time-of-use (TOU) tariff, critical peak pricing (CPP) tariff, and real-time pricing (RTP) tariff [27].This paper uses day-ahead RTP; in other words, the electricity price of every hour is published by the utility company to residents one day ahead.
The controller is the kernel of HEMS.Each HEMS component communicates with the controller over a home area network (HAN), which can be realized through Zigbee communication technology [28].The controller connects with the Internet by a broadband access unit (BAU) and gets weather information including outdoor temperature forecast via the Internet.Through the controller, the user can set parameters and configure the system.
In the framework, the schedulable appliances (i.e., HVAC, EWH, WM, CD, and DW), PHEV, and battery are scheduled by the controller to minimize the electricity cost and maximize user comfort level according to the electricity price, user preferences, and PV power output.

Power Distribution Relationships of the HEMS.
In the proposed framework, the power distribution relationships among loads, battery, PV, and grid are shown in Figure 2. In this figure, the components enclosed by the dash line, that is, loads, PV, and battery, are owned by the user, and they are the scheduling objects of the proposed algorithm. G2L  is the power that is transmitted from grid to loads at time .Similarly,  P2L  and  B2L  are the power transmitted from PV and battery to loads,  G2B  and  P2B  represent the power transmitted to the battery from grid, and PV,  P2G  , and  B2G  stand for the power transmitted to grid from PV and battery at time , respectively.The values of these power distributions are equal to or greater than zero.
Under the RTP scheme, the scheduling of loads and power distribution among different components affect the total monetary expense.As a result, besides load management, optimal control of the power distributions among grid, loads, battery, and PV is another important issue for the optimization goals.This problem will be discussed in detail in Section 3.

Models and Constraints of Individual Appliances.
The model of each appliance used in this paper and the corresponding constraints are described as follows.

HVAC.
The HVAC model developed in [29] is adopted in this paper.In this model, the room temperature is calculated as where  Room  and  Room

𝑡+1
are the room temperatures ( ∘ F) in time slots  and +1, respectively; Δ is the length of time slot  in hours;   is the heat gain rate of the house in Btu/h during time slot ; Δ is the energy needed to change the temperature of the air in the room by 1 ∘ F (Btu/ ∘ F);  HVAC is the cooling/heating capacity of HVAC in Btu/h, positive for heating and negative for cooling;  HVAC  is the working status of HVAC in time slot , 1 for on and 0 for off.For simplicity, it is assumed that the HVAC runs with its rated power,  HVAC (kW), when it is turned on.
In order to ensure the comfort preference, HVAC should regulate the room temperature within the certain range prespecified by the user.This constraint is depicted in where  Room min and  Room max stand for the minimum and maximum room temperatures, respectively.[2] is employed in this paper to calculate the temperature of hot water inside the EWH tank:

EWH. The model presented in
where  EWH  and  EWH +1 are the hot water temperatures ( ∘ F) inside the EWH tank in time slots  and  + 1, respectively;  EWH,env  and  EWH,in  are the temperatures ( ∘ F) of ambient environment and inlet water in time slot , respectively;  is the equivalent thermal mass (Btu/ ∘ F); Δ is the length of a time slot in hours;  EWH is the ratio of the surface area of EWH to the thermal resistance of the tank.  ,    , and   are calculated according to the following equations, respectively: where  water is the density of water,   is the specific heat of water, and   represents hot water flow rate in time slot . EWH is the rated power of the EWH (kW) and  EWH  is the status of the EWH in time slot .
The EWH has two statuses, on and off.When turned on, it runs with the rated power, and the hot water temperature increases exponentially; otherwise, the temperature decreases.Similar to HVAC, the EWH should maintain the hot water temperature within a prespecified range where  EWH min and  EWH max are the minimum and maximum water temperatures set by a user, respectively.This constraint is expressed by

PHEV.
The battery state-of-charge (SOC) relationship of PHEV [29] is calculated according to where SOC PHEV  and SOC PHEV

𝑡+1
are the PHEV battery SOC in time slots  and  + 1, respectively;  PHEV size is the rated capacity of PHEV battery (kW⋅h); Δ is the length of a time slot in hours;  PHEV  is the charging power of PHEV in time slot  (kW); in this paper, it is assumed that the charging power is constant, that is, the rated charging power of PHEV,  PHEV (kW).Therefore,  PHEV  is determined by where  PHEV  is the charging status of PHEV in time slot , with 1 representing on and 0 representing off.
To protect the PHEV battery from damage, the battery SOC should be maintained in a safe range of [SOC PHEV min , SOC PHEV max ], where SOC PHEV min and SOC PHEV max are the minimum and maximum allowable PHEV battery SOC.To satisfy user's transportation demand, the PHEV battery should be charged each day with a SOC equal to or greater than the prespecified SOC, SOC PHEV final .These two constraints are depicted in the following, respectively: where SOC PHEV  slot is the PHEV battery SOC in the final time slot (i.e., time slot  slot ) of the scheduling horizon. slot denotes the total number of the time slots in the scheduling horizon.
2.4.4.WM, CD, and DW.In this paper, WM, CD, and DW are taken as noninterruptible appliances; in other words, these appliances have two statuses, on and off.Once they are turned on, they must keep working with the rated power until their tasks are completed.The task starting time and the number of time slots that are needed for completing the task of each appliance are set by the user.They should meet the constraints where  ∈ {WM, CD, DW};   start is the time slot in which the task of home appliance  is started;   task is the number of time slots that are needed to complete the task of appliance ;    is the working status of appliance  in time slot , with 1 representing on and 0 representing off.
The power of appliance  in time slot ,    , is calculated as where   is the rated power of appliance .

Battery.
In order to prevent the home energy storage battery from overcharge and overdischarge, the battery SOC should always be maintained within a specified range [SOC Bat min , SOC Bat max ], where SOC Bat min and SOC Bat max are the minimum and maximum allowable SOC of the battery, respectively.This constraint is depicted in The battery SOC associated with the charge and discharge of the battery is calculated by the following equations, respectively: where  Bat size is the rated battery capacity (kW⋅h); SOC Bat  and SOC Bat +1 are the battery SOC in time slots  and  + 1, respectively;  Bat,ch  and  Bat,disch  represent the charging and discharging power in time slot , respectively,  Bat ch is the charging efficiency; and  Bat disch is the discharging efficiency.
To ensure the safety of operation, the charging and discharging powers should be controlled to be equal to or smaller than the maximum allowable values.As shown in Figure 2, the battery can be charged by power from the grid  G2B

𝑡 and PV 𝑝 P2B
; on the other hand, the battery can also supply electricity to loads  B2L  and grid  B2G  .Consequently, the constraints about charging and discharging power are formulated as follows, respectively: where  Bat,ch max and  Bat,disch max are the maximum allowable charging and discharging power of the battery, respectively.
The battery is not allowed to supply electricity to loads or the grid when it is in charging state, or to be charged when it is supplying electricity to loads or the grid.This constraint is formulated as 2.4.6.Other Constraints.Besides the constraints mentioned above, other constraints are described as follows: where  PV  is the power output of PV in time slot  in kW and  CL  is the total power of the critical loads (i.e., nonschedulable loads) in time slot  in kW.

Multiobjective Optimization of HEMS
3.1.Electricity Cost.In this paper, minimizing the overall electricity cost over the next 24 hours (i.e., next day) is one of optimization objectives based on the forecasted outdoor temperature and power output of PV over the next 24 hours, which can be obtained using the corresponding prediction algorithms [30,31].However, these algorithms have limitations due to the prediction accuracy.In this study, scenarios are used to capture the uncertainties of forecasted outdoor temperature and power output of the PV.The overall net electricity cost over the scheduling horizon is formulated as (21), which consists of three parts: the first item represents the overall electricity cost of buying electricity from the grid, the second item stands for the degradation cost ($) of the home energy storage battery, and the third item denotes the overall revenue of selling electricity to the grid: where s temp and s PV denote the outdoor temperature and PV power output scenario sets, respectively;  1 represents an outdoor temperature scenario and  2 stands for a PV power output scenario;   1 and   2 denote the occurrence possibility of scenario  1 and  2 , respectively;  grid  is the electricity price in time slot  when the user buys electricity from the grid; and  sell  is the electricity price in time slot  when the user sells electricity to the grid. G2L,s 1  2  denotes the power transmitted from the grid to loads in the scenario when  1 and  2 occur at the same time, and other symbols have similar meanings.
Deg is the battery degradation cost ($/kW⋅h); the detailed description and calculation method of it can be found in [3].

Comfort Level Indicator for Home Appliances.
In practice, a residential user has different concerns for different home appliances.For example, for HVAC and EWH, the user pays more attention to temperature; however, for PHEV, WM, CD, and DW, the user focuses on when the tasks of these appliances are completed.Therefore, a set of comfort level indicators are proposed based on appliance type.

HVAC.
To quantify a user's comfort level under the operation of HVAC, this paper proposes a comfort level indicator whose definition is based on the assumption that when the room temperature is equal to the user setting temperature, the user is most comfortable; if the room temperature deviates from the setting value to a certain extent, the user's comfort level will be decreased [32].The indicator is calculated as where where  3. The indoor temperature horizon is divided into three zones by these parameters: comfortable zone, tolerable zone, and intolerable zone.

EWH. The definition of comfort level indicator for
EWH is similar to that for HVAC, and it is calculated as where

𝐿
, and Δ EWH  are user setting parameters whose meanings are similar to the parameters of HVAC comfort level indicator. EWH is in the range of [0, 100] too.

PHEV.
A user's comfort level about PHEV is determined by the charging finish time.The user is most satisfied in the case where once a PHEV is plugged in and it is kept charging until the PHEV battery SOC reaches the specified value.In reality, the user can tolerate some delay of the charging finish time, which makes the PHEV a flexible load.However, this tolerance is limited; if the delay is too long, the user will be unsatisfied.Based on these facts, the comfort level indicator for PHEV is calculated as where  plug is the time shot when the PHEV is plugged in;  charge is the number of time slots that are needed to complete a charging task;  delay is the maximum tolerant delay of charging completion time in time slot;  PHEV fsoc is the time slot in which the PHEV battery SOC reaches the specified value;  end is the last time slot of the scheduling horizon.According to the definition,  PHEV is within [0, 100].Figure 4 illustrates the relationships among these parameters.

WM, CD, and DW.
The comfort level indicators for WM, CD, and DW share the same expression, and they are calculated as where   min and   max specify the valid working interval for appliance ;   ideal is the ideal time slot in which the appliance  is started, and it is set by a user;   start is the actual starting time slot of appliance ;   work denotes the number of time slots that are needed by appliance  to complete its task;   delay is the tolerant delay of task finish time.The relationships of these parameters are depicted in Figure 5.   is in the range of [0, 100] too.
For home appliance , if its task is started before or in the time slot   ideal +   delay , the user will be satisfied; if the task is started in the range of [  ideal +   delay ,   max −   work ], the task can be completed before the deadline; however, the user's comfort level will be decreased.
It must be pointed out that, according to the comfort level indicators' definitions, the smaller these indicators, the more comfortable the user.For example, the user is most comfortable when  HVAC is equal to zero.
Based on the above definitions, the user's overall comfort level during the scheduling horizon is formulated as where

𝑎
denotes the comfort level indicator value of appliance  in the scenario when outdoor temperature scenario  1 and PV power output scenario  2 occur at the same time and  |A| is the number of appliances in schedule home appliance set A.  comfort is within [0, 100].When  comfort is zero, the user is most comfortable.7) , (10)-( 12), ( 14) , (17)- (20).(28) In this model, the working status of HVAC, EWH, and PHEV in each time slot and the task starting times of WM, CD, and DW are decision variables.Minimizing electricity cost and maximizing user comfort level are the two objectives.

Algorithm Design
where  is called user preference factor, 0 ≤  ≤ 1, through which a user can take a tradeoff between the electricity cost and the comfort level conveniently.
To handle the constraints of model ( 29), the penalty function method is used.Model ( 29) is further transformed into where  final is the final objective function,  is a positive figure that is big enough, and  viol is the overall violation value: viol only considers constraints (2), (7), and (10).Other constraints can be guaranteed to be satisfied by other methods presented in Section 4.3.
Model ( 30) is solved by an improved high-dimensional hybrid discrete particle swam optimization algorithm presented in the following section.

Improved Particle Swarm Optimization. PSO is originally
proposed by Kennedy to solve unconstrained continuous single objective optimization problems [33], and it is a kind of stochastic search algorithms.Due to its simplicity, strong search ability, and robustness, PSO has been explored in depth, many improved PSO algorithms have been proposed in the literature, and its application has not been limited to continuous optimization problems anymore.Algorithms based on PSO have been applied in many engineering optimization fields [34][35][36][37].Therefore, in this paper, an improved PSO is employed to solve the optimization model depicted in (30).
Although the basic PSO has many advantages, it has the drawback of premature convergence and local optima [38].The performance of PSO algorithm can be improved by identifying the particles which fell into local optimal area and performing crossover, mutation, local search, reset, or reinitialization on these particles during operation [39].For this purpose, [40] assigns a counter for each particle in the population; at each iteration, the fitness value of each particle is compared with the global best particle's fitness value.If the absolute value of the fitness value difference between a particle and the global best particle is smaller than a predefined threshold, the particle's counter is increased by 1, and then the counter is checked as to whether it reaches the specified maximum value; if so, the particle's position and velocity vectors are initialized and the corresponding counter is reset.This method is effective in some cases.However, if the particle which fell into local optimal area is not in the same area with the global best particle that keeps evolving, the absolute value of the fitness value difference may be kept greater than the specified threshold.As a result, the particle which fell into local optimal area cannot be identified.
To overcome this problem, a novel "worst particles" identification method is proposed to find out the particles that fell into local optimal area based on the update of each particle's personal best position vector and the sorted particle fitness values.This method is described as follows.
Similar to [40], each particle in the population has a counter.However, different form [40], the counter is used to record the number of iterations in which the particle's personal best position vector is not updated successively.The counter is named personal-best-update counter and updated as where   () and   (−1) denote the counter values of particle  at iterations  and  − 1, respectively and P  best () and P  best ( − 1) are the personal best position vectors of particle  at iterations  and  − 1, respectively.
After updating each particle's counter, the particles in the population are sorted decreasingly according to their fitness values.If the optimization is minimization, the smaller the function value is, the greater the fitness value will be.Within the last   sorted particles, the particles whose counters are equal to or greater than the specified threshold  th are selected to create a particle set named worst-particle-set.Λ() denotes the worst-particle-set created at iteration , and the  if |Λ()| > 1, a particle is selected randomly from Λ() as the worst particle.Finally, the selected worst particle is initialized and the corresponding counter is reset.

Algorithm Based on Improved Hybrid PSO.
Based on the improved PSO algorithm described in Section 4.2, a multiobjective optimization algorithm for HEMS is described in this section.
In this optimization algorithm, the th decision vector of the optimization model ( 30) is depicted as where As shown, S HVAC , S EWH , and S PHEV are binary vectors, and T start is a discrete vector.Therefore, the decision vector X d  is a typical hybrid vector with a dimension of 3 slot + 4 −  plug .
The dimension is related to the time slot when the PHEV is plugged in.For example, in the case that the scheduling horizon is 24 hours and is evenly divided into 120 time slots (i.e., the length of each time slot is 12 minutes) and the PHEV is plugged in at time slot 91, the dimension of ( 33) is 273.In this paper, it is assumed that the PHEV can be guaranteed to be plugged in power grid through HEMS during [ plug ,  slot ].
In the algorithm, the position vector of each particle represents a decision vector of model (30).The principal procedure of the proposed multiobjective optimization algorithm for HEMS in smart grid is described as follows.
Step 1. Get electricity price and forecasted weather information of the scheduling horizon from the utility company and the Internet, respectively.Based on the weather forecast information, the power output of PV during the scheduling horizon is predicted.
Step 2. Generate a set of outdoor temperature scenarios and PV power output scenarios using Monte Carlo simulations.
Step 3. Set parameters of PSO, such as population size  pop , maximum iteration number  max , maximum velocity weight  max , minimum velocity weight  min , thresholds  th , and   .
Step 4. Set user preference parameters, such as preference factor ,   grid.In this paper, the production cost of PV is assumed to be negligible.
Bat  denotes the price of the energy stored in the home energy storage battery in time slot , its value is determined by charging operation, and it is not affected by discharging.

𝑐 Bat
is calculated as follows [1]: where  Bat  and  Bat +1 denote the energy in kW⋅h stored in the home energy storage battery in time slots  and  + 1, respectively.
Bat,sell  stands for a threshold of grid electricity price in time slot .If the grid electricity price  grid  is greater than  Bat,sell  , the home energy storage battery is allowed to sell the stored energy to the grid for revenue. Bat,sell  is calculated as sell controls the possibility of selling the energy stored in the home energy storage battery to the grid in time slot ; the smaller  sell is, the greater the possibility will be. Bat,buy  is another threshold of grid electricity price in time slot .If the grid electricity price  grid  is smaller than  Bat,buy  , the home energy storage battery is allowed to buy electricity from the grid for charging.   buy controls the possibility of buying electricity from the grid to charge the home energy storage battery in time slot .The greater the  buy is, the greater the possibility will be.
From the algorithm described in Section 4.3 and the power distribution vector calculation method presented in this section, it can the said that the constraints of (30), that is, constraints ( 11)-( 12), (14), and ( 17)- (20), are ensured to be satisfied.

Case Studies
In this section, to validate the effectiveness of the algorithm proposed in this paper, simulations were performed extensively.All simulation programs were coded in C language in the environment of Microsoft Visual Studio 2008 and were run on a Windows 7 (32 bit) Intel Core i7-3540 M@3.00 GHz computer with an 8.00 GB memory.

Input Data and Parameter
Setting.The scheduling horizon is 24 hours, and it is divided evenly into 120 time slots with each time slot being 12 minutes; that is,  slot = 120, Δ = 0.2 h.
The data of real-time electricity price and outdoor temperature from [41], hot water usage from [42], and critical load from [43] are utilized.The electricity price, outdoor temperature, hot water usage, and critical load are shown in Figures 7, 8, 9, and 10, respectively.
In this paper, it is assumed that the capacity of the PV system in Figure 1 is 5.75 kW and the PV power output during scheduling horizon is as shown in Figure 11.In each time slot, the price of selling electricity to the power grid by a user,  sell  , is assumed to be equal to the price that he/she pays for buying electricity from the grid,  grid  .Based on the forecasted outdoor temperature and PV power output, two sets of stochastic scenarios were generated which are shown in Figures 12 and 13, respectively.
The parameters of house and HVAC of [24] are used in this paper, which are listed in Table 1.The parameters of EWH are as follows.The volume of EWH tank is 50 gallons,  EWH is 1.0 (Btu/(h * ∘ F)),  is As for the PHEV,  PHEV size is 16 (kW⋅h), SOC PHEV 0 is 0.5,  PHEV is 3.3 (kW), and SOC PHEV min , SOC PHEV max , and SOC PHEV final are 0.2, 0.95, and 0.85, respectively.It is assumed that the PHEV is plugged in the grid in time slot 91; that is,  plug = 91. charge is 9,  delay is 3, and  end =  slot = 120.
The parameters of WM, CD, and DW are listed in Table 2.
As for the home energy storage battery, the rated battery capacity  Bat size is 13.44 (kW⋅h),  Bat 0 is 6.72 (kW⋅h), SOC Bat min is 0.2, SOC Bat max is 1.  Bat,ch max =  Bat,disch max = 2.0 (kW), and  Bat ch =  Bat disch = 0.9.It is assumed that the battery is leadacid battery; the capital cost is 2176 ($).The degradation cost function coefficients in [44] are used.
As described in Section 4.4,  sell and  buy are two important parameters that affect the power distributions between the grid and home energy storage battery.In the simulations, they are 0.6 and 0.8, respectively.
The parameters of PSO are as follows.The population size  pop is 30 and the maximum iteration number  max is 3000. min ,  max ,  th , and  c are 0.2, 0.9, 20, and 5, respectively.According to the values of  slot and  plug , the dimension of position vector and velocity vector of each particle is 273.

Case Description.
For comparison, different cases were studied, and the input data and parameter setting in all cases are the same as those presented in Section 5.1.These cases are summarized as follows.
Case 1.It is the multiobjective optimization algorithm for HEMS proposed in this paper, and the scheduling objects are PHEV, EWH, PHEV, WM, CD, DW, and home energy storage battery.In this case, the user has the ability to sell electricity to the grid for revenue.The power distributions among grid, loads, PV, and battery are demonstrated in Figure 2.
Case 2. It is a single objective optimization algorithm that minimizes the electricity cost.Other aspects of Case 2 are the same as those in Case 1.
Case 3. It is a single objective optimization algorithm that minimizes the electricity cost too.However, the user does not have the ability to sell electricity to the grid for revenue.The home energy storage battery is used to store the excessive energy generated by the PV.In this case, if the power output from PV is greater than the sum of load demand and the charging power of home energy storage battery, the excessive energy will be discarded.
Case 4. This case is similar to Case 3 except that, in this case, the operations of home appliances are not optimally scheduled by any algorithm and the user uses these appliances without considering the electricity price, PV power output, and forecasted outdoor temperature.

Cost and Comfort
Level.The simulation results of these four cases are listed in Table 3.
For Cases 1, 2, and 3, the algorithms were run independently 30 times with different initializations.The results presented in Table 2 are the average values of different runs.For Case 1, the user preference factor  is 0.5.
From Table 3, we can see that the user is most comfortable in Case 4.However, in this case, the user's net electricity cost is the highest because of not considering the electricity price and PV power output.During the operations of the PHEV and CD, the electricity price is high and the PV power output is low, which increases the electricity cost.The power from PV is supplied to the loads and the home energy storage battery.When the PV power output is high (e.g., time slots 60-90), the excessive power is discarded due to the inability to sell electricity to the utility grid for revenue.Therefore, the PV utilization efficiency is very low.
In Case 3, the schedulable home appliances and the home energy storage battery are optimally scheduled according to electricity price, PV power output, forecasted outdoor temperature, and user preferences.The power consumption on peak hours is shifted to off-peak hours or hours when the PV power output is high, more demand of loads is met by the PV, and the PV utilization efficiency is improved significantly.As a result, the amount of electricity purchased from the grid and the overall net cost are reduced.Compared with Case 4, the electricity purchase cost and net cost of Case 3 are reduced by 32.76% and 18.27%, respectively, at the cost of user comfort level.
In Cases 1 and 2, the user has the ability to sell electricity to grid for revenue.Therefore, the excessive power of PV can be sold to the utility grid, and there is no power wasted.In addition, the home energy storage battery can absorb electricity from the grid when the electricity price is low and supply the stored energy to loads or sell back to the utility grid for profit when the electricity price is high.These two factors contribute to overall net cost reduction.On the other hand, because the home energy storage battery absorbs electricity from the grid, the costs of purchasing electricity from the grid in Cases 2 and 1 are higher than that of Case 3.Meanwhile, more energy is charged to or discharged from the home energy storage battery; therefore, the battery degradation costs in the two cases are higher than those in Cases 3 and 4.However, due to the gain of selling electricity to the utility grid, compared with Case 3, the net costs of Cases 2 and 1 are reduced by 15.55% and 8.92%, respectively.Consequently, we can say that the framework of HEMS proposed in this paper is better than other frameworks that only include parts of these components or without the ability to sell electricity to the utility grid.Compared with Case 2, the net cost of Case 1 is increased by 7.85%.However, the comfort level of Case 1 is improved by 32.36%.Besides this improvement, in Case 1, the user can take a tradeoff between the electricity cost and comfort level through the preference factor  conveniently, and the user's comfort level is quantified.Based on these results, we can conclude that the multiobjective optimization algorithm proposed in this paper is superior to the single objective algorithms in Cases 2, 3, and 4.

Operation States of Schedulable Home Appliances.
When the forecasted outdoor temperature scenario is  6 and PV power output scenario is  8 , the operation states of schedulable home appliances under the control of the algorithm proposed in this paper are shown in Figure 14.
As shown in Figure 14, the temperatures of room and water in the tank of EWH are within their prespecified ranges.Most charge power for PHEV is shifted from high price hours to low price hours, and the final SOC of the PHEV battery has reached the specified value.WM, CD, and DW finish their tasks before their deadlines.

Power Distributions among Grid, Load, PV, and Battery.
When the operation states of schedulable home appliances are as shown in Figure 14, the corresponding power distributions among grid, load, PV, and battery are demonstrated as follows.
The power distributions between the grid and the home energy storage battery are shown in Figure 15.
From Figure 15 we can find that when the electricity price is low, that is, between time slot 1 and time slot 62, the home energy storage battery absorbs electricity from the grid; when the price is high, that is, between time slot 63 and time slot 110, it sells the stored electricity to the grid for profit.
The SOC, charging power, and discharging power of the home energy storage battery are shown in Figure 16.
Figure 16 shows that the SOC of the home energy storage battery is within the specified range during the scheduling horizon.Between time slot 1 and time slot 62, most charging power is from grid; between time slot 63 and time slot 95, most charging power is from PV.Before time slot 50, the power discharged from the home energy storage battery is supplied to loads; between time slots 51 and 120 and the discharged power is supplied to loads and sold to the grid.
Figure 17 displays the power distributions from PV to loads, battery, and grid.
Figure 18 depicts the power distribution that is transmitted from the grid to HEMS, that is, the power that is purchased by the user in each time slot.
As shown in Figure 18, HEMS purchases electricity from the utility grid when the electricity price is low.When the price is high, the amount of electricity purchased from the utility grid is reduced or even does not buy electricity any more.For example, from time slot 61 to time slot 90, HEMS does not buy electricity from the grid because of the high electricity price.

Parameter Analysis.
To demonstrate the effect of preference factor to optimization results, the input data and other parameters are kept the same as those in Case 1, and the multiobjective optimization algorithm was run with different preference factors.The optimization results are shown in Figure 19.
As shown in Figure 19, when the user preference factor increases from 0 to 1, the electricity cost decreases from 169.18 cents to 126.34 cents and the comfort level indicator increases from 13.55 to 36.77.In other words, with the increase of preference factor, the electricity cost increases and the user feels less comfortable.
The optimization algorithm runs with different  sell while the other parameters and input data are kept the same as those in Case 1. Figure 20 shows the relationship between the total energy that is transmitted from battery to the grid and  sell .
As shown in Figure 20, with the increase of  sell , the total amount of energy that is transmitted from the home energy storage battery to grid decreases.The reason is that the greater  sell decreases the possibility of selling the stored energy to the grid for revenue.
Figure 21 depicts the relationship between the total energy that is transmitted from the grid to the home energy storage battery and  buy .
As shown in Figure 21, with the increase of  buy , the total amount energy that is transmitted from the grid to the home energy storage battery increases.The reason is that greater  buy means more chances of buying electricity from the grid to charge the home energy storage battery when the electricity price is low.

Runtime and Robustness of Algorithm.
The parameters and input data were kept as described in Section 5.1, and the maximum iteration number was set to 3000.The algorithms in Cases 1, 2, and 3 were run 30 times, respectively, and the statistics of runtime and final fitness value were obtained.The results are displayed in Table 4.
As presented in Table 4, the runtimes in Cases 1 and 2 are longer than that in Case 3. The reason is that the former two cases need to determine the power distribution among loads, PV, battery, and grid through the method described in   Section 4.4.Because the proposed multiobjective optimization algorithm for HEMS is an offline optimization algorithm, the runtime is acceptable for practical applications.
In fact, compared to the algorithm in [1], it is very fast.In addition, from the standard deviations of runtime and fitness value in Table 4, we can say that the proposed algorithm is robust enough for application.

Conclusion
In smart grid, implementing DR in residential sector through HEMS has attracted much interest of both academic researchers and industrial engineers.This paper first proposes a framework of HEMS including grid, load, PV, and home energy storage battery.In this framework, a user has the ability to sell electricity to utility grid for revenue.In order to quantify user's comfort level during the operation of home appliances, a set of comfort level indicators are proposed based on home appliance's characteristics and user's preferences.A novel multiobjective optimization algorithm for HEMS is proposed, which minimizes the electricity cost and maximizes the comfort level of the user simultaneously.The algorithm optimally controls the operations of schedulable home appliances, such as PEHV, EWH, WM, CD and DW, and the power distributions among grid, load, PV, and battery according to the electricity price, power output of PV, forecasted outdoor temperature, and user preferences.The stochastic natures of PV generation and outdoor temperature are considered and modeled by scenario method.The control of both home appliances and power distributions among different components of HEMS is investigated in depth by simulations.The computation time and robustness of the proposed algorithm are acceptable for practical applications.
The results demonstrate that, compared with other framework of HEMS and algorithms, the framework of HEMS and

Figure 1 :
Figure 1: Framework of the HEMS in smart grid.

Figure 3 :
Figure 3: Relationships among parameters of HVAC comfort level indicator.

Figure 6 :
Figure 6: Flowchart of power flow vectors calculation method.

Figure 12 :Figure 13 :
Figure 12: Scenarios of outdoor temperature over scheduling horizon.

Figure 19 :
Figure 19: Relationship between optimization results and preference factor.

Figure 20 :
Figure 20: Relationship between total energy transmitted from the home energy storage battery to grid and  sell .

Figure 21 :
Figure 21: Relationship between total energy transmitted from the grid to the home energy storage battery and  buy .
According to the definition of  HVAC , it is within [0, 100].
, and Δ Room  are demonstrated in Figure StartCalculate the overall user demand in time slot t including the critical load and the load of schedulable home appliances.The overall demand is denoted by ∑ a p a

Table 1 :
Parameter of the house under study.

Table 2 :
Parameter setting of CW, CD, and DW.

Table 3 :
Simulation results of different cases.

Table 4 :
Statistics of runtime and fitness value.