Energy Consumption Models at Urban Scale to Measure Energy Resilience

: Energy resilience can be reached with a secure, sustainable, competitive, and a ﬀ ordable system. In order to achieve energy resilience in the urban environment, urban-scale energy models play a key role in supporting the promotion and identiﬁcation of e ﬀ ective energy-e ﬃ cient and low-carbon policies pertaining to buildings. In this work, a dynamic urban-scale energy model, based on an energy balance, has been designed to take into account the local climate conditions and morphological urban-scale parameters. The aim is to present an engineering methodology, applied to clusters of buildings, using the available urban databases. This methodology has been calibrated and optimized through an iterative procedure on 102 residential buildings in a district of the city of Turin (Italy). The results of this work show how a place-based dynamic energy balance methodology can also be su ﬃ ciently accurate at an urban scale with an average seasonal relative error of 14%. In particular, to achieve this accuracy, the model has been optimized by correcting the typological and geometrical characteristics of the buildings and the typologies of ventilation and heating system; in addition, the indoor temperatures of the buildings—that were initially estimated as constant—have been correlated to the climatic variables. The proposed model can be applied to other cities utilizing the existing databases or, being an engineering model, can be used to assess the impact of climate change or other scenarios.


Introduction
The goal of European energy policies is to achieve energy and climate targets through an improvement in energy efficiency and a greater use of renewable energy sources in order to make cities more resilient. In Italy, these indications have been transposed by the "Integrated National Plan for Energy and Climate 2030" with the following objectives: (i) a 40% decrease in greenhouse gas emissions (compare to 1990); (ii) an increase to 32% of the share of renewable sources; (iii) a 32.5% improvement in energy efficiency. In European countries, almost 50% of the final energy consumption is used for space heating and cooling, of which 80% is for buildings [1]. For this reason, the optimization of building efficiency is one of the goals to promote the low-carbon and resilient urban development of cities [2,3].
Urban-scale energy models allow reliable estimates of the energy consumption of buildings to be made, which can in turn be used as a base for planning a resilient city [4,5]. Since the energy consumption of buildings is related to the local climate conditions and the urban morphology, these models have to consider the urban context (especially in dense, built-up areas) [6]. Therefore, energy simulation models and tools should take into account not only the characteristics of buildings, Table 1. Impacts of energy on resilience in cities [19].

Environment
Greenhouse gas emissions (GHG) emissions: -GHG emissions influence climate change; -Energy is the largest contributor to GHG emissions.
Heat emissions: -Heat due to energy consumption in cities contributes to urban heat island (UHI) effect; -UHI affects human health, the ecosystem, and energy demand.
Environmental pollution: -Low availability of local renewable energy sources; -Air pollutant emissions: SOx and NOx are emitted by burning fossil fuels; -Water and land impact of energy-use.

Economy
Energy price fluctuations: -Energy prices affect human activities (i.e., industry, transport, households, . . . ); Maintenance and renovation of energy infrastructure: -Costs of maintenance and renovation of the existing energy infrastructure.

Disruptions of energy supply by disasters and critical events:
-Millions of people lose energy supply; -Suspension of services; -Regional and global effects through supply chains.

Governance
Energy governance is affected by various factors: -Stable policy and regulatory framework; - The availability of local and non-local energy resources; -Local energy management (e.g. self-sufficient energy systems); -State of air pollution, water and land impact. In order to be resilient, urban energy system needs to be capable of "planning and preparing for", "absorbing", "recovering from", and "adapting" to any adverse events that may happen in the future. Integrating these four abilities into the system would enable it to continuously address "availability", "accessibility", "affordability", and "acceptability" as the four sustainability-related dimensions of energy [17]. Some strategies to improve energy resilience in cities can be summarized as follows [19]: • Energy management in urban policy: to measure the state of resources and to set achievable targets with a low environmental impact. • Robust energy system: robust infrastructures and self-sufficient entities/communities. • Redundant and flexible energy management: the diversification and optimization of energy sources and users by encouraging investments from public and private stakeholders (foreseeing social and economic changes).

•
Resourceful and inclusive energy management: promoting local renewable energy production, and enhancing energy efficiency interventions in all sectors and among all stakeholders. • Integrated energy management: regional and national coordination between municipalities and cities in order to create a multiplier effect on the territory.
Finally, energy data at the city level, including data on energy consumption and renewable energy production, are fundamental for understanding resilience challenges related to energy and for developing urban policies. Unfortunately, these data are difficult to find, often incomplete, and rarely available in a standardized format.

Research Gap
There are a number of simulation energy tools and models, such as CityBES (City Building Energy Saver), CitySim, SimStadt, UCB (UrbanSim), UMI (Urban Modeling Interface), that are able to estimate building stock energy demand considering the climate and urban morphology [20,21]. The existing models and tools are able to accurately simulate the energy performance at the block of buildings or neighborhood scale, but not at the city level. For example, CitySim, which is a large-scale building energy simulation, gives accurate results on the heat flow load at the neighborhood scale [22]. Additionally, Zhu et al., (2019) developed a method for building energy estimation on the district level using CityBES, and eight public buildings have been investigated [23].
In general, these models need the support of other combined tools, do not interact with the existing databases (e.g., Municipal Technical Maps, Digital Surface Model, Digital Terrain Model, satellite images, orthophotos), and are also paid for.
The model presented here is an engineering model based on buildings' energy balance that is implemented with a free GIS software using existing databases and is able to carry out simulations at the urban-territorial scale introducing urban variables. On the other hand, it is a simplified model and is therefore less accurate then engineering models at the building scale. Finally, this model is not a single building energy model applied at the urban scale [24,25]; it does not evaluate how local climatic conditions change according to urban morphology [26,27], and it is not a statistical model [28].

Research Questions
This work starts from studies conducted in the past with bottom-up and top-down models of the energy performance of buildings [29] which use data with high detail at the building level and data with low detail at the municipal level, respectively [30]. Then, an engineering bottom-up monthly model has been created to evaluate the energy performance of the buildings connected and not connected to the DH network in Turin [31]. For the evaluation of thermal peak loads, the problem of having an hourly model emerged. According to the standards on the energy balance of buildings (i.e., ISO 52016-1:2017, ISO 52017-1:2017), a simplified model has been designed using the available data of the buildings at the urban scale. The engineering model presented can be classified as a "grey-box model" that combines simplified physical information (i.e., geometrical and typological characteristics, local climate conditions) with historical data (i.e., thermal consumptions) to simulate the building energy consumption from the building to city level [32]. In a previous work [6], a comparison between a first hypothesis of the grey-box model and a "black-box model"-which is fully based on historical data and statistical analysis-using a machine learning approach was made on two residential blocks of buildings in Turin. The results of this work indicated that the grey-box model could give good results, and for this reason the authors decided to optimize that model.

