#### Abstract

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 a multiobjective 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.

#### 1. 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–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–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 two-way 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–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–23] only schedule the operation of loads. The systems proposed in [13–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.

#### 2. System Model

##### 2.1. 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.

##### 2.2. 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 vehicle-to-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 time-based 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.

##### 2.3. 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. is the power that is transmitted from grid to loads at time . Similarly, and are the power transmitted from PV and battery to loads, and represent the power transmitted to the battery from grid, and PV, , and 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.

##### 2.4. Models and Constraints of Individual Appliances

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

###### 2.4.1. HVAC

The HVAC model developed in [29] is adopted in this paper. In this model, the room temperature is calculated aswhere and are the room temperatures (°F) in time slots and , 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); is the cooling/heating capacity of HVAC in Btu/h, positive for heating and negative for cooling; 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, (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 inwhere and stand for the minimum and maximum room temperatures, respectively.

###### 2.4.2. EWH

The model presented in [2] is employed in this paper to calculate the temperature of hot water inside the EWH tank:where and are the hot water temperatures (°F) inside the EWH tank in time slots and , respectively; and 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; 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 is the density of water, is the specific heat of water, and represents hot water flow rate in time slot . is the rated power of the EWH (kW) and 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 and are the minimum and maximum water temperatures set by a user, respectively. This constraint is expressed by

###### 2.4.3. PHEV

The battery state-of-charge (SOC) relationship of PHEV [29] is calculated according towhere and are the PHEV battery SOC in time slots and , respectively; is the rated capacity of PHEV battery (kW·h); is the length of a time slot in hours; 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, (kW). Therefore, is determined bywhere 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 , where and 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, . These two constraints are depicted in the following, respectively:where is the PHEV battery SOC in the final time slot (i.e., time slot ) of the scheduling horizon. 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 constraintswhere ; is the time slot in which the task of home appliance is started; 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 aswhere is the rated power of appliance .

###### 2.4.5. 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 , where and 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 is the rated battery capacity (kW·h); and are the battery SOC in time slots and , respectively; and represent the charging and discharging power in time slot , respectively, is the charging efficiency; and 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 and PV ; on the other hand, the battery can also supply electricity to loads and grid . Consequently, the constraints about charging and discharging power are formulated as follows, respectively:where and 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 is the power output of PV in time slot in kW and is the total power of the critical loads (i.e., nonschedulable loads) in time slot in kW.

#### 3. 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 and denote the outdoor temperature and PV power output scenario sets, respectively; represents an outdoor temperature scenario and stands for a PV power output scenario; and denote the occurrence possibility of scenario and , respectively; is the electricity price in time slot when the user buys electricity from the grid; and is the electricity price in time slot when the user sells electricity to the grid. denotes the power transmitted from the grid to loads in the scenario when and occur at the same time, and other symbols have similar meanings. is the battery degradation cost ($/kW·h); the detailed description and calculation method of it can be found in [3].

##### 3.2. 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.

###### 3.2.1. 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 aswhere . is determined bywhere is the desired indoor temperature set by the user and and are two parameters that are related to the temperature deadband of HVAC and the user’s preference. For example, in summer, the user prefers cool. Consequently, in this case, . According to the definition of , it is within .

The relationships among parameters , , , , and are demonstrated in Figure 3. The indoor temperature horizon is divided into three zones by these parameters: comfortable zone, tolerable zone, and intolerable zone.

###### 3.2.2. EWH

The definition of comfort level indicator for EWH is similar to that for HVAC, and it is calculated aswhere and , , and are user setting parameters whose meanings are similar to the parameters of HVAC comfort level indicator. is in the range of too.

###### 3.2.3. 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 aswhere is the time shot when the PHEV is plugged in; is the number of time slots that are needed to complete a charging task; is the maximum tolerant delay of charging completion time in time slot; is the time slot in which the PHEV battery SOC reaches the specified value; is the last time slot of the scheduling horizon. According to the definition, is within . Figure 4 illustrates the relationships among these parameters.

###### 3.2.4. WM, CD, and DW

The comfort level indicators for WM, CD, and DW share the same expression, and they are calculated aswhere and specify the valid working interval for appliance ; is the ideal time slot in which the appliance is started, and it is set by a user; is the actual starting time slot of appliance ; denotes the number of time slots that are needed by appliance to complete its task; is the tolerant delay of task finish time. The relationships of these parameters are depicted in Figure 5. is in the range of too.

For home appliance , if its task is started before or in the time slot , the user will be satisfied; if the task is started in the range of , 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 is equal to zero.

Based on the above definitions, the user’s overall comfort level during the scheduling horizon is formulated aswhere denotes the comfort level indicator value of appliance in the scenario when outdoor temperature scenario and PV power output scenario occur at the same time and is the number of appliances in schedule home appliance set . is within . When is zero, the user is most comfortable.

##### 3.3. Multiobjective Optimization Model

The multiobjective optimization model for HEMS is formulated as

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.

#### 4. Algorithm Design

##### 4.1. Model Transformation

For simplicity the multiobjective optimization model proposed in Section 3.3 is transformed into a single objective optimization model by weighting method:where is called user preference factor, , 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 (30), which is a nonconstraint single objective optimization model and easy to solve:where is the final objective function, is a positive figure that is big enough, and is the overall violation value:

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.

##### 4.2. 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–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 aswhere and denote the counter values of particle at iterations and , respectively and and are the personal best position vectors of particle at iterations and , 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 are selected to create a particle set named worst-particle-set. denotes the worst-particle-set created at iteration , and the number of the particles in the set is , . If , the last particle of the sorted particles is selected as the worst particle; if , the particle in is selected; if , a particle is selected randomly from as the worst particle. Finally, the selected worst particle is initialized and the corresponding counter is reset.

##### 4.3. 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 aswhere

As shown, , , and are binary vectors, and is a discrete vector. Therefore, the decision vector is a typical hybrid vector with a dimension of . 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 .

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 , maximum iteration number , maximum velocity weight , minimum velocity weight , thresholds , and .

*Step 4. *Set user preference parameters, such as preference factor , , , , , , and .

*Step 5. *Initialize particle population:(1)Initialize position vector , velocity vector , and personal best vector .(2)Calculate power distribution vectors , , , , , , and based on electricity price, PV power output, and (i.e., ). Here, , and the other power distribution vectors have similar forms. The calculation procedure of these vectors is described in Section 4.4.(3)Calculate the objective function value according to (30).(4)After initializing all particles in the population, initialize the global best particle’s position vector.(5)Reset iteration counter and personal-best-update counter of each particle.

*Step 6. *Compute the velocity weight [38] at iteration as

*Step 7. *For each particle in the population, perform the following operations.Update the velocity vector aswhere and denote the values of the th dimension of particle at iterations and , respectively; and are two random uniform distribution stochastic variables within ; are two learning factors; is the th dimension of the personal best vector of particle ; is the th dimension of the global best position vector.Update the position vector .

The first part of , that is, , is updated aswhere is a random uniform distribution stochastic variable within .

The second part of , that is, , is updated aswhere the symbol denotes rounding to zero.Calculate power distribution vectors , , , , , , and .Calculate the objective function value according to (30).Update the personal best position vector according to (39) and the personal-best-update counter according to (32):Update the global best position vector:

*Step 8. *Identify the worst particle which fell into local optimal area as follows:(1)Create the worst-particle-set following the method described in Section 4.2.(2)Select the worst particle and reinitialize it and reset the corresponding personal-best-update counter.

*Step 9. *Increase the iteration counter by 1. Check whether the iteration counter reaches the maximum number or not. If not, jump to Step 6; if so, continue Step 10.

*Step 10. *Calculate the electricity cost indicator and comfort level indicator as follows:(1)Output the global best position vector.(2)Calculate the power distribution vectors.(3)Calculate the electricity cost indicator and comfort level indicator according to (21) and (27), respectively. Check whether the user is satisfied with the indicators or not. If not, jump to Step 4; if so, continue Step 11.

*Step 11. *Control the operations of HVAC, EWH, PHEV, WM, CD, and DW according to the vector , the final global best particle’s position vector. In each time slot, the power distribution among loads, battery, renewable generation, and power grid is determined through the method described in Section 4.4.

##### 4.4. Calculation Methods of Power Distribution Vectors

In time slot , the values of , , , , , , and are determined following the flowchart shown in Figure 6.

As shown in Figure 6, the power output of PV is supplied to loads first. If there is extra energy, it is used to charge the home energy storage battery or sold to the utility grid for revenue; if the PV power output cannot meet the load demand, the shortage is met by the home energy storage battery or the grid. In this paper, the production cost of PV is assumed to be negligible.

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. is calculated as follows [1]:where and denote the energy in kW·h stored in the home energy storage battery in time slots and , respectively.

stands for a threshold of grid electricity price in time slot . If the grid electricity price is greater than , the home energy storage battery is allowed to sell the stored energy to the grid for revenue. is calculated as

controls the possibility of selling the energy stored in the home energy storage battery to the grid in time slot ; the smaller is, the greater the possibility will be.

is another threshold of grid electricity price in time slot . If the grid electricity price is smaller than , the home energy storage battery is allowed to buy electricity from the grid for charging. is calculated as

controls the possibility of buying electricity from the grid to charge the home energy storage battery in time slot . The greater the 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.

#### 5. 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.

##### 5.1. 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, , 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, , is assumed to be equal to the price that he/she pays for buying electricity from the 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.

Consequently, in model (1), (Btu/h) where is the outdoor temperature in time slot , (Btu/°F), h, and the rated power is 2.352 (kW). The user preference parameters about HVAC , , , , and are 72, 80, 76, 3, and 2 (°F), respectively.

The parameters of EWH are as follows. The volume of EWH tank is 50 gallons, is 1.0 (Btu/(h°F)), is 419.88 (Btu/°F), the rated power is 4.5 (kW), is equal to , and is 60 (°F). The user preference parameters , , , , and are 108, 122, 115, 3, and 3 (°F), respectively.

As for the PHEV, is 16 (kW·h), is 0.5, is 3.3 (kW), and , , and 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, . is 9, is 3, and .

The parameters of WM, CD, and DW are listed in Table 2.

As for the home energy storage battery, the rated battery capacity is 13.44 (kW·h), is 6.72 (kW·h), is 0.2, is 1. (kW), and . It is assumed that the battery is lead-acid battery; the capital cost is 2176 ($). The degradation cost function coefficients in [44] are used.

As described in Section 4.4, and 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 is 30 and the maximum iteration number is 3000. , , , and are 0.2, 0.9, 20, and 5, respectively. According to the values of and , the dimension of position vector and velocity vector of each particle is 273.

##### 5.2. 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.

##### 5.3. 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.

##### 5.4. Operation States of Schedulable Home Appliances

When the forecasted outdoor temperature scenario is and PV power output scenario is , the operation states of schedulable home appliances under the control of the algorithm proposed in this paper are shown in Figure 14.

**(a) Room temperature**

**(b) Water temperature in tank of EWH**

**(c) Charging power of PHEV**

**(d) PHEV battery SOC**

**(e) CW power**

**(f) CD power**

**(g) DW power**

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.

##### 5.5. 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.

**(a) Power transmitted from grid to battery**

**(b) Power transmitted from battery to grid**

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.

**(a) Battery SOC**

**(b) Charging power of battery**

**(c) Discharging power of battery**

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.

**(a) Power output of PV**

**(b) Power transmitted from PV to loads**

**(c) Power transmitted from PV to battery**

**(d) Power transmitted from PV to 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.

##### 5.6. 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 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 .

As shown in Figure 20, with the increase of , the total amount of energy that is transmitted from the home energy storage battery to grid decreases. The reason is that the greater 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 .

As shown in Figure 21, with the increase of , the total amount energy that is transmitted from the grid to the home energy storage battery increases. The reason is that greater means more chances of buying electricity from the grid to charge the home energy storage battery when the electricity price is low.

##### 5.7. 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.

#### 6. 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 algorithm proposed in this paper can reduce electricity cost and improve a user’s comfort level significantly, provides the user with an efficient method of taking a tradeoff between the electricity cost and the comfort level, and facilitates the implementation of DR in residential sector in smart grid.

In this paper, the PHEV is considered as a pure load, which absorbs electricity for transportation. However, in smart grid, when the grid electricity price is high, it can also supply the stored electricity to other home appliances or critical loads through the V2H function to reduce the amount of electricity purchased from grid and home owner’s electricity cost. In the future, we will integrate this function into the model proposed in this paper. In this case, determining the power distribution among loads, PV, battery, PHEV, and grid will become more challenging.

#### Conflict of Interests

The authors declare that there is no conflict of interests regarding the publication of this paper.

#### Acknowledgments

This work is supported by the National High Technology Research and Development of China (2011AA040103), the Natural Science Foundation of China (61233007, 61300215), and the Important National Science and Technology Specific Project (2013ZX03005004). The authors would like to sincerely thank the anonymous reviewer whose comments have helped them improve the paper significantly.