Thermoeconomic Analysis in Advanced Cogeneration Systems in Buildings

In this work thermoeconomics is applied to a central thermal system covering three buildings that consists of a cogeneration engine, an aerothermal heat pump and a natural gas condensing boiler. Cogeneration systems integrated with renewable energy technologies are very attractive solutions in the building sector. Nevertheless, the use of cogeneration systems together with active envelope solutions, such as the one encountered in this work, are scarce and the efforts to enhance the synergies between both systems are even scarcer. A heat pump is connected to a so-called solar wall to provide hot air and a renewable photovoltaic system supplies the electricity consumed by the heat pump. Thermoeconomics is applied to evaluate the cost of flows based on its energy-quality. Hence, this innovative and complex system can be analysed and diagnosed by this methodology. As a result, thermoeconomics is presented as an effective tool for the detailed study of the energy cost distribution and the key to enhancing energy efficiency.


INTRODUCTION
Due to the high-energy consumption and GHG emissions of the building sector, buildings are responsible for almost 40% of the global energy consumption (Li et al., 2021) and many efforts are being made to decrease the energy demand and increase the efficiency of thermal systems, without affecting the Indoor Environment Quality (IEQ) (Korsavi et al., 2020). Demand needs to decrease in order to achieve the environmental objectives set by the European Commission (Verhaeghe, 2020). Innovative actions, both in the thermal envelope and through the implementation of renewable technologies, make it possible to reduce energy consumption while also enhancing the interior comfort of buildings to improve the quality of life. Moreover, the current context is characterized by exceptional conditions in which the economic crisis, accelerated by the current COVID-19 health crisis, converges with the need to increase the IEQ of buildings.
Traditionally, buildings have produced the required thermal demand by means of combustion equipment, such as boilers. Nowadays, technologies that are more sophisticated are being pursued to adapt more efficiently to the thermal levels of demand; such as sustainable solutions that comprise heat pumps, solar thermal systems or even hydrogen based cogeneration systems (Cheekatamarla et al., 2021). After all, buildings require heating and cooling, at a temperature a few degrees above or below the ambient temperature, domestic hot water (DHW) at around 60°C, or electricity, which is a highquality energy. The use of waste heat, or of some renewable sources, makes it possible to cover low-quality demands by adapting more efficiently to thermal levels. Combustion or electric equipment can be used to cover high-quality demands, such as household appliances or lighting. The result of adapting the technologies to specific uses can help to create more energy efficient buildings and decrease the environmental issues.
Due to their energy and environmental advantages, polygeneration systems combined with renewable energy technologies (also known as hybrid polygeneration systems) are now being examined in many works of research. A review to outline the latest developments on integrated polygeneration and renewable systems, for desalination, is done in Khoshgoftar Manesh and Onishi. (2021); a polygeneration hybrid solar and biomass system is investigated in Sahoo et al. (2018); solar-driven polygeneration systems are summarized and discussed in Ref. Kasaeian et al. (2020). The optimal design and the performance analysis of solar hybrid polygeneration system is analysed in Yang and Zhai. (2019) by considering different building types and climate conditions, and in Yang and Zhai. (2018) considering different operation strategies. In fact, the combination of these two technologies, polygeneration and renewable energies, provides several advantages: 1) primary energy conversion efficiency is higher compared to traditional systems, and 2) renewable energy-based technologies have less impact on the environment.
However, hybrid polygeneration systems have seldom been used in building systems because there is a necessity to investigate the integration of the said technologies as well as the optimal energy management. The influence of legal constraints on the integration of renewable energy technologies in polygeneration systems for buildings was analysed in Pina et al. (2021). In the case of cogeneration, also known as Combined Heat and Power (CHP), this has a much lower economic return on buildings than on industry. This is because: • The demand is very variable, as it depends on climatic factors and on the behaviour of the users, which is difficult to predict; • As the power of the facilities in buildings is lower than in industry, economies of scale come into play.
However, technologies for small-power cogeneration and micro-cogeneration or polygeneration systems can provide the energy services demanded in buildings (electricity, DHW, heating and cooling), all with high-energy efficiencies, and with the consequent economic benefit and lower environmental impact. The technical and economic viability of micro-cogeneration systems in buildings is discussed in Atănăsoae. (2020) while Cheekatamarla et al. (2021) search sustainable solutions in buildings by analysing cogeneration systems. Furthermore, new analysis strategies have arisen in the last few decades enabling us to better understand energy use and its degradation, as is the case of thermoeconomics (TE).

