Optimal Allocation Method for a Fair Distribution of the Benefits in an Energy Community

Since their introduction in the EU RED II Directive in 2018, energy communities are a key topic for distributed photovoltaic systems. However, the distribution of the economic benefit among participants and the evaluation of the best composition of the energy community are still to be fully understood. Herein, a method for the optimal distribution of the benefit among participants based on their own contribution to the system is proposed. This method will be compared to other possible allocation methods and to achieve this, an energy community model which considers energy exchanges and economic expenditures is used. This model is a linear programming model based on a single‐objective optimization approach. The user economic contribution to the community can be quantified through sequential optimizations. The composition of energy communities affects the result of the optimization, as well as the contribution of each user: the total effective contribution of the participants is higher when the composition is more heterogeneous and the overall payoff in the analyzed case study increases by 12% passing from the lowest to the highest possible heterogeneity. In this latter scenario, users contribute differently as well, and their contribution is measured and ranges between 10% and 97%.


Introduction
The EU Directive 2018/2001 [1] on the promotion of the use of energy from renewable sources has introduced a new way to conceive and manage the self-produced energy of widespread production units, especially with regard to power plants close to endusers and connected to the low voltage grid. The directive identifies two different energy community schemes: the "jointly acting renewables self-consumers" and the "renewable energy community." In this article, the focus is on the latter which "[…] means a legal entity: (a) which, in accordance with the applicable national law, is based on open and voluntary participation, is autonomous, and is effectively controlled by shareholders or members that are located in the proximity of the renewable energy projects that are owned and developed by that legal entity […]." [1] Energy communities (ECs) are the most immediate way for citizens to directly participate in energy production, consumption, or sharing. EC can encourage the diffusion of new technologies, increase their energy efficiency, fight energy poverty, increase social inclusion, and go for a more sustainable lifestyle. Consumers are therefore increasingly empowered, and they are among the main players in the ongoing energy transition with an active role in implementing these solutions and focusing on optimizing instantaneous self-consumption and renewable energy sharing. However, it is important not to forget that ensuring a benefit in economic terms, such as savings in the bill is one of the main drivers to encourage the commitment of consumers.
An important aspect in this context, not assessed and considered in detail, concerns the distribution of the economic benefit among participants and the impact of the composition of the EC. In fact, at the regulatory level, no indication is given about how to distribute and allocate the economic benefit arising from the establishment of the EC, but this choice is left to the EC itself. Therefore, concerning the implementation of an EC, not only it is important to model a complex multienergy system, but also to focus on an equally concrete aspect that concerns the individual players of the EC by identifying and formalizing supportive models.
Some of the works related to EC that assess both the global EC payoff, and also its allocation among users exploit typical applications of game theory for benefit or cost sharing mechanisms, for instance the Shapley value. [2] This mechanism assesses the average of the marginal contribution to all possible member coalitions and therefore, despite being known as one of the fairest allocation methods for shared infrastructures, it has the disadvantage of a high computational burden [3] because it needs the resolution of a large number of optimization problems that rises exponentially in proportion to the number of feasible system coalitions.
Other approaches addressing the benefit obtained by individual users and not only by the whole system are, for example, the following: 1) an electricity pricing scheme to achieve a fair division of revenue between small-scale electricity suppliers DOI: 10.1002/solr.202100473 Since their introduction in the EU RED II Directive in 2018, energy communities are a key topic for distributed photovoltaic systems. However, the distribution of the economic benefit among participants and the evaluation of the best composition of the energy community are still to be fully understood. Herein, a method for the optimal distribution of the benefit among participants based on their own contribution to the system is proposed. This method will be compared to other possible allocation methods and to achieve this, an energy community model which considers energy exchanges and economic expenditures is used. This model is a linear programming model based on a single-objective optimization approach. The user economic contribution to the community can be quantified through sequential optimizations. The composition of energy communities affects the result of the optimization, as well as the contribution of each user: the total effective contribution of the participants is higher when the composition is more heterogeneous and the overall payoff in the analyzed case study increases by 12% passing from the lowest to the highest possible heterogeneity. In this latter scenario, users contribute differently as well, and their contribution is measured and ranges between 10% and 97%. and end-users is derived by the Shapley value [4] ; 2) a coalition of microgrids, the objective of which is to minimize the total operation cost, is composed of autonomous entities aiming at maximizing self-interest through a cost allocation method which ensures a fair cost share among coalition members, guaranteeing the economic stability, by applying the Benders decomposition algorithm [5] ; 3) a criterion for allocating the total economic benefit relies on the investment, therefore the payoff is shared equally among tenants who participated in the investment to the same extent [6] ; and 4) the Nucleolus [7] distribution model encourages stability, but it grows exponentially with the size of the EC and does not satisfy fairness, by favoring members who do not install generation units. In [7] Shapley-Core-Nucleolus-like allocation approaches are also assessed, and issues regarding fairness lack or computational burden are faced.
Similar allocation problems, where the configuration of the system and the resulting benefit allocation are not decoupled, are also treated as equilibrium problems with equilibrium constraints as in ref. [8] or a Nash equilibrium problem as in ref. [9] or [10]. Also, the sharing of costs is assessed through an axiomatic formulation for sharing aggregated costs based on the cost causation principle as in ref. [11].
However, these approaches depart from the aim of this article, as a decoupled allocation of the benefits is foreseen and this study aims at proposing a method for the optimal distribution of the benefit among the participants which aspires both to reduce computational burden and to focus on fairness, which from the aforementioned citations seems to be a complex trade-off.
The distribution study is performed after a preliminary phase which involves the evaluation of the optimal configuration of the EC by adopting an EC model, the objective of which is to maximize the global reward of the aggregate EC. This mathematical model optimizes the energy flows and the expansion capacity of the EC and it is not constrained by the following allocation of the benefit.
In summary, an allocation metric is proposed assuming that a fair distribution of the payoff among users depends on the allocation of a share which is proportional to their marginal contribution to the system. Given this core idea, the allocation metric is based on a heuristic mechanism and inspired by the Vickrey-Clarke-Groves auction theory mechanism. [12] Moreover, by adopting this approach, the entire distribution problems solution is fast to compute, compared to the others introduced and therefore the main novelties of this article can be summarized as follows: a heuristic formulation based on the contribution allocation mechanism for sharing the benefit has been developed and applied to the energy community framework. This heuristic overcomes the computational complexity faced by other methods that increase exponentially with the number of members.
This developed mechanism and the introduction of an index which measures the fairness of the adopted business model to distribute the benefit and the conducted analysis with a focus on the impact of the energy community heterogeneity are the innovative contribution of this work. This last index allows us to evaluate if and how much an applied business model for the benefit distribution among the members reflects the added value they bring to the EC.
The article is structuredas follows: Section 2 is divided into two parts in which the first one provides an overview of the EC model, and its inputs and outputs, while the second one presents the methodology at the base of the distribution method introduced earlier; Section 3 presents some results obtained from the application of the previous methodology to several case studies and then discusses the main aspects; finally, in Section 4, conclusions and observations on the proposed methodology are reported.

