How to Achieve Positive Energy Districts for Sustainable Cities: A Proposed Calculation Methodology

In this paper, a methodology for calculating the energy balance at the district level and energy performance of those districts aspiring to become a Positive Energy District (PED) is proposed. PEDs are understood as districts that achieve a positive energy balance on an annual basis by means of exporting more energy than is consumed within their limits. The main issue to standardize the concept, besides which characteristics should be considered, is that current standards to calculate an energy balance are not applied at the district level. This paper reviews the current standards and adapts them to propose an energy balance calculation methodology. Calculation of an energy balance at the district level is complex since it includes several parameters, such as which loads (or elements) should be included, which renewable energy technologies should be considered on-site production, and which primary energy factors should be used. The proposed methodology is thought to help cities at the design stage of a district and to evaluate its annual energy balance. The methodology is performed in eight steps, and all the needed assumptions that affect the calculation of the annual energy balance are discussed in each step.


Introduction to Positive Energy Districts
Buildings account for 40% of total energy consumption in the European Union (EU) [1] and 35% of greenhouse gas emissions (GHG) derived from energy uses [2]. Thus, cities are essential actors in fighting climate change, and have a high potential of reducing the world's global emissions [3], hence contributing to meeting COP21 targets. Furthermore, cities have the commitment to enhancing inclusive, safe, resilient, and sustainable urbanization [4]. Two main actions to achieve the transition towards more sustainable and climate neutral cities are building renovations and the installation of distributed renewable energy technologies within city limits [5]. In the EU, more than 220 million buildings were built before 2001, with generally poor energy performance, and of which only 0.2% perform deep renovations every year. This means that there is a huge potential for reducing energy consumption in the building stock. Regulations and building codes have evolved and continue evolving towards more efficient or nearly zero energy buildings, with EU Directives 2010/31/EU and 2018/844/UE as clear examples of strong commitment to the improvement of the energy efficiency of the building stock. A review of the main actions of the European Union towards the development of the nearly zero energy building was presented in [6]. Since 2018, the Positive Energy District concept (PED) has been introduced to the discussion about the energy transition of the building stock, acknowledging that districts can play a major role in this transition, as they tackle a larger scale of projects, 9]. PEDs and Positive Energy Neighborhoods (PENs) are now seen as strategic keys for decarbonizing the built environment in Europe [2], according to the recently published Renovation Wave Strategy.
Since usual practice in urban planning has frequently considered energy performance of buildings individually, irrespective of the surrounding buildings, PED breaks this habit by applying integrated strategies for building renovation, energy efficiency, and local energy production from renewable energy sources (RES) in a locally interconnected and holistic way [10].
The key concept of PED is that of a district that produces more energy from RES than what is needed to fulfil the district's demand, being able to export this energy surplus to another part of the city. Existing PED definitions such as the Joint Programming Initiative (JPI) Urban Europe include other characteristics in the PED definition, addressing that PED should be an "added value to the user" or achieve an "affordable and high-quality living standard" [11]. Figure 1 shows a summary of the concept and the different characteristics found in the literature (discussions from JPI Urban Europe [11], European Energy Research Alliance (EERA) [12], and International Energy Agency Annex 83 on PEDs [13], among others). The EU Horizon 2020 called for innovation actions in the field of Smart Cities and Communities [14]. The aim was to apply the concept of PED as a demonstration in "lighthouse" cities that could guide the replication to other fellow cities. Currently there are six EU-funded projects aiming at demonstrating the PED concept in at least 12 lighthouse cities, which will be more if fellow cities replicate the concept. The Strategic Energy Technology Plan (SET Plan), inside Action 3.2, also promoted the challenge to have 100 PEDs throughout the EU by 2025 [15]. Besides H2020 projects, the PED concept was also implemented by a few cities, and examples of PEDs in operation can be found in places such as the Feluriaye West district in France and Smart Energy Å land in Finland [1].
The PED concept can also be related to the "Citizen Energy Community" (CEC) defined by the EU Internal Electricity Market Directive (IEMD), or the "Renewable Energy Community" (REC) found in the EU Renewable Energy Directive (REDII). Whereas RECs and CECs are more related to organizational structures and managing energy generation, PEDs do not need to be a legal entity, and can in principle adopt any form of organization and management to achieve the objective of a positive energy balance. This paper proposes a methodology for calculating the energy balance at the district level, which can serve as a preliminary energy performance evaluation for districts aspiring to achieve the goal of becoming a Positive Energy District (PED). The methodology aims to support the various processes, projects, and initiatives previously described that are promoting the implementation of PEDs. The EU Horizon 2020 called for innovation actions in the field of Smart Cities and Communities [14]. The aim was to apply the concept of PED as a demonstration in "lighthouse" cities that could guide the replication to other fellow cities. Currently there are six EU-funded projects aiming at demonstrating the PED concept in at least 12 lighthouse cities, which will be more if fellow cities replicate the concept. The Strategic Energy Technology Plan (SET Plan), inside Action 3.2, also promoted the challenge to have 100 PEDs throughout the EU by 2025 [15]. Besides H2020 projects, the PED concept was also implemented by a few cities, and examples of PEDs in operation can be found in places such as the Feluriaye West district in France and Smart Energy Åland in Finland [1].
The PED concept can also be related to the "Citizen Energy Community" (CEC) defined by the EU Internal Electricity Market Directive (IEMD), or the "Renewable Energy Community" (REC) found in the EU Renewable Energy Directive (REDII). Whereas RECs and CECs are more related to organizational structures and managing energy generation, PEDs do not need to be a legal entity, and can in principle adopt any form of organization and management to achieve the objective of a positive energy balance. This paper proposes a methodology for calculating the energy balance at the district level, which can serve as a preliminary energy performance evaluation for districts aspiring to achieve the goal of becoming a Positive Energy District (PED). The methodology aims to support the various processes, projects, and initiatives previously described that are promoting the implementation of PEDs.
The main issue to standardize the concept, besides which characteristics should be considered, is that the current standards to calculate an energy balance are not applied at the district level. This paper reviews the current standards and adapts them to propose an energy balance calculation methodology. The main novelty aspects provided in the present paper are based on the scarce of information and research leading to show a common framework to design and evaluate a PED. The complexity of calculating the energy balance at the district level is because it includes several parameters, or elements (loads, renewable energy technologies, non-renewable energy technologies, etc.), and assumptions (primary energy factors, efficiencies, etc.) affecting the calculation of the positive energy balance as well as the design of the PED.
Taking current standards at the building level as a basis for the calculation framework, Section 2 presents the proposed methodology and most relevant methodological choices for the calculation of the energy balance, which are related to the definition of the boundaries of the district (Section 2.1), calculation of the energy needs (Section 2.2), and chosen primary energy factors (Section 2.6). Section 3 discusses the shortcomings of the presented methodology. Section 4 presents the conclusions derived from the presented work, highlighting its potential value as a framework for further development of standardized methods for district energy balances.

