Next Article in Journal
Investigation to Enhance Solid Fuel Quality in Torrefaction of Cow Manure
Previous Article in Journal
Rethinking Abandoned Buildings as Positive Energy Buildings in a Former Industrial Site in Italy
 
 
Font Type:
Arial Georgia Verdana
Font Size:
Aa Aa Aa
Line Spacing:
Column Width:
Background:
Article

Integration of Machine Learning Solutions in the Building Automation System

Department of Electrical Apparatus, Faculty of Electrical, Electronic, Computer and Control Engineering, Technical University of Lodz, 90-537 Lodz, Poland
*
Author to whom correspondence should be addressed.
Energies 2023, 16(11), 4504; https://doi.org/10.3390/en16114504
Submission received: 4 May 2023 / Revised: 30 May 2023 / Accepted: 1 June 2023 / Published: 2 June 2023
(This article belongs to the Section A1: Smart Grids and Microgrids)

Abstract

:
This publication presents a system for integrating machine learning and artificial intelligence solutions with building automation systems. The platform is based on cloud solutions and can integrate with one of the most popular virtual building management solutions, HomeAssistant. The System uses communication based on the Message Queue Telemetry Transport (MQTT) protocol. The example machine learning function described in this publication detects anomalies in the electricity waveforms and raises the alarm. This information determines power quality and detects system faults or unusual power consumption. Recently, increasing electricity prices on global markets have meant that buildings must significantly reduce consumption. Therefore, a fundamental element of energy consumption diagnostics requires detecting unusual forms of energy consumption to optimise the use of individual devices in home and office installations.

1. Introduction

Worldwide, there is a struggle to reduce the energy consumption of residential and industrial buildings [1]. One of the main reasons for reducing energy consumption is the source of non-renewable sources. In addition, existing power plants generate a significant amount of CO2, which makes us want to reduce the amount of energy and thus reduce CO2 consumption [2]. The European Union (EU) has devised a plan to combat climate change [3]. The program includes new regulations for CO2 emissions and reducing energy consumption and it that will affect many sectors, including the building sector [4]. According to the EU directive, buildings in the European Union must become more energy efficient and sustainable. Regulations promote the refurbishment of existing buildings and the design of new buildings to minimise their environmental impact. According to the directive, any new building must meet strict standards in terms of energy consumption. The regulation means new buildings must have low energy consumption, use renewable energy sources and have adequate thermal insulation and ventilation. Building owners must reduce CO2 emissions and energy consumption by upgrading heating systems and installing photovoltaic panels or thermal insulation. All public buildings, such as schools and hospitals, must meet higher energy efficiency standards and renewable energy sources. All activities will encourage investment in more sustainable buildings and accelerate the process of change throughout the building sector. The first step in improving the energy efficiency of a building is to create an intelligent and conscious energy system [5,6,7]. The energy system is part of the building management system (BMS). Building control systems, also known as BMS, are becoming increasingly popular today as they allow buildings to be managed more efficiently and minimise energy consumption (operation) and costs. Building management systems have many components, such as sensors, controls, user interfaces, lighting and computer programs. These elements enable data collection and the processing of energy consumption, weather conditions, temperature and humidity in the building and the load on systems such as heating, ventilation and air conditioning.
In order to be able to manage the building properly, it is necessary to exclude faults in the electrical installation that may cause an increased demand for electricity. In addition, the analysis of energy consumption allows users to detect devices or situations in the house that cause an anomaly of consumption concerning regular operation [8,9,10]. Building control systems can optimise the operation of systems to achieve the highest possible energy efficiency. For example, building management systems can control the room temperature to ensure occupant comfort and minimise energy consumption. Chemingui, Gestli and Ellabban achieved a 21% reduction in energy consumption by using machine learning algorithms for indoor air quality [11]. Mariano-Hernandez et al. condensed research that allows energy savings of up to several dozen per cent through multiple building management systems. [12]. In many other studies, authors describe how we can reduce energy consumption by building automation [13,14,15,16,17,18]. Bardazzi and Pazienza described how lighting systems could help with population ageing. The system described by the authors can turn lighting on and off to reduce energy waste [19]. Machine learning can support home automation systems, Kent et al. In the research, intelligent sensors were used to manage the lighting in an office to save energy and then artificial intelligence (AI) from IoT data was applied to defect detection (blocked sensors) to improve performance. Finally, they used vector machines to detect desk illuminance [20]. Desk illuminance sensor blockage was detected using support vector machines for closed-loop daylight harvesting. Building control systems are most important in large buildings such as offices and hotels, where energy consumption is significant and expensive. These systems are also used in private homes, which can help save energy and provide comfort to residents. In addition to saving energy and ensuring optimal comfort, modern systems can also detect anomalies that may cause damage to the equipment or be the reason for higher energy consumption [21,22,23,24]. BMSs are essential tools for efficient building management. They enable optimising energy consumption, increasing occupant safety and minimising costs. Therefore, more and more buildings are using such systems to achieve maximum effects. Artificial intelligence (AI) in buildings minimises energy consumption and supports fault detection [25,26,27]. AI is a tool that can help with energy management and accelerate the process of energy transition. Thanks to AI, companies and institutions can predict and optimise energy consumption, bringing environmental and financial benefits. Predicting energy consumption is one of the most fundamental ways AI can be used. The energy management system uses classification algorithms to improve its mechanisms. AI can analyse various data, such as outdoor temperatures, the day’s duration or weather forecasts, to predict future energy consumption. In this way, the user can better plan energy production and minimise costs. Another way to use AI in energy management is to optimise energy systems. AI can help optimise the operation of heating, cooling and ventilation systems to minimise energy consumption and costs. These systems can continuously respond to changing parameters.
One of the critical elements for the use of AI in building systems is computing power. Computing power is the ability of a system to process large amounts of data in a short period. In the case of building control systems, computing power is critical for processing sensor data, monitoring energy consumption and making real-time decisions. Thanks to machine learning, these systems can analyse sensor data and learn how to best optimise energy consumption based on weather conditions and system load. For example, these systems can analyse sensor data to predict when occupants will leave the building and adjust energy consumption accordingly.
Many articles have adjusted machine learning to improve intelligent home automation systems. However, authors mainly described prototypes of systems with partial integration. Our research aims to have a cloud-based solution to integrate with home automation systems quickly. It is the first step of the solution with support for more interfaces and algorithms. Furthermore, in this research we want to achieve observability for the anomaly of energy consumption from home automation systems.
In summary, computing power and artificial intelligence are critical to building control systems that enable more efficient energy management in buildings. Thanks to data analytics and machine learning, these systems can learn how to use energy and adapt it to external conditions. In this way, these systems help reduce buildings’ cost and environmental impact.