Methodology
Energy communities regard connected networks of individuals or communities that are focused on the collaboration, the sharing and the exchange of products and services. This determines the need for new rules to regulate and facilitate the management of members who participate, [13] in fact, one of the most critical points to be addressed is the management of the economic benefits that may derive from self-consumption and energy sharing in energy communities. In this section the model adopted for the analysis is briefly introduced with a proposed solution.

General Model Characteristics and Structure
An EC system model, [14] based on open energy modelling framework (oemof ), [15] has been used to develop this work. This model performs the operational and the expansion capacity optimization of the system by minimizing the economic expenditures. In ref. [14] the objective function is expressed as in Equation (1) where OF EC ¼ objective function of the EC model; n ¼ index of node set N; u ¼ index of generation unit set U; t ¼ time-step index of set T; vc n,u,t ¼ variable costs of the generation unit u of node n at time t; E n,u,t ¼ electricity generation value of unit u of node n at time t; inv u ¼ capacity of investment variable u; epc u ¼ equivalent periodical cost of investment variable u. www.advancedsciencenews.com www.solar-rrl.com Figure 1 shows an illustrative EC developed through the oemof components, which allows the user to simulate generation sources (Source), loads (Sink), and storage systems (Generic Storage). Once the optimization has been carried out the outputs are: 1) the installed capacities (i.e., of photovoltaic and battery energy storage systems) and the energy flows, 2) the amount of electricity purchased or self-produced and shared or selfconsumed within the building, and 3) the overall economic benefit obtained both from the avoided electricity purchase and the refunded amounts for energy sharing.
The model associates a demand profile to the members and a production profile to each photovoltaic system. In this way, it is possible to study cases with all plants having the same conditions-by associating the same profile to each plant-and having different conditions-by associating different profiles. Both options are investigated in this work: the latter will assess how photovoltaic conditions have a relevant impact on the results of an EC.