Research Objective
The aim of this work is to create a dynamic energy model to be applied at the urban scale, starting from the energy balance equations at a building scale (according to: ISO 13786:2018, ISO 52016-1:2017, ISO 52017-1:2017, and ISO 13790:2008). This model has been designed to link with the existing territorial databases and then can be used for different urban contexts. One of the novelties of this urban energy model is that it can be applied to groups of buildings considering the energy-related variables that describe the urban morphology. These variables were introduced in the incoming and outgoing energy flows of the energy balance equations.
Summing up, the aim of this work has been to investigate the following topics: • Why should we use hourly models? The DH network is dimensioned according to the peak of hourly energy demand. Then, the evaluation of the morning peak of consumption is a key factor related to the capacity of the energy distribution network. Moreover, hourly models can be also used to evaluate the optimization of the energy supply/demand, especially boosting renewable technologies. • Is this hourly model accurate? How precise would the results be if the model is applied at an urban-territorial scale and to a group of buildings? The novelty of this model is its application to homogeneous groups of buildings using urban morphology variables. The model has been simplified so that it can use the data available for all the buildings in a city; it must provide results quickly, but these results should be accurate.

•
Starting from the consideration that the model will be used to calculate the hourly consumption of buildings in a city, it is better to consider the temperature inside the buildings to be constant (e.g., set-point range) or variable according to the weather conditions?
Then, the novelty of the model here presented is that it is a simplified engineering model applied at the urban scale; it uses existing territorial databases and a place-based assessment through a Geographic Information System (GIS) tool. In this work, the model was studied to consider the interactions between buildings introducing new urban variables. Furthermore, with this energy model it is possible to evaluate the future energy efficiency or renewable energy scenarios, representing the spatial distribution of the energy demand/supply to achieve energy and climate targets [33][34][35].

Materials and Methods
This paragraph describes the input data of buildings at the urban scale and then explains the equations that use this data and that regulate the energy balance of buildings and groups of buildings.
In this first part of the work, residential buildings with different energy consumptions were characterized according to the main variables that influence their energy consumptions. Then, the buildings were characterized into archetypes and grouped into clusters according to their typologies and consumptions. The energy balance model was applied to the different clusters, identifying the most effective input data. Then, to further reduce the errors, the buildings' temperature profiles were corrected, taking into account climate conditions. The accuracy of this hourly energy balance model was evaluated by comparing the forecast energy supplied with the measured consumptions for the 2013-2014 heating season. This work can be divided into three parts ( Figure 1): Sustainability 2020, 12, 5678 5 of 33

1.
Input data collection and processing: identification of the input data that have been collected using existing databases and the energy consumption provided by the DH Company. The data have been processed and georeferenced with the support of a GIS tool.

2.
The energy balance with an iterative procedure was designed, dividing residential buildings into four clusters (homogenous groups) according to the hourly consumption profiles and the construction periods. The profiles of the building temperature-simulated using the energy balance equations-were compared with the indoor comfort temperature (according to ISO 7730: 2005 and EN 16798-1:2019). To further optimize the model, the internal temperature of the buildings was corrected, taking into account the climate conditions (external air temperature and sol-air temperature). 3.
The energy consumptions were simulated using optimized energy balance equations and have been compared with the measured energy consumptions in order to test the accuracy of the model and validate it.

Input Data Collection and Processing.
This section describes the input data, how they were treated and analyzed, and the tools that were used for their management and processing. A geo-referenced database was created using the data presented in the following sub-sections (see Table 2 and Table A1 in the Appendix).
The main steps in the management of data are indicated below: • A sorting algorithm was used in the pre-processing phase to elaborate the DH energy consumption data. The raw data of the energy consumptions were interpolated with a constant time interval equal to 1 hour; building data with too many errors or missing data (more than 10%) were discarded. • GIS software was used to locate each building, identifying its characteristics according to the availability of data at the urban scale. The input data were processed to evaluate the geometrical and typological characteristics of buildings and groups of buildings and all energy-related variables; at the block of buildings scale, also the sky view factor (SVF), urban canyon height to distance ratio (H/W), building orientation, and solar exposition were evaluated to characterize the buildings' surrounding context.

Input Data Collection and Processing
This section describes the input data, how they were treated and analyzed, and the tools that were used for their management and processing. A geo-referenced database was created using the data presented in the following sub-sections (see Tables 2 and A1 in the Appendix A).
The main steps in the management of data are indicated below: • A sorting algorithm was used in the pre-processing phase to elaborate the DH energy consumption data. The raw data of the energy consumptions were interpolated with a constant time interval equal to 1 hour; building data with too many errors or missing data (more than 10%) were discarded. • GIS software was used to locate each building, identifying its characteristics according to the availability of data at the urban scale. The input data were processed to evaluate the geometrical and typological characteristics of buildings and groups of buildings and all energy-related variables; at the block of buildings scale, also the sky view factor (SVF), urban canyon height to distance ratio (H/W), building orientation, and solar exposition were evaluated to characterize the buildings' surrounding context. Local climate data were used as energy-related variables for the hourly energy model to evaluate the energy consumption for the space heating of the buildings. The local climate data were processed with reference to the nearest weather stations (WS), the ENEA (Italian National Agency for New Technologies, Energy, and Sustainable Economic Development: http://www.solaritaly.enea.it/), and to the PVGIS portal (Photovoltaic Geographical Information System: https://re.jrc.ec.europa.eu/pvg_tools/ en/tools.html).
The hourly air and sky temperature, relative humidity, and incident solar radiation data from the nearest ARPA WS (Regional Environmental Protection Agency; in Italian: Agenzia Regionale per la Protezione Ambientale) were elaborated, and 34 typical monthly days with different air temperature and solar irradiation conditions were identified for the 2013-2014 heating season. The heating period for the case study (the city of Turin, Italy) is from October 15th to April 15th (183 days), and the analyzed weather data therefore refer to the same heating period.
The direct and diffuse components of solar irradiation were mainly obtained from the climatic data derived from weather station reports and from the PVGIS portal; the solar azimuth (a) and the solar height (h) were obtained from solar geometry correlations. According to [37,38], the relation between these parameters can be written as follows: where h is the solar height, ϕ is the latitude, β is the solar declination, z = 15·(t − 12) is the hour angle, t is the solar hour, and d is the day. The incident solar irradiance on walls (I sol,wall ) was assessed considering the hourly variation in the shadow percentage for each building (ξ) as a function of the solar height h and the canyon height to distance ratio H/W ( Figure 2). When h is less than the urban canyon angle arctan(H/W), the shadow quota of the building wall is equal to the tan(h)/(H/W); instead, if arctan(H/W) is greater than/equal to 1, there is no shadow on the building wall: where ξ is the percentage of shadow on the vertical wall, h is the solar height, H is the urban canyon height, and W is the urban canyon width.
where ξ is the percentage of shadow on the vertical wall, h is the solar height, H is the urban canyon height, and W is the urban canyon width.

