Optimized profitability of LFP and NMC Li-ion batteries in residential PV applications

This paper analyses the economic profitability provided by different types of Li-ion batteries when used in residential solar applications under a Model Predictive Control that optimizes the operation of the system. The control methodology takes profit of actually commercial time-of-use rates to minimize the operation costs. Also, the analysis takes into account the progressive degradation of the batteries involved by using state-of-the-art semi-empirical ageing models. The study is performed by means of annual simulations that use actual consumption curves for three different households and real PV production batteries, with extended lifetime warranties and prices below 600 €/kWh, under optimized operation and use even when only energy arbitrage and peak shaving services are considered. Keyword: residential PV systems, li-ion batteries, ageing.


Introduction
Photovoltaic (PV) technology has added more capacity per year than any other power technology since 2016, overtaking wind that was the leading sector in previous years [1]. In all, new PV installations represented about 100 GW in 2018, achieving an accumulated capacity above 500 GW [2]. The skyrocketing situation of the PV sector has come true thanks to the prices plummeting experienced by this tech in the last decade. The cost for installing residential grid-connected PV systems is worldwideaveraged around 1.3 €/W [3]. In line with it, the residential PV market has also experienced a big deployment that achieves very high shares of the energy production-consumption in certain local grids, Fig. 1. This casuistic is getting more and more common, with the "prosumer" role getting popular to an increasing extent. However, such big amounts of behind-the-meter renewable and stochastically intermittent installations pose certain problems in the management of the low voltage grids [4]. Hence, new technical and regulatory solutions have to be implemented to avoid running into the problem of systematically curtailing part of their production. A clear candidate solution to reduce these issues at the technical level is the introduction of some energy storage systems (ESS), mainly batteries, within the dwellings [5]- [7]. This combination provides benefits from the point of view of the grid (potential reduction of the intermittency of the local and distributed PV production, stabilization of the low voltage grid) and also from the point of view of the prosumer (potential reduction of the energy bill for the installation owners).
Residential PV solutions with batteries are commercially available and gaining traction. Note that these installations outpaced utility-scale ones in the USA during the second quarter of 2019 [8]. Also note that, again in the USA, there were more residential batteries installed in Q2 2019 than in all of 2017 [8]. Even like that, the USA is not the leading scenario and it is the European residential energy storage market which keeps being the global market leader as of the end of 2018, with Germany presenting more than 120,000 households and small-businesses presenting PV installations with battery storage [9]. Estimates equally indicate the European market is on track for a five-fold increase in capacity by 2024. Therefore, this is an important sector to be surveyed and analysed.
PV systems with batteries have been largely analysed in the literature. However, most of the previous works are focused on optimizations related to the sizing of the battery system [10]- [12] or to maximizing the economic income of the PV installations [13]- [15]. Other recent work [16] tries to determine the bestsuited battery technology depending on the size and the applications involved. It concludes residential batteries are not profitable yet even when combining applications at two different locations. In the same way, authors in [17] investigate the economic viability of residential PV with batteries plant by using a methodology for optimising the size of the storage. They also conclude that present costs of batteries are still too high to allow an economic convenience of the storage installation. In opposition to previous works, the analysis presented here contemplates a Model Predictive Control (MPC)-based methodology that allows performing an optimized operation of the system that returns certain economic profit. This is achieved with real irradiance and a monthly-averaged temperature profile at a location in a southern Mediterranean region. Also, various load profile data have been considered. The control methodology profits actually commercial time-of-use rates, and the analysis takes into account the progressive degradation of the batteries involved by means of a state-of-the-art ageing model.
The work is organized as follows. Section 2 is devoted to the analysis of the different Li-ion chemistries available and to the selection of the best alternative for domestic use. Section 3 introduces the ageing models used for the selected batteries. The optimized control algorithm and the operation of the residential PV system with batteries are described in Section 4. Then, Section 5 introduces the results for the different combinations of cases analysed. Finally, some conclusion remarks are provided to complete the manuscript in Section 6.