Thermoeconomics in Building Thermal Systems
Thermoeconomics (TE), based on the first and second laws of thermodynamics, aims to promote energy savings and sets the guidelines for a better energy use; a fact that also decreases the environmental impact, making the service sector a sustainable sector for its application. TE is a relatively young science, developed for the industrial world, which is rarely applied in the building sector. Different thermoeconomic methodologies are explained and compared in Picallo-Perez et al. (2021a). Consequently TE aims to detect the points of highest irreversibilities and losses (and therefore costs) in order to obtain a rational picture of the cost formation process. This information is very useful when implementing improvement and control optimization actions with the aim of reducing costs and promoting energy savings, which cannot be obtained with classical analyses based on energy conservation. Therefore, TE relates Physics with Economics through the concept of exergy cost, since exergy is an appropriate thermodynamic property, as it takes into account the quantity of energy and its quality, understanding by quality its capacity to do something useful (de Renobales, 1995). Thermoeconomics makes it possible to solve problems that cannot be solved with traditional energy analyses based on the first law, such as: • Determining the costs of the products of a facility based on physical criteria, see an example in Valero et al. (2006). • Detecting the places where losses actually occur, evaluating their costs and proposing cost-effective improvements. • Diagnosing facilities, see the tool developed in Picallo-Perez et al. (2021b). • Optimizing decision variables in the design of equipment and facilities, Piacentino and Cardona. (2007).
The applications of TE in the industrial field date back to the end of the last century. However, applications in non-industrial areas started to be explored in the 2010s, as for example in Picallo-Perez et al. (2017a) and Picallo-Perez et al. (2017b); a detailed literature review appears in Abusoglu and Kanoglu.( 2009) and Keshavarzian et al. (2018). As far as the building sector is concerned, these works are scarcer. The book of Sala and Picallo. (2020) was published in 2019 and it comprehensively analyses buildings; both the envelope and facilities, from an exergy point of view, applying thermoeconomics for design, optimization and maintenance purposes 1 .
Even if scarce, some works can be found in the literature concerning TE application in hybrid polygeneration systems. In , for example, a TE analysis is done for calculating the exergetic cost of a combined cooling, heating and power system of a hypothetic hotel, highlighting that exergetic cost is seldom assessed in this type of systems. In Mouaky and Rachek. (2020) a solar and biomass hybrid polygeneration system is analysed under the thermodynamic and TE point of view using a model developed by Ebsilon Professional software. A polygeneration system supplied by solar, geothermal and biomass resources is optimized and deeply analysed in Calise et al. (2021). However, the TE analysis done is based only in some economic parameters and not in exergy costs. Conversely, exergy costs are accounted in Martínez-Gracia et al. (2021) where also a complementary method is offered to assess and better understand the efficiency of a cogeneration solar configuration. Therefore, even if some works exist, the methodology to apply TE in building polygeneration systems (based on exergy costs) should be enhanced. After all, productive structure definition can be sometimes tedious or difficult. This work, besides applying TE based on exergy costs approach, proposes a simplified methodology to define the productive structure of the system and defines new indexes based on exergy terms to analyse CHP systems.

Objectives and Overall Organization
In this work, the central thermal polygeneration system of a set of three buildings is analysed. It consists of a cogeneration engine, a natural gas condensing boiler and an aerothermal heat pump provided with renewable PV electricity and working in connection to a solar wall. These buildings are social housing blocks, where heating and DHW cost minimization is one of the main goals.
In Section 2, after analysing the advantages of including cogeneration through the calculation of its respective indices, the basis of a general thermoeconomic model is set out. In Section 3 the above developments are applied to the set of three buildings of our case; thermoeconomics is applied to check and detect the most unfavourable thermal processes and control strategies in terms of energy costs. In Section 4, the numerical results obtained are shown and analysed. At the end of this Section, a discussion of the results obtained and some conclusions are set out and the savings coming from renewable energy use are quantified.

