Online Energy Management for a Sustainable Smart Home with an HVAC Load and Random Occupancy
Abstract
In this paper, we investigate the problem of minimizing the sum of energy cost and thermal discomfort cost in a longterm time horizon for a sustainable smart home with a Heating, Ventilation, and Air Conditioning (HVAC) load. Specifically, we first formulate a stochastic program to minimize the time average expected total cost with the consideration of uncertainties in electricity price, outdoor temperature, renewable generation output, electrical demand, the most comfortable temperature level, and home occupancy state. Then, we propose an online energy management algorithm based on the framework of Lyapunov optimization techniques without the need to predict any system parameters. The key idea of the proposed algorithm is to construct and stabilize four queues associated with indoor temperature, electric vehicle charging, and energy storage. Moreover, we theoretically analyze the feasibility and performance guarantee of the proposed algorithm. Extensive simulations based on realworld traces show the effectiveness of the proposed algorithm.
Nomenclature
Indices

Time slot index.
Constants

Total number of time slots.

Duration of a time slot (hour).

The PV generation efficiency.

Total radiation area of solar panels ().

Factor of inertia.

Thermal conversion efficiency (heating).

Overall thermal conductivity (kW).

Time constant of system (hour).

Power rating of an HVAC system (kW).

Lower bound of comfort range ().

Upper bound of comfort range ().

Minimum outdoor temperature ().

Maximum outdoor temperature ().

Maximum charging power of the EV (kW).

Maximum queueing delay of the queue (hour).

Tolerant EV charging delay (hour)

Maximum ESS charging power (kW).

Maximum ESS discharging power (kW).

Thermal cost coefficient (RMB).
Variables

Generation output of PV panels (kW).

Solar radiation intensity (W).

Indoor temperature ().

Outdoor temperature ().

HVAC input power at slot (kW).

EV energy queue (kW).

Service rate of the queue (kW).

Arrival rate of the queue (kW).

Stored energy level of the ESS (kWh).

Purchasing/selling power of a smart home (kW).

Buying electricity price (RMB/kWh).

Selling electricity price (RMB/kWh).

Charging or discharging power of the ESS (kW).

The most comfortable temperature ().

Home occupancy state at slot .

Energy cost (RMB).

Thermal discomfort cost at slot (RMB).

Virtual queue related to indoor temperature ().

Virtual queue related to EV charging delay (slots).

Virtual queue related to ESS control (kWh).

Lyapunov function.
I Introduction
As a nextgeneration power system, smart grid is typified by an increased use of information and communications technology (ICT) in the generation, transmission, distribution, and consumption of electrical energy. In smart grid, there are twoway flows of electricity and information. As far as twoway information flow is concerned, consumers and utilities could exchange realtime information (e.g., electricity prices, power usages) through smart meters. Consequently, some energy management schemes could be developed to save energy cost for consumers by exploiting the temporal diversity of electricity prices[1, 2, 3]. As large electricity consumers in power grids, residential homes account for 30%40% of the total electricity consumption in a country (e.g., about 39% in U.S.[4]). Therefore, it is of particular importance to carry out the design of efficient energy management for residential homes. In this paper, we mainly focus on the energy management of smart homes, which are evolved from traditional homes by adopting three components, namely the internal networks, intelligent controls, and home automations[5].
In a smart home, there are lots of appliances. In general, such appliances could be divided into two types, i.e., inflexible loads (e.g., lights, computers, and televisions) and flexible loads (e.g., heating, ventilation, and air conditioning (HVAC) systems, electric water heaters, electric vehicles (EVs), and washing machines). In this paper, we mainly focus on the scheduling of an HVAC system and an EV in a smart home, since HVAC systems account for about 50% electricity consumption of a smart home[4] and EV charging task represents one of the most flexible loads (i.e., deferrable and interruptible[6]). As a result, the temporal price diversity could be utilized to save energy cost. In addition, distributed generation and energy storage system are also considered in the smart home. The purpose of this paper is to minimize the sum of energy cost associated with appliances and thermal discomfort cost related to occupants in a longterm time horizon with the consideration of uncertainties in electricity price, outdoor temperature, renewable generation output, electrical demand, the most comfortable temperature level, and home occupancy state. To achieve the above aim, we first formulate a problem of minimizing the time average expected total cost for the sustainable smart home with an HVAC load. Since there are timecoupling constraints and the future system parameters are unknown, it is challenging to solve the formulated problem.
Typically, the framework of Lyapunov optimization techniques (LOT)[7] could be adopted to solve a time average optimization problem and an online energy management algorithm can be designed[8, 9]. Existing Lyapunovbased energy management algorithms intend to buffer the power demand requests of flexible loads in queues when electricity prices are high and to serve the stored requests when electricity prices are low. Different from flexible loads with specified energy/power demands (e.g., EV), an HVAC system has unknown power demand that is related to many factors, such as the most comfortable temperature level decided by occupants, the lower and upper bounds of indoor temperature, home occupancy state, and outdoor temperature. Therefore, existing Lyapunovbased energy management algorithms could not be applied to our problem directly.
To avoid knowing about an HVAC power demand when using the LOT framework, we construct a virtual queue associated with indoor temperature. By stabilizing all queues associated with indoor temperature, EV charging, and energy storage device, we design a Lyapunovbased energy management algorithm without predicting any system parameters and knowing HVAC power demand.
The main contributions of this paper are summarized as follows,

