EVB-Supportive Energy Management for Residential Systems with Renewable Energy Supply

: This study examines the potential role that an Electric Vehicle Battery (EVB) can play in Home Energy Management System (HEMS) based on a future development on the performance and costs of batteries. The value of EVB in an HEMS with different home connection settings and energy consumption/storage/generation capacities are investigated to advise the optimal future HEMS setups. Solar PV are considered as the residential renewal energy supply, which is the main resource of uncertainty of the system. A novel forecasting model is deployed which incorporates geographical information, solar radiation forecast and weather-related conditions into an exponential-based method to simulate day-ahead solar PV output. Optimal ﬂows of energy and usage of storage (batteries) are then captured by a Stochastic Programming (SP) model and solved by CPLEX. Managerial insights and optimal designs of the HEMS are drawn based on the results obtained.


Introduction
Renewable energy and energy storage technologies have been developed for decades to conserve natural resources and to reduce global fossil-fuel carbon emissions [1,2]. Many global energy leaders tend to change the direction of production from fossil energy sources to renewables such as solar, wind, hydro, biomass, etc., which are often referred to as clean energies. For instance, renewable energy provided more than one-fourth of global electricity consumption by the end of 2018, and, moreover, its capacity grew by 8% compared to the previous year, which is led by wind and solar [3]. In 2019, the UK's electricity generated from renewables contributed to 35.8% of the total supply, which is led by wind power, bio-energy, solar photo-voltaic (PV), and hydro-power [4]. In addition, renewable energy sources are characterized in a particular location by considering the existing energy flows and the spatial and time variations [5]. For example, the suitable residential renewable energy deployments in the UK are known as solar panels and small wind turbines [6,7]. In particular, solar PV adoption has expanded rapidly over the past few years as the International Energy Agency (IEA) declared that solar PV power is the new king of electricity since it is consistently cheaper than fossil-fuel power plants [8].
It is well understood that significant uncertainties lie in the renewable power generation, e.g., residential or grid-scale solar power and wind turbine systems largely relying on the weather conditions. In addition, such renewable generations are usually not matching the typical daily consumption patterns of households. For household electric end-uses, there is a variety of home appliances including kitchen and cooking appliances, washing machine and tumble dryer, fridges and freezer, microwaves, ovens, toasters, humidifiers, Figure 1. The average household electricity consumption profile for a typical UK home [10].
As claimed by many publications [11][12][13][14][15], self-consumption, i.e., the power usage on its generation site, is one of the most efficient energy consumption modes, and its level can be increased by deploying energy storage. With the advances of technology and materials, solar PV panels and energy storage have became available at increasingly lower costs [11][12][13]16]. The key factors that affect the renewable energy deployment at household level can then be concluded as the quality of the weather forecasting and the optimal usage of energy storage.
On the other hand, Electric Vehicles (EVs) play a critical role in meeting the environmental goals to reduce local air pollution and to address climate change. In many countries, there is an effort to promote EV development and usage so as to reduce pollution levels by introducing EV policy support measures in various types of Government policies, e.g., financial benefit, tax incentive, etc. [17,18]. Over the last decade, the global EV market expanded rapidly driven by supportive policies and technology advances at all governance levels [19]. Besides these policies, as EV is driven by a battery and it comes home together with the driver, which leads to discussions of using the EV battery to supply home devices, namely EV-to-home power supply. For example, Mitsubishi Motors Corp and the Electricity Generating Authority of Thailand have agreed to cooperate in developing a system to enable electric vehicles to power homes for other purposes in 2021 [20]. Moreover, recently, Tesla's battery supplier, as one of the leaders of energy storage and EV technologies, plans to launch a lower-cost and million-mile lifespan battery [21].
Based on the above analysis, given the uncertain distributed renewable generation (e.g., micro wind turbines, on-roof solar panels for local communities and households), different clean energy technologies (e.g., EVs, battery storage), and various consumption needs, it is important to have an optimal control system to coordinate the operations of the residential renewable energy system. The home energy management system (HEMS), which could serve such a role, can be seen as a demand response tool conceptualized based upon solar energy management system [22]. Existing literature on HEMS has presented several optimization models and techniques such as stochastic dynamic programming (SDP) [23], convex programming [24], mixed integer linear programming (MILP) [25] and stochastic programming (SP) [26,27] to optimize energy usage in smart homes with renewable energy, energy storage system (ESS) and plug-in electric vehicle (PEV). For instance, Schram et al. [28] proposed a simulation model to optimize the home battery with different household load profiles and PV systems. Moreover, stochastic management of energy storage is one of the important areas to explore to reveal the potential that lies in renewable energy sources [28]. Mathematical optimization, model predictive control and heuristic control are used to improve the efficiency of energy operation in households [29]. The operating policies have been efficiently proposed and applied including vehicle-to-home supply [25] and peak-load shifting [25]. Although our research question comes within the context of home energy management, it is worth mentioning that other research problems in similar or different context could be closely related. For instance, the energy management of microgrids and nanogrids (e.g., buildings) equipped with EVs, energy storage, and PV [30,31] is a closely relevant research problem. Along this direction, Ref. [32] developed a stochastic programming framework to the integrated demand and supply energy management for microgrids. Ref. [33] further extended the framework to multi-energy microgrid equipped with the combined heat and power unit (CHP). Ref. [34] further studied the potential of using a second-life battery as storage in the microgrid system. Ref. [35] developed an Internet-of-things (IOT) based system to monitor the battery status in the microgrid.
Most existing works formulate and optimize the system based on the communication between devices and smart meters for real-time uses so as to monitor electricity consumptions in households with real-time pricing (RTP). In this work, however, we assume that the hourly charging rate of batteries can be pre-set in smart meters according to a forecast of weather condition, electricity price and demand in the following 24 h. We also look at the supportive policies of energy storage systems whether it be electric vehicle battery (EVB) or home energy storage by managing day-ahead electricity usage. The research challenges therefore lie in not only modelling the HEMS as a demand response tool to improve the energy load consumption according to electricity price, but also developing an efficient solar PV forecasting for dealing with system parameter uncertainty.
To this end, this paper aims to propose and investigate the different residential energy connections of EV Battery (EVB) to the residential solar PV system and to home appliances so as to explore the effectiveness of deploying EV batteries in future households. The remainder of this paper is organized as follows: Section 2 summarizes the problem settings and system parameters to be used in our system models. Section 3 presents a forecasting model on electric generation from solar panels. In Section 4, we develop and formulate the EVB-supported systems under a time-of-use tariff in a normal situation on weekdays by stochastic programming (SP). Section 5 summarizes the results of the optimization models under different generation and battery capacities. Finally, in Section 6, we conclude on the optimal settings of the EVB-supported system under different scenarios. Figure 2 represents the electricity flow inside a household which has a solar PV system, a home battery and an EV. Demands are classified into three categories, i.e., EV, typical home appliances and small appliances. It shows the default system where all devices are connected to the grid. A home battery is installed and connected to the solar panel to increase self-consumption. Electricity generated by solar panels or pulled from the grid can directly supply home appliances and/or charge the home battery, while home battery can supply the appliances as well. We assume that solar panels can directly supply home appliances without going through the home battery. A stochastic programming model will be developed in this work to explore the optimal usage of batteries under this connection setting under different solar PV generation levels and home battery capacities.

