Introduction

One of the difficult times the world has been through in the past decade is the era of the COVID pandemic. Businesses had to close down, death took a toll on families, schools shut down, and economies got shuttered. However, COVID taught the world a beautiful lesson of people working remotely. The culture of working remotely has become the new normal for most businesses, giving rise to increased building energy consumption through the continuous use of lighting, computers, electronics, and HVAC systems.

Building energy use is an important subject of discussion since it contributes significantly to the world’s energy use and is directly linked to environmental sustainability. Therefore, the most recent researches on building energy systems have been dedicated to efficient and environmentally friendly technologies [1,2,3]. Building cooling and heating systems are at the heart of building energy use, contributing to about 38% of the building energy consumption [4].

Compared to a typical air-conditioning system or electrical heater, geothermal heat pumps (GSHP) have been found to be an energy-efficient and renewable energy technology for building, heating, cooling, and hot water generation [5]. However, most heat pumps operate with various faults that negatively affect the system performance and operation [6]. When detected and diagnosed earlier, the energy lost due to various faults in heat pumps can be reduced by about 40% [7]. This has resulted in the development of fault detection and diagnosis (FDD) models to spot various faults early, before they deteriorate further in heat pumps.

Refrigerant charge faults greatly affect the energy use of heat pumps [8, 9] and cause severe CO2 emissions. Du et al. [10] assessed the impacts of common faults on vapor compression cycles and observed that a reduction in the performance of these cycles at refrigerant undercharge conditions and refrigerant overcharge greater than 20% of the optimal charge. Shamandi and Jazi [11] investigated various faults, including refrigerant charge faults, in a fixed orifice vapor compression cycle. Authors found that refrigerant overcharge results in higher electric consumption and decreased COP, while refrigerant undercharge causes a decrease in compressor power consumption.

Over the years, there has been enormous research efforts to develop algorithms for detecting faults in HVAC systems [12,13,14,15]. Eom et al. [16] used regression and classification models as refrigerant charge FDD models for a heat pump. The regression method had a root-mean-square error of about 3% and was found to be the best FDD model. Yoo et al. [17] used heat exchanger mid-point temperature and inlet secondary fluid temperature to develop a refrigerant fault detection methodology for an air-conditioning unit and established that the refrigerant charge is sensitive to the temperature difference in the evaporator. The methodology was able to highly predict refrigerant charges below 70% of the optimal value. Zhu et al. [18] examined the use of a gray box model, a machine learning model, and their combination to predict refrigerant charge faults in a data center air-conditioning unit. The study found the hybrid FDD model to be the best in predicting the refrigerant charge fault under a root-mean-error margin of 2.5%. Guo et al. [19] used deep learning to model an FDD algorithm for an air-conditioner. The study found that the selection of the number of epochs, hidden layer nodes, learning rate, and neural network layers greatly affects the prediction rate of the FDD model. Chintala et al. [20] predicted faults in an air-conditioner using a Kalman filter approach that related electrical properties to thermodynamic properties. The FDD algorithm used the residential thermostat and outdoor temperature to predict refrigerant leaks and air leaks with a success rate of 87%. Hu and Yuill [21] experimentally investigated the use of a virtual sensor in finding refrigerant charge faults existing in multiple simultaneous faults in a heat pump. The virtual sensor was able to detect the existence of refrigerant faults but could not accurately predict the extent and magnitude of the refrigerant faults as part of a combination of multiple simultaneous faults. To develop an efficient FDD model for heat pumps in cold China, Sun et al. [22] employed a Kalman filter gray-based model to predict the heat pump parameters and their variance from real data, while a statistical process control method was used to reduce the FDD error margin as it developed dynamic control limits for the heat pump parameters. Liu et al. [23] used exponentially weighted moving average control charts, principal component analysis, and their combinations to predict refrigerant charge fault in an air-conditioner. A combination of statistical methods was found to efficiently predict the refrigerant charge faults. A rule-based FDD method was developed by Guo et al. [24] for an air-conditioner with a focus on the indoor and outdoor units. The FDD method used a regression algorithm to detect faults in real time. The authors validated the proposed FDD model and achieved an overall predicting rate of about 85% in diagnosing faults occurring in the outdoor unit, temperature sensors, and the air-conditioning unit. Kim and Lee [25] posited that the implementation of existing FDD models is expensive due to the cost of adding new sensors to the air-conditioning system. The authors, therefore, developed an FDD model using virtual sensors and found that the use of virtual sensors accurately predicts refrigerant charge faults within a 10% error margin notwithstanding the operating condition or the existence of other faults. Many researchers have also used software-based systems to detect faults [26,27,28,29]. The softwares are installed in residential facilities to measure the power consumption of HVAC systems. A change in the power measurement with time raises an alarm of a potential fault in the HVAC system.

