View on GitHub

Analysis of Smart Lighting Systems

Boyang Cai, Xuerui Yan

Link to this website:

https://xueruy.github.io/EE-M202B-Final-Project/

Abstract

Nowadays, phenomenon of ever-lasting lighting at large-scale public buildings is seriously universal, and the different lighting systems results in hugh different power consumptions even in the similar building environment. Our group came up with a new Data Precontrol Model (DPM) that is a smart lighting system which could help with managing the lighting in large-scale public buildings. The entire of our research make the comparisons among the Lighting System of Naive Lighting Control, Sensor-mode Control and Data Precontrol Model. The experimental result shows that DPM have the significant energy reduction of using fluorescent lamp in the UCLA large scale building. The DPM has around 43% lower energy cost compared with Naive strategy and approximate 38% lower than that of Sensor-mode strategy. For the future work, we will use more advanced devices related to the lighting and testing system to get more accurate research results, and add more features in the machine learning algorithm to provide a better prediction account on energy consumption schedule.

Introduction

The condition of ever-lasting lighting at large-scale public buildings has long been an issue. And the discussion of using what type of energy efficient lighting systems in the large-scale building is still controversial. In this project, we compare the regressive models and energy consumptions in large-scale public buildings among Naive Lighting Control Strategy, Sensor-mode Control Strategy, and Data Precontrol Model strategy, and ensembly analyze performance of each model.

Background of Methodology

Naive Lighting Control

For the naive lighting control, it is widely used in majority of large-scale public buildings. The Strategy of the naive lighting control is straightforward, which enable the ever-lasting lighting and no matter what kind of and how much environmental changes, the lighting schedules are not affected. This control strategy is almost controlled manually.

Sensor-mode Control

The sensor-mode control is the strategy that is commonly used since the sensor-based lighting system becomes more and more popular and universal. Normally, Once the flag raised (“1”) in the sensor, the light will keep ON for a constant time that usually depends on the user settings on the sensor, and then the light would be turned of due to “0” state raised in the sensor.

Data Precontrol Model (DPM)

We designed the data precontrol model based on the machine learning regression method that predict light OFF waiting time condition in different time intervals during the day in the public building.

The question might be asked: why machine learning? Our group tests other precontrol model with non-machine learning algorithm including self chose LSE method with exponential and logarithmic models and Polynomial Fit by Numpy, the results are not as well as our machine learning model, because those models are not covering enough parameters to robust the error or outliers in the data. We found our model fits better with polynomial regressive functions, so we decided to build up the polynomial model with machine learning.

As for our frame and algorithm of DPM, generally, we mine the prepared (1/0) sensing data sorted in the excel files with csv version, which could include one or more days’ data depends on the requirement of the user. After collecting and preprocessing the data, we put the data into machine learning regression algorithm to train and test data so that we could get the non-linear regression of data. Then we put the trained data to the Numpy ployfit model to output the readable polynomial equation. Once the approximated function from regression is obtained, we could do second derivative and definite integral to set the different time intervals in the testing periods and get the average light OFF waiting time (0->1), respectively. Finally with our energy computing algorithm we could figure out the predicted lighting power consumptions in the assigned time intervals daily. It needs to be noticed that the power consumptions of Naive and Sensing-mode methods in these time intervals can also be calculated with our energy computing algorithm.

Controllable Parameters in DPM Computation

We set up the following parameters in the DPM in order to get the better and more reasonable model.

Machine Learning Regression Algorithm in DPM

We choose the PolynomialFeatures to generate polynomial and interaction features for our expected model. It can generate a new feature matrix consisting of all polynomial combinations of the features with degree less than/equal to the required regressive degree. For example, if input data is two dimensional and of the form [a,b], the 2-degree polynomial features are [1, a, b, a^2, ab, b^2].

After deciding to use PolynomialFeatures, we can implement the polynomial regression with linear model, using pipeline to add the polynomialfeatures.

Then we need to figure out what type of the linear model should we choose. At first when choosing the regressor, we tried many regressors of robust linear estimator fitting that could be good fit with our regression model. We tried RANSAC that is known as good for strong outliers in the y direction, TheilSen that is good for small outliers, both in direction X and y, OLS model that is widely used and classic ordinary least squares Linear Regression, and Ridge that solves a regression model where the loss function is the linear least squares function and regularization is given by the l2-norm, with built-in support for multi-variate regression.

The following graphs show the testing result of each linear model mentioned above.

From the above graphs, it can be found that RANSAC and TheilSen regressors are not fairly fitted with our expected regression model. Although OLS plot looks performed as well as Ridge, the normalized parameter in the OLS have to be set to True in order to obtain the above result, which would give rise to the hyperparameters learnt more robust and almost independent of the number of data if the OLS is normalized.

Therefore, we finally choose ridge regressor as our linear model to pipeline with polynomial regressive interpolation.

