Local Production and Storage in Positive Energy Districts: The Energy Sharing Perspective

In response to the Positive Energy District transition, this paper proposes an energy tool for the modeling of energy sharing configurations among buildings equipped with energy production systems and distributive storages. The model is targeted for urban planners and energy policymakers and gives insights into the role of buildings in fostering the achievement of net-zero energy balances in districts when virtual or physical peer-to-peer configurations are established in the area. A real urban district is considered as a case study and the energy performances are measured against properly defined Key Performance Indicators. Results confirm the strategic role played by energy sharing among buildings in achieving self-sufficient and carbon-neutral areas. In particular, the insertion of storages allows not only for higher self-sufficiency of the area (by facilitating the coupling of production and demand) but also for higher distribution rates among buildings. However, photovoltaic insertion and storages should be appropriately balanced since it has been observed that at increasing the number of production and storage systems, the distribution is reduced in favor of autonomy, thus limiting the usefulness of an interconnected local distribution grid.


INTRODUCTION
Built-up areas are responsible for a high level of energy consumption and consequent carbon emissions (United Nations Framework Convention on Climate Change, 2015). The integration of renewable energy production systems at the urban scale has proven to be a significant solution to target the EU's strategic objectives in terms of both energy efficiency and emissions reduction. In this sense, urban communities play a pivotal role in fostering the transition toward sustainability and climate neutrality. Beyond the widely acknowledged advantages of energy efficiency and carbon-neutrality, renewable sources have changed the way urban areas have been so far conceived. Indeed, the insertion of renewables implied, de facto, the rising of decentralized distribution configurations among buildings, able now to produce, self-consume, and distribute energy within their neighborhood (Parag and Sovacool, 2016). This emergent feature of the building sector paves the way for inclusive urbanization, in which the citizen's role of shaping sustainable and autonomous districts can no longer be neglected (Fichera et al., 2016a). Recently, the Strategic Energy Technology (SET) Plan, Action 3.2, stressed the need for planning the diffusion of Positive Energy Districts (PEDs), i.e., urban agglomerates with annual net-zero energy imports and net-zero emissions (European Commission, 2018). Among the peculiar characteristics of PEDs, "interaction and integration between buildings, " as well as "an integrative approach including technology, spatial, [. . . ] perspectives" are considered as fundamental pillars for strategic energy planning (European Commission, 2018). Therefore, the modeling of energy sharing among buildings, including physical or virtual distribution, peerto-peer topologies, and infrastructure, is crucial to achieving a fruitful transition toward PEDs. Under these premises, any long-term urban energy strategy should build upon integrated energy models coupling local production, local distribution among buildings and local distributive energy storage as key interlinked characteristics for the achievement of sustainable urban energetic configurations.
Up to now, many studies and regulations have proposed energy modeling tools and energy efficiency measures targeted to the built environment and focusing on the building scale (Directive 2010/31/EU, 2010; Directive 2012/27/EU, 2012). Magrini et al. (2020) discussed the most recent European directives concerning a building chosen as a reference case for energy-independent urban areas. On the premises that newly built edifices should be nearly-zero energy buildings (Cellura et al., 2017) and that energy planning decisions should refer to the district level, Sougkakis et al. (2020) compared energy performances of new and retrofitted buildings of a Greek neighborhood highlighting the best combination in terms of installed technologies and financial incentives. Keiner et al. (2019) investigated several energy scenarios for the optimal covering of electrical, thermal, and mobility demands for the residential sector. Other studies enlarged the buildingbased perspective to comprehend residential blocks of up to 25 buildings. Among these, Dorneanu et al. (2019) proposed a mixed-integer linear programming model to optimize the design and operation of energy distribution systems integrated with heating/cooling networks and connected to the main grid. Soutullo et al. (2020) mapped the existing European living laboratories and pursued a statistical analysis to develop guidelines orienting the evaluation of suitable and energyefficient urban configurations. An interesting application of energy flexibility at the building scale is represented by the review of Al Dakheel et al. (2020), who set guidelines for the implementation of retrofit measures in existing buildings.
Among the unquestionable merits of these studies, they contributed to the increased awareness of the need to develop energy actions focused on the specific features and characteristics of buildings, as well as on the use of renewable-based technologies for the net-zero target (Cellura et al., 2011). Nevertheless, despite highly detailed, some of these tools cannot be easily scaled to the district level due to the computational intensity that would inevitably derive from extending these features to a significant number of households. This is even more relevant if the chance for buildings to share the own produced energy is added to the analysis; in these cases the possible energy interactions that should be considered for proper modeling would exponentially increase at increasing the number of buildings. Therefore, the traditional building-based perspective needs to be enlarged to reach the district level (Fichera et al., 2016b;Eicker, 2019;Bossi et al., 2020). In this direction, Ali et al. (2018) proposed a GIS-based tool to inform urban planners for the definition of energy strategies aiming at reducing both energy consumption and emissions. For the optimal design of energy systems, Jing et al. (2019) proposed a hierarchical methodology constituted of an optimization model and a clustering technique.
As said, the diffusion of renewable sources within urban areas enhanced the autonomy of the built-up areas. However, to improve the competitiveness and the advantages deriving from self-produced energy, the mismatch between production and consumption needs to be solved. A solution in this sense consists of coupling energy storage to district energy systems (Thomsen and Overbye, 2016). Near-optimal and real-time operation of buildings with installed renewable systems and batteries can be achieved by implementing a non-linear programming model to obtain positive energy balances (Cortès et al., 2020), by optimal pricing strategies for economic viability in electricity markets (Lin and Wu, 2017), or by considering the optimal positing of storage within the grid (Korjani et al., 2018). On this topic, Sameti and Haghighat (2018) proposed a mixed-integer linear programming model for the optimal design of distributed thermal and electrical energy storage with an application for a district of seven residential buildings.
Overall, the aforementioned literature recognizes the important impact of storage in urban areas. Nonetheless, the insertion of renewable energy production systems coupled to storage still needs to be deepened from the distribution perspective. Indeed, the distributive behavior of storages is usually considered at the sole micro-grid level (Liu et al., 2019) and the debate on the role that buildings can play in energy sharing is still open to discussion.
To this aim, this work aims at contributing to the existing state-of-art by measuring to what extent energy distribution among buildings can represent a key characteristic in shaping positive energy districts. In this direction, an integrated tool is here proposed to model spatial, energetic, and technological features of future PEDs with particular attention to sharing configurations arising from energy distribution among buildings. The developed methodology is intended for urban planners and decision-makers, being it able to offer a comprehensive evaluation of urban districts in which energy sharing mechanisms are planned to be introduced. Going into the details, simulations run under the methodological framework of the agent-based theory, successfully implemented in literature for modeling interactions among parts, at both the building (Sun et al., 2018) and district-scale (Fichera et al., 2018). The output of the energy simulations is discussed against Key Performance Indicators (KPIs), useful metrics if aiming at evaluating the energy performances of buildings  and PEDs (Clemente et al., 2019). In particular, in this study, KPIs are formulated about the impact of local energy sharing on the achievement of a positive energy balance for the area.
That said, the novelties of this paper can be summarized as: -Assessment of local energy sharing as a key feature for PEDs development; -Coupling of local production and local distributive energy storage at the district level; -Definition of an agent-based model able to highlight the high granularity of energy flows among interacting buildings; -Definition of focused KPIs measuring to what extent local distribution may affect the energy performances of PEDs and formulated to be replicable for comparison among other studies.
The following of this paper is organized as follows: section "Methodology" presents the proposed methodological approach, section "District Modeling" describes the district chosen as a case study and section "Discussion" discusses the results. Conclusions on the main implications deriving from the output of the proposed methodology are reported in section "Conclusions".

