Article Versions
Export Article
Cite this article
  • Normal Style
  • MLA Style
  • APA Style
  • Chicago Style
Research Article
Open Access Peer-reviewed

An Integrated Machine Learning Algorithm for Energy Management and Predictions

Daniel Abode , Samson Oyetunji
American Journal of Energy Research. 2017, 5(3), 103-113. DOI: 10.12691/ajer-5-3-5
Published online: December 29, 2017

Abstract

Management of energy consumption from the demand side has been inefficient and this has inadvertently affected the efforts of energy management on the supply side. This paper describes how machine learning integrated with Internet of things can enhance energy consumption management on the consumer side. Sensor nodes were designed and installed to gather data including date, time, temperature, humidity, light intensity, human presence and state of the load point switches. The sensor nodes transferred the data collected to a google firebase cloud storage which stored the data. The data collected was used in MATLAB neural network toolbox to train a machine learning algorithm that can predict the states of the receptacles, the ambient condition and the energy consumption statistics. The results show 99.7% success and 0.3% failure in the prediction of the state of the receptacle, 98.9% success and 1.1% failure in the prediction of the light state. In addition, the performance of the trained network for solving the classification and the regression problems that were involved in the prediction of the states of the switches and receptacles, the ambient condition and energy consumption statistics were shown graphically. Graphical results were also developed to show the relationship between the energy consumption, time of the day, human presence, and temperature. Conclusion was drawn on how time of the day, human presence and temperature affected the energy consumption on the consumer side.

1. Introduction

Energy is essential for the creation of wealth and improved standard of living; this means that reliable supply of energy is required to ensure sustainable growth 1. The per capital electricity consumption of the developing countries has been increasing due to increase in various electrical and electronics devices that is meant to bring comfort to our daily life 2. Increase in consumption means increase in cost of living and also increase in maintenance cost for the electric energy generation, transmission and distribution companies.

However, a large percentage of this consumed power are usually wasted due to negligence by the consumer. Hence, there is a need for the development of an integrated machine learning algorithm that can help in the management and prediction of energy consumption on the consumer side and provide useful data in future planning for electrical energy consumers and suppliers.

This form of prediction is generally beyond the empirical form of data analysis. With the ever increasing amounts of data becoming available, there is good reason to believe that machine learning will become more pervasive as a necessary ingredient for technological progress 3.

Machine learning was defined by Arthur Samuel as a field of study that gives the computer the ability to learn without being explicitly programmed 4. It has since been gaining wide recognition in application to big data 5. Various industries are using machine learning process to learn patterns from big data and discover new fact 6.

Machine learning was formally defined by Tom Mitchell as a means by which a computer program learns from experience E with respect to some class of Tasks T and performance measure P, if its performance in class T, as measured by P, improves with experience E 7. A supervised learning algorithm works by generating a hypothesis function (h), after the learning algorithm has learnt from the training set. If the input features (x) is passed through h, it will give a predicted value (y) 8 as shown in equation 1 for linear regression, classification algorithm uses the sigmoid function 9 as shown in equation 2.

(1)
(2)

The value of and is the value that can minimize the cost function J (, ) shown in equation 3.

(3)

This can be achieved by using the gradient descent algorithm which helps to calculate the value of and that minimizes J (, ) as shown in equation 4 by iterating the value of Ѳj until convergence.

(4)

This paper shows how we can apply machine learning on sensor data in order to predict user’s behavior in terms of the energy consumption statistics, state of electrical receptacles and switches and also ambient condition of the place of interest. The study is based on sensor data logged automatically with the use of a designed data-logging device that carries sensor node for measuring human presence rating, relative humidity, temperature, date and time information, and also state of the switch and electrical receptacles. The data was collected in a lab environment with two receptacles, one serving the lab attendant office, the other serving a lab desk and a light point. The data collected were used to train a machine learning algorithm using the MATLAB development environment, which generates function that can help to predict the energy consumption statistics, the ambient condition of the place and the states of the light switch and receptacles.