We formulate a time average expected total cost minimization for a smart home with an HVAC load considering uncertainties in electricity price, outdoor temperature, renewable generation output, electrical demand, the most comfortable temperature level, and home occupancy state.

We propose an online energy management algorithm for the formulated problem based on the LOT framework without predicting any system parameters and knowing the HVAC power demand. Moreover, we theoretically analyze the feasibility and performance guarantee of the proposed algorithm.

Extensive simulation results based on realworld traces show that the proposed algorithm can reduce energy cost effectively with small sacrifice in thermal comfort.
The remaining of this paper is organized as follows. Section II gives the literature review. In Section III, we describe the system model and problem formulation. Then, we propose an online algorithm to solve the formulated problem in Section IV. In Section V, we conduct extensive simulations. Finally, conclusions and future work are provided in Section VI.
Ii Literature Review
There have been many studies on investigating energy management for smart homes. In [10], Tsui et al. proposed a convex optimization framework with regularization for the home energy management, which can handle appliances with ON and OFF operational statuses. In [11], Liu et al. investigated the transformation from singletime scale into multitime scale to reduce the computational complexity for the optimization of home energy management. In [12], Huang et al. formulated a chanceconstrained programming optimization problem to minimize energy cost of appliances considering uncertainties in a smart home. In [13], Keerthisinghe et al. proposed a scheme to schedule distributed energy resources in a smart home using an approximate dynamic programming with temporal difference learning. In [14], Zhang et al. developed a learningbased demand response strategy for an HVAC system in a smart home to minimize energy cost without affecting customer’s comfort of living. In [15], Hansen et al. proposed a partially observable Markov decision process approach to minimize the energy cost in a smart home. In [16], Basit et al. designed a scheme based on Dijkstra algorithm to minimize the energy cost of all devices in a home. In [17], Deng et al. proposed a temporallydecoupled algorithm to control the indoor temperature of smart buildings with nexthour electricity price. Though some positive results have been obtained in aforementioned research efforts, they either implicitly/explicitly assume that future system parameters could be forecasted perfectly or known exactly, or require parameter forecasting.
To avoid the forecasting of system parameters, some online energy management methods have been developed based on the LOT framework[8, 19, 20, 18, 21]. In [8], Guo et al. proposed a Lyapunovbased cost minimization algorithm for multiple residential households in a smart neighborhood. In [18], Li et al. investigated the joint energy storage management and load scheduling at a residential site with renewable integration and designed a realtime solution. In [19], Yang et al. designed a costeffective and privacypreserving energy management strategy for smart meters by using a battery. In [20], Huang et al. presented an adaptive electricity scheduling algorithm to minimize the microgrid operation cost with the consideration of qualityofservice in electricity. In [21], Shi et al. proposed a realtime energy management strategy in microgrids considering physical constraints associated with the power distribution network. However, the abovementioned works do not consider the online energy management for a smart home considering an HVAC system.
In [9], Fan et al. investigated the online energy management problem for a smart home with an HVAC load based on the LOT framework. Specifically, this paper intends to minimize energy cost by buffering the power demand requests of appliances in queues when electricity prices are high and serving requests when electricity prices are low. However, different from loads with specific energy/power demands (e.g., EV), an HVAC load has unknown power demand in each time slot that is related to many factors, such as the most comfortable temperature level decided by occupants, the lower and upper bounds of indoor temperature, room occupancy state, and outdoor temperature. Thus, the HVAC power demand is randomly generated in [9] and can not reflect the true demand of the HVAC system. Though the Lyapunov optimization technique is also adopted to design online energy management strategy for a smart home with an HVAC system, this paper has several aspects different from [9]: (1) by introducing a virtual queue associated with indoor temperature, our proposed algorithm operates without knowing the HVAC power demand in each time slot; (2) we jointly consider the minimization of energy cost and thermal discomfort cost; (3) random home occupancy, energy storage system, and selling electricity are jointly considered; (4) all system control parameters which affect algorithmic feasibility are explicitly derived.
Iii System Model and Problem Formulation
The smart home considered in this paper is shown in Fig. 1, where there are twoway communications between the smart home and the utility grid. Thus, realtime electricity price and power usage could be known by the smart home and the utility grid, respectively. In addition, the smart home could buy electricity from the utility grid and sell electricity back to the utility grid. In the smart home, some devices are connected to a lowvoltage DC/AC bus for energy exchange, such as distributed generators (e.g., wind turbines or solar panels), energy storage system (ESS), home energy management system (HEMS), and loads. As the central controller of the smart home, HEMS manages the way of energy generation, storage, and consumption. Specifically, through twoway information flow, HEMS could collect system states (e.g., renewable generation output, electricity price, outdoor temperature, energy demand, and home occupancy state) and send control signals to controllable devices. As far as loads are concerned, we mainly consider flexible loads such as HVAC and EV, while the demands of other loads are satisfied by HEMS instantly and not considered in the optimization problem. In addition, HEMS operates in slotted time, i.e., , where is the total number of time slots. Moreover, the duration of a time slot is normalized to a unit time so that power and energy could be used equivalently.
Iiia Renewable energy model
We consider the solar energy supply in the smart home. Let be the maximum generation output of photovoltaic (PV) solar panels at slot . Then, could be estimated by the following model[22], i.e.,
(1) 
where denotes the PV generation efficiency, is the total radiation area of solar panels (in ), and represents the solar radiation (in ).
IiiB Load model
IiiB1 HVAC model
Generally, an HVAC system has two kinds of operational modes, i.e., heating and cooling. In this paper, we mainly focus on the heating mode in the winter and our designed algorithm could be extended to accommodate the cooling mode in the summer by taking the changes of equations (2) and (17)(19) into consideration, e.g., the second “+” in (2) should be “” when the cooling mode is considered.
According to [23], the indoor temperature dynamics caused by an HVAC system could be obtained as follows
(2) 
where and denote the indoor temperature and outdoor temperature, respectively; is thermal conversion efficiency, and is the overall thermal conductivity in ; ; is the system time constant.
In this paper, we consider an HVAC system with inverter, i.e., the HVAC system can adjust its input power continuously[24]. Let be the rating power of the HVAC system, we have
(3) 
For one person in the smart home, he/she would feel comfortable when the indoor temperature varies within a range, e.g., . Thus, we have the following constraints,
(4) 
where and are lower and upper bounds of the comfort range, respectively.
IiiB2 EV charging model
When an EV is connected to the DC/AC bus in the smart home, EV should send a charging request to the HEMS. To be specific, the charging request is represented by a 3tuple (, , ), where , and denote the starting time, completion time and energy demand, respectively. To fully utilize the temporal diversity of dynamic prices, the energy demand of the EV should be satisfied intelligently, i.e., executing charging when electricity prices are low and deferring charging process when electricity prices are high. To intelligently satisfy the energy demand of the EV without violating the completion time, we adopt an energy queue as follows,
(5) 
where and are service and arrival processes of the energy queue, respectively. Since the LOT framework could transform a longterm optimization problem into many online subproblems through the queue stability control, introducing the energy queue contributes to online scheduling of EV charging as in [25].
Denote the maximum value of by , where () so that it is always possible to make the queue stable. Note that there is no need to serve the energy demand that is greater than , we have
(6) 
Since the charging power of an EV is limited, the EV can add at most an energy demand to in a time slot, where denotes the maximum charging power of the EV. When , multiple time slots are needed to finish the submission of total energy demand . Similar to [25], the EV submits the energy demand at slot according to the following equation,
(7) 
where .
To ensure that the average length of is finite, we have the following constraint, i.e.,
(8) 
Since (8) is not enough to ensure that the charging completion time is not violated, we adopt the following constraint,
(9) 
where is the maximum queueing delay of the queue ; denotes the tolerant EV charging service delay, which is equal to .
IiiC ESS model
Let be the charging or discharging power of the ESS at slot . Then, we have
(10) 
where and are maximum charging power and discharging power, respectively. Following the ESS models in [8],[20],[26], the dynamics of energy levels in the ESS could be expressed by
(11) 
where represents the stored energy of the ESS at time slot . Though the ESS model with perfect charging and discharging efficiency parameters is considered in this paper, the proposed Lyapunovbased algorithm can be extended to incorporate more complex ESS models, please see [27] for details.
Since the energy level should fluctuate within a certain range, we have
(12) 
where and denote the maximum and the minimum capacity of the ESS, respectively.
IiiD Power balancing
Let be the energy transaction between the smart home and the main grid at slot . Specifically, means electricity purchasing while means electricity selling. Then, according to the realtime power balancing, we have
(13) 
IiiE Problem formulation
With the above models, the energy cost due to the electricity selling or buying is given by
(14) 
where and denote the price of buying and selling electricity at slot , respectively. We assume that selling prices are not higher than purchasing prices, i.e., for all . In other words, the smart home cannot make profit by greedily purchasing energy from the utility grid and then selling it back to the utility grid at a higher price simultaneously. Such assumption is commonly made in existing works[20][28]. In addition, the intuition behind (14) is that just a variable is needed to reflect the electricity purchasing or selling. For example, when , . For the case , .
Similar to [29], we model the thermal discomfort cost of occupants at slot by
(15) 
where is the cost coefficient with unit , which reflects the relative importance of discomfort cost with respect to energy cost; denotes the most comfortable level for occupants in slot (e.g., 22.5), and its value could be decided by occupants at slot . Binary variable represents the home occupancy state at time slot (“1” denotes occupancy and “0” denotes vacancy). When , would be zero since there is no occupant at home. The value of could be decided by the last occupant, who is going to leave the home at slot . If no human participation is expected, smart devices with sensors could be deployed to implement behavior awareness (e.g., leave home) and execute the corresponding operations[30].
With abovementioned models, we formulate a problem to minimize the sum of energy cost and thermal discomfort cost as follows,
(16a)  
(16b) 
where denotes the expectation operator, which acts on random purchasing/selling electricity prices /, outdoor temperatures , renewable generation outputs , EV electrical demand , the most comfortable temperature level , and home occupancy state ; the decision variables of P1 are , , and .
Iv Algorithm Design
Iva The proposed online algorithm
There are two challenges involved in solving P1. Firstly, the constraints (2), (5), (11) introduce time couplings, which means that the current decision would affect future decisions. Secondly, future parameters are unknown, e.g., electricity prices and outdoor temperatures. To handle the “timecoupling” property, typical methods are based on dynamic programming[31], which suffers from “the curse of dimensionality” problem. Recently, the LOT framework was often adopted to deal with the above challenges[8][9]. Existing Lyapunovbased energy management algorithms intend to buffer the power demand requests of appliances (e.g., EV) in queues and to serve such requests when electricity prices are low. Different from EVs with specified energy/power demands, an HVAC load has unknown power demand in each time slot that is related to many factors, such as the most comfortable temperature level decided by occupants, the lower and upper bounds of indoor temperature, room occupancy state, and outdoor temperature. Thus, we need to redesign an algorithm to deal with the HVAC load. The key idea of the proposed algorithm is summarized as follows:

Constructing virtual queues associated with indoor temperature, EV charging delay and ESS.

Obtaining the driftpluspenalty term according to the LOT framework.

Minimizing the upper bound given in the righthandside of the driftpluspenalty term.
Based on the above idea, we can propose an online energy management algorithm without predicting any system parameters and knowing HVAC power demand in each time slot. Note that the purpose of constructing virtual queues is to guarantee the feasibility of constraints (4), (9), and (12). By stabilizing such queues, the proposed algorithm could operate without violating the constraints (4), (9), and (12). Specific proof can be found in Theorems 13.
To begin with, three mild assumptions are made about system parameters so that the system is controllable, i.e.,
(17)  
(18)  
(19) 
where , . Note that the first assumption is very common for the heating mode in the winter since the highest temperature in the winter is always less than the comfortable temperature levels (e.g., Fig. 2(a) shows that is about , while is about 25.). In addition, the second assumption simply implies that the temperature decay can be compensated by injecting the maximum power of the HVAC system (this is required by any an HVAC system). The last assumption could also be satisfied easily in practice, e.g., when we set the parameters as follows[29][17]: , , , , , , , we have . The intuition behind (19) is that the control parameter in (33) should be greater than zero, i.e., .
IvA1 Constructing virtual queues
To guarantee the feasibility of (4), we define a virtual queue as a shifted version of indoor temperature as follows,
(20) 
where is a constant, which is specified in the Theorem 1 of Section IVB. Continually, the dynamics of could be obtained below,
(21) 
where the above equation could be obtained by integrating (2) with (20).
In addition, to satisfy the requirement of (9), we define a delayaware virtual queue as follows,
(22) 
where ; is a fixed parameter, which represents the arrival rate of the virtual queue when the queue , while represents the service rate of . According to our previous work[3], it can be known that (9) could be guaranteed when the queues and have finite upper bounds. Moreover, the maximum queueing delay . In next section, we will show that such upper bounds indeed exist.
IvA2 Obtaining driftpluspenalty term
In addition to keeping three virtual queues stable, the actual energy queue should also be stabilized so that (8) could be satisfied. Thus, we define a Lyapunov function below,
(25) 
Define , the oneslot conditional Lyapunov drift could be calculated as follows,
(26) 
where the expectation is taken with respect to the randomness of electricity prices, outdoor temperatures, renewable generation output, EV charging demand, the most comfortable temperature level, and home occupancy state, as well as the chosen control decisions.
Taking (25) into consideration, we have
(27) 
where , , , . Specifically, , , , and have the following upper bounds, i.e.,
(28)  
(29)  
(30)  
(31) 
where , , , .
By adding a function of the expected total cost over one slot to (26), we can obtain the driftpluspenalty term as follows,
(32) 
where is a weight parameter that implements a tradeoff between queue stability and total cost reduction.
IvA3 Minimizing the upper bound
Since the main principle of the Lyapunovbased algorithm is to choose control actions that minimize the upper bound given in the righthandside of the driftpluspenalty term. Then, the proposed algorithm could be described by the Algorithm 1, where P2 is a convex optimization problem with four variables and its solution could be solved efficiently using available convex methods (e.g., interior point methods) or tools (e.g., CVX). In addition, the value of with is described by for brevity. The lines 67 denote that the HVAC power input would be zero if the home is not occupied in the next time slot and is still greater than , which contributes to saving energy cost without affecting the thermal comfort of occupants.
Note that updating , , and according to (21), (5), (24) means that the constraints (2), (5), (11) could be satisfied by the proposed algorithm. Moreover, (3), (6), (10), (13) are explicitly incorporated in P2. Thus, the remaining constraints (i.e., (4), (8), (9), (12)) are not considered in Algorithm 1. In the next section, we will show the feasibility of the proposed algorithm for P1 by proving that (4), (8), (9), (12) could be satisfied.
IvB Algorithm feasibility
Let (,,,) be the optimal solution of P2, we have the following three Lemmas and three Theorems, which show that the constraints (4), (8), (9), (12) could be satisfied by the proposed algorithm.
Lemma 1. The optimal HVAC operation decision of the proposed algorithm has the following properties, where , .