Default Setting and System Parameters
The EV is driven by its own battery which can be charged from the grid. Due to the voltage and existing restrictions, direct charge from solar panel to the EV battery is prohibited by this default layout. In later discussions, however, we will lift this restriction to explore the potential usage of EV batteries in balancing demands and supply, and look into the possibilities of replacing home batteries by EV battery in a household with renewable energy supply. In Section 4, we will develop a stochastic programming model to optimize the usage of batteries in energy shifting so as to minimize household bills. Based on the developed model, further discussion will be carried out on the role of EV and home batteries and the potential integration of them. To feed in the uncertainties of the stochastic programming model, in Section 3, we will develop a novel forecasting approach to estimate the renewable energy generation levels.

Day-Ahead Probabilistic PV Generation Forecast
In this work, we develop a forecasting model with exogenous variables at the day ahead horizon to generate scenarios of the hourly output of the peak-PV generation for the next 24 h. For the solar PV power forecasting, the time-series methodology is one of the three major categories for a micro-scale and intra-day resolution [36]. In particular, exponential-based and AutoRegressive Integrated Moving Average (ARIMA) based approaches [37][38][39][40][41] are suitable for the short-term solar PV planning. Most of these methods consist of meteorological data as exogenous variables such as solar radiation, sunshine hour, weather and cloud conditions, etc. The intensity of solar radiation or sunlight, which is a direct input of Photovoltaics (PV) via solar panels, reaches the earth surface that has a strong relation to satellite (images) data [42,43], historical solar radiation data [27,44], cloud conditions [16,27,44], and sunshine duration [43,45]. It also depends on a variety of factors including latitude, season, time of day, cloud cover, and altitude.
A forecasting model proposed by Chitsuphaphan et al. (2020) [27] (Section 2(E)) incorporates local information, such as coordinate, solar radiation forecast, and weatherrelated conditions into an exponential-based method that can be used to simulate day-ahead solar PV output. To forecast the day-ahead solar PV output in micro-scale resolution for residential energy consumption as a stochastic variable, we focus on statistical probabilistic forecasting [46] by adding the main factors in solar radiation at the earth surface [47], including geographic location, time of day, and local weather into the model [27].
In our analysis, we consider the cloud cover, including five available levels such as sunny, partly cloudy, mostly cloudy, cloudy, and rainy, being an independent variable (as an indicator variable that represents categorical data). Cloud cover is captured by a category variable with five levels. In the regression analysis, we transform it to a four-dimensional dummy variable x s,1j , x s,2j , x s,3j , x s,4j , with (0, 0, 0, 0) standing for sunny, (1, 0, 0, 0) standing for partly cloudy, (0, 1, 0, 0) standing for mostly cloudy, (0, 0, 1, 0) standing for cloudy and (0, 0, 0, 1) standing for rainy, where s indicates the location and j denotes the jth day.
Let (P s,j , x s,j ) represent a historical data set of the peak-PV generation and a cloud forecast vector at s position on day j, and A t S|x s,j denotes an amount of hourly-t solar electricity generation given x s,j = (x s,1j , x s,2j , x s,3j , x s,4j ). Therefore, the forecasting model with five levels of cloudiness used to simulate the scenarios of hourly electricity supply for the second-stage problem of the SP model is whereP s,j represents the magnitude forecast at s-position on day j when x s,j given, , v s,j denote sunrise and sunset time index, calculated by u s,j = sunrise time and v s,j = sunset time , respectively, f j denotes a frequency of sine wave function s.t.
The historical time series and cloud cover conditions (five levels of cloudiness) are serviced to download by the PVOutput platform (see https://pvoutput.org/, accessed on 24 May 2022). The data set is used to estimate the parameters of the forecasting model and simulate the scenarios afterward. In the UK, a 3 kWh solar panel system, which requires at least 21 square metres of surface area to install, can sufficiently generate electricity for daily consumption of a small household size (1-3 residents) [48]. Therefore, we will generate three sets of solar electricity scenarios (A ω S , ω ∈ Ω, |Ω| = 20) based on 1, 2 and 3 kWh peak PV system.

Notations and Parameters
To develop a stochastic programming model, we firstly declare parameters, decision variables and abbreviations in Table 1.

System Layouts and Models
To understand the different role played by each component of the household energy system, we look into different systems with respect to the availability of batteries and/or connections between batteries and devices. Table 2 summarizes the detailed systems we are examining with the connection links demonstrated in Figure 3. These scenarios are going to be compared with the default setting as displayed in Figure 2.
Note that these systems are proposed with a joint consideration of current practicality and potential future developments of the solar PV and energy storage devices. In detail, the on-grid system is the simplest system for a household with solar PV and EV, which is connected to the grid and all consumption are pulled directly from the grid while needed. To investigate how batteries help in carrying energy from generation phase (cheap hours) to demand phase (peak hours) so as to maximize self-consumption, the default system ( Figure 2) is proposed, which reflect the standard setup of a household with solar PV, EV and home energy storage (battery) with the state-of-the-art technology. The hybrid system, on the other hand, improves the default system by allowing power transmission from home battery to EV batteries so that, if the solar PV generation is higher than standard household consumption, the excess will not be wasted.  The other two systems are proposed by adding extra transmission possibilities from the EV battery to home appliances, on top of the structure of hybrid system and the on-grid system. By doing this, we create possibilities of integrating/replacing the home battery with/by EV battery. Considering EV is a global trend of the next generation vehicles, and these systems inform us about the optimal usage of EV batteries in a wider household energy settings. Note that all the links connecting to EV batteries are valid only when the EV is parked at home.

SP Model for the Default Setting
Default system, as shown in Figure 2, is a modern PV system that combines solar panels and battery storage in one place. The electricity generated from solar panels can be consumed right away or be stored in a home battery for later usage. This can improve self-consumption and ease the load and pressure on the grid. In addition, the home battery can also be used as a route to reduce energy bills by carrying electricity from off-peak hours to peak hours. We assume that the EV battery can only be charged at home from the grid, so essentially the two storage systems are not interacting with each other and the EV system is not influenced by the power supply from solar panels.
To simplify the problem structure, a two-stage SP is designed, with the first-stage deciding proactively the best amount to pull from the grid into the energy storage (EV and home battery), and the second stage reacting to the actual supply and demand to minimize the overall cost. Note that, in the formulation in this and subsequent subsections, we model the energy levels of battery directly as l t B (for battery storage) and l t E (for EV battery), instead of the relative measure of energy level (i.e., State of charge (SoC)). Such a modelling approach has been widely used in existing studies, e.g., [32,33].
Let y t G,k , k ∈ {E, B} and l t E be the first-stage variables and (x t i,j ) ω , (z t B,j ) ω , (y t S,B ) ω , (l t B ) ω , ∀i ∈ {S, G}, ∀j ∈ {T, D}, ∀k, ∀t, ∀ω be second-stage recourse variables, where ω denotes the outcome of the random weather condition. The two-stage SP model is expressed by EV battery flows: EV battery capacity: EV battery daily power cycle: Non-negativity: where ϕ(y t G,k , ω) represents the optimal objective of the second-stage problem under scenario ω. The second-stage problem can thus be written as Solar PV supply: Home battery flow: Electricity demands: Home battery supply: Home battery daily power cycle: Home battery capacity: Non-negativity: (y t S,B ) ω ≥ 0, ∀t, ∀ω (13) (x t i,j ) ω ≥ 0, ∀i, ∀j ∈ {T, D}, ∀t, ∀ω (14) (z t B,j ) ω ≥ 0, ∀j ∈ {T, D}, ∀t, ∀ω (15) where (A t S ) ω represents the 24-h PV output that are generated by the forecasting model in Section 3, which only become available in second stage.

SP Model for (a) Hybrid System
(a) Hybrid System is an extension of the default system by allowing EV battery to be charged by home battery. This system is proposed considering the possibility of a high generation from the solar panel beyond the daily household consumption. The remaining amount can then be used to charge the EV battery so as to save electricity bills. This scenario should work well when the solar generation is high and the home battery is relatively large. Major differences from the default system lie in five constraints: EV battery flows (moved to the second stage as it now depends on scenario (ω)): EV battery capacity (moved to the second stage as it now depends on scenario (ω)): EV battery daily power cycle (moved to the second stage as it now depends on scenario (ω)): Home battery flow: Home battery supply: where w t B,E ≥ 0 denotes the electricity flow from home battery to EV battery in hour t.

SP Model for (b) Hybrid System with EVB Supply
(b) Hybrid System with EVB Supply is an extension of the hybrid system by allowing home appliances to be supplied from the electric vehicle battery (EVB). This system is motivated by the fact that normally the house occupiers come back home together with the EV, so that the EVB connection is available during the peak demand hours. By pushing remaining energy from EVB to supply home appliances when parking at home, one can further reduce the electricity purchase from the grid during peak rate hours. This would enable the maximum usage of the EV battery as an energy storage, which is available to be charged during the off-peak night hours and to be discharged to supply home appliances during the peak hours. This scenario should work well when the home battery is relatively small. Major differences from system (a) lie in three constraints: EV battery flow: EV battery supply: Electricity demands: where (z t E,j ) ω ≥ 0, j ∈ {T, D} denotes the electricity flow from EV battery to home appliances in hour t.

SP Model for (c) On-Grid System
(c) On-grid System is a benchmark system which has no home battery installed. The excess solar electricity after supplying home appliances at time t, denoted by s t , can be uploaded to the grid to get power credits. This is shown by the link between the solar panel and the grids in Figure 3. Provided that the surplus can be sold back to the grid at a discounted price with discount rate γ, the objective function for second stage problem has to be updated to include the income.
s.t. EV battery flow: EV battery daily power cycle: EV battery capacity: with the second-stage problem written as Electricity demands: Non-negativity: where (s t ) ω ≥ 0 denotes the surplus electricity generated from solar panels in hour t. Note that, as there is no storage available, this surplus has to be uploaded to the grid regardless of whether this uploading is paid or not.

SP Model for (d) On-Grid System with EVB Supply
(d) On-grid System with EVB Supply is an extension of the on-grid system. It assumes no home battery but allows home appliances to be driven by EV battery. Essentially, we assume that the EV battery takes the role of home battery. A major difference lies in the fact that the EV battery is not available throughout the day and it can only be charged/used when the EV is parked at home, so it will miss the peak hours of solar generation and therefore has limited ability to store surplus solar power generations. The EV battery is more likely to serve only as a tool to bring cheaper electricity to peak hours. The SP model can be modified based on the one for an on-grid system. EV battery flow (moved to the second stage as it now depends on scenario (ω)): EV battery daily power cycle (moved to the second stage as it now depends on scenario (ω)): Electricity demands:

Experiment Settings and System Parameters
To draw valuable insights from solving the proposed SP model, we set the problem parameters to reflect practical situations according to reliable sources.
Electricity supply: A t i , i ∈ {S, G} In practice, the electricity grid can supply as much energy as what is needed by a household, so this problem has no constraints on the amount of electricity from the grid (A t G ). On the other hand, how much electricity we can generate from the PV system installed at home is under significant uncertainty, which has to be predicted to feed into the model. The electricity output from solar panels depends on several factors such as size, capacity, location, and weather conditions. In the UK, most residential solar PV systems installed typically have a capacity between 1 kWh and 4 kWh by taking around 8-28 square metres (m 2 ) of space. In this study, we will examine three different peak PV generation capacities at 1 kWh, 2 kWh and 3 kWh in clear sky conditions (sunny day) and study how electricity storage would act in these three settings. Re-scaled according to the chosen capacities, the spatial exponential smoothing model as presented in Section 3 is used to generate 20 random scenarios of the 24-h electricity generation, which are used as the {(A t S ) ω , t = 1, ..., 24, ω = 1, ..., 20} values in the model. Electricity demand: U t j , j ∈ {V, T, D} The households consumption data (without EV), i.e., U t T and U t D , are extracted from the household electricity survey [9]. In this study, we deploy the average household consumption data over all household types, in order to explore the optimal household electricity system settings under the typical UK consumption pattern. Devices (excluding EV) in households are categorised into two groups, i.e., major appliances (white goods) and small appliances and electronic devices (brown goods). Figure 4 summarises the hourly consumption level of these two categories (green and orange lines), together with other key information of the system like average daily PV generation and electricity price patterns. It can be seen that the peak demand occurs between 6:00 p.m.-9:00 p.m., which is the typical cooking and family entertaining time after working hours. High peak-load price applies to this period's consumption, which forms the major part of high electricity bills.
For the EV consumption (U t V ), we consider urban commuter driving profiles by assuming specifications as follows: (a) the household has an EV with 30 kWh battery, with a typical daily consumption of 10 kW, (b) the EV is only charged at home and its available time ranges from 7:00 p.m. to 7:00 a.m. the next morning. Let δ t be binary indicators stating the available charging time at home for the EV, which is set to one between 7:00 p.m.-7:00 a.m.
Electricity prices: P t i , i ∈ {S, G} For electricity prices, we take a typical time-of-use (TOU) electricity tariff that is provided by the eastern region household electricity surveys [9]. A day is divided into four time intervals, and each has its own electricity prices (P t G ) as shown by the red line in Figure 4. On the other hand, we assume that the electricity generated by solar panels (P t S ) is free of charge by ignoring the installation and maintenance costs. When customers upload energy back to the grid, they receive credits for doing so, and this is called Feed-in-tariff. In this study, we test through different levels of Feed-in-tariff, γ, between 0-60% of the lowest price of the TOU tariffs.
Energy storage capacity: C k , k ∈ {E, B} Being consistent with industrial production, here we assume that a 30 kWh (C E ) lithium-ion electric-vehicle battery is installed, which provides up to 160 km range per charge. As for the home battery C B , we are aiming to find the influence of it so we examine the options ranging from 0-30 kWh. The battery round-trip efficiency is the fraction of energy put into the storage that can be retrieved afterwards. Here, we set it to 80% according to [49].

Scenarios of Solar PV Generation
In this subsection, we fit the forecasting model of Section 3 to a real dataset recorded at a solar farm in Cambridge during 1-30 June 2019. This dataset consists of 1440 observations of half-hourly PV outputs with cloud cover conditions (five levels of cloudiness). The fitted model is then rescaled according to home PV capacity so as to generate simulation scenarios for our stochastic programming models. In the regression analysis (first stage of the proposed model), the aggregated-daily PV output, the dependent variable, is modeled with the independent variables weather conditions using the forward variable selection method.
The parameter estimation results of the forecasting model are presented in Table 3, which is used to simulate possible PV supplies via (1). Then, to feed in the stochastic programming model, we generate 20 random trajectories of hourly solar PV output for a specific weather condition, e.g., sunny, which form the inputs of the second-stage optimization model, which is presented in the following subsection.

Results of SP Models
In order to investigate the energy efficiency of the systems proposed, we test them with the aforementioned parameters. Experiments are carried out using ILOG CPLEX V12.9.0 on an Intel Core i9-7940X 3.1 GHz machine. Figure 5 shows a comparison of the energy bills under different system settings as presented in Section 4.2.  default system system (a) system (b) system (c) system (d) Figure 5. Daily household consumption costs by solar PV and battery capacities. Figure 5 shows the daily energy bills payable by the household under different system settings with different levels of Solar PV (SPV) generation and Home Battery (HB) capacities. Note that some results are the same for different systems; to display them clearly, some lines are thickened in Figure 5 and have another line drawn on top of it.
Not surprisingly, the daily usage cost decreases with increased size of solar PV capacity. The cost also decreases with an increased size of home battery, under the same solar PV generation. Upper limits on the home battery capacity can be identified for each system setting from the results. The larger the solar PV generation is, the higher HB should be installed to facilitate full usage of the power generated. According to Figure 5, suitable capacity of HB for 1 kWh, 2 kWh, and 3 kWh SPV under the default systems are, respectively, 3 kWh, 4 kWh, and 5 kWh. Higher home battery capacity will not decrease the electricity bill further. In addition, the best capacity of HB under systems (a) and (b) are, 3 kWh, 10 kWh, and 15 kWh for 1 kWh, 2 kWh, and 3 kWh SPV generation, respectively.
Through future analysis, we find that system (b) (allowing EVB supply to home appliances) reduces the electricity bill by 5.6-15% when no HB is installed in the household, and by 3.3-5% when HB capacity is very low (HB = 1). This is achieved by using the EVB to carry low-cost electricity from off-peak hours to peak hours. The reduction in bill slows down as the solar PV generation is getting higher. If we take a closer look, we can see that the electricity bills are roughly the same for system (b) when HB = 0, regardless of the size of the solar PV. This is because the EVB operates independently from the solar system if there is no home battery connecting them. On the other hand, the cost of the default system when HB = 0 decreases with the increased generation capacity of solar PV, so the gap between system (b) and the default system becomes less significant.
For system (a) (allowing transmission from HB to EVB), it converges to a default system when home battery capacity is low and converges to system (b) when home battery capacity is high. Indeed, when HB capacity is low, it carries less energy than the household demands so there will not be surplus to supply the EVB. When HB capacity is high, however, allowing EVB supply to home appliances will not add further value to the system. In addition, savings achieved by system (a) become more significant when solar system gets larger; it saves 21% (58%) on the daily electricity bill by allowing transmission from HB to EVB on top of the default system with 2 kWh (3 kWh) solar generation capacity. After a future examining of results with solar generation capacity of 2 kWh and 3 kWh, it is not hard to see that both systems are restricted by the battery size until the HB capacity reaches 5 kWh (they have the same decreasing pattern until HB = 5 kWh). Further savings can only be achieved with higher solar generation.
For systems (c) and (d), their results are shown in the figures by the scatters aligned on the left of each graph because they do not have home batteries (HB = 0). The scatters are labelled with the selling price rate considered, e.g., γ = 0.3 representing one can sell the surplus electricity at a price of 0.3 * min{P t G , t = 1, ..., h}. When selling price is zero, system (c) is identical to the default system (and system (a)) with HB = 0, while system (d) is identical to system (c) with HB = 0. We can see from the results that, when selling back electricity is allowed, the daily bill decreases approximately linearly with the increase of the selling price. System (d) saves around 20% on system (c) by allowing EVB supply to home appliances when γ = 0.3, and the savings increase with the size of solar panels. When γ = 0.3, system (d) leads to a similar daily bill to systems (a) and (b) with the highest possible home battery installed, and system (d) is certainly better than system (a) and (b) when γ = 0.4 or higher. This means that, supposing selling electricity in the future at a fixed price is allowed, replacing a home battery with an EVB battery becomes feasible at no extra daily usage cost. However, we also note that this increases the pressure and uncertainty of the grid management.

Managerial Insights
Based on the analysis above, we can obtain some managerial insights:

•
In general, EV batteries cannot fully replace HB because: (a) It cannot be charged by solar PV in our experimental setting; (b) It is not at home when solar PV generation reaches the maximum level. • Supposing that considerable rewards are paid for "selling" back electricity, e.g., at a rate of 40% of the lowest tariff, HEMS without home battery outperforms those with home batteries, and depends less on the solar generation level. • When home battery is not installed, allowing EVB supply to home appliances saves 5-15% of the daily bill. Therefore, once EV replaces petrol/diesel cars in the future, households having solar PV but no home battery installed can benefit from using their EVB as alternative home energy storage. • When home battery is large (over 10 kWh), allowing transmission from HB to EVB saves 21-58% of the daily bill with minimum 2 kWh solar generation. This suggests the future development directions of battery charging/discharging routes.

Conclusions and Future Work
In this study, we deploy a forecasting model that incorporates spatial information and weather-related conditions to predict solar PV generation for the following 24 h, in order to facilitate proactive management of electricity flows in a residential renewable energy system equipped with solar panels, home battery, EVs, and various types of loads. Several settings (connections) of the residential energy system are proposed and investigated, including allowing electricity transfer from home battery to EVB, and/or allowing EVB to supply home appliances where needed. Stochastic programming models are developed for every connection scenario, which are simplified to two-stage models to be solvable with CPLEX. Discussions around the possibility of replacing a home battery with EVB in future households, and the best connection setup in different supply and consumption scenarios is carried out according to the numerical results obtained.
In addition to this, our approach and the stochastic programming model can also be extended to cover more complicated system setups. We also note that, to capture the full dynamics of the system and for more accurate solutions, one can consider using a multi-stage stochastic model (instead of two stage) or Markov Decision Process (MDP). Another future research direction could be developed around the EV modelling including the statistical modelling of EV departure/arrival times and charging duration such as in [50], and considering different application scenarios such as solar-charging the EV at workplace during the daytime at a lower electricity price, and discharging to power home appliances in the evening [51].