2. Anomaly Detection in System Building

Anomaly classification is about identifying unusual patterns or events that deviate from typical patterns in the data. It is an essential tool in many fields, including social sciences, economics, medicine and computer science [28,29,30,31].
Data anomalies can be challenging to identify because it is not always clear what constitutes a “typical” pattern. The classification of anomalies is to identify those patterns that do not conform to the general trend. In scientific publications, the classification of anomalies can be crucial in identifying essential phenomena or trends. Data anomalies can be classified using various methods, including statistical methods, machine learning and social network analysis. Anomaly detection can be realized alone or in a combination of methods. The combination of algorithms depends on the characteristics of the data and the purpose of the analysis.
Current building systems do not provide direct support for using machine learning algorithms, such as anomaly classification and detection. In addition, more complex algorithms do not support GPU technology, e.g., CUDA [32].
Our proposal to solve this problem is an intelligent expert platform, thanks to which we can easily integrate building data and use machine learning algorithms. Furthermore, this platform will support many types of communication with the building and can use many algorithms. In this paper, we focus on presenting one of the most popular forms of data exchange in modern buildings and an algorithm for anomaly detection based on measurement data from the building’s power management and monitoring system.
Machine learning has different kinds of anomaly detection methods. For example, we can use supervised, unsupervised or semi-supervised types of anomalies.
In supervised learning, the quality of the training dataset is paramount. There is much manual work needed to split data into normal and abnormal. The unsupervised is the most common type of anomaly detection. The advantage of this method is that it allows us to decrease the manual work in anomaly detection. Semi-supervised anomaly detection methods combine the advantages of the previous two methods. Engineers can use unsupervised learning methods to automate feature learning and work with unstructured data. However, by combining them with human supervision, they can monitor and control what kind of patterns the model learns. We can use many machine learning algorithms: Local outlier factor (LOF), K-nearest neighbours (KNN), Support vector machine (SVM), DBSCAN, Autoencoders, Bayesian networks and Binary trees.
The algorithm we have integrated into our platform is called iforest. The iforest algorithm is a popular anomaly classification method based on decision trees. In this article, we discuss anomaly classification using the iforest algorithm based on energy data from building systems. The iforest algorithm was developed by Liu, Ting and Zhou in 2008 and is a machine learning method that uses decision trees to classify anomalies in data [33]. Unlike other methods, such as clustering or principal component analysis, iforest selects samples from the data and then uses decision trees to identify anomalies. The iforest algorithm selects random samples from the data and creates a decision tree based on those samples. Decision trees consist of nodes and leaves, each representing a decision based on the value of one of the data features. Anomalies are identified by their shallow depth in the decision tree. In other words, the anomaly is classified as a leaf in the tree, which can be achieved with relatively few decisions. The iforest algorithm is relatively simple and easy to understand, which makes it popular with researchers [34,35,36,37]. However, like any anomaly classification method, iforest has its limitations and requires a good fit to the data to achieve reliable results. Care should also be taken to ensure that the method follows scientific and ethical principles. We adopted the iforest algorithm for the energy consumption parameters in buildings with relatively high volatility.
In Table 1, we present a short review of some algorithms in the area of anomaly detection. In addition, there are many publications on anomaly detection described in the article by Fahim and Sillitti [37] and Cook et al. prepared a review of anomaly detection for IoT [38].

3. Building a Machine Learning System

