An Overview on Functional Integration of Hybrid Renewable Energy Systems in Multi-Energy Buildings

Buildings are responsible for over 30% of global final energy consumption and nearly 40% of total CO2 emissions. Thus, rapid penetration of renewable energy technologies (RETs) in this sector is required. Integration of renewable energy sources (RESs) into residential buildings should not only guarantee an overall neutral energy balance over long term horizon (nZEB concept), but also provide a higher flexibility, a real-time monitoring and a real time interaction with end-users (smart-building concept). Thus, increasing interest is being given to the concepts of Hybrid Renewable Energy Systems (HRES) and Multi-Energy Buildings, in which several renewable and nonrenewable energy systems, the energy networks and the energy demand optimally interact with each other at various levels, exploring all possible interactions between systems and vectors (electricity, heat, cooling, fuels, transport) without them being treated separately. In this context, the present paper gives an overview of functional integration of HRES in Multi-Energy Buildings evidencing the numerous problems and potentialities related to the application of HRESs in the residential building sector. Buildingintegrated HRESs with at least two RESs (i.e., wind–solar, solar–geothermal and solar–biomass) are considered. The most applied HRES solutions in the residential sector are presented, and integration of HRES with thermal and electrical loads in residential buildings connected to external multiple energy grids is investigated. Attention is focused on the potentialities that functional integration can offer in terms of flexibility services to the energy grids. New holistic approaches to the management problems and more complex architectures for the optimal control are described.


