0% found this document useful (0 votes)
32 views5 pages

Cloud-Based Machine Learning Framework For Residential HVAC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
32 views5 pages

Cloud-Based Machine Learning Framework For Residential HVAC

Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 5

Cloud-based Machine Learning Framework for

Residential HVAC Control System


1st Atthawut Issaraviriyakul 2nd Wanchalerm Pora 3rd Napong Panitantum
Department of Electrical Engineering Department of Electrical Engineering Department of Electrical Engineering
Chulalongkorn University Chulalongkorn University Chulalongkorn University
Bangkok, Thailand Bangkok, Thailand Bangkok, Thailand
[email protected] [email protected] [email protected]

Abstract—Occupant behavior prediction has become a a quantitative thermal comfort criterion for a large group of
significant part of smart building technologies. This research people in a specific environment. A scale of PMV ranges
emphasizes on HVAC (Heating Ventilation and Air from -3 to 3 or from cold to hot respectively. According to
Conditioning) system as its operation is crucial in terms of both [5], thermal sensation collected using a questionnaire is used
energy usage and user comfort. In previous researches, comfort
prediction is developed using the filled questionnaires from
as an input of a neural network, where PMV is an output
signal used to regulate the operation of the compressor, fan,
2021 13th International Conference on Knowledge and Smart Technology (KST) | 978-1-7281-7602-4/21/$31.00 ©2021 IEEE | DOI: 10.1109/KST51265.2021.9415840

occupants. The prediction output is employed to control the


mechanical components of the system. On/Off control is mostly and airflow outlet. The problem of this method is that
developed using rule-based distance triggering that turns on/off occupant needs to interact with the system to give input data.
the system when occupants enter/exit a specific perimeter. This Moreover, modification of the hardware is necessary. Rather
article proposes a plug-and-play HVAC control system with an than collecting data inside the specific environment, the
adaptive cloud machine learning (ML) framework that utilizes occupant’s behavior can be defined using the data integrated
room current ambient conditions together with the historical with the geolocation of the occupant. Generally, a virtual
adjustment log to automatically adjust room temperature perimeter or geo-fenced area [6] is generated around a
according to the user comfort using Support Vector
specified location. A location-based service triggers actions
Classification (SVC). This system can also turn on air
conditioner automatically using predictive control which on entry/exit the perimeter. This idea is used for room
implements GPS location and the occupant's data on the precooling before the arrival of the occupant. However, there
Artificial Neural Network (ANN). Furthermore, cloud are plenty of possibilities that the occupant enters the
deployment can solve problems in processing power and storage perimeter without the intention to go to that room.
of an end device, also provide scalability for future development. This paper aims to develop a residential HVAC control
Findings show that an adaptive algorithm in the ML framework system that employs an ML algorithm trained by data specific
can perform well, even when the occupant's behavior changes to the occupant. Ambient data gathered from an end device,
slowly. adjustment data via remote controller, and current weather
Index Terms—smart buildings, HVAC control system,
data from an external source are used to create the model that
thermal comfort, occupancy forecast can recognize the comfort sensation of the user, then adjust
the temperature of the air conditioner(A/C) automatically.
With different ML model, historical displacement data
I. INTRODUCTION acquired by GPS signal from a mobile phone together with
According to [1], in tropical countries, over 50% of time which can imply routine of the user are used to create an
buildings’ energy is consumed by the HVAC system to occupancy prediction model which is finally used to control
maintain thermal comfort. To mitigate the problem, IoT- A/C on/off automatically. The learning algorithms are
based optimal control regarding the thermal comfort and user designed to be adaptable [7] to the change of the occupant’s
behavior needs to be considered. behavior pattern. The output of the system is an infrared
Adoption of a data-driven approach can solve problems waveform transmitted from the end device to control the A/C.
not only in industries but also in households. Parameters that Furthermore, the system is deployed on a cloud infrastructure
affect building thermal dynamics are composed of time- that provides scalability towards the size of storage, and
invariant data such as characteristics of the building which processing efficiency for future applications.
hardly changes. A learning framework [2] uses supervised The rest of the paper is organized as follows. Section II
learning with time-variant data such as outdoor/indoor explains the architecture of the system. Section III describes
temperature, time, outdoor relative humidity, an hour of the the prediction models analysis. Section IV shows the result
day, day of the week, etc. These data can be captured by and discussion and finally conclusion in shown in Section V.
sensors to forecast the temperature change without
II. SYSTEM ARCHITECTURE
considering building characteristics. According to the
ASHRAE standard [3], the temperature is not the only factor The architecture of the system consists of end device,
that affects the thermal comfort of occupants. There are 6 mobile application, and a system deployed on the Google
primary factors of concern, including 2 characteristics of Cloud Platform which consists of real-time database,
occupants (Metabolic Rate, and Clothing Insulation) and 4 Firestore database, and ML framework. The overall system
ambient conditions (air temperature, radiant temperature, architecture is shown in Fig. 1. The end device is a hardware
airspeed, and relative humidity). The thermal comfort is used for interaction between the cloud back-end and physical
evaluated using the predictive mean vote (PMV) [4] which is environment with realtime database as a media. Collected
data combined with data from mobile and external data
978-1-7281-7602-4/21/$31.00 ©2021 IEEE