Buildings on the market often have different building systems and solutions. We have yet to set a standard for interfaces in buildings. Therefore, building data are integrated in many ways, depending on the building automation system. Intermediate systems and time series databases are often used for this purpose. Such solutions combine traditional building systems with cloud and distributed solutions. The communication between the building and the systems is visible in Figure 1.
The building shown in Figure 1 represents an object in building systems equipped with several devices connected to building automation systems. The building, equipped with various control, measurement and execution systems, is managed by individual building systems, including Grenton [46], LCN [47], Siemens [48], Jung, Gira, Wago, Schneider, Loxone [49] and many others. Individual building systems have extensive configuration capabilities, creating integrations and communication with cloud solutions. Some of these companies can use machine learning to create a starting configuration; for example, Loxone uses a pre-built learning model that can create a basic system configuration based on the added elements of the building layout. In order to make full use of the values coming from the building systems, it is necessary to integrate and visualise them. In the target solution, our platform will be able to optimise the parameters of the building without knowing the data and the system. In the first step, described in this publication, we want to show the possibility of integrating the cloud platform with the building system in order to detect energy consumption anomalies.
In the sequence diagram from Figure 2, we see an example of the WAGO system installed in one room of the Department of Electrical Apparatus, Technical University of Lodz. The Wago system is integrated with sensors and cloud infrastructure located in the local network.
A prevalent method of data exchange in building Information and Communication Technology (ICT) systems is the MQTT protocol, which allows us to exchange data from any system (that supports this type of connection) [50]. For the System based on the MQTT protocol to work correctly, a broker must be in the computer network, such as Mosquito or RabbitMQ [51]. These brokers are responsible for forwarding the messages circulating within it and for appropriate redirection and dissemination. MQTT communication is also becoming more familiar with developing virtual building systems such as HomeAssistant. This System has several solutions and integration capabilities, thanks to which we can create very complex scenarios and schedules for building management. In order to optimally monitor and store data, databases based on the time series database model are used, such as InfluxDB [52] or Prometheus. Data visualization and event alert handling are easy to monitor in the Grafana system. Based on trends in building technology and the availability of reference buildings to test our machine-learning System for buildings, we selected two buildings equipped with energy monitoring [53].
One of the measurement objects is a laboratory room on a modern and intelligent floor of the building of the Department of Electrical Devices of the Technical College of Lodz. This type of building object has stable energy consumption parameters and a Wago measurement system for monitoring energy consumption. Another research object is a family house equipped with an energy monitoring system based on the Zamel system. This type of building has multiple parameters of energy consumption, which are influenced by many external factors and the availability of users in the building. The method of communication in the tested objects is described in Figure 3. Each building sends data via TCP/IP communication to the MQTT broker. Our machine learning system and other systems in the building network fetch the data in MQTT. All samples are saved in Prometheus and everything we can show in Grafana Dashboard. Additionally, we have integrated Home Assistant [54] into the System because it is the open source for managing the building.
The “building1” (in Figure 3) uses the Wago measurement system, which sends measurement data directly to the MQTT broker at a frequency of 60 s. The MQTT broker exists in the same local network as the WAGO System; the data from the WAGO system are transferred directly to the broker. The “building2” uses the Zamel measurement system and the Supla solution for data transmission. We need to use Supla Cloud because this building is not connected to the network of the MQTT broker. To easily fetch the data from SuplaCloud, we created a converter for Supla API to MQTT based on the docker image. Our converter requests the sample from Supla via REST API and converts it on the MQTT frame. HomeAssistant reads data directly from the MQTT broker, in which we can monitor energy consumption and manage other building system elements through other interfaces. We used the Prometheus database that reads data from HomeAssistant. The process of building, training and retraining the model uses data from Prometheus but evaluates the sample based on the MQTT subscription. If the ML system detects any faults, they are also raised via MQTT. The visualization of data is based on Grafana and data from Prometheus.
Like most current IT solutions, the entire solution is placed in the cloud system; in our case, it is Docker as a Service. In this environment, many components together form the entire building management system. The logical connections of the communication layer are shown in Figure 4. We can see that the two separate building systems used for energy are connected using the TCP/IP protocol. The converter Supla to MQTT, the MQTT broker, Grafana, Prometheus and Home Assistant work as separate communication containers. The ML system creates a distributed multithreaded system represented in containers. As the user can easily see, the ML system does not communicate directly with building systems; it only uses data already correctly collected in MQTT and stored in Prometheus. The described transfer data ensure security and no possibility of interference from the outside.
Why did we not directly connect the building system with the ML system? We did it consciously, mainly because of the data storage in the Prometheus system. Prometheus’s time database accumulates all metrics from all building systems.
The platform we created is a Docker image that can be configured via a YAML runtime file [54,55]. This file contains a set of parameters required for the correct operation of the entire platform; it contains information about the systems used, the models to be created and the properties used for the correct operation of the classification model in the case of the research described. In our research, we used four blocks from our platform:
  • mqtt (for information about MQTT broker and data).
  • prom (for Prometheus connection and to fetch data).
  • iforest (configuration of the algorithm).
  • System (parameters of the whole System).
An example is presented in Figure 5.
As part of the research, we deployed two separate machine learning instances. The first is dedicated to “Building 1” and the second to “Building 2”. “Building 1” is a two-story residential building inhabited by five people. The idea was to show the typical energy consumption of an ordinary building. On the other hand, “Building 2” is a room in a building of a scientific unit that does not have regular energy consumption. Therefore, there is increased consumption only during the stay of one, or a maximum of two users, for 8 h a day. During the execution of algorithms, we introduced improvements (upgrade procedure). The first was responsible for detecting anomalies in the runs in Building 1, while the second was responsible for Building 2. The architecture of the System is presented in Figure 6.
The System consists of many workers responsible for collecting data, building models and their evaluation. Each worker consists of three basic blocks. The MQTT handler is responsible for subscribing to the relevant topic in MQTT and sending data to the iforest block after receiving it. The next element is communication and downloading data directly from Prometheus (Prometheus handler). It is used to download data in a certain period. The last of the blocks is iforest, responsible for building new models and checking each sample for anomalies in the course. In the ML of BMSs exists Main Logic. In this block, we have logic for raising the alarm based on the data from workers. The basic logic implemented is on logic AND. ML Logic would be alarmed if all workers voted on the sample as a fault, in addition to the basic blocks for handling data and ML. Finally, there is a system responsible for data storage and logging.
Each building used workers working in several time perspectives (seven Workers = twenty-one Threads + Main Logic):
  • Seven days
  • One day
  • 12 h
  • 6 h
  • 3 h
  • 1 h
  • 30 min.
In the case of a single-family building and the Zamel system, samples of the power factor and the instantaneous active power for each phase were used. In a building with the Wago system, we measured the voltage and current for each phase and active and reactive power.
The idea behind the Isolation Forest algorithm is that it is easier to distinguish anomalous data points from the rest of the sample. The algorithm recursively generates partitions on the sample by randomly selecting an attribute and then a split value between the minimum and maximum values permitted for that attribute to isolate a data point. As a result, anomalies require fewer random partitions to isolate than expected points, as can be seen from the data. The Isolation Tree structure can be used to show recursive partitioning. The number of partitions needed to isolate a point can be considered the length of the path within the tree to a terminating node starting at the root.
The algorithm described in this publication is an example of how we can integrate machine learning solutions with building automation systems in a simple and non-invasive way in building systems. The next step in the development of this software will be adding additional algorithms that will be able to support building systems. Implementing algorithms with supervised learning will be very easy, making it easy to build neural networks integrated with building systems [11,56,57].

4. Results

