Optimal Comfortable Load Schedule for Home Energy Management Including Photovoltaic and Battery Systems

: Although the main concern of consumers is to reduce the cost of energy consumption


Introduction
The cost of energy consumption by residential consumers has increased as a result of the global pandemic and war crisis [1]; according to the International Energy Agency (IEA), in 2021, the worldwide residential energy consumption accounted for 30% of the total energy consumption [2]. Therefore, residential buildings contribute directly or indirectly to around 27% of global greenhouse gas emissions. Thus, according to the Paris Climate Agreement, implementing zero-energy designs in residential buildings can play a crucial role in mitigating climate change, which encourages countries to increase the use of clean energy sources to lower carbon dioxide emissions [3]. As a result, many homeowners look for the available forms of renewable energy, such as solar energy, wind energy, etc., to lessen their carbon footprint and cut costs [4]. To hasten the transition to a cleaner energy future, some governments are also providing tax credits and other financial incentives for the use of renewable energy sources according to the government's policy [5]; for instance, long short-term memory recurrent neural networks (LSTMs [36]) are examples of machine learning algorithms that use data-driven strategies to optimize a system's performance to create the best load schedule possible for the day-ahead forecasted weather and loads.
Unfortunately, most countries' electricity suppliers do not pay for load shifting or curtailment; thus, customers need to reduce costs by scheduling their load profile without sacrificing comfort. This can be accomplished by utilizing DRE and smart home technologies that allow customers to control their energy consumption remotely. Moreover, implementing energy-efficient appliances and practices can help reduce costs while maintaining comfort. This paper proposes a new optimization algorithm, a random integer search optimizer (RISO). Moreover, this work offers a new objective function that represents the cost of energy consumption by individual homes. The RISO algorithm is applied to minimize the objective function and to schedule the home appliances within the comfort time window of end users.

System Description
For zero-energy homes in Hong Kong, the government encourages individuals to install distributed PV and ESS systems to supply clean energy to their homes, and the excess energy can be injected into the grid. The Hong Kong government initiated a feed-in tariff scheme to help individuals recover the capital cost of installing renewable energy resources within 10 years of the project. However, individuals still need efficient energy management to optimize household appliance schedules and reduce energy consumption costs. In this study, the structure of HEM is shown in Figure 1. This HEM includes clean energy generation (PVs and ESSs); household appliances, including electric vehicles (EVs), smart meters for measuring the bidirectional energy to or from the grid, communication systems that transfer the decision signals to sockets of appliances or transfer the measured data, and energy hubs that manage the energy flow inside the home and between the home and grid; and software that optimize the schedule of household appliances. The PVs, ESSs, and EVs are connected to the DC distribution system, where bidirectional DC/DC converters are used; the household appliances are connected to the AC distribution system (blue lines), where the PVs and ESSs are connected to them via a bidirectional DC/AC inverter.

Mathematical Energy Modeling
The decision-making of HEM relies on the day-ahead forecasted energy from and ESSs and the scheduled household appliances. Therefore, the mathematical mod of the HEM components helps us to study the feasibility of the optimal HEM befor ploying it in a real home. Using mathematical modeling, researchers can simulate d

Mathematical Energy Modeling
The decision-making of HEM relies on the day-ahead forecasted energy from PVs and ESSs and the scheduled household appliances. Therefore, the mathematical modeling of the HEM components helps us to study the feasibility of the optimal HEM before deploying it in a real home. Using mathematical modeling, researchers can simulate different scenarios and evaluate the performance of the HEM system under various conditions. This can help to identify potential issues and optimize the system design before it is implemented in a real-world setting.

PV Energy Modeling
As discussed above, the PV system is the main source of home electricity for zeroenergy buildings. The output power of the PVs (P PV ) varies with the variations in the irradiation (G) and ambient temperature (T), as in Equation (1) [37].
where α P is the temperature coefficient of the power of PV cells, G 0 and T 0 are the irradiation and temperature under standard test conditions (STCs) (G 0 = 1000 W/m 2 and T 0 = 25 • C), P PVrated represents the rated installed capacity of PVs at the STC, and η inv is the efficiency of a DC/AC inverter.

