A Linear Programming Approach for Battery Degradation Analysis and Optimization in Offgrid Power Systems with Solar Energy Integration

Storage technologies and storage integration are currently key topics of research in energy systems, due to the resulting possibilities for reducing the costs of renewables integration. Off-grid power systems in particular have received wide attention around the world, as they allow electricity access in remote rural areas at lower costs than grid extension. They are usually integrated with storage units, especially batteries. A key issue in cost effectiveness of such systems is battery degradation as the battery is charged and discharged. We present linear programming models for the optimal management of off-grid systems. The main contribution of this study is developing a methodology to include battery degradation processes inside the optimization models, through the de ﬁ nition of battery degradation costs. As there are very limited data that can be used to relate the battery usage with degradation issues, we propose sensitivity analyses to investigate how degradation costs and different operational patterns relate each others. The objective is to show the combinations of battery costs and performance that makes the system more economic.


Introduction
Storage technologies and storage integration are currently key issues in energy systems research, particularly due to the need to integrate high renewable energy capacities.Diagrams presented in Ref. [1] show the increasing penetration of renewable sources both in industrialized and developing countries between 1980 and 2010.The International Renewable Energy Agency IRENA discusses different technologies of battery storage for renewables in the report [2], where four main application areas are identified: islanded systems with off-grid rural electrification; households with solar photovoltaic; demand shifting; short-term electricity balancing in ancillary markets.
Off-grid power systems in particular have received wide attention around the world as further analyzed in Ref. [3].They can bring electricity to remote rural areas at lower costs than grid extension.As described in Ref. [4] they are typically based on one or more renewable energy sources (e.g.solar photovoltaic or wind) together with a conventional power generator to provide backup when necessary.
Storage units, such as batteries, can be integrated in offgrid systems as they represent an alternative capacity source to the conventional generator which has high operational costs due to fuel consumption in addition to CO2 emissions [5].Especially in offgrid applications like the one presented in Ref. [6], batteries perform several important tasks such as reducing intermittence of the renewable resources, extending the electrical service hours to night time periods, and allowing the system to run for extended periods without any power generation.
Optimization techniques and technical economic analyses has been widely used in literature in order to investigate smart operational management approaches both in distributed energy systems and islanded systems.Examples can be found in Ref. [7] where linear programming is used for distributed energy system operational optimization, and in Ref. [8] where comparisons between fuel-based systems and smart renewable-based systems are presented.
As outlined in Ref. [9], the economics of a hybrid energy system depend both on the size of the selected components and on the dispatch strategy.With regard to the latter, a key issue in cost effectiveness of such systems is battery degradation as the battery is charged and discharged [10].Hence a question that arises is how storage operations might be carried out in a more economical way, taking into account the hidden costs related to the degradation issues involved in such technologies?And since these battery technologies have operation costs due to degradation issues, are they still cost effective for an off-grid system?These kind of questions can be well studied through using mathematical optimization techniques [11] to determine whether certain choices are cost effective or not and, if not, understanding under which conditions they can become cost effective and how to make better use of the available alternatives.
The present paper will discuss linear programming models that can be used to optimise management of off-grid systems.The key contribution of this work is the inclusion of battery degradation costs in the optimization models.As available data on relating degradation costs to the nature of charge/discharge cycles are limited, we concentrate on investigating the sensitivity of operational patterns to the degradation cost structure.The objective is to investigate the combination of battery costs and performance at which such systems become economic.
This paper is organized as follows.In Section 2 a brief literature review on battery control and optimization is presented, followed by an introduction to the main technical properties of battery in Section 3. The mathematical model developed for off-grid system optimal management including battery scheduling is described in Section 4 while the following Section 5 discusses mathematical formulations to take into account the main battery degradation issues.Computational testing of the model is presented in Section 6, and Section 7 draws conclusions and present possible future research directions.