This research using the System was conducted for half a year. During the testing period, improvements were introduced, affecting the entire System’s stability. The period in which the research was conducted included holidays, e.g., Christmas, Easter and New Year’s. The period is essential due to the increase in energy consumption in this period in the residential building and the decrease in energy consumption in the office building.
The System’s final structure, described in earlier chapters, is the result of work over this period and the improvement of the entire platform. The algorithm’s operation is monitored in the Grafana system by a counter dedicated to detecting anomalies in the building system (e.g., Figure 7). The tests carried out included forced anomalies, which were implemented by, for example, switching on engines and heating devices with significant power.
All necessary data are visualised in the Grafana system. Grafana is a popular platform for visualising time-series data. When using Grafana to visualise data, the user can create charts, graphs and dashboards to display their data meaningfully. An additional advantage of using Grafana is monitor Alerts. The alerts module is integrated with our platform to present an alarm when an anomaly is detected and shared via the MQTT broker. Our visualisation is presented in Figure 7. In addition to creating individual visualisations, the user can create dashboards to display multiple visualisations together. Dashboards allow users to create a custom layout of visualisations that can be used to monitor and analyse their data over time. For example, the user can choose which building they want to monitor in our dashboard.
When we have a typical situation in the building energy system (without anomaly), we do not see any alerts and the detection counter is on the same level. In Figure 7, we see empty alerts and Figure 8 presents grouped energy data and a “Fault Counter,” which is used to see the counter of anomaly detections by the System. The data in Figure 8 come from single-family buildings. We can observe a significant fluctuation in active energy consumption over several periods. These distortions have been generated by the motor used in the building’s heating system. By monitoring energy consumption, we can also analyse the activation of individual devices. In the period presented in Figure 8, we see data from one sample day. What is worth observing is that the anomaly detection counter in the data has a constant value, which means that no anomalies were detected in this data series, which is a correct detection.
The platform has little impact on real BMS control scenarios in its current shape. The results described in this publication allow building users to diagnose energy consumption over time and receive information about unusual events. These events require user analysis to determine the cause, e.g., the device was switched on unnecessarily, or heating during the absence of users. During the research, we found in “Building 2” that the air conditioner unnecessarily switched to heating mode when the heaters were turned on in parallel, increasing electricity consumption. Once detected, it is possible to optimise air conditioner scenarios. In a residential building (“Building 1”), an excessive energy consumption of one of the solar pumps was empirically diagnosed, which resulted in replacing it with a more energy-efficient one with the same efficiency.
The detection of any anomaly in the electrical energy data can be seen in Figure 9. The data visible on the charts for about 20 min show a sudden increase in active energy during one of the phases and a change in the power factor. The System labelled such parameters as an anomaly because, from the short-term data, it is a significant anomaly (an increase from 20 watts is almost 300 watts in one minute). As a result, the error count increased from 14 to 15. The System increments the error counter by one when it detects anomalies in the transmitted data. The error counter is global and increments with each detected anomaly.
The algorithm we tested is not entirely resistant to “expected” anomalies in energy consumption parameters. For example, an anomaly can be seen in Figure 10 in which the kitchen oven is turned on causing a sudden increase in power consumption and pure resistance in the phase angle for one of the phases. The algorithm detected the activation of the oven as an anomaly, which is a sound detection, but from the user’s perspective, this is the intended action. In order to eliminate such effects in the future, we want to use supervised learning and train the model to filter the intended characteristics.
As part of analysing the algorithm’s operation and checking whether the System correctly detects values in the System, the data were checked manually from data collected from 2 weeks of system operation in a single-family reference building and the department room. The process of verifying the correct operation of the algorithm is presented in Figure 11.
The results of the analysis are presented in Table 2 and Table 3. The samples were collected in a confusion matrix. The values collected there represent the results of the system operation. Within a two-week randomly selected period, the first System generated 105 alarms and processed over 240,000 data samples. The second System generated four alarms and processed over 20,000 data samples.
During the manual analysis, we detected 16 incorrectly detected alarms based on electricity parameters that looked correct over time, i.e., they stayed within user expectations for conduct or measured values. The remaining 89 alarms showed a high sensitivity of the algorithm to changes in the characteristics of the electrical network parameters in the building. Each time users turned on a device that had not been started, it reported an error. We detected that four alarms had been missed. However, the parameters of regular operation were ignored correctly (more than 240,000).
We ignored the research on direct sensor or hardware issues. For example, the measurements from both buildings can be affected by sensors, but sensor faults can also be the reason for anomaly detection.
We have calculated the four basic parameters of the classification algorithm: accuracy, sensitivity, specificity and precision. The first measure is accuracy. It is defined as the number of correctly classified samples for all samples. Therefore, when choosing a model based on this criterion, we focus only on how many samples will be correctly classified; we lose information about what type of error we make. From the perspective of our algorithm, it is not a critical parameter. However, because the System analyses many samples, most are expected. Therefore, the most relevant metric for our System is precision, which reflects how many erroneous samples there are. Therefore, we can classify precision as the number of samples correctly classified as an error for all generated alarms. System precision in single-family buildings is 84%. For the department room, precision is 80%. In the second building, we have stable parameters of energy. We only had an incorrect situation a few times.
An interesting aspect of how the algorithm works is the execution time. In our system, the most crucial time is the time taken to evaluate the sample. The evaluation time is always the same regardless of the value and the condition of the building system. Evaluation time depends on the sample count. Only the server’s state (more or less loaded) can affect this time. The retraining of the model takes place synchronously at a specified time that can be configured (it is not carried out for each sample).
For the retraining time of the algorithm in different time configurations (for different periods), the measurement period has a linear dependence on the number of samples and this affects the training time. In Table 4, we have compiled the average training time for various configurations. We noticed that, in the case of increasing the number of samples (larger measurement window), the training time did not increase and in some cases, even decreased.
The average evaluation time is about 80 ms for one sample.

5. Discussion

Classification model algorithms are one of the most widely used machine learning techniques in building systems. The platform we have created gives an excellent opportunity to use the computing power of any server in building automation systems. These algorithms analyse large amounts of data and identify patterns to predict a new data point’s class or category. In other words, classification algorithms can classify data into different categories or classes. An essential feature of our System is the simplicity of its configuration and the speed of implementing the new algorithm.
Furthermore, the algorithm’s operation confirms that we can integrate data from any building system that can send data to the System via MQTT and present their results in the Grafana data visualisation system. Currently, the System has the static format of the data, but in the future, we need to implement configurable pre-processing data. The formatting of the data is significant for the machine learning algorithms.
Today’s most popular classification algorithms used in the industry include decision tree regression, which we used in our System’s sample algorithm. However, each algorithm has its strengths and weaknesses, and the choice of algorithm depends on the specific problem and the available data. Therefore, developing our platform with new algorithms and integration possibilities will allow us to build a ready-made platform for quickly creating solutions based on machine learning and artificial intelligence, solving problems in building automation systems.
There are several key steps to follow to build an effective classification model. First, data must be collected and pre-processed to ensure its purity, high quality and acceptable format. The next important step is featuring engineering, which involves selecting the model’s most important features or variables. Next, the model selection step involves selecting the most appropriate algorithm based on the data and the problem, and the final step involves evaluating the model’s performance.
The use of classification model algorithms is not limited to error detection. The System can create use cases that can solve various other problems. In conclusion, many industries use classification model algorithms as robust forecasting and decision support tools. Understanding the different algorithms, their strengths and weaknesses and the critical steps in building effective models is essential for anyone who wants to use these techniques in their work. The platform, dedicated to the needs of buildings, is easy to install, configure and analyse in machine learning solutions.
Our observations show that we can use our platform to, for example, analyse anomalies in public buildings, thanks to which we will be able to reduce energy consumption and detect unnatural energy consumption efficiently.

