**6. Conclusions**

When the primary energy (PE) consumption in Spanish buildings is calculated with the official factors summarized in Table 1, which depend on the energy carrier and its energy source, it was demonstrated that the electrical energy carrier is 1.6 times more demanding than the natural gas from non-renewable sources. Even so, there is a tendency to electrify the consumptions because it is an energy carrier that can be more easily decarbonized. Some industrial heating systems are electrified due to the availability of powerful transmission lines. Despite of this, building centralized heating systems are not normally electrified because of the limitations of electrical grids in the cities.

Fuel cell-based CHP systems are a good solution to provide the energy demand for heating and hot water in buildings, showing a decrease in both PE consumption and CO2 emissions, even if the hydrogen is obtained from natural gas reforming. However, this PE reduction is directly related to the thermal energy conversion efficiency of the CHP and the boiler because in the best situation a 50% PE reduction can be achieved with an energy production of ca. 20% of thermal demand and ca. 50% of the electrical demand. When the fuel cell-based CHP systems are powered with carbon-free hydrogen, the PE reduction is higher when the system is able to meet a big share of the energy demand, which corresponds to a better fit of the heat-to-power ratio between production and demand. The use of micro-CHP units integrated into smart grids can help to reduce not only the thermal and electrical demand of the user but also the electrical demand from the nearby with the proper energy management.

The economic viability of fuel cell-based CHP units is similar to other technologies such as solar thermal systems that are projected to supply a maximum share of the thermal demand, ensuring the higher possible operating time. Based on the results of Figure 12, the optimal situation corresponds to centralized systems where the total operating time is above 80% of the year-hours and the thermal demand can be fully supplied.

**Author Contributions:** The first author, J.R., has taken lead on all the steps of the research and writing process. The rest of authors have contributed as follow: research methodology, F.S., A.L. and F.B.; simulation, V.G., L.D. and A.R.; validation, P.V., A.G.; writing—original draft preparation, F.S., A.L. and F.B.; supervision, F.S. and A.L.; writing—review and editing, F.S., A.L. and F.B. All authors have read and agreed to the published version of the manuscript.

**Funding:** This research was funded by the Secretariat of State for Research of the Spanish Ministry of Economy and Competitiveness (DPI2015-69286-C3-1-R), the Spanish Ministry of Science and Innovation (RTI2018-096001-B-C33), and the Aragon Government (LMP246\_18).

**Institutional Review Board Statement:** Not applicable.

**Informed Consent Statement:** Not applicable.

**Acknowledgments:** This work has been partially funded by the Secretariat of State for Research of the Spanish Ministry of Economy and Competitiveness under the project MICAPEM (ref.: DPI2015- 69286-C3-1-R) and by the Spanish Ministry of Science and Innovation under the project DOVELAR (ref.: RTI2018-096001-B-C33). LIFTEC research team would also acknowledge the funded provided by the Aragon Government under the project LMP246\_18.

**Conflicts of Interest:** The authors declare no conflict of interest.