Introduction
Reducing building energy consumption is of foremost importance to meet the European goal of being climate-neutral by 2050. Indeed, buildings and building sectors combined are responsible for over 30% of global final energy consumption and nearly 40% of total direct and indirect CO 2 emissions [1]. Despite energy efficiency, fuel switch policies and the penetration of renewable energy sources (RESs) over the past 40 years, energy demand from buildings is constantly growing, driven by improved access to energy in developing countries, more extensive use of energy-consuming devices, growth in global buildings floor area and rapid urbanization. Therefore, an extensive penetration of renewable energy technologies (RETs) will be required in the next few years to meet building energy demand.
As a matter of fact, in the last two decades [2], RETs have undergone massive development and rapid penetration, so much that the share in gross final energy consumption increased from 9% in 2005 to 17% in 2020 [3]. However, there are still several barriers for Buildings. Actually, existing reviews about HRES in this regard appear to be sectoral (i.e., focusing only on a single type of energy source), mostly referred to electric power generation in smart and micro grids [13,15,[34][35][36][37][38][39], or on the integration of the two thermal and electrical production systems regardless of their integration within the building.
To this end, over 200 research papers were analyzed by the authors, with particular focus on papers dated between 2010 and 2020, in order to include the latest developments in these technologies. It is highlighted that the scope of this work is not that of giving an extensive literature review about HRESs since, given the high scientific production, this would be inapplicable. The aim of this work is rather to focus the attention of the readers from different sectors (i.e., thermal and electrical) to have an overview intended to address, with a systemic approach, the numerous problems and potentialities related to the application of HRES systems in the residential building sector. Indeed, in this sense the integration, although strongly desired, is still not fully achieved, also due to the different "languages" spoken by the leading experts in respective fields.
This paper is organized as following: Section 2 provides a review of the state-of-the-art of building-integrated HRES. Section 3 presents the issues that arise when installing HRES in residential buildings. Section 4 provides an insight into HRES functional integration in Multi-Energy Building, by introducing models of HRESs and loads and investigating the approaches to be adopted for the optimal design, management and control. The conclusions section is intended to analyze the future prospects of HRESs in the residential sector.

Building-Integrated HRES
As already said, this work is focused on HRESs obtained by coupling two or more RETs with thermal, electrical and chemical energy storage systems (respectively, TES, EES and CES) and with auxiliary (AUX) energy systems ( Figure 1). The whole system is generally controlled by a supply management system, that is designed and optimized to fulfil different objectives, such as maximizing the use of renewables, providing higher efficiency values and carbon free power production using together two different or more renewable sources [18]. As well known, six major RESs are available: bioenergy, hydropower, geothermal, wind, solar, and ocean energy [40]. For building integration purposes, devices for harvesting solar, wind, low-enthalpy geothermal, and biofuel power can be reasonably integrated to meet the local thermal and electrical demand, with different levels of implementation difficulty and diffusion rates; on the other hand, hydropower and ocean energies have almost no possibilities to be integrated within residential buildings due to different factors, such as space, size of equipment, availability, etc. [26]. For similar reasons, solar RETs, such as photovoltaic panels and solar thermal collectors have the greatest potential for architectural integration, thanks to the possibility to adapt their shape, color, dimensions, superficial finishing, type of material, etc. [41][42][43].
The RETs applicable to the residential sector for energy conversion of the main RESs are shown in Table 1. Table 1. RETs applicable to the residential sector for energy conversion.

Wind
Wind turbine (WT) [55] Electrical energy Low-enthalpy geothermal Ground-source heat pumps (GSHPs) [56,57] Thermal energy Referring to small scale residential applications, TES can be classified into thermochemical, latent, and sensible. Deployment of thermochemical technology for residential use is still in early development (few prototypes, high costs and no long-term experience). Latent TES utilizes the latent heat of a phase change material, allowing to store the thermal energy in freezing or melting mediums, both for active (i.e., when used as actual components of the heating/cooling system) and passive (i.e., when integrated in the building envelope, such as transparent surfaces) applications. Although very promising, the use of phase change materials as TES systems in residential buildings is limited, due to a number of reasons mainly connected to phase change materials characteristics (melting temperatures, toxicity, costs, etc.). Sensible TES are the most widely applied systems in which the thermal energy is stored using the heat capacity of liquid mediums. Among these, water-based storage tanks play a major role in the residential sector, due to the high specific heat capacity, the natural stratification into thermal layers, the good controllability of heat transfer, and the easy integration with mostly water based residential heating systems [58].
CES are typically represented by hydrogen energy storages and composed by a fuel cell, an electrolyzer and a high-pressure container [63].
Finally, AUX systems are mainly represented by fossil fuels-powered energy systems, whose function is to provide energy on-demand when RESs are lacking. Combustion boilers and µCHP systems are included in this category. A review of µCHP systems applicable to the residential sector is provided in [45], including reciprocating engines, Stirling engines, micro turbines, organic Rankine cycles, and fuel cells.
That said, the choice of the type of HRES has to be made case by case, taking into consideration a number of factors, which may be classified into different categories: (i) sitespecific factors [64], such as climatic data, RES availability, grid-connection availability, etc.; (ii) user-specific factors, such as energy demand of the building, thermal and electrical load profiles of the users, the type of system installed (systems for heating, power production etc.) etc.; (iii) internal techno-economic factors, such as capital costs, price of equipment, etc.; (iv) external techno-economic factors such as energy carriers' prices, available subsidies, etc.
In this paper, basing on existing scientific literature, the authors classified HRESs for residential applications which use two or more RETs into four main groups: wind-solar hybrid systems, solar-geothermal hybrid systems and solar-biomass hybrid systems and other hybridizations. Table 2 summarizes the main outcome of this section, highlighting, for each hybridization, the respective advantages and disadvantages. In the table, complementarity is highlighted in all the HRES analyzed since this is a main advantage of HRES integrating two or more RESs. Spatial complementarity is defined when the scarcity of one RES in a region is complemented by its availability in another region at the same time, while temporal complementarity can be observed between two or more RESs in the same region [65].

Wind-Solar Hybrid Systems
Wind-solar hybrid utilization is a promising strategy to increase the renewable consumption of a residential building, due to the complementary nature of those RESs. The rationale of a wind-solar hybrid system lies in the possibility to mitigate one of the main issues related to the use of RESs in residential buildings which is the availability of wind and solar RESs both at a daily scale and a seasonal scale. Indeed, in most climates, such as the one of the northern European regions, when the availability of solar radiation is high (i.e., in summer/during sunny days), that of wind energy is lower and vice versa (i.e., in winter/during nights) and one source can balance the lack of the other, leading to cover a greater part of the energy demand of buildings while reducing the need for battery storage. In this context, the potential for temporal complementarity between wind and solar RESs has been explored in numerous contributions [65][66][67].
The literature [68][69][70][71][72][73][74] mainly refers to wind-solar hybrid systems to those consisting of a WT, PV-Ps and EES. When combined with traditional generators (such as internal combustion engines, etc.), wind-solar systems have a high potential to be employed for the electrification of rural houses for off-grid applications [75,76]. The integration of wind-solar RESs allows the development of promising applications [77], in the transport sector for the electric vehicle charge [78][79][80][81], in the Heating, Ventilation, and Air Conditioning (HVAC) systems and domestic hot water production to supply heat pumps [82][83][84] and, generally, to meet the electrical energy demand of nonresidential and residential buildings [13,85]. The wind-solar hybrid system is characterized by high capital costs, and low operating and maintenance costs.
Couplings of wind-solar hybrid systems with electrolyzer, fuel cells, and optional hydrogen storage has been also proposed in the scientific literature [86][87][88][89][90][91][92][93][94]. Among all, combination of WT, PV-Ps and/or STCs with thermodynamic heat pumps [83,95] represents a very attractive solution, for the possibility to supply electricity, heating and cooling energy, for the higher thermal energy efficiency of thermodynamic heat pumps, the crossover between the thermal energy flow and the electrical energy flow, which enables greater flexibility in the energy management of the global system [95]. In particular, in [96] it has been demonstrated that replacing two-thirds of the STC by PV-Ps associated with a thermodynamic heat pump can be more effective than one providing directly the thermal energy to ensure thermal needs. In [97], adopting a wind-solar hybrid system and heat pumps limit the building peak power demand and maximize the self-consumption of on-site renewable electricity.

Solar-Geothermal Hybrid Systems
Referring to solar-geothermal systems, in [98], it is demonstrated that adding geothermal energy to a hybrid renewable energy system can lead to an improvement of about 5.5% of the renewable fraction, decrease emissions and fossil fuel consumption by almost 48%. Solar and geothermal energies have been found to be highly complementary both in the case of space heating and in space cooling applications [99][100][101], being able to cover a great part of the energy demand in residential applications.
GSHPs can be integrated with STCs for space heating purposes, resulting in a solarassisted GSHP. Referring to heating-dominated load profiles, the latter system presents the advantage to minimize the thermal drift [102], by consequently decreasing of the total borehole length, together with the investment costs. In [103], a comprehensive review on solar assisted GSHPs is provided, which demonstrated that advanced configurations of solar assisted GSHPs with PV-Ps provide high performance and shorter payback periods when trigeneration (combined production of heating, cooling and electricity) is applied. Additionally, hybridization of solar and geothermal systems has been proven to be particularly effective also for space cooling purposes [104,105]. Indeed, even if in EU the main use of energy is still represented by space and water heating, there is a high variability of these shares among different Member States, depending on climatic conditions, cultural and social aspects, characteristics of the building stock and space cooling energy use is expected to rapidly grow across the world in the next coming decades [106].
Few works evaluate the possibility to integrate solar-geothermal hybrid systems to provide both thermal and electrical energy [96,[99][100][101]107]. In [96], a small, grid-connected hybrid system for energy supply of a standard household, is analyzed in terms of technical and economic feasibility, demonstrating the cost effectiveness of coupling GSHP for heating/cooling and PV-Ps. In [99], the mutual interaction of a PV-Ps and GSHP in the context of a residential building is proposed to allow the maximum self-consumption of the energy generated by PV-Ps. In [100], the authors conclude that the combination of a PV-Ps and GSHP is a perfect matching since the two systems do not compete for the same domestic heating load. In fact, the GSHP electricity need during the summer months in combination with the household electricity load make it possible to install larger PV-Ps. In [101], a system concept, consisting of PV/T-Cs and a GSHP, has been simulated showing that this system is able to cover 100% of the total heat demand for a typical newly-built Dutch one-family dwelling, while covering nearly all of its own electricity use and keeping the long-term average ground temperature constant.

Solar-Biomass Hybrid Systems
Solar-biomass hybrid systems have attracted considerable attention from researchers for several thermodynamic, economic and environmental reasons [108,109]. Indeed, they are characterized by steady performances, source abundancy, carbon neutrality, low costs, as well as flexible production scale [110]. It is well known that the use of biomasses has the highest potential for integration in residential buildings, since the heat supply for smaller communities can easily be met with biofuel generators, without substantial modifications of the heating systems. Complementarity between solar and biomass sources in hybrid systems has been proved to be high [110] in case of suitable HRES system optimization.
Most of the studies available on solar-biomass hybrid systems focus on drying [111], power generation [112,113], biomass gasification [114] or multi-generation [108,115,116], while only few on residential energy supplying [110,117]. In [110], a hybrid solar-biomass trigeneration system is proposed to explore the complementarity of biomass and solar energy on the energy efficiency. It is demonstrated that the biomass subsystem has a greater contribution to the total system energy efficiency than that of the solar one and that high biomass energy ratio always corresponds to a higher energy efficiency. In [118], a novel hybrid solar-biomass energy supply system is designed and evaluated in terms of thermodynamic performance and practical feasibility. The system mainly consists of a solar subsystem and a biomass subsystem and is used to supply heat energy for the anaerobic reactors and a nearby building. The daily excess biogas is used to provide cooking fuel to the surrounding households. The results of [118] indicate that the average annual energy efficiency and primary energy saving rate of the system are 25.18% and 94.98%, respectively, and the carbon emissions reduction is about 2961.85 (tons/year). Combination of solar energy with organic Rankine cycles for electricity and space heating demand is also gaining interest. As for example, in [119] is presented a combined cooling, heating and power system that integrates STCs with a single-effect absorption chiller and an organic Rankine cycle. Results of [119] indicate that a maximum solar efficiency of 94% for the combined production can be achieved, with up to 7% efficiency for power production. In [120], the potentialities of a solar-biomass hybrid system based on STCs and BBs and an innovative reversible hybrid heat pump with organic Rankine cycle for addressing heating, cooling and domestic hot water demand of residential buildings is explored in three cities (Madrid, Berlin and Helsinki). The results of [120] show that in standard multifamily houses, up to 70% of heating demand and 100% of cooling demand can be covered by the system in warmer climates and up to 60% share of renewables can be reached in Northern climates.

Other Hybridizations
Despite a higher level of complexity, several other hybridization strategies have been evaluated in the scientific literature including more than two RESs. These will be briefly discussed below.
In [121], the authors propose and evaluate the technical and economic viability of a smart integrated renewable energy systems in remote and rural areas. The system is primarily composed of biogas digesters and stoves, WTs, PV-Ps, pico-hydro power plants, water storage tanks, biogas powered generator, batteries, fuel cells; it is used for a multioutput use (biogas for cooking, water for domestic and irrigation use, electricity). It is found that the employment of the proposed system costs at about 40% less when compared with other current approaches including grid extension. In [122] the authors have presented a hybrid zero-energy system consisting of a zero-energy building supplied by GSHP, PV-Ps and a WT in Finnish and German climates. They performed a parametric analysis in the TRNSYS simulation environment to evaluate the system performance obtained from the hybrid system. The results showed that the use of a GSHP helps realizing the net zero-energy balance with less local generation, while improving the overall matching capability with marginal influence on the utilization of the cogenerated heat. In [123], the authors present an off-grid HRES consisting of PV-Ps, WTs, and biogas generator for rural electrification in Fars province, Iran. A sensitivity analyses is performed to obtain optimal system configurations on input biomass rate, biomass price, and inflation rate parameters. The most optimal economic system involves a biogas generator, PV-Ps, batteries, and converter. In [124], the authors present a feasibility assessment of a Energies 2021, 14, 1078 9 of 33 community scale HRES comprising WT, PV-Ps, biogas generator, and EES, applied to two European cities accounting for their distinct domestic biowaste profiles, renewable resources and energy practices. Biogas generators are found to make the most substantial share of electricity generation (up to 60-65% of total), hence offering a stable communityscale basal electricity generation potential, alongside reduction in disposal costs of local solid waste.

HRES in Multi-Energy Buildings
HRES have been developed to mitigate two main issues related to the use of RESs in residential buildings: (i) the limited and intermittent availability and the low energy density of RESs [125]; (ii) the existence of a mismatch between production and demand [126].
Regarding the first issue, RESs are not always and everywhere available in the necessary quantity, especially wind and sun (see Figure 2), which are available only for limited periods in a given timeframe, and the use of a single RES cannot alone guarantee a reliable production of both thermal and electrical energies [125]. In addition, low energy density is also regarded as a main weakness for RESs, with the consequence that a single source is not sufficient to support a continuous energy supply system. Thus, the use of two or more RETs allows to decrease both grid dependency and RES intermittency. Obviously, the availability and energy density of a specific RESs is intrinsically connected to the geographical location in which the building is located and its characteristics. As, for example, greater potential for bioenergy exploitation is located in South America and Caribbean, sub-Saharan Africa and the Commonwealth of Independent States and Baltic states [40]. Similarly, the greatest potential for exploitation of solar RES is geographically located in the equatorial and subtropical latitudes, while the one of on-shore wind power generation is located between North America, Russia and Australia [127].
Regarding the second issue, a mismatch problem refers to the interaction between energy supply and energy demand [126]. Table 3 shows residential energy demand, characterized in terms of end-uses, main drivers and applicable appliances. Within Table 3, loads are classified as: (i) "thermal", referring to those appliances with a thermal vector as input (i.e., fuels or fluids) and output, such as absorption chillers, heat exchangers, combustion appliances, etc.; (ii) "electrical" with reference to those appliances whose input is only electrical energy, such as lighting technologies, electrical appliances and electric vehicles; (iii) "electro-thermal" [128], referring to those specific technologies establishing a link between electrical and thermal energies (heat pumps, electric heaters, HVAC systems, etc.) by converting electrical energy into thermal energy useful to meet end uses such as heating, cooling and water heating.
The shift between RES availability and energy load profiles of residential consumers does not always allow the self-consumption of energy produced on-site from RESs ( Figure 3). As for example, direct use of electricity produced by PV-Ps and of thermal energy produced by STCs is, in most cases, unapplicable, since the peak of electricity and thermal energy production occurs in the central hours of the day, while the energy demand of a generic working day is higher during the evening and in the early morning (see Figures 2 and 3) [126]. Figure 2 refers to a Mediterranean location (such as Rome) but these punctual considerations are valid also for other regions and climates. As for example, if a cold semicontinental Baltic region was considered (such as Oslo) [129,130], solar energy would be almost unavailable in the winter months, compared to a much higher availability of wind energy and almost constant wind speed profiles throughout the day.   [131], data sourced by [129,130].
Conventionally, RES availability and load mismatch in residential buildings have been tackled exploiting the power exchange with the grids. On the other hand, this approach is no longer acceptable; in fact, huge problems are arising in the energy distribution systems because of the large-scale integration of variable RESs. In absence of appropriate flexibility mechanisms, it is increasingly difficult to manage the network imbalances between generation and demand resulting from their natural variations in real-time. Then, appropriate integration of RES in a residential building should require not only efficient strategies to ensure on-site a proper balance between supply and demand, but also could offer new options providing flexibility services to the energy grids. Flexibility services benefit both building (by increasing its revenue) and grids (by contributing to its reliability and efficiency). Case-study house located in Central Italy [132]. Percentages of the peak average daily load.
In the following, to integrate HRES in Multi-Energy Building reference is made to the system sketched in Figure 4, where three major subsystems interact with each other, namely: the HRES (RET to electricity, RET to thermal, AUXs, EES, TES, and CES), the energy grids (electric, thermal, and natural gas) and the domestic appliances (electric, thermal, and electro-thermal). The energy balance of the residential building is described with reference to thermal and electrical energy outflows. The thermal energy balance refers to outflows (in orange): 1. from: • thermal RET (see Table 1) • AUX systems (e.g., fossil-fuel based boilers and µCHP) • electro-thermal appliances (see Table 3) 2. from/to: • thermal appliances (see Table 3) • The electrical energy balance refers to outflows (in blue): 4. from: • electrical RET (see Table 1 • electrical appliances (see Table 3) • electro-thermal appliances (see Table 3) It is important to underline that, in Figure 4 the energy outflows with electrical and thermal grids are bidirectional. For example, the surplus of electrical energy generated into the building by RET during low load conditions and/or the energy stored by EES can be injected into the electric grid to offer ancillary services to the distribution network. On the other hand, in district heating thermal energy production by the end user is still not spread in most countries as in the electrical sector. Furthermore, the grid of natural gas can feed AUX systems but can also directly feed the thermal appliances such (i.e., combustion appliances) for cooking purposes. Finally, CES (typically hydrogen) can be used for fuel cells. Nevertheless, in the residential sector this solution represents more a future development than a state-of-the-art, therefore CES will not be further discussed in the following.

Functional Integration of HRES in Multi-Energy Buildings
The problem of functional integration of HRES in Multi-Energy Buildings has the scope of designing as well as of managing and controlling HRES, thermal and electrical loads, and energy exchanges with the external grids in an optimal way.

Modeling
The functional integration requires, as a first step, adequate models for HRES and loads. Then, such models together with the energies outflowing from the thermal and electrical grids are coupled to provide the building energy balance.

HRES Models
Each RET, storage and AUX system installed in the building must be modeled. The model is formed by equations representing the functional laws of the energy conversion systems and the inequality constraints derived from the operational limits of each component.

• RET to thermal
Concerning thermal RET, reference is made to BBs, STC and GSHP. For all the thermal RETs, the simplest model linking the energy input to the energy output is represented by mass and energy balance conservation equations. The most used approach is the zero-dimensional one (in which only the temporal variability of the modeled system is considered). However, in order to allow a more accurate understanding of variables involved in the process within each subsystem, a multidimensional approach should be adopted (e.g., one-/bi-/three-dimensional). In this case, alongside the mass and energy balance equations, the momentum conservation should be considered.
For a BBs, the energy output (i.e., energy to the heating medium) is determined by the input (i.e., fuel enthalpy) by subtracting the losses of the combustion chamber, the unburned residues in the ashes [133] and, finally, the heat losses in the heat exchange with the working fluid [134]. Models applicable to solid fuels (i.e., wood) have been proposed in literature [135][136][137][138][139][140]. A unified model for the simulation of space heating boilers for energy estimating purposes is proposed in [134].
Regarding STCs, models refer to the equations relating the generated thermal power to the thermodynamic variables (fluid temperature, mass flow rate, etc.) and to environmental variables (solar irradiance, air temperature, etc.). A differential equation has to be solved using different boundary conditions including, but not limited to, climatic and operational conditions as well as thermal efficiency of the collector. Steady state models, one-dimensional energy balances and thermal resistance network methods are the most widely applied [141][142][143][144]. The simplest model is the Hottel-Whillier [141] one-dimensional energy balance equation, determining the usable thermal output of a STC by solving the energy balance of the collector, under the assumptions of neglectable thermal capacities and considering a single value of collector overall heat loss. The energy transferred to the working fluid is considered as the absorbed solar energy minus the heat losses from the absorber surface. Inequality constraints are related to the minimum and maximum temperature of the STC.
The models of the GSHP represent the equations relating the generated thermal power to the thermodynamic variables (fluid temperature, mass flow rate, etc.) and to environmental variables (ground temperature, ground moisture, etc.). A compact overview of the state-of-the-art in modeling of GSHP systems is given in [145], while modeling approaches of GSHP systems are detailed in [57]. A GSHP is a complex system, whose modeling requires attention both from the point of view of the system and from that of heat exchange with the ground. Depending on applications, there are several classes of models suitable for GSHP systems [57,[146][147][148]. However, to be able to correctly reproduce both the short-term and long-term behavior of the GSHP system, a detailed model is needed including all its main components. Such a model is proposed and validated in [149,150] basing on TRNSYS dynamic simulation software. Inequality constraints have to be considered related to the to the minimization of the so-called "thermal drift" [151].

•
RET to electricity Concerning electrical RET, reference is made to PV-Ps and WTs. The models of the PV-Ps represent the nonlinear equations that relate the generated electric power to the electric variables (voltage and current) and to environmental variables (solar irradiance and the cell temperature). Moreover, the thermal equations relating the cell temperature to the solar irradiance and other ambient variables must be accounted for [152]. There are many models in literature that propose a compromise between complexity of the model and accuracy of the results [153,154]. One of the most complete and accurate models is described in [155]. In the case of PV/T-Cs, the model of the PV-Ps is extended to account for the heat collector that can be air-type or water-type. Extensive models for PV/T-Cs are presented in [156], whereas in [53] some simpler reduced models are proposed. Finally, inequality constraints must be added related to the minimum and maximum power limits of the inverter.
The WT system models represent the nonlinear equations that relate the generated electric power to the electric variables (voltage and current) and to the environmental variable (wind speed). Moreover, the model should include the various control systems that are present, such as pitch control and speed control. There are plenty of models that have been proposed in literature, but they are often oriented to the mechanical and electrical components design. A model that is adequate for the purpose of the present problem formulation is described in [157]. In this case also, inequality constraints must be added related to the limits of the power converter.

• Storage
Concerning storages, reference is made to TES and EES. As already said, hot-water tanks are the most widely spread TESs in residential sector, since they have shown to be a cost-effective option. The amount of heat stored into the tank depends on the specific heat, the mass and the temperature variation of the water Energies 2021, 14, 1078 14 of 33 through a simple energy balance. If temperature stratification is neglected, the energy balance of a hot-water tank is given by equating the thermal energy stored and the sum of the thermal energy outputs (i.e., withdrawals from user and thermal losses through the outer shell of the tank) and inputs (i.e., hot water produced). By integrating the energy balance over time, the long-term performance of the TES unit can be determined. However, long-term analytical solutions are difficult to obtain, due to the complexity of some of the time-dependent terms in the equation. For this purpose, possible numerical integration methods have been proposed [158].
For EES, the most widely used technology for residential building is the battery energy storage systems that are based on electro-chemical conversion. The models essentially represent the battery voltage as a function of current, state-of-charge (SOC) and other parameters [159]. It can be done either by analytical functions or by equivalent electric circuits, that can include nonlinear components [160]. In addition to the voltage, the model must also provide the expression of the SOC, which represents the amount of energy available in the battery compared to its maximum capacity. Typically, it is a differential equation that expresses the variations of the SOC as a function of the battery current. Inequality constraints imposed by the power conversion must also be added to represent the maximum charging and discharging power of the battery. Electric vehicles are sometimes included in the EES category. In this case, the EES model must be enriched with additional constraints representing the recharging laws and the charge limits that guarantee the fulfilment of need of the end-use, that is of the transport vehicle [161]. Indeed, electric vehicles can often be considered as controllable loads, which may assume also negative values of the absorbed power [162].

• AUX systems
Concerning AUXs, reference is made to combustion boilers and µCHP systems. The models adopted for combustion boilers sourced by fossil fuels are similar to the ones supplied by biomasses, although easier to be modeled, considering the different types of fuels used (i.e., liquids, gases). With reference to µ CHP systems, the models represent the equations relating the generated thermal and electrical powers to the input thermodynamic variables (fuel enthalpy, mass flow rate, system efficiency, etc.). Depending on the type of µ CHP system analyzed, several simulation and optimization models were proposed for predicting characteristics such as the rated capacity, control methods, environmental benefits, etc., and the system performance, while combining multiple technologies. These include but are not limited to [163][164][165][166][167][168][169].

Loads Models
Generally speaking, load modeling involves the use of standard profiles, represented by variation of the household demand over a specified time-horizon.
Typically, standard load profiles are extracted from historical data referring to similar days and applying a prediction model to represent the expected user behavior. Similar days are characterized by similar external environmental factors (i.e., seasonal effects on the use pattern in households, types of weekdays, weather conditions, emergencies) and by similar internal family factors (i.e., number of household occupants, building type, income statuses).
Standard load profiles are created by using top-down, bottom-up, or hybrid models; these latter are also referred in the literature as, respectively, black-box (physics-based), white box (data driven) and grey box (combination of physics based and data-driven) [170].
With bottom-up models [171], the total demand is obtained by aggregation of energy consumption of the single household systems (i.e., appliances, building envelope elements, heating systems, etc.) [172,173]. For this purpose, physically based equations basing on different parameters (e.g., thermo-physical characteristics of the building, installed heating systems and their real operation, human behavior, climate data, installed power of household appliances, outdoor climatic conditions, etc.) are employed.
Top-down models typically estimate the energy consumption through the application of statistical techniques, starting from the aggregate energy demand of multiple buildings. In particular, among these, data-driven models are particularly relevant because they make predictions by learning from historical energy consumption data (e.g., data from smart-metered districts or cities) thanks to suitable statistical techniques (machine learning algorithms, regression methods, etc.) [174][175][176]. In this case, no information about the single household systems is required and typical consumption patterns are directly derived [177,178].
The time horizon of the load profiles can be a minute, quarterly, half-hourly, hourly, daily, monthly, seasonal, or yearly in dependence on both the adopted methodology and the pursued purposes (design, management, control) [179]. Let the case of thermal and electro-thermal loads for space heating/cooling and water heating be considered. Standard load profiles strongly depend on the external climatic conditions (temperature conditions, solar radiation, relative humidity, weather-climatic events, etc.) and their determination is often linked to the so-called "energy signatures" [180] (i.e., energy as a function of the external climate). Therefore, for the purposes of load control and management, the possibility of measuring and predicting weather-climatic conditions accurately is of fundamental importance. On the other hand, for modeling electrical loads the temporal variation of the operating conditions of the electrical grid can also be included in the model of the load profile by using the ZIP load model form [181].
Beside standard load profiles, load modeling requires the representation of the flexibility, due to the participation of end-users to DR programs. Modeling flexibility consists of representing the change of the energy consumption with respect to the reference load profile in response to prices signal or incentives [182].
Flexibility could be provided by various household appliances in the form of reduction and/or shifting. For this reason, loads are classified as shiftable, curtailable and inflexible ( Figure 5). Shiftable loads refer to appliances whose total load must always be met but may be moved within a given time interval (typically a day). Within this class, a further distinction can be made between shiftable profile loads (whose profile can only be shifted, but not modified) and shiftable volume loads (where the total volume must be met over a set of time periods, but the profile can change within limits). Examples of shiftable profile loads ( Figure 6) are electrical appliances such as washing machines, dishwashers, tumble dryers, charging batteries of electric vehicles, while a battery-powered vacuum cleaner is a clear example of a shiftable volume load [183]. Curtailable loads are those that may be reduced (with or without a possible disutility for the users). Among curtailable loads, reducible and disconnectable loads may be distinguished ( Figure 6); the former can be only reduced down to a certain level (e.g., lights dimming), the latter may be either on or completely off. Those include all thermal and electro-thermal loads listed in Table 3 plus the refrigerators and are also referred to as "thermostatically controllable loads" [184]. Typically, disconnectable loads take advantage of the inertia of the thermodynamic systems toward the changes in energy supply. Since a connection/disconnection of the energy supply does not immediately result in a service interruption [185], they can offer flexibility both upward and downward. Considering, for example, the case of thermal and electro-thermal loads for space cooling, thermal energy may be stored or curtailed in the thermal mass of the building by decreasing/increasing the set-point temperature (respectively upward/downward flexibility) [186]. Anyhow, for this to happen, it is necessary that the building has been suitably designed in terms of adequate thermo-physical characteristics.
Many applications of DR involving electrical appliances have been proposed in the literature [10,161,187] while DR for district heating connected buildings has not yet reached maturity and few studies [188][189][190] have investigated its potential. This is likely due to the fact that application of district heating is limited in many parts of the world [58].
In this sense, flexibility strategies have been proposed mainly for HVAC systems, including global thermal zone temperature reset, precooling and preheating, duct static pressure control, desiccant cooling and chiller water temperature control [191], for the possibility of being easily integrated with smart energy management systems.
In some cases, the application of DR strategies is not possible through automated interaction with the appliance. As for example, in the absence of a TES, to modify the consumption of domestic hot water would require a direct intervention on end-user behavior (i.e., let the user postpone the use of hot water in the moment of greater availability of the resource and similar) [192]. In these cases, basing on [193,194], heat control by time, prioritizing hot water demand, TES, hybrid systems and influencing energy consumption behaviors are the techniques most worthy of consideration for application [195]. Additionally, for both natural gas and thermal grids, meters and multi-hour tariffs suitable for DR are still not currently available.

Home Power Balancing
The home power balance assures that the total demand of the household appliances is met by the thermal and electric powers supplied by HRES and energy grids.
As an example, in the following let a residential building be considered including a RET for the local production of electrical energy, a RET and an AUX for the local production of thermal energy, an ESS, a TES, M E electrical appliances and M T thermal appliances; in addition, a heat pump is used to contribute to the supply of the thermal demand.
Concerning electric energy, the balance equation referring to a generic time-horizon t is expressed in terms of average active power according to: where P RET e (t) is the average active power generated by the electrical RET; P EES discharge (t) and P ESS charge (t) are, respectively, the power discharged and charged by the EES in the timehorizon t; P grid e,imp (t) and P grid e,exp (t). are the active power imported from and exported to the electric distribution network, respectively; P appliance e,j (t) is the active power absorbed by the j-th electrical appliance; P HP e (t) is the active power absorbed by the heat pump. If the building is enabled to operate in islanding mode (i.e., disconnected from the electric grid), terms related to the grid power exchange are absent.
Concerning thermal energy, the balance equation referring to a generic time-horizon t are expressed in terms of thermal energy according to: where Q RET t (t) is the thermal energy generated by the thermal RET; Q AUX t (t) is the thermal energy generated by the AUX; Q TES discharge (t) and Q TSS charge (t) are, respectively, the power discharged and charged by the TES in the time-horizon t; Q HP t (t) is the thermal energy generated by the heat pump; Q grid t,imp (t) and Q grid t,imp (t). are the power imported from and exported to the thermal grid, respectively; Q appliance t,j (t) is the energy absorbed by the j-th thermal appliance.
It is important to notice that the time horizon is traditionally different for electric and thermal balances, because of the different dynamics associated with the two energy systems. Electrical systems have short time constants (typically seconds or minutes), while those of the thermal energy systems are sensibly higher (typically hourly or daily) [176]. Only in recent years, the developments in the field of both the dynamic simulation and the smart metering has led to widespread use of hourly or even quarter-hourly balances also for thermal systems. This trend facilitates the functional integration between electrical and thermal systems.

Optimization
The optimal functional integration can be viewed as an overall complex optimization problem with an objective function, that accounts for economics, comfort and environmental issues, and which is subject to the models of both HRESs, end-users and energy balance equations.
To practically solve the overall problem, the first step is to decompose it on a temporal basis (Figure 7). In detail, three-time horizons are typically defined (long term, mediumshort term and real-time) and then three levels of optimization problems are derived: • optimal design (long term horizon, that is years or life-long term); • optimal management (medium-short term horizon, typically days or hours); • optimal control (real-time, typically minutes or seconds). The three optimization levels are solved separately. At each level, the optimization problem assumes some quantities of the models as variables and the other ones as parameters. Typical examples are the size of the components, which are assumed as variables by the optimal design and turn to be parameters for the optimal management and control. Similarly, the electric energy injected into the electric grid is assigned as a share of the electric energy generated by the HRES in the optimal design, whereas it is a variable to be determined by the optimal management and control problem.
Additionally, the formulation of the objective functions varies according to the chosen time horizon. For example, optimal design assumes long term costs (including investment costs), whereas optimal management accounts for short term costs (including only operational costs). In practice the design stage is a separate problem which is solved once in the planning activities. The management and the control problems are strongly coupled in the operation and require specific management and control systems, which are generally referred to as Home Energy Management Systems (HEMSs) [196].

Optimal Design
The design of the HRES integrated in a Multi-Energy Building is a planning activity on a long-term horizon, which typically coincides with the financial horizon of the investment plan.
Optimal design can be approached according to two points of view: architectural and functional. This paper focus on the functional design.
In general, the design optimization requires as input data estimation of the availability of RESs, loads types, available energy grids, energy prices; in addition, some limiting bounds may result from physical, technological, legal, or economical restrictions. The objective functions are based on one or more metrics, such as the ones summarized in Table 4. Constraints are derived from the models of both HRESs, loads and energy balance equations. Output results are types, sizes and costs of the various components of HRES. Table 4. Typical metrics used for optimal design purposes.

Metric Optimization Problem Name Acronym Description
Minimization Annualized cost of the system (ACS) The sum of the annualized capital cost related to the initial investment, of the annual replacement cost and annual maintenance cost of each component [39].

Minimization
Levelized cost of the energy (LCE) The annual costs of the energy supplied by the grids [197].

Maximization
Levelized price of the energy (LPE) The annual revenues for the energy supplied to the grids [197].

Maximization
Levelized benefit of CO 2 emission reduction (LBE) The annual CO 2 emission reduction due to the use of RES evaluated accounting for the carbon taxation [198].

Minimization
Loss-Of-Load-Probability (LOLP) In the case the system can operate also in islanded mode separated from the grids, it is the cost of the load supply interruption [39].
The optimal functional integration of HRES in Multi-Energy Buildings has been treated in various studies, which however do not adopt a holistic approach to achieve optimal integration of various technologies and of the thermal and electric energy systems.
In [199], an HRES composed of PV-Ps, STC, GSHP, and TES is integrated in a singlefamily building located in Finland, which is connected to both electrical and district heating grids. Adopting a heuristic approach optimizing a set of indicators, introduced for evaluating net-energy and net exergy exchanges, primary energy consumption and CO 2 emissions, the sizes of the components as well as the grid exchanges are determined ex-post. However, both electric and thermal loads are not controllable and modeled as monthly energy demands.
In [200], residential buildings located in Nigeria are optimally designed by the HOMER software to integrate PV-Ps, WT, diesel generator, and EES to achieve lower LCE, net present cost (based on the difference between ACS and LPE) and greenhouse gas emissions. However, the presented results should further be consolidated with strategies for power dispatch and load scheduling and a more accurate representation of thermal supply and demand.
In [201], a methodology has been proposed to optimize the sizing of a HRES for buildings using a simulation-based optimization approach. The model minimizes total net present cost and CO 2 emission, while simultaneously maximizes renewable energy ratio. The developed methodology is applied to an apartment building in Canada, which is connected to both electrical and gas grids, and PV-Ps, WT, GSHP, STC, BB, TES, and electric vehicles. Despite the large number of RETs, DR for both thermal and electrical loads is not investigated.
A more exhaustive approach requires that the optimal management and control of the Multi-Energy Building must be modeled at the design stage, although in a simplified way. For example, typical days can be assumed in terms of time evolutions of RET generation, base-load profiles, and energy price. On their basis, the optimal control patterns of controllable loads, charging/discharging powers of storage, generation by AUXs are obtained for each typical day. From the daily control patterns, various design solutions can be compared in terms of objective functions. With reference to the metrics in Table 4, the following can be evaluated: the number of charging cycles of energy storage systems needed for the ACS, the amount of energy supplied by/to the grid needed for the LCE/LPE, the amount of energy produced by RESs needed for the LBE. Moreover, the control patterns could be derived by using probabilistic approaches so as to account for the random behavior of both RETs and loads. Finally, it is worth noticing that the numerical methods that can be adopted for the optimal design problem solution are extremely various [197]. However, since it is an off-line solution, the computational time requirements are not significantly demanding, and the choice of the numerical method is essentially based on the effectiveness in finding the best solution.

Optimal Management
The optimal management is essentially a medium/short term operational planning problem.
Input data are the forecast of RESs and loads provided by forecasting functions, which continuously collect data from field measurements. Further inputs are collected from field measurements, such as the stored energies. Finally, other inputs are related to the price of energy exchanged with the grids, which can be known in advance or forecasted.
The objective function is based on the operational incomes and costs, typically maximizing the difference between the former and the latter ones [202]. Additional terms in the objective function can refer to the number of charging cycles of EESs [203], thermal wellness [204], and greenhouse emissions [205].
Constraints to the optimal management problem are derived from HRES and load models and the energy balancing equations. Other constraints can be added that account for the (heating and cooling) wellness associated with the thermal loads, if not included into the objective function; the user's acceptability of the assumed flexibility for electrical loads; the number of charging cycles of the EESs, if not included into the objective function; the secure operation in terms of LOLP, if the system can operate in islanded mode.
The outputs of the optimal management problem solution are set-points to be sent as inputs to the optimal control problem. Examples are the variation of stored energy, the load flexibility to be implemented in terms of variations of the absorbed energy, the energy exchanged with the grids. All these outputs are expressed as the optimal values that should be achieved at the end of the considered time interval and are sent as inputs to the optimal control.
In literature, some works dealt with the optimal management of Multi-Energy Buildings with HRES.
In [205], a residential building connected to the electric and gas grids, integrates combined cooling heating and power, PV-Ps, TES, to satisfy electrical and thermal demands. An optimal management strategy is achieved by DR programs (including electric load shifting and curtailing, and flexible thermal loads) and combined cooling heating and power, TES and hybrid EV. A multiobjective optimization is conducted to consider energy costs and greenhouse emissions. However, only solar energy is exploited in the HRES.
In [91], an optimal energy management strategy is presented for a building with PV-Ps, WT, hybrid EES through FC, which is connected to the electrical grid, by minimizing energy costs and maximizing FC output, taking into account the time-of-use electricity tariff. However, DR and thermal grid are not considered.
The optimal management problem is typically expressed on a basis of hour time interval. For example, both [205] and [91] assume time horizon of 1 day divided in 24 h. In fact, the HRES and the load models present some equations that couple variables of subsequent time intervals. Typical examples are the stored energies, the ambient temperature, the shifted absorption of flexible loads.
Actually, the optimal management problem should be formulated and solved with a sliding time frame. In practice, the management problem at the time interval h is formulated considering the time frame from h to h + k. After the time interval h, the new input data are available and at the time interval h + 1 the problem is reformulated and again solved considering the time frame from h + 1 to h + k + 1. Such a formulation adequately copes with the couplings among subsequent hours if k is large enough. In Figure 8, the time sequence of the solutions of the optimal management problem is schematically depicted. The resulting problem is typical of mixed-integer linear (or nonlinear) programming problems (MILP or MINLP) [206] and many available numerical solving techniques are compatible with the computing requirements of few minutes.

Optimal Control
The optimal control is an operational activity on real time which should be decomposed into two levels, according to a hierarchical decomposition approach [207] (Figure 9). At the lower level, the aim of the control system is to continuously observe the status of the single component (RET, AUX, storage, load) and to act on the control variables so as to impose the set-points by classical closed-loop control. In detail, each local controller determines the status of the component by acquiring field measurements and sends it to the upper level; moreover, it receives the set-points from the upper level and implements adequate actions on the component under its control to obtain that the actual variables are equal to the set-points ( Figure 10). The lower level is often referred to as local or real-time control level, because of the small response time (i.e., seconds). At the upper level, the aim of the control system is to evaluate the corrections of the set-points received from the optimal management problem so as to account for the variations of the actual operating conditions. In detail, the control system receives the status of the components from the real-time control level, measures from the field and requests of flexibility services from the energy grid operators; then, it formulates an optimal control problem (OPC) to evaluate the corrections of the set-points received from the optimal management problem and sends this solution to the real time control level. In addition, it communicates the status of the components to the optimal management. The upper level will be referred to in the following as optimal control level (OCL). The OPC solution is evaluated several times within the time interval of the optimal management problem (i.e., minutes) ( Figure 8).
The implementation of the optimal control is an open issue, in particular with reference to the choice of the best architecture to implement the upper level. The optimal control level is the 'brain' of the control system, that must optimize HRES, load demand and exchange with the grids while guaranteeing the coordination among them; then, its correct implementation can increase the optimal operation of the overall energy system. At the same time applications on residential buildings seldom consider explicitly the optimal control level. The reason can be found in the poor attention paid to short-time dynamics which characterize DR and flexibility service provision to the grids. An example of two levels control structure is proposed in [208], applied to a HRES, composed of PV-Ps, gas powered µCHP, TES, EES, and connected to the electrical grid. This case does not consider DR and thermal grid. The optimization management consists of a model predictive control which minimizes the operational costs on a time horizon of hours or day and is performed every 10 min. The upper level of the optimal control adjusts for incorrect set points due to uncertain forecasts of solar radiation and load demand on short time scales; it is implemented by a heuristic rule-based strategy rather than an optimization, which is necessary for multiple components and DR.
While it is well established that the real time control is locally implemented without any information exchange, the architecture of the optimal control level can follow three different approaches, namely centralized, distributed, decentralized [209] or hybrid [210].
In a centralized architecture, a central control unit receives information about the operating status from subsystems and components and other variables (e.g., requests of flexibility services or measures from the field, including environmental variables). On the basis of the actual inputs, the central control unit evaluates the solution of the OCP. With respect to the optimal management problem, the OCP has the same objective function, but it refers to a single short time interval (minutes). It is a typical linear (or nonlinear) programming problem that can be adequately solved by various types of algorithms in the required computation time. The solutions of the OCP are then sent to local controllers as variations of the set-point values. The main drawback of the centralized structure is that this requires a communication infrastructure with adequate bandwidth, to exchange information quickly and accurately, and this drawback can affect the economic viability and reliability of such a structure [211]. On the other hand, its main advantage is that the global optimal solution of the optimization problem is achieved.
In a distributed architecture, the OCP is decomposed in subproblems which are assigned to the same control units that perform the local control of the lower level. In practice, the local control units, in addition to the local control action, also solve an optimization subproblem. Each local control unit exchanges information with the other (neighbor) local control units to coordinate and achieve an optimal solution for the overall system. The distributed approach typically requires a communication infrastructure with lower requirements than the one of the centralized approach [212]. The key issue is then the definition of the coordinating actions among the local control units which should guarantee that the solution is optimal (or near the optimal) for the overall system. Two main approaches are used in coordination: one is based on parallel decomposition [213] and the other one on multiagent techniques [214,215]. Generally speaking, the larger the number of local control units, the more complex and less efficient coordinating action is.
In a decentralized (or hybrid) architecture, the OCP is decomposed in a reduced number of subproblems related to aggregations of components or subsystems. Each subproblem is assigned and solved by a decentralized control unit. For example, a control unit is assigned to the whole HRES, rather than each RET, storage and AUX, and a decentralized control unit can deal with all the electric/thermal loads, rather than each load. This approach results to be a trade-off between the centralized and the distributed architectures. With respect to the former one, the local controllers do not communicate with a centralized control unit, but with a decentralized one; whereas with respect to the distributed one, the coordinating action is implemented among few decentralized control units. The decentralized architecture can result in lower communication requirements with respect to the centralized one and better performance in terms of optimal solution with respect to the distributed architecture.
In conclusion, it is worth noticing that in modern buildings a good communication system may be available for many other applications and, then, it may not be a limitation. In these cases, the centralized architecture is preferable because it guarantees that the optimal solution of the OCP is achieved. However, the implementation of decentralized architectures often presents further advantages related to the practical implementation. In fact, it allows to adopt the best commercially available solution for the control unit of each subsystem because different technologies and off-the-shelf products can be integrated into the HEMS, provided that the data exchange needed for the coordinating action is guaranteed. Figures 11 and 12 show an example of centralized and decentralized (or hybrid) control architectures.

Conclusions and Future Challenges
In this paper, an overview of the main technical issues related to functional integration of HRES into Multi-Energy Buildings was presented.
While in the first section it was highlighted how the HRES systems (i.e., wind-solar, solar-geothermal and solar-biomass) have reached their technological maturity, it was also evidenced that a full integration of the HRES systems in Multi-Energy Buildings still needs to be achieved. Indeed, the real possibilities of integration between all the different subsystems of a HRES, the demand-side and the multiple energy networks are in fact strictly connected to the enabling of full crossover functionalities between the different energy sectors (i.e., heat, electricity, gas, transport, etc.), while research in this sense is Energies 2021, 14, 1078 25 of 33 still strongly sectorial. Additionally, achieving a full functional integration of HRES in Multi-Energy Buildings requires the adoption of complex monitoring, management and control systems, of energy load and storage management systems, whose application is still limited in the scientific literature. In such a view, the design, management, and control phases cannot be separated and will increasingly require an integrated analysis not only of the HRES systems, but also of the demand-and the network-side characteristics. In this sense, the authors believe that one of the main challenges lies in the Integrated Demand Response concept. Indeed, actual integration of renewables in Multi-Energy Buildings and Systems will be fully achieved only when all possible crossovers between energy sectors (electricity, thermal energy, natural gas, hydrogen) will be effectively exploited. Moreover, in the near future the Integrated Demand Response will involve more and more the transport sector, due to the wide spreading of electric vehicles. Since these latter ones can be viewed both as a shiftable electric load and as part of a distributed energy storage system, the issue of adequate models for including electric vehicle into Integrated Demand Response is still open. Finally, concerning the optimal management and control systems, the research should more deeply investigate the forecasting methods on short and medium time horizons and the probabilistic-based optimization methods, so as to account with increased accuracy for the uncertainties related to RETs and loads. From the actual applications, adequate models of the users' attitudes with respect to load flexibility should also be derived.
New opportunities can derive from the cooperation among various Multi-Energy Buildings with HRES: the user dimension turns from individual customer to several territorially connected energy communities. The transition toward energy community would require a close synergy between the management and control systems of different Multi-Energy Buildings at local level. The clustering in renewable energy communities should favor the on-site temporal matching between production from HRESs and demand, thus increasing the savings in terms of energy cost and reducing the impact of RETs on energy grids. In addition, incentives are expected to be provided by national regulations for renewable energy communities. From the point of view of functional integration, the clustering requires the introduction of a coordination among the management and control systems of the Multi-Energy Buildings.
Further opportunities will derive from the services that Multi-Energy Buildings with HRES can provide to the energy distribution grids. In the electric sector, the flexibility of the Multi-Energy Buildings integrating HRES can be used by an Aggregator to offer aggregated electric demand response services, presently, for power balancing at transmission system level and, in the near future, at distribution grid level. Moreover, also the natural gas grid could move progressively towards a bidirectional functionality, in which some prosumers (more likely energy communities) will be able to inject biomethane, syngas or hydrogen using the storage capacities of this grid, also through typical power-to-gas technologies. In this view, the diffusion of distributed generation and storage of biomethane, syngas or hydrogen (produced locally in residential buildings or by energy communities) together with their injection into the grid are certainly very challenging aspects. Additionally, the analysis of the response of the natural gas network towards inputs from distributed generation is still a technological and research area to be explored. In particular a power-togas scenario (i.e., renewable hydrogen or other syngas injected to natural gas network) must be considered. These technologies are already available, but costs and integration problems still represent factors slowing down their full spread. Then, H2NG and biomethane could be a practical solution to increasing RES integration in residential buildings and improve both the electrical grid balancing and the natural gas greening.
Finally, in this evolution, district heating could allow autonomous heating and cooling entities to connect with each other, also enabling the use of the network and its components as thermal storages in periods of excess local production. In this sense, the application of multi-hour tariffs to the use of thermal wastes represents a real possibility of exploiting thermal energy according to its actual level of quality.