6. Conclusions

This publication’s research shows that we can easily configure and launch a platform that works with existing building systems without interfering with the BMS controller software. The first algorithm on our platform is used to detect anomalies in runs, making it possible to adapt it to analyse other building parameters, such as temperature, HVAC or lighting. In addition, we see great potential in developing the platform and expanding it with new algorithms (finally combining many algorithms into one whole). While working on the platform, we made many attempts to run it on our server; thanks to this, it was possible to optimise the parameters passed in the configuration file to a minimum (yaml configuration file). As a result, the platform allows analysing the anomaly from many perspectives in an alien shape. We worked out such a solution after many attempts to implement the system.
Our platform is a perfect solution for existing and future machine learning systems that can communicate via TCP/IP, e.g., MQTT, API or any other. Furthermore, the platform has excellent development potential, allowing users to integrate many building automation systems. The next step of the research is integrating our platform with all building automation systems available in our science unit. Adaptation with all systems will allow for implementing much scientific and didactic work using new building automation systems, significantly affecting the development of functionalities available on our platform. The target solution/idea is an autonomous platform with many integration methods and a massive pool of learning algorithms, including neural networks, supported by GPU acceleration. The server on which the research was conducted is already adapted to the platform’s development. We want to develop our System as part of our diploma theses, doctor’s theses and research work. Ultimately, the platform will be able to select the optimal algorithm and, using the data, interfere with building automation systems to optimise many parameters, including electricity. As the target solution, we see open software that users can develop with additional algorithms and integrations.

Author Contributions

Conceptualization, B.K. and P.B.; methodology, B.K.; software, B.K.; validation, B.K. and P.B.; formal analysis, B.K.; investigation, B.K.; resources, P.B.; data curation, B.K.; writing—original draft preparation, B.K.; writing—review and editing, B.K. and P.B.; visualization, BK; supervision, P.B.; project administration, B.K.; funding acquisition, P.B. All authors have read and agreed to the published version of the manuscript.

Funding

This research was funded by the own funds of the Department of Electrical Apparatus, Lodz University of Technology. The purchase of equipment in the described Building 2 was made as part of the project "Interdisciplinary Research and Development Center for Advanced Materials and Intelligent Management Systems in Construction 2020+ of the Lodz University of Technology" co-financed by the European Union, under the contract RPLD.01.01.00-10-0003/18.

Data Availability Statement

Not applicable.

Conflicts of Interest

The authors declare no conflict of interest.