The rest of this paper is structured as follows. Section 2 gives detail description of the system, Section 3 discusses the result and Section 4 draws conclusion and presents some recommendation for future works.

2. System Description

The system includes several components as shown in Figure 1. It includes a sensor node for measuring light intensity, temperature, humidity and socket1 state connected via Wi-Fi communication to another sensor node measuring time, date, human presence, socket2 state and also carrying the data logging SD_CARD module. In addition, a software part which is MATLAB neural network toolbox for developing the learning algorithm.

2.1. Sensor Node A

This sensor node consists of sensors, a 5v switch mode power (SMP) supply, an indicator and ESP8266 NodeMCU, a system on chip (SOC) that carries an esp8266 module for Wi-Fi communication and a Tensilica X10 microcontroller 10. The sensors on this node include a MAX44009 for measuring luminous intensity, a DHT11 sensor for measuring temperature and humidity. It also includes a light dependent resistor (LDR) mounted on the indicator of socket1 to detect when the socket is switched on or off. The circuit diagram for this node is shown in Figure 2.

2.2. Sensor Node B

Sensor node B consist of PIR motion sensor for detecting human movement, a LDR mounted on the indicator of socket 2. A DS1302 RTC module for monitoring the real time, a SD_CARD module for logging the data, the ESP8266 NodeMCU SOC including a 5v SMP power supply module. The circuit diagram for this node is shown in Figure 3.

2.3. Description of Data Logged

Day type (DT): day type distinguish weekend from work day, 1 was chosen for weekend and 2 for week day and it was label.

Day of the week (DOW): day of the week helps to label each day in the week, Monday was counted as 1 up till Sunday which was labelled 7.

Hour of the day (HD): Hour of the day was labelled 0-24 for the 24-hour clock. The feature was labeled

Minute of the hour (MH): Minute of the way was logged using number 0-60 to cover the 60 min in an hour range. DS1302 RTC module was used to perform the real time clock function.

Human presence (HP): Human presence was detected with the use of a PIR motion sensor, it outputs 1 when it detects a human movement and a zero otherwise, the result of the output was averaged over 2 minute before it was logged, its value ranges from 0.00 – 1.00.

Light Intensity (LI): The light intensity of the room was detected using MAX44009 light sensor, it measures the light intensity in lux.

Temperature (TP): The temperature of the room was also logged, the temperature was sensed using DHT11 temperature and humidity sensor.

Humidity (HM): The humidity of the room was sensed using DHT11.

Light State (LS): By using the MAX44009 the sensor was position to be shielded from ambient light, when the light is switched on there is a sudden increase in the light intensity, this behavior was used to detect when the light is on or off.

Socket1 state (S1S): The state of the first socket was detected using an LDR, placed inside the socket and focusing on its indicator, when the socket is off the reading of the LDR is low and when on the reading is high, this behavior was used to determine when the socket is on (1) and off (0).

Socket2 State (S2S): The state of the second socket was also detected using the same method used to detect socket1 State.

The data were logged every 2 min for 30 days, at the end of the data logging period a total of 10940 data were logged per features. An extract of the data is shown in Figure 4.

2.4. Data Preprocessing

The data were preprocessed before they were fed to the machine learning algorithm, text data as shown in Figure 4 in column 1 and column 2 were removed as the needed data on time and day as been represented with column 3,4,5 and 6. In addition, some rows of data containing the text ‘xx’ was removed they contain incomplete information as the data at those specific time were logged when sensor node A was unable to pass its data to sensor node B. The remaining data was divided to form input data and output data for the various learning algorithm. For the receptacles state prediction, “DT, DOW, HD, MH, HP, LI, TP and HM” features were used as input features and the output features were LS, S1S, S2S respectively for the light state, socket1 state and socket2state. For the ambient condition prediction “DT, DOW, HD, MH, HP and LI” were the input features and the output features were TP and HM respectively for temperature and humidity.

2.5. Machine Learning Process

