## 3 Proposed Methodology
### Thermoeconomic Diagnosis  
The thermoeconomic variable used in the thermoeconomic diagnosis is the unit exergy consumption (\(k\)). The unit exergy consumption of component \(i\) (\(k_{i}\)) is defined as the inverse of the efficiency (\(\varepsilon_{i}\)), which is a function of the corresponding independent thermodynamic variables (\(\overline{x}_{i}\)) (temperatures, consumptions, flow rates, etc.). The diagnosis aims at detecting and assigning anomalies, as well as assessing their cost overrun effects, by analysing the change of exergy unit consumption (\(\Delta k_{i}\)). This difference can be differentiated between the one produced due to intrinsic anomalies (\(\Delta k_{i,anomaly}\)) (related to the degradation of a specific component \(i\)) and that produced by induced anomalies (\(\Delta k_{i,ind}\)) (due to the need of the other components to adapt to the specific intrinsic anomaly) by means of an appropriate thermodynamic model. Implementing the diagnosis with thermoconomic diagnosis tools, although not strictly necessary to detect anomalies [15], allows us to evaluate the weight or relevance that each one has in terms of cost increase in the system.  
2.1 Detection of the Operating Mode and Comparison of the System Operating Condition vs. Its Analog Reference Condition  
The thermoeconomic diagnosis methodology is based on identifying the active operating mode of a thermal system at any given time and comparing the actual operating condition (\(OP_{\mathit{Sist}}\)), which may be degraded, with its reference condition without anomalies (\(REF_{\mathit{sist}}\)), see Figure 2.  
* Operating Modes: These represent the specific configurations of the thermal equipment and subsystems (such as boilers, heat exchangers, pumps, etc.) that are activated according to the thermal demands of the building, the external environmental conditions, and the control system that regulates the operating modes. These modes are deduced from the external independent variables (\(\overline{x}_{\mathit{cater}}^{DP}\)): (1) prevailing environmental conditions (\(T_{\mathit{env.}}\)) and (2) instantaneous demands (\(\hat{Q}_{\mathit{DHW}}\)), and the activation state of the component \(i\) (\(on/off_{i}\)). These external and independent variables are precisely the ones that cause the dynamism of thermal installations in buildings.
* Operating Condition (\(OP_{\mathit{Sist}}\)): This represents the instantaneous operational situation of the system, which is determined by sensors' data collected along the energy chain (\(\overline{x}_{\mathit{Sist}}^{\mathit{OP}}\)), including temperatures, flow rates, consumptions, among others. These sen  
Figure 2: Graphical example of operation modes and system operation and reference condition.  
sors reveal the active components at a given instant \(\big{(}on/off_{i}^{OP}\big{)}\) that may contain anomalies due to wear and tear or operational failures.
* Analog Reference Condition (\(REF_{sist}\)): Represents the theoretically ideal operating situation that reflects the same operation mode as \(OP_{sist}\), but without anomalies. It is defined using the same independent external variables of \(OP_{sist}\) (\(\overline{c}_{exter}^{OP}\)) (environmental conditions (\(T_{env}^{OP}\)), demands (\(\dot{Q}_{DHW}^{OP}\)) and equipment activation (\(on/off_{i}^{OP}\))), applied to previously validated models of the active components, generated through ML tools and based on reference behaviour data without anomalies (see Section 3.3). This reference system model provides as outputs the intermediate variables of the components in the reference system (\(\overline{x}_{sist}^{REF}\)) with the operating condition input variables.  
Comparing the \(OP_{sist}\) and \(REF_{sist}\) conditions helps to assess whether the consumption of the whole system in operation (\(C_{sist}^{OP}\)) differs from the reference system (\(C_{sist}^{REF}\)) and, if it differs, it means that there is at least one anomaly to be identified.