MATERIALS AND METHODS
This section contains brief mathematical formulae to follow the case study and the numerical results finally obtained.

Cogeneration Energy and Exergy Indexes
Cogeneration sequentially produces electricity (E) and useful heat (H) from the same fuel (F), having an energy efficiency defined as: In order to incorporate it in building systems, the promoter must decide whether to install it or to proceed in a conventional manner, by buying electricity from the grid (produced with η E efficiency) and installing a unit, as a boiler, with an energy efficiency of η H . Therefore, the primary energy saving (ES) related to cogeneration is the difference between the fuel consumption in the conventional mode (F*) and the cogeneration consumption (F) (IDAE, ): The Percentage of energy saving (PES) is In the case of installations of less than 1 MWe, which is the most common case in buildings, the PES needs to be positive to be considered as a high efficiency system (Official Journal of the European Union, 2004).
The equivalent electrical efficiency (EEE) considers the fuel consumption attributable to the electricity produced in the cogeneration plant (F eqE F − F H ), where F H H/η H . Thus, it is defined as: This index allows the electrical efficiency of a CHP plant to be compared with the electrical efficiency of a plant that only produces electricity.
In parallel with these indices, similar indices can be defined in terms of exergy. For that, the exergy efficiency of a cogeneration plant is defined as the relationship between the electricity (E) plus the thermal exergy produced (B H ) and the exergy of the fuel used (B F ): This efficiency considers the real losses or irreversibilities in the cogeneration process. Its value is lower than the energy efficiency, since it considers the quality of the energy and not only the quantity. Indeed, even if electricity is all exergy, the thermal energy produced is low-quality energy, so its exergy content is much lower than its energy, whereas the fuel used has a quality factor near one.
The Exergy Saving (ExS) is defined in an analogous way: where φ E is the exergy efficiency of the electricity from the grid and φ H the exergy efficiency in the production of thermal energy by the conventional system. Therefore, the Percentage Primary Exergy Saving (PExS) is: Similarly, the Equivalent Electrical Exergy Efficiency (EExE): Frontiers in Energy Research | www.frontiersin.org January 2022 | Volume 9 | Article 802971

Thermoeconomic Model
As the name suggests, thermoeconomics combines economic models with physical energy models to, among other things, calculate the costs (exergetic and economic) of the flows along a system. 1 The term cost refers to the amount of resources required to obtain the specific ith flow, (B p i ); and the unit cost refers to the ratio between that cost and the exergy flow (k p i B p i /B i ). The formulae for calculating the costs are based on four main propositions, (Lozano and Valero, 1993): If there is no extra evaluation, the external incoming exergy unit cost of resources is equal to one k p e B p e /B e 1. • Proposition 3: All costs generated in the process are assigned to the final products. Therefore, losses have null costs. • Proposition 4: It is divided into two parts: (4.1) if the jth flow is an outgoing flow of a subsystem and belongs to the incoming ith flow of that subsystem, both flows have the same unit cost, If a subsystem has more than one product (i.e., ith and jth flows), all of them have the same unit cost TE also uses the productive model of the system. The productive model refers to the interactions between components in terms of Fuels (F) and Products (P): F considers the amount of resources needed in the process, and P reflects the purpose of the process. Therefore, the cost can be given in terms of the costs of fuel and the product of an ith component (F p i and P p i ), or in unit exergy costs of fuel and the product of the component (k p Fi and k p Pi ). The productive model can be graphically represented by the productive structure, where all the flows and components of the system are gathered together by means of squares (representing each component), entering arrows (fuels), outgoing arrows (products), diamonds (bifurcations) and circumferences (junctions).
Accordingly, all the propositions can be introduced in a common matrix formula that contemplates the whole system; so the fuels and products of all the components are represented by its vectors (F, P), I being the irreversibility vector, the difference between the product and fuel.
Likewise, the vectors of the unit exergy costs of fuels and products (k p F and k p P ) are included in the matrix formulation. Both unit exergy costs are obtained by multiplying the unit cost of external resources (k p e ) and the matrix operators |k p F 〉 and |k p F 〉 (Picallo et al., 2016) (which contain all the propositions): These unit exergetic costs give the information of the cost distribution along the system. Accordingly, on the one hand, the unit cost of fuel of an ith component k p Fi accounts for the amount of resources needed in order to get such a component. Therefore, if the system is sequential, the components downstream need to consume more resources than the upstream ones, since more irreversibilities accumulate until that point. Thus, this cost is useful for interpreting the interactions between components.
On the other hand, the difference between the unit cost of the product and fuel of an ith component k p Pi − k p Fi somehow represents the unit cost of the irreversibility of that component; since the irreversibility is the difference between the product and the fuel of the component. That is, it indicates the energy degradation (and the increment in cost) between the required resources and the obtained product. Thus, this increment is useful for locating the component with higher irreversibilities, which should be a focus of improvement.
The total exergy costs of the fuels and products are simply achieved by multiplying the unit costs by their exergy.

