Optimal Operation of Energy Storage Facilities in Incentive-Based Energy Communities

: The green energy transition calls for various solutions to enhance environmental sustainability. One of these is represented by renewable energy communities, which may help transition from centralized energy production to distributed renewable generation. European countries are actively promoting incentive schemes for energy communities to foster local electricity self-consumption in order to balance demand and renewable generation. In this context, energy storage facilities can be employed to gather the energy production surplus and use it in periods of low generation. In this paper, we focus on the optimal operation of an incentive-based energy community in the presence of energy storage systems. A centralized optimization problem was formulated to optimally operate storage systems at the community level. Starting from this solution, distributed charging/discharging commands were found to optimally operate the single storage units. Moreover, conditions guaranteeing the convenience of using energy storage systems inside the community were derived. Numerical simulations were performed to validate the reported results and to evaluate the potential benefits of energy storage facilities inside renewable energy communities.


Introduction
The European community is driving its countries to implement sustainable solutions and comply with the net-zero plan reported in the 2050 agenda [1].For this purpose, it is of paramount importance to transition to novel energy paradigms like renewable energy communities (RECs), the aim of which is to shift centralized energy production to local renewable generation.Most notably, the main objective of an REC is to provide social, environmental and economic benefits to its members by means of renewable generation devices, energy storage facilities and electric vehicles [2].The participants in an REC can include organizations, citizens and local businesses that partake in the community on a voluntary and open basis.For these reasons, RECs can contribute to enhanced environmental sustainability by establishing a spontaneous synergy among all members.
Research efforts have produced several contributions concerning the operation of RECs [3,4] and how they can be implemented according to regional, social and political factors [5].The investigated topics span from community models featuring internal markets [6,7] to those focused on incentive-based schemes [8,9].In this work, we consider an REC where an incentive is provided on the basis of the virtual self-consumption of the community, like in the Italian framework [10].This quantity is computed for a given time period, and it amounts to the overall renewable energy shared inside the community [11].
It has been shown that joining an REC can increase local self-consumption.In [12], it was shown that the employment of genetic algorithms for the optimal usage of renewable resources provides a boost to REC performance, while the adoption of multi-objective criteria provides economic and environmental benefits [13].Moreover, the optimization of community facilities may help to increase the social welfare of the affiliated members [14], while joining an REC is a possible tool for addressing energy poverty [15].The benefits of energy communities in smart building frameworks were assessed in [16], while economic analyses of the profitability of RECs depending on different variables were proposed in [17].In [18,19], optimization approaches were used to design the allocation of renewable resources in RECs to reduce investment costs and increase their benefits.The optimal management of community devices can reduce carbon emissions and the interaction between the grid and the community [20], as well as optimize the operating costs [21].The optimal collaboration of REC members to maximize community social welfare was investigated from a game theory perspective in [22].

Contribution and Novelty
In this paper, the optimal operation of an REC involving consumers, prosumers, producers and energy storage facilities is considered.Starting from load and generation profiles of each member, we provide a centralized optimization framework for the optimal management of the installed storage devices aimed at minimizing the community's energy bill.
Despite the presence of other contributions involving energy storage systems in RECs, to the best of the authors' knowledge, none of them provides methodological tools addressing how community incentives affect optimal community operation.To this end, this work aims to fill the identified research gap via the following contributions:

•
Provide analytical conditions that assess to what extent the incentive is worthwhile for the participation of storage facilities in REC operation; • Introduce a low-complexity linear optimization problem obtained by aggregating REC member profiles at the community level; • Provide a procedure that allows one to compute the optimal distributed storage management starting from the aggregated one.
The main novelties of this work are related to the introduction of tools focused on addressing the optimal operation of storage facilities in incentive-based energy communities in response to a given incentive.In particular,

•
We provide conditions under which the self-consumption incentive will trigger the coordination of storage units within the community; • The proposed optimization framework streamlines the management of RECs by providing insights into the potential benefits of the presence of energy storage through the solution of a low-complexity optimization problem.