References

  1. Ghiani, E.; Galici, M.; Mureddu, M.; Pilo, F. Impact on Electricity Consumption and Market Pricing of Energy and Ancillary Services during Pandemic of COVID-19 in Italy. Energies 2020, 13, 3357. [Google Scholar] [CrossRef]
  2. Yao, Y.; Ivanovski, K.; Inekwe, J.; Smyth, R. Human Capital and CO2 Emissions in the Long Run. Energy Econ. 2020, 91, 104907. [Google Scholar] [CrossRef]
  3. European Commision European Green Deal: Commission Proposes 2030 Zero-Emissions Target for New City Buses and 90% Emissions Reductions for New Trucks by 2040. Available online: https://ec.europa.eu/commission/presscorner/detail/en/ip_23_762 (accessed on 3 May 2023).
  4. European Commision European Green Deal: Commission Proposes Transformation of EU Economy and Society to Meet Climate Ambitions. Available online: https://ec.europa.eu/commission/presscorner/detail/en/IP_21_3541 (accessed on 3 May 2023).
  5. Chen, S.; Zhang, G.; Xia, X.; Setunge, S.; Shi, L. A Review of Internal and External Influencing Factors on Energy Efficiency Design of Buildings. Energy Build. 2020, 216, 109944. [Google Scholar] [CrossRef]
  6. Cabral, M.R.; Blanchet, P. A State of the Art of the Overall Energy Efficiency of Wood Buildings—An Overview and Future Possibilities. Materials 2021, 14, 1848. [Google Scholar] [CrossRef]
  7. Chen, C.; Hu, Y.; Marimuthu, K.; Kumar, P.M. Artificial Intelligence on Economic Evaluation of Energy Efficiency and Renewable Energy Technologies. Sustain. Energy Technol. Assess. 2021, 47, 101358. [Google Scholar] [CrossRef]
  8. Capozzoli, A.; Lauro, F.; Khan, I. Fault Detection Analysis Using Data Mining Techniques for a Cluster of Smart Office Buildings. Expert Syst. Appl. 2015, 42, 4324–4338. [Google Scholar] [CrossRef]
  9. Ruiz, L.; Cuéllar, M.; Calvo-Flores, M.; Jiménez, M. An Application of Non-Linear Autoregressive Neural Networks to Predict Energy Consumption in Public Buildings. Energies 2016, 9, 684. [Google Scholar] [CrossRef] [Green Version]
  10. Khan, Z.A.; Ullah, A.; Ullah, W.; Rho, S.; Lee, M.; Baik, S.W. Electrical Energy Prediction in Residential Buildings for Short-Term Horizons Using Hybrid Deep Learning Strategy. Appl. Sci. 2020, 10, 8634. [Google Scholar] [CrossRef]
  11. Chemingui, Y.; Gastli, A.; Ellabban, O. Reinforcement Learning-Based School Energy Management System. Energies 2020, 13, 6354. [Google Scholar] [CrossRef]
  12. Mariano-Hernández, D.; Hernández-Callejo, L.; Zorita-Lamadrid, A.; Duque-Pérez, O.; Santos García, F. A Review of Strategies for Building Energy Management System: Model Predictive Control, Demand Side Management, Optimization and Fault Detect & Diagnosis. J. Build. Eng. 2021, 33, 101692. [Google Scholar]
  13. Wang, Z.; Hong, T. Reinforcement Learning for Building Controls: The Opportunities and Challenges. Appl. Energy 2020, 269, 115036. [Google Scholar] [CrossRef]
  14. Zhu, W.; Wang, Z.; Zhang, Z. Renovation of Automation System Based on Industrial Internet of Things: A Case Study of a Sewage Treatment Plant. Sensors 2020, 20, 2175. [Google Scholar] [CrossRef] [Green Version]
  15. Mancini, F.; Lo Basso, G.; de Santoli, L. Energy Use in Residential Buildings: Impact of Building Automation Control Systems on Energy Performance and Flexibility. Energies 2019, 12, 2896. [Google Scholar] [CrossRef] [Green Version]
  16. Stolojescu-crisan, C.; Crisan, C.; Butunoi, B. An IoT-Based Smart Home Automation System. Sensors 2021, 21, 3784. [Google Scholar] [CrossRef] [PubMed]
  17. Farzaneh, H.; Malehmirchegini, L.; Bejan, A.; Afolabi, T.; Mulumba, A.; Daka, P.P. Artificial Intelligence Evolution in Smart Buildings for Energy Efficiency. Appl. Sci. 2021, 11, 763. [Google Scholar] [CrossRef]
  18. Mohamed, N.; Al-Jaroodi, J.; Lazarova-Molnar, S. Leveraging the Capabilities of Industry 4.0 for Improving Energy Efficiency in Smart Factories. IEEE Access 2019, 7, 18008–18020. [Google Scholar] [CrossRef]
  19. Bardazzi, R.; Pazienza, M.G. Switch off the Light, Please! Energy Use, Aging Population and Consumption Habits. Energy Econ. 2017, 65, 161–171. [Google Scholar] [CrossRef]
  20. Kent, M.; Huynh, N.K.; Schiavon, S.; Selkowitz, S. Using Support Vector Machine to Detect Desk Illuminance Sensor Blockage for Closed-Loop Daylight Harvesting. Energy Build. 2022, 274, 112443. [Google Scholar] [CrossRef]
  21. Rocha, P.; Siddiqui, A.; Stadler, M. Improving Energy Efficiency via Smart Building Energy Management Systems: A Comparison with Policy Measures. Energy Build. 2015, 88, 203–213. [Google Scholar] [CrossRef] [Green Version]
  22. Fayaz, M.; Kim, D.H. Energy Consumption Optimization and User Comfort Management in Residential Buildings Using a Bat Algorithm and Fuzzy Logic. Energies 2018, 11, 161. [Google Scholar] [CrossRef] [Green Version]
  23. Kim, S.; Lim, H. Reinforcement Learning Based Energy Management Algorithm for Smart Energy Buildings. Energies 2018, 11, 2010. [Google Scholar] [CrossRef] [Green Version]
  24. Chojecki, A.; Ambroziak, A.; Borkowski, P. Fuzzy Controllers Instead of Classical PIDs in HVAC Equipment: Dusting off a Well-Known Technology and Today’s Implementation for Better Energy Efficiency and User Comfort. Energies 2023, 16, 2967. [Google Scholar] [CrossRef]
  25. Mat Daut, M.A.; Hassan, M.Y.; Abdullah, H.; Rahman, H.A.; Abdullah, M.P.; Hussin, F. Building Electrical Energy Consumption Forecasting Analysis Using Conventional and Artificial Intelligence Methods: A Review. Renew. Sustain. Energy Rev. 2017, 70, 1108–1118. [Google Scholar] [CrossRef]
  26. Ngarambe, J.; Yun, G.Y.; Santamouris, M. The Use of Artificial Intelligence (AI) Methods in the Prediction of Thermal Comfort in Buildings: Energy Implications of AI-Based Thermal Comfort Controls. Energy Build. 2020, 211, 109807. [Google Scholar] [CrossRef]
  27. Verma, A.; Prakash, S.; Kumar, A. AI-Based Building Management and Information System with Multi-Agent Topology for an Energy-Efficient Building: Towards Occupants Comfort. IETE J. Res. 2023, 69, 1033–1044. [Google Scholar] [CrossRef]
  28. Conceição, T.; Braga, C.; Rosado, L.; Vasconcelos, M.J.M. A Review of Computational Methods for Cervical Cells Segmentation and Abnormality Classification. Int. J. Mol. Sci. 2019, 20, 5114. [Google Scholar] [CrossRef] [PubMed] [Green Version]
  29. Tang, T.W.; Kuo, W.H.; Lan, J.H.; Ding, C.F.; Hsu, H.; Young, H.T. Anomaly Detection Neural Network with Dual Auto-Encoders GAN and Its Industrial Inspection Applications. Sensors 2020, 20, 3336. [Google Scholar] [CrossRef] [PubMed]
  30. Mokhtari, S.; Abbaspour, A.; Yen, K.K.; Sargolzaei, A. A Machine Learning Approach for Anomaly Detection in Industrial Control Systems Based on Measurement Data. Electronics 2021, 10, 407. [Google Scholar] [CrossRef]
  31. Rodrigues, F.; Cotella, V.; Rodrigues, H.; Rocha, E.; Freitas, F.; Matos, R. Application of Deep Learning Approach for the Classification of Buildings’ Degradation State in a BIM Methodology. Appl. Sci. 2022, 12, 7403. [Google Scholar] [CrossRef]
  32. Gavali, P.; Banu, J.S. Deep Convolutional Neural Network for Image Classification on CUDA Platform. In Deep Learning and Parallel Computing Environment for Bioengineering Systems; Elsevier: Amsterdam, The Netherlands, 2019; pp. 99–122. ISBN 9780128167182. [Google Scholar]
  33. Liu, F.T.; Ting, K.M.; Zhou, Z.H. Isolation Forest. In Proceedings of the 2008 Eighth IEEE International Conference on Data Mining, Pisa, Italy, 15–19 December 2008; pp. 413–422. [Google Scholar] [CrossRef]
  34. Karczmarek, P.; Kiersztyn, A.; Pedrycz, W.; Al, E. K-Means-Based Isolation Forest. Knowl.-Based Syst. 2020, 195, 105659. [Google Scholar] [CrossRef]
  35. Zhang, Y.; Dong, Y.; Wu, K.; Chen, T. Hyperspectral Anomaly Detection with Otsu-Based Isolation Forest. IEEE J. Sel. Top. Appl. Earth Obs. Remote Sens. 2021, 14, 9079–9088. [Google Scholar] [CrossRef]
  36. Li, W.; Li, Y.; Shi, J.; Chao, K.; Zhang, X. Power Grid Fault Detection Method Based on Cloud Platform and Improved Isolated Forest. IEEE Adv. Inf. Technol. Electron. Autom. Control Conf. (IAEAC) 2021, 2021, 864–867. [Google Scholar] [CrossRef]
  37. Ahmed, S.; Lee, Y.; Hyun, S.H.; Koo, I. Unsupervised Machine Learning-Based Detection of Covert Data Integrity Assault in Smart Grid Networks Utilizing Isolation Forest. IEEE Trans. Inf. Secur. 2019, 14, 2765–2777. [Google Scholar] [CrossRef]
  38. Cook, A.A.; Misirli, G.; Fan, Z. Anomaly Detection for IoT Time-Series Data: A Survey. IEEE Internet Things J. 2020, 7, 6481–6494. [Google Scholar] [CrossRef]
  39. Liu, Y.; Pang, Z.; Karlsson, M.; Gong, S. Anomaly Detection Based on Machine Learning in IoT-Based Vertical Plant Wall for Indoor Climate Control. Build. Environ. 2020, 183, 107212. [Google Scholar] [CrossRef]
  40. Liu, X.; Ding, Y.; Tang, H.; Xiao, F. A Data Mining-Based Framework for the Identification of Daily Electricity Usage Patterns and Anomaly Detection in Building Electricity Consumption Data. Energy Build. 2021, 231, 110601. [Google Scholar] [CrossRef]
  41. Ramapatruni, S.; Narayanan, S.N.; Mittal, S.; Joshi, A.; Joshi, K. Anomaly Detection Models for Smart Home Security. In Proceedings of the 2019 IEEE 5th International Conference on Big Data Security on Cloud (BigDataSecurity), IEEE International Conference on High Performance and Smart Computing, (HPSC) and IEEE International Conference on Intelligent Data and Security (IDS), Washington, DC, USA, 27–29 May 2019; pp. 19–24. [Google Scholar] [CrossRef]
  42. Rashid, H.; Singh, P. Monitor: An Abnormality Detection Approach in Buildings Energy Consumption. In Proceedings of the 2018 IEEE 4th International Conference on Collaboration and Internet Computing (CIC), Philadelphia, PA, USA, 18–20 October 2018; pp. 16–25. [Google Scholar] [CrossRef]
  43. Rashid, H.; Stankovic, V.; Stankovic, L.; Singh, P. Evaluation of Non-Intrusive Load Monitoring Algorithms for Appliance-Level Anomaly Detection. In Proceedings of the ICASSP 2019—2019 IEEE International Conference on Acoustics, Speech and Signal Processing (ICASSP), Brighton, UK, 12–17 May 2019; pp. 8325–8329. [Google Scholar] [CrossRef] [Green Version]
  44. Jiang, J.; Li, T.; Chang, C.; Yang, C.; Liao, L. Fault Diagnosis Method for Lithium-Ion Batteries in Electric Vehicles Based on Isolated Forest Algorithm. J. Energy Storage 2022, 50, 104177. [Google Scholar] [CrossRef]
  45. Lei, L.; Wu, B.; Fang, X.; Chen, L.; Wu, H.; Liu, W. A Dynamic Anomaly Detection Method of Building Energy Consumption Based on Data Mining Technology. Energy 2023, 263, 125575. [Google Scholar] [CrossRef]
  46. Woliński, M.; Szymczyk, T. Comparative Analysis of Software for Smart Homes. J. Comput. Sci. Inst. 2022, 23, 84–88. [Google Scholar] [CrossRef]
  47. Pawłowski, M.; Borkowski, P. Electrical Energy Management System in Double Unpredictability Objects. Prz. Elektrotechniczny 2014, 90, 191–196. [Google Scholar] [CrossRef]
  48. Siemens. Comprehensive Building Solutions in Your Hands Desigo System. Available online: https://assets.new.siemens.com/siemens/assets/api/uuid:8db4340b-fa06-4cae-8698-eb5ee408f7d8/Desigosysteminteractivebrochurehighres.pdf (accessed on 3 May 2023).
  49. Žáček, M. Smart Building with Loxone System. In AIP Conference Proceedings; AIP Publishing LLC.: Melville, NY, USA, 2019; Volume 2186. [Google Scholar] [CrossRef]
  50. Ramelan, A.; Adriyanto, F.; Hermanu, B.A.; Ibrahim, M.H.; Saputro, J.S.; Setiawan, O. IoT Based Building Energy Monitoring and Controlling System Using LoRa Modulation and MQTT Protocol. IOP Conf. Ser. Mater. Sci. Eng. 2021, 1096, 012069. [Google Scholar] [CrossRef]
  51. Shilpa, V.; Vidya, A.; Pattar, S. MQTT Based Secure Transport Layer Communication for Mutual Authentication in IoT Network. Glob. Transit. Proc. 2022, 3, 60–66. [Google Scholar] [CrossRef]
  52. Nasar, M.; Kausar, M.A. Suitability of Influxdb Database for Iot Applications. Int. J. Innov. Technol. Explor. Eng. 2019, 8, 1850–1857. [Google Scholar] [CrossRef]
  53. Chakraborty, M.; Kundan, A.P. Monitoring Cloud-Native Applications; Apress: New York, NY, USA, 2021. [Google Scholar]
  54. Obaid, A.J. Assessment of Smart Home Assistants as an IoT. Int. J. Comput. Inf. Manuf. (IJCIM) 2021, 1, 18–36. [Google Scholar] [CrossRef]
  55. Bisong, E. Google Cloud Machine Learning Engine (Cloud MLE). In Building Machine Learning and Deep Learning Models on Google Cloud Platform; Apress: New York, NY, USA, 2019; pp. 545–579. [Google Scholar]
  56. Talei, H.; Benhaddou, D.; Gamarra, C.; Benbrahim, H.; Essaaidi, M. Smart Building Energy Inefficiencies Detection through Time Series Analysis and Unsupervised Machine Learning. Energies 2021, 14, 6042. [Google Scholar] [CrossRef]
  57. Ahmad, T.; Chen, H.; Huang, R.; Yabin, G.; Wang, J.; Shair, J.; Azeem Akram, H.M.; Hassnain Mohsan, S.A.; Kazim, M. Supervised Based Machine Learning Models for Short, Medium and Long-Term Energy Prediction in Distinct Building Environment. Energy 2018, 158, 17–32. [Google Scholar] [CrossRef]