12

Authorized licensed use limited to: Carleton University. Downloaded on May 27,2021 at 13:20:55 UTC from IEEE Xplore. Restrictions apply.
source are stored inside Firestore database and finally used to C. Mobile Application
train ML algorithms to perform predictive control of the air A mobile application interface shown in Fig. 3. is
conditioner through IR emitter attached on the end device. developed for providing another remote air-conditioner
Behaviors of cloud services (depicted with the red arrow control. After a button is pressed, a corresponding command
in Fig. 1.) are governed by Cloud Functions which run is sent to the end device via RTDB.
backend commands in response to a triggered event. This The geolocation of a user is assumed to be the same as
research developed Cloud Functions with NodeJS runtime for his/her phone’s GNSS data. If the change in distance is more
Javascript. than 50 meters, current latitude and longitude will be reported
every 4 minutes interval to the Firestore database. Home
location can be selected as current geolocation or can be
selected on a map interface. This application is developed
with Flutter open-source mobile UI development framework.

Fig. 1. System Architecture Overview

A. End Device
Having an ESP32 module as the microcontroller, the end
device of which the schematic diagram is shown in Fig.2 can
communicate via WiFi and execute multiple tasks managed
by FreeRTOS (Real-time Operating System). Ambient Fig. 3. Mobile Application User Interface
temperature, CO2, and relative humidity (RH) captured by
SCD30 sensor are sent to ESP32 via I2C port periodically. A D. Firestore Database
940nm IR emitter carries commands to the A/C (Tested on
Mitsubishi MU-SGD18VC). The end device synchronizes its Firestore is a non-relational database that hierarchically
data with the Realtime Database (RTDB) via a REST API. stores data. User data are stored in a collection of which
documents inside are data from RTDB, geolocation from a
mobile device, and user settings such as home location.
Collected data from different documents are joined inside
a sub-collection of the database by Cloud Function every 5
minutes as shown in Fig. 4. Joined data are then indexed by
timestamp. The current location of the user and home location
is used to calculate a displacement by Haversine formula [8].
At the same time, current outdoor weather data of the location
set as ‘Home’ will be retrieved from an external data source
with its REST API.

Fig. 2. End Device Schematic Diagram

B. Realtime Database
Realtime database (RTDB) is a non-relational database
which stores and synchronizes data which are structured as
JSON (JavaScript Object Notation) tree in realtime between Fig. 4. Data aggregation in database
cloud backend and the end device.
RTDB is used as a medium between backend services and
the end device. Data sent from RTDB to the end device are E. Machine Learning Framework
remote control parameters which can turn on/off, change First, ML models were pre-trained with a test user in a
temperature, or set fan speed. In the opposite direction, testbed environment. 2-month collected data indexed with a
ambient conditions collected by the sensor are transferred timestamp are injected to the data analysis platform
from the end device to RTDB. Upon RTDB update, ambient (Anaconda) to train prediction models (described in Section
condition data and A/C adjustment are also logged. III) on premise. Then models and their scalers are uploaded