The PED Calculation Methodology
To have a PED, it is necessary to achieve an annual positive primary energy balance, i.e., more energy is produced than what is consumed within the district boundaries. The methodology presented was developed within the MAKING-CITY project [16], and follows a series of steps (see Figure 2). Following the approach of the CEN/TR 15615 and ISO 52000 standards, the calculation direction is the opposite of the energy flow in the system [17], starting with the calculation of the energy needs (step 2) within the PED boundaries (defined in step 1) to a series of iterative steps that finish calculating the equivalent primary energy (step 6), the primary energy balance (step 7), and the associated Sankey diagram (step 8). When designing a PED, it is recommended to go back and forth in order to test different technology options until all the needs are covered and the positive energy balance is achieved. At the operational phase of the district, the evaluation of the energy balance can start at step 4, measuring the on-site RES production and the final energy delivered (i.e., electricity or gas consumption) to calculate the balance. In step 6, the assumptions made when setting the primary energy factors should be stated.
The main issue to standardize the concept, besides which characteristics should be considered, is that the current standards to calculate an energy balance are not applied at the district level. This paper reviews the current standards and adapts them to propose an energy balance calculation methodology. The main novelty aspects provided in the present paper are based on the scarce of information and research leading to show a common framework to design and evaluate a PED. The complexity of calculating the energy balance at the district level is because it includes several parameters, or elements (loads, renewable energy technologies, non-renewable energy technologies, etc.), and assumptions (primary energy factors, efficiencies, etc.) affecting the calculation of the positive energy balance as well as the design of the PED.
Taking current standards at the building level as a basis for the calculation framework, Section 2 presents the proposed methodology and most relevant methodological choices for the calculation of the energy balance, which are related to the definition of the boundaries of the district (Section 2.1), calculation of the energy needs (Section 2.2), and chosen primary energy factors (Section 2.6). Section 3 discusses the shortcomings of the presented methodology. Section 4 presents the conclusions derived from the presented work, highlighting its potential value as a framework for further development of standardized methods for district energy balances.

The PED Calculation Methodology
To have a PED, it is necessary to achieve an annual positive primary energy balance, i.e., more energy is produced than what is consumed within the district boundaries. The methodology presented was developed within the MAKING-CITY project [16], and follows a series of steps (see Figure 2). Following the approach of the CEN/TR 15615 and ISO 52000 standards, the calculation direction is the opposite of the energy flow in the system [17], starting with the calculation of the energy needs (step 2) within the PED boundaries (defined in step 1) to a series of iterative steps that finish calculating the equivalent primary energy (step 6), the primary energy balance (step 7), and the associated Sankey diagram (step 8). When designing a PED, it is recommended to go back and forth in order to test different technology options until all the needs are covered and the positive energy balance is achieved. At the operational phase of the district, the evaluation of the energy balance can start at step 4, measuring the on-site RES production and the final energy delivered (i.e., electricity or gas consumption) to calculate the balance. In step 6, the assumptions made when setting the primary energy factors should be stated. The terms and definitions of what is understood as "energy needs" and "energy use," among other terms, are based on ISO52000-1 and listed in Appendix A of this article.  The terms and definitions of what is understood as "energy needs" and "energy use," among other terms, are based on ISO52000-1 and listed in Appendix A of this article.