Influence on the Cost of Renewable Energies
As already said, the exergy costs reflect the degradation of energy along a system, pointing out the places with higher irreversibilities by means of higher costs. These costs refer to the amount of resources (in kWh ex ) needed to provide a certain flow, therefore, it only considers the fuel consumption without taking into account the cost related to the acquisition, operation and maintenance costs. However, expressing the fuel consumption costs in economic units (in €) can be more attractive for a cost analysis. Indeed, this is the way to emphasize the advantage of using renewable energies. Hence, we define the unit exergoeconomic costs of each external resource as the cost per unit of exergy (c e i [ € kWh ex ]). So, similarly, the vector of unit exergoeconomic costs (c F and c P ) is related to the unit exergetic costs of the external resources, c e through the |k * F 〉 and |k * P 〉 matrix operators as follows: On the other side, when total costs are taken into account, z p vector needs to be considered whose elements contain the costs of acquisition, operation and maintenance per unit of products 2 .

Flow Chart of the Methodology
Therefore, the methodology to be followed is summarized in Figure 1. Accordingly, this work is devoted to calculate the following values: • Cogeneration Energy indexes • Cogeneration Exergy indexes • Exergy costs of components • Exergoeconomic costs of system components 3 CASE STUDY

Description of the Buildings
The set of buildings are in Portugalete (the Basque Country, in northern Spain), on a plot of land with a 10% of slope. There are three adjacent five-floor buildings, with two dwellings per floor. There are also two underfloor parking spaces, Figure 2.
These buildings are part of the Basque Government's social housing, where homes are provided to low-income people for 5 years with a low rent; because of that these buildings are design to have a very-low energy demand for heating.
The main problem is that most of the users could be unable to pay the community charges, so the buildings are designed to reduce energy consumption to a minimum. In order to avoid such a state of affairs, these buildings have some particularities, incorporating passive systems, renewable energies and cogeneration.
Related to the architecture of the buildings, the façades facing the North, West and East are conventional, with the following thermal transmittances: • 0.26 W/m 2 K for opaque elements (composed of a sandwich panel, polyurethane, rock wool, cellular concrete and plasterboard). • 2.2 W/m 2 K for windows (low emissivity glass 6/12/4).
The South façades of two of these buildings, conversely, have two different types of active façade solutions 3 : • One is a Trombe wall connected to the ventilation system through a heat recovery system. • The other is a solar wall connected to the heating system, providing hot air to a heat pump placed on the roof.
Furthermore, there are 88 PV panels (with 22.4 kW of installed power) placed on the roof to feed the heat pump and the lifts.