Benefit Allocation
Although the importance of the distribution of the benefit in EC is highly recognized, there are very few researches that assess it in detail as refs. [2,3,6,7]. Moreover, at a regulation level, no pronouncement is provided, and it remains a query that must be established within each EC.
If the analysis is carried out without referring to the specific needs of one particular stakeholder (e.g., a utility), in generic terms, the optimal solution is the one that guarantees fairness, which is indeed an important and relevant performance measure in allocation schemes, but which is also very complex to evaluate. Moreover, the optimal solution depends on the involved participants, and this is not a unique solution. A key point is that being fair does not necessarily mean performing an equal distribution of the benefits. Sometimes, it is fair that a user is granted more benefits than another user, however, the most appropriate allocation metric is to be identified.
In this article, a distribution of the EC benefit can be considered fair when it reflects the contribution of each participant. The marginal contribution represents the participant added value to the community. A heuristic approach to allocate benefits, inspired by the Vickrey-Clarke-Groves (VCG) mechanism of auction theory, is proposed. [12] The aim is to optimize global contentment, namely, to maximize the total of the bids. The price a bidder needs to pay to secure an auction item is the difference in social welfare induced by his participation. For instance, a participant offering more than others causes disadvantage-or less social welfare-to the other participants due to his presence.
This mechanism is extremely popular in the algorithmic game theory since it separates two objectives: ensuring a good social welfare while preserving truthfulness. [16] Once the allocation (participants-items) maximizing the social welfare is computed, VCG pricing ensures that each participant is incentivized to declare his actual valuation.
Similarly to auctions, the difference in social welfare can be the key aspect to redistribute the payoff in energy communities. We will name this difference as "contribution." The rationale behind this selection is that in an EC system, where members make an unequal demand for resources and provide different services and production, the fairness may be based on the ratio of contribution of each member to the overall system. Each user marginal contribution to the community-considered in economic terms-is calculated as in Equation (2).
where i ¼ index used for the energy community members; MC i ¼ benefit marginal contribution of member i; optðECÞ ¼ savings of the EC (all members included); optðEC \ figÞ ¼ savings of the EC (member i excluded).
After finding all the contributions, it is possible to determine the benefit distribution vector, where the distribution among the users is weighted by their contribution as expressed in Equations (3) and (4).
where D cd,i ¼ contribution distribution percentage of member i; D cd ¼ EC contribution distribution vector; m tot ¼ total number of members in the EC. This method should ensure that the benefit percentage assigned to a user does not trigger discontent among other members, who would not have equally access to that amount without that member participation. According to the community composition, the distribution vector may also have null terms. We can have a null term if a member is not providing any benefit. Therefore, if he is not contributing there should be no reason to get anything, however, when applicable to the real case, in necessary cases the society could proceed according to other criteria and might still want to allocate something to this member (i.e., in energy poverty, where people are unable to access energy). The best and preferable scenario is the one in which all members increase the overall common benefit.