If , .

If , .
Proof:
See Appendix A. \qed
Based on Lemma 1, Theorem 1 could be derived as follows.
Theorem 1. If the initial temperature , the proposed algorithm with fixed parameters and would offer the following guarantee, i.e., for all time slots, where
(33)  
(34)  
(35) 
In above formulas, , , , , , , , .
Proof:
See Appendix B. \qed
Lemma 2. The optimal EV charging decision of the proposed algorithm has the following properties:

If , .

If , .
Proof:
See Appendix C. \qed
Based on Lemma 2, Theorem 2 could be derived as follows.
Theorem 2 Suppose . If , the proposed online algorithm has the following properties:

is bounded by , is bounded by .

Maximum queueing delay
Proof:
See Appendix D. \qed
Lemma 3. The optimal ESS decision of the proposed algorithm has the following properties:

If , we have .

If , we have .
Proof:
See Appendix E. \qed
Based on Lemma 3, Theorem 3 could be derived as follows.
Theorem 3. If the initial energy level , the proposed algorithm with fixed parameters and would offer the following guarantee, i.e., for all slots, where
(36)  
(37)  
(38) 
Proof:
See Appendix F. \qed
Theorems 13 show that the constraints (4), (8), (9), (12) could be ensured under the proposed algorithm. Since other constraints are explicitly considered in Algorithm 1, we have the conclusion that the proposed algorithm is feasible to the original problem P1. In next section, we will use realworld traces about outdoor temperature, electricity price and PV generation to test the effectiveness of the proposed algorithm.
IvC Performance guarantee
In this subsection, we analyze the performance guarantee of the proposed algorithm in Theorem 4.
Theorem 4. If purchasing/selling electricity prices /, outdoor temperatures , renewable generation outputs , EV electrical demand , the most comfortable temperature level , and home occupancy state are i.i.d. over slots, the proposed algorithm offers the following performance guarantee, i.e., , where is the optimal objective value of P1.
Proof:
See Appendix G. \qed
Since is a complex function of , the above optimality gap would not monotonically decreases with the increase of . Specially, when , becomes a constant. At this time, the performance of the proposed algorithm would be better given a greater . When uncertain parameters are non i.i.d over slots, performance analysis could be conducted using “multislot drift” in [7], which will be our future work.
V Performance Evaluation
Va Simulation setup
The main simulation parameters are given as follows: hours, 1 hour, , for home occupancy, , [17], , , (we set ), , [28], [22], , [8], , [8], , , (the power could support the heating of a room with 136 )^{1}^{1}1http://item.gome.com.cn/A0006199221pop8009870115.html?intcmp=list90000007001_1_1. Suppose follows a uniform discrete distribution with parameters 4 and 18, EV charging time is [7pm, 6am]. Thus, we have . According to the Theorem 2, we set . In simulations, we adopt the hourly outdoor temperature data^{2}^{2}2http://data.cma.cn/ and retail electricity price data associated with the Nanjing City of China in January of 2017, which are shown in Figs. 2(a)(b). For renewable generation information, we use the hourly solar radiation data^{3}^{3}3http://midcdmz.nrel.gov/srrl_bms/historical/ associated with the Golden city of the USA in January of 2017. Due to the lack of home occupancy traces, we adopt the sport data related to the step number in January of 2017 to approximate home occupancy states, which was collected by an iPhone automatically. To be specific, if the total step number during an hour is larger than a given threshold, the home is assumed to be unoccupied. Otherwise, the home is occupied. In this paper, we set the threshold as 1800 (i.e., 2 seconds per step)^{4}^{4}4Though the above thresholdbased decision may mistake other cases (e.g., office occupancy) for home occupancy, it is still effective for the hours of sleep, e.g., 22pm7am. and the obtained home occupancy trace is shown in Fig. 2(d).
To show the effectiveness of the proposed algorithm, three baselines are adopted as follows:

Baseline2 (B2): B2 intends to implement the temporallydecoupled algorithm as in [17] with perfect onestep price forecasting when the home is occupied, which results in an optimal HVAC control if (3) is neglected. Moreover, random occupancy is also considered in B2, i.e., when and , we set . In addition, B2 does not consider ESS and serves EV charging demand instantly.

Baseline3 (B3): the proposed algorithm is equivalent to B3 when ESS control is not considered (i.e., ).
VB Simulation results
VB1 Algorithm feasibility
According to Theorems 13, the algorithmic feasibility of the proposed algorithm could be verified by checking the normal ranges of indoor temperature, ESS energy level, and EV charging delay. As shown in Fig. 3, indoor temperature under the proposed algorithm and ESS energy level always fluctuate within their respective normal ranges. Moreover, the maximum EV charging delay is less than . Therefore, the proposed algorithm is feasible to the original problem P1. In addition, it can be observed that B1 intends to maintain the most comfortable level when the home is occupied. When the home is unoccupied, B1 will turn off the HVAC system if that decision would not result in a temperature below in the next time slot. For B2, the increase or decrease of the indoor temperature depends on the relationship between and . When , the temperature will increase for preheating. Otherwise, the indoor temperature will decrease.
VB2 The impact of
Since the proposed algorithm adjusts the HVAC power input dynamically according to the current electricity price, larger temperature range would result in lower energy cost. With the increase of , normal temperature range () decreases. Consequently, the proposed algorithm and B3 achieve higher energy cost but lower ATD (i.e., Average Temperature Deviation from the most comfortable level : , and denotes the total number of time slots with home occupancy) as shown in Fig. 4. Moreover, the proposed algorithm could reduce energy cost by 36.3% compared with B1 with small sacrifice of ATD (ATD=1.295). When , the proposed algorithm achieves lower energy cost than B3. Otherwise, B3 achieves lower energy cost than the proposed algorithm. The reason is that a small control parameter would affect the utilization of temporal price diversity as shown in [2].
VB3 The impact of
The performance of the proposed algorithm under varying is demonstrated by Fig. 5, where the proposed algorithm generally achieves lower energy cost given a larger . The reason is that larger would result in less thermal loss given the same time horizon, which contributes to reaping the benefits of temporal price diversity under our proposed algorithm. Here, the temporal price diversity means that the proposed algorithm would increase power inputs when electricity prices are low so that power inputs associated with high electricity prices in later time slots could be reduced, resulting in lower energy cost. When , the energy cost begins to increase. The reason is that a small will lead to a small actual temperature range as shown in Fig. 5(c). Compared with B3, the proposed algorithm could reduce energy cost without the sacrifice of ATD under the given configuration. Though B2 has the lowest energy cost, its ATD is also the largest. Therefore, B2 is not necessarily the best scheme when energy cost and thermal discomfort cost are jointly considered.
VB4 The impact of
Fig. 6 illustrates the performance of the proposed algorithm and three baselines under varying . It can be found that the proposed algorithm achieves the lowest total cost when falls within an appropriate range, e.g., (no vacancy) and (with vacancy). Specifically, when the tolerant ATD is smaller than , the proposed algorithm could achieve lower energy cost than B1 by 40.41% and 38.95% when the home is always occupied and randomly occupied, respectively. In contrast, B2 achieves the best performance in a much smaller range since its thermal discomfort cost would be the largest given a larger as shown in Fig. 6(c). When is large enough (e.g., ), B1 would achieve the best performance since the thermal discomfort cost of B1 is the smallest one and the corresponding energy cost is a constant, which are illustrated by Figs. 6(b) and (c). In summary, the proposed algorithm offers an effective way of controlling the HVAC system when home occupants care about both energy cost and thermal comfort.
Vi Conclusions and Future Work
In this paper, we investigated the energy management of a sustainable smart home with an HVAC load and random occupancy. To minimize the sum of energy cost and thermal discomfort cost in a longterm time horizon, we proposed an online energy management algorithm based on the LOT framework without predicting any system parameters. Different from existing Lyapunovbased energy management algorithms, the proposed algorithm does not require submitting unknown power demands of an HVAC system into an energy queue. Extensive simulation results based on realworld traces showed the effectiveness of the proposed algorithm. In the future, we plan to investigate the online HVAC control in a commercial building[34], e.g., how to allocate the air supply rate of every zone or room in realtime while taking thermal discomfort of occupants into consideration. Moreover, we plan to investigate the impact of HVAC load aggregation[35] in a residential building on enduser comfort, e.g., given some households enrolled in a demand response program, how to minimize the average thermal discomfort of these households without violating the total power reduction/increase requirement during a demand response event.
Appendix A Proof of Lemma 1
Proof:
Let (,,,) be the optimal solution of P2.

When , suppose . To prove that the above assumption does not hold, we construct another solution (0,,,). According to power balance, we have . Let the optimal objective value of P2 be and the objective value with the new solution (0,,,) be , respectively. Then, we can compare with under different symbols of and as follows.

When , we have since and . Then, .

When and . Then, .

When and . Then, .
Taking the above three cases into consideration, we have the conclusion that when .


When , suppose . To prove that the above assumption does not hold, we construct another solution (,,,). According to power balance, we have . Let the optimal objective value of P2 be and the objective value with the new solution (,,,) be , respectively. Then, we can compare with under different symbols of and as follows.

When , we have since . Then, .

When and . Then, .

When and . Then, .
Taking the above three cases into consideration, we have the conclusion that when .

Appendix B Proof of Theorem 1
Proof:
We will prove that the above inequalities are satisfied for all time slots by using mathematical induction method. Since , the above inequalities hold for =0. Suppose the abovementioned inequalities hold for the time slot , we should verify that they still hold for the time slot +1. The specific proof detail is given as follows.

If . Then, the optimal HVAC decision is according to the Lemma 1. As a result,