Thermal Facility
The thermal installation consists of radiant floor heating and DHW distribution for 32 dwellings in three blocks. Heat is generated in three main elements: a cogeneration engine, an aerothermal heat pump and a natural gas condensing boiler.
• The 12.5 kW thermal power and 5.5 kWe electric power cogeneration engine serves a so-called high-temperature branch, and for energy efficiency reasons, it is in operation for as long as possible. • The 12.9 kW rated power heat pump serves a so-called low temperature branch and has the second priority after the micro-cogeneration equipment, especially when there is no heating demand. 4 FIGURE 1 | Flow chart of the methodology.
3 The thermoeconomic analysis of these two solutions are beyond the scope of this work, but will be analysed in detail in an upcoming survey. 4 As mentioned above, block 2 has a solar wall system that collects heat from the façade and channels it to the aerothermal heat pump in order to use as much energy as possible by means of a fan with a frequency converter.
Frontiers in Energy Research | www.frontiersin.org January 2022 | Volume 9 | Article 802971 • The 102 kW nominal power condensing boiler supports the previous engines and works with a lower priority, when the micro-cogeneration equipment and the heat pump are not able to cover the heating and DHW demands of the buildings.
There is also auxiliary equipment to transfer thermal energy and to provide the necessary inertia for the heating and the DHW of each dwelling, such as heat exchangers, 2000 L tanks and valves. Figure 3 groups the main equipment and shows the scheme of the installation.

Thermal Facility Control
As said, one of the main limitation to the CHP diffusion in residential buildings is due to the high variability of the demand, which depends on the climatic factors and on the users behaviours. For such a reason the adopted control logic plays a crucial role. The control is divided into two main sets: the DHW circuit control and the heating circuit control; the system control logic flowchart is in Figure 4.
In the case of the DHW demand, the priority order of the stages is as follows: • First, the cogeneration engine turns on to keep the DHW tank at 80°C. • Then, the heat pump starts in low temperature mode, at 45°C. • Subsequently, if the DHW demand cannot be covered, the heat pump changes to high temperature mode, at 70°C. • Finally, if necessary, the boiler is turned on.
Heating demand is turned on according to a yearly schedule (from November 1st to May 15th), as well as to the outside temperature. The heating operates if the outside temperature is below 17°C and there is a minimum number of dwellings (at least 5) demanding heating through their individual thermostat, until 21°C is reached.
The heat pump provides mainly heating, as the terminal elements correspond to a radiant floor. If the heating is running and the heat pump cannot handle the demand, the heat pump starts working at the high temperature level by proportionally regulating the valve of the third heat exchanger (HX3) so that the micro CHP and/or the boiler can support it.
If, above all, there is sufficient surplus in the electrical power (coming from the PV cells and CHP engines), the heat pump will be activated. That will happen if: • The average ambient temperature of the building is below 21°C. • A minimum number of dwellings (5) have their ambient temperature below 21°C.
If one of these two cases occurs, the radiant floor heating will be started "free of charge" to all dwellings below 21°C to heat the building in general terms. In the event that the building's average temperature rises above the setpoint, or the surplus for the "free" mode is terminated, free-heating will be stopped.

Thermoeconomic Model
All the equipment and its control has been modelled in Trnsys Studio (Trnsys, 2000) interface by including the corresponding The corresponding demands are included through an external document read by a Data-reader Type 9a. Such  Frontiers in Energy Research | www.frontiersin.org January 2022 | Volume 9 | Article 802971 7 demands are obtained directly from the building's monitoring system, where the DHW Li et al, 2021 demand and the heating demand (kWh) are extracted every minute. The environmental temperature is also monitored, so real temperatures are used for the system control. The radiation meteorological data was taken from the Meteonorm database (Remund, 2008). The simulation was done for the heating period with a time step of 15 min.
The physical model of the system envisages the 54 flows and components used for the thermoeconomic analysis, Figure 5.
The productive model, on the other hand, reflects the interactions between components in terms of Fuels and Products. It is worth highlighting the fact that the approach followed was the one of a productive super-structure explained in Picallo-Perez et al. (2019). In this way, the dynamism of the system was accounted for by means of productive specific-structures that adapt, at each time-step, to the modulating operating conditions; that is, only the active components and flows are considered for the specific productive structure at that time, which is created by erasing the non-active components and the non-active flows from the productive super-structure.
The productive super-structure is depicted in Figure 6 according to the flow numbering of Figure 5. Fuels are defined as the entering arrows and products as the outgoing arrows. Real components are identified with 10 squares, junctions with 19 circumferences and bifurcations with 19 diamonds. So there are 48 components, some are real and others virtual.