METHODOLOGY
The proposed methodology aims at supporting urban planners and energy policymakers toward the definition of proper action plans targeted for PEDs with enabled energy sharing among buildings equipped with local energy production systems and energy storage. The modeling procedure relies on the following main pillars: -On-site energy production from renewables; -Energy storages to account for the mismatch between production and consumption; -Sharing distance among connected buildings within the spatial boundary.
The adopted methodological path is reported in Figure 1, where three main divisions can be identified: the input data section, the simulation toolbox, and the output section.

Input Data
The input section collects data focusing on the spatial, energetic, and technological aspects. The first module implements the modeling boundaries of the chosen urban district, featured within the GIS environment. Geo-referenced building-specific information such as location, construction data, rooftop area, orientation, and shading factors, is determined. In addition, the maximum distance along which buildings share energy has to be decided to balance energy flows exchanged within the districts and between each building and the main grid. It is worth noting that the required specifications for spatial input data may vary for the chosen technology. In this paper, an application with PV panels coupled to EESs is studied, being PV a leading technology due to its scalability, fast installation, and low maintenance and due to the presence of incentives that favor its diffusion in buildings (Lovati et al., 2020). To the scope, specifications on rooftops' area and typology (span/flat roof), inclination, orientation, and shading are included as input data for the simulation tool.
Case-by-case, urban planners may decide to include other relevant aspects, for example, surface and occupied volume, number of inhabitants, buildings' age, wall stratigraphy, and building function, depending on the simulation needs.
The second step consists of the definition of electrical and thermal consumption profiles for each building, taking also into account the information deriving from the spatial module. Electrical and thermal profiles are available on a daily basis for each household. Then, hourly profiles have been calculated matching the available data with the typical electrical consumption per person derived from the Italian Regulatory Authority for Energy (2020), and electrical profiles from the study of Capozzoli et al. (2016), considered as general and replicable for the Mediterranean basin. In this paper, the sole electrical profile is included in the simulation, being electrical energy suitable for the bidirectional peer-topeer mechanism.
The third module gives detail on both the installed energy production technology and the energy storage systems. In this study, PV panels are coupled with electrical energy storage (EES) to account for the fluctuations between production and demand. EESs operate in a distribution mode, i.e., stored electricity can be distributed to neighboring buildings. Input data for this section are power sizes, determined by matching data from the spatial module (rooftop available area, typology, orientation, inclination, and so on) and data from the energy module (electrical and, if modeled, thermal loads). Electrical production profiles at varying the installed PV sizes are calculated for the site solar irradiance. Data on specific PV power output, direction normal irradiation, global and diffuse horizontal irradiations, and optimum tilt of the modules and hourly profiles for each month are extracted from the Global Solar Atlas (2021) for the geographical coordinates of the area deriving from the GIS-based information included in the spatial module. Data on EESs are included in terms of storage technology, storage capacity, inverter power and size, state of charge, and depth of discharge. As suggested by Huld (2011), good results on the overall performances between PV panels and EES can be achieved by assuming a conversion ratio of 65% to include any system losses (cables, DC/AC converter, charging and discharging, shadows, and dust on the modules).