13

Authorized licensed use limited to: Carleton University. Downloaded on May 27,2021 at 13:20:55 UTC from IEEE Xplore. Restrictions apply.
to the Cloud storage. Prediction engine APIs are provisioned Cyclic continuous features which are hour (h) and day (d)
independently in container environments with Cloud Run. are separated into 2 dimensional values [1] as:
While serving, Cloud Function is responsible for sending an
HTTP request with current data from Firestore database as a ℎ1, ℎ2 = ∙2 , ∙2 (1)
request body to each prediction engine API as shown in Fig.
4. These APIs are developed with Python Flask microweb 1, 2 = ∙2 , ∙2 (2)
framework.
Standardized to zero mean and variance of 1, input is used
to train ML algorithm. This research chose artificial neural
network (ANN) because of the ability to define a complex
non-linear relationship between input and output. The 5-Fold
cross validation (CV) is used to determine performance of 20
combinations of hyperparameters of ANN with an accuracy
(percent of correct prediction from all samples) as a metric.
Hyperparameter set in Table I is chosen with the highest
average accuracy of 96.5% over 5 folds.

TABLE I. SELECTED HYPERPARAMETERS

Neurons in 5:5:5:2
Fig. 4. ML Framework layers
Activation ReLu:ReLu:Softmax:Softmax
Each engine performs its prediction by 1.) acquiring the
Optimizer Adam
prediction model and the data scaler from cloud storage. 2.)
applying data scaler to transform the incoming data to the
B. Thermal Comfort Prediction
training data distribution. Finally, predicting using scaled
The ASHRAE Standards, recognized standards for
data, then delivering output to the RTDB to perform
ventilation system design, stated that there are 6 factors that
predictive control of the A/C.
affect thermal comfort which are metabolic rate, clothing
As the system is developed with a test subject whose
insulation, air temperature, radiant temperature, airspeed and
behavior is unique among other users. Retrain Engine is
relative humidity, air temperature and relative humidity can
programmed to fit a new batch of incoming data to the
be directly collected by low-cost end device. Since metabolic
pretrained model and adjust parameters every 2 weeks to
rate is varied by the activities throughout the day, hour of day
ensure high performance in prediction.
and day of week can be used as factors to imply the routine
activities that affect the change in metabolic rate and clothing.
III. PREDICTION MODEL ANALYSIS Time and weather conditions can also reflect radiant
temperature from the sun. According to [10], outdoor
Prediction models are developed from data collected over
environment factors can alter human perception of thermal
a period of 2 months.
comfort. Thus, 4 classes of outlook (sunny, cloudy, rainy,
A. Occupancy Prediction thunderstorm) are also used as features. The level of CO2 can
Hour of day in 24 hours and day of week are used as a estimate occupancy.
time frame for prediction of the weekly routine whether the To sum up, air temperature, relative humidity, CO2, hour
user will be staying at home or not. Historical data is used to of day, day of week, outdoor temperature, outdoor feels-like
predict displacement in the future timestep. Displacement (S) temperature, and outlook are used as features of a learning
data in previous time steps which are 20 (t-4), 15 (t-3), and algorithm. The thermal discomfort data of the user which are
10 (t-2) minutes before the prediction target timestep is stored labeled as ‘Too Hot’ and ‘Too Cold’ is determined by the
in a sliding window [9]. Together with time data as shown in adjustment (increase/decrease) of the A/C temperature as
Fig. 5, historical displacement data is used to predict shown in algorithm I.
occupancy at the future timestep (t) which is 10 minutes after
the current timestep. Algorithm I
If A/C status == 1:
If setTemp(t) > setTemp (t-1):
Comfort = “Too Cold”
Elif setTemp(t) < setTemp (t-1):
Comfort = “Too Hot”
Else:
Comfort = “Neutral”