Most FDD algorithms use direct measuring sensors [30,31,32]. In detecting refrigerant charge faults, temperature sensors for measuring heat pump parameters have been used [33]. However, most of these studies have focused on constant speed heat pump units. The few FDD works on variable speed heat pumps in the open literature use rule-based FDD models to compare performance trends to that of the baseline [34, 35]. This study, therefore, experimentally investigates faults in refrigerant charge, their effects on a variable speed water-to-water heat pump unit, and proposes an FDD model to predict these faults. Development of the fault detection model is accomplished using multiple regression analysis and multilayer perceptron analysis by training the experimental data with artificial neural networks in MATLAB.

Methods

Figure 1 provides a representation of the setup built to analyze the refrigerant charge fault and its consequences on a variable-speed heat pump unit. The heat pump unit comprised of a variable-speed compressor, condenser, expansion device, and evaporator. The experiment was done considering summer outdoor conditions using the condenser and evaporator as outdoor and indoor heat exchangers, respectively. R410A and brine were used as refrigerant and secondary fluid, respectively. The brine was controlled using a pump in the evaporator and condenser flow loops. In operating the test rig, the refrigerant got compressed, went through the condenser, exchanged heat with the secondary fluid, and got expanded by the expansion device into a liquid refrigerant that entered the evaporator, absorbed heat from the brine, and entered the compressor as superheated refrigerant for a continuation of the cycle.

Fig. 1
figure 1

Experimental setup of the heat pump

In performing the experiment, the heat pump’s optimum charge was first obtained at standard temperature conditions of 25 \(^\circ \mathrm{C}\) to the condenser and 12 \(^\circ \mathrm{C}\) to the evaporator using ISO 13256–2 [36] and NR GT 101 [37]. Expansion device was used to control the experiment to ensure a constant superheat of 7 \(^\circ \mathrm{C}\). The optimum charge amount was 4700 g and was represented as a 100% refrigerant charge ratio (RCR). The RCR is a percentage of the charge amount at a particular condition and time to the optimum charge. Afterwards, the heat pump’s performance was studied by varying the charge amount from 70 to 120% RCR at various compressor speeds and outdoor entering water temperature (\({T}_{OD}\)) of 25 \(^\circ \mathrm{C}\) and 35 \(^\circ \mathrm{C}\) as shown in Table 1. A refrigerant charge ratio lower than the optimum value is called refrigerant undercharge or regarded as refrigerant leakage, and that higher than the optimum value is called refrigerant overcharge. The measurement of the heat pump’s performance was done by measuring the heat pump parameters using sensors mounted at vantage positions in the experimental setup. Thermocouples of accuracy ± 0.2 \(^\circ \mathrm{C}\), and pressure transducers and refrigerant flowmeter with accuracy ± 0.5%, were used in measuring refrigerant temperature, pressure, and flow rate, respectively, while power meter of accuracy ± 0.5% was used to measure compressor power. Resistance temperature detector sensors with ± 2% accuracy and flow meter with ± 0.15 \(^\circ \mathrm{C}\) accuracy were used in measuring the brine temperature and flow rate, respectively. The test data were recorded every 3 s after steady state on a computer using a Yokogawa MX100 data acquisition device. The heat pump’s capacity was calculated using Eq. 1 with density (\(\rho\)), specific heat capacity (\({C}_{p}\)), volumetric flow rate (LPM), and temperature of brine entering the evaporator (EWT) and temperature of brine leaving the evaporator (LWT), while COP was determined as the capacity (Q) divided by the compressor power (W) as indicated in Eq. 2. The Pythagorean uncertainty principle was used to determine the uncertainty of measured parameters as shown in Eq. 3 [38]. The capacity and COP had uncertainties of 2.7% and 2.9%, respectively.