Lithium Ion Battery Types and Selection.
Within the family known as Li-ion batteries, there are up to six different chemistries available in the market nowadays. These present different properties and characteristics as a function of their internal structure and composition [18], and are mainly identified as: Lithium Cobalt Oxide (LCO), Lithium Manganese Oxide (LMO), Lithium Iron Phosphate (LFP), Lithium Nickel Cobalt Aluminium Oxide (NCA), Lithium Nickel Manganese Cobalt Oxide (NMC), and Lithium Titanate (LTO). The main difference among them lies in the material that makes up the cathode. This material provides the name to the specific family, LCO or NCA, etc…, being the anode made of graphite for the first 5 chemistries. Only for the latter, the LTO family, receives the name from its anode's material, being in turn the cathode made of graphite. The different internal compositions provide the six families with varying capabilities in terms of specific power (W/kg), specific energy (Wh/kg), thermal stability, cyclability and performance [19], [20]. They also differ in cost and lifetime expectancy [19], [21], [22]. When comparing them by means of Fig. 2, it can be observed how those containing cobalt present high power capacity and energy densities although they usually have drawbacks associated to lower safety and shorter lifespan [23], [24].
Conversely, those without cobalt (mainly LFP and LTO) present good cyclability and are considered very safe although they suffer from low energy and power densities, being LTO also still the most expensive. LMO would be the poorest chemistry in terms of operation properties while NMC would be the compromise chemistry applicable to any use or requirement [20]. Therefore, depending on the application and the associated ESS requirements, a different chemistry will be selected. For the case of residential applications in which batteries are used to maximize the PV production while reducing the economic cost of the electricity consumption in the dwelling, safety and space availability are generally assumed to be the most defining or limiting parameters [25]. In this sense, according to their different characteristics, LFP and NMC chemistries are those selected as candidate technologies for analysis in this work. In fact, with their pros and cons, these are the chemistries of choice in most of the commercial solutions available in the market nowadays for the residential sector [22]. When comparing the two of them, it is important to note that while LFP technology presents limitations in terms of specific volume and require larger locations for a given energy capacity than NMC, they also generally present better cyclability, power response and safety level [20].

Ageing Models.
There exist different types of models to predict the lifetime expectancy of Li-ion batteries [26], [27]. Among them, semi-empirical models are considered to be the best approach, in terms of complexity and reliability, for analysis as the one introduced here. According to the previous, we introduce in the following well accepted semi-empirical methods that analyse both the cycling and the calendar ageing in LFP and NMC cells.

LFP ageing model
The semi-empirical model used in this work to estimate the lifetime of LFP batteries is that suggested by Stroe et al. [28]. These authors propose a model to analyze the loss of the battery capacity (C fade ) associated separately to, on the one hand, the calendar ageing, as in: "#$% &'( = 3.087 · 10 12 · 4.45678·9 · 4.5 (1) where T is the temperature (in Kelvin) and t is the time (in months), and, on the other hand, to the operation (cycling ageing), as in: "#$% &>& = 6.87 · 10 15 · 4.4@2·9 · 4.5 (2) where NC represents the number of equivalent reference cycles. To obtain NC, it is necessary to process the evolution of the state of charge (SOC) of the battery during a given period (usually a year). Then, this is introduced to the Rainflow Counting Algorithm (RFC), which is capable of grouping those cycles presenting the same depth of discharge (DOD) and the same average SOC. Thus, by means of the Palmgren-Miner rule [29] and the capacity evolution curves of batteries provided by the manufacturer, the NC value can be calculated. This procedure is described in detail in [30].
Thereafter, once accounted the NC, this is introduced into (1) and (2) together with the temperature and time analyzed. The resulting C fade values are combined to finally provide a lifetime prognosis, in years, by means of equation (3). This equation takes into account that the battery manufacturer defines the end-of-life (EOL) of the batteries at the 70% of its initial capacity (C 0 ).

30% · C 4 = C EFGH IJK year PQR , T + C EFGH IVI NC, T · years PQR (3)
The solution in years to this equation is the estimated lifetime expectancy of the LFP cell.