‘Neutral’ is data labeled when there is no change in set


temperature, but it is ambiguous to be used as the
Fig. 5. Sliding window of displacement indexed with timestep representation of comfort feeling because the user might stay
uncomfortable without adjusting the A/C, thus excluded from
the training process. With an assumption that ‘Neutral’ exists

14

Authorized licensed use limited to: Carleton University. Downloaded on May 27,2021 at 13:20:55 UTC from IEEE Xplore. Restrictions apply.
in a state between 2 discomfort classes, this research utilized TABLE II. WEEKLY ACCURACY OF OCCUPANCY PREDICTION
probabilistic classification using support vector classification
(SVC) with sigmoid kernel on a 2-month dataset of the 5 mins 10 mins 15 mins 20 mins
discomfort. As the size of the dataset is only 277 records, Week 1 95.2% 94.5% 94.1% 92.8%
ANN is not suitable for solving the problem. Week 2 95.4% 94.1% 93.4% 88.6%
The model was trained with 75% of the dataset and tested Week 3 94.1% 92.5% 91.4% 90.3%
with the rest. The result in Fig. 6 shows a relationship Week 4 89.8% 89.1% 90.6% 88.7%
between probability from 0 (Too Cold) to 1 (Too Hot) and
the frequency of the labeled data in the test set. At the Assuming 10 minutes of precooling can ensure thermal
probability range 0-0.25, 90% of data is predicted as ‘Too comfort without consuming too much energy, 10 minute-
Cold’, while at probability range 0.75-1, 91% is predicted as session is used in the production model. To prevent the model
‘Too Hot’. from further accuracy dropping, the retraining process is
implemented every 2 weeks. Thus, the accuracy can be
maintained at over 95% all the time. Data from week1 and
week2 are used to fit the original model and weights are
adjusted. Accuracy using the adaptive model in week3
increased from 95.5% to 97% and 92.1% to 95% in week4.
The example of correct occupancy prediction is shown in
Fig. 8. Displacement at 21:50, 21:55 and 22:00, time, and day
of week at 22:10 is used to predict occupancy at the time
22:10 which is 10 minutes later than the time of the last
Fig. 6. Predicted probability of discomfort dataset known displacement. This prediction is correct as the real
distance turned zero (blue line), occupancy (red line)
Ordinal regression [11] is applied to the probability predicted beforehand is already turned to 1 which means
predicted by SVC as 0-0.25 to be ‘Too Cold’, 0.25-0.75 to be presence.
‘Neutral’ and 0.75-1.00 to be ‘Too Hot’. Since the purpose of
the model is to recognize the comfort zone of the user, a
metric used to define the performance of the classifier is a
recall (percentage of true positive from all true samples) of
prediction on ‘Neutral’ data.

Fig. 8. Correct occupancy prediction.

Fig. 7. Predicted probability of ‘Neutral’ data. On the other hand, if the occupant’s arriving behavior is
out of routine, prediction result will be incorrect as shown in
Fig. 7 shows the prediction result as the data labeled as Fig. 9 where prediction result turned to 1 which is ‘presence’
‘Neutral’ is tested on a model. 84.5% of the total data lie 5 minutes before the occupant arrived.
under the probability range of 0.25-0.75.

IV. RESULT AND DISCUSSION


Performance of both occupancy prediction model and
thermal comfort prediction model is evaluated by testing on
new coming 4 weeks of unseen data.
For occupancy prediction model, forecasting is separated
into 4 sessions which are 5, 10, 15 and 20 minutes in the
future and each session is ingested with the entire data from
week1, week2, week3, and week4 respectively. As result
shown in Table II, accuracy gradually decreases as the future
session range increases and in the same way, accuracy also
decreases as the period of test set is getting further away from
the training set. The reason of the accuracy decline is that the Fig. 9. Incorrect occupancy prediction.
occupant’s behavior pattern slightly changes through time.

15