Business Models
The distribution of benefits based on the marginal contribution of each member is feasible from a computational point of view, although the calculation time increases with the number of users of the EC. Therefore, it also useful and effective to define simpler distribution methods not involving an optimization.
In this article, some possible criteria, hereafter called business models (BMs), are identified for dividing the benefit among users in a more intuitive way. The benefit refers to the amount of income that remains after accounting for all expenses, and costs. The main sample business models meet the following criteria for assigning the benefit among EC members: 1) homogeneous distribution-including the investments (BM A), 2) homogeneous distribution-excluding the investments (BM B), 3) distribution according to the loads (BM C), 4) distribution according to the number of people of each member-family (BM D), and 5) distribution according to the self-consumed quotapromoting the matching of demand and production (BM F).
These BMs are further defined in the appendix.
www.advancedsciencenews.com www.solar-rrl.com After having selected the BM, it is possible to determine the benefit distribution vector as in Equation (5). The business model distribution of each member can deviate from the optimal one. The deviation can be zero-the share returned to the member is perfectly in line with their contribution; the deviation can be negative and, therefore, the concerned user is receiving less than they should; the deviation can be positive and, therefore, the concerned user is receiving more than they should. Furthermore, it is possible-according to needs -identify and define additional BMs to those listed here.

Fairness Index
A measure of the suitability of the adopted BM should be provided with respect to the distribution previously introduced as fair, so as to identify among possible ones what distribution is more suitable to be implemented based on the EC. To determine the heterogeneity of the EC a Gini index is used, [17] which is an index of heterogeneity for qualitative variables described by Equation (6). It can vary between 0-if there is maximum homogeneity and all the frequencies are concentrated in a single modality-and 1-if the frequencies are equally distributed among all the modalities, where the frequency is the number of occurrences of a certain composition of the members.
where GI ¼ Gini Index; f ¼ frequency of the composition a certain member i. The fairness index (FI) is applicable to any EC regardless of the size and it returns a value between 0 and 1 if each individual member has a profit: the closer the value is to zero the fairer and the more suitable is the applied BM. If some participants do not get any benefit-that is, they have more expenses than benefits, according to the adopted BM-the distribution will have negative terms and the index will return the number of unhappy users. The integer represents the number of unhappy members. FI ¼ {1, 2, …, m tot }, where m tot is the number of the members.
The denominator of the FI involves the introduction of an additional benefit distribution called Dw (Equation (7)). This distribution is the furthest from the optimal one. For instance, it is the one that distributes all the benefit obtained to only one member, the one who is contributing the least and it maximizes the denominator of the FI. Therefore, the resulting value of the FI provides a measure of how much the chosen model is "closer" to the optimal case (value goes to zero) or, on the contrary, "closer" to the worst case (value goes to one). Equation (8) shows the FI of the global community.
where D w,i ¼ worse distribution percentage of member i; D w ¼ EC worse distribution vector; m¼ number of members for which D > 0.