Model
The simulation tool is developed within the theoretical framework of agent-based models, which have proven to be particularly suitable to solve problems characterized by a significant amount of interactions among the constituting parts (Khan et al., 2019), as in the case of districts with enabled energy distribution among buildings (Fichera et al., 2020). Agents represent interacting buildings aiming at both fulfilling their demands and achieving a positive energy balance at the district level. Interactions among buildings depend on a spatial-energetic constraint built upon their relative geographical location and their energy balance. Going into the detail of the spatial issue, the stakeholder (urban planner, policy-maker) has to define the geographical distance d along which energy distribution is enabled. All feasible connections respecting the selected spatial distance are collected under the spatial The matrix reports which buildings from the set i = 1, 2, . . . , i, . . . , N are connected on the ground of the chosen distance. Data are reported in a binary form, being a ij the x connection between building i with spatial position x i , y i and building j with spatial position x j , y j in the space of matrix M: It is worth noting that the diagonal of the matrix contains 0, having connections i − i no sense from the distribution perspective. The matrix represents the mathematical representation of the initial energy distribution scheme, from which energy balances will be calculated.
Referring to the energy aspect, energy balances between production and demand and balances at the EESs are calculated as: The energy balance at each time t for each building i can be either positive or negative. A positive balance indicates that the production has covered the demand of the building and that residual energy can be either stored or shared among connected buildings. In this model, distribution has priority over storage and, in addition, the stored energy can be distributed to connected buildings if necessary. A negative balance indicates that the building's demand still needs to be covered: to this aim, energy may be supplied from other buildings with positive production balance or those with positive storage balance or, as the last option, from the main grid. Electrical energy in EESs is stored at time t − 1 and is distributed at time t. The balance at the EESs is obtained by considering the residual amount of produced energy after the distribution within the district. The stored electrical energy needs to respect a maximum and minimum storage level, due to the physical and technological characteristics of the chosen battery. Therefore, the following constraint: lower limit ≤ en stored(i,t−1) + en stored(it) ≤ upper limit Therefore, considering the introduced spatial matrix and the energy balances, distribution occurs if buildings are connected and respecting the energy flow direction from buildings with a positive balance to buildings with a negative balance. In addition, the energy sharing among buildings respects a priority criterion for which the produced (and stored) energy satisfies the energy need of the building owning the equipment, then the eventual excess is distributed to other requiring buildings and, if further energy is available it can be again stored (if possible) and finally released to the main grid. According to this criterion, buildings cannot receive energy if their energy balance is already positive to avoid utilitarian and profit-oriented behaviors at the expense of the district's needs.