Hourly District Heating (DH) Consumption Data
Space heating consumption data at the building scale (in Wh) with different time intervals (from 20 minutes to 1 hour) were provided by the Iren DH Company of Turin for the 2013-2014 heating season. The database, which has a large extension (5 GB), has been elaborated on, and in the preprocessing phase a sorting algorithm in python language has been used to extract and organize the  The database, which has a large extension (5 GB), has been elaborated on, and in the pre-processing phase a sorting algorithm in python language has been used to extract and organize the data for each building with hourly time-steps according to the following actions: • The raw data were interpolated with a constant time interval equal to 1 h, the missing data were computed from the available measurements, data with too many errors or missing data (with no information of 10%) were discarded (the useful sample of buildings decreased from 102 to 92 buildings).

•
Space heating consumptions were geo-referenced at the building scale according to the coordinates/address of each energy meter using a GIS tool.

Constant Building Data
The thermo-physical and geometric parameters of the residential buildings were evaluated using information from the municipal technical maps, ISTAT (National Statistical Institute; in Italian: Istituto Nazionale di Statistica) census data for the year 2011, European Standards, and the literature. The Territorial DataBase (DBT) was implemented with other official information, such as the characteristics of the territory, using a Digital Surface Model, "DSM" (with a precision of 0.5 m); satellite images (Landsat 7 and 8); and orthophotos (with a precision of 0.1 m).
The typological characteristics of 102 buildings were calculated using the attributes of a 2D footprint derived from the municipal technical map with the GIS software: net and gross heated volume; -net and gross floor surface; -a transparent surface equal to 1/8 of the floor was assumed for the glazing (air-lighting ratio of D.M., 7 July 1975, and Turin building regulations); -solar exposure and orientation, and shading elements, using the DSM and the solar geometry; -the presence of uninhabited cellars and attics (very common in large Italian cities) has been hypothesized.
The thermal and construction characteristics of the residential buildings were assessed by identifying archetypes. The main input data were (ISO 52016-1:2017): the thermal transmittance (U) and resistance (R) of the building envelope elements; -the total solar transmittance (g G ) of the transparent envelope; -the solar radiation absorption coefficient (α E ) of the opaque envelope, which was determined considering the average color; -the emissivity (ε E and ε G ) of the envelope, which was assumed to be constant for opaque and transparent elements; -a reduction frame factor (F F ) of the windows, which was hypothesized as being constant; -thermal capacities (C) and system efficiencies (η); -the type of system management (i.e., intermittent with night shutdown).
The data concerning the use of the buildings mainly refer to (i) the type of ventilation and (ii) the type of internal heat gains: -As far as the type of ventilation is concerned, three scenarios were assessed in order to evaluate the quota of heat losses due to natural ventilation. Firstly, an air exchange per hour (ach) of 0.5 h −1 was assumed to be constant for all residential buildings during the day (24 h) resulting from infiltration. In the second scenario, ach was assumed to be variable during the daytime (with ach equal to 0.62 h −1 ) from 7 a.m. to 9 p.m. and the nighttime (with ach equal to 0.30 h −1 ) from 10 p.m. to 6 a.m. due to the use of shutters. In the last scenario, the thermal balance was implemented and the ach was assumed to be variable, considering a quota for infiltrations (3/4 h) and a quota for window opening (1/4 h) when the temperature inside the buildings exceeded the comfort temperature (T B > 22 • C). -According to ISO 52016-1:2017, the internal heat gains were assumed with daytime and nighttime profiles.

Constant Morphological Urban-Scale Parameters
Previous studies [39][40][41][42][43][44] confirm that certain variables, such as the climatic and local climatic conditions, the presence of vegetation, and/or the type of outdoor surfaces, can influence the thermal consumption of buildings. The morphological urban-scale parameters were evaluated using the municipal technical map (2015), ISTAT census data (2011), remote satellite images (i.e., Landsat 7 and 8), and a DSM with a precision of 0.5 meters. The urban characteristics that it was possible to consider were: the sky view factor (SVF), which measures the visible portion of the sky from a given location; the albedo, which is the percentage of solar incident irradiation reflected from a surface, and varies mainly according to the characteristics of the materials; the presence of vegetation, which is evaluated with the normalized difference vegetation index; the main orientation of the buildings; the urban canyon effect, which influences the outside air temperature and wind velocity, and which can be quantified considering the ratio between the urban canyon height "H" and its width "W"; the relative building height (H/H avg ), which describes the solar exposition in relation to the height of the surrounding buildings; the building coverage ratio (BCR) and the building density (BD), which describe the percentage of built area and the ratio of the building volumes to the sample area, respectively.
In this work, SVF, H/W, H/H avg , and building orientation were used as input data in the thermal balance to take into account the characteristics of a specific urban context. SVF was used to describe the solar exposition and the thermal radiation lost to the sky from the built environment. H/W, H/H avg , and building orientation were used to quantify the effect of direct solar irradiation on the building envelope at hourly time-steps.

Dynamic Urban-Scale Thermal Balance
Starting from the thermal balance at the building scale (according to ISO 52016-1:2017 and ISO 52017-1:2017), the thermal flux equations have been simplified using the available data at the urban scale. Then, the energy performance of buildings was based on the following assumptions: • The buildings internal environments are considered with uniform thermal conditions to enable a thermal balance calculation (during the heating season, the heated space has a daily temperature of 20 ± 2 • C).