Paper Organization
The paper is organized as follows: In Section 2, the community model is presented, while the optimal community operation problem and technical results are provided in Section 3. In Section 4, the computation of a distributed solution is discussed, while numerical simulations and related results are reported in Section 5. Finally, some conclusions are drawn in Section 6.

Notation and Nomenclature
The optimal solution of an optimization problem is represented by superscript * , while a generic feasible solution is represented by .Symbols used in this work are summarized in the following table.

U
Set of community entity indexes U s Set of community entity indexes involving a storage system Objective function value without using the community storage systems S Vector containing storage commands γ(t) Ratio between optimal charging energy and its bound δ(t) Ratio between optimal discharging energy and its bound

REC Model
In this work, we focus on an REC whose affiliated entities belong to the same geographical neighborhood.This is, for instance, the case of Italian RECs, where entities must be connected to the same primary station of the grid [23].Entities are supposed to be divided into the following three categories:

•
Consumers: entities composed of appliances only.They are perceived by the community as pure loads.
• Prosumers: entities composed of appliances and renewable generation facilities.Depending on the energy production, they are perceived by the community either as loads or as generators.

•
Producers: entities composed of renewable generation facilities only.They are perceived by the community as generators.
The models presented throughout this paper are defined according to a discrete time setting, where load and generation profiles are assumed to be known in advance.
Let u be the index defining an entity of the community, and let U be the set containing all the indexes of the community members.For u ∈ U , we define l u (t) as the load demand of a user between t and t + 1, while r u (t) is the renewable energy generated during the same time interval.Clearly, a consumer is such that r u (t) = 0, ∀t, while for a producer, one has l u (t) = 0, ∀t.
Concerning energy storage, we suppose that a fraction of producers and prosumers is equipped with a storage unit to be used in synergy with the renewable generation device.For instance, such an assumption is in line with the Italian regulation since, as stated by the Italian energy service manager [24], storage can contribute to the community only by means of renewable resources.Therefore, five possible combinations of entities are considered in community operation, whose graphical representation is reported in Figure 1.The set of indexes of users employing a storage system is denoted by U s ⊆ U .We assume that the renewable energy produced by prosumers is first employed to compensate for the internal load, while the remaining amount can be charged into storage.For this reason, only the difference between generation and load is considered in the mathematical formulation.Let be the variable denoting this difference; then, the energy that can be employed to charge a storage system between t and t + 1 is which is equivalent to the energy surplus provided by the renewable source.To streamline the reasoning, we suppose that the energy storage units are such that they can always store the energy surplus (e c u (t)) whenever needed.

Energy Storage Model
For a given entity (u ∈ U s ), the energy stored at time t is defined by the variable s u (t), whose time evolution is defined by the following equation: where the initial condition is assumed to be s u (0) = 0.In (3), η denotes the storage charging/discharging efficiency, whereas e c u (t) and e d u (t) denote the energy charged and discharged between t and t + 1, respectively.Constraints involving the charging energy can be modeled as which enforces e c u (t) being positive and not exceeding e c u (t).Concerning e d u (t), one has which enforces e d u (t) and s u (t) as positive quantities.Finally, to avoid simultaneous charging and discharging, the following constraints need be enforced:

Prosumer Load Balancing
Before performing the optimal community operation, we assume that prosumers first use their own storage units to comply with their needs.For this reason, their renewable energy surplus is first employed by the storage system to balance the load in periods of lower generation.The remaining energy can be used for community purposes.
Let ρ ′ u (t) be the profile obtained after performing this load-balancing operation.For instance, a possible profile (ρ ′ u (t)) is depicted in Figure 2. Generation exceeds load during periods where ρ u (t) > 0, while when ρ u (t) < 0, the load is greater than generation.It is worthwhile to note that the total renewable generation used for this operation (the area where ρ u (t) > ρ ′ u (t)) is greater than the overall energy required by loads (the area where ρ u (t) < ρ ′ u (t)) due to the round-trip efficiency (η 2 ) of storage.
The balancing operation involves only prosumers equipped with a storage device.Thus, profiles involving consumers, producers and prosumers without storage units remain unchanged, i.e., ρ ′ u (t) = ρ u (t).Since new energy profiles are generated, constraints involving the storage units are modified according to ρ ′ u (t).Therefore, e c u (t) is bounded as follows: where Remark 1.The profile (ρ ′ u (t)) is employed to perform the optimal community operation.Once the optimal solution is computed, the actual storage schedule involves the sum of two terms.The former is the solution providing ρ ′ u (t), while the latter is that related to community optimization.Moreover, no simultaneous charging and discharging may happen by merging the two solutions.In fact, when ρ ′ u (t) ≤ 0, the community solution cannot ask for storage charging.On the contrary, when ρ ′ u (t) > 0, storage is not used for the load-balancing operation; hence, it can be either charged or discharged depending on the stored energy (see Figure 2).

Community-Level Aggregation
In the following, computations aimed at aggregating at the community level, the introduced quantities are reported.Let us focus on the aggregation of load and generation.At a given time (t), the overall energy demand of all entities is while the renewable energy produced in the community is Notice that consumers and producers always contribute to L(t) and R(t), respectively.On the other hand, prosumers contribute either to L(t) if, at time t, a load excess occurs (ρ ′ u (t) < 0) or to R(t) if there is a renewable generation surplus (ρ ′ u (t) > 0).In an incentive-based REC, a monetary incentive is provided on the basis of the selfconsumed energy within the community.Let A 0 (t) denote community self-consumption.Its mathematical expression can be written as which represents the energy demand that is fulfilled by renewable sources.The aggregation of storage systems is performed similarly to the computations of L(t) and R(t).Specifically, at a given time (t), the energy stored in all storage facilities is while the charging and discharging energies are Constrains with respect to E c (t) and E c (t) need to be managed, too.The overall storage dynamics can be expressed as whereas E c (t) and E d (t) are bounded as follows: where A direct consequence of managing the storage units within the community is that the renewable generation profile is modified.The actual renewable generation (G(t)) in the community is the result of the following operation: Therefore, the REC's self-consumption needs to be adapted accordingly.Let A s (t) denote community self-consumption using storage systems; then, one has Remark 2. Note that constraint (6) cannot be aggregated as ( 9)- (18), since E c (t) and E d (t) are both allowed to be non-zero at the same time.
In the following, a formulation for optimal community operation is provided using aggregated quantities.Moreover, a procedure for computing a distributed feasible solution starting from the aggregated one is provided in the next sections.

Optimal Storage Operation
In this section, the optimal storage operation problem is introduced.We assume that the community's primary objective is to minimize the energy bill over the time interval of T = {0, 1, . . ., T − 1} through the incentive gained by self-consumption.Storage operation is optimized by minimizing the following objective function: where c p , c s and k are the energy purchase price, selling price and unitary incentive, respectively, for self-consumption.
In this setup, we suppose that the storage units are empty at the beginning and at the end of the considered time interval (T ).The constraint enforcing such a condition is Then, the optimal storage command is the minimizer of the following optimization problem: s.t. ( 15) − (20), ( 22), (24) where S * is the vector containing the optimal charging and discharging control signals, i.e.,

Energy Storage Convenience
In order to show when it is convenient to have storage systems inside the community, we first introduce a lemma that provides an equivalent formulation of Problem 1. where Proof of Lemma 1.Since the optimization constraints are the same as for Problem 1, the equivalence is proven by showing that objective functions I and J are equivalent.
To this end, let us first focus on storage (S(t)), which is equivalent to where the initial condition is not considered, since S(0) = 0. On the other hand, constraint ( 22) can be written as follows: Therefore, according to ( 19) and (31), the renewable generation over the optimization period can be written as Substituting I into the objective function, one has In (33), the terms involving L(t) and R(t) do not depend on the control signals (E c (t) and E d (t)).Thus, it is possible to consider the equivalent objective function as follows: which concludes the proof.
The convenience of community storage units relies on their optimal coordination, leading to reduced costs compared to not using them.In other words, if no storage units are involved in community operations, then the optimal solution to Problem 1 is trivially found by setting E d (t) = E c (t) = 0 for all t ∈ T .Thus, the following theorem provides a threshold value for the incentive (k), dictating when storage systems are not worthwhile for community operation.
Proof of Theorem 1.Let us consider the equivalent optimization problem introduced in Lemma 1.Moreover, let E d (t) = E c (t) = 0, ∀t ∈ T and J 0 the value of J for such a solution.It holds that Let us now consider a generic solution.According to (20) and ( 11), the following inequality holds: Thus, the objective function can be bounded from below as follows: According to the hypothesis of k ≤ α, one has Since the solution E d (t) = E c (t) = 0, ∀t ∈ T achieves the lower bound, such a solution is optimal.Remark 3. Theorem 1 provides a threshold value on k denoting the convenience of using storage.In fact, if k ≤ α the best solution does not require the use of storage to minimize the REC cost.In this case, the cost of the energy losses that occur during the charging/discharging operations cannot be compensated for by the increment of the monetary incentive received by the REC, so the optimal solution of Problem 1 does not call for the presence of batteries.On the contrary, if k > α, storage systems can be effectively adopted to provide a lower cost at the community level.Notice that costs associated with the storage, like degradation and replacement costs, are not considered in this analysis, since they are related to single entities and not to the REC.

Distributed Solution Derivation
The solution of Problem 1 considers only aggregated quantities of community storage systems and does not involve the charging/discharging commands of each single storage unit.In this section, the derivation of a distributed solution for the operation of storage facilities is reported.
First, it is worth noting that the solution of Problem 1 is such that E c * (t) and E d * (t) cannot be simultaneously greater than 0, as proven in the following lemma.Therefore, the t − th term of the sum in objective function (21) is the same for both solutions.However, the state of charge of storage at time t + 1 for the two strategies is

Lemma 2. Let E c
Then, Therefore, by applying E c (t) and E d (t), the cost function until time t is the same as applying S * , but the state of charge of storage is greater.Since (22) requires that, at time T, the storage must be empty, such a surplus of energy is sold in the next time steps, providing a final cost smaller than that provided by S * , leading to a contradiction.
A similar argument holds for the case of Let the optimal solution of Problem 1 be given, and let E c * (t) and E d * (t) be the optimal charging and discharging commands, respectively, at a given time (t).According to (30), the optimal value of the stored energy at time t follows Let us introduce the following quantities that denote how close the charging and discharging commands are to their respective upper bounds: It is worthwhile to remark that all the quantities involved in ( 46) and (47) are known, since the optimal solution of Problem 1 is assumed to be given.The optimal charging/discharging commands of each single storage unit of the REC are provided by the following theorem.Theorem 2. Let the optimal solution of Problem 1 be given, and let be the charging/discharging commands for each storage unit, where At a given time (t), the following set of equations holds: where the last equation follows from the two previous ones.It remains to be proven that that constraints (4)-( 6) are satisfied.According to ( 16) and ( 17), it holds that 0 According to Lemma 2, one has γ(t) • δ(t) = 0.This last implication ensures that e c * u (t) • e d * u (t) = 0.
Remark 4. Theorem 2 makes it possible to compute a solution for each single storage unit starting from the aggregated one.Specifically, this solution partitions the optimal aggregated command to ask users the for same commitment for community operation.In other words, the ratio between the charging/discharging command and its corresponding upper bound is the same for each entity of the REC.

Numerical Results
To show how the proposed approach works, two illustrative examples and a largescale example are reported.The optimization period spans 24 h, with a sampling time 15 min, i.e., T = 96.The energy efficiency of the storage units is set to η = 0.9, while grid prices are supposed to be c p = 0.35 e/kWh and c s = 0.20 e/kWh, and the incentive is assumed to be k = 0.12 e/kWh.It is worth noting that since α = c s (1 − η 2 )/η 2 = 0.047 e/kWh, according to Theorem 1, the value of the incentive (k) makes storage utilization in the community convenient.Simulations were run using MATLAB 2023b, and Problem 1 was formulated using YALMIP R20210331 [25] and solved by CPLEX [26].

Example 1. Load-balancing operation.
A simplified community structure involving one consumer and one prosumer is considered to show how the load-balancing operation is embedded in the optimal solution of community operation.Load and generation profiles of the entities are depicted in Figure 3.The presented profiles were derived to resemble the renewable generation of a wind turbine and a residential load.
After performing the load-balancing operation explained in Section 2.2, the prosumer profile (ρ ′ u (t)) is obtained (see Figure 4).Then, aggregating at the community level, load and generation profiles are computed, as reported in Figure 5.The aggregated profile shows a renewable surplus during the time window ranging from 3:30 to 7:45, whereas excess load occurs in the other time periods.
The optimal solution of Problem 1 is such that the storage unit of the prosumer is employed to fully exploit the energy surplus to compensate for part of the load when L(t) > R(t).This behavior is evident in the storage dynamics and related charging and discharging control signals shown in Figure 6.Moreover, the obtained storage schedule is such that self-consumption (A 0 (t)) is maintained/enhanced when the storage is charging/discharging, as shown in Figure 7. Thus, the obtained profile initially follows the load until the storage is fully discharged; then, the self-consumption pattern resembles the generation profile (R(t)).The optimal solution allows the community to save about EUR 2.16 with respect to EUR 36.77when no storage is used for the community operation.Most notably, energy self-consumption increases by about 78% when using storage units to reduce community cost.Community costs and incentives concerning all the simulated setups are summarized in Table 1.Finally, we show how storage is actually used within the community.Clearly, the storage system is first employed to balance part of the prosumer load; then, the remaining renewable surplus is used to reduce the community cost.Thus, part of the storage schedule is devoted to two different kinds of operations involving different charging/discharging commands.The control signals used for load balancing and for community operation are reported in Figure 8.As depicted, the charging and discharging control signals do not overlap.Therefore, the actual storage operation is obtained by merging the storage commands for both the load-balancing and community operations.The merged storage schedule is reported in Figure 9.In this example, we show how the distributed solution behaves when two storage units are involved in community operation.For this purpose, we consider a community structure involving one consumer, one prosumer and one producer.
Entity profiles of load and generation are depicted in Figure 10, whereas the related profiles aggregated at the community level are depicted in Figure 11.Intuitively, the optimal storage operation exploits the renewable surplus occurring in the time period ranging from 08:15 to 17:00 to match part of the load excess in the last period of the day.The optimal storage operation is shown in Figure 12.Then, by exploiting Theorem 2, the distributed solution is obtained on the basis of the aggregated one.In particular, the resulting storage schedules are depicted in Figure 13.It is worthwhile to remark that the two solutions differ, since the prosumer storage is first used to the perform load self-balancing operation, then for community operation.
Concerning cost performance, the proposed algorithm reduces the community cost by about 8.5% with respect to the solution not using storage in the community, while the community incentive increases by about 19%.This increase is highlighted observing the self-consumption profiles (A 0 (t) and A s (t)) in Figure 14.In this section, a large-scale example is reported.An REC comprising 30 consumers, 20 prosumers and 10 producers is considered, where 10 prosumers and 7 are assumed to be equipped with storage systems.Simulations are performed for 10 days, using real historical data concerning load and generation.Note that since all the entities belong to the same neighborhood, we consider a base profile for all members involving renewable generation scaled by a suitable constant.For prosumers, this constant is sized on the basis of the related load, whereas it is the peak production value if it involves producers.The generation profile providing renewable production for all entities is taken from a real photovoltaic plant, and it is depicted in Figure 15.In Figure 16, load and generation profiles of three entities are reported, while in Figure 17, the aggregated profiles at the community level are depicted.Similarly to the previous cases, by employing the optimal solution of the storage operation problem, the energy surplus incoming from renewable generation is stored in the storage units, then used in later periods.A comparison of the self-consumption profiles between the optimal storage operation and the solution without using storage systems is shown in Figure 18.Concerning computational aspects, the proposed approach requires about 3.43 s to solve all 10 days of simulation on an i7-11700k@3.60GHz with 32 GB of RAM.

Discussion
Focusing on the results of the large-scale example reported in Table 1, it follows that the proposed approach is capable of reducing the community cost by about 9.2% compared to a strategy that does not optimize the behavior of the storage units.From a self-consumption perspective, the optimal strategy coordinates the operation of the storage systems in order to match energy consumption with renewable generation.Notably, on average, the selfconsumption is increased by about 44%, providing significant benefits from an incentive and sustainability standpoint.
The obtained results are in line with European energy policies and directives [2], since the proposed approach enables environmental, economic and social benefits for the community members.In fact, by suitably coordinating storage units, it is possible to reduce the cost of the whole community system, while substantial environmental benefits are attained through increased renewable self-consumption.

Conclusions
An optimization framework for optimal storage operation in RECs is proposed.By aggregating quantities related to load/generation profiles and energy storage facilities, and optimization problem with the aim of minimizing the community cost was formulated.The optimal storage schedule was computed through the solution of a low-complexity linear program, which allows one derive analyses in feasible time frames.Moreover, a condition on the self-consumption incentive is derived to define the threshold at which installed storage systems become beneficial for the community.By exploiting optimality conditions of the introduced problem, an optimal distributed solution for storage operation is finally obtained.
Numerical results show how the optimal solution behaves in different settings.In all the considered examples, the optimal storage schedule makes it possible to considerably increase community self-consumption.Most notably, in the considered large-scale scenario, energy self-consumption is increased by about 44%, whereas the computation time remains negligible compared to the sampling time.
Future work will focus on deriving an explicit solution to the reported optimization problem and adapting the proposed framework to more complex scenarios.Such scenarios will be focused on addressing uncertainty in load and generation, price sensitivity to load demand and the integration of additional community facilities such as different storage devices (e.g., hydrogen, supercapacitors) and electric vehicles.

Figure 1 .
Figure 1.Entity types in the considered community.

Figure 3 .
Figure 3. Example 1: load and generation profiles of the community entities.

Figure 5 .
Figure 5. Example 1: load (L(t)) and generation (R(t)) at the community level after performing prosumer load balancing.

Figure 6 .
Figure 6.Example 1: Storage level of charge and related charging and discharging control signals for community operation.

Figure 8 .
Figure 8. Example 1: charging and discharging command of storage for the load-balancing operation and for community operation.

Figure 9 .
Figure 9. Example 1: storage level of charge and related charging and discharging control signals for the load-balancing and the community operations.

Figure 10 .
Figure 10.Example 2: load and generation profiles of the community entities.

Figure 11 .
Figure 11.Example 2: load (L(t)) and generation (R(t)) at the community level after performing prosumer load balancing.

Figure 12 .
Figure 12.Example 2: storage level of charge and related charging and discharging control signals for community operation.

Figure 13 .
Figure 13.Example 2: distributed solution involving charging and discharging control signals for community operation.

Figure 15 .
Figure 15.Generation profile per energy unit of the large-scale example.

Figure 16 .
Figure 16.Example 3: load and generation profiles of three community entities.

Figure 17 .
Figure 17.Example 3: load (L(t)) and generation (R(t)) at the community level after performing prosumer load balancing.

Table 1 .
Community costs and incentives.