Key Performance Indicators
Properly defined Key Performance Indicators describing energy distribution among buildings are derived from the output data section. The performances of the modeled district are measured against three indicators. The first evaluates to what extent buildings share energy along the (physical or virtual) enabled connections built in the matrix M. In particular, it compares the number of connections used for the distribution in a 24 h horizon for the number of connections established in the matrix M: The total useful connections Sp conn in Equation (6) gives important insights on the spatial distance considered for the energy sharing balance among buildings since it calculates the percentage of connections effectively used for the exchange with respect to the initial allowed configuration. This indicator varies within the interval [0, 1], being Sp conn = 0 indicative of a disconnected district and Sp conn = 1 suggesting that all feasible connections (depending on the distance chosen by the energy planner) are effectively exploited.
The amount of energy distributed within the district as part of the production is measured referring to the KPI reported in the following: The distributed energy En district returns the rate of energy production shared among buildings and net of the rate used for self-consumption. The lower limit of this indicator, the distributed energy En district = 0, indicates the case for which buildings do not exchange energy, either because they are not connected or because the produced energy has been used to cover the energy demand of installers.
Hourly energy balances at the district level are finally displayed to verify if the area is eligible for the transition toward the PED configuration.

District Modeling
The modeled district is located in Catania, Sicily, and counts 108 buildings, represented in Figure 2. Buildings are heterogeneous in terms of use, including residential households, a few singlehouses, offices, and commercial edifices, distributed as in Figure 3. For each building, the roof surface and typology, volume, number of floors, surface exposition are known and used for the simulation. The overall available surface for PV installation is around 11,095 m 2 . On average, residential buildings have 3-4 floors. For residential buildings, the number of inhabitants has also been evaluated to eventually calibrate the hourly electrical consumption.
Detailed information about the electrical consumption profile of each building has been made available thanks to a dedicated mapping campaign. The electrical production profile of the installed PV panels is calculated by coupling the available data on rooftop areas and typologies for each building (spatial data from module 1) to the direct normal irradiation per square meter extracted from Global Solar Atlas (2021). The hourly electrical profile of the area for a typical summer day and the direct normal irradiation are reported in Figure 4.
Concerning the storage technology, lithium-ion batteries have been selected in this study for their diffusion at the building scale (Speidel and Braeunl, 2016). Technological and operational characteristics of batteries have been derived from the current literature (Shen et al., 2017;Hoang and Lee, 2018) as summarized in Table 1.
The storage capacity measures the amount of electricity that can be stored in the battery. State of Charge (SoC) and Depth of Discharge (DoD) are two operational parameters affecting the functioning of the battery. In particular, SoC measures the amount of electricity stored in the battery with respect to its capacity. DoD measures the usable storage capacity, i.e., rate of usable energy at a given time t with respect to the total capacity of the battery. Both are given as percentages, being defined as ratios between capacities.
Two modeling scenarios are discussed, each of them characterized by different percentages of PV diffusion in the territory. In detail, scenarios differ concerning the percentage of rooftops' area covered by PV panels. It is worth pointing that PV panels are randomly inserted in buildings and that the insertion respects the spatial constraints derived from the spatial input data section. Each scenario is then modeled with and without EESs to assess if EESs have a beneficial impact on both the distribution and the positive energy balance at the district level. A summary of the two scenarios, labeled as #Sc1 and #Sc2 and distinguished for the presence or not of EES, is reported in Table 2.
Finally, simulations run in NetLogo (Wilensky, 1999) for a 24 h cycle and respecting an energy priority rule regulating the energy distribution mechanisms within the district. Assuming that the spatial-energy criterion is satisfied, buildings are allowed to share the produced energy if the following conditions take place: -Energy flows can be shared following the direction from a building with positive energy balance to a building with negative energy balance; -Energy production is first used to satisfy the own energy needs; -Exceeding production is firstly distributed and then stored; -Eventual exceeding production (that can not be further stored or distributed) is sent to the main grid and, conversely, buildings with residual demand are supplied from the main grid.