Battery Energy Modeling
The energy flow to or from the batteries depends on the state of charge (SOC) and the maximum rate of charging or discharging power (P Bmax ). The stored battery energy (ε B (t + 1)) increases or decreases with each time step (∆t) during charging or discharging states, as in Equation (2). Therefore, it is essential to monitor the SOC and P ch B to ensure efficient energy management and prevent damage to the batteries.
where η B is the total efficiency of DC/DC and DC/AC converters and ε B is the total energy storage of the battery.

EV Energy Modeling
An EV is modeled as a battery model, but it will function as a household appliance. Therefore, the charging mode for EVs is considered in this study as follows. The main aim of this study is to help residential consumers reduce their carbon footprint by installing clean energy resources and, at the same time, schedule their energy consumption. The load demand is the required power by the household appliances (P hl ), including for the EV (P EV ), as in Equation (8). This demand will be primarily supplied by the installed renewable energy resources. Therefore, the load demand of the home (P L ) is fed by the PV power (P PV ) and discharging battery power (P dch B ). If there is excess PV power, it will first be used to charge the battery (P ch B ) until it reaches SOC Bmax ; the excess power can be sold to the grid after (P s g ). However, if the demand power (P L ) is higher than the PV and ESS power, the shortage power will be bought from the grid (P b g ), as in Equation (9).

Optimization Methodology
The total demand power of homes (P L (t)) varies with the running time of appliances. Therefore, the running time is the optimization variable of this study, which is an integer value as it is usually coded as an index number for power flow (P(t)). Therefore, this paper proposes stochastic algorithms based on random integer numbers, which have been called the random integer search optimization (RISO) algorithm.