Authorized licensed use limited to: Carleton University. Downloaded on May 27,2021 at 13:20:55 UTC from IEEE Xplore. Restrictions apply.
For the thermal comfort prediction model, the recall of [9] H. Hota, R. Handa, and A. Shrivas, "Time series data prediction using
sliding window based rbf neural network," International Journal of
comfort sensation (Neutral) on 4 weeks of data with and Computational Intelligence Research, vol. 13, no. 5, pp. 1145-1156,
without retraining on data from week1 and week2 is shown 2017.
in Table III. The maximum recall of a thermal comfort [10] C.-H. Huang, H.-H. Tsai, and H.-C. Chen, "Influence of Weather
prediction with this model is about 85% due to the difficulty Factors on Thermal Comfort in Subtropical Urban Environments,"
Sustainability, vol. 12, no. 5, p. 2001, 2020.
of defining metabolic rate and clothing by using the only time
[11] E. Satake, K. Majima, S. C. Aoki, and Y. Kamitani, "Sparse ordinal
to imply routine. Besides, airspeed is the factor that cannot be logistic regression and its application to brain decoding," Frontiers in
captured by the low-cost end device. Moreover, sometimes neuroinformatics, vol. 12, p. 51, 2018.
the occupant might remain too hot or too cold without
realizing the thermal discomfort condition.

TABLE III. RECALL OF THERMAL COMFORT PREDICTION

V. CONCLUSION
In this article, a plug-and-play cloud-based ML
framework was developed in a cost-efficient system. A
combination of data collected by an end device and a mobile
phone can be used to create the models which explain the
occupancy and thermal comfort sensation of the occupant
with good performance without any additional cost from
hardware installation. Thanks to the adaptive learning
models, accuracy of occupancy prediction can be maintained
above 95% and the recall of thermal comfort prediction can
be maintained above 80% without human intervention.
This system is suitable for single room residence such as
a condominium since the platform was developed using only
one end device. Therefore, in future work, it is important to
develop a sensor network to collect and extract usage of the
A/C in residence with multiple rooms and multiple
occupants.
REFERENCES

[1] A. R. Katili, R. Boukhanouf, and R. Wilson, "Space cooling in


buildings in hot and humid climates–a review of the effect of humidity
on the applicability of existing cooling techniques," in 14th
International Conference on Sustainable Energy Technologies
–SET, 2015.
[2] X. Zhang, M. Pipattanasomporn, T. Chen, and S. Rahman, "An IoT-
based thermal model learning framework for smart buildings," IEEE
Internet of Things Journal, vol. 7, no. 1, pp. 518-527, 2019.
[3] A. Standard, "Standard 55-2004 (2004) Thermal environmental
conditions for human occupancy," American Society of Heating,
Refrigerating and Air-Conditioning Engineers Inc., Atlanta.
[4] C. Ekici, "A review of thermal comfort and method of using Fanger’s
PMV equation," in 5th International symposium on measurement,
analysis and modelling of human functions. Vancouver, Canada,
2013.
[5] W. Liu, Z. Lian, and B. Zhao, "A neural network evaluation model
for individual thermal comfort," Energy and Buildings, vol. 39, no.
10, pp. 1115-1122, 2007.
[6] Y. Man and Y. Liu, "Towards an energy-efficient framework for
location-triggered mobile application," in Australasian
Telecommunication Networks and Applications Conference (ATNAC)
2012, 2012: IEEE, pp. 1-6.
[7] P. Rashidi and D. J. Cook, "Keeping the resident in the loop: Adapting
the smart home to the user," IEEE Transactions on systems, man, and
cybernetics-part A: systems and humans, vol. 39, no. 5, pp. 949-959,
2009.
[8] E. Winarno, W. Hadikurniawati, and R. N. Rosso, "Location based
service for presence system using haversine method," in 2017
International Conference on Innovative and Creative Information
Technology (ICITech), 2017: IEEE, pp. 1-4.

16

Authorized licensed use limited to: Carleton University. Downloaded on May 27,2021 at 13:20:55 UTC from IEEE Xplore. Restrictions apply.

You might also like