As for the more specific explanation of using ridge piped with polynomial regression, from n data 1d points, this combo suffices to build the Vandermonde matrix, which is n data * n-th degree+1, the form shown in the Figure below. Intuitively, the generated matrix can be interpreted as a matrix of pseudo features (the points raised to some power). The matrix is akin to (but different from) the matrix induced by a polynomial kernel.

Accordingly, we are able to approximate a function with a polynomial of degree n_degree by using ridge regression reasonably and reliably.

Energy Computation Algorithm in DPM

Computation Algorithm for DPM

We then come up with the the energy computation algorithm for DPM to compute the lighting energy consumption (Unit: Watt*h) in different resulted time intervals which obtained from regressive function. For convenience, our algorithm also cover the energy computation of Naive and Sensor-mode methods.

We then come up with the the energy computation algorithm for DPM to compute the lighting energy consumption (Unit: Watt*h) in different resulted time intervals which obtained from regressive function. For convenience, our algorithm also cover the energy computation of Naive and Sensor-mode methods.

The very base equation of the idea of power computation is Energy consumption = Energy_light_ON + Energy_light_setup, where Energy_light_setup is the trigger energy consumption of turning on light instantly.

In this energy computation model, we use 5-minute Rule[1] of light ON/OFF to be set as Light OFF waiting threshold time, so that we could compute the setup energy cost of the lighting system. As for this Rule that contains two rules, the Rule 1 is If you will be out of a room for 5 minutes or less, leave it on, the Rule 2 is If you will be out of a room for more than 5 minutes, turn it off.

Then we introduce one important variable which is light-OFF Probability, it is the ratio of sum of light OFF waiting time (0->1) above the waiting threshold time vs. the sum of total light OFF waiting time in one time interval.

If Probability > 0.6, we execute Rule 2, due to over-threshold waiting time dominated. We introduced totalLightOffTime under this rule, light no longer waits threshold time, use totalLight OffTime instead of tdmean to compute Energy_light_ON. We then set the totalTime as the total light ON/OFF time to compute Energy_light_setup, and it is punished by the coefficient of negative correlation of light-OFF Probability. The complete equation in this case is shown below.

Additionally, the deltaT is the entire time difference of the time interval.

If light-OFF Probability <= 0.6, we execute Rule 1, due to over-threshold waiting time not dominated. We introduce the tdMean as average waiting time within the time interval which is as mentioned above, obtained from second derivative, and tdMean is obtained by integrational average from regressive equation based on its time interval to compute Energy_light_ON. And introduce occurTime that the times of over-threshold waiting time to compute Energy_light_setup. The complete equation is shown below.

We set the threshold of light-OFF Probability to be 0.6 because we could assume that the probability that is lower than this value have many enough (0->1) events and the light OFF waiting time is not too much in the time interval, whereas if the probability is higher than 0.6, it could be recognized as that the waiting time of light OFF is enough long and less (0 -> 1) events occur.

Energy Computation Algorithm for Naive and Sensor-mode Control

As for the Naive Energy Consumption, it is actually really intuitive because the Naive Energy consumption = Energy_light_ON, and the setup energy could be ignored due to its tiny ratio compared with its total power consumption.

In terms of the Sensor-mode Energy consumption, the LightOffTime is used as the sum of light Off time for over-threshold waiting time. The entire computation equation could be expressed as Energy consumption = occurTime * setupEnergy + maintainPower * (deltaT - LightOffTime + occurTime * 5 * 60)

DPM Programming Output Validation Testing result

The figure of Area 1 testing point of DPM programming regression output is shown below.

The power consumption output in the console, of Area 1 testing point of DPM programming is shown below.

Experimental Setup

We choose one of the UCLA Boelter Hall 4th floor halls as our data collection place. We choose this place as our test area because this area has good internet service (our Smartthing hub only support LAN port) and this area has both low-density area and high-density area. Therefore, we can verify the model in different circumstance. Since we only have four sensors, we evenly distribute these sensors along the hall. Therefore, we divide the hall into 4 areas.

Since my partner and I both have classes in the daytime, we are unable to get a complete one-day data. We take the trade off to spilt the one day data into different period within a week and combine the data we took for the whole week as one day. The reason we use this method is because the hall we choose only contains Seas Lab and offices and there is no classroom in the hallway. Therefore, there should be less variation on people volume within each weekday from Monday to Friday. Besides, we divide our data into Weekday group and Weekend group so we can get more accurate data for each day. For weekday, we choose 7:00am to 11:00pm as our time period. We consider the other time period the same as “night time as this time period should has the same pattern as time around 11pm (and we need to sleep as well). For weekend, we choose 1pm to 8pm as our data time range.

The sensor we choose is Smartthing motion sensor (2013 edition) powered by Samsung. Since the sensor is the first edition, we are unable to find its range. The average Battery life is around 2080 hrs.

sensor