Literature review
The available literature in the field of batteries can be classified into two main approaches, experimental studies and the mathematical analytical studies.The first focuses on chemical analyses and laboratory tests to increase knowledge of degradation processes.Examples of this approach can be found in Ref. [12] where authors discuss a method to diagnose electrode-specific degradation in commercial lithium ion (Li-ion) cells [13]; which presents a diagnostic technique which is capable of monitoring the state of the battery using voltage and temperature measurements in galvanostatic operating modes [14]; where authors describe life experiments performed on lithium polymer cells to investigate the cell life dependence on the depth of discharge; and [15] where a review on methods to mitigate battery degradation is presented.
On the other hand, the mathematical analytical approach is focused on computational simulations and optimization analyses.l r efficiency of the rectifier r (%) The objective is to facilitate the decision making process, both in terms of optimal design and optimal operational management of energy systems where batteries are integrated as storage units.
Examples of such an approach can be found in Ref. [16] where a design and management mechanism for a smart residential energy system made of PV modules and storage banks is presented [17]; where authors discuss an optimization algorithm for the scheduling of residential battery storage with solar photovoltaic [18]; which describes a scheduling problem where conventional and photovoltaic sources of energy are scheduled to be delivered to satisfy energy demand [19]; focused on the development of a device to facilitate the interface between the low voltage grid and renewable generators combined with lithium-ion batteries.None of these papers are focused on battery degradation processes and battery use optimization.
Other examples can be found in Ref. [20] where the energy management problem of a microgrid is addressed using mathematical programming with the main objective to minimize the operation costs, but where the authors focus more on a detail modeling of the microturbines and fuel cells rather than on detailed battery degradation processes.Another energy management problem is investigated in Ref. [21] where the authors investigate an islanded network with the objective to minimize the energy losses in the grid and the total generation costs through an optimized use of the integrated battery storage.However in this case the optimization is made through the use of a metaheuristic technique (NSGA) in contrast to the classical optimization approach adopted here.Moreover, the approach proposed for the management of battery does not consider battery degradation.The optimal use of batteries for energy arbitrage with different energy tariffs is investigated in Ref. [22] and similar work focused on load shifting through an optimal battery operating strategy is discussed in Ref. [23].Both works investigate battery use optimization to maximize profits of the battery owner, but battery degradation is not taken into account.The authors make some assumptions and they state in the paper that they assume a battery without any form of degradation.
Further papers in the literature deal with technical economical evaluation of different battery technologies to investigate how the choice of technology affects the management of the system in different scenarios.Such studies can be found in Ref. [24] where a technoeconomic evaluation is carried out referring to lithium-ion, sodium sulfur and vanadium redox battery technology.In this case authors focus mainly on the economical impact of the storage technology without consideration of battery degradation.A similar study can be found in Ref. [25] where again a comparison of different battery technologies is proposed but no degradation issues are taken into account.
The battery degradation issue is considered in Ref. [26] where authors present an Energy Systems Model similar to the popular microgrid software HOMER, but they aim at improve the battery models used in that program.However the proposed methodology is still a simulation tool and no optimization element is introduced to the simulation model.
Battery degradation is taken into account also in Ref. [27] where authors assume a fixed degradation cost of the battery, but no sensitivity analysis is performed to identify the level of degradation required for the technology to become cost competitive.
A similar approach is used in Ref. [28] where the degradation of the battery is taken into account through the use of parameters such as state of health, aging coefficients and calendar life that vary for different technologies and thus define the degradation cost for a given technology.
There are other studies that are more focused on integrating degradation issues within battery control, however they are generally related to grid connected systems, and the battery control is in general very simple.A common issue with such studies is that the battery control is performed using very strong assumptions as inputs, for instance, defining a priori an upper bound on the maximum number of allowable cycles as in Refs.[29] and [30], or defining upper bounds and lower bounds on the state of charge of the battery as in Refs.[31] and [32] without formal optimization.This assumes part of the solution, rather than balancing costs of degradation against benefits of use.An optimization model should ideally be built in such a way that number of cycles and state of charge (as well as other degradation properties) are considered as variables rather than as input parameters.This way deeper analyses on balancing cost of using battery against benefits can be done, and the optimal battery schedule can be found without imposing ex ante hard constraints.
None of the above papers are aimed at developing degradation cost functions in a form suitable for inclusion in optimization models.The key contribution of the present paper compared to the current available literature is that if one can assign costs to battery cycles of different natures, then the optimization approach will be more directly related to minimizing the true costs of operating the battery.