NMC ageing model
The reference semi-empirical model used for NMC batteries is that proposed by Schmalstieg et al. [31]. These authors presented a model for 18650 cylindrical NMC cells from Sanyo that also considers the ageing as the loss of battery capacity associated to both calendar and cycling. The first of these phenomena is described in [31] according to: "#$% &'( = 7.54 · − 23.75 · 10 8 · 1 8]28 9 · 4.25 (4) where V is the average daily voltage (in Volts), T and t are again the temperature and the time (in Kelvin and in days for this model), respectively. The second phenomenon, the cycling ageing, is evaluated with: "#$% &>& = · 7.348 · 10 1_ · Ø − 3.667 @ + 7.600 · 10 17 + 4.081 · 10 1_ · ∆ (5) Where Q stands for the charge throughput (in ampere-hour), ∅V is the average voltage of the cycle (in Volts) and ΔDOD is the depth of discharge of the cycle (in range of 0 -1). Then, the resulting C fade values for calendar and cycling are combined to finally provide the lifetime prognosis ( EOL , in years), by means of equation (6).
As for the previous model (LFP model), this "NMC cylindrical" model also takes into account that the EOL of the batteries is estimated at the 70% of its C 0 , according to the manufacturer.
Finally, note that current residential battery solutions using NMC batteries do not usually contain cylindrical but pouch cells. These cells respond much better to high operation temperature within battery packs [32]. Also, both the number of cycles and the overall charge throughput that state-of-the-art NMC pouch cells can withstand is much larger than that of the Sanyo 18650 cylindrical NMC cells published in [31] in 2014. Therefore, this work considers a second enhanced model for NMC batteries, based on equations (4)- (6), that has been recalibrated according to the warranty provided for current NMC pouch cells provided by manufacturers such as LG Chem in their RESU models [33]. Thanks to the use of such last-generation pouch cells and the better thermal management achieved by improved cells arrangements and pack designs within the battery pack products by manufacturers, these commercial units withstand up to 20 MWh as energy throughput and are granted for 10 years if operated in a range of temperatures between -10 °C and 45 °C [34]. Then the updated model takes into account these improved properties to minimize the impact of the calendar ageing and to extend the cyclability of the battery. Results for this updated model are labeled as "NMC pouch".

Residential PV with batteries operation mode.
Batteries are used in residential PV installations to boost the handling of local solar production P no and to reduce the cost of the electricity supply in the dwelling. This is done by increasing the amount of self-production that becomes self-consumed and also by profiting a time-of-use electricity rate structure that allows energy arbitrage, i.e. storing energy during off-peak hours to profit it during expensive grid power periods. Moreover, the introduction of batteries allows peak shaving, i.e. reducing instantaneous demand power values beyond a given value, with the corresponding reduction in the fix charges associated to the electricity supply.
The study here introduced presents an optimization control algorithm that combines these possibilities for different sizes of PV systems and various capacities of batteries with the target to minimize the electricity bill.