The machine learning consists of two different problems, a classification problem and a regression problem. Both the classification and the regression problem can be solved using neural network. The problem of predicting the states of the switch and the receptacles which in turn sums up the energy consumption pattern of the user is classification. Whereas the problem of predicting the ambient condition i.e. temperature and humidity of the room is a regression problem.


2.5.1. Classification Problem

The classification algorithm which helps to predict the states of the switches and in turn predicts the energy consumption pattern was developed using the classification neural network toolbox of MATLAB following the steps in Figure 5.

The performance of the training was analyzed by using the confusion matrix generated at the end of the training, cross validation and testing. After the training the toolbox automatically generates a function that can take sample input data as input and gives a prediction.


2.5.2. Regression Problem

The prediction of the temperature and humidity of the room is a regression problem and it was solved using the regression neural network toolbox of the MATLAB environment and it was carried out by the steps as shown in Figure 6. Analyzing the prediction of the regression problem showed a large deviation of predicted to actual value, which was a sign that the algorithm was suffering from bias. To overcome this, a MATLAB program was written to generate higher order polynomials of the input features up to degree 3. Hence a total number of 83 input features were generated from the existing 6 input features. The algorithm was retrained with this input features and the output showed an improvement. This was better improved by generating higher order polynomial of degree 5, so that a total number of 461 input features was regenerated to retrain the algorithm to improve its accuracy.

3. Results and Discussion

3.1. Network Result for Socket 1 state Classification Prediction

Figure 7 shows the confusion matrix result of socket1 state classification result for both training, validation and testing. The network outputs are very accurate; this can be seen in Figure 7. The green squares show the correct responses and the red squares show the incorrect responses. The lower right blue squares show the overall accuracies. For training, there were 6259 correct responses for class 0 “off state” and 1355 correct responses for 1 “on state”. Likewise, 12 responses were incorrectly predicted as 0 and 10 responses was incorrectly predicted as 1. The blue square shows the overall responses as 99.7% success and 0.3% failure. For the cross validation, 1323 responses were correctly predicted as 0 and 309 were correctly predicted as 1. 2 responses were mistakenly predicted as 0 and 2 responses were mistakenly predicted as 1. The blue square shows the overall responses as 99.8% success and 0.2% failure. For the test confusion matrix, 1340 responses were correctly predicted as 0 and 292 were correctly predicted as 1. 1 response was incorrectly predicted as 0 and 3 responses were mistakenly predicted as 1. The blue square shows the overall responses as 99.8% success and 0.2% failure. The overall confusion matrix blue square shows the overall network accuracy as 99.7%.

110 samples of the input features were taken at interval and fed to the function generated by the network for prediction. The result of the predicted value and the actual value is shown in Figure 8. Samples where the red line overlap the blue line shows 100% accuracy of prediction. It is also shown on the plot that there was small deviation in some few samples.

3.2. Network Result for Light State Classification Prediction

Figure 9 shows the confusion matrix result of light state classification for both training, validation and testing. The network outputs are very accurate but not as accurate as socket1 state network. The green squares show the correct responses and the red square shows the incorrect responses. The lower right blue squares show the overall accuracies. For training, there were 6293 correct responses for class 0 “off state” and 1257 correct responses for 1 “on state”. Likewise, 72 responses were incorrectly predicted as 0 and 14 responses was incorrectly predicted as 1. The blue square shows the overall responses as 98.9% success and 1.1% failure. For the cross validation, 1342 responses were correctly predicted as 0 and 281 were correctly predicted as 1. 10 responses were mistakenly predicted as 0 and 3 responses were mistakenly predicted as 1. The blue square shows the overall responses as 99.2% success and 0.8% failure. For the test confusion matrix, 1347 responses were correctly predicted as 0 and 269 were correctly predicted as 1. 15 responses were incorrectly predicted as 0 and 5 responses were mistakenly predicted as 1. The blue square shows the overall responses as 98.8% success and 1.2% failure. The overall confusion matrix blue square shows the overall network accuracy as 98.9%.