We use this sensor to detect the occurrence of people in the different area in the hall. When the sensor detect a heat (a people), it will send the hub a “high” signal using Zigbee network. When the sensor detect no heat, it will send the hub a “low” signal one minute later using Zigbee.

Beside the sensors, we also need to use the TP-LINK Wi-Fi as a wifi client for Smartthing Hub. The AP client transform the LAN signal of Smartthing Hub into wifi and connect to the Wifi of the campus.

We also get the information of the fluorescent lamp by taking a picture of the lamp. We learned that the working power of the lamp is 26W. So we will use this data to estimate the energy.

Besides the equipment, we need to develop a way to log our data. We refer a code from online that can log data from smart sensor to the google sheet. The hub will log the data it get from the smart sensor as well as the current time. If the incoming data is “high”, it will log a “1” with the current time in the google sheet. It will log “0” if the incoming data is “low”. After we get the data, we change the time format and convert it to a csv file for python to read.

Experimental Results and Evaluation

Generally, we choose the degree 5 as our result for weekday because degree 5 has a higher score than degree 4 and degree 6. For the weekend, degree 4 has the higher score.

For the weekday, we got the following graph and score for Area 1-4

From the graph we can see that Naive model consumes the highest total energy among three models. We can also see that Sensor mode has more energy saving during the valley time(the 1st and the 4th period) but it has more energy consuming than Naive model because of the setup energy. Same for the DPM, the DPM has the minimum total energy consumption in three model types but it does not perform good in the region where there are higher frequency of people walking by. The Data Precontrol Model has a good energy consumption during the valley time because that it know at this time people terns to show up less frequently. Therefore it choose to turn off the lamp immediately after letting the current people pass by(and after a 1 min delay caused by sensor).

The weekend data looks similar to weekday data, but with less frequency of people. Here is the weekend data for area 1-4:

area1-2_weekend area3_weekend area4_weekend weekend

The data for weekend has less degree than the data for weekday. However, we notice that the two edges is going down rather than going up. We think the reason could be that the Seasnet is open on 1PM and closed around 8~9. Therefore there are more people coming and on on these two time period. We think that if we have more data, we could get rid of this kind of period.

Related Work

We did a lot of research, but actually there is no really similar research that could provide us some previous experiences and technology. In fact, We use self-piped regressive model in our case, so we did not figure out that other researcher or group that use this machine learning method to analyze the lighting system in large-scale public buildings. The only research paper found that are close to our research paper is the one that provided by Prof. Mani Srivastava. The paper named “Data Predictive Control for Peak Power Reduction”[4], which presents data-driven based methods which are implemented by data predictive control with regression trees (DPCRT) for making receding horizon control-oriented model in order to reduce peak power in buildings and maintain thermal comfort. The work of their research is relatively close to our topic and we get some inspiration from the experimental setup and the way of evaluation from their content of research paper.

Conclusion and Future work

Our experiment shows that the DPM method we use can reduce the energy consumed by the fluorescent lamp by dynamically change the waiting time for the lamp. The data shows that the energy could be decreased by 43% than using the Naive model. Yet there is a lot of improvement we can do, such as using more data as our sample to get a more accurate model for our prediction. We can also add the Office/class schedule into the data so the algorithm can set up a base model before learning the real data.

This model should be embedded in microcontroller for real time use. We use Smartthing Hub because we want to see whether there is a potential energy drop by using Data Precontrol Mode. Now that we shows that using DPM can reduce the energy consumption, the next step would be using a real microcontroller and measure the energy by a physical meter to see the result. Although DPM method can drop the energy a lot, the hard part comes from the installation and the maintenance. As LED is replacing the fluorescent light in the future, then the combination of LED and DPM may reduce the energy consumption on campus to the lowest level.

Reference

[1] “Does Turning Fluorescent Lights Off Use More Energy Than Leaving Them On?”. Retrieved from: https://www.scientificamerican.com/article/turn-fluorescent-lights-off-when-you-leave-room/

[2] “Robust linear estimator fitting”. Retrieved from: http://scikit-learn.org/stable/auto_examples/linear_model/plot_robust_fit.html#sphx-glr-auto-examples-linear-model-plot-robust-fit-py

[3] “Code reference for logging data to google sheet”. Retrieved From: https://community.smartthings.com/t/log-events-to-google-sheets-see-post-154-for-current-github-repo-and-v1-1/36719

[4] “Data Predictive Control for Peak Power Reduction”. A. jain, etc. Retrieved From: https://dl.acm.org/citation.cfm?id=2993582

Weekly Update

Week 6:

Get the equipment from the TA and set up the network of Smartthing

Week 7:

Write the code for Smartthing to automatically log sensor info on the online google Sheet. Start taking data.

Week 8:

Set up the base algorithm, find which part should be learned by machine learning and keep taking data(including the weekend data)

Week 9:

Optimize the algorithm to evaluate the data precisely. Isolate weekend data from weekday data. Write the code for the control side.

Week 10:

Optimize the algorithm. Set up the presentation. Building website