Step 1: Define the PED Boundaries
The boundaries of a system can be defined as "a borderline that includes several systems, installations, facilities and/or buildings that are interconnected with each other, or with to some energy infrastructure, grid or virtual/contractual connection." Thus, the boundary is defined by the spatial and administrative relationship between the final energy consumption and the energy generation units (inside the buildings or beyond the boundaries, e.g., the grid). Depending on the relationship, the PED can have virtual, geographical, or functional boundaries according to the latest discussions of the EU initiatives (the EU initiatives of JPI Urban Europe [11] and EERA [12] hold discussions among EU projects and stakeholders on this topic.).
Regarding these discussions, when the boundaries are delimited by spatial-physical limits, including delineated buildings, sites, and infrastructures, the PED is defined by geographical boundaries. If the buildings are not close to each other, but are interconnected, thanks to a gas, electric, or heating network, the PED has functional boundaries. If the energy demand is covered by a generation unit, which is shared with other consumption points (e.g., a windmill) and located outside the geographical boundaries of the PED, then it could be considered a virtual boundary. It is currently debated whether or not a virtual boundary could exist when the district cannot afford to own an energy infrastructure and it purchases their RES energy by means of a Power Purchase Agreement (PPA) or by buying green energy certificates. Although certified green electricity is not seen as a part of a PED, it is well recognized by article 15 of directive 2009/28/EC as a measure that a city can apply in the emission inventories as a part of their Sustainable Energy and Climate Action Plans (SECAPs) [18]. This raises the question: What if the positive energy balance is achieved and green energy certificates are also considered? Should it be a virtual PED? What if a PED uses Power Purchase Agreements (PPAs) to buy certified green electricity? These questions are still under discussion, but it is important to note that PEDs need to be seen as a solution to decarbonizing cities, helping to balance the grid, as well as improving the quality of life of inhabitants. If PPAs or green energy certificates are used, it will only help to force the numbers to achieve a positive energy balance, but it will not contribute in a direct way to the city's GHG emissions. This issue is mainly related to the ownership of the power plant (within or beyond the geographical area of the PED), which perhaps could be solved by including the energy operators and producers within the project, as long as the operation of the PED involves the citizens. In the other definitions, such as the REC from the REDII or the CEC from the IEMD proposal, the members are natural persons (such as citizens), local authorities, including municipalities, or small enterprises. IEMD also mentions microenterprises, and these members should effectively control the community [19]. The draft of the EU REDII proposed that REC should include at least 51% of the mem-bers of the community should be local members such as citizens or municipalities, but this limit was not finally included in the recent approved directive. Nevertheless, PEDs could take this limit as a reference, and follow a similar approach when applying vir-tual boundaries. In Spain, the Institute for Diversification and Saving of Energy (IDAE) specifies that LECs should welcome large companies as long as they recognize and contribute to the objectives and roles of the community. How the entity should be created and managed in the PED is still under discussion, but it is something that can be adapted to each local context. Another issue is whether or not these boundaries should have a certain size as a requisite to become a PED. In PED projects being developed under EU funding from H2020, specific requirements were implemented, such as "include at least 15,000 m 2 floor area and a minimum of three large buildings (new, retro-fitted or a combination of both)" [20]. The minimum number of buildings and total floor area were mentioned, as well as the included buildings within the PED being from a different use typology such as residential, work, commercial, or recreational. Nevertheless, these were the requirements for this specific funding call, not a rule imposed by the concept itself. Although they could be taken as a reference, cities may have different contexts that may lead to different PED categories (also known as "archetypes").
The approach taken in the MAKING-CITY PED calculation guidelines is to allow the calculation of the PED to be adjusted for each specific case by selecting from a checklist the different elements and boundaries to be considered for the energy balance (see Figure 3) so as to ensure transparency, while allowing the PED concept to adapt to the different cities' characteristics.

Sustainability 2021, 13, x FOR PEER REVIEW
The approach taken in the MAKING-CITY PED calculation guidelines is to a calculation of the PED to be adjusted for each specific case by selecting from a c the different elements and boundaries to be considered for the energy balance (se 3) so as to ensure transparency, while allowing the PED concept to adapt to the d cities' characteristics.

