## 3 Proposed Methodology
### Learning and Locking Reference Systems with Machine Learning
#### 3.3.2 Reference Condition Modelling: Individual Components and the System as a Whole  
As previously mentioned, the objective is to compare the actual operating condition with the reference condition without anomalies, considering both the individual components and the system as a whole. Thus, two main reference models without anomalies are learned:  
* Individual Reference Operator: one ML model for each component \(i\) in the reference state. * Reference System Model: ML model for the reference system as a whole. This modelling is performed before applying diagnosis techniques and only once considering the reference data (\(\overline{x}_{i}^{REF}\)). Data for the learning phase can be generated from computer simulators, such as Trnsys, in the absence of empirical data. However, as previously argued, the aim is to avoid the use of commercial software and focus exclusively on a sensor-based approach. In this context, since the following thermoeconomic diagnosis application will also be based on sensor data, it is assumed that such data will be adequate to generate the necessary reference models. Once validated, it is \"frozen\" or \"locked\" and used to calculate the costs associated with the anomalies by feeding them with data in the operating condition (\(\overline{x}_{i}^{OP}\)). The architecture of the neural network depends on the objectives of the study and the characteristics of the data. Hybrid modelling using physics informed machine learning, specifically Physics-Informed Neural Networks (PINNs), are proposed to model complex thermodynamic systems. This method integrates fundamental physical principles such as mass, energy, and entropy balances with machine learning and deep learning techniques to develop a hybrid physics-driven dynamic modelling framework [27]. PINNs allow for integrating experimental data with physical laws expressed by partial or ordinary differential equations. During training, they minimise a loss function that combines the neural network error with the deviation from the mass and energy conservation equations and entropy balances, ensuring that the model complies with the physical principles of the system. To construct a PINN, the relevant thermodynamic equations are first defined and incorporated as constraints in the loss function. The model is then trained using historical reference data so that the predictions comply with both the observed reference data and the differential equations of the system physics. Although we do not find examples in the literature related to applications in thermal installations in buildings, PINNs were originally introduced by [PERSON] et al. in 2019 [28], and have since been developed for complex mechanics and thermodynamics applications. [PERSON] et al. [29], present a new PINN framework for modelling interface problems in which they achieve reduced system error and lower computational cost. [PERSON] et al. [27] propose an improved solution based on PINNs for solving integral-differential equations. [PERSON] et al. [30] use PINNs to solve the partial differential equations that model macroscopic pedestrian flow and conclude that the ro-PINN is the most efficient option for simulating the evolution of macroscopic pedestrian flow. Individual Reference Operators Modelling  
For the so-called reference operators, our proposal focuses on training a PINN for each \(i\) component (e.g., boiler, heat exchanger), modelling its reference behaviour, based on historical reference data without anomalies. In this case, the input variables for learning the PINN will be the data linked to the inputs of these components without anomalies (\(\overline{x}_{j}^{REF}\)); and the output variables, the ideal outputs without anomalies (\(\overline{x}_{out,i}^{REF}\)), which will be used to calculate the reference unit consumption of component \(i\) (\(k_{i}^{Bref}\)).