•
To evaluate the heat flow between two environments, the heat transfer coefficients by transmission and ventilation are used.

•
The energy need for humidification or dehumidification was neglected, as the heating systems of residential buildings are mainly central water systems with radiators and without mechanical ventilation systems; they can control only the temperature and not the relative humidity.

•
The calculation time interval is one month or one hour.

•
Compared to the monthly method, the main goal of the hourly calculation is to be able to take into account the influence of hourly and daily variation in weather and operation.
In this energy balance model, three thermodynamic systems (in Figure 3) were considered and the following assumptions were made: (i) the temperatures of the thermodynamic systems were uniform; (ii) the heat transmission through the building elements was one-dimensional and thermal bridges were neglected; (iii) the energy need for humidification or dehumidification was neglected; (iv) the energy balance equations can be applied also to groups of buildings with similar behavior. account the influence of hourly and daily variation in weather and operation.
In this energy balance model, three thermodynamic systems (in Figure 3) were considered and the following assumptions were made: (i) the temperatures of the thermodynamic systems were uniform; (ii) the heat transmission through the building elements was one-dimensional and thermal bridges were neglected; (iii) the energy need for humidification or dehumidification was neglected; (iv) the energy balance equations can be applied also to groups of buildings with similar behavior. The three thermodynamic systems (TS) considered are: E) The opaque envelope, which is composed of all opaque surfaces separating the heated internal volume of the building from the external environment or other unheated spaces; G) The glazing, which consists of all transparent surfaces separating the heated internal volume of the building from the external environment or other unheated spaces; B) The building, which is the inside part of a building with internal structures, furniture, and air.
The energy balance equations on the three systems make it possible to assess the temperatures of the three systems per hour using an iterative method. The maximum number of iterations and the acceptable error were set at 1000 and 0.001, respectively.
Starting from the general energy balance equation (Equation 5), the equations for the three thermodynamic systems G, E, and B are shown below (the following paragraphs will explain all the variables in more detail): The three thermodynamic systems (TS) considered are: E) The opaque envelope, which is composed of all opaque surfaces separating the heated internal volume of the building from the external environment or other unheated spaces; G) The glazing, which consists of all transparent surfaces separating the heated internal volume of the building from the external environment or other unheated spaces; B) The building, which is the inside part of a building with internal structures, furniture, and air.
The energy balance equations on the three systems make it possible to assess the temperatures of the three systems per hour using an iterative method. The maximum number of iterations and the acceptable error were set at 1000 and 0.001, respectively.
Starting from the general energy balance equation (Equation (5)), the equations for the three thermodynamic systems G, E, and B are shown below (the following paragraphs will explain all the variables in more detail): where, for each TS, C is the heat capacity (JK −1 ); T is the temperature of the TS, air or sky (K); t is the time (s); φ sol is the heat flow rate from solar gains; φ I is the heat flow rate from internal gains; φ H is the heat flow rate from the heating system; φ T is the heat flow rate dispersed by transmission; φ V is the heat flow rate dispersed by ventilation; α is the solar absorption coeff. (-); τ is the total solar energy transmittance (-); I sol is the solar irradiance (Wm −2 ); ξ is the envelope sunny quota (-); F is the reduction factor (-); A is the envelope area (m 2 ); R is the thermal resistance (m 2 KW −1 ); U is the thermal transmittance (Wm −2 K −1 ); F r is the form factor buildings-sky (-); h r is the radiative heat flux coeff.
(Wm −2 K −1 ); c a is the air specific heat (Jkg −1 K −1 ); and . m a is the air mass flow rate (kgm −3 ). The hourly temperatures of the glazing (T G ) were obtained with Equation (6) from a balance of the thermal flows between the glazing and the building (T B ) and the glazing and the outdoor environment (T ae ); similarly, the hourly temperatures of the envelope (T E ) were calculated using Equation (7), and the hourly temperatures of the buildings were calculated using Equation (8).
The definitions of the equations and the input data of the model have been realized in order to have a building temperature equal to the set-point range during the heating season: 20 ± 2 • C. Then, it was observed that the building temperature (T B ) varied according to the outdoor climatic conditions, and therefore correlations were found with T ae and T sol-air . T sol-air was introduced because it allows one to take into account not only the outside air temperature but also the solar irradiation absorbed by the opaque envelope: where T ae is the outside air temperature ( • C), α E is the absorption coefficient (-), I sol is the incident solar irradiance (Wm −2 ), and h e is the external thermal adductance (Wm −2 K −1 ). The following subsections explain the different components of the energy balance in detail. To avoid repetitions in explaining the methodology for the three thermodynamic systems (i.e., B, E, and G), Equation (6) was used to explain the heat flux components for a generic TS.

The Heat Flow Rate from Solar Gains
The heat flow rate from solar gains (Φ sol ) is obtained directly by transmission or indirectly by absorption considering the solar irradiation through the building element (k). In accordance with standards ISO 13790:2008, ISO 52016-1:2017, and ISO 52017-1:2017, the heat flow rate from solar gains is given by: where φ sol is the heat flow rate from solar gains, α is the solar absorption coefficient (-), τ is the total solar energy transmittance (-), I sol is the solar irradiance (Wm −2 ), ξ is the envelope sunny quota (-), F is the reduction factor (-) and, A is the envelope area (m 2 ). The heat flow rate from solar gains φ sol,α was used for the envelope and glazing TSs, and Φ sol,τ was used for the building TS. In this model, the following data were used: • I sol was calculated considering the orientation and the inclination of the surfaces of the building envelope. • ξ was calculated with hourly time steps, since the height of the sun (h) and the urban canyon height-to-distance ratio (H/W) were known [6]. • α k was assumed to e equal to 0.6 for an opaque envelope (α E ), considering an intermediate color (not dark or light), while, for a transparent envelope, α G depended on the type of glass used in the different periods of construction (e.g., 0.06 for single glass in buildings built before 1976). • τ G depended on the type of glass used in the different periods of construction (e.g., 0.72 for single glass in buildings built before 1976). • the obstruction factor F k has been calculated through the view factor and the SVF (on a grid of points at the street level and on the roof of buildings with the Relief Visualization Toolbox). • A k was calculated as all geometrical characteristics, with the support of the GIS software, considering the area of the walls (A W ), the glazing area (A G ), and the opaque envelope area (A E ), taking into account the non-dispersive walls between adjacent buildings.