A Simplified Method for Applying Thermoeconomic Propositions
Applying TE propositions in the productive super-structure of Figure 6 seems to be tedious and non-intuitive due to the great amount of components. However, if each arrow is related to only one number/flow, the method becomes direct and easy to apply. This section shows a direct way to apply TE propositions methodologically.
To do so, each component, either real or virtual, needs to be defined with only one entering flow-number and one outgoing flow-number. The said flow-number considers the global "cumulative flow", i.e., it is the sum (or subtraction) of the physical flows specified in the productive super-structure of Figure 6. Accordingly, the productive super-structure is renamed in Figure 7. As a result, there are now 48 components and 75 flows.
As the aim of thermoeconomics is to account for the exergy cost distribution along the system, i.e., to calculate the costs of 75 flows, there are 75 unknown values. So we need a system of 75 equations to calculate each exergy cost. Nevertheless, defining propositions in this re-named super-structure is much easier and direct; indeed, only three propositions are needed: • Proposition 1: All the fuel costs are equal to all the product costs in each component; therefore, as there are 48 components, we have 48 equations as: F p i P p i . • Proposition 2: All the external resources have a unit exergy cost equal to one. As there are 7 entering resources, they follow 7 equations: B p e /B e 1. Consequently, we obtain a system of 48 + 7+20 75 equations to apply the corresponding matrix formulae. The F and P of all the components, as well as the propositions, are shown in Table 1, except for the proposition F p i P p i , which is excluded because of reasons of space.

NUMERICAL RESULTS
This section briefly contains the main results related to the thermoeconomic application to the cogeneration system.

Energy Performance
The facility was modelled in Trnsys and simulated during the heating period, with a 15 min time-step and the control explained above. As the simulation model and the energy analysis are beyond the scope of this work, only the results referring to the generator engines and the demands and production are shown. Figure 8 depicts the dynamic behaviour fuel consumption of the engines and the external climate conditions during the third week of March. As can be seen: • Cogeneration (C) is on all the time thanks to the inertial tank (Tc) associated with it. The heat pump (HP) and the boiler (B) enter subsequently, when the temperature of the DHW tank is below the defined setpoint (this  tank (Td) gives inertia to the system so that the activating moments of HP and B occur after a temperature drop). • The solar radiation is variable due to its dependence on the hour of the day and the climatic conditions. • The average energy and exergy efficiency of the generator components in the heating period are in Table 2. Even if the HP has a COP higher than 1, its exergy efficiency is very low because it transforms electricity into low temperature heat. Something similar happens with B and C, which produce heat from combustion; however, as C also produces electricity, its exergy efficiency is higher. The energy and exergy efficiencies of the PVs are similar, as the exergy of the solar radiation is similar to the energy. Figure 9 shows the heating and DHW demands, as well as the electricity generation of CHP and the electricity surplus of the PV cells. As can be seen: • DHW demand is almost "periodic" along the week, while the heating demand is very variable, depending on the user profiles and ambient conditions. • Electricity production in C is constant because it depends on the cogeneration engine, while the electricity surplus in the PV panels depends on the solar radiation (this electricity is the subtraction between the PV production and the HP consumption, when positive).