110 samples of the input features were taken at interval and fed to the function generated by the network for prediction. The result of the predicted value and the actual value is shown in Figure 10. Samples where the red line overlap the blue line shows 100% accuracy of prediction. It is also shown on the plot that there was small deviation in some few samples.

3.3. Energy Consumption Profile

The energy consumption was measured as the average of load points in use at any particular time. This was derived by summing the predictions for the states of the sockets and the light point and then finding the mean for each hour of occurrence. As shown in Figure 11, the energy consumption was greater between the hour of 8am in the morning and 16pm in the afternoon. Figure 12 shows the energy consumption statistics vs human presence rating; it can be seen that the energy consumption was concentrated in the region of human presence rated 0.3 to 1 which shows high activity in the area. Though in few samples, energy consumption was high at human presence rating 0, this is because at some points when there is no activity in the room for more than 2 minute, the load points where still in use. This can be characterized as energy wastage if it occurs at an unusual time when energy consumption is low as shown in Figure 13.

3.4. Ambient Condition Prediction

Figure 14 shows the plot of predicted value shown in red and the actual value shown in blue for temperature prediction. Deviation occurs in more samples with only few samples overlapping. Effort were made to generate higher order polynomial input features up to degree 5 which increased the accuracy of the prediction. Nevertheless, to obtain higher accuracy there is a need to generate more data for training the algorithm. Figure 15 shows the effect of temperature on the energy consumption profile. It can be seen on the figure that energy consumption is relatively high in the region of higher temperature, between 24°C and 28°C, this value skyrocketed on getting to higher temperature between 29°C and 30°C. Higher energy consumption in the day can also be justified by Figure 16 showing a drastic increase in temperature from the period of 8am to 16pm.

This same period of the day has been seen earlier in Figure 11 as having the highest energy consumption statistics.

4. Conclusion and Recommendation

According to the results in section 3, it can be concluded that the energy consumption profile depends on several factors including temperature, human presence rating and time of the day. All this factors invariably contribute to the complexity of energy management on the consumer side. Developing a machine learning algorithm integrated with internet of things can be useful in learning from these factors in order to automate consumption of energy on the consumer side. Hence, enhancing energy consumption management on the consumer side.

This paper presented the application of machine learning to energy consumption management and prediction. A machine learning algorithm was developed to learn from sensor data and user attitude towards usage of the load points. After the analysis of the learning network, it can be concluded that the energy consumption pattern and ambient condition of a location can be predicted based on sensor data. The results obtained are encouraging and the analysis can be extended by creating a larger network of sensor nodes and increasing the number of days for data collection.

Future study can look into developing an online learning algorithm hosted on the cloud server that can be used to learn from this data real time as they stream to the database. This can help create a more robust and accurate system.

Acknowledgements

I acknowledge the effort of my supervisor, DR. S.A. Oyetunji for his moral and mental support during the course of this research. I also acknowledge Engr. Sola Oladiran, the lab instructor, PCB design lab FUTA.

Statement of Competing Interests

The author has no competing interest.

References

[1]  Raphael A.W. Energy Efficiency and Mangement in Industries- a case study of Ghana's largest Industrial Area. Linkoping: Institute of Technology Linkoping University, 2012. LIU-IEI-TEK-A-12/01311-SE.
In article      View Article
 
[2]  An Approach to Energy Saving and COst of Energy Reduction Using an Improved Efficient Technology. Abubakar K.A., Abba L.B., et al. 4, s.l.: Open Journal of Energy Efficiency, 2015, Vol. I.
In article      View Article
 
[3]  Alex S., Vishwanathan S.V.N. Introduction to Machine Learning. Cambridge: Cambridge University Press, 2008.
In article      
 
[4]  Some Studies in Machine learning Using the Game Checkers. Arthur L.S. Stanford: IBM Journal of Reasearch and Development, 1959.
In article      View Article
 