RISO Algorithm
Commonly, stochastic optimization utilizes a real random number between zero and one; however, the index numbers of matrices in the coding programs are integer numbers. Therefore, applying the famous optimization algorithms requires modifying them to fit the integer variables [38], which affects their accuracy. In this work, we present a straightforward optimization algorithm based on generating random integer numbers called the random integer search optimization (RISO) algorithm. Firstly, this algorithm randomly generates a vector of initial population agents (X), as in Equation (10). After that, the cost function is computed for all population agents, and the agent with the lowest cost is selected to be the best agent (X*), as in Equation (11). Furthermore, a random selection for a random search agent (X r ) will be performed as in Equation (12). Then, the search agents will be updated as in Equation (13). The boundary of the updated agent should be checked to be within the lower and upper boundaries, as in Equation (15). The exploration of the proposed algorithm is achieved by using the random selection of the search agent (X r ); however, the exploitation is achieved by using the variable A. The pseudocode of the proposed RISO algorithm is shown in Algorithm 1.
where LB and UB are the vectors of the lower and upper bounds of the optimization variables, N is the random integer vector, r is a real random number (∈ [0, 1]), itr is the current iteration, and Max_itr is the total number of iterations.
Initialize the search agents X using Equation (10) find the minimum cost function f*(X*) While Itr less than Max_iter Use Equation (12) to find a random search agent X r Do for all search agents r = random number between [0, 1] Use Equation (14) to find the value of a & A Update the search agents X using Equation (13) Check if the new search agents are within the boundaries as in Equation (15) find the cost function for all search agents f(X) using Equation (16 End While Output f*(X*) and X*

Objective Function
This study aims to reduce purchasing power from the grid to achieve zero-energy buildings. Furthermore, selling the excess power to the grid can reimburse the capital cost of installing renewable energy resources. Therefore, the minimum bought power from the grid means the minimum cost function, so it is a proportional relationship. On the other hand, the cost function will decrease with the increase in surplus generated power to the grid, so the cost function is inversely related to the sold power to the grid, as in Equation (16).
where C Total is the total cost and ∆t is the step time (h); c b, and c s are the cost of bought and sold power ($/kWh).

Optimization Flowchart
In this section, Figure 2 displays the optimization flowchart. The demand power (P D ) from the grid should be zero wherever the generated PV power is enough to feed the load power (P L ). However, the surplus power can be first used to charge the battery system if the battery system's SOC is less than its maximum value, or it can be sold to the grid (P g = P D ) if the SOC is at its maximum value. Otherwise, if the PV power is insufficient, the system will draw power from the batteries to make up the difference. However, if the power from the PV and batteries is insufficient to feed the demand, the power shortage will be purchased from the grid. Using the RISO algorithm to determine the day-ahead schedule of household appliances based on the day-ahead weather forecast energy demand can help reduce energy costs. Within the predetermined time window, the RISO will determine the best time to turn on the appliances for homeowners. The total cost for the scheduled home appliances is determined in (16). The optimization process will continue up until the maximum number of iterations. The best schedule for the load profile is the final result of this flowchart.   Figure 3 shows some of the common types of household appliances and the preferred time range for them to be used in urban houses in Hong Kong. The prescribed comfort time range is based on people's common habits and needs to use these appliances. For example, the starting point (t start ) of the range hood appliance is at 5:00 and the end time (t end ) is at 17:00, while the duration time of operation is 30 min. The electric vehicle is considered as a household appliance, where it is expected to receive energy in the time range of 00:00 to 9:00 with a duration of 2 h. The hourly load profile for a residential consumer is randomly generated without optimization, as shown in Figure 4. It is clear that the EV charging time interval is 3:30 to 5:30 with a duration time of 2 h. Moreover, the total energy consumption at the end of the day is approximately 29 kWh. For the optimal load profile, the proposed RISO algorithm can be applied to select the best starting time (t* start ) in the time range [t start , t end − ∆τ]. Therefore, the proposed method is generalized and flexible enough to be applied to select the optimal operating periods within any comfort time range, which can be suggested by every homeowner.  Figure 3 shows some of the common types of household appliances and the preferred time range for them to be used in urban houses in Hong Kong. The prescribed comfort time range is based on people's common habits and needs to use these appliances. For example, the starting point (tstart) of the range hood appliance is at 5:00 and the end time (tend) is at 17:00, while the duration time of operation is 30 min. The electric vehicle is considered as a household appliance, where it is expected to receive energy in the time range of 00:00 to 9:00 with a duration of 2 h. The hourly load profile for a residential consumer is randomly generated without optimization, as shown in Figure 4. It is clear that the EV charging time interval is 3:30 to 5:30 with a duration time of 2 h. Moreover, the total energy consumption at the end of the day is approximately 29 kWh. For the optimal load profile, the proposed RISO algorithm can be applied to select the best starting time (t*start) in the time range [tstart, tend − Δτ]. Therefore, the proposed method is generalized and flexible enough to be applied to select the optimal operating periods within any comfort time range, which can be suggested by every homeowner.

Weather Conditions Data
Section 2 describes that the PV power generation varies with the solar irradiatio ambient temperature variations. Therefore, in this study, we employed real hourly of solar irradiation and temperature in Hong Kong on 1 January 2021, as shown in F 5. We assumed that these data are the day-ahead forecasted weather conditions winter to test the effectiveness of the proposed HEM. The peak solar radiation is a 750 W/m 2 , which occurred at 12:00.

Case Study
Three scenarios were investigated and compared in this work. The primary sou all scenarios is the PV system, and this work aims to reduce the purchased grid p while simultaneously reducing the cost of energy consumption by using an optim scheduling of the load profile. Therefore, we studied three scenarios of home energy agement to show the benefits of optimal load rescheduling. Table 1 shows the pro three scenarios of energy resources with or without an optimal schedule.

Weather Conditions Data
Section 2 describes that the PV power generation varies with the solar irradiation and ambient temperature variations. Therefore, in this study, we employed real hourly data of solar irradiation and temperature in Hong Kong on 1 January 2021, as shown in Figure 5. We assumed that these data are the day-ahead forecasted weather conditions in the winter to test the effectiveness of the proposed HEM. The peak solar radiation is almost 750 W/m 2 , which occurred at 12:00.

Weather Conditions Data
Section 2 describes that the PV power generation varies with the solar irradiation and ambient temperature variations. Therefore, in this study, we employed real hourly data of solar irradiation and temperature in Hong Kong on 1 January 2021, as shown in Figure  5. We assumed that these data are the day-ahead forecasted weather conditions in the winter to test the effectiveness of the proposed HEM. The peak solar radiation is almost 750 W/m 2 , which occurred at 12:00.

Case Study
Three scenarios were investigated and compared in this work. The primary source in all scenarios is the PV system, and this work aims to reduce the purchased grid power while simultaneously reducing the cost of energy consumption by using an optimal rescheduling of the load profile. Therefore, we studied three scenarios of home energy management to show the benefits of optimal load rescheduling. Table 1 shows the proposed three scenarios of energy resources with or without an optimal schedule.

Case Study
Three scenarios were investigated and compared in this work. The primary source in all scenarios is the PV system, and this work aims to reduce the purchased grid power while simultaneously reducing the cost of energy consumption by using an optimal rescheduling of the load profile. Therefore, we studied three scenarios of home energy management to show the benefits of optimal load rescheduling. Table 1 shows the proposed three scenarios of energy resources with or without an optimal schedule. In this scenario, a residential house's energy sources are presumed to be hybrid photovoltaics (PVs) and the grid, with the load profile being depicted in Figure 4. The load profile includes the charging of an electric vehicle (EV) at a rate of 6 kW for two hours between 3:30 and 5:30 a.m., with the initial state of charge (SOC) being equal to 20% of the total battery capacity (12 kWh). The other household appliances are used according to the house occupation on the weekdays, where the load demand peaks in the morning (7:30 to 9:00) and evening (16:00 to 17:00 and 20:00 to 22:00). The daily energy use is approximately 29 kWh. The capacity of the PV system is 6 kW, which generates electrical power based on the incident solar irradiance and ambient temperature, with the peak power generation occurring during the noon hours. Figure 5 depicts Hong Kong's sun irradiation and temperature data for January. PV energy is used to meet load demand first, and then the surplus energy is supplied into the grid. However, if the PV power generated is less than the load requirement, the grid will satisfy the load demand, as illustrated in Figure 6. Table 2 summarizes the total energy that is provided to and from the grid. In Hong Kong, the feed-in tariff for power delivered to the grid is 5 HKD/kWh, while the rate for energy acquired from the grid begins at 0.674 HKD/kWh. While the amount of purchased and sold energy is nearly the same, the cost of sold energy is greater to encourage the customers to install solar panels on their homes. In this scenario, a residential house's energy sources are presumed to be hybrid photovoltaics (PVs) and the grid, with the load profile being depicted in Figure 4. The load profile includes the charging of an electric vehicle (EV) at a rate of 6 kW for two hours between 3:30 and 5:30 a.m., with the initial state of charge (SOC) being equal to 20% of the total battery capacity (12 kWh). The other household appliances are used according to the house occupation on the weekdays, where the load demand peaks in the morning (7:30 to 9:00) and evening (16:00 to 17:00 and 20:00 to 22:00). The daily energy use is approximately 29 kWh. The capacity of the PV system is 6 kW, which generates electrical power based on the incident solar irradiance and ambient temperature, with the peak power generation occurring during the noon hours. Figure 5 depicts Hong Kong's sun irradiation and temperature data for January. PV energy is used to meet load demand first, and then the surplus energy is supplied into the grid. However, if the PV power generated is less than the load requirement, the grid will satisfy the load demand, as illustrated in Figure 6. Table 2 summarizes the total energy that is provided to and from the grid. In Hong Kong, the feed-in tariff for power delivered to the grid is 5 HKD/kWh, while the rate for energy acquired from the grid begins at 0.674 HKD/kWh. While the amount of purchased and sold energy is nearly the same, the cost of sold energy is greater to encourage the customers to install solar panels on their homes.  In this scenario, the battery energy storage system (BESS) is used to reduce the carbon footprint. The BESS's total capacity is assumed to be 14 kWh, with an initial SOC of 80% of the total capacity. The PV power first meets the load demand, and the surplus power is used to charge the BESS. Any excess PV power will be fed back into the grid if the BESS is Power (kW) Figure 6. Energy generation and load demand for scenario 1. In this scenario, the battery energy storage system (BESS) is used to reduce the carbon footprint. The BESS's total capacity is assumed to be 14 kWh, with an initial SOC of 80% of the total capacity. The PV power first meets the load demand, and the surplus power is used to charge the BESS. Any excess PV power will be fed back into the grid if the BESS is fully charged. If the PV power is less than the load demand, the BESS will discharge and meet it. If the load demand exceeds the BESS's maximum discharge power, the grid supplies extra power. Furthermore, if the SOC of the BESS is 20% of the total capacity, the BESS will stop discharging, and the load demand will be met solely by the grid, as shown in Figure 7. By comparing Tables 2 and 3, it is obvious that the total energy purchased from the grid in scenario 2 is reduced from 23 kWh to 6.6 kWh. Therefore, in addition to the cost savings, the homeowner reduced around 75% of their carbon footprint, which helps them to achieve the government policy to reduce greenhouse emissions.  The carbon footprint is further minimized in this case by using load demand ma agement. Customers can change the operating time of their household appliances with their frequent interval operating period. The RISO algorithm redistributes the applianc consumption in their frequent interval operating time. The RISO is used to reduce t grid-purchased electricity while increasing the clean energy feed-in to the grid. The obje tive function is the cost of purchased power divided by the cost of sold power. Figure illustrates the cost savings that are associated with the RISO algorithm. Figure 9 illustra the shifting load demand and power supplied by the PVs, BESS, and grid. The amou and cost of grid-purchased energy and grid-sold energy are given in Table 4. By comp ing Tables 3 and 4, the amount of grid energy purchased is lowered, resulting in a co reduction of 25% from 5.37 to 4.01 HKD/day. On the other hand, the amount of clean e ergy that is sold to the grid is increased from 11.8 to 13.59 kWh, which results in an crease of nearly 9 HKD/day in revenue.

Scenario 3
The carbon footprint is further minimized in this case by using load demand management. Customers can change the operating time of their household appliances within their frequent interval operating period. The RISO algorithm redistributes the appliances' consumption in their frequent interval operating time. The RISO is used to reduce the grid-purchased electricity while increasing the clean energy feed-in to the grid. The objective function is the cost of purchased power divided by the cost of sold power. Figure 8 illustrates the cost savings that are associated with the RISO algorithm. Figure 9 illustrates the shifting load demand and power supplied by the PVs, BESS, and grid. The amount and cost of grid-purchased energy and grid-sold energy are given in Table 4. By comparing  Tables 3 and 4, the amount of grid energy purchased is lowered, resulting in a cost reduction of 25% from 5.37 to 4.01 HKD/day. On the other hand, the amount of clean energy that is sold to the grid is increased from 11.8 to 13.59 kWh, which results in an increase of nearly 9 HKD/day in revenue.
illustrates the cost savings that are associated with the RISO algorithm. Figure 9 illustrate the shifting load demand and power supplied by the PVs, BESS, and grid. The amoun and cost of grid-purchased energy and grid-sold energy are given in Table 4. By compa ing Tables 3 and 4, the amount of grid energy purchased is lowered, resulting in a co reduction of 25% from 5.37 to 4.01 HKD/day. On the other hand, the amount of clean en ergy that is sold to the grid is increased from 11.8 to 13.59 kWh, which results in an in crease of nearly 9 HKD/day in revenue.

Conclusions
This paper introduced a novel optimization algorithm, the RISO algorithm, for a comfortable home energy schedule. Consumers will save money and lessen their carbon footprint without sacrificing comfort thanks to this comfort load schedule, even though the utility will not pay for it. By planning the load demand within the user-friendly usage window, the proposed RISO algorithm helps lower the cost of electricity from the grid. The PV and battery systems are the study's main energy sources. Grid power is regarded as standby power for residences. The Hong Kong government also encourages homeowners to contribute to lowering their carbon footprints by feeding extra PV power into the grid. Three scenarios, which were enacted with and without an optimal load schedule,

Conclusions
This paper introduced a novel optimization algorithm, the RISO algorithm, for a comfortable home energy schedule. Consumers will save money and lessen their carbon footprint without sacrificing comfort thanks to this comfort load schedule, even though the utility will not pay for it. By planning the load demand within the user-friendly usage window, the proposed RISO algorithm helps lower the cost of electricity from the grid. The PV and battery systems are the study's main energy sources. Grid power is regarded as standby power for residences. The Hong Kong government also encourages homeowners to contribute to lowering their carbon footprints by feeding extra PV power into the grid. Three scenarios, which were enacted with and without an optimal load schedule, were researched to ascertain the efficacy of the proposed HEM system. The obtained simulation results showed that, without compromising user comfort, the optimal load schedule reduced the cost of energy consumption by almost 25%. Residential users can therefore help reduce the grid's carbon footprint by adding clean power to it or through the construction of zero-energy buildings by adding more batteries to store the extra power. In a future work, we will study the capital cost to implement the proposed method in a real house.