Heat Flow Rate from Internal Heat Sources
The heat flow rate of residential buildings, resulting from internal heat sources (φ I ), depends on the average floor area per dwelling (S f ): where q int is the internal heat flow rate (W/m 2 ), S f is the average floor area of a dwelling (m 2 ), and n is the number of dwellings in a building (-). The heat flow rate φ I was calculated using the hourly profiles of q int for daytime and nighttime due to occupants and equipment for residential buildings, according to the standards UNI/TS 11300-1:2014 and ISO 13790:2008.

Heat Flow Released from the Heating System
In Turin, the most widely used heating system is a centralized water heating system consisting of radiators and a climate control unit; only recently have room controllers been installed. In this model, the heat flow rate released from the heating system (φ H ) guarantees the set-point range in the buildings; then, when the comfort temperature is reached (i.e., 20 ± 2 • C in the daytime), the heating system is switched off.
If the heat flow rate supplied to the heating system φ S,H is known, it is possible to calculate φ H by multiplying φ S,H by the system efficiency η H : where φ H is the heat flow released into the building by the heating system (W); φ S,H is the heat flow supplied by the DH network (W); and η H is the system efficiency (-), which depends on the period of construction of the buildings.

Heat Flow Rate Lost by Transmission
The heat flow rate lost by transmission through the building envelope can be calculated considering the heat flow lost by transmission due to temperature differences and the extra heat flow due to the infrared radiation lost to the sky. The heat flow rate due to temperature differences through walls, the roof, slabs, and windows was calculated considering the thermal transmittances (U) and the thermal resistances (R) of the building element k, according to the thermal properties of common building elements for the different periods of construction (UNI-TR 11552:2014). φ T,t was calculated in accordance with ISO 13790:2008, and it is given by: where φ T,t is the heat flow rate lost by transmission (W), k is the envelope element (-), A k is the area of the element k (m 2 ), R k is the thermal resistance (m 2 KW −1 ) of the building element k, R s is the surface thermal resistance (m 2 KW −1 ) (R se =0.04 m 2 KW −1 , R si = 0.13 m 2 KW −1 for a horizontal heat flow, 0.17 m 2 KW −1 for a downward heat flow, and 0.10 m 2 K −1 W for an upward heat flow), b is the correction factor for unconditioned adjacent spaces (b=1 for external surfaces, b=0.5 for cellars, and b=0.9 for unheated attics), and T is the temperature of the thermodynamic system [K]. The extra heat flow due to thermal radiation lost to the sky (φ T,r ), for opaque and transparent building elements is given by: where F r is the form factor between a building element and the sky (-), R se is the external surface thermal resistance (m 2 KW −1 ), U k is the thermal transmittance of the element k (Wm −2 K −1 ), A k is the projected area of the element k (m 2 ), h r,k is the radiative heat transfer coefficient (Wm −2 K −1 ), and T is the temperature of the external air and sky (K). The form factor F r depends on the presence of obstructions (F sh,ob ) and was calculated as a function of the sky view factor (SVF) and the view factor that depends on the surface inclination (γ). The radiative heat transfer coefficient h r,k was calculated according to ISO 13790:2008, with the emissivity ε of the external surfaces assumed to be equal to 0.9 for opaque elements and 0.873 for glass without low-emission coatings.

Heat Flow Rate from Ventilation
The heat flow rate from ventilation (φ V ) depends on the heat capacity of the air per volume (ρ a ·c a ), the number of air changes per hour (ach), and the temperature differences of the air: where ρ a is the air density (kgm −3 ), c a is the air specific heat (Jkg −1 K −1 ), ρ a ·c a the heat capacity of air per volume (Jm −3 K −1 ), . m a is the air mass flow rate (kgm −3 ), ach are the number of air changes per hour (h −1 ), V is the volume of air (m 3 ), and T a is the air temperature inside and outside the building (K).
Firstly, a constant air change rate ach= 0.5 h −1 was assumed during the day (24 h), considering natural ventilation through infiltrations (widely used in Italy in residential buildings). In the second phase of this work, in order to improve the accuracy of the model, ach was assumed to be variable during the daytime and nighttime; ventilation heat losses are minimal during the night due to the presence of shutters. Finally, ach was calculated considering that when the building temperature exceeds the set-point range, users can open windows; therefore, the air change rate can be calculated considering a quota for infiltrations and a quota for window openings. Then, the number of ach for the window openings was calculated according to [45] (in Figure 4).
where Fr is the form factor between a building element and the sky (-), Rse is the external surface thermal resistance (m 2 KW −1 ), Uk is the thermal transmittance of the element k (Wm −2 K −1 ), Ak is the projected area of the element k (m 2 ), hr,k is the radiative heat transfer coefficient (Wm −2 K −1 ), and T is the temperature of the external air and sky (K). The form factor Fr depends on the presence of obstructions (Fsh,ob) and was calculated as a function of the sky view factor (SVF) and the view factor that depends on the surface inclination (γ). The radiative heat transfer coefficient hr,k was calculated according to ISO 13790:2008, with the emissivity ε of the external surfaces assumed to be equal to 0.9 for opaque elements and 0.873 for glass without low-emission coatings.

Heat Flow Rate from Ventilation
The heat flow rate from ventilation (ϕV) depends on the heat capacity of the air per volume (ρa · ca), the number of air changes per hour (ach), and the temperature differences of the air: where ρa is the air density (kgm −3 ), ca is the air specific heat (Jkg −1 K −1 ), • the heat capacity of air per volume (Jm −3 K −1 ), ̇is the air mass flow rate (kgm −3 ), ach are the number of air changes per hour (h −1 ), V is the volume of air (m 3 ), and Ta is the air temperature inside and outside the building (K).
Firstly, a constant air change rate ach= 0.5 h −1 was assumed during the day (24 h), considering natural ventilation through infiltrations (widely used in Italy in residential buildings). In the second phase of this work, in order to improve the accuracy of the model, ach was assumed to be variable during the daytime and nighttime; ventilation heat losses are minimal during the night due to the presence of shutters. Finally, ach was calculated considering that when the building temperature exceeds the set-point range, users can open windows; therefore, the air change rate can be calculated considering a quota for infiltrations and a quota for window openings. Then, the number of ach for the window openings was calculated according to [45] (in Figure 4).