Step 2: Calculate the Energy Needs
Heating, cooling, domestic hot water, and electric energy needs must be id The needs could be determined by several approaches, including monitoring, calc based on bills, simulation, standards, or statistical data.
The most common elements included in the energy performance of buildin are space heating and cooling (SH&C), lighting, domestic hot water (DHW), ven and humidification [21]. Neither elevators, escalators, home appliances, televis computers, nor are electric vehicles (EV) or their charging stations are covered u EPB. -. However, these energy uses are likely to be included in future EPBs (F according to the Spanish technical code [22]. Thus, within the MAKING-CITY PE lation guidelines, elements that are included in the balance need to be clearly d (see Figure 3) so as to ensure transparency as well as to make the results compara . Define the PED boundary by selecting the different elements to be considered in the energy balance (loads), the PED limits of the district (geographical, virtual, or functional), and the objectives of the PED (positive energy balance, self-sufficient district, circular economy district, or net GHG emissions district).

Step 2: Calculate the Energy Needs
Heating, cooling, domestic hot water, and electric energy needs must be identified. The needs could be determined by several approaches, including monitoring, calculations based on bills, simulation, standards, or statistical data.
The most common elements included in the energy performance of buildings (EPB) are space heating and cooling (SH&C), lighting, domestic hot water (DHW), ventilation, and humidification [21]. Neither elevators, escalators, home appliances, television, and computers, nor are electric vehicles (EV) or their charging stations are covered under the EPB. However, these energy uses are likely to be included in future EPBs ( Figure 4) according to the Spanish technical code [22]. Thus, within the MAKING-CITY PED calculation guidelines, elements that are included in the balance need to be clearly displayed (see Figure 3) so as to ensure transparency as well as to make the results comparable.

Thermal Energy Needs
Thermal energy needs can be defined as the heat to be delivered to cover the energy demands of the building in order to maintain an intended space at a given temperature (space heating = SH and space cooling = SC), and to raise the temperature of the water distribution network to the desired temperature for domestic hot water (DHW) consumption [21].
In many countries, recent regulations for nearly zero or very low energy buildings require a decrease in energy consumption from 30 to 50% from what was required in previous regulations. For most countries, new buildings under the NZEB concept are expected to consume less than 50 kWh/m 2 /year in total primary energy terms (although it depends on the country). Table 1 tries to summarize the average specific energy needs in EU countries for existing residential buildings and NZEB buildings. The former value (144 kWh/m 2 /year) is too high due to poor insulation of the building stock in the EU [23]. For PED implementation it is recommended to improve the efficiency of the buildings to reduce first the energy needs and thus reduce the quantity of energy production needed to cover it. In the case of NZEBs, the variation of the energy needs (9 to 34.3 kWh/m 2 /year) depends on the climate zone, with more strict requirements for southern countries.  [23]. 2 Zebra Tool nZEB (2020) [24]. 3 Passive House requirements [25]. 4 Demos estimations in the MAKING-CITY project.
A basic calculation for energy needs for a PED, whenever no more data is available, would rely on the energy needs from building regulations applied to the different buildings, such as those presented in Table 1, and the SH and SC needs can be defined by the following equation:

Thermal Energy Needs
Thermal energy needs can be defined as the heat to be delivered to cover the energy demands of the building in order to maintain an intended space at a given temperature (space heating = SH and space cooling = SC), and to raise the temperature of the water distribution network to the desired temperature for domestic hot water (DHW) consumption [21].
In many countries, recent regulations for nearly zero or very low energy buildings require a decrease in energy consumption from 30 to 50% from what was required in previous regulations. For most countries, new buildings under the NZEB concept are expected to consume less than 50 kWh/m 2 /year in total primary energy terms (although it depends on the country). Table 1 tries to summarize the average specific energy needs in EU countries for existing residential buildings and NZEB buildings. The former value (144 kWh/m 2 /year) is too high due to poor insulation of the building stock in the EU [23]. For PED implementation it is recommended to improve the efficiency of the buildings to reduce first the energy needs and thus reduce the quantity of energy production needed to cover it. In the case of NZEBs, the variation of the energy needs (9 to 34.3 kWh/m 2 /year) depends on the climate zone, with more strict requirements for southern countries.  [24]. 3 Passive House requirements [25]. 4 Demos estimations in the MAKING-CITY project.
A basic calculation for energy needs for a PED, whenever no more data is available, would rely on the energy needs from building regulations applied to the different buildings, such as those presented in Table 1, and the SH and SC needs can be defined by the following equation: where TEN H&C is thermal energy needs for heating and cooling kWh th yr , M M&C is the space to cool or heat (m 2 ), and Spec SH or sc is the specific energy need of SH or SC needs kWh m 2 yr .
Other simple calculation procedures were followed in the literature, such as the heating degree days (HDD) and cooling degree days (CDD) methodology. First, the heat loss coefficient (in W/K) of the building is calculated as a result of the heat gains (internal, solar heat gains, etc.) and the losses due to heat transfer by transmission (dependent on the U value of the buildings) and ventilation. Then, the HDD and CDD are calculated, which estimate how many days within a year the temperature of the building is under (for heating) or above (for cooling) a certain reference level (i.e., outside temperature at which people start to use heating or cooling appliances). By multiplying these two values, the energy needs can be estimated [26]: where BEN H&C is building energy needs (kWh), BLC is the overall building heat loss coefficient (kW/K), and DD is the degree days (K·d). More detailed methodologies for calculating the energy needs use energy modelling tools such as Energy+ [27], or specific national calculation tools developed in most countries for compliance with building regulations (e.g., HULC in Spain [28]).
With regards to the DHW energy needs, EN15316-3-1 presents several ways to estimate it. For example, it can be calculated assuming a linear relationship between the volume of water to be heated and the square meters of the building, or by estimating it with tabulated values for different types of buildings (relating area and DHW energy needs). Thus, the DHW needs can be defined by the following equation: where TEN DHW is the domestic hot water needs, M is the floor area of the building (m 2 ) or the number of people in the building, and Spec DHW is the specific energy demand to cover DHW needs. The parameters in Equation (3) are the floor area of the building in m 2 (or number of people in the building, depending on the data provided by the national standards), and the specific energy demand in kWh/unit to cover DHW needs. The latter one sometimes can be found in some national standards. In Spain, residential DHW needs are estimated to be from 420 to 573 kWh/year per tenant, whereas in hospitals it depends on the beds (1050 kWh/year/bed) and in sport centers on the users (477 kWh/year/user) [29]. Tools such as the CREST demand model [30] or DHWcalc [31] can be used for residential buildings to generate DHW profiles with statistical means per minute. Table 1 summarizes some specific energy needs for different uses. Again, specific national calculation tools developed for compliance with building regulations also provide calculations of DHW demands.

Electric Energy Needs
"Electric energy needs" are understood as the electricity delivered to cover the energy demand for the lighting and ventilation of a building. Usually "electric energy needs" and "electric energy use" by the building for lighting and ventilation purposes are the same, as losses are usually omitted [21]. Electrical energy to drive the heating system (such as heat pumps or electrical heaters) and auxiliary elements (pumps, etc.) should be included as energy use. On the contrary, the heating or cooling output from the heat pump to cover the space heating and space cooling needs are included in the thermal energy needs.
The energy use of appliances is difficult to quantify and predict, as it depends a lot on the occupants' behavior and preferences [32]. The CREST demand model [30] can be used to determine the electric energy use of appliances within a day (and can be extrapolated to a year) depending on the number of electrical devices (fridges, cookers, television, computer, etc.) and occupancy levels estimated by statistical means. Appliances are not considered as part of the services included in the assessment of the energy performance and thus, not calculated [21]. But its energy consumption can contribute significantly to the performance gap between the predicted and actual energy consumption of the building, and thus to the performance of the positive energy balance of the district. If appliances are excluded, when evaluating a PED, monitoring shall allow the loads to be measured separately to calculate the PED performance with and without appliances.
The electric energy needs can be estimated with the following equation: where EEN is the electric energy needs kWh e yr M is the floor area of the building (m 2 ), and Spec el is the specific electric energy need from literature kWh m 2 yr . The specific energy needs can be found in Table 2. Table 2. EU-27 residential specific electric energy needs.

Needs
Specific Energy Needs (kWh/m 2 ·Year) Using values from Table 2, the electric energy needs for the district are the sum of the electric energy needs for ventilation and for lighting:

Step 3: Calculate the Energy Use
To cover the energy needs, distribution systems, emitters (such as fan coils, radiators, etc.), storage tanks, and heat exchangers are used. To take into account all the losses, from the generation system to the energy needs (DHW, SH, SC) of a building, some typical efficiencies can be considered. The efficiency transforms "energy needs" into "energy use": where TEN is calculated according to Section 2.2.1 and transformed to TEU considering the efficiency (η) of the emitters. Typically, heat exchangers have a conversion efficiency from the primary stream (source) to the secondary stream (sink) of 70%, but it might be higher or lower depending on many factors, such as the area of heat transmission. Heat distribution losses by pipes and storage can vary a lot, from 5% for systems with high insulation to 20% if thinner insulation is installed. TABULA estimates losses of 14.7 kWh/m 2 /year with buffer storage losses, 20.5 kWh/m 2 /year for central heating with a pipeline inside of the thermal envelope, and 36.4 kWh/m 2 /year for central heating with a fraction of the pipeline outside of the thermal envelope [33]. The thermal energy use can also be identified as the useful energy output from the thermal generation systems (e.g., solar thermal collectors, boilers, thermal output from CHP, etc.). Detailed information on how to calculate the energy uses is presented in standard EN15316-3:2017. Electric energy use can also be identified as the useful energy output from the electric generation systems, but there may be a slight difference between the energy use by the appliances and lighting and the energy produced, as part of the electric energy will be lost in the form of heat. Nevertheless, most of the time this energy loss is very small and can be omitted, so for ventilation and lighting it could be said that: If a heat pump (HP) or an electric resistance is used to cover the SH/SC needs or DHW, its seasonal coefficient of performance (SCOP for SH and DHW) and its seasonal Sustainability 2021, 13, 710 9 of 19 energy efficiency ratio for cooling (SEER SC ) could be used to estimate the electric energy use. Thus, the total electric energy use of the district is the sum of the ventilation, lighting, and electricity required for SH/SC and DHW: The COP of HPs largely depends on the temperature to be delivered, the mode (heating or cooling), and the temperature of the source. For example, for a WWHP producing 55 • C for DHW with a ground temperature of 15 • C, the COP may be around 3.16, whereas if it produces water at 35 • C, the COP increases up to 6.30. For this same heat pump, if producing cooling at 7 • C with an outdoor air temperature of 35 • C, the EER is reduced to 2.73 [34].
In the MAKING-CITY calculation methodology electricity used within the district boundaries for domestic appliances and mobility (traffic lights, road lights, EV cars, etc.) are omitted. In commercial and industrial buildings, the corresponding standards should be taken into account, but usually all energy use for processes and for the services provided by a commercial or tertiary activity should be considered. Nevertheless, it is left open that a PED can elect the elements and prepare a specific calculation, as long as it is clearly reported as displayed in Figure 3.

Step 4: Calculate the on-Site Generation
The following step in the PED calculation is to consider different supply side solutions to cover energy needs [35]. After selecting which solutions will be considered for a certain district, energy systems can be listed, and the connections between each of them (schematics) as well as the energy sources supplying the PED (biogas, natural gas, solar, wind, electricity from the grid, etc.) can be identified. Table 3 shows the energy flows depending on different supply side solutions. Several systems could be used in combination, so different energy flows should be considered. The energy carrier fed into the generation systems can come from on-site renewable energy sources (within the boundaries) or from the outside (incoming energy) when electricity from the grid or biomass is consumed. RES are considered local (or on-site) generation in the MAKING-CITY calculation methodology (i.e., within the boundaries of the district). Waste heat is also considered a renewable source in most of the literature, as this heat would otherwise be wasted [36]. Heat pumps with a SCOP higher than 2.5 are considered a renewable source according to ISO52000, but in this methodology what is done is to consider the driving source of the heat pump as energy use (in Equation (8)) instead of local on-site production.
The idea in this phase is to identify which energy uses will be covered by RES (numbers 1 and 2 in Figure 5) and maximize its capacity to cover as much as possible with it. As Figure 5 shows, the higher the thermal energy coming from RES and waste heat, the lower the dependency from a non-RES system such as a boiler. If the latter one is used, a fuel input is required (number 4 in Figure 5) that can come from a non-RES source (such as natural gas). In the case of electricity, the energy uses can be covered by electric RES, a CHP, or the electricity from the grid (numbers 2 and 3 in Figure 5, respectively). In the case of the heat pump, it can be seen that it is accounted as EEU, which produces heating or cooling to cover the needs.  Thus, the useful RES thermal energy produced from hybrid photovoltaic-thermal panels (TEP PVT th ), a biomass-fuelled CHP (TEP CHP bio,th ), and a direct exchange with a geothermal source (TEP geo ), among others, can be calculated as follows: TEP RES = ∑ TEP PVT th + TEP CHP bio,th + TEP geo + · · · The biomass used in the CHP should be considered in step 5. The useful RES electricity generated on site from PVT panels (EEP PVT el ), from PV panels (EEP PV ), and from a biomassfueled CHP can be calculated as follows: EEP RES = ∑ EEP PVT el + EEP PV + TEP CHP bio,el + · · · (10) Biomass used in the CHP should be only accounted for once in Section 2.5. Knowing the energy uses that need to be covered by each RES system gives an idea of its needed useful output and, using an efficiency, the required installed capacity to cover the needs. In [37], the efficiency values at full load for different energy systems were evaluated. The efficiency mean values were near 100% for condensing boilers and electric radiators, from 85% to 90% for solar thermal unglazed collectors, from 75% to 80% for non-condensing boilers, around 60% for flat-plate and evacuated tube collectors, and 50% for electric stoves. The DH system had a mean heat loss for EU28 of 13.70%. The mean capacity per equipment in EU28 was presented in [37], varying from 5 kW to aerothermal heat pumps and stoves, 20 kW for condensing and non-condensing boilers, and up to 200 kW for combined heatpower units (CHP) [37]. The district heating mean value exceeded the capacities (reaching a number of almost 75,000 kW [37]) but the maximum capacities in small houses were actually 60 kW for DWW and 20 kW for heating [38]. If SH and DHW are centralized, they can reach much more depending on use and demand.

Step 5: Calculate the Energy Delivered
The energy delivered is known as the energy supplied to the PED (per energy carrier) that is produced outside the district boundaries. Usually it comes from thermal, gas, or electric grids and feeds the energy systems available on site in the district.
With the useful outputs calculated in step 4, the remaining energy to be covered by non-renewable energy sources (e.g., natural gas-driven boilers) or by external grids (e.g., electricity or DHN) was identified. To do so, the thermal energy produced from RES (TEP RES ) and the thermal energy use (TEU) are compared. If the difference is greater than zero, there is remaining energy to be covered by non-RES or by a district heating system. For both, the energy delivered (ED) to the PED should be considered. If instead the difference is lower than zero, there is an amount of thermal energy exported outside the limits of the PED (which can be called a surplus of thermal energy): The same applies for the surplus of electric energy: In the case that the SEE is higher than zero, the electricity needed can come from the power electricity grid. Greater energy consumption over renewable energy generation within the boundary indicates an import (in) from outside the boundary (i.e., STE > 0 or SEE > 0). Greater renewable energy generation within the boundary over energy import from outside the boundary indicates an export (out) to outside the boundary (i.e., STE < 0 or SEE < 0).
Even if the STE is lower than zero, the incoming energy to boilers or CHP systems that use biomass is usually considered a renewable source coming from outside the boundaries (thus, it is delivered to the PED). That incoming energy (to be used by biomass boilers or CHP boilers) needs to be accounted for as well. For example, the energy delivered (ED) by a CHP using biomass is: The ED CHP is the biomass energy needed to produce the required heat (TEP CHP bio,th ). The ED of the CHP is only accounted for once as the CHP produces both electricity and heat using the same input. Both the output and input of each system are linked with a source of energy inside or outside the boundary for each energy carrier. The total ED is accounted for separately per energy carrier, such as natural gas, peat, biomass, electricity from the grid, oil, etc. The imported energy (or ED) and exported energy are then transformed to primary energy in step 6 per energy carrier.

Step 6: Calculate the Primary Energy Equivalent
Primary energy is the energy that has not undergone any conversion in the transformation process, calculated by the energy carrier using the primary energy factors (PEF). In the MAKING-CITY methodology non-renewable primary energy factors (PEF nren ) are used. Usually the non-renewable primary energy factor for the electricity exported is considered the same as the grid's non-renewable primary energy factor since a substitution assumption is made, meaning that by exporting it, the exports avoid this amount of electricity in the national energy mix. The same thing happens with the heat exported to district heating.
The "delivered energy" per energy carrier is transformed into primary energy as follows: • Primary energy imported (PEI) is calculated as the sum of the weighted delivered energy over all energy carriers (electric energy drawn from the grid, gas from the grid, oil, or pellets-all multiplied by their respective PEF nren ). PEI = ∑ Delivered energy per energy carrier * PEF nren per energy carrier (14) It accounts for the energy supplied to the district that is produced outside the district limits.

•
Primary energy exported (PEE) is calculated as the sum of the weighted exported energy over all energy carriers. PEE = ∑ Exported energy per energy carrier * PEF nren per energy carrier (15) It is the surplus of energy delivered by the district that is used outside the system boundary.
PEFs are the ratio of a given type of primary energy (renewable, non-renewable, and total as the addition of both) to the actual energy amount. On the one hand, if only nonrenewable primary energy is taken into account in the analysis, non-renewable primary energy factors (PEF nren ) are used. This methodology recommends calculating the PED balance in non-RES primary energy terms using PEF nren , as if total primary energy factors (TPEF) are used it could hamper the use of some RES, such as biomass from forest waste that would be an import to the PED. TPEF is the sum of the PEF nren and renewable primary energy factor (PEF ren ): PEFs, whether TPEF or PEF nren , are usually a constant national value, and do not depend on time or geographical location. However, they depend on the specific mix of primary energy sources and the efficiency of the processes of transformation, generation, storage, and transportation, which are temporally dependent factors [39]. PEF ren for RES are a bit more intricate. Finland considers PEF ren zero in their calculations [40,41], whereas Spain [42] and Germany [43] do not. Waste heat can be seen as a renewable source (with a PEF ren of 1) that is used to reduce the heat input, as this heat would otherwise be wasted [36]. For biomass, PEF ren can depend on its regrowth rate [44], such as peat that is considered non-RES since it accumulates on the land with a low carbon sequestration yield [45]. For renewable sources such as PV or wind, some countries consider the non-renewable energy used during the maintenance process of these plants (hence, its PEF nren is similar to 0.05). For the present methodology, as the balance is calculated on annual basis, national primary energy factors are recommended. Nevertheless, if some factors cannot be found, the ISO 52000 standard provides a table with default total non-renewable and renewable primary energy factors [46].

Step 7: Calculate the PED Energy Balance
The primary energy balance in the MAKING-CITY methodology is calculated as the difference between the non-renewable primary energy delivered to the district (PEI) and the non-renewable primary energy that is exported outside the PED's boundaries (PEE): The PED balance value is negative when the PEE is higher than the PEI. This means that the district is positive. This is due to the fact that the energy flow direction when entering the building (or the district) is positive, and when it leaves the district boundaries it is negative.
When evaluating an existing district, monitored data can be used and the evaluation can start in step 4, calculating how much energy is used within the district, how much energy comes from outside the boundaries of the district (step 5), and thus, the primary energy balance (step 6 and 7).

Step 8: Perform the Sankey Diagram
Once all the steps are finalized, an energy flow diagram can be drawn (known as a Sankey diagram) such as the one in Figure 6. This graphic representation shows the energy flows for the different stages of the balance. For simplicity, energy systems and emitters are not drawn. The energy needs that the district demands, the energy used for covering this demand, the final energy delivered into the district, and this energy (represented in terms of primary energy) are the four stages that cover electric and thermal energy. The fifth section of this diagram shows the result of the primary energy balance and represents the surplus of energy that the PED could have. the ISO 52000 standard provides a table with default total non-renewable and renewable primary energy factors [46].

Step 7: Calculate the PED Energy Balance
The primary energy balance in the MAKING-CITY methodology is calculated as the difference between the non-renewable primary energy delivered to the district (PEI) and the non-renewable primary energy that is exported outside the PED's boundaries (PEE): The PED balance value is negative when the PEE is higher than the PEI. This means that the district is positive. This is due to the fact that the energy flow direction when entering the building (or the district) is positive, and when it leaves the district boundaries it is negative.
When evaluating an existing district, monitored data can be used and the evaluation can start in step 4, calculating how much energy is used within the district, how much energy comes from outside the boundaries of the district (step 5), and thus, the primary energy balance (step 6 and 7).

Step 8: Perform the Sankey Diagram
Once all the steps are finalized, an energy flow diagram can be drawn (known as a Sankey diagram) such as the one in Figure 6. This graphic representation shows the energy flows for the different stages of the balance. For simplicity, energy systems and emitters are not drawn. The energy needs that the district demands, the energy used for covering this demand, the final energy delivered into the district, and this energy (represented in terms of primary energy) are the four stages that cover electric and thermal energy. The fifth section of this diagram shows the result of the primary energy balance and represents the surplus of energy that the PED could have.

Other Indicators
The total primary energy can be used as an additional indicator besides non-renewable primary energy.Total primary energy can be divided into non-renewable primary energy (PEnren) and renewable primary energy (PEren) expressed in net terms as follows: DISTRICT BOUNDARIES Figure 6. Sankey diagram of a district the dashed line indicates the boundaries considered in this paper.

Other Indicators
The total primary energy can be used as an additional indicator besides non-renewable primary energy.Total primary energy can be divided into non-renewable primary energy (PE nren ) and renewable primary energy (PE ren ) expressed in net terms as follows: • PE nren is the non-renewable primary energy consumed at the energy facility. It is calculated as the sum of all delivered energy per energy carrier that comes from a non-renewable source weighted using non-renewable primary energy factors (PEF nren ). In addition, the avoided energy as a result of injecting PV into the grid is considered (using PEF nren,GRID ).
• PE ren is the renewable primary energy consumed at the energy facility. It is calculated per energy carrier. Renewables coming from the grid are also considered: PE ren = ∑ Delivered energy per energy carrier * PEF ren,ENERGY CARRIER − Exported energy PV * PEF ren,GRID −Exported energy Biogas * PEF ren,GAS · · · ETC (19) The sum of the two terms from above is the total primary energy balance: PED Balance TOTAL terms = PE nren + PE ren (20) This can give an idea of how efficient a district is. Furthermore, if the city wants to assess how much renewable energy has been delivered to the PED, the renewable energy factor is calculated as follows: Finally, the net carbon dioxide equivalent emissions can be calculated as the difference between the total equivalent carbon dioxide emissions (CO 2eq ) of the imported primary energy and the total equivalent emissions that have been avoided by exporting the RES produced. CO 2 eqB = ∑ PEI per energy carrier * CO 2eq emission factor − ∑ PEE per energy carrier * CO 2eq emission factor (22) Care should be taken calculating this, as most of the CO 2eq emission factors are in terms of delivered energy or final energy (not primary energy). In this case it is calculated with the net non-renewable primary energy. Therefore, the emission factor to be used is in terms of non-renewable primary energy, too.

Discussion-Shortcomings of the Proposed Methodology
The methodology proposed a process to calculate a PED energy balance based on primary energy. On the one hand, the accuracy that can be required for the energy balance calculations of the PED is debatable. Calculation of energy needs and energy use within the buildings and public spaces at the design stage needs a lot of estimations, and it can lead to over-and underestimations of what will really be demanded. For instance, in a MAKING-CITY project the calculation of the energy use of the building is simplified (and by extension the district) and appliances are not considered.
On the other hand, EU member states (MS) have different approaches when accounting for the RES requirements for the energy performance of buildings (such as the NZEB). Some technologies, such as solar thermal panels for domestic hot water generation and for heating, PV for self-use, biomass boilers, and heat pumps coupled with external air, exhaust air, ground, or ground water, can in general be accounted for in the energy performance calculation in all 24 countries [47]. However, PV for feed-in, RES as part of a district cooling network or micro-wind turbines (for both: self-use or feed-in), and local hydro power for self-use can be accounted for in the energy performance calculation in about half of the EU MS. The RES technologies that can most rarely be accounted for in energy performance calculations are RES electricity via the grid (with a specific contract) and local hydro power for feed-in. In principle, PEDs should use an approach closer to the national codes where the PED is applied, but accounting additionally for the energy that is exported, as is followed in this article (otherwise, it would be very difficult to achieve a PED). However, as MS do not have a harmonized way to calculate energy balances, in some countries the implementation of PEDs could be jeopardized and it could be difficult to compare them. For example, in Spanish DB-HE2019 regulations non-renewable energy flows can be only compensated with energy exports within the same month. This means, for example, that the excess PV energy exported during the months of summer cannot compensate the non-renewable energy consumption from the months of winter. This is a barrier for implementing PEDs in Spain, and relates to the calculation timestep used in the PED calculations. Although in this paper an annual energy balance was considered, shorter timesteps add complexity to the calculation. Monthly, daily, hourly, or sub-hourly simulations can be a further addition to the methodology whenever it is necessary to assess the role of PEDs on the flexibility of the energy system.
Finally, barriers to the technology implementation and refurbishment of buildings are high, especially in existing districts. CA EPBD work on national applications of the NZEB definition has shown that MS see a specific challenge in "how to include RES contributions to the energy supply of multi-family houses in city centres, where roof areas and other suitable areas for the installation of RES technologies (e.g., the ground around the buildings) are limited in comparison with the buildings' floor area and are often shaded by other buildings" [47]. The EU project POCITYF will demonstrate 10 integrated solutions in cultural heritage areas that are usually difficult to refurbish due to the cultural value of their façades. Thus, there is still a gap in the different barriers that could be found in different urban contexts and how to overcome them.

Conclusions
This paper establishes an eight-step guideline on how to calculate the annual energy balance of a district. The methodology is meant for districts aspiring to become PEDs, which need to demonstrate that a positive energy balance is achieved. Although many assumptions are required depending on district, region, or country context (such as PEFs), the methodology proposed could help the cities at the design stage of establishing a district and to evaluate its annual energy balance.
Currently, there is no standard to calculate an energy balance applied at the district level, and the energy flows between the buildings and energy systems are very casespecific and sometimes complex to understand. On the other hand, standards can help but are not that user-friendly. Therefore, the developed methodology proposes an energy balance calculation as a "first step" to standardize the process and to provide a clear calculation procedure. The proposed calculation makes different assumptions on how the boundaries are defined and how to calculate the district balance despite most of them still being under discussion in most of the relevant scientific forums. Appliances, mobility, occupants' behavior, and building automation systems are not considered in these calculation procedures (not known at the design stage), but when considered, it could improve the results between the predicted and actual energy uses of the district and lead to a more accurate design to achieve a positive energy balance. In the future, integration of different sectors and energy vectors (such as industry and hydrogen), should also be considered. Furthermore, seasonal and even simultaneous operation of PEDs and the impact and stress that the grid can suffer should be studied.
Because it is possible to achieve a Positive Energy District through an unrealistic system (as huge on-site generation, to give an example), a standardized calculation is needed similar to the NZEB rating, where lowering the energy needs is a first requisite to certifying the building (and by extension a district).
Finally, the developed methodology will be the basis for energy balance calculations for lighthouse cities in the MAKING-CITY project, and the verification of this methodology once the real project demo sites are finished and evaluated.
The following terms are used within the calculation methodology. The terms are based on ISO52000-1 [27].

Name Acronym Description
Positive Energy District PED A Positive Energy District is an urban area with clear boundaries, consisting of buildings of different typologies that actively manage the energy flow between them and the larger energy system to reach an annual positive non-renewable primary energy balance. Non-renewable primary energy imported to the district is lower than the equivalent avoided non-renewable primary energy (due to RES exports outside the district limits).

Renewable Energy Sources RES
Systems using solar energy, wind farms (owned by the district), geothermal, hydropower, heat pumps (with COP > 2.5), and systems using local biomass or biogas are local on-site renewable energy sources. Waste heat facilities are considered local on-site renewable sources. In the case of biogas and biomass, a non-renewable primary energy factor is used to transform the biogas/biomass energy delivered into primary energy, i.e., accounting for the energy needed to process and obtain these fuels.
Thermal Energy Needs (heating and cooling) TEN H&C Heat to be delivered to or extracted by emitters (radiators, fan coils, etc.) to cover the energy demands of the buildings and thermal conditioned spaces to maintain the intended space temperature conditions during a given period of time [21] Thermal energy Needs (domestic hot water-DHW) TEN DHW Heat to be delivered to the needed amount of domestic hot water to raise its temperature from the cold network temperature (usually known as tap water) to the prefixed delivered temperature (different for each country and system) at the delivery point, accounting for the losses [21] Electric Energy Needs EEN Electric energy to be delivered to cover the energy demand of lighting and ventilation of a building. Usually electric energy needs and electric energy use by the building for lighting and ventilation purposes are the same (losses can be neglected). Electrical energy to drive the heating system (such as heat pumps or electrical heaters) and auxiliary elements (pumps, etc.) should be included as energy use [21] Thermal Energy Use TEU Energy input into the heating, cooling, or hot water system to satisfy the thermal energy needs for heating, cooling, or hot water, respectively. It can also be identified as the useful energy output from the thermal generation systems (e.g., solar thermal collectors, boilers, thermal output from CHP, etc.). [21] Name Acronym Description Electric Energy Use EEU Electric energy directly consumed by buildings (from grid or local RES as PV, wind, etc.) to be delivered to cover the energy needs (for DHW, heating, and cooling when an electricity-driven system is used; and ventilation and lighting). Only electric energy needs and uses in the EPB standards are considered, therefore the electricity used within the district boundaries for domestic appliances and mobility (traffic lights, road lights, EV cars, etc.) are neglected [21]. In commercial and industrial buildings, the corresponding standards should be taken into account. Note that electric energy use can also be identified as the useful energy output from the electric generation systems. There might be a slight difference between the energy use by the building and the electric energy needs by appliances due to the loss of energy by means of heat, which is usually neglected, as it is smaller than the overall consumption. Electric energy to drive the heating system (such as heat pumps or electrical heaters) and auxiliary elements (pumps, etc.) should be included as electric energy use.
Thermal Energy Produced from RES TEP RES Thermal energy generated by the systems located on site in the district from RES. The energy carrier used in these systems should be considered in order to know the amount of energy delivered to the PED (e.g., biomass imported, etc.).

Electric Energy Produced from RES EEP RES
Electricity generated by any system located on site in the district from RES. All the energy carriers used in these systems should be considered in order to know the amount of energy delivered to the PED (e.g., biomass imported, etc.).

Surplus of Thermal Energy STE
The thermal energy produced on site that is not used to cover thermal energy needs and therefore is exported outside the district boundaries. It is calculated as the difference between thermal energy produced on site and thermal energy used on site.

Surplus of Electric Energy SEE
The electricity produced on site that is not used to cover electricity needs and therefore is exported outside the district boundaries. It is calculated as the difference between the electricity produced on site and electric energy used on site.
Energy Delivered ED Energy supplied to the PED (thermal, fuels, and electricity) that comes from outside the district boundaries [21].

Primary Energy Balance PEB
The primary energy balance is calculated as the difference between energy delivered to the district (sum of all energy carriers) multiplied by the non-renewable primary energy factor (per energy carrier) and the energy that is exported outside the PED's boundaries multiplied by the non-renewable primary energy factor (per energy carrier).

Total Primary Energy
Factor TPEF This factor indicates how much primary energy (renewable and non-renewable) is used to generate a unit of electricity or a unit of useable thermal energy (commonly applied to fuels). This electricity comes usually from the grid, and in that case, it is a country specific indicator and depends on the country's energy mix [21].

Non-Renewable Primary Energy Factor PEF nren
The non-renewable primary energy factor (PEF nren ) proves or shows how much primary energy from non-renewable sources is used to generate a unit of final energy through the use of consumption indicators [21].

Renewable Primary Energy Factor PEF ren
The renewable primary energy factor (PEF ren ) proves or shows how much primary energy from renewable sources is used to generate a unit of final energy through the use of consumption indicators.

Primary Energy Exported PEE
Surplus of non-renewable primary energy delivered by the PED that is used outside the district boundaries. It is calculated as the sum of the surplus of thermal energy multiplied by non-renewable primary energy factors (taking into account the different energy carriers) and the surplus of electric energy multiplied by non-renewable primary energy factors (taking into account the grid electricity factors). The non-renewable primary energy factors of the grids (gas, electricity, fuels, etc.) are used in order to take into account the "avoided" energy of the system beyond the boundaries.

Primary Energy Imported PEI
Energy delivered into the PED that is calculated in terms of non-renewable primary energy as the sum of the weighted delivered energy over all energy carriers (electric energy drawn from the grid, heat from a district heating network, gas from the grid, oil, biomass, biogas, or any other fuel) multiplied by the non-renewable primary energy factors of each energy carrier.