Table 1 Test map
$$Q=\frac{\rho \times {C}_{p}\times LPM\times \left(LWT-EWT\right)}{\mathrm{60,000}}$$
(1)
$$COP=\frac{Q}{W}$$
(2)
$$U=\sqrt{\sum_{i=1}^{n}\;\left(\frac{U_i}{x_i}\right)^2}$$
(3)

Results and discussion

Performance analysis of the heat pump according to refrigerant charge faults

Performance characteristics of heat pumps are affected by the charge quantity, temperature of brine entering the condenser, and in variable-capacity heat pumps, the compressor speed. The heat pump’s capacity with respect to charge amount, compressor speed, and \({T}_{OD}\) are shown in Fig. 2. A 100% RCR corresponds to the optimum charge value, RCR lower than 100% represents refrigerant undercharge or leak, while RCR higher than 100% represents an overcharge condition. The capacity reduced at undercharge states and slightly increased at overcharge conditions. Generally, the capacity was higher as RCR increased since the amount of heat transferred between the refrigerant and the brine in the evaporator increased. This caused a decrease in evaporating temperature as the RCR increased as seen in Fig. 3. Capacity is greatly affected by the flow rate of the refrigerant and the amount of heat transferred between the refrigerant and the brine in the evaporator, which has a direct effect on the difference in the temperature of the brine in the evaporator. Flow rate of the refrigerant remained fairly the same as the RCR increased as shown in Fig. 4. This is because the opening of the expansion device was decreased to ensure a constant superheat. However, the difference in the temperature of the brine in the evaporator increased as the refrigerant charge amount increased as seen in Fig. 5, as a result of the rise in the amount of heat transferred between the brine and refrigerant in the evaporator.

Fig. 2
figure 2

Change in capacity according to RCR and compressor speed

Fig. 3
figure 3

Evaporating temperature with change in RCR and compressor speed

Fig. 4
figure 4

Change in mass flow rate according to RCR and compressor speed

Fig. 5
figure 5

Change in the temperature difference of brine in evaporator according to RCR and compressor speed

In real systems, the capacity of heat pump units needs to be modulated to meet the cooling load of buildings at part load conditions. The use of variable speed compressors has been found to be an energy-efficient method for capacity control in heat pumps [39]. As presented in Fig. 2, the capacity was higher as the compressor speed increased from 50 to 60 Hz, 70 Hz, and 80 Hz at all refrigerant charge ratios and OD EWT. While compressor speed increased, evaporating temperature decreased to cause a rise in the rate of the R410A. This gave rise to the amount of heat transferred between the brine and the R410A in the evaporator, resulting in an increase in the difference in temperature of brine across the evaporator and a rise in capacity.

The COP is optimized at 100% RCR. Therefore, any charge amount rather than the optimum value will reduce the COP, as shown in Fig. 6, and make the heat pump energy intensive. The variation in COP was largely due to the change in the pressure difference across the compressor as the refrigerant charge varied. Figure 7 shows that the difference in pressure across the compressor decreased during undercharge conditions and increased during overcharge conditions. This directly affected the compressor power as presented in Fig. 8. Thus, the compressor power reduced during refrigerant undercharge and increased during refrigerant overcharge. However, the cooling capacity decreased during undercharge conditions and slightly decreased during overcharge conditions. This decreased the COP since the decreasing rate in cooling capacity was above that of the compressor power at undercharge conditions.