Optimization control proposal for PV system with batteries.
Consider that, during the typical operation of a PV system with batteries in a residential application there are permanently two uncontrollable power variables: qr , and the consumption of the loads ( st#$ ). In general, these quantities are not to be equal and, when st#$ > qr , the panels production will have to be supplemented either from the ESS ( hv ) or from the grid wxy$ . Conversely, when st#$ < qr , the excess power can be fed into the ESS or sold to the grid. hv and wxy$ are therefore controllable variables, and it has to be decided which one is to be used in each situation.
In a flat-rate electricity pricing structure, in which the prices of the electricity exchanged with the grid do not change throughout the day and with a buying cost higher than the acquisition one, the optimal operation strategy would always be to charge or discharge the ESS before exchanging power with the grid. However, most of electricity markets present a time-of-use rates structure with prices being more expensive during high demand periods in the power system (on-peak hours) and cheaper during lower demand ones (off-peak hours). In this context, the optimal strategy could be different from that described above: it might be convenient to save energy in the ESS in off-peak hours if it is going to be locally demanded during on-peak periods.
This kind of problem, which requires taking into account the effect that current actions have on optimality and on the ability of meeting constraints in the future, is very suitable for the application of Model Predictive Control (MPC) [35]. This is a controller design technique based on an optimization strategy in which the future outputs for a given horizon N, called the prediction horizon, are predicted at each instant using process models. These predicted outputs depend on the future control signals, which are calculated by optimizing a determined criterion while fulfilling a set of constraints. Although a complete sequence of future control signals is computed, only the first one is effectively sent to the process, because at the next sampling instant new information will be available. This is known as receding horizon.
For residential PV systems with batteries, the optimization criterion is mainly determined by the economic balance of the energy exchanged with the grid. However, it is also convenient to include in the optimization cost the power fed into, or taken from, the ESS. Regarding the constraints, the power balance, including powers from the PV system, the ESS, the grid and the loads, must be met; also the state of charge (SOC) of the ESS must be kept within its limits; and, finally, the power exchanged both with the grid and the ESS must also stay within certain limits.
Note that the future production of the PV panels and the coming consumption of the loads should be somehow known in order to grant the fulfillment of the power balance. However, there is no way to advance the exact value of these variables, as they mainly depend on the future irradiance from the Sun and the stochastic behavior of the consumer, respectively. Therefore, suitable models ( qr and st#$ ) described in the following subsection, will be used.
With all these considerations, and following an approach similar to [36], the optimization problem to be solved in the MPC framework can be formulated as follows: where: • T is the sampling period.
• wxy$ + is the power exchanged with the grid at instant + , with wxy$ + > 0 when energy is purchased.
• hv + is the power exchanged by the ESS at instant + , with hv + > 0 when discharging.
• hv + is the energy available in the ESS at instant + .
• hv, ‡yˆ and hv, ‡#Š are the limits in between which the ESS SOC must be kept.
• hv ( + ) is the cost given to the power exchange with the ESS, used to tune the behavior of the system.
, being $y' and --w the discharging and charging efficiencies, respectively.
Although most of the equations in the above problem are linear, such problem in its current formulation is still difficult to solve because it presents two piecewise functions, wxy$ and , and a non-linear function, hv + . This kind of functions can be dealt with by introducing binary variables, which lead to a mixed integer linear program (MILP), computationally prohibitive for the size of the problem. Therefore, a different formulation is proposed.
The idea is to replace wxy$ by two new variables, ‹OE• and '%ss , for the cases when it is positive or negative. Similarly, hv can be replaced by --w and $y' , and the cost of energy exchanged by the ESS, hv , is also substituted by --w and $y' . Furthermore, with the previous formulation, the optimization could present multiple solutions with the same minimum, due to the piecewise constant nature of the costs. To avoid this, two weighting sequences, -= ‚ and $ = ‚ are introduced. -, with = 0.999, weights --w in a way that, in otherwise equal situations, favors charging as late as possible. Conversely, $ with = 1.001, weights $y' to favor discharging as soon as possible.
With the changes introduced, the optimization problem turns into: Note that, the objective function and all the constraints (apart from the last two) become linear with this new formulation. These two quadratic equality constraints are introduced to avoid illogical solutions from the solver, i.e. simultaneously buying/selling energy from the grid, or charge/discharge from the ESS.
Let us now consider a new optimization problem by dropping the two last constraints, involving ‹OE• and '%ss , and --w and $y' . The new problem, with both the cost function and constraints defined as linear functions, is a linear program (LP), which is a convex optimization problem and its optimal solution can be easily found. Furthermore, because of the structure of the problem at hand, this optimal solution is such that either ‹OE After all these considerations, the original optimization problem can be replaced by a linear program (LP) that achieves the same optimal solution, and can be easily solved with standard optimization tools. It must be noted that the power sequences obtained by the LP are optimal only if future qr and st#$ are exact. However, this is never the case in general and the system operation sequences may even be unfeasible. In an MPC framework, this is critical for the power values in the first time instant because they are actually applied. For the cases in this work when these are unfeasible (usually because the power balance is not met) a correction algorithm is described in subsection 4.3.
Finally, it is important to remind that, for the application of the MPC strategy, prediction models qr and st#$ are needed. Those used in this work for each of them are introduced in the following section.

Models required in the optimization.
qr is based on a clustering strategy of the actual irradiance at the target location. Clustering is a methodology to classify data vectors (24-hour irradiance profiles in this case) into groups in such a way that the resulting sets contain, respectively, those data vectors that are more similar to each other, according to a specific criterion. Moreover, the clustering strategy implemented also provides a centroid of all the data vectors in a group. These centroids are the 24-hour profile vectors used to generate qr .
There exist different methods designed to define the appropriate number of clusters in a dataset. Those more extended in the literature, Elbow method [37] and gap statistic [38], are implemented here. The Elbow method is based on the "k-means" algorithm, which partitions data into k distinct clusters based on the squared Euclidean distance of the data classified to the centroid of each cluster. Therefore, this method is based on calculating, for different values of k, the sum of all the distances of every data point to the centroid of its cluster. Finally, it graphically determines when the decrement of this sum, which descends continually with k, is not significant enough to keep increasing the number of clusters. On the other hand, gap statistic method uses the output of the clustering algorithm to compare the change in within-clusters dispersion with that expected under an appropriate reference null distribution. As for the Elbow method, the "k-means" algorithm has been used to group irradiance data.
For the case under study, yearly real irradiance data measured every 15 minutes at a location in a southern Mediterranean region with 1880 peak sun hours are used. The resulting number of clusters for the irradiance experienced in that location, obtained using the Elbow and Gap statistic methods, is 5. Their centroids, used to generate qr in this work, are shown in Fig. 3. Observe how clusters 3 and 4 comprehend winter and summer sunny days, respectively. Note how cluster 3 shows a lower midday peak and a profile in which irradiance appears later and ends sooner than that for cluster 4. Furthermore, cluster 5 encompasses days that are sunny in the morning but cloudy in the afternoon. Conversely, cluster 2 includes days that are cloudy in the morning but sunny in the afternoon. Finally, cluster 1 corresponds to overcast days.
For the sake of clarity in regards to the clustering strategy performance, check Fig. 4 which shows the centroid and all the irradiance curves contained in cluster 5. All these curves are used during the simulations to generate the results introduced in Section 5. Note in this sense that the colored curves in Fig.  4 will give rise to qr while black centroid curve will be used as qr . The computation of qr and qr from the corresponding irradiance profiles has been performed taking into account the efficiency and losses of the different components conforming the PV installation and attending the proposal from [39] and [40]. Contrary to qr , models of dwelling consumption profiles cannot be derived out of a clustering analysis. This is due to the fact that the evolution of the daily consumption in a household is so stochastic that grouping it into a small number of clusters is unfeasible. Thus, the st#$ used corresponds to one of the reference load profiles defined by the Spanish Ministry of Industry for the residential sector [41]. These profiles are used by energy retailers to bill hour-dependent tariffs to those consumers not updated yet with consumption telemetry. As for the case of Fig. 4, Fig. 5 represents the reference load profile, in black, and some examples of real daily load curves registered at one of the dwellings analyzed in the simulations. Fig. 5. Example of reference [29] and actual consumption curves at a dwelling.

Final operation of the system.
The operation of the PV system with batteries derived from the optimization in 4.1 may be unfeasible when qr and st#$ are not exact. In fact, this is the normal situation and when the power balance cannot be met it requires a series of decision rules defined with the goal to keep minimizing the electricity bill while avoiding uncontrolled operations. Thus, it is necessary to permanently determine not also the PV and load forecast errors but the global error in the hourly power balance. This is done by: %xxtx = st#$ + 1 − st#$ + 1 + qr ( + 1) − qr + 1 Then, %xxtx > 0 means that there is an excess of energy in the dwelling electrical system during that operation hour and, hence, the control power preferences shown in Fig. 6 have to be implemented. Under such a casuistic, it is initially required to check if the system is purchasing energy from the grid (step 1 in Fig. 6). If so (step 2.1), the control system compares %xxtx with the power purchased reducing the latter in case is larger than %xxtx (step 3.1). On the contrary, the system cancels all the imports from the grid and recalculates the power still to be balanced, %xxtx_#OEŠ (step 3.2). After that, and together with the case analyzed in step 1 that returns no imports (step 2.2), %xxtx_#OEŠ will have to be charged to the batteries. Prior to that, the system checks and verifies if that excess of power together with the actual battery power (defined by the optimization) do not exceed the power ratings of the battery converter (step 4). If that is the case, all the power excess is instantly assumed by the battery (step 5.1). On the contrary, if the battery power ratings are exceeded, it will be charged to limited to it, thus generating a new excess power (step 5.2). Once the new battery power reference is defined, it is time to check if the maximum battery SOC is not or it is not going to be exceeded (step 6). As a function of this, it will be necessary (or not) to sell some energy to the grid (steps 7.2 and 7.1).
Conversely, when %xxtx < 0, it is necessary to provide extra energy to the dwelling. In this case, the control power preferences shown in Fig. 7 are implemented. These basically imply to favor the use of the energy stored in the battery instead of purchasing from the grid. Thus, the system starts by checking whether the battery was being discharged (step 1). Then, as for the previous case when %xxtx > 0, the battery discharge power limit is analyzed (step 2) and, as a function of the results, the new powers resulting to meet the power balance are defined (step 3 and 4). Likewise, it is also verified that, when the battery is discharged to complete the energy balance in the house, the discharge does not goes beyond its minimum SOC (step 5). Finally, the corresponding power references are set up (step 6).   Step 1 Step 2.2 Step 3.2 Step 4 Step 5.2 Step 6 Step 7.2 Step 2.1 Step 3.1 Step 5.1 Step 7.1 Step 1 Step 2 Step 3 Step 4 Step 5 Step 6 Then, also note in Fig. 6 and Fig. 7 that only in the case that qr = qr and st#$ = st#$ the final power variables used for the operation of the plant will be those defined as optimal by the LP. That is: Where y " are the final powers and y ( + 1) are the power sequences obtained by the LP.
All these cases of operation, subject to the different preferences depending on the casuistic, can be observed in Fig. 8. This shows in a) the ideal operation of the system in the case that qr = qr and st#$ = st#$ . On the contrary, Fig. 8b) represents the actual or final operation of the system under regular circumstances. Note how during on-peak hours (grey regions) no energy is purchased from the grid and battery is profited to the maximum. In the same way, if still profitable and proper PV production is forecasted for the coming day, the battery keeps discharging to supply demand during off-peak hours. In this way, most of the PV production is self-consumed and energy is only purchased from the grid during off-peak hours. Finally, check in Fig. 8c), which represents the evolution of the battery SOC during the actual operation just described for those three days, how the battery SOC evolves accordingly.

Benchmark of study cases.
Annual simulations of the hourly system operation have been performed using Matlab ® . The irradiance and temperature data employed were the same for all the cases: actual irradiance values measured every 15 minutes throughout a year at the location of interest and the temperature profile provided by PVGIS [42] for that location during the same year. Note that these ambient temperatures were offset with 15 ºC to better emulate the operating temperatures of the cells within the battery packs.
On the contrary, three different dwellings were considered with varying hourly-load distributions. The three of them present a global annual consumption that, although differently distributed throughout the day, rounds 5,000 kWh/year. Fig. 9 represents their different distributions as percentages of annually-averaged hourly consumption together with the reference load profile already introduced in Fig. 5, and used as st#$ . To summarize the differences in the load distribution among these households, note how the first one presents a peak of demand during two morning hours. On the contrary, the second household concentrates an important part of its consumption during the evening hours. Finally, the third household hardly deviates from the reference load profile, being in this sense a model consumer. These three distributions cover most of the main regular cases that can be encountered in the residential sector. They have been selected with the aim of providing results as general as possible. Fig. 9 also details the off-peak and on-peak hours during the different seasons of the year defined in the Iberian Market of the Electricity (MIBEL) for residential users. A commercial and much extended electricity time-of-use rate in Spain [43] has been assumed to assign costs to the sale and purchase of electricity during the different hours of the day. So, while the sale is defined constant throughout the day at 5 c€/kWh, the purchase is rated at 22 c€/kWh during on-peak hours and 11 c€/kWh during off-peak hours.
Moreover, three different PV installations (with rated powers of 2, 3, and 4 kW, respectively) have been considered for each of the dwellings. And for each of these 9 possible combinations, two cases without batteries (under two different economic regimes: with and without economic compensation of the surplus PV production exported to the grid) and four cases with different battery capacities (all with a rated power of 3.2 kW and roundtrip efficiency of 90 %, but storage capacities for 1, 2, and 4 hours), have been analyzed. The rated power and capacity values selected for both the PV installation and the battery are in accordance with the usual size of the installations in the residential sector in southern Europe and attending the most common models of home batteries available in the market. The simulation of each of the previous combinations provided differently shaped annual SOC evolutions. These were then fed, together with the temperature profile and the time vector, to the ageing models defined in equations (2) to (6). Finally, the resulting lifetime expectancies were used to calculate the profitability of the batteries under such a combination of operation conditions.

Operation and profitability results.
The results obtained for the different study cases just introduced are summarized in Tables 1 through 5. The first three tables initially introduce the lifetime expectancy calculated for the batteries, in years, when used at each of the households according to the optimized operation methodology explained in Section 4 and for each of the ageing models introduced in Section 3. After that, these tables introduce the annual gross and net savings achieved when installing a given residential PV system with batteries and taking into account the expected lifetime of the components and their initial cost. The latter is calculated as: Where the annual gross savings for each dwelling are accounted as the difference between the initial electricity bill (that amounts for around 840 € without PV system and batteries) and the operating cost once the system is installed. Note in this sense that, in agreement with [3], an initial investment of 1,300 €/kW of installed capacity is assumed for the PV system (with a lifetime expectancy of 25 years). Also, taking into account [16] and [17], as well as different reviews and energy storage reports [44]- [47], a CAPEX of 350 €/kWh has been assumed for the batteries, regardless of the chemistry and type, while the lifetime is calculated for each different battery and size.
Then, two more tables are introduced, Table 4 and Table 5. These summarize the profitability results for the different system combinations. Three profitability metrics are presented in these tables: the "Payback Period" in Table 4, and the "Net Payback Period", and the "Net Present Value" in Table 5, which only accounts for the cases using "NMC pouch" cells because is the sole model providing clear benefits when including batteries. These metrics are calculated according to the following equations: Where i is the discount rate (with value 0.65%), n the number of periods (25 years in this case) and R t is the Net Cash Flow during each t period.   Finally, it is equally important to highlight that the profitability of the different installations could be further increased if peak shaving possibilities had been quantified in the tables. This would imply, thanks to the battery rated power capacity (3.2 kW in this analysis), to decrease the cost of the electricity supply associated to the power term of the bill by around 120 € per year, what would favor the introduction of batteries even more.

Results discussion and sensibility analysis.
When analyzing all the results presented in Table 1 through Table 5, various interesting conclusions can be withdrawn. First, start consulting for instance the first 5 lines in Table 1. These indicate that: the PV installation with no compensation for the surplus local production would return 176 € as "Annual net savings", the PV installation being credited 5 c€/kWh for each surplus kWh sold to the grid would return 293 €, the same PV installation credited 5 c€/kWh for each surplus kWh sold and also with a 3.2 kW / 3.2 kWh battery would return 354 €, with a 3.2 kW / 6.4 kWh battery would return 377 €, and 3.2 kW / 12.8 kWh battery would return 359 € as "Annual net savings". Thus, note how increasing battery capacity is positive in economic terms but only up to a given size. Beyond this capacity, usually in the range around 6.4 kWh, the profitability would be negative, what implies a decreasing interest for investment.
Second, it is important to review the variability of results among households, Tables 1 to 3. It is clear that neither in lifetime expectancy nor in economic profitability the results differ significantly. Economic returns are a little bit better for household 3, as its load is more similar to the load model introduced to the optimization than that of the other two households. Also, note how household 2 would be a slightly better place to introduce the systems under discussion than household 1 because it concentrates a higher load during on-peak hours while the morning peak consumption in household 1 is in off-peak hours. In all, annual returns differ by as much as 50 € among households, what represents a 15% out of the initial annual electricity cost (as indicated, calculated around 840 € for the energy purchase in all of them). So, the profitability of PV systems with batteries is not greatly affected by the specific dwelling load distribution. This can be also concluded from Table 4 which summarizes the Payback Period, according to (12), for all the combinations simulated in Tables 1 to 3 but without taking into account the lifetime expectancy of the different batteries considered. Payback periods ranging from 5.91 to 17.27 years are registered.
Third, note on the contrary how the ageing of the different batteries largely varies as a function of the model used to analyze it, what also impacts the economic profitability study. In fact, this could be expected from the different backgrounds of the models: two of them published years ago for cylindrical cells modeled as isolated systems, while the third one is a recalibration of the NMC model adapted to the operational warranty of a currently commercialized battery pack including state-of-art NMC pouch cells. In this sense, none of the cases simulated and analyzed for the two first battery models (the "LFP model" or the "NMC cylindrical model") achieves "annual net savings" that outperform the installation of a PV system all alone, check results in Tables 1 through 3. Under such ageing conditions, the installation of batteries would be not profitable, as indicated by previous studies. However, the "Annual net savings" results column obtained for the third model ("NMC pouch") returns a clear increased profitability when batteries are included in the installation, with regard to the cases without them. This is why Table 5 is devoted to analyze the and the Net Present Value only for the cases considering this cell model. Note how the is larger than the calculated in Table 4 due to the introduction of the batteries amortization in the calculation. Interesting NPV values are obtained for these batteries from an economic point of view.
Still, it is important to point out that increasing the rated power of the PV system from 2 to 4 kW in a household presenting a yearly electricity consumption circa 5,000 kWh, regardless of the load distribution profile, would increase the profitability of the installation. And this is so for the PV installation all alone (both with and without compensation of surplus production) or for any combination with the different sizes of batteries analyzed. Note in this sense that introducing the smallest battery would increase the annual return by around 50 to 60 €, regardless of the PV rated power.
Beyond the previous results and discussions, a sensibility analysis has been also conducted to check how variations in the CAPEX of both the PV system and the batteries would affect these results. Prices of PV installations ranging from 500 €/kW to 2000 €/kW have been considered. Thus, results are similar among cases in all the range of PV prices, reducing the profitability of the system as CAPEX gets higher. However, when battery prices are varied from 150 €/kWh to 1000 €/kWh, differences in profitability are registered. In this sense, while batteries are below 600 €/kWh, it keeps being profitable to introduce them in the system. In fact, below 200 €/kWh those with capacities of 12.8 kWh are a better option than smaller ones. However, for battery CAPEX beyond 625 €/kWh, results would confirm that introducing the battery in the equation would not improve the economics of the installation with regard to the case pf PV installation with surplus production economic compensation.
Finally, it is important to remark that, although batteries start presenting a business case at the residential sector for peak shaving and energy arbitrage, their economic profitability could and should be enhanced to overcome financial risks by allowing them to take part in remunerated grid services. This is not applicable yet in countries such as Spain or Portugal but it is allowed in others such as Germany, UK or the USA. Thus, although the PV production is not so significant in some of these countries, the prospects to get extended economic profits with batteries are granting the rise of so many residential PV installations with ES, and even the emergence of concentrations of them in the form of Virtual Power Plants [48].

Conclusions.
This work has presented a profitability analysis of Li-ion batteries operated under an MPC strategy for residential PV applications. First, the suitability of the different Li-ion families regarding these applications has been discussed, being LFP and NMC the resulting candidate technologies. Also, semi-empirical ageing models, derived from the literature, have been presented for each of these chemistries.
Next, an MPC control strategy has been proposed in order to optimally manage the PV system with batteries by taking into account at any moment not only the current PV generation and demand, but also the expected future evolution of these variables. To do so, suitable prediction models have been used: a clustering approach for the PV generation, and government-provided load profiles for the residential sector as the demand model. Furthermore, the original non-linear optimization problem has been reformulated and shown to be solvable as a linear program. Finally, an adjustment algorithm has been proposed for those periods when real PV production and/or demand deviate from their prediction models.
The proposed strategy has been tested by means of annual simulations of the algorithm with real irradiation data from a Mediterranean location, actual consumption data from three households with different behavior, and different configurations of the PV installation size and ES capacity. Results show how the installation of batteries is not profitable yet for any of the considered cases when using the two first ageing models proposed. However, for the more recent NMC pouch cells, installation of batteries up to a certain capacity increases the annual net savings obtained by the PV system all alone (considering the batteries amortization during its expected lifetime). Finally a sensibility analysis has been performed, showing that NMC pouch-based batteries would remain profitable with CAPEX up to around 600 €/kWh.