[5]  Using Machine Learning on Sensor Data. Alexandra M., Marko P., et al. 4, Ljubjana: Journal of Computing and Information Technology, 2010, Vol. I.
In article      View Article
 
[6]  Machine Learning Applied to Sensor Data Analysis. Go T., Moe T., et al. 1, Yokogawa: Yokogawa Technical Report, 2016, Vol. 59.
In article      View Article
 
[7]  Mitchell T. Machine learning. Louisiana: McGraw Hill, 1997.
In article      
 
[8]  Andrew N.G. Machine learning Stanford University. [Video] s.l.: Cousera, 2017.
In article      
 
[9]  Artificial Neural Networks: A Tutorial. Anil K.J., Jianchang M., Mohiuddin K.M.,. s.l.: ACM Digital Library, 1996, Vol. 29.
In article      
 
[10]  EspressIf System IOT Team. ESP8266EX Datasheet. s.l.: http://bbs.espressif.com/, 2015.
In article      View Article
 

Published with license by Science and Education Publishing, Copyright © 2017 Daniel Abode and Samson Oyetunji

Creative CommonsThis work is licensed under a Creative Commons Attribution 4.0 International License. To view a copy of this license, visit http://creativecommons.org/licenses/by/4.0/

Cite this article:

Normal Style
Daniel Abode, Samson Oyetunji. An Integrated Machine Learning Algorithm for Energy Management and Predictions. American Journal of Energy Research. Vol. 5, No. 3, 2017, pp 103-113. http://pubs.sciepub.com/ajer/5/3/5
MLA Style
Abode, Daniel, and Samson Oyetunji. "An Integrated Machine Learning Algorithm for Energy Management and Predictions." American Journal of Energy Research 5.3 (2017): 103-113.
APA Style
Abode, D. , & Oyetunji, S. (2017). An Integrated Machine Learning Algorithm for Energy Management and Predictions. American Journal of Energy Research, 5(3), 103-113.
Chicago Style
Abode, Daniel, and Samson Oyetunji. "An Integrated Machine Learning Algorithm for Energy Management and Predictions." American Journal of Energy Research 5, no. 3 (2017): 103-113.
Share
[1]  Raphael A.W. Energy Efficiency and Mangement in Industries- a case study of Ghana's largest Industrial Area. Linkoping: Institute of Technology Linkoping University, 2012. LIU-IEI-TEK-A-12/01311-SE.
In article      View Article
 
[2]  An Approach to Energy Saving and COst of Energy Reduction Using an Improved Efficient Technology. Abubakar K.A., Abba L.B., et al. 4, s.l.: Open Journal of Energy Efficiency, 2015, Vol. I.
In article      View Article
 
[3]  Alex S., Vishwanathan S.V.N. Introduction to Machine Learning. Cambridge: Cambridge University Press, 2008.
In article      
 
[4]  Some Studies in Machine learning Using the Game Checkers. Arthur L.S. Stanford: IBM Journal of Reasearch and Development, 1959.
In article      View Article
 
[5]  Using Machine Learning on Sensor Data. Alexandra M., Marko P., et al. 4, Ljubjana: Journal of Computing and Information Technology, 2010, Vol. I.
In article      View Article
 
[6]  Machine Learning Applied to Sensor Data Analysis. Go T., Moe T., et al. 1, Yokogawa: Yokogawa Technical Report, 2016, Vol. 59.
In article      View Article
 
[7]  Mitchell T. Machine learning. Louisiana: McGraw Hill, 1997.
In article      
 
[8]  Andrew N.G. Machine learning Stanford University. [Video] s.l.: Cousera, 2017.
In article      
 
[9]  Artificial Neural Networks: A Tutorial. Anil K.J., Jianchang M., Mohiuddin K.M.,. s.l.: ACM Digital Library, 1996, Vol. 29.
In article      
 
[10]  EspressIf System IOT Team. ESP8266EX Datasheet. s.l.: http://bbs.espressif.com/, 2015.
In article      View Article