DISCUSSION
Results are discussed against the KPIs introduced in subsection Key Performance Indicators. As previously introduced, the achievement of a positive energy balance within a district cannot neglect the evaluation of the energy sharing impact. This aspect can be measured from different perspectives and under several scenarios, In this study, the district energy performances and the sharing impact are analyzed at varying the installed energy production on the territory and including or not EESs, as summarized in Table 2.
The values of the useful connections exploited among buildings, Sp conn , are reported in Table 3 at varying the distance at which distribution may occur and for the identified scenarios.   As a remark, the useful connections Sp conn indicator evaluates the rate of connections used for energy sharing with respect to the number of initial connections established on the ground of the allowed distance d. The first initial consideration arising from the graph regards the impact of distributive storages in terms of exchanged energy flows. In particular, when EES is not included in the simulation, the rate of connected buildings decreases and, consequently, energy distribution decreases as well. This  is more evident at increasing the distance of connection, being higher distances bearer of higher sharing connections (virtual or physical, as specified). Precisely, this gap increases correspondently for each partial increase in the spatial distance among buildings. Otherwise, a general improvement regarding the sharing performances of the district can be noticed if EESs are coupled to PV panels, independently of the size of installed PV systems. This can be explained by the fact that even if energy production increases, the energy storage capacity of batteries remains unchanged, thus yielding no significant differences between the two scenarios. In addition, for buildings equipped with PV and EES systems, the impact of the distance is less significant, i.e., available energy connections have a good exploitation rate even among buildings in close spatial proximity. Overall, distances around 100 m permit to have a more connected district, and energy sharing among buildings is significant, with percentages around 80% of total and feasible connections crossed by energy flows during the day.
Moving forward, the distributed energy En district indicator is now analyzed. Results are reported in Figure 5 at varying the distance of connection among buildings and for the two scenarios introduced in Table 2.
Again, the inclusion of EESs meaningfully affects the amount of energy distributed among buildings, yielding a higher share of energy distributed within the district. This consideration is valid independently from the modeled distance and scenario. Thus, the impact of EESs to reach any self-sufficient and autonomous targets for urban areas is significant not only from the spatial connection perspective (as reported in Table 3) but also considering the effective amount of energy production shared among buildings. As can be observed from Figure 5, indeed, an increase of circa 10-15% of total distributed energy is achieved within the territory, corresponding to higher participation of buildings in the energy sharing mechanisms and improving the energy efficiency of the area.
Surprisingly, the rate of energy shared among buildings is higher for #Sc1, i.e., for the scenario characterized by a lower energy production capacity. This can be explained by considering that, consistently with the results reported in Table 3 for fixed energy production, #Sc1 ensures for a more connected district, being the majority of established connections among building effectively crossed by energy flows; therefore, a higher amount of energy is distributed within the district.
Finally, the hourly electricity balances at the district level are shown in Figures 6, 7 for both scenarios. Considering both Figures, it emerges how the chosen area can be effectively candidates for planning the transition toward the PED configuration. A significant excess of electricity production can be recorded both in #Sc1 and #Sc2, despite the self-consumption and the distribution among buildings. This electricity excess can be exploited to balance nightly consumption and, generally, to fulfill any electrical demand not covered from the PV production. In addition, being the excess particularly significant, strategic planning can include the insertion of electric vehicles to the electricity needs of the area (Inturri et al., 2017).
Going into the detail of both Figures 6, 7, the significant impact of distributed storages within the area can be again recognized. As can be seen, EESs are beneficial to increase both the rate of self-sufficiency and energy sharing among buildings by passing the main grid and thus contributing toward the hourly net-zero balance, as recommended by the Directive (European Commission, 2018).
The decrease of the electricity supply from the main grid is much more evident in #Sc2 due to the higher diffusion of PV panels (and, therefore, higher production). Coherently, being higher the electricity production capacity of the area, the electricity excess is more significant than in #Sc1. In this scenario, the role of distributive EESs is less evident being more buildings able to reach self-sufficiency without requesting electricity from either the neighborhood or the main grid. Finally, it is worth pointing that, despite the insertion of PVs and EESs, a residual amount of electricity is still requested to the main grid: this is due to the fact that both Figures record the electricity balances of the area separately, and that amount of electricity from the main grid is going to balance the buildings' electricity demands not covered by PV production or by district sharing.