Model Application
The presented thermal balance model was applied to a district in the city of Turin (IT). Turin is located in the northwestern part of Italy, and it has a temperate continental climate (Italian zone E), with 2648 Heating Degree Days (HDD) at 20°C (UNI 10349-3:2016). There are about 60,000 heated buildings in the city, nearly 45,000 of which are residential. These are mainly large and compact blocks of apartments, and 80% of them were built before 1976, before the first Italian law on building energy savings [6]. The energy consumption for space heating in Turin is rather important due to the high building density, the low level of energy efficiency of the buildings, and the cold climate;

Model Application
The presented thermal balance model was applied to a district in the city of Turin (IT). Turin is located in the northwestern part of Italy, and it has a temperate continental climate (Italian zone E), with 2648 Heating Degree Days (HDD) at 20 • C (UNI 10349-3:2016). There are about 60,000 heated buildings in the city, nearly 45,000 of which are residential. These are mainly large and compact blocks of apartments, and 80% of them were built before 1976, before the first Italian law on building energy savings [6]. The energy consumption for space heating in Turin is rather important due to the high building density, the low level of energy efficiency of the buildings, and the cold climate; therefore, a DH network was built in 2000 to distribute energy effectively and reduce the high emissions of individual boilers; the DH network is currently connected to 60.3 Mm 3 of buildings with about 600,000 inhabitants in Turin [46].
In this work, the DH energy consumptions were used to design, optimize, and validate the dynamic urban-scale energy model. The definition of the model was carried out by choosing the input data and defining the balance equations in order to have comfortable temperatures in the buildings. Then, the model was optimized by finding correlations between the temperature of the building and the climatic conditions. The validation of the model was carried out using the model to calculate energy consumptions, setting the internal temperature of the building according to the external climatic Sustainability 2020, 12, 5678 14 of 33 conditions. The model was applied to a total of 92 residential buildings grouped in four clusters of various periods of construction in a central district of Turin.

Input Data
In this section, the main input data used for the model are described. All the data were geo-referenced, and a DBT for the city of Turin was created with the support of the GIS tool.
The energy consumptions of the buildings were provided by the Iren DH company and elaborated at hourly time steps. Starting from 102 residential buildings (whose thermal consumption was known for the 2013-2014 heating season), 92 were selected for the model application. The first selection was made considering only buildings with the heating system switched off during the night (typical of Italian buildings). Then, the other six buildings were excluded from this analysis due to anomalous/missing data. The local climate conditions were elaborated using hourly data (i.e., air temperature, relative humidity, solar irradiation) measured at the Politecnico di Torino WS.
The main thermo-physical and geometric parameters of the building elements are indicated in Tables 3 and 4. Table A1 in Appendix A reports the other main data used for the 92 analyzed residential buildings.
Data on the thermal transmittances (U) and relative thermal resistances (R) of the building elements for different periods of construction are reported in Table 3. The U data in the GIS database were calculated for each building according to its period of construction, distinguishing U values for vertical walls, glass, cellar slabs (with an adjustment factor b equal to 0.5), and ceiling slabs in unheated attics with un-insulated roofs (with an adjustment factor b of 0.9).
The heat capacities of the building elements are reported in Table 4 according to the period of construction. For the envelope elements, the thermal capacity reported considers the recurring stratigraphies for the different construction periods (UNI/TR 11552:2014). For the building, we started from the value of 165,000 J/m 2 /K (per m 2 of envelope, from UNI/TS 11300-1:2014), which considers the inside part of the building plus 10 cm of the internal envelope; subtracting this last quota, the value of 30,496 J/m 2 /K was obtained (per m 2 of net heated surface, considering that air and furniture have a heat capacity of 10,000 J/m 2 /K, ISO 52016-1:2017).

Building Clusters
In order to represent the average energy behavior of residential buildings, groups of buildings with similar characteristics were identified. This analysis can simplify the application of the model on an urban scale. Building archetypes were identified by analyzing the energy consumption profiles, the thermo-physical and geometric parameters, and the typology of the heating systems. The main energy-related variables identified for the building archetypes were the volume, the area of dispersing surfaces, the envelope technology, the percentage of windowed area, and the type and efficiency of the heating system [46]. The "surface-to-volume" (S/V) ratio was not considered because is quite constant, with an average value of 0.28 m −1 and a standard deviation of 0.04 (i.e., large apartment buildings). Then, after analyzing the trend in heating consumption, the buildings were grouped into four construction periods and with different envelope technologies, percentages of windowed area, and types and efficiencies of the heating system. Table 5 indicates the characteristics of each cluster and the main input data that were used to analyze the energy balance model. The following discussion is on the four clusters, which have similar volumes (only cluster 4 has different values of net heated volume and floor due to low values of occupancy) and therefore allow a comparison of their results. Period of construction 1919-1945 1946-1960 1961-1970 1971-1980

Typical Monthly Days
The hourly data on the external air, solar-air and sky temperatures, relative humidity, solar irradiation, and position of the sun from the Politecnico WS were elaborated, and 34 typical days were identified for the 2013-2014 heating season. These days were selected to identify all the possible climate conditions during a heating season, with daily T ae = 1.70−7.97 • C and I sol,d = 169−5774 Wh/m 2 /d. Table 6 indicates the characteristics of the 34 typical days that were identified. Date 1 and date 2 were chosen with similar outdoor air temperatures but different solar irradiation conditions.

Results and Discussion
The main results pertaining to the analyses of the energy consumptions of buildings and clusters of buildings, the heat flow components of the energy balance, the trends of the temperatures of the three thermodynamic systems, and the application of the hourly energy balance model to clusters of buildings are reported in the following sections.