Fig. 6
figure 6

Change in COP with RCR and compressor speed

Fig. 7
figure 7

Change in pressure difference with RCR and compressor speed

Fig. 8
figure 8

Variation of compressor power according to charge ratio and compressor speed

Furthermore, an increase in the compressor speed decreased the COP. As seen in Fig. 9, increasing the compressor speed increased the condensing temperature, while the evaporating temperature decreased. This caused a significantly increased temperature lift, which decreased the COP.

Fig. 9
figure 9

Variation in condensing temperature according to charge ratio and compressor speed

The effect of refrigerant leaks on the capacity greatly increased; the percentage leakage increased. At the reference compressor speed (60 Hz), the capacity reduced by 4.3%, 18.4%, and 30.3% as the refrigerant charge ratio decreased from 100 to 90%, 80%, and 70%, which corresponds to 10%, 20%, and 30% leak, respectively.

During times when variable-capacity heat pumps are not operating at the reference capacity or set temperature, the variable speed compressor always cycles to meet the set cooling temperature. Thus, when variable speed heat pumps experience refrigerant charge faults, the compressor speed increases to meet the cooling load. This greatly increases the energy consumed by the heat pump and decreases the COP. For instance, at 90% and 80% refrigerant charge ratios, the compressor speed increased to 70 Hz and 80 Hz, respectively, to meet the baseline capacity. However, the COP decreased by 10.2% and 20.7% from the reference value at 70% and 80% compressor speeds to match the reference cooling capacity at 90% and 80% refrigerant undercharge respectively. This shows that there is a sharp increase in the energy consumption of variable speed heat pumps as refrigerant leak levels increase. It is, therefore, important to model refrigerant charge FDD algorithms for variable speed heat pumps to detect refrigerant leakage as early as possible to prevent these high-energy consumption levels.

Refrigerant charge FDD model

Refrigerant leakage or overcharge constitutes faults in heat pumps. Refrigerant leakage mostly occurs due to wears and tears in heat pump components, while overcharge faults are related to human errors during charging. Aside from refrigerant leakage, an increase in outdoor temperature conditions also degrades the heat pump’s performance. However, the outdoor temperature cannot be controlled in real systems. It is, therefore, expedient to consider it when developing a refrigerant FDD algorithm. Furthermore, the most recent heat pumps adopt variable speed compressors to meet the required cooling load of buildings due to their energy-efficient nature compared to other heat pump capacity control methods. The variable-speed compressor is engaged to produce the baseline capacity when the heat pump is operating at off-design conditions. At refrigerant undercharge, or increased outdoor temperature conditions, increasing the compressor speed increases the capacity to the baseline value. Therefore, the variable speed compressor needs to be considered when developing a refrigerant charge FDD model for a variable-capacity heat pump. The heat pump’s performance trend with respect to the refrigerant charge faults, condenser inlet water temperature (\({T}_{OD}\)), and compressor speed is presented in Table 2. The discharge temperature and pressure of the compressor, subcooling, condensing temperature, change in temperature of brine across the condenser and evaporator reduced at undercharge condition, and increased during overcharge, while the evaporating temperature increased at refrigerant undercharge but reduced during refrigerant overcharge. The evaporating and condensing temperatures, and the discharge pressure and temperature of the compressor, increased as \({T}_{OD}\) increased and decreased as \({T}_{OD}\) decreased, while the change in temperature of the brine across the condenser and evaporator decreased as \({T}_{OD}\) increased. However, the degree of subcooling was insensitive to changes in the \({T}_{OD}\). Furthermore, the discharge pressure and temperature of the compressor, subcooling, condensing temperature, and change in temperature of the brine across the evaporator and condenser decreased as the compressor speed decreased, while the evaporating temperature decreased as the compressor speed increased and increased as the compressor speed decreased.

Table 2 Parameter trend with variation of refrigerant fault, \({T}_{OD}\), and compressor speed

