Abstract
This paper presents a risk-averse stochastic programming model for the optimal design of a home energy system that integrates renewable energy generation from photovoltaic panels and a battery energy storage system. Prosumer’s loads are classified into base and programmable loads and the possibility of exploiting the flexibility of these latter is considered in the optimal design. Uncertainties associated with weather-related variables, load demand, and electricity tariffs are considered, through the definition of scenarios representing possible joint evolutions of these factors. The model incorporates a risk measure to control the cost variability and the objective function, by the conditional value-at-risk, aims at minimizing the expected costs that the prosumer may incur in a given percentage of worst-case scenarios. The approach is applied to a real case study in the residential sector calibrated on data of the Italian electricity market. Through numerical experiments and sensitivity analysis, optimal system sizing and operational strategies are derived under different risk preferences. Results demonstrate that the risk-averse stochastic programming approach leads to robust decisions, providing a balance between cost-effectiveness and reliability in the management of the home energy system.
Similar content being viewed by others
1 Introduction
Over the last few decades, a fundamental change in electricity supply has been globally observed, with a growing reliance on renewable energy sources (RESs). This transformation reflects evolving priorities towards sustainability, reducing carbon footprints, and increasing energy security. According to analysis by the International Energy Agency (IEA),Footnote 1 global renewable energy capacity additions in 2023 is increased by almost 50% to nearly 510 gigawatts. This growth rate represents the highest in the last decade and is expected to increase further over the next five years, driven by the rapid expansion of the solar photovoltaic (PV) panels and wind energy, which dominate the total production from RESs. The rapid rise in electricity prices, influenced by current geopolitical tensions, has played a key role in this upward trend. In addition, the price of PV panels continues to fall and governments around the world are promoting policies to facilitate their widespread adoption. This trend can also be seen in the residential sector, where more and more households are turning from consumers to “prosumers”, i.e. consumers who also produce electricity. Prosumers play a crucial role in the evolving energy sector as they contribute to the integration of locally generated renewable energy, enhancing grid resilience and sustainability. Furthermore, the residential sector, accounting for almost 27% to the total consumption, contributes significantly to a wider global transition towards a cleaner energy future ( Gajdzik et al. 2023).
The design of home energy system (HES) integrating RESs involves considering different factors, among which the non programmability of the energy supply. RESs are characterized by high intermittency as their production depends on weather-related variables that are not known in advance. A common alternative to mitigate this side effect is the integration of a battery energy storage system (BESS). Energy produced during periods of low demand can be stored and used during peak hours when electricity prices are higher and/or when RES production is reduced or stopped (as at night). In this way, by increasing the self-sufficiency rate, the HES can reduce the interaction with the grid, leading to a reduction in the electricity bills.
The optimal design of local HES integrating RES-BESS represents a challenging problem with significant practical implications. If the system size, represented in terms of number of PV panels and nominal BESS capacity, is not properly determined, the system could be underutilized or overutilized. In the first case, the prosumer will not get the benefits that he/she was expecting, while in the second case, he/she would incur investment and maintenance costs which are higher than necessary. Moreover, the selection of the optimal size is influenced by the operation of the system that depends, in turn, on the time of the year. During winter days the use of the storage device is typically limited as all the produced energy is directly used, vice versa during the summer time its use is much higher. Energy stored in the central hours of the day is discharged in the evening when electricity is used, for example, for air conditioning.
Another important aspect to account for is the possibility to implement Demand Side Management (DSM) programs. Nowadays, an increasing number of prosumers are equipped with smart-meters and controllable ICT devices. These advances have been increasing even more the proactive role of the prosumers who are becoming “prosumagers”, that is prosumers that can partially manage their consumption by planning controllable devices operation. Additional benefits can be gained adapting the demand pattern in response to price signal and energy availability. Besides a base load deriving from devices whose operation can not be modified, e.g., refrigerator and lighting, there is a flexible load component that could be exploited. Some devices, as washing machine for example, are deemed for control. Clearly, the possibility of scheduling the flexible loads represents another important issue that can have a significant impact on the optimal sizing. However, as the analysis of the scientific literature reveals, design and scheduling decisions are rarely considered as a whole in the sizing problem.
The optimal sizing problem is made more challenging by the inherent uncertainty affecting the main parameters involved in the decision process. Future electricity prices as well as production from RESs and daily electricity demand are not known in advance when sizing decisions should be taken. Nevertheless, neglecting the randomness in these parameters and relying on the solution of deterministic models, calibrated, for example, on the average value, can lead to decisions that are ineffective in a real-life context.
To account for uncertainty, we apply the stochastic programming framework, and, in particular, the two-stage paradigm. Here, first-stage decisions represent here-and-now actions referring to the optimal size of the considered devices, whereas second-stage decisions refer to operation of the HES in terms of BESS management and satisfaction of the electricity demand, taking into account the possibility of scheduling flexible loads. In addition, the proposed formulation incorporates a risk measure to control the variability of the electricity expenses. Specifically, we consider the Conditional Value at Risk (CVaR), a very popular risk measure in the financial field that allows to control the average cost that can be incurred in a given percentage of worst case situations (Rockafellar and Uryasev 2000). The proposed risk-based approach would provide more robust solutions compared to a risk-neutral approach where just the expected costs are minimized. For non-repetitive decision making problems, as those related to the system design, this approach would be preferable as it considers the impact produced by certain unfavorable situations that may occur.
To place the proposed contribution within the scientific literature, in the following we review the main related research streams, focusing on the residential sector. The aim is to highlight how our approach contributes to fill the existing literature gaps providing an innovative contribution.
2 Relevant scientific literature and research gaps
The optimal sizing of HESs has been the subject on intensive research in the last decades, as witnessed by the large number of scientific contributions. Very recent review papers, as Chreim et al. (2024) and Khezri et al. (2022), survey the main findings and indicate research gaps and challenges. In Chreim et al. (2024), the authors present a comprehensive review of the most recent techniques adopted to address the problem of planning and management of energy systems integrating storage devices focusing on the residential sector. The paper discusses both individual and shared BESS installations within a local energy community.
One of the main research gaps identified in Chreim et al. (2024) is the lack of consideration for the sizes of the BESS available on the market. Many studies determine an optimal size without accounting for commercially available options, meaning the recommended size often does not match the available models. As a result, investors are forced to choose a BESS with the closest available size, which can significantly alter the original plan and calculations. In the proposed formulation, this specific issue is addressed in order to provide recommendations that can be applied in a real-world setting. Additionally, the review highlights a limited number of papers that explicitly consider uncertainty factors affecting the decision-making process, none of which introduce a measure of risk.
In Khezri et al. (2022), the authors analyze the key parameters to consider in the optimal planning of the PV-battery systems for the grid-connected residential sector. More specifically, economic and technical data, along with an analysis of the main objective functions, design constraints and impact of the electricity pricing structure are critically analyzed. The paper also reviews the main optimization methodologies. The review highlights the importance to incorporate demand response strategies to reduce the capacity of PV and battery and hence the costs of the energy system.
In what follows, we review the main contributions related to our study. Papers are classified according to i) the structure of the formulation, either basic, i.e. only accounting for capacity decisions, or advanced, i.e. considering also scheduling decisions to manage flexible loads, and ii) the explicit consideration of uncertainty, i.e. deterministic versus stochastic.
Many different papers propose “basic” formulations aimed at determining the optimal size of the PV system and the nominal capacity of the BESS. The papers differ for the choice of the objective function and the constraints introduced to model the functioning of the energy system under evaluation. For example, some contributions consider financial objectives as the maximization of the net present value (NPV), e.g. Talent and Du (2018)- Khalilpour and Vassallo (2016)- Erdinc et al. (2015), or the minimization of the costs, e.g. Beck et al. (2016)- Zhou et al. (2018). In other papers, technical objectives are considered. For example, in Korjani et al. (2020) the aim is the design an energy system that guarantees the maximum self-consumption rate, whereas in Mulleriyawage and Shen (2020) both the minimization of the total costs and the maximization of self-consumption are considered.
Uncertainty has been typically neglected even in the “basic” formulation. Among the few papers dealing with the stochastic dimension, we mention Aghamohamadi et al. (2019) where the authors propose a robust formulation, aimed at determining the optimal capacity of a residential PV-battery system accounting for uncertain variations in the load and PV production. We also mention the contribution Xie et al. (2021) that deals with the problem of the optimal sizing of BESS considering virtual energy storage in a smart microgrid. The proposed model includes a mean-risk objective function aimed at controlling the risk of system cost variability due to the presence of PV and load uncertainties.
The number of papers integrating the management of flexible loads within the capacity sizing problem is by far lower. In Atia and Yamada (2016), the authors propose a mixed-integer linear formulation for the the optimal sizing of a renewable energy system with a BESS in which DSM is considered. The study only considers synthetic load profiles including expected thermal load for a community and lacks the consideration of real energy consumption pattern of individual households. A similar study has been carried out in Akram et al. (2018a) for a standalone residential microgrid, and results revealed that shifting 20% of the total load can result in a 5.5% of cost savings in the microgrid. The impacts of DSM on sizing the BESS together with thermal energy storage has been investigated in Akram et al. (2018b). However, the study is limited to a single residential profile and the added benefits of BESS to the residential PV-Battery system are not fully analyzed. More recently, Mulleriyawage and Shen propose in Mulleriyawage and Shen (2021) an optimal sizing framework for residential BESS where scheduling of flexible loads is considered. The analysis of the results shows that larger benefits, measured in terms of Return on Investment, are obtained when BESS are sized and operated with DSM.
Only few paper acknowledge the importance of explicitly accounting for uncertainty in optimal sizing problem. Here we mention Farrokhifar et al. (2020) where the authors propose a stochastic formulation for the optimal sizing and management of an HES also accounting for the scheduling of controllable loads. The aim of is to maximize the expected NPV and the approach is tested on two test cases related to an individual home and a larger micro-grid. The huge size of the proposed formulation (the involved variables are replicated in the number of months, number of days by month, number of hours per day and number of scenarios) limit the solution of the problem to instances of very small size (up to 10 scenarios).
The analysis of the scientific literature shows a research gap in the definition of supporting tools for the optimal sizing of PV-BESS energy systems integrating DSM. Scheduling of the flexible loads entails the introduction of binary decision variables making the mathematical problem even more challenging. More importantly, uncertainty has been typically neglected in the previous studies with a few exception. As the capacity sizing is a strategic decision problem, simplified solutions obtained solving deterministic formulations can lead to worse planning decisions with an evident impact in the long run. Consequently, this paper makes the following contributions to existing literature.
-
From a modeling perspective, we propose a comprehensive mathematical formulation for the optimal design of an HES considering DSM of flexible loads. Data uncertainty is dealt with by modeling the decision problem by the stochastic programming paradigm. The problem incorporates a risk measure aimed at controlling the variability of the total costs, minimizing the expected cost that can be incurred in a given percentage of the worst case realizations.
-
The paper provides extensive computational experiments carried out on a case study calibrated on data of the Italian electricity market. The results demonstrate the effectiveness of the proposed solution approach when considering an increasing number of scenarios. We validate the significance of explicitly dealing with data uncertainty and the importance of incorporating a risk measure. The findings of this study provide valuable managerial insights for decision makers prioritizing sustainable energy solutions.
The remainder of the paper is organized as follows. Section 3 introduces the problem, whereas Sect. 4 presents the proposed risk-based stochastic programming formulation. The considered case study is presented in Sect. 5, while numerical results are discussed in Sect. 6. Finally, conclusions and future research directions are discussed in Sect. 7.
3 Problem definition
We focus on the problem of the optimal design of a smart HES. Rather than completely relies on the grid supply, the prosumager considers the possibility of installing a local system composed by PV panels and BESS to satisfy, at least partially, the electricity load. The integrated solution allows to mitigate to some extent the uncertainty of the solar production, storing the amount produced in excess to the demand and discharging it when needed.
The prosumager’s home is connected via a bidirectional channel to the power grid (eventually the prosumager can belong to an energy community) and it is equipped with a smart controller able to monitor, control and operate the programmable electrical appliances. More specifically, loads are classified into two main groups, i.e., base and flexible. Oven, refrigerator, lighting belong to the first group and concur to define an energy request that can not be modified. As for the flexible loads, they can be further classified into shiftable and interruptible loads. The former are loads with an operation cycle that cannot be interrupted once initiated, e.g., dishwasher and laundry machine. Interruptible loads are, on the contrary, loads that can be interrupted as long as a given amount of energy is supplied during a specific time window. A typical example of this type of load is represented by the electric vehicles (EV) charge.
The choice of the optimal capacity sizing depends on the operation of the HES that should be defined in such a way to exploit the flexibility of the controllable loads by properly defining the time of operation. Compatible with the time windows defined by the end-user, flexible loads could be scheduled when the electricity prices are lower and/or when the energy stored in the battery is available. The final aim is to minimize the overall costs, defined as the sum of investment costs for equipment purchasing and the operating and maintenance (O&M) costs. The latter component includes the cost for purchasing the residual amount of electricity from the grid, eventually reduced by the revenue gained by selling to the grid the amount of electricity produced in excess to the demand, if any.
The design problem has a strategic nature since the investment decisions have usually a long-term impact and should be taken “here and now”, that is in face of uncertainty which characterize some system parameters. Electricity prices, solar production and energy demand are not known when the optimal configuration is selected, but their random nature should be taken into account during the decision process. Moreover, the choice of the optimal configuration is influenced by the operational decisions, like the daily load profile of the BESS, which refer to a short-term planning. The presence of solar-based technologies imposes considering meteorological conditions which primarily vary depending on the season. In the proposed formulation, we consider a planning horizon of one year represented by a set of typical days. In particular, each season is associated with a specific day and, for each reference day, we consider a time interval with a hourly resolution.
The stochastic nature of the problem under investigation suggests the adoption of the stochastic programming modeling framework. More specifically, we formulate the problem as a two-stage model with recourse. Here, first-stage decisions refer to the design of the HES, in terms of installed capacity of both PV and BESS, whereas second-stage decisions concern the operation strategy that could vary according to the day type, the hour of the day and to the realization of the uncertain parameters. To control cost variability we propose a risk based formulation, measured by the CVaR. We refer to Rockafellar and Uryasev (2000) and Noyan (2012) for the properties of the CVaR and its reformulation in stochastic programming.
In the following, the formulation of the proposed model is presented.
4 Mathematical model
We consider a time horizon of one year, described by a set \({\mathcal {D}}\) of reference days, each one representing a certain number of similar days in terms of consumption and production profiles. For example, we can assume one reference day for each season. For each day \(d \in {\mathcal {D}}\) we consider a planning horizon divided in hourly time steps, as usual in day-ahead decision processes, and we denote by \({\mathcal {T}} = \{1,2,\dots ,24\}\) the corresponding set. We further denote by \(\theta _d\) the number of days of type d in the year. Under this assumption, the overall planning solution is made up by considering the effect of each configuration over all the reference days and then calculating the overall benefit on a yearly basis.
As usual in stochastic programming, we assume that the uncertain parameters are represented by random variables defined on a given probability space \((\varOmega , {\mathcal {F}}, \mathrm{I\!P})\) (Ruszczyński and Shapiro 2003). We consider a discrete space and we assume that each realization (scenario) \(\omega \in \varOmega \) occurs with a probability \(\pi _\omega \).
The choice of the optimal configuration is influenced by the possibility to program the flexible loads. We introduce the sets \(\mathcal {J}\) = \(\{ 1,\dots ,J \}\) and \(\mathcal {K}\)=\(\{ 1,\dots ,K \}\) to denote the shiftable and interruptible loads, respectively.
For each flexible load, the prosumager can specify a time window, during which the request should be completed. In particular, for load \(j \in \mathcal {J}\), we denote by \([l_j, u_j]\) the prescribed time window and by \(n_j\) and \(q_j\) the duration (in hours) and the associated hourly energy consumption. Similarly, for each interruptible load \(k \in \mathcal {K}\), \([l_k, u_k]\) specifies the corresponding time window and \(q_k\) the required overall energy for the entire operation cycle. Differently from the flexible loads, the inflexible ones can not be programmed and can have an uncertain nature. We denote by \(b^{\omega }_{dt}\) the base demand for the hour t of the day type d under scenario \(\omega \).
While in the case of the simple consumer the energy supply is completely guaranteed by the electricity grid and may suffer from price fluctuations, in the case of the prosumager the dependence on the grid is partial, as the self-produced energy can be used either immediately or discharged from storage device when needed. We assume that the electricity tariffs are dynamic (i.e., they may change day by day) and hourly differentiated, mirroring common practices in many electricity markets (Beraldi and Khodaparasti 2023). This pricing scheme is comprehensive and encompasses other schemes, as the Time of Use (ToU) block and/or the flat one, as special cases. In particular, we denote by \(pb^\omega _{dt}\) the electricity price at the hour t of the day d under scenario \(\omega \). In addition, we consider the possibility that the excess of produced energy can be fed back to the grid and we denote by \(ps^\omega _{dt}\) the corresponding price that, in the most general case, can be time dependent and uncertain too, since it is defined by means of an auction clearing mechanism on the day-ahead market.
The design problem consists in determining the optimal capacity of the integrated PV-BESS system. We assume that, on the basis of a preliminary analysis of the models available in the market, a given set of candidate sizes can be determined. More specifically, we denote by \({\mathcal {I}}\) and \({\mathcal {L}}\) the sets associated with the BESS and PV sizes, respectively, and we model the choice of a given size by the first-stage variables. Specifically, we denote by \(x_i\) and \(y_l\), with \(i \in {\mathcal {I}}\) and \(l \in {\mathcal {L}}\), the binary variables taking the value 1 if the corresponding size is selected and 0 otherwise. We denote by \(S_i\), the capacity of the BESS of size i.
Each choice brings a known purchasing cost, denoted by \(c_i^{BES}\) and \(c_l^{PV}\), for the two technologies, respectively. Since the investment spans over a time horizon greater than one year, we consider the annualised cost by using a capital recovery factor f defined as function of interest rate r and the lifetime of the considered components denoted by \(N_i\) and \(N_l\). Specifically, considering a generic lifetime N, the recovery factor is defined as:
In the proposed formulation, first stage costs are associated with the investment decisions and are expressed as:
First stage constraints are reported below and refer to the capacity selection:
For each feasible configuration, the operation plan must assure the satisfaction of the energy request under every circumstance that may occur. In our proposed formulation, we designate as second-stage all the decision variables that vary in response to the actual observation of the uncertain parameters. In particular, for each hour t of the day d under scenario \(\omega \), these variables pertain to:
-
the management of the storage device by the variables \(E_{idt}^{\omega }\), \(v_{idt}^{\omega }\), \(w_{idt}^{\omega }\) related to the state of charge, the amount of electricity charged in and discharged from the BESS, respectively. We note that these variables are replicated in the number of possible sizes of the BESS;
-
the scheduling of the shiftable appliances by the binary variables \(\delta _{jdt}^\omega \) taking value 1 if the appliance is turned on, and 0 otherwise, and the supporting variables \(SL_{jdt}^\omega \), related to the amount of energy absorbed;
-
the scheduling of the interruptible devices by the variables \(IL_{kdt}^\omega \) representing the amount of supplied electricity;
-
the involvement with the market by the variables \(x_{dt}^\omega \) and \(y_{dt}^\omega \) representing the amount of electricity purchased and fed back to the grid, respectively.
The second-stage cost accounts for the operation and management of the designed system. Being affected by uncertainty, related to the future electricity prices and to the energy production, such a function is clearly random. For a fixed configuration of the HES, and a given realization \(\omega \), the second stage cost \(Q(x,y,\omega )\) represents the optimal objective function value of the second-stage problem specified below.
Here (4) accounts for the operation costs associated with the purchase of electricity. This amount is eventually reduced by the income generated from energy fed back to the grid.
Constraints (5)-(10) refer to the management of the storage device. In particular, (5)-(6) relate the state of charge of the BESS between two consecutive time periods, with (6) referring to the first hour of each day, where \({\bar{E}}_i\) represent the initial level of charge. By (7) continuity relations are imposed, stating that the state of charge, in the last period of each representative day, should be equal to the amount initially stored. Constraints (8) impose lower and upper bounds on the state of charge. In a similar way, constraints (9) and (10) bound the amount that can be charged to and discharged from the selected battery in each hour.
Constraints (11)-(14) refer to the scheduling of the flexible loads. In particular, constraints (11) impose that each shiftable appliance should be turned on within the time window at most at time \(u_j -n_j+1\), thus assuring that it never finishes later than \(u_j\). Constraints (12) are used to define the values of the auxiliary variables \(SL^{\omega }_{jdt}\) referring to the required energy amount. We note that the characteristics of the shiftable loads (e.g., time windows) might also vary according to the considered season. In the proposed model they are considered constant for all the representative days for the sake of notation simplicity. We also note that in general the working cycle of the shiftable loads (e.g., washing machine) is divided in stages, each one eventually requiring a different amount of electricity. Due to the strategic nature of our problem, which is mainly aimed at defining the optimal configuration, we use a simplified but still meaningful representation, believing that the more involved (in terms of additional binary variables required) stage-wise representation is more useful when focusing only on the operation level (Violi et al. 2023). Similarly, constraints (13)-(14) refer to the interruptible loads operation. In particular, constraints (13) guarantee that the total energy absorbed by load k within the defined time window is \(q_k\). A variable energy amount, within a given upper bound level \({\bar{e}}_{k} \), can be absorbed during each period of the chosen slot, whereas outside the windows the values are 0.
Constraints (15) refer to energy balance. More specifically, the total energy request coming from both the base and the flexible loads is fulfilled by exploiting the uncertain self-produced energy \(\xi ^{\omega }_{ldt}\) deriving from the installed PV system, by using the energy stored in the BESS and eventually purchasing the missing amount. We note that the energy in excess to the demand can be either stored or fed back to the grid. Finally, constraints (16)-(17) limit the amount of electricity that can be taken from or fed back to the power grid by means of upper bounds \(\varGamma _b\) and \(\varGamma _s\), whereas (18)-(19) define the domain of the decision variables.
The proposed formulation considers a risk measure in the objective function. More specifically, denoting by \(F(x,y,\omega )\) the total costs, defined as the sum of the first and second stage costs, the objective function is defined as:
Exploiting the translation invariant property of the \(CVaR_{1-\alpha }\), (20) can be rewritten as:
For a given probability level \(\alpha \in [0,1]\), the \(CVaR_{1-\alpha }\) measures the expected value of the cost exceeding the Value at Risk. Following Rockafellar and Uryasev (2000), it can be written as:
where \((\cdot )_+ = \max \{\cdot , 0 \}\) and \(VaR_{1-\alpha }\) represents the VaR, i.e., the \(\alpha \)-quantile of the distribution of the costs. We observe that the parameter \(\alpha \) translates the level of risk that the decision-maker is willing to accept and, consequently, drive the formulation to more or less conservative solutions. Specifically, when \(\alpha \) approaches to 0 the CVaR translates a risk neutrality position, the contrary when \(\alpha \) approaches to 1. Under the assumption of discrete distribution, the proposed risk-averse stochastic programming model can be rewritten as:
The complete risk-averse deterministic equivalent reformulation, together with the full nomenclature, is reported in the Appendix.
5 Case study and data setting
We consider a residential prosumager located in Southern Italy. In addition to the base load, which accounts for an average daily consumption ranging between 10 and 12 kWh depending on the day type (see Violi et al. (2023) for a detailed description of the prosumager consumption data). We assume that the household is equipped with four shiftable loads, whose main characteristics are given in Table 1. In particular, for each device, we report the operating windows, the number of working hours and the corresponding energy consumption. We also report the preferred hour, i.e., the starting hour when such loads are considered as non programmable. As for the interruptible loads, we have considered an EV that should be recharged when the vehicle is at home. In the experiments, we have considered the time window from 8 p.m. to 7 a.m. and an overall consumption of 18 kWh with a maximum hourly energy absorption of 2.3 kWh.
A preliminary analysis of the technologies available in the market has been carried out, taking also into account some specific constraints (e.g., the space availability). Specifically, for the BESS we have considered Lithium-ion storage devices with an increasing capacity, ranging from 5 to 20 kWh, and purchasing costs from €2,500 to €7,200.Footnote 2 As for the technical parameters related to the BESS management, we have considered the value 0.99 for \(\eta _c\), \(\eta _d\), \(\chi _c\) and \(\chi _d\), and 0.1 and 0.9 for \(\phi _i\) and \(\varPhi _i\), respectively (see also Violi et al. (2023)). All these values have been considered size invariant. Finally, the lifetime of the device has been set to 10 years.
As for the production side, we have considered PV panels with a nominal peak power of 335 \(W_p\) and an expected lifetime of 20 years. Considering the available space, we have considered 8 possible configurations, from 10 to 24 kW, with a purchasing cost ranging from €15,000 to €27,600.Footnote 3 The interest rate r used to derive the recovery factor has been set to \(3\%\) (see Ciocia et al. (2021)).
As already stated, the test case has been defined according to the Italian market features. First, we have considered the possibility for residential prosumers to have a tax-discount benefit of \(50\%\) of the purchasing cost in 10 years, and this issue will be taken into account for the evaluation of the economic convenience of resources. Secondly, in Italy there are no feed-in tariffs for new PV plants of a few kW (lower than 20 kW), but a prosumer with a PV system with less than 500 \(\hbox {kW}_p\) can access a net billing service (“Scambio sul posto”Footnote 4), which considers the grid as a sort of virtual storage system for energy that is produced, but not locally consumed by the prosumager (Ciocia et al. 2021). According to this service, provided by the grid operator, at the end of each year the prosumer receives a contribution that is made up by two distinct components:
-
1.
a first amount that is the economic value of the energy that is absorbed and injected to the grid (\(y_1^{\omega }\)), at a unit tariff \(st_1\);
-
2.
a second amount related to the surplus of energy, that is of the difference, if any, between produced and self-consumed energy (\(y_2^{\omega }\)), at a unit tariff \(st_2\), usually lower than \(st_1\).
To account for the on-site exchange, management costs used in proposed formulation have been rewritten as:
We note that equation (28) can be easily linearized by adding the following constraints:
In the experiments, the values of \(st_1\) and \(st_2\) have been set to 0.11 and 0.04 €/kWh, respectively.Footnote 5
Scenarios, entering as input parameters in the proposed formulation, refer to the purchasing electricity pricesFootnote 6 and solar production from the installed PV panelsFootnote 7. As regards prices, we have considered a mean-reverting process for the expected value estimation (Menniti et al. 2010) with random shifts, while for the overall uncontrollable demand and production from renewable systems we have considered random variations from the hourly expected value calculated on the basis of historical data for similar days. According to this assumption, the whole scenario set has been generated by merging the scenario sets obtained for each random variable independently through the Cartesian product and then by adopting a scenario reduction technique (Beraldi et al. 2010). The results reported in the following Section have been carried out by considering a set with 250 scenarios. For such number, the solutions provide good in sample stability values, that is the values of the first stage solutions for different instances of the same size are very close.
6 Computational experiments
This section is devoted to illustrate the test phase carried out in order to validate the effectiveness of the proposed decision approach. The overall numerical code has been implemented by the integration of MATLAB R2015Footnote 8 for the scenario generation and parameters set-up steps and GAMS 24.5Footnote 9 as algebraic modeling system, with state-of-art CPLEX 12.6.1Footnote 10 as solver for mixed integer problems. All the test cases have been solved on a PC Intel Core I7 (2.5 GHz) with 16 GB of RAM.
As detailed in the following, as basis of comparison we have considered simplified variants of the proposed formulation, obtained by considering (i) all the loads as inflexible, (ii) the deterministic model obtained by substituting the random variables with their expected values.
6.1 Solution analysis via Key Performance Indicators
The effectiveness of the proposed approach has been assessed by the computation of some well-known Key Performance Indicators (KPIs). The reported results have been obtained by considering a risk level \(\alpha \) equal to 0.95. Similar performance has been obtained considering other values of the risk aversion parameter.
The first two KPIs are the self-consumption (SC) and self-sufficiency (SS) rates (see, e.g., Ciocia et al. (2021)). The first one is defined as the amount of self-consumed energy (directly from the power output of the PV panels or later taken from the battery) over the overall local generation. The SS measures the consumption amount supplied by local generation with respect to the total consumption. Both the indicators refer to a specific time duration, fixed to one year in our case. It is evident that the maximization of the SC and SS indicators is a clear goal for the individual prosumager, with significant implications for the entire energy system. Indeed, high values of the considered KPIs highlight a reduced dependency on the grid supply and an increased efficiency of the use of the locally generated energy. The results are shown in Fig. 1, where we also report the same values computed under the assumption that all loads are inflexible. Specifically, we solve a variant of the proposed formulation where we impose that all the shiftable loads start at the associated default hour, while the EV absorbs the maximum amount of electricity each hour starting from the first hour within the specified time window.
Looking at the results, we may observe that the values of the SS are very high and very close for both the flexible and the inflexible case, whereas the SC indicator is higher when flexibility in electricity loads is accounted for in the design of the HES. This behaviour can be explained observing that in the case of programmable loads there is greater potential to align electricity consumption with renewable energy generation, thus increasing the use of produced energy.
Another KPI used to evaluate the benefit deriving from the adoption of the solutions provided by the proposed approach is the traditional cost saving (CS). Specifically, we measure the CS as the difference between the expected annual total cost provided by our model and that obtained when assuming all the loads as inflexible. The average CS in percentage is around \(24\%\), showing a clear benefit deriving from the possibility to schedule the operation of flexible loads. A similar comparison has been performed when considering the end-user as a simple consumer, that is without any energy resources. In this case the average percentage savings is of about \(67.34\%\), outlining how the availability of RESs and BESS can allow a radical change in the usage of electricity under an economic standpoint.
Additional KPIs have been used to evaluate the profitability of investing in a local HES. To this aim, we have measured the net present value (NPV), the internal rate of return (IRR) and the discounted payback period (DPP). For the calculation of these indicators we have considered the annual cash flow measured in terms of cost savings due to resources availability. The value of the discount rate has been set to 3% (Ciocia et al. 2021). Specifically, for the NPV the vale of 35,099.59 € has been obtained, whereas the values of IRR and DPP are 20.24% and 3.9 years, respectively.
The obtained values underscores the profitability of the investment project: PV panels and BESS complement each other providing valuable and sustainable solution. The investment is repaid in a limited number of years and provides a stable solution mitigating risks associated with volatile energy prices. Moreover, the high IRR value confirms the financial attractiveness of the investment playing a critical role in advancing the green energy transition.
6.2 Impact of uncertainty and risk
In what follows we examine the impact produced by the incorporation of uncertainty and risk in the optimal design problem. As usual in stochastic programming, we evaluate the benefit deriving from an explicit modelling of the uncertainty affecting the parameters involved in the decision problem by comparing the solution of the recourse formulation with respect to the solution obtained when solving the deterministic counterpart. To this aim, we have solved a deterministic model obtained by replacing the random variables with the corresponding expected values. More specifically, we compute the value of stochastic solution (VSS) originally introduced for stochastic formulations incorporating the expected value as objective function (Ruszczyński and Shapiro 2003). As our formulation is risk-based, the VSS, for a given risk aversion level \(\alpha \), is defined as:
In (32), \(CVaR^{Sto}_{1-\alpha }\) is the objective function value of the proposed formulation for a fixed value \(\alpha \), whereas the value of \(CVaR^{Det}_{1-\alpha }\) has been obtained by solving the same stochastic problem, but with the first-stage variables fixed to the values of the optimal solution of the deterministic problem with the expected values (also known as EEV). As the VSS depends on the choice of the risk level aversion, we derive a new indicator computed as average of the VSS values obtained for different levels of \(\alpha \) ranging from 0 to 1, with step increment of 0.1. The corresponding indicator is around 6% with higher values obtained when the decision maker is more risk averse, highlighting the advantage coming from an explicit consideration of the random nature of the input parameters.
It is worthwhile noting that the HES configuration provided by the deterministic and the risk-averse formulations are rather different both in terms of PV and BESS capacity. Specifically, the deterministic model suggests a solution with a higher PV capacity with respect to the stochastic solution (18 kW versus 11 kW), the opposite for the BESS (11 kW versus 13 kW). The lower PV capacity of the stochastic solution can be be justified by the consideration of the potential variability in solar generation: a smaller size is suggested with the aim to avoid over-investment that may not be fully utilized under certain conditions. Conversely, the higher BESS capacity might be suggested to provide greater flexibility and resilience against uncertainties, enabling the system to better manage intermittency and unexpected energy imbalances.
The final set of results shows how the risk aversion attitude impacts on the design of the HES. Specifically, we have solved different instances of the problem by varying the value \(\alpha \) from 0 to 1, with a step increment of 0.1. We recall that when the risk level is set to 0, the objective function aims at maximizing the expected value with no consideration for possible cost increase that can occur in adverse situations. As expected, this approach yields the lowest objective function value. As the value of \(\alpha \) increases, an increase in the objective function value is observed. In such instances, the decision-maker would prioritize "safer" design solutions, even if they may be more costly. In the extreme case, when considering \(\alpha \) approaching to 1, the aim becomes the minimization of the total cost in the worst case scenarios. Clearly, when this criterion is selected, the maximum value for the objective function is achieved.
The results are shown in Fig. 2, where we report the values of the objective function for different levels of \(\alpha \).
Looking at the Figure, we can appreciate the difference in the objective function values associated with the two extreme cases, i.e., \(\alpha \) equal to 0 and 1. Specifically, in the case of risk neutrality, the value of the objective function is 13% lower than the corresponding value obtained for the risk aversion case. Looking at the solutions obtained in the two extreme cases, we may notice that the PV capacity is the same, whereas for the storage device when the decision-maker is more risk averse the suggested BESS size is larger.
The following Table 2 reports the main benefits due to the model application for the optimal sizing problem and the operation of the prosumager.
All the results of the computational experiments we have carried out confirm the benefits of the PV and BESS integration and suggest to invest in larger storage devices to effectively manage unfavorable situations that can occur, related to instability in electricity market prices and variability of solar production.
7 Conclusions and future work
In this work we have faced the decision problem related to the design of a home energy system, which potentially integrates both RESs and BESS, with the aim of minimizing the overall cost of both resource purchasing and operation of the energy procurement. In order to model a realistic household status, we have considered the presence of flexible loads, which operation cycle can be scheduled and/or interrupted for a better matching between energy demand and production or for moving the energy absorption from the grid when the purchasing price is lower.
The inherent uncertainty of the decision problem, due to the unpredictability of various factors (base load demand, renewable production and market prices), has motivated the definition of a stochastic programming model, having as objective the minimization of the risk exposure according to the risk-aversion attitude of the prosumager. The solution provides the optimal combination of PVs and BESS sizes over a long-term horizon, by simulating their adoption on a day-by-day planning.
Several computational experiments have been carried out on case study defined according to the Italian market rules, providing interesting managerial insights and demonstrating the benefit related to the purchasing of energy resources under both the economic and sustainability viewpoint, by means of different KPIs. Moreover, the effectiveness of a stochastic approach instead of a deterministic one has been validated as well, showing clear savings in particular as regards the investment costs in resources. Finally, some experiments have validated the capacity of properly deal with different risk-aversion attitudes of the prosumager, by means of different resource size combinations and load scheduling planning.
Possible future research directions include first of all the possibility of extend the sizing problem to an energy coalition as a whole, considering the possibility of sharing both RESs and BESS among the prosumagers participating to the aggregation. Another interesting enhancement can be related to the integration of thermal loads and production and storage systems, aiming at providing more effective and realistic solutions for both the optimal sizing and the management decision problems.
Data Availability
Not applicable.
Notes
References
Aghamohamadi M, Mahmoudi A, Haque MH (2019) Robust allocation of residential solar photovoltaic systems paired with battery units in south australia. In: 2019 IEEE energy conversion congress and exposition (ECCE), pp 6673–6679 . https://doi.org/10.1109/ECCE.2019.8913208
Akram U, Khalid M, Shafiq S (2018) An improved optimal sizing methodology for future autonomous residential smart power systems. IEEE Access 6:5986–6000. https://doi.org/10.1109/ACCESS.2018.2792451
Akram U, Khalid M, Shafiq S (2018) An improved optimal sizing methodology for future autonomous residential smart power systems. IEEE Access 6:5986–6000. https://doi.org/10.1109/ACCESS.2018.2792451
Atia R, Yamada N (2016) Sizing and analysis of renewable energy and battery systems in residential microgrids. IEEE Trans Smart Grid 7(3):1204–1213. https://doi.org/10.1109/TSG.2016.2519541
Beck T, Kondziella H, Huard G, Bruckner T (2016) Assessing the influence of the temporal resolution of electrical load and pv generation profiles on self-consumption and sizing of pv-battery systems. Appl Energy 173:331–342. https://doi.org/10.1016/j.apenergy.2016.04.050
Beraldi P, De Simone F, Violi A (2010) Generating scenario trees: a parallel integrated simulation optimization approach. J Comput Appl Math 233(9):2322–2331
Beraldi P, Khodaparasti S (2023) Designing electricity tariffs in the retail market: a stochastic bi-level approach. Int J Prod Econ 257
Chreim B, Esseghir M, Merghem-Boulahia L (2024) Recent sizing, placement, and management techniques for individual and shared battery energy storage systems in residential areas: A review. Energy Rep 11:250–260. https://doi.org/10.1016/j.egyr.2023.11.053
Ciocia A, Amato A, Di Leo P, Fichera S, Malgaroli G, Spertino F, Tzanova S (2021) Self-consumption and self-sufficiency in photovoltaic systems: effect of grid limitation and storage installation. Energies 14
Erdinc O, Paterakis NG, Pappi IN, Bakirtzis AG, Catalão JP (2015) A new perspective for sizing of distributed generation and energy storage for smart households under demand response. Appl Energy 143:26–37. https://doi.org/10.1016/j.apenergy.2015.01.025
Farrokhifar M, Aghdam FH, Alahyari A, Monavari A, Safari A (2020) Optimal energy management and sizing of renewable energy and battery systems in residential sectors via a stochastic milp model. Electric Power Syst Res 187:106483. https://doi.org/10.1016/j.epsr.2020.106483
Gajdzik B, Jaciow M, Wolniak R, Wolny R, Grebski WW (2023) Assessment of energy and heat consumption trends and forecasting in the small consumer sector in poland based on historical data. Resources 12(9) . https://doi.org/10.3390/resources12090111
Khalilpour R, Vassallo A (2016) Planning and operation scheduling of pv-battery systems: a novel methodology. Renew Sustain Energy Rev 53:194–208. https://doi.org/10.1016/j.rser.2015.08.015
Khezri R, Mahmoudi A, Aki H (2022) Optimal planning of solar photovoltaic and battery storage systems for grid-connected residential sector: Review, challenges and new perspectives. Renew Sustain Energy Rev 153:111763. https://doi.org/10.1016/j.rser.2021.111763
Korjani S, Serpi A, Damiano A (2020) A genetic algorithm approach for sizing integrated pv-bess systems for prosumers. 151–156 . https://doi.org/10.1109/IESES45645.2020.9210700
Menniti D, Scordino N, Sorrentino N, Violi A (2010) Short-term forecasting of day-ahead electricity market price. In: 2010 7th International conference on the European energy market, EEM
Mulleriyawage U, Shen W (2020) Optimally sizing of battery energy storage capacity by operational optimization of residential pv-battery systems: an australian household case study. Renew Energy 160:852–864. https://doi.org/10.1016/j.renene.2020.07.022
Mulleriyawage U, Shen W (2021) Impact of demand side management on optimal sizing of residential battery energy storage system. Renew Energy 172:1250–1266. https://doi.org/10.1016/j.renene.2021.03.122
Noyan N (2012) Risk-averse two-stage stochastic programming with an application to disaster management. Comput Oper Res 39:541–559
Rockafellar RT, Uryasev S (2000) Optimization of conditional value-at-risk. J Risk 2:21–41
Ruszczyński A, Shapiro A (2003) Stochastic programming. In: Handbook in Operations Research and Management Science. Elsevier Science, Amsterdam
Talent O, Du H (2018) Optimal sizing and energy scheduling of photovoltaic-battery systems under different tariff structures. Renew Energy 129:513–526. https://doi.org/10.1016/j.renene.2018.06.016
Violi A, Beraldi P, Carrozzino G (2023) Dealing with the stochastic prosumager problem with controllable loads. Soft Comput 27(18):12913–12924
Xie C, Wang D, Lai CS, Wu R, Wu X, Lai LL (2021) Optimal sizing of battery energy storage system in smart microgrid considering virtual energy storage system and high photovoltaic penetration. J Clean Prod 281:125308. https://doi.org/10.1016/j.jclepro.2020.125308
Zhou L, Zhang Y, Lin X, Li C, Cai Z, Yang P (2018) Optimal sizing of pv and bess for a smart household considering different price mechanisms. IEEE Access 6:41050–41059. https://doi.org/10.1109/ACCESS.2018.2845900
Acknowledgements
This work was funded by the Next Generation EU - Italian NRRP, Mission 4, Component 2, Investment 1.5, call for the creation and strengthening of "Innovation Ecosystems", building ’Territorial R&D Leaders’ (Directorial Decree n. 2021/3277) - project Tech4You - Technologies for climate change adaptation and quality of life improvement, n. ECS0000009. This work reflects only the authors’ views and opinions, neither the Ministry for University and Research nor the European Commission can be considered responsible for them.”.
Funding
Open access funding provided by Università della Calabria within the CRUI-CARE Agreement. The authors did not receive support from any organization for the submitted work.
Author information
Authors and Affiliations
Contributions
Conceptualization: P. Beraldi, A. Violi; Methodology: P. Beraldi, A. Violi; Formal analysis and investigationA., P. Beraldi, A. Violi; Writing - original draft preparation: P. Beraldi, A. Violi; Writing - review and editing: P. Beraldi, A. Violi, D. Laganá; Resources: G. Carrozzino; Code implementation: G. Carrozzino; Computational experiments: G. Carrozzino, A. Violi; Results analysis and managerial insights: P. Berald, A. Violi, D. Laganá.
Corresponding author
Ethics declarations
Conflict of interest
The authors have no Conflict of interest to declare that are relevant to the content of this article.
Ethical approval
This work does not contain any studies with human participants or animals performed by any of the authors.
Informed consent
Informed consent was obtained from all individual participants included in the study.
Code availability
Not applicable.
Additional information
Publisher's Note
Springer Nature remains neutral with regard to jurisdictional claims in published maps and institutional affiliations.
Appendix
Appendix
1.1 Mathematical formulation
Nomenclature | |
|---|---|
Sets | |
\({\mathcal {D}}\) | set of number of days |
\({\mathcal {T}}\) | set of elementary time periods (hours) |
\({\mathcal {I}}\) | set of available sizes of BESS |
\({\mathcal {L}}\) | set of available sizes of PV |
\({\mathcal {J}}\) | set of flexible loads |
\({\mathcal {K}}\) | set of interruptible loads |
\(\varOmega \) | set of scenarios used for representing evolution of uncertain parameters |
Parameters | |
Deterministic Parameters | |
\(\theta _{d}\) | number of days of the year represented by typical day d |
\(l_{j}, u_{j}\) | working time window of the flexible load j |
\(n_{j}\) | overall duration (in hours) of the flexible load j |
\(q_{j}\) | hourly energy consumption of the flexible load j ([kWh]) |
\(l_{k}, u_{k}\) | minimum working time windows of the interruptible load k |
\(q_{k}\) | overall energy consumption of the interruptible load k ([kWh]) |
\({\bar{e}}_{k} \) | upper bound on the hourly energy consumption of the interruptible load k ([kWh]) |
\({\bar{E}}_{i}\) | the initial level of charge for BESS size i |
\(S_{i}\) | capacity of storage size i ([kWh]) |
\(\eta _{c}, \eta _{d}\) | efficiency rate for BESS energy injection and withdrawal |
\(\chi _c, \chi _d\) | maximum rate (%) for BESS energy injection and withdrawal |
\(\phi _i, \varPhi _i\) | minimum and maximum fraction of the BESS capacity for the state of charge |
\(c_i^{BESS}\) | purchasing cost of BESS size i ([€]) |
\(c_j^{PV}\) | purchasing cost of PV size j ([€]) |
\(N_i\) | lifetime of BESS size i |
\(N_j\) | purchasing cost of PV size j |
f | recovery factor |
\(\varGamma _b, \varGamma _s\) | upper bounds on energy purchased/sold from the day-ahead market ([kWh]) |
Stochastic Parameters | |
\(\pi _{\omega }\) | probability of occurrance of scenario s |
\(b^{\omega }_{dt}\) | base load energy demand for at time t of the day d under scenario \(\omega \) ([kWh]) |
\(\xi ^{\omega }_{ldt}\) | energy produced by PV size l at time t of the day d under scenario s |
\(pb^{\omega }_{dt}\) | unit purchasing price at time t of the day d under scenario \(\omega \) ([€/kWh]) |
\(ps^{\omega }_{dt}\) | unit selling price at time t of the day d under scenario \(\omega \) ([€/kWh]) |
First-stage Variables | |
\(x_{i}\) | binary variable representing the choice of the size of storage system: |
the variable takes value 1 if the size i is chosen and 0 otherwise | |
\(y_{l}\) | binary variable representing the choice of the size of PV module: |
the variable takes value 1 if the size l is chosen and 0 otherwise | |
Second-stage Variables | |
\(x^{\omega }_{dt}\) | amount of energy to buy from the day-ahead market at time t of the day d ([kWh]) |
\(y^{\omega }_{dt}\) | amount of energy to sell on the day-ahead market at time t of the day d ([kWh]) |
\(E^{\omega }_{idt}\) | the state of charge at time t of the day d for BESS size i under scenario \(\omega \) ([kWh]) |
\(v^{\omega }_{idt}\) | energy supplied at time t of the day d for BESS size i under scenario \(\omega \) ([kWh]) |
\(w^{\omega }_{idt}\) | energy taken at time t of the day d for BESS size I under scenario \(\omega \) ([kWh]) |
\(\delta ^{\omega }_{jdt}\) | binary variable representing the activation of the flexible load j at time t |
of the day d under scenario \(\omega \) | |
Auxiliary Variables | |
\(\varPsi _\omega \) | auxiliary variable for CVaR linearization |
Dependent Variables | |
\(TC_I\) | overall investment cost ([€]) |
\(SL^{\omega }_{jdt}\) | energy consumed by flexible load j at time t of the day d under scenario \(\omega \) ([kWh]) |
\(IL^{\omega }_{kdt}\) | energy consumed by interruptible load k at time t |
of the day d under scenario \(\omega \) ([kWh]) | |
\(Q(x,y,\omega )\) | second-stage problem objective function ([kWh]) |
\(F(x,y,\omega )\) | total cost ([kWh]) |
\(VaR_{1-\alpha }\) | Value at Risk for a certain confidence level \({1-\alpha }\) |
\(CVaR_{1-\alpha }\) | Conditional Value at Risk for a certain confidence level \(1-\alpha \) |
Rights and permissions
Open Access This article is licensed under a Creative Commons Attribution 4.0 International License, which permits use, sharing, adaptation, distribution and reproduction in any medium or format, as long as you give appropriate credit to the original author(s) and the source, provide a link to the Creative Commons licence, and indicate if changes were made. The images or other third party material in this article are included in the article’s Creative Commons licence, unless indicated otherwise in a credit line to the material. If material is not included in the article’s Creative Commons licence and your intended use is not permitted by statutory regulation or exceeds the permitted use, you will need to obtain permission directly from the copyright holder. To view a copy of this licence, visit http://creativecommons.org/licenses/by/4.0/.
About this article
Cite this article
Beraldi, P., Violi, A., Laganá, D. et al. Home energy system: optimal design via risk-averse stochastic programming. Soft Comput 29, 3367–3381 (2025). https://doi.org/10.1007/s00500-025-10616-w
Accepted:
Published:
Version of record:
Issue date:
DOI: https://doi.org/10.1007/s00500-025-10616-w