Building Cluster Identification
In a previous study [47], it had been shown that the hourly consumption profile for the space heating of buildings depends on the type of building, its level of energy efficiency, and the local climate conditions. For this case study on compact residential buildings, these characteristics can be represented by grouping the buildings by periods of construction. Four periods have been identified with different geometrical and material characteristics, types of envelope, and types of systems: 1919-1945, 1946-1960, 1961-1970, and 1971-1980 (new buildings in the urban environment are few and therefore it is more difficult to make this analysis).
The specific energy consumptions of the four clusters of buildings for four typical days are represented in Figure 5. It can be observed that the hourly energy consumption profiles of the clusters have a typical trend-the buildings have a night-time heating interruption, with a peak at 6 in the morning and a quite constant consumption up to 8 p.m. In general, the energy peak of the clusters decreases as the outdoor temperature (T ae ) increases. If the percentage of energy consumed daily is represented, the opposite would be observed: the percentage of energy consumed at 6 a.m. is higher if the outside temperature increases (as also reported in [47]). In addition, with the percentage of daily consumption, buildings that consume less have a higher peak at the same outdoor temperature: from 10% to 16% for the 1919-1945 period, from 9% to 15% for 1945-1960, from 8% to 12% for 1961-1970, and from 8% to 11% for 1971-1980. Moreover, consumption is constant at 6% from 9 a.m. to 8 p.m., regardless of the temperature and period of construction. The specific consumption per m 3 has been represented because the four clusters do not have the same heated volume (see Table 6). Figures 6-9 show the trend of all the heat fluxes components and consequently the resulting trends of the temperatures of the three thermodynamic systems: building, opaque envelope, and glazing. The heat flux components in Equation (5) can be observed on the left; the heat flux through ventilation, φ V (light blue), is quite constant. The temperatures of the three thermodynamic systems (B, E, and G) are represented, with the outside air temperature and the solar irradiance, on the right. These representations allowed us to control the input data and the weight of the energy balance components.  (5) can be observed on the left; the heat flux through ventilation, ϕV (light blue), is quite constant. The temperatures of the three thermodynamic systems (B, E, and G) are represented, with the outside air temperature and the solar irradiance, on the right. These representations allowed us to control the input data and the weight of the energy balance components. Figure 6 shows the results of the energy balance model with a number of constant air changes per hour of 0.5 h −1 over 24 hours for the typical day of February 22 nd 2014, with a Tae= 6.24 °C. It can be observed that the temperature of the building, TB, (in green), has a constant diurnal and nighttime trend; the set-point range (20 ± 2 °C) is reached during the day. Similar results have been obtained applying the energy balance model with variable ventilation between daytime (ach = 0.62 h −1 ) and nighttime (0.3 h −1 ) in Figure 7. Compared to the previous model (with constant ventilation), during the day the dispersions due to ventilation are slightly higher, and consequently the temperature B is lower. Figures 8 and 9 show results considering a variable number of air changes per hour and the opening of windows for typical days in February and October (the windows have been opened when the building temperature exceeds 22 °C). In Figure 8, the heat fluxes for February 22 nd 2014 can be observed on the left with a clear difference in the heat flux from ventilation between the day and night and the high variation due to window openings. The temperature trend on the right is similar, but the temperature of the buildings does not exceed 22 °C.
The results of the energy balance model with a variable number of air changes per hour and the opening of windows have been presented also for a typical day in October, that is, October 24 th 2013, with Tae = 16.3 °C (Figure 9). In general, it is possible to see, on the left, the increase in the ϕV, due to the windows opening at 2 p.m. A similar trend can be seen for clusters 3 and 4, where the windows were opened more times, with a consequent stabilization of the building temperature.  Figure 6 shows the results of the energy balance model with a number of constant air changes per hour of 0.5 h −1 over 24 hours for the typical day of February 22nd 2014, with a T ae = 6.24 • C. It can be observed that the temperature of the building, T B, (in green), has a constant diurnal and nighttime trend; the set-point range (20 ± 2 • C) is reached during the day. Similar results have been obtained applying the energy balance model with variable ventilation between daytime (ach = 0.62 h −1 ) and nighttime (0.3 h −1 ) in Figure 7. Compared to the previous model (with constant ventilation), during the day the dispersions due to ventilation are slightly higher, and consequently the temperature B is lower. Figures 8 and 9 show results considering a variable number of air changes per hour and the opening of windows for typical days in February and October (the windows have been opened when the building temperature exceeds 22 • C). In Figure 8, the heat fluxes for February 22nd 2014 can be observed on the left with a clear difference in the heat flux from ventilation between the day and night and the high variation due to window openings. The temperature trend on the right is similar, but the temperature of the buildings does not exceed 22 • C.
The results of the energy balance model with a variable number of air changes per hour and the opening of windows have been presented also for a typical day in October, that is, October 24th 2013, with T ae = 16.3 • C (Figure 9). In general, it is possible to see, on the left, the increase in the φ V , due to the windows opening at 2 p.m. A similar trend can be seen for clusters 3 and 4, where the windows were opened more times, with a consequent stabilization of the building temperature.         Figure 10 shows a representation of the positive and negative heat flux contributions for seven typical days that have been selected from Table 6 (remember that cluster 4 has a smaller useful surface area and volume). It is possible to observe that the heat flux for space heating is higher in the cold months of December and January, the thermal losses by transmission through opaque envelope and glazing and by ventilation vary according to the external local climate conditions  Figure 10 shows a representation of the positive and negative heat flux contributions for seven typical days that have been selected from Table 6 (remember that cluster 4 has a smaller useful surface area and volume). It is possible to observe that the heat flux for space heating is higher in the cold months of December and January, the thermal losses by transmission through opaque envelope and glazing and by ventilation vary according to the external local climate conditions and are higher in cold months, the internal gains are constant, and the solar gains through windows are higher in the warmer months (October, March and April).    Comparing the four clusters of buildings with different periods of construction, is possible to observe that the night and daytime building temperatures are quite stable and depend on both the characteristics of the buildings and on the external climatic conditions. This behavior suggests that it would be possible to hypothesize some correlations between the climatic conditions and the day and night temperatures of the building, T B .
The linear correlations between T B , T air , and T sol-air are reported in Figure 12 for the different ventilation conditions. In particular, Figure 12a The building temperatures, TB, are represented in Figure 11, where the climate conditions for four typical days are shown, with a Tae = 3.7, 7.4, 11.2, and 15.3 °C. The solid lines represent the results of TB with constant ventilation with ach = 0.5 h −1 , the dashed lines refer variable ventilation between daytime (ach = 0.62 h −1 ) and nighttime (0.3 h −1 ), and the dotted lines represent the ach variable and windows opening. The temperature of the three ventilation models is very similar for colder days. The difference with window openings can be observed only for higher temperatures (dotted lines).   The Figure 13 shows the comparison between the simulated and measured daily thermal consumptions applying the model with the correlations for the building temperature and the three different ventilation conditions. A very good accuracy can be observed by comparing the simulated and measured values for each period of construction for the model with ach constant; the accuracy decreases with a variable ach and the last model with a variable ach and window openings is not accurate enough. This result attests that, in Turin, ventilation can be represented with the model of constant infiltration (during the analyzed heating period).
In Figure A1 of Appendix A, the comparison between the calculated and measured monthly energy consumption data are represented. The main conclusions are the same: the model that best represents the results is the one with constant ventilation; this model with a constant air change rate ach of 0.5 h −1 was chosen. This type of model can be applied at the urban scale to represent the distribution of energy consumptions, evaluate the heat peak in every zone of a city, access the potential of renewable energy technologies that can be useful to meet that energy demand profile, and analyze the further expansion of a district heating network. All these applications can improve the security, sustainability, and affordability of the energy system and therefore the energy resilience of an urban environment.
In Figure 14, an example of the hourly model application to the city of Turin is represented. By changing the building attributes on the right, the results of this solution can be obtained.
Comparing the four clusters of buildings with different periods of construction, is possible to observe that the night and daytime building temperatures are quite stable and depend on both the characteristics of the buildings and on the external climatic conditions. This behavior suggests that it would be possible to hypothesize some correlations between the climatic conditions and the day and night temperatures of the building, TB.  The linear correlations between TB, Tair, and Tsol-air are reported in Figure 12 for the different ventilation conditions. In particular, Figure 12a  consumptions applying the model with the correlations for the building temperature and the three different ventilation conditions. A very good accuracy can be observed by comparing the simulated and measured values for each period of construction for the model with ach constant; the accuracy decreases with a variable ach and the last model with a variable ach and window openings is not accurate enough. This result attests that, in Turin, ventilation can be represented with the model of constant infiltration (during the analyzed heating period).  In Figure A1 of Appendix A, the comparison between the calculated and measured monthly energy consumption data are represented. The main conclusions are the same: the model that best represents the results is the one with constant ventilation; this model with a constant air change rate ach of 0.5 h −1 was chosen. This type of model can be applied at the urban scale to represent the distribution of energy consumptions, evaluate the heat peak in every zone of a city, access the potential of renewable energy technologies that can be useful to meet that energy demand profile, and analyze the further expansion of a district heating network. All these applications can improve the security, sustainability, and affordability of the energy system and therefore the energy resilience of an urban environment.
In Figure 14, an example of the hourly model application to the city of Turin is represented. By changing the building attributes on the right, the results of this solution can be obtained.