The discharge temperature of the compressor has been used to predict refrigerant charge faults since it is easier and cheaper to measure and is sensitive to the refrigerant charge [31]. Subcooling has also been used by researchers in detecting refrigerant charge faults because it is insensitive to the outdoor entering water temperature. However, its measurement in real systems is a bit tedious and costly due to the need for pressure sensors, temperature sensors, and refrigerant property tables. This study, therefore, focuses on the use of compressor discharge temperature to predict refrigerant charge faults in a heat pump equipped with a variable speed compressor. Figure 10 shows the relationship between the discharge temperature of the compressor with respect to changes in refrigerant charge, compressor speed, and the temperature of brine entering the condenser. The compressor discharge temperature increased as the charge amount and \({T}_{OD}\) increased. Since the compressor discharge temperature is sensitive to the \({T}_{OD}\) and cannot be controlled in real systems, it is considered in the development of the FDD algorithm.

Fig. 10
figure 10

Changes in compressor discharge temperature with RCR, compressor speed, and \({T}_{OD}\) of a 20 \(^\circ \mathrm{C}\), b 25 \(^\circ \mathrm{C}\), c 30 \(^\circ \mathrm{C}\), and d 35 \(^\circ \mathrm{C}\)

Artificial neural network (ANN)-based versus regression-based approaches

Motivation for using ANN

The motivation for settling on a machine learning approach stems from the fact that the FDD problem is one that takes a while to diagnose if reliance on just the traditional linear regression model is the only instantiated solution. Today, with the ubiquity in computational processing power and lower cost in the acquisition of sensors and microprocessors, a data-driven paradigm realizable via ANN provides a better approach than the static, nonflexible experimental-based approach of basic linear regression.

In the deployment of such environments, logging the FDD statistical data, analyzing it, and reconfiguring the parameters of the system for optimal performance is also both a highly time-consuming and laborious venture, particularly for real-time deployable setups. The data points obtainable through consistent supervision are not commensurate with the time invested, so a linear learning model is not appealing. A machine learning approach remedies these problems.

Weka-based analysis (preprocessing and rapid prototyping)

The data was initially preprocessed using the Weka software with a number of models tested to get a cursory view of which various machine learning models and regression models would be viable. This sped up the stages of data preprocessing and rapid prototyping. Two models were eventually decided upon for comparison based on our understanding of [16] and [17]. We settled on the traditional linear regression model and the multilayered perceptron model.

Linear regression model

The refrigerant charge FDD model for the variable compressor speed heat pump was developed using linear regression. The compressor speed (\({C}_{s}\)), compressor discharge temperature (\({T}_{dis}\)), and outdoor entering water temperature (\({T}_{OD}\)) were selected as indepedent variables for the model. The FDD algorithm was modelled to be a second-order polynomial as presented in Eq. 4 and is able to predict the charge quantity with a root-mean-square error of 4.5 as shown in Fig. 11.

Fig. 11
figure 11

Prediction of refrigerant charge fault using linear regression model

$$RCR=137.9-2.089{C}_{s}+0.00502{{C}_{s}}^{2}+2714{T}_{dis}-0.005306{{T}_{dis}}^{2}-6.554{T}_{OD}+0.06188{{T}_{OD}}^{2}-0.004208{C}_{s}{T}_{dis}+0.02397{C}_{s}{T}_{OD}-0.005838{T}_{dis}{T}_{OD}$$
(4)

Comparison of linear regression model and Weka-based ANN model

Based on the results of the cross-validation summary presented in Table 3, it is deducible that an artificial neural network (ANN) solution would offer a better approach to addressing the FDD problem. The preprocessing and rapid prototyping phases were done using 96 samples from the experimental data. Weka offers an API extensible via Python to implement any final solution on a microprocessor or microcontroller. However, for better control over the tuning of our parameters, we instead chose to implement our final solution in MATLAB.

Table 3 Performance comparison of linear regression model and ANN model with Weka