Figure 1. Communication scheme of exemplary building systems.
Figure 1. Communication scheme of exemplary building systems.
Energies 16 04504 g001
Figure 2. The sequence diagram of the Wago Home Automation System integrated with Cloud infrastructure.
Figure 2. The sequence diagram of the Wago Home Automation System integrated with Cloud infrastructure.
Energies 16 04504 g002
Figure 3. Data transmission in the tested buildings.
Figure 3. Data transmission in the tested buildings.
Energies 16 04504 g003
Figure 4. Logic connection inside of System.
Figure 4. Logic connection inside of System.
Energies 16 04504 g004
Figure 5. Example of the configuration file of ML System.
Figure 5. Example of the configuration file of ML System.
Energies 16 04504 g005
Figure 6. Architecture of ML System. 1—subscribed messages; 2—data necessary to build a new model; 3—raising an alarm.
Figure 6. Architecture of ML System. 1—subscribed messages; 2—data necessary to build a new model; 3—raising an alarm.
Energies 16 04504 g006
Figure 7. Example of visualization of building parameters in the Grafana system. Voltage and current present three phases (1—green; 2—yellow; 3—blue).
Figure 7. Example of visualization of building parameters in the Grafana system. Voltage and current present three phases (1—green; 2—yellow; 3—blue).
Energies 16 04504 g007
Figure 8. Active energy, phase angle and fault counter from sample day generated in a single-family building without anomaly. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Figure 8. Active energy, phase angle and fault counter from sample day generated in a single-family building without anomaly. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Energies 16 04504 g008
Figure 9. Active energy, phase angle and fault counter from sample day generated in a single-family building with anomaly detection, represented by the counter. A 20 min period with a quick pick of energy consumption. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Figure 9. Active energy, phase angle and fault counter from sample day generated in a single-family building with anomaly detection, represented by the counter. A 20 min period with a quick pick of energy consumption. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Energies 16 04504 g009
Figure 10. Active energy, phase angle and fault counter from sample day generated in a single-family building with anomaly detection, represented by the counter. A 2 h period with the oven turned on. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Figure 10. Active energy, phase angle and fault counter from sample day generated in a single-family building with anomaly detection, represented by the counter. A 2 h period with the oven turned on. Active power and phase angel present three phases (1—green; 2—yellow; 3—blue).
Energies 16 04504 g010
Figure 11. Process of verification system and algorithms.
Figure 11. Process of verification system and algorithms.
Energies 16 04504 g011
Table 1. Summary of analysed related works.
Table 1. Summary of analysed related works.
Algorithms and MethodsThe DataSummaryIntegrated with Home Automation System
Autoencoder; long short-term memory encodes decoder [39]CO2 and temperatureMany factors can impact machine learning algorithms and the dataset should have excellent quality.No
Statistical algorithms; density-based spatial clustering application with noise; K-means; classification and regression tree [40]Energy load and temperatureThe algorithm can classify the profile of the building and detect anomalies in the profile—with accuracy above 80% of classification.No
Hidden Markov Model [41]Various IoT sensorsThe model can correctly detect anomalies in the network. The authors achieved 97% accuracy in the smart home.Partially
K-NN; k-medoid clustering; Breadth First Scheme [42]Power consumptionUsing a combination of algorithms improves the score from 0.65 to 0.89.Yes
Rule-based algorithm; Supervised anomaly detection [43]Energy loadAppliance-level anomalies cannot be detected using the algorithm proposed by the authors. Not directly
Isolation forest [44]VoltageThe algorithm proves it can be adapted for fault detection in the battery area based on the voltage parameters.No
Particle swarm optimization; K-medoids algorithm; KNN algorithm [45]Energy consumption dataExcellent clustering results are obtained using the PSO-optimised K-medoids clustering technique, and the mean values’ error for all classes is less than 5%. Partially
Table 2. Confusion matrix for two-week period in a single-family building.
Table 2. Confusion matrix for two-week period in a single-family building.
Parameters from System
Fault SituationsNormal Situations
ML for BMS decisionFault situations8916
Normal situations4~240,000 *
* Many normal data samples, about 240,000 samples (14 days * 24 h * 60 min * 12 samples per minute).
Table 3. Confusion matrix for two-week period in a department room.
Table 3. Confusion matrix for two-week period in a department room.
Parameters from System
Fault SituationsNormal Situations
ML for BMS decisionFault situations31
Normal situations0~20,000 *
* Many normal data samples, about 20,000 samples (14 days * 24 h * 60 min * 1 sample per minute).
Table 4. Time of retraining model in different time windows.
Table 4. Time of retraining model in different time windows.
Time WindowTime of Retraining (Incl. Pre-Processing) [ms]
AverageMedian
30 min739483
1 h1191748
3 h1200751
6 h34813932
12 h38133933
One day36683934
Seven days41413528
Disclaimer/Publisher’s Note: The statements, opinions and data contained in all publications are solely those of the individual author(s) and contributor(s) and not of MDPI and/or the editor(s). MDPI and/or the editor(s) disclaim responsibility for any injury to people or property resulting from any ideas, methods, instructions or products referred to in the content.

Share and Cite

MDPI and ACS Style

Kawa, B.; Borkowski, P. Integration of Machine Learning Solutions in the Building Automation System. Energies 2023, 16, 4504. https://doi.org/10.3390/en16114504

AMA Style

Kawa B, Borkowski P. Integration of Machine Learning Solutions in the Building Automation System. Energies. 2023; 16(11):4504. https://doi.org/10.3390/en16114504

Chicago/Turabian Style

Kawa, Bartlomiej, and Piotr Borkowski. 2023. "Integration of Machine Learning Solutions in the Building Automation System" Energies 16, no. 11: 4504. https://doi.org/10.3390/en16114504

Note that from the first issue of 2016, this journal uses article numbers instead of page numbers. See further details here.

Article Metrics

Back to TopTop