Conclusions
In this work, the energy balance that has been studied for a single residential building has been simplified in order to use it at an urban scale with the existing databases (e.g., the Municipal Technical Maps that are available for every city), for groups of buildings with similar characteristics, and evaluate the distribution of space heating consumption in an urban context. The geometrical and typological characteristics of buildings were evaluated by geo-referencing information on building consumption using a GIS tool. This analysis was carried out on 92 residential buildings and on 4 groups of buildings with similar space heating consumptions and characteristics.
The main findings of the presented work can be summarized as follows: • The presented model allows us to make fairly accurate forecasts on the consumption of buildings with the data available on an urban scale; of course, the existing tools are more accurate but do not allow analysis on cities, have much longer calculation times, and need data that is often not available.

•
The best results were obtained with the building temperature variable according to the external climatic conditions and considering a constant ventilation by infiltrations of 0.5 ach.

•
The use of a GIS tool allows us to design a very flexible urban-scale model, use data with different scales, manage the existing free databases, and map the results with a spatial Figure 14. Example of urban-scale energy tools: 3D city model; building attributes; energy, GHG emissions, and comfort estimation.

Conclusions
In this work, the energy balance that has been studied for a single residential building has been simplified in order to use it at an urban scale with the existing databases (e.g., the Municipal Technical Maps that are available for every city), for groups of buildings with similar characteristics, and evaluate the distribution of space heating consumption in an urban context. The geometrical and typological characteristics of buildings were evaluated by geo-referencing information on building consumption using a GIS tool. This analysis was carried out on 92 residential buildings and on 4 groups of buildings with similar space heating consumptions and characteristics.
The main findings of the presented work can be summarized as follows: • The presented model allows us to make fairly accurate forecasts on the consumption of buildings with the data available on an urban scale; of course, the existing tools are more accurate but do not allow analysis on cities, have much longer calculation times, and need data that is often not available.

•
The best results were obtained with the building temperature variable according to the external climatic conditions and considering a constant ventilation by infiltrations of 0.5 ach.

•
The use of a GIS tool allows us to design a very flexible urban-scale model, use data with different scales, manage the existing free databases, and map the results with a spatial distribution on the territory. • Energy models and tools, such as the one proposed here, could be used at the territorial scale to: 1. identify effective energy policies for the city, considering the real characteristics of buildings, population, and urban morphology; 2.
create an easily upgradable energy atlas for buildings, related to the existing territorial databases; 3.
evaluate the feasibility of establishing energy communities and grouping private and public entities, considering their energy consumptions and productions to reach energy security with a low environmental impact and good socio-economic effects.
The novelty of this simplified energy balance model concerns the possibility of applying it at the urban scale with the introduction of urban variables into the energy balance equations in order to consider the real characteristics of the urban context (with the sky view factor SVF, the urban canyon effect H/W ratio, and the solar exposition). These simplified engineering models can be used in an urban energy atlas to support decision-making in order to study how to improve the energy resilience of neighborhoods and cities with a place-based tool.

Conflicts of Interest:
The authors declare no conflict of interest. Figure A1 shows the comparison between the simulated and measured monthly thermal consumptions.
The simulated thermal consumptions have been calculated using the three dynamic thermal balances: (i) a constant air change rate n = 0.5 h −1 ; (ii) a variable ach during the daytime and nighttime; (iii) a variable ach considering a quota for infiltrations and a quota for window openings.  Figure A1 shows the comparison between the simulated and measured monthly thermal consumptions. The simulated thermal consumptions have been calculated using the three dynamic thermal balances: (i) a constant air change rate n = 0.5 h −1 ; (ii) a variable ach during the daytime and nighttime; (iii) a variable ach considering a quota for infiltrations and a quota for window openings.