MATLAB-based analysis

Table 4, referred to as Algorithm 1, captures the simulation steps involved in determining the optimal number of neurons needed for the hidden layer. Based on the results of this rapid prototyping phase, a neural network model was designed in MATLAB [40]. Since the dataset used in our simulations is hyper-dimensional, obtaining a 3D plot would be difficult. However, a good measure of the performance of the artificial neural network (ANN) is possible via RMSE values. The \({RMSE}_{\mathrm{train}}\) and \({RMSE}_{\mathrm{val}}\) represent the error measure between the true output value (\({\mathrm{y}}_{\mathrm{output}})\) and the corresponding predicted values from the training set (\({\mathrm{y}}_{\mathrm{train}}\)) and cross-validation set (\({\mathrm{y}}_{\mathrm{val}}\)), respectively. The training set and cross-validation set were generated by using a 70%/30% split on the generated dataset. The number of neurons for the hidden layer was therefore selected based on the observation of the decrease in the error due to training (\({RMSE}_{\mathrm{train}}\)) from 0.08 to 0.03, which afterwards became relatively stable as shown in Fig. 12. However, an increase in the cross-validation error (\({RMSE}_{\mathrm{val}}\)) from its lowest of 0.06 with an increase in the number of hidden layer neurons meant that a problem of overfitting would occur if the number of neurons exceeded 7. Hence, the initial Monte Carlo simulation of 100 iterations arrived at a value of 7 neurons for the hidden layer. This indicates a saturation in the performance of the system, and hence no additional benefit from adding more neurons. The insight then is that the ANN requires 7 neurons in the hidden layer to make viable predictions on any subsequent test sets fed into it under similar experimental conditions and parameters. Therefore, for testing the performance of the trained ANN on any test set, one only needs to fix the selected number of neurons (n) variable of Algorithm 1 to the optimal number of neurons (7 in this case). The experimental parameters used for the simulation are captured in Table. 5.

Table 4 Algorithm 1: ANN simulation algorithm for determining optimal number of neurons for hidden layer
Fig. 12
figure 12

Plot of root-mean-square error values against the number of neurons in the hidden layer

Table 5 Simulation parameters

In terms of deployment of the ANN, it could either work in real time or be deployed after pre-training. For this work, the pre-training scenario is assumed due to the length of time needed to accumulate and preprocess the data for training. Thus, the weights used after deployment could change after periodically retraining the ANN with more data. This is also one of the reasons why the ANN is preferable to the linear regression model as it is more adaptable to changes in data and less prone to problems such as under-fitting and over-fitting which could affect a regression-based model.

Conclusions

The performance of a variable-speed heat pump as affected by refrigerant charge faults was studied at different outdoor entering water temperatures (\({T}_{OD})\) and the performance trends used for the development of a refrigerant charge FDD model. The refrigerant charge FDD model was developed using a multiple linear regression model and multilayer perception model to ascertain which of the models will accurately predict the refrigerant charge fault using the compressor discharge temperature, \({T}_{OD,}\) and compressor speeds as input data. The following conclusions are drawn from the study:

  • The refrigerant charge amount, outdoor entering water temperature, and compressor speed significantly affected the heat pump’s performance.

  • An increase in compressor speed was found to compensate for the degradation in the capacity during refrigerant leak. However, this resulted in a decrease in the COP, leading to higher energy consumption.

  • The FDD model using multilayer perception showed higher prediction accuracy with a mean square error of ± 3.7%, while the multiple linear regression model predicted the refrigerant charge fault with a mean square error of ± 4.5%.

  • A Monte Carlo simulation ran showed that the multilayer perceptron model requires 7 neurons in the hidden layer to make viable predictions on any subsequent test sets fed into it under similar experimental conditions and parameters.

  • The FDD models discussed are applicable to the heat pump studied in this work. Nonetheless, the approach can be used in future works that would seek to develop a generic FDD model for water-to-water heat pumps.