This paper presents a comprehensive machine learning-based approach for automatic fault detection in Heating, Ventilation, and Air Conditioning (HVAC) systems. HVAC systems are the largest energy consumers in commercial buildings, accounting for 40–50% of total energy usage. Undetected faults result in significant energy waste, reduced efficiency, and elevated maintenance costs. Traditional rule-based threshold monitoring systems fail to capture the complex, multivariate relationships between system parameters, making them unsuitable for early-stage fault detection.
In this study, a synthetic dataset of 10,000 samples was generated, encompassing eight temperature sensors (T1–T8) and compressor power (kW) as features, covering five condition classes: Normal, Condenser Failure, Low Refrigerant, Poor Cooling, and Sensor Failure. A Random Forest ensemble classifier was trained and evaluated against three competing algorithms — Decision Tree, K-Nearest Neighbours, and Logistic Regression — using five-fold stratified cross-validation. The proposed Random Forest model achieved 97.76% cross-validation accuracy and 97.55% test accuracy, with macro-averaged precision and recall both at 0.98, substantially outperforming conventional methods. Extensive analysis including ROC curves, learning curves, feature importance rankings, and per-class performance metrics validate the robustness and generalizability of the system. The results demonstrate that machine learning can effectively replace conventional rule-based building management systems for proactive, predictive HVAC maintenance.
Introduction
This paper proposes a machine learning–based fault detection and diagnosis (FDD) system for HVAC (Heating, Ventilation, and Air Conditioning) equipment using a Random Forest multi-class classifier. HVAC systems are critical for maintaining indoor comfort, air quality, and energy efficiency, but they consume nearly 40–50% of total energy in commercial buildings and are vulnerable to faults such as refrigerant leaks, condenser failures, sensor malfunctions, and compressor issues. Traditional monitoring systems rely on fixed alarm thresholds, which often fail to detect subtle or complex fault patterns. The study explores machine learning as a more intelligent alternative.
Problem Statement
The objective is to classify HVAC operating conditions into one of five categories using sensor measurements from eight temperature sensors (T1–T8) and compressor power:
Normal Operation
Condenser Failure
Low Refrigerant
Poor Cooling
Sensor Failure
Unlike conventional Building Management Systems (BMS), the proposed approach does not require manually configured thresholds.
Objectives
The study aims to:
Monitor HVAC temperatures and power consumption.
Develop a multi-class Random Forest fault classifier.
Compare Random Forest against:
Decision Tree
K-Nearest Neighbors
Logistic Regression
Evaluate performance using confusion matrices, ROC curves, learning curves, and feature importance analysis.
Demonstrate suitability for integration with IoT-enabled building management systems.
Literature Review
Previous HVAC fault detection research has evolved through several stages:
Traditional Approaches
Rule-based and model-based methods achieved 70–80% detection accuracy under controlled conditions.
Performance degraded significantly under varying operating environments.
Statistical and Machine Learning Methods
Bayesian networks improved handling of uncertain sensor readings.
PCA reduced dimensionality and lowered false alarms.
Support Vector Machines achieved high accuracy but required extensive tuning.
Neural networks captured complex nonlinear relationships but often overfitted small datasets.
Ensemble Learning
Random Forest emerged as a preferred approach because it:
Combines predictions from many decision trees.
Reduces overfitting.
Handles multivariate sensor data effectively.
Provides interpretable feature importance scores.
Recent research has also explored IoT integration, hybrid ensemble systems, and deep learning architectures.
Dataset Description
The study uses a synthetic dataset simulating a vapor-compression air-conditioning system.
Input Features
Nine operational parameters are recorded:
Feature
Description
T1
Compressor inlet temperature
T2
Compressor outlet temperature
T3
Condenser outlet temperature
T4
Expansion valve outlet temperature
T5
Fresh air inlet temperature
T6
Evaporator inlet air temperature
T7
Evaporator outlet air temperature
T8
Room/chamber temperature
Power
Compressor power consumption
These variables represent critical thermal and energy characteristics of HVAC operation.
Fault Classes
The dataset contains 10,000 samples distributed almost equally across five classes:
High power consumption and elevated room temperatures
Sensor Failure
Erratic and inconsistent sensor readings
The balanced class distribution eliminates the need for oversampling or undersampling methods.
Dataset Characteristics
Key dataset properties:
Total samples: 10,000
Classes: 5
Features: 9
Missing values: None
Class distribution: Approximately 20% per class
Because the dataset is balanced, classifier performance can be evaluated fairly without bias toward any fault category.
Exploratory Data Analysis
Class Distribution
The dataset exhibits near-perfect balance:
Normal: 19.78%
Condenser Failure: 20.41%
Low Refrigerant: 19.76%
Poor Cooling: 20.33%
Sensor Failure: 19.72%
This balanced structure supports reliable training and testing.
Feature Behavior Across Faults
Distinct sensor patterns emerge for each fault:
Condenser Failure: High T2 and T3 temperatures.
Low Refrigerant: Significant drop in T4 and increase in T1.
Poor Cooling: Elevated power consumption and higher room temperature (T8).
Sensor Failure: Abnormal and inconsistent sensor relationships.
These distinct signatures suggest that machine learning models should be capable of accurately separating fault categories.
Correlation Analysis
The correlation matrix reveals meaningful thermal relationships:
Strong positive correlation between T2 and T3 (0.72).
Moderate positive correlation between T5 and T6 (0.64).
These correlations reflect interconnected heat-transfer processes within the refrigeration cycle and provide useful information for machine learning classifiers.
Expected Benefits of Random Forest
The proposed Random Forest approach offers several advantages:
Detects complex multivariable fault patterns.
Eliminates dependence on manually configured alarm thresholds.
Handles nonlinear sensor relationships.
Provides robust classification performance.
Produces feature importance rankings for fault interpretation.
Easily integrates into smart building and IoT monitoring systems.
Conclusion
This paper has presented a robust, data-driven fault detection system for HVAC applications based on the Random Forest ensemble classifier. Using nine sensor features from a 10,000-sample synthetic dataset covering five operational classes, the proposed system achieves 97.76% cross-validated accuracy and 97.55% test accuracy — substantially outperforming conventional rule-based approaches (70–80%) and competing machine learning models.
Exhaustive analysis through confusion matrices, ROC curves (all AUC ? 0.99), per-class precision/recall, feature importance rankings, learning curves, and n_estimators sensitivity studies confirms that the Random Forest model is accurate, stable, and well-generalised. Feature importance analysis reveals that refrigerant-side temperatures (T4, T1, T8) are the most diagnostic signals, offering actionable guidance for future sensor deployment strategies.
The system is lightweight (no dedicated database, Python + scikit-learn only), deployable through a Streamlit web interface, and ready for integration with BMS and IoT platforms. Future work will focus on validating the approach on real HVAC sensor data, expanding the fault taxonomy, incorporating temporal sequence modelling, and deploying on embedded edge hardware for real-time inference.
References
[1] S. Katipamula and M. R. Brambley, \"Methods for fault detection, diagnostics, and prognostics for building systems — A review, Part I,\" HVAC&R Research, vol. 11, no. 1, pp. 3–25, 2005.
[2] S. Katipamula and M. R. Brambley, \"Methods for fault detection, diagnostics, and prognostics for building systems — A review, Part II,\" HVAC&R Research, vol. 11, no. 2, pp. 169–187, 2005.
[3] Y. Zhao, J. Wen, and S. Wang, \"Diagnostic Bayesian networks for diagnosing air handling units faults,\" Building and Environment, vol. 45, no. 6, pp. 1479–1488, 2010.
[4] J. Li and S. Wang, \"An improved fault detection method for HVAC systems using principal component analysis,\" Energy and Buildings, vol. 43, no. 12, pp. 3463–3470, 2011.
[5] Q. Yan and F. Xiao, \"Fault detection and diagnosis for HVAC systems using support vector machines,\" Energy and Buildings, vol. 43, no. 6, pp. 1418–1426, 2011.
[6] H. Li, Z. Wang, and X. Chen, \"Application of artificial neural networks in HVAC fault detection,\" Energy Procedia, vol. 14, pp. 1482–1487, 2012.
[7] M. Beghi, L. Cecchinato, and M. Rampazzo, \"Fault detection and diagnosis for HVAC systems using decision trees,\" Energy and Buildings, vol. 76, pp. 117–126, 2014.
[8] D. Wang and J. Ma, \"Energy-efficient fault detection in HVAC systems based on data mining,\" Applied Energy, vol. 135, pp. 74–83, 2014.
[9] K. Lee and S. Park, \"Hybrid machine learning model for HVAC fault diagnosis,\" Energy and Buildings, vol. 86, pp. 357–365, 2015.
[10] J. Kim and K. Cho, \"Random forest-based fault detection approach for HVAC systems,\" Energy and Buildings, vol. 118, pp. 1–10, 2016.
[11] R. Singh and P. Sharma, \"IoT-based smart monitoring system for HVAC applications,\" Int. Journal of Engineering Research, vol. 5, no. 4, pp. 120–125, 2016.
[12] A. Gupta and R. Verma, \"Predictive maintenance of HVAC systems using machine learning,\" Int. Journal of Mechanical Engineering, vol. 7, no. 2, pp. 45–52, 2017.
[13] L. Breiman, \"Random Forests,\" Machine Learning, vol. 45, no. 1, pp. 5–32, 2001.
[14] F. Pedregosa et al., \"Scikit-learn: Machine learning in Python,\" J. Machine Learning Research, vol. 12, pp. 2825–2830, 2011.
[15] Y. Yan, J. Wang, and F. Xiao, \"Deep learning for fault diagnosis in HVAC systems,\" Energy and Buildings, vol. 158, pp. 131–140, 2018.