Battery properties, assumptions and definitions
According to the kinetic battery model discussed in Ref. [33] the main battery properties that has to be considered in an operational management optimization problem are: h t char (kWh) that is the maximum amount of power that the battery can absorb in every discrete time step t according to its state of charge; max discharge power h t dis (kWh) that defines the maximum amount of energy that can be withdrawn from the battery in every time step t; nominal voltage V (V) which is the reference voltage provided by manufacturers; minimum state of charge S (kWh) below which the battery must not be discharged to avoid permanent damage; maximum charge current I (A) which is the absolute maximum charge current regardless of the state of charge; nominal capacity Q max (kWh) that indicates the rated capacity of the battery; roundtrip efficiency E (%) which indicates the percentage of the energy going into the battery that can be drawn back out.We assume the battery efficiency in both direction is the same and therefore can be derived as the square root of the roundtrip efficiency.This same approach has been carried out by other works that involve batteries, such as [34] or [35].
The nominal capacity is often measured by Ah (number of Amperes that can be taken from battery multiplied by time how long this current can be taken).In order to work in kWh, the battery capacity will be calculated as battery voltage multiplied by Ah.We assume that the voltage is constant and equal to the nominal voltage.
In this study we will use the Kinetic Battery Model described in Ref. [33] to specify the amount of energy that can be absorbed by or withdrawn from the battery bank on each time step.The kinetic battery model is based on the concepts of electrochemical kinetics, and it represents a battery as a two tank system.The first tank contains available energy, that is energy that is readily available for conversion to electricity.The second tank contains bound energy, that is energy that is chemically bound and therefore not immediately available for withdrawal.The total amount of energy stored in the battery at any time t Q t j is the sum of the available energy Q1 t and bound energy Q2 t .In order to describe this two tank system three parameters are needed: the maximum battery capacity (Q max ) which is the total amount of energy the two tanks can contain; the capacity ratio c which is the ratio of the size of the available energy tank to the combined size of both tanks; the rate constant k which gives the conductance between the two tanks, i.e how quickly the battery can convert bound energy to available energy or vice-versa.
The life of a battery can be measured either by the total amount of energy in kWh that can flow throughout it or the number of times it can be cycled before it is no longer able to deliver sufficient energy to satisfy the load requirements of the system.The two mentioned approaches are one of the many ways to measure the life of a battery (see also [36] for further readings).The first approach refers to the lifetime throughput calculation.The lifetime throughput is derived from the lifetime curve provided by battery manufacturers, in which different depths of discharge n is associated with numbers of residual cycles to failure.The general trend of lifetime curves is that the deeper the discharges are, the less the related residual cycles to failure are.Table 1 shows an example of such data.
For every depth of discharge n it is possible to calculate a value of the lifetime throughput L n : where:Q max is the battery capacity (kWh),f n is the number of cycles to failure of the table's line n,g n is the depth of discharge of the table's line n (%).
Then the lifetime throughput L (kWh) of the battery is obtained by averaging the n values of lifetime throughput L n in the allowable range of depth of discharge.In the example of Table 1 the resulting lifetime throughput is obtained by averaging the first seven lifetime throughput values as the battery minimum state of charge is 20%.The same lifetime throughput calculation has been discussed by other research, for instance [37].
The second approach mentioned before refers to the number of cycles calculation.In this case it is important to remember that there are two main types of a battery cycle.A full cycle refers to a sequence of discharge-charge operations that starts and ends with a fully charged battery.On the contrary a partial cycle refers to a sequence of discharge-charge that can start and/or end with a not fully charged battery.For further reading about the properties of each class of cycle refer to [38] [39], and [40].
As described in Ref. [41] partial cycles are regarded as having a negative impact on the battery wear and lifetime, for instance through sulfate crystal formation in floaded lead acid batteries.More importantly, cycling a battery between two partial states-ofcharge soon causes severe electrolyte stratification, causing accelerated ageing of the bottom part of the battery plates.
To summarize, the degree of wear of a battery is a function of number of cycles, depth of cycles, type of recharge and amount of energy that flows throughout it.These are the main stress factors we will focus on in this paper.In order to represent the battery degradation in optimization models, a representation of battery degradation costs will be put on battery actions for control purposes.In particular we will refer to both a degradation cost per kWh and a degradation cost per cycle.
With regard to the first, the battery degradation cost will be defined as the cost of the energy through the battery bank.It is assumed that the battery bank will require replacement once its total throughput equals its lifetime throughput.From that point of view, the battery degradation cost per kWh B can be defined using the following equation: Where:R replacement cost of the battery ($),L the lifetime throughput of the battery (kWh),E the square root of the roundtrip efficiency of the battery (%).This cost will be incurred every time the battery is discharging as a cost per kWh out the battery.See in particular Sections 5.1, 5.2, 5.3 and 5.4.
The second way that will be used to include degradation costs, is to calculate the cost per cycle for every depth of discharge n as a fraction of the battery capital cost R and the remaining cycles to failure f n as shown in Formula (3).
The idea is that say there are different depth of discharge values and different cycle life values, the cost per cycle for each depth of discharge can be calculated.We calculate the value for the whole battery bank (capital cost) and then store up the costs of every discharge cycle until we get to the max capital cost: then the battery has to be replaced.In particular, this cost will be used in Section 5.5 where the focus will be on the cost of battery cycles.

Mathematical model
This section will introduce a mathematical formulation for the off-grid system optimal management integrated with battery details, while the following section will discuss how to take into account the main battery degradation issues.Fig. 1 shows a simplified system diagram and the energy flows among the different units that will represent decision variables in the optimization model while a list of decision variables and parameters can be found in the Nomenclature section.The model considers a time step t of 1 h.
The objective function (4) aims at minimizing the energy cost C t G of the conventional generator and the total degradation costs C t B related to the battery use.Note that if C t B ¼ 0 the optimization result will reflect the actual current off-grid systems behavior focused just on diesel costs minimization regardless of battery degradation issues or battery use optimization.The conventional generator cost is the cost of the energy that flows from the conventional generator to the final users x pd and from the conventional generator to the battery x pr ; it is calculated by multiplying the kWh out the conventional generator by K that represents the energy cost per kWh.
The battery total degradation cost C t B is defined as a function of one or more battery stress factors s and their related costs.The mathematical modeling for the battery degradation functions will be discussed in more detail in following sections.
Constraint (6) ensures that user demand is completely met with one of the two flows or both.
From an operational point of view the energy flows out the conventional generator must respect its minimum production PP p and its maximum capacity PC p .For this purpose the semi continuous variables ðx t pd þ x t pr Þ can be inserted in the disjunctive constraint (7) which contains the logical operator or defined by the symbol jj to state that only one of the two mathematical expressions on either sides of the logical operator can be satisfied in every time step.See Ref. [42] for further definitions and discussion of the use of disjunctive constraints in scheduling problems.
Semi-continuous variables are variables that by default can take the value zero or any value between their lower bound and their upper bound.In the specific case of constraint (7) the lower bound is the minimum conventional generator production PP p and the upper bound is the conventional generator capacity PC p .Hence, the total energy out the conventional generator can either be zero or any value between PP p and PC p (PP p x t pd þ x t pr PC p ).As described in Ref. [43] solvers such as CPLEX can directly handle semicontinuous variables and related constraints.

Converter units efficiency
Constraint ( 8) and ( 9) are used to take into account the loss of energy due to the inverter efficiency l v and the rectifier efficiency l r .

Renewable source capacity
x Constraint ( 10) is inserted to control the flows from the renewable source: their summation must respect the maximum forecast production of the renewable source R t in time t.

Initial values of battery variables
Constraints ( 11) and ( 12) define the initial values (t¼0) of the battery content Q t j (the battery is assumed completely charged) and of the variable Q t 1 that will be used inside the max charge and discharge constraints.The parameter c is the battery capacity ratio defined as input.

Minimum battery charge level
The battery properties impose that the battery content can't be less than a minimum value as expressed in constraint (13) where S j is the minimum state of charge defined as input.

Charge and discharge processes management
The last following constraints define the charge and discharge processes through the Kinetic Battery Model formulas introduced in the previous paragraph.
Constraint (14) defines the current value of the battery energy content for every time step t taking into account the loss of energy due to the discharge process E.
Constraint ( 15) contains the max discharge power formula where h t dis is expressed by the following equation according to the Kinetic Battery Model formulation.See the Nomenclature section to revise the parameters showed in the formula.
Constraint ( 16) contains the max charge formula where h t char is expressed by the following formula: According to the Kinetic Battery Model formulation and the parameters listed in the Nomenclature section, the values of H 1 H 2 and H 3 are the following: Note that H 3 is not time dependent since it is the absolute maximum charge power allowed for the battery.4.2.10.Q1 step by step value The last constraint (20) defines the value of Q 1 for every time step t according to the Kinetic Battery Model formulation and the parameters listed in the Nomenclature.

Battery stress factors modeling
This section will explain how the basic model presented in previous section can be modified by adding variables and constraints to take into consideration different battery degradation issues.

Cost per kWh throughout the battery
The simplest model of battery degradation is to apply a per-kWh degradation cost on the flows out the battery x t jv as follow: Note this way the model will just minimize the energy that flows through the battery, but it will not control any stress factor related to depth of discharge or number of cycles or insufficient recharge.

Daily depth of discharge reduction
Studies have shown that the battery wearing is largely influenced by the depth of discharge (see for instance [44]).
Moreover, the battery use for off-grid solar applications is dominated by a daily major discharge-charge cycle (see computational tests presented in Section 6: that is related to the fact that the general off-grid systems behavior for solar applications is to store the exceeding renewable energy during the day in order to extend the electrical service hours during night time periods when the PV production is zero.Hence the battery degradation can be mathematically represented by placing a cost per kWh on the daily depth of discharge.
A new decision variable Qm g has to be created to represent the lowest state of charge in every day g.The summation of the Qm g in every day g multiplied by a representative battery degradation cost per kWh, will be subtracted from the objective function.min X subject to where B represents a Battery Degradation Cost per kWh, as introduced in Section 3.

Partial cycles and energy out the battery
The daily depth of discharge formulation presented in previous Section 5.2, can be suitable to reduce also the number of partial cycles as shown in Fig. 2 where different examples of battery curves with different depth of discharge (cases 1e3) are represented.As the daily depth of discharge becomes shallower, the energy content at the end of the cycles increases and therefore a higher number of cycles will end with a fully charged battery.Hence an indirect effect of the daily depth of discharge reduction will be a simultaneous reduction of partial cycles (which are cycles that starts and/or end with a not fully charged battery).Another indirect effect is related to a reduction in the amount of energy that will flow throughout the battery during the considered time horizon.

Minimize the gap between the highest and lowest state of charge in every day
Another possibility is to measure the battery wear based on the gap between the highest and lowest state of charge in each day and place a degradation cost on it.Two new decision variables are needed: the lowest state of charge in a day g called Qm g and the highest state of charge in a day g called Qp g .The gap to be minimized can be defined through two new constraints: Q t j Qp g cg; cðt2gÞ : Finally the gap minimization will be added in the objective function: where ðQp g À Qm g Þ is the discharge gap to be minimized in every day and B is a battery degradation cost per kWh.

Number and type of cycles
As previously outlined the battery degradation is a function of the number of cycles and the depth of discharge defined as the amount of energy left at the end of a discharge session.Mathematical formulations to minimize battery cycles and simultaneously define the battery energy content at the end/ beginning of every cycle follow.

Minimize battery cycles
In order to minimize the battery cycles it is necessary to define the time t at which a charge cycle starts and finishes by linking three binary variables.
q t equal to 1 if the battery is charging in time t, 0 otherwise q t down equal to 1 if a charge sequence is starting, 0 otherwise q t up equal to 1 if a charge sequence is finishing, 0 otherwise Similarly, it is possible to define the time t at which a discharge action is starting and finishing by linking three types of binary variables: b t equal to 1 if the battery is discharging in time t, 0 otherwise b t down equal to 1 if a discharge sequence is finishing, 0 otherwise b t up equal to 1 if a discharge sequence is starting, 0 otherwise Therefore the binary variables q t up and b t up identify the upper peaks of the battery charging curve, while the binary variables q t down and b t down identify the lower peaks of the battery charging curve.It is clear that if a charge sequence is immediately followed by a discharge sequence without any steady condition between the two states, then the two binary variables q t up and b t up coincide in the same time step.Similarly, if a discharge sequence is immediately followed by a charge sequence without any steady state between the two states, then the two binary variables q t down and b t down coincide in the same time step.If discharge starts immediately after the end of a charge cycle, then the two binary variables q t up and b t up will not coincide in the same time step, and instead they will identify the beginning and the end of the steady period that occurs between the end of the charging sequence and the next start of the discharging sequence.Similarly, if the end of a discharge is not at the same time as the start of the charge, then the two binary variables q t down and b t down will not coincide in the same time step, instead they will identify the beginning and the end of the steady period that occurs between the end of the discharge sequence and the next start of the charge sequence.
Clearly all the four variables q t up , b t up , q t down and b t down identify interruptions in the charge sequence or in the discharge sequence, i.e. upper or lower peaks in the battery charge/discharge curve.To minimize the number of cycles we are only interested in those peaks in the battery charge/discharge curve that identify either an interruption in the charge sequence or an interruption in the discharge sequence.Therefore the binary variable that we aim at minimize in the objective function is only one of the four mentioned variables, namely q t up .From a mathematical point of view, the charging sequences can be summarized as follow: if at time t the storage is on a charge sequence (q t ¼1) and at time tÀ1 it was not on a charge sequence (q tÀ1 ¼0), then at time t a charge sequence is starting (q t down ¼ 1); if at time t the storage is not on a charge sequence (q t ¼0) and at time tÀ1 it was on a charge sequence (q tÀ1 ¼1), then at time t a charge sequence is finishing (q t up ¼ 1); if at time t the storage is on a charge sequence (q t ¼1) and at time tÀ1 it was on a charge sequence too (q tÀ1 ¼1), then there is no change in the state of charge (q t down ¼ 0 and q t up ¼ 0); if at time t the storage is on a discharge sequence (q t ¼0) and at time tÀ1 it was on a discharge sequence too (q tÀ1 ¼0), then there is no change in the state of charge (q t down ¼ 0 and q t up ¼ 0).if at time t the storage is steady (q t ¼0) and at time tÀ1 it was steady too (q tÀ1 ¼0), then there is no change in the state of charge (q t down ¼ 0 and q t up ¼ 0).Similar statements can be formulated for the discharge sequences: if at time t the storage is on a discharge sequence (b t ¼1) and at time tÀ1 it was not on a discharge sequence (b tÀ1 ¼0), then at time t a discharge sequence is starting (b t up ¼ 1); if at time t the storage is not on a discharge sequence (b t ¼0) and at time tÀ1 it was on a discharge sequence (b tÀ1 ¼1), then at time t a discharge sequence is finishing (b t down ¼ 1); if at time t the storage is on a discharge sequence (b t ¼1) and at time tÀ1 it was on a discharge sequence too (b tÀ1 ¼1), then there is no change in the state of charge (b t down ¼ 0 and b t up ¼ 0); if at time t the storage is on a charge sequence (b t ¼0) and at time tÀ1 it was on a charge sequence too (b tÀ1 ¼0), then there is no change in the state of discharge (b t down ¼ 0 and b t up ¼ 0).if at time t the storage is steady (b t ¼0) and at time tÀ1 it was steady too (b tÀ1 ¼0), then there is no change in the state of discharge (b t down ¼ 0 and b t up ¼ 0).These considerations can be expressed by the following constraints: q t À q tÀ1 ¼ q t down À q t up ct > 0 (28) Another pair of constraints will ensure that the beginning of a charge event cannot happen together with the end of a charge event, and that the beginning of discharge event can't happen together with the end of a discharge event.That means the q t down and the q t up can't be equal to 1 at the same time and similarly, the b t down and the b t up cannot be equal to one at the same time.
It is necessary to link the new binary variables to the existing decision variables in order to get correct results from our mathematical model.In particular the variables q t and b t has to be linked to the flows into the battery in time t, x t ij and x t rj . x Finally another constraint has to be added in order to link the binary variables q t and b t to the flows out the battery.If the binary variable q t is equal to 1, this means that the battery is charging and therefore the flows out the battery itself must be equal to zero.On the other hand, if the binary variable b t is equal to 1, this means that the battery is discharging and therefore the flows into the battery itself must be equal to zero.To enforce these requirements, "mutually exclusive flows" constraints are inserted as follows: Then the objective function will minimize the cycles by multiplying the binary variable q t up by a representative degradation cost per cycle B c .min X

Identify the cycles that end with a fully charged battery
It can be useful to identify only those peaks in the battery charge/discharge curve in which the battery is fully charged, as such peaks represent full cycles.Ideally, we wish to reduce partial cycles (that starts or end with a partially charged battery) and prioritize the full cycles, those in which the battery ends up fully charged after a sequence of discharge and charge operations.
For that purpose we can define a new binary variable q t up;max that is equal to 1 if in time t a charging is finishing and the battery content is equal to the maximum battery capacity Q max , and 0 otherwise.
The following set of constraints can be added to handle such variable: q t up !q t up;max ct (39) where M represents a very large number.
In particular, constraint (37) implies that if the variable q t up;max is equal to 1, then the difference between the maximum battery capacity Q max and the current battery energy content Q t should be zero.That means that the battery energy content is equal to the battery maximum capacity, or in other words, the battery is fully charged.If the variable q t up;max is zero, then the constraint (37) will always be satisfied thanks to the multiplication by the M number.
The constraint (38) imposes that if the battery is fully charged and therefore q t up;max is equal to 1, then no flows of energy into the battery are allowed and the summation x t ij þ x t rj has to be zero.On the other hand, if the battery is not fully charged, then q t up;max will be zero and flows into the battery are allowed but limited by the battery capacity Q max .
Finally, constraint (39) guarantees that q t up;max will be counted only once when the battery is at the end of a charging sequence, and not every time that the battery is fully charged (i.e.we need to avoid q t up;max being equal to 1 for every time of a steady sequence).Therefore q t up;max is allowed to be equal to 1 only in those time steps in which also q t up is one, i.e.only at the end of a charging sequence.However if the end of the charging sequence is not at a fully charge level, then the constraint allows q t up to be 1 and q t up;max to be zero.An objective function which prioritises full cycles over partial cycles can be specified as: where the smaller the difference between P t q t up and P t q t up;max , the larger the number of charging sessions that terminate with a full charge battery.

Define the content of energy at the end/beginning of a charging session
A more detailed way to study battery degradation issues is not only focusing on the cycles minimization, but considering also the energy content at the beginning or at the end of every charging or discharging sequence.For that purpose two new decision variables are defined as follow: Q t end which define the energy content in the battery at the end of a discharge sequence; Q t start which define the energy content in the battery at the beginning of a discharge sequence; In order to define the value of Q end the following constraints are inserted: The constraint (41) imposes that the variable Q end will assume a value greater than zero only when the variable q t down will be equal to one, as the objective is to look for those lower peaks in which a charge sequence is starting.
The constraint (42) imposes that the variable Q end can't be greater than the energy content in time t, thus if the variable Q end is maximized in the objective function, it will always be equal to the battery energy content Q t j .But thanks to the constraint 41 this will happen only for those lower peaks in which a charge sequence is starting, that means when the variable q t down is equal to 1.The objective function will become the following: where Q max À Q t end represents the amount of space in the battery for those lower peaks in which a charge sequence is starting and B is the degradation cost applied.The lower the value Q max À Q t end , the shallower the depth of discharge.
Similarly, for the battery energy content on the upper peaks at the end of a discharge sequence Q start the following constraints can be added: Then the objective function will become as follow: where represents the amount of space in the battery on the upper peaks at the end of a charge sequence to be minimized.The lower the value, the higher the battery energy content at the end of the charge sequence (that means the battery will start a discharge in a fully charged condition).

Introduction to sensitivity analyses
The objective of the following computational tests and sensitivity analyses is to investigate whether at the current state of art of technology battery degradation costs make regular use of the battery viable, and, if not, how much capital costs must fall or lifetimes increase in order for it to become viable.
The main energy alternative to meet the demand of an offgrid system is represented by a diesel generator.If the system is going to use the battery less to reduce the battery stress factors, then sometimes it will have to run the conventional generator more.Therefore we will study a range of costs to understand how behavior of system will depend on lower degradation costs defined as the ratio of the battery degradation cost and the diesel cost.We will also investigate how much the battery replacement cost should drop as a function of the declared lifetime throughput, to make the battery use more convenient.The key point is whether it is still worthy to use the battery when there is a conventional generator with a lower cost per kWh.The ratio of the battery degradation cost and the diesel cost will allow us to explore future scenarios with better batteries (i.e. a forecasted scenario in which battery costs drop and diesel costs will continue to increase).

Data
Tests have been made using real world data of demand and renewable production from a site in Rwanda [45].The offgrid system data shown in Table 2 come from the real world application in Rwanda.The site is provided with a 1.3 kW solar PV array and a battery that represents a standard lead acid battery for off-grid applications (refer to [46] for a review of lead acid battery properties).Tests will be focused on a representative lead acid battery because, as discussed in Ref. [45], in developing countries like Rwanda the lead acid battery is the most widely used storage technology.
The diesel cost in $/kWh is derived from the cost per liter $/L and the liter required for every kWh of energy l/kWh.The cost per liter is equal to 1.6 $ and the average diesel production is equal to 0.33 Liter/kWh (values for the African sites tested in Ref. [45]).
The battery data used is provided by manufacturer documentation.From the data, the capacity and lifetime curve are used to derive kinetic battery constants which are used in modeling the battery as discussed in Section 3. Table 3 shows the battery lifetime data expressed as depth of discharge versus cycles to failure that is generally provided by manufacturers.The column "Lifetime throughput" shows the calculated throughput for each depth of discharge using the formula 1.

Results discussion
The following diagrams and tables show the results obtained performing the optimization using an Intel Pentium processor SU4100 1.30 GHz PC, with 4 GB of memory; the MILP models are solved through the branch-and-cut algorithm implemented in the IBM Cplex 12.2 solver.We will show and discuss the resulting battery energy content Q j in 20 representative days, from the 8th to the 27th of August which correspond to the days with the higher solar irradiance throughout the year in Rwanda.Different ratios B/K of per kWh battery degradation cost B to diesel cost K has been tested.When no degradation charge is applied that leads to the extreme case illustrated in This shows that, for off-grid applications, lead acid battery technologies will have higher costs due to the low throughputs which will require the battery to be replaced frequently to maintain a reduced outage.
Within the two extreme scenarios outlined above, sensitivity analyses has been made to explore how the battery curves change as a function of different degradation cost values.Fig. 4 shows two representative enlargements of Fig. 3.The different curves are obtained applying different degradation costs on the daily depth of discharge, using different B/K ratios.
As the B/K ratio becomes lower, the battery trend changes from very little use (backup and emergency purposes) to a deeper use (storage purpose).As a battery degradation cost is applied, then the battery use tends to become shallower allowing a reduction of the stress factors, but that requires a higher use of the conventional generator.The use of the diesel generator to satisfy the final user demand increases as the B/K ratio becomes higher.
In Fig. 5 different battery stress factor values for the different battery degradation costs are shown together with the related diesel costs.
Table 4 summarizes the main stress factor values and diesel costs for the different B/K ratios along the representative period considered.Note that partial cycles are all the charge/discharge operations that start with a not fully charged battery and/or end with a not fully charged battery.For practical reasons it is considered a fully charged battery when the energy content is greater than or equal to 90% of the total battery capacity (that is an almost fully charged battery as discussed in Ref. [47]).
As shown by the enlargements of Fig. 4, there are almost overlapped curves for B/K ratios equal to the 50e60e70%.Moreover, looking at the stress factors versus diesel costs representation in Fig. 5 there is an evidence that the range of B/K values within 50e60e70% is the one in which the battery stress factors are considerably shallower and the total diesel costs remain steady on medium-low values.Lower B/K values correspond to very high stress factors, and higher B/K values correspond to very high total diesel costs and a very little use of the battery.As a conclusion, for off-grid applications the lead acid battery technology is still not mature enough and it should move towards a degradation cost reduction where the battery degradation cost B defined in 2 should drop below the 70% of the diesel costs.In other words, that means that, given the current diesel costs K in $/kWh, the battery lifetime throughput L in kWh and the battery efficiency E in %, then the battery replacement cost R in $ should satisfy the relationship: R L*E*0:7*K The Formula 47 can be a guideline during battery choice and purchase.
Table 5 shows the replacement cost R in every B/K scenario for our particular case study in Rwanda in which the lifetime throughput of the battery L was equal to 1344 kWh, the battery efficiency E was equal to 89% and the diesel cost was equal to 0.48 $/kWh.

Comments of results for the particular Rwanda case
At the current state of technology PV-Storage is not economically valuable for rural off-grid communities without external support from government or international donors as was the case in Rwanda [45].
Lead acid batteries can be more convenient in off-grid applications for rural and remote areas, where the diesel costs are much higher due to additional handling and transportation costs.However, looking at a future in which diesel prices for rural communities will increase and the battery technologies will improve, it can be reasonably expected that the ratio between the battery degradation costs and the diesel costs will drop.Fig. 6 for instance shows the increasing diesel prices trends in Rwanda along the last years.
At the present time the oil price is very low and this may impact the diesel prices in Rwanda moving them downwards from the price increase trend shown in Fig. 6.However, it is important to note that in remote land locked areas like Rwanda, the diesel cost is higher due to supply and additional transportation and handling operations worsen by limited road infrastructure connecting remote villages and towns.In this situations, the use of storage becomes more valuable as long as the global diesel cost increases by up to the 30%.Schmid et al. in Ref. [48] showed from their research in Brazil that such additional transportation and handling costs to move the fuel from suppliers to the remotes sites could add a mark-up of 15%e45%.
However, the future cost of diesel is unknown and though the transportation and handling issues in land locked countries with remote sites increases the cost of diesel in such countries, the government would need to provide support to enable off-grid systems with batteries to be viable in the short to medium term for remote off-grid communities.A way of reducing the high cost of off-grid systems due to battery costs and replacement costs would be for the government to support the import and use of second life electric vehicle batteries which will be reusable and discounted compared to new batteries.This will increase accessibility to batteries, reduce costs and move installers to use other technologies apart from lead acid batteries, for instance lithium ion technology that is largely used in the electric vehicles.

Conclusions
A model for the battery degradation analyses and optimization has been presented.The authors have provided in this paper a way to address how different operational patterns of an off-grid power system impacts the degradation costs of batteries.This has been done in particular in light of limited data available from rural communities with failed off-grid power systems resulting from batteries prematurely becoming unusable.The contribution of the study is both a methodological one and an analytical one.From a methodological point of view we presented mathematical ways to represent off-grid systems and battery degradation issues inside an optimization model.It is important to note that any assumption on the allowable depth of discharge has been made; instead we place an operational cost on use of the battery arising from the degradation caused, and identify an operational cost optimum balancing this against costs of alternative fossil fuel supply.From an analytical point of view we used the proposed model to make sensitivity analyses on the degradation costs, demonstrating how much lifetimes or capital costs must improve in order to make the battery fully cost competitive.
At the current state of technology, lead acid batteries which were widely used in Rwanda where the data used for analyses in this paper was gathered, are convenient for backup and emergency uses.Our analyses shows that lead acid batteries become viable when their degradation cost per kWh drops below the 70% of the current diesel cost which represents the main energy alternative.As the degradation cost is a function of the battery replacement cost, throughput and efficiency (see formula 2), that means that the battery technology should move towards a replacement costs reduction and a throughput properties improvement.
The proposed work highlights the importance of the economic operation of storage which takes into account the relationship between the degradation of a battery and the operating pattern to meet the electricity requirements of an off-grid site.Our analyses showed that this is crucial to prolonging the lifetime of an installed battery in the off-grid system, leading to fewer battery replacements which increase the cost of maintaining off-grid systems.The weakness of off-grid PV systems which is largely attributed to the battery costs and short lifetime, has led to a stigma around investing in such systems.In fact they are costly compared to using diesel generators, in the short term, and do not last very long.Implementing a strategy that optimises operation based on battery degradation, will mean less replacement and breakdown of off-grid PV systems, which will benefit countries who wish to implement them.The formulation provided in (47) can serve as a guideline for designers on choosing a battery for off-grid sites based on both the battery parameters and cost of diesel in a country.It can be used as one of many guidelines to establish whether to go fully off-grid, use a hybrid off-grid diesel system, or use only diesel generators if the cost of diesel is not high enough to make using a battery viable.
Finally, the analyses from this paper shows that a fully off-grid system at present will be expensive and requires good management and control strategies to prolong the life of the batteries.From that point of view, investigating different control strategies could be a natural future development of the present work.In particular,  control strategies could be discussed to manage shortage conditions and those extreme situations where the conventional generator is unavailable, which is the case of many African rural islanded villages.One of the social aspects that characterize African sites in general and the Rwanda site we studied in particular, is that 100% reliable power is not always a necessity.Therefore developing flexible control strategies that allow load disconnection could represent a way to integrate social aspects and technoeconomic aspects within the management and control strategy of energy storage systems.However, delving deeper into the subject of control strategies and management of the systems is beyond the scope of this paper, which develops a way of representing battery degradation costs for use in improving the performance and reducing the need for frequent battery replacements in a system, while providing the electricity the system was designed for.
In conclusion, we show that a hybrid system design should take into consideration battery degradation issues and costs: such issues are frequently overlooked while our analyses showed clearly how much they can influence the general operating cost of a system.The authors would also like to underline the need for further work on analysis of degradation costs.Current manufacturer data on degradation are not ideal for predicting the cost of lifetime reductions arising from given duty cycles, and new research on this topic could bring great benefits in the design of economic battery system control.

Fig. 2 .
Fig. 2. Example of a battery curve that is shifted towards the higher part of the diagram.The direct effect is the depth of discharge minimization.The indirect effect is the reduction of partial cycles and the reduction of the amount of energy out the battery.
Fig 3 represented by the black bold curve and related to a very intensive use of the battery.Another extreme scenario is related to a high degradation charge defined as B ¼ R L*E (see Equation (2) for further details).This is the extreme scenario depicted by the dotted line in the figure, which shows a very little use of the battery, i.e. when it is used mainly for backup and emergency purposes.

Fig. 3 .Fig. 4 .
Fig. 3. Two extreme cases of battery use: the deep use (black line) when battery degradation costs are not considered and the very little use (dot line) due to the actual degradation cost.

Fig. 5 .
Fig. 5. Stress factors values (right ordinate) and total diesel costs (left ordinate) incurred along a representative period of 20 days.Total values in different scenarios applying different battery degradation costs per kWhB as a percentage of the fixed diesel cost per kWh K (ratios B/K on the x axis).The higher the grey column is the worse the stress factor is.

Table 1
Example of depth of discharge versus cycles to failure data for a solar battery (2.7 kWh capacity and 20% minimum state of charge), with lifetime throughput calculations.

Table 2
Data for computational tests.

Table 3
Battery bank lifetime table (depth of discharge versus cycles to failure) with lifetime throughput calculations.

Table 4
Results summary along a representative period of 20 days -battery stress factors in different scenarios with different battery degradation costs applied to the daily depth of discharge.

Table 5
Battery replacement cost in different scenarios B/K for our particular case study in Rwanda.