Cogeneration Energy and Exergy Indices
The accumulated values along the heating season were used to calculate the cogeneration indices, Table 3. The Percentage of Energy Saving (PES) and Percentage of Exergy Saving (PExS) were calculated with the following efficiencies, taken from Spanish Government. (2016): η E 44 % and φ E 44% (electricity is 100% exergy) and η H 90% and φ H 13% (considering a quality factor of 0.14 for the heating  According to the results obtained, the following is observed. • Even in energy or exergy terms, cogeneration is preferable to separate production (since the PES and PExS indices are positive). Moreover, the percentage in savings is more marked in exergy terms. This is because generating heat separately requires more exergy consumption due to the low exergy efficiency of the boiler. • The same happens with the EEE and EExE indices, which both reflect the suitability of cogeneration.

Thermoeconomic Analysis
The TE analysis distributes the unit exergy cost throughout the system according to the fuel (F) and product (P) definitions of each component. As the results for real components are the interesting ones, Table 4A gathers the values of the F, P, irreversibility (I) and the unit cost of fuels (k * F ) and products (k * P ) during the heating period for those components.
The results can be summarized as follows: • The k * F of the generating equipment that consumes external resources [photovoltaic panels (PV), cogeneration (C) and boiler (B)] is equal to one, because of the thermoeconomic proposition 2.
• The heat pump (HP), however, consumes part of the electricity coming from PV and part from the net (when there is not enough PV generation); therefore, its k p F HP is higher than one. This fact can be somewhat misleading against the use of renewable sources. After all, the PV cells incorporate irreversibilities, so the cost of k p F HP is bigger than 1, as it will be if electricity is consumed directly as an external resource. Nevertheless, this issue is resolved when  introducing economic unit values (as the solar energy cost is null and the electricity from the grid has a cost). • C generates the highest irreversibilities of the system. This is because I is an extensive property and gets bigger as more fuel is consumed. To be precise, C is activated as much time as possible in order to profit from the electricity cogenerated. • However, the unit exergy consumption increment (i.e., the k * P − k * F difference) of C is less than in the B and HP. This reflects the fact that C is the most suitable component in terms of saving costs, as is also shown in Table 2. • The HP is less efficient than B since its k * P is higher. This is because HP converts electricity (100% exergy) to lowtemperature heat (lower than that of B), which is a very poor quality energy flow.
• Even if this system cannot be considered sequential at all, as the components are placed downstream, their k * F values tend to increase because more irreversibilities are accumulated along the way. That is why k * F in HX3 has a higher value than in Tc.
The most interesting values are the exergy costs of the outgoing products P * , i.e., the DHW, heating and electricity. These exergy costs refer to the amount of resources [in exergy base (kWh ex )] needed to satisfy the required demand, Table 4B.
Accordingly, in unit exergy terms, heating is more expensive than DHW. In relation to electricity generation, the electricity from cogeneration requires fewer resources than the electricity coming from renewable solar radiation. Therefore, a priori, the CHP system seems to be a better alternative than PV cells, due to their lower exergy efficiency.

Influence on Cost of Renewable Energies
As said above, the exergoeconomic analysis expresses the costs in monetary units. The cost per unit of exergy for each external resource is, in our case: • c NG 5.27 [ c€ kWhex ] for natural gas (for C and B); • c elec 21.81 [ c€ kWhex ] for electricity purchased from the grid; • and, c solar 0 [ c€ kWhex ] for solar radiation. Table 5 summarizes the results of the exergoeconomic analysis in two cases: 1) when all the electricity comes from the grid without considering the PV renewable production, and, 2) including the PV production. These results are only related to the external resource consumption, without considering the acquisition, operation and maintenance costs of each component. Therefore: • As c solar external resource is null, the HP cost is lower when some part of its fuel comes from PV production, decreasing from c HP 169.20 (c€/kWh ex ) to c ren P HP 138.76 (c€/ kWh ex ).
• Only the components associated to the HP branch have different costs:   The unit exergoeconomic costs and the total cost of the final products (DHW, heating and electricity) are shown in Table 6. As said, these costs do not consider the acquisition, operation and maintenance costs of the components, but show the benefits of combining renewable sources with polygeneration systems; a result that was misinterpreted in the previous exergetic analysis.
The electricity consumption in this table is divided into two parts: • Electricity obtained from the CHP.
• Electricity obtained from the PV surplus, which instead of selling to the grid covers some community consumptions (lifts and illumination).
Therefore, the PV panels' surplus substitutes the grid consumption, so it can be though that c PV surplus is the saving obtained by not buying that electricity from the grid and then c PV surplus −c elec −21.81 [ c€ kWh ex ]). In consequence, there are two main savings due to the renewable energy incorporation:

CONCLUSION
This work analyses a central thermal system of three buildings consisting of a CHP cogeneration engine, an aerothermal heat pump (supplied by PV electricity) and a natural gas condensing boiler. PES, PExS and EEE, EExE indexes identify whether the cogeneration system transforms the energy with greater efficiency than the conventional systems, under an energy and an exergy point of view. The following results show the adequacy of using CHP systems: • PES is positive (27%).
• Exergy values reflect better the advantage of producing electricity in a combined way (EExE 1.58) than in energy terms (EEE 1.1).
Consequently, exergy is a very useful property to locate the real losses and the profitability of transforming energy from one type to another. In this way, such combustion equipment as boilers or CHP systems, are heavily penalized under the exergy point of view, because they transform a high-valuable energy flow of fuel to a low-quality heat flow, resulting in: • Exergy efficiency of the cogeneration engines is φ C 37% • Exergy efficiency of the boiler is φ B 16%.
• Exergy efficiency of HP is φ HP 14%, as it transforms electricity to low-quality heat.
These are the results according to the thermoeconomic analysis: • The DHW unit exergy cost is 3.61 (kWh/kWh).
• In addition, cogenerating electricity is cheaper [2.72 (kWh/ kWh)] than generating it from PV panels [7.79 (kWh/ kWh)] because of the irreversibilities encountered in the conversion of solar radiation and electricity.
However, the exergoeconomic costs highlight the benefits of using renewable energy; these costs are only related to the fuel consumption costs without considering the acquisition, operation and maintenance costs. As the cost of solar radiation is null, c solar , the direct cost of energy conversion in PV panels is also null, decreasing the exergoeconomic unit cost of the rest of the connected equipment as well as obtaining revenues from grid consumption saving: • The yearly saving, due to exergoeconomic unit cost reduction in DHW and heating, thanks to PV renewable panels, is 537€/year. • And the savings obtained due to the electricity surplus in PV panels is equal to 438 €/year.

DISCUSSION
The potential for introducing CHP systems in the building sector is very high, but practically unexploited. In relation to industry, the main disadvantage of introducing cogeneration in buildings is that the thermal demand is very variable and the power of the equipment needed is smaller. Nevertheless, the dynamism of thermal demand can be avoided somewhat by using thermal inertial systems to cover the decoupling between production and demand. In addition, in order to ensure the constant functioning of the CHP systems, they are usually undersized and auxiliary generation systems, such as heat pump and boilers, are included to help in peak demand periods.
On the other hand, the costs occasioned by the irreversibilities along the systems can be accounted for by thermoeconomics (TE). TE makes a rational distribution of costs, i.e., it accounts for the amount of resources required to achieve a specific objective, on an exergy base. Along this work, an easy-to-apply method has been explained to apply TE propositions in a system with a high number of components. This method is dynamic and can be applied successively, no matter how many components or flows there are.
Nevertheless, to evaluate the total cost, we must take into account the acquisition cost and the operation and maintenance costs. In the same way, when evaluating the income from the sale of cogenerated and PV electricity, the complement for efficiency, the complement for reactive energy, the costs of deviations, etc., as well as the maintenance costs for the whole components of the system, must be taken into account. Likewise, the insurance and financing costs must also be considered.
Furthermore, renewable technology can be related to the environmental impact generated along its useful life (from cradle to grave). Accordingly, the exergoenviromental analysis considers the environmental impact associated with the generation of the flows. It is an approach analogous to exergetic and exergoeconomic analyses and uses Life Cycle Analysis (LCA) to calculate the unit exergoenvironmental costs of the fuels and products (b F and b P ) in impact/kWh ex units. If an LCA were included, a proper inventory analysis would have to be made, with a list of disparate entries, such as carbon dioxide, nitrogen oxides, chloromethane, etc. Following this inventory analysis, an impact assessment would have to be made to convert and aggregate those entries into environmentally relevant items, such as global warming, acidification, etc.; so the total impact of all the components would be accounted for in the costs.

DATA AVAILABILITY STATEMENT
The datasets presented in this article are not readily available because they are ENEDI research group data. Requests to access the datasets should be directed to ana.picallo@ehu.eus.