CONCLUSIONS
In this study, a model for the carbon-neutral and sustainable energy transition toward PEDs is proposed and targeted for the definition of strategic urban planning. Taking inspiration from the existing literature on the field of energy modeling and bearing in mind the guidelines of the SET-Plan Action 3.2, the proposed methodology includes the energy sharing among buildings and the presence of local storage as characterizing features of urban energy modeling. Spatial, energy, and technological input data are used to simulate energy exchange among buildings. Results are discussed against properly defined KPIs highlighting the spatial connection and energy distribution rates within the areas, as well as by measuring the hourly energy balance in the area. The developed simulation tool can be used for any district, being each step of the proposed methodology replicable at varying the input data.
The model has been tested in a district in South Italy and simulating the insertion of PV panels and Lithium-Ion batteries (the most diffused and scalable technological choice at the building level). Two main energy production scenarios are then simulated to account for different rates of PV penetration in the area and including or not electrical storage systems.
In particular, if considering the topological configuration of the distribution among buildings, it is worth noting that the insertion of EESs coupled to PV systems can be considered as beneficial to stress the decentralization of energy distribution and, consequently, the autonomy of the area. Into the details, allowed distance around 100 m can achieve a widely connected district. If evaluating the electricity flows exchanged into the area, again, EESs can guarantee higher rates of energy distribution among virtual or physically connected buildings, with an impact of circa 10-15% compared to the sole production scenario (without EESs). In addition, posing attention to the PED balance of the area, it can be effectively argued that there is the chance for the neighborhood to be designed as an eligible candidate for PED transition, being exceeding production sensitively higher than the overall demand. Careful scenarios' analyses can be dedicated to evaluating how to exploit the electricity excess. Strategic solutions in this sense could be directed to promote sustainable mobility for the considered area or to match nightly demand with diurnal production from PV systems.
From a broader perspective, results confirm the strategic role of connected and sharing buildings toward the net-zero or positive energy district configuration. In this direction, any urban action plan focusing on the definition of strategic measures favoring the insertion of renewable-based production systems coupled to energy storages should take the impact of energy distribution among buildings as crucial to increasing energy efficiency, carbon neutrality, and competitiveness of the area.
Further research should be focused on assessing the economic and environmental impact of buildings' sharing decisions on the area, as well as on the definition of the optimal energy production systems position for fostering energy exchanges.

DATA AVAILABILITY STATEMENT
The original contributions presented in the study are included in the article/supplementary material, further inquiries can be directed to the corresponding author/s.

AUTHOR CONTRIBUTIONS
All authors listed have made a substantial, direct and intellectual contribution to the work, and approved it for publication.

FUNDING
This research has been funded by the European Union and the Italian Ministry of Education, University and Research, under the project AIM-Attrazione e Mobilità Internazionale, in attuazione dell'Azione I.2 Mobilità dei Ricercatori dell'Asse I del PON R&I 2014-2020-Linea di Intervento 1, AIM1889410.