Results and Discussion
The EC model and the methodology introduced to allocate the payoff have been applied to case studies. These case studies have been generated ad hoc to show the potential of the introduced model.
The electricity demand profiles of individual users have been obtained through the LoadProfileGenerator tool [18] and vary according to the composition of the household considered, for example, if it is a family with children, a family without children, a retiree and other additional categories (see Figure 2 for daily load profiles of the households).
Successively, known the average Italian consumption based on the number of users, these profiles were tailored to the Italian case.
The regulatory framework considered for calculations and the input data is the Italian one, starting from the adoption of the RED II directive, [1] up to the latest documents published by ARERA, [19,20] MiSE, [21] and GSE. [22] The variable costs taken into consideration in the model are therefore all the variable components of the bill applied to date by the Italian regulation, as well as the incentives or refunded quota and expense deductions (see Table 1). However, the input values can be readily changed to be suitable for different applications.
According to the Italian electricity bill, the "energy material charges" component includes the energy supply costs and the retail marketing costs. The other invoice components billed to the end customers and regarding the grid services are divided in transportation and meter management charges (distribution, metering, transport, transmission and distribution equalization, and quality) and system charges.
Moreover, the considered photovoltaic (PV) plants have the same normalized production pattern, it is considered therefore that the production plants have all the same conditions: orientation, inclination, place coordinates, climatic conditions, shading, and all other factors influencing the PV production. Table 2 shows the costs of PV and battery energy storage systems (BESS) which were given as input to the model to perform the optimization. Table 3 depicts the first case study involving six buildings and six equal users. It presents a first EC composed of 6 single-family housing buildings where all users are the same featuring a totally homogeneous EC (EC #1). Subsequently, not the EC configuration, but the user composition is modified, and therefore the www.advancedsciencenews.com www.solar-rrl.com users (EC #2, EC #3, EC #4) are gradually replaced so that Gini Index increases until the maximum heterogeneity is reached. We also provide the total demand of the entire community in all cases presented: the total demand changes when the users change, but not significantly (AE10% from the average).

Heterogeneity Impact on the Case Study Results
The first results related to the investment capacity optimization of the EC in the four proposed versions are presented in Table 4, while those regarding energy self-consumption and sharing in Figure 3.
The different graphs of Figure 3 make more comprehensible the heterogeneity or homogeneity of the EC systems. The results also show what happens with respect to investments. The following aspects can be pointed out: because of the similar demand, the installed capacity of PV does not change substantially (AE10% compared to the average); unlike PV, BESS installed capacity decreases by about 67% as heterogeneity increases; finally, it can be seen that even the savings in the bill are higher in the case with higher heterogeneity, rather than in the case with higher homogeneity, likewise the shared energy.
The results related to the fairest distribution, which is based on identifying the contribution of each participant are presented in Figure 4. The number of simulations carried out with the introduced allocation method is equal to m tot þ 1, namely 7, since the number of members mtot is 6. Otherwise, by applying the Shapley value there would have been 2^m tot , namely 64    www.advancedsciencenews.com www.solar-rrl.com simulations. This way the number of combinations simulated is reduced by 90%, with a high impact on the computational time.
As expected for the first case, no one contributes more to the welfare than the others. Thus, any distribution that provides an uniform sharing of the total benefit is suitable and fair. The solution complexity rises by increasing the heterogeneity of the system, where the application of a homogeneous distribution would be not fair for 5 users out of 6 already in the second graph where only a user is different from the others. This situation gets worse with the increase of the heterogeneity.
From a comparison of the BMs applied with the method based on the suggested contribution distribution, it emerges that a model is better than the others depending on the composition of the EC. In Figure 4, the deviation from the optimal distribution to that derived from the BM considered is presented for each user: negative deviations in purple; positive deviations in light blue. In case no deviation is shown, it means that the BM is working in the same way of the optimal distribution.
For each BM and case study introduced the FI increases with the standard deviation as reported Table 5. Hence, it is possible to have a more accurate evidence of BM suitability. Considering a case with high heterogeneity, it will not be recommended to adopt the BM A and then to distribute the benefit equally, in fact it is more likely that the user's contribution is more diversified.
In the presented case studies, it emerges that BM B and BM C are closer to the optimal case (see the lowest FI in Table 6). Despite this, by applying these two BMs, the user deviations from optimal varies as some users will still be more or less happy than others.
This aspect becomes even more evident when comparing BM D and BM E. When there is maximum homogeneity, the results do not change for the suggested BMs. This is no longer valid when increasing heterogeneity.
For the case with Gini ¼ 0.33, when the BM D is adopted, the result is adequate, whereas BM E does not perform well in terms of fairness. For the other cases (GI ¼ 0.8 and GI ¼ 1.0), both models BM D and BM E are equally less effective in terms of fairness than the others except for BM A. Table 7 show the impact of PV production in homogeneous EC (Gini Index equal to 0). The model allows us to simulate different PV conditions, by assigning to the PV plants different normalized production profiles, while their nominal capacity will be determined again with the optimization. Data regarding these scenarios are reported in Table 5. www.advancedsciencenews.com www.solar-rrl.com Table 6 shows how the different hourly production of the PVs adds further benefits by enhancing the self-consumption (32% increase) and exploiting the energy-sharing, which is not present otherwise in an EC with GI ¼ 0. The results show an increase in PV and BESS installed, respectively of 17% and 133% and also of the bill saving of 44%. Each user contribution instead of being equal to 16.7% can vary between 14% and 20% as visible in Figure 6 and this aspect depends on the power plant conditions.  The lowest FI value.

Conclusion
The purpose of this work was to develop a heuristic to address the payoff distribution problem of ECs. This developed approach is added to those already existent, but it reduces the computational time problems, which, for instance, occur with the aforementioned Shapley value. Moreover, this approach pays particular attention to the concept of fairness. Once a model is used to evaluate the optimal expansion capacity and flows of the energy community, the payoff distribution among its members must be evaluated.
The optimal distribution definition is based on the following concept: each member should receive a welfare amount that reflects their contribution to the EC. To evaluate the contribution of each user, the composition of the community itself has been taken into account. The composition is the first factor that determines not only the result of the optimization, but also how the contribution of the users changes. It has been proved, in fact, that similar users contribute equally to the community, but that their total effective contribution is lower than when the composition is more heterogeneous. In the case study presented, where the global demand and the installed capacity of photovoltaics are the same and we pass from a lower heterogeneity (GI ¼ 0.33) to a higher one (GI ¼ 1), the need for flexibility provided by the BESS is reduced by 67% and the benefit increases by 14%. These data demonstrate that by changing the users, each of them gives a different contribution which has to be taken into account. In the case presented, with maximum heterogeneity we have users whose presence contributes to increase the overall benefit from 10% to 97%.
It has emerged that it is more difficult to evaluate the contribution of each user as the variability of users included in an EC increases, and consequently to define when the distribution is fair, and reflects the different added value of each user. The fairness index measures precisely this aspect and aims at understanding how not to disadvantage anyone, since the participation is free and voluntary.
The results show that if all users are equal, no one contributes more to the welfare than the others and any payoff uniform distribution is fair. This is no longer verified when the EC heterogeneity increases. Depending on the composition of the EC, a model will be more or less suitable.
The adoption of BM A-which is based on a homogeneous distribution of payoff and investments-will not be recommended for a high heterogeneity EC because it is more likely that the users contribution is more diversified. In this case, the highest calculated FI is obtained (FI ¼ 0.200).
For the case with Gini ¼ 0.33, BM C-based on member loads-should be adopted, since it is the case in which the lowest FI is obtained (FI ¼ 0.0006). The same choice should be made if GI ¼ 0.8 even if the FI is higher (FI ¼ 0.025). By further increasing the heterogeneity to GI ¼ 1.0, the choice should fall on BM B which is based on a homogeneous distribution of the payoff (FI ¼ 0.026).
It was also shown how the contribution of individual users and the overall benefit depend not only on the demand profiles of the users themselves, but also on the conditions, and therefore on the production schedules, of the PV systems. This contributes to increasing the heterogeneity of the overall system and to bringing additional benefits and, for instance, also to exploiting the possibility of sharing energy, which otherwise would not be possible: in the example provided, we go from not making energy-sharing to covering about 4% of the total demand thanks to shared energy.
For simplicity, we have shown only single-family housing buildings, but it is certainly possible to carry out the same analysis by using the described tool while also considering multifamily housing buildings.
3) BM C: Distribution according to the loads (see Equation (11)) 4) BM D: Distribution according to the number of people of each member-family (see Equation (12)) 5) BM E: Distribution according to the self-consumed quotapromoting the matching of demand and production (see Equation (13)) where L i ¼ electric demand of member i; dim i ¼ number of people who make up the member-family i; sc i ¼ electric selfconsumption of member i.