This report explains the intended goal of this project and how the dashboard aids in reaching this goal. I will also briefly describe what is the data from which the dashboard builds upon, and the rationale behind the dashboard panels and plots.
Amid growing concerns about rising energy prices, energy independence, and the impact of climate change, statistics show buildings to be the primary energy consumer in the U.S. This fact underscores the importance of targeting building energy use as a key to decreasing the nation’s energy consumption. The building sector can significantly reduce energy use by incorporating energy-efficient strategies into the design, construction, and operation of new buildings and undertaking retrofits to improve the efficiency of existing buildings. It can further reduce dependence on fossil fuel derived energy by increasing use of on-site and off-site renewable energy sources. (Source: Whole Building Design Guide)
In the context of this project, a net-zero building is thought of as being capable to generate energy (from solar irradiance) and consume energy through it’s various energy devices. Every year, based on the diference of energy generated versus energy consumed, the building is “evaluated” as:
The goal at every year is minimally to be Net-Zero, as Net-Negative will inccur costs to purcharse energy.
The energy management, however, is not fully automated by the building: It is the responsability of the building’s users to reach the Net-Zero goal every year.
In order to help the users to reach net-zero, the building will also contrain several environmental (e.g. temperature, relative humidity) and energy sensors (for the energy devices and outlets) for the users to use to manage the energy usage.
The Hawaii Natural Energy Institute (HNEI), located at the University of Hawaii at Manoa, is sponsoring the construction of two NZEB buildings in the university campus. Since the HNEI is focused in renewable technologies and the project is targeted at buildings, the Environmental Research and Design Lab (ERDL), under the school of architecture, is also involved, the later which I am part of.
While the two buildings are still under construction, we are already aware they will be used by the UH Manoa College of Education (COE) by teachers and highschool students.
Since the two buildings are to be Net-Zero, the teachers will be held responsible to reach every year, minimally, the Net-Zero goal. Reaching the net-zero goal every year, however, is not a trivial task. One must continuously take into consideration energy-saving opportunities. These opportunities arise at any moment someone inside the building decides to (or not) turn on an energy device. For instance, in a day where it its relatively windy outside, opening the windows could avoid the consumption of the A/C for the entire day. Alternatively, even if the temperature is slight uncomfortable during a month, it may be best to endure it if it is already expected the following month will be worse, and the energy generated can only be spent in one of the two months.
Enabling the user, in this case the highschool teachers, to continuously take into consideration energy-saving opportunities by constantly making informed decisions of when to turn or not on an energy device is the purpose of this project Dashboard.
Since from the problem statement the dasboard is intended to help teachers decide when to turn or not on any energy device when using the room, a dashboard metaphor that accounts for the cost of each decision seems reasonable.
Namely, we can consider that every year the building’s users (teachers and highschool students) are given an energy allowance. The energy allowance for the entire year is then allowed to be spent by them in the energy devices (e.g. fan, A/C, outlets, etc.) up until the allowance ends. The metaphor is useful as a simple model for both teachers and highschool students, since it closely relates to how one would use their money.
Following the analogy, we will be provided by Loisos and Ubbelohde with predictions of how much energy should be consumed at every device per day in order for the Net-Zero goal to be reached, while still being able to use the devices every day. Following along the metaphor, this could be seen as parental advice to not spend all the money quickly, but rather distribute it accordingly to several objects over time.
The challenge then is how to best present this metaphor, through plots, tables and text through the dashboard which will be available in the building to decide wether or not to turn on devices. In order to do so, we need to understand better first the data model, i.e., what data is available and how they relate.
As noted in the introduction, the two UH Manoa NZEB buildings where the dashboard will be placed are still under construction. Since the buildings being constructed are similar to other 3 existing buildings by the same company, we decided to use them as a reference to create our dashboard. The buildings in the scope of this report are known as KWWest, KWEast, and Illima. The sensors available on the 3 buildings are the same, as shown below:
library(data.table)
sensors <- fread("~/Downloads/data-for-carlos/sensor_info2.csv")
library(knitr)
kable(sensors[building=="KWWest"])
| sensor_id | building | location | type | end_use |
|---|---|---|---|---|
| 1 | KWWest | Ceiling | Illuminance_ft-c | |
| 2 | KWWest | W wall | Illuminance_ft-c | |
| 3 | KWWest | room | RH_pct | |
| 4 | KWWest | W wall | Temp_F_air | |
| 5 | KWWest | E wall | Temp_F_air | |
| 6 | KWWest | W wall | Temp_F_surface | |
| 7 | KWWest | E wall | Temp_F_surface | |
| 51 | KWWest | Energy_kwh | ceiling_fans | |
| 52 | KWWest | Energy_kwh | condensing_unit | |
| 53 | KWWest | Energy_kwh | exhaust_fans | |
| 54 | KWWest | Energy_kwh | fan_coil_unit | |
| 55 | KWWest | Energy_kwh | lighting_exterior | |
| 56 | KWWest | Energy_kwh | lighting_main_space | |
| 57 | KWWest | Energy_kwh | panel_feed | |
| 58 | KWWest | Energy_kwh | plug_load | |
| 59 | KWWest | Energy_kwh | louver_actuator | |
| 60 | KWWest | Energy_kwh | pv_generation |
There are 2 main type of sensors:
The sensors are (unsure if indoor or outdoor):
For each type of sensor, we have one on each wall (aside from Relative Humidity and Illuminance). Let’s observe over the course of a year (July 1,2014 - June 31,2015) how each sensor data looks like, as this can help understanding how to better present the data in the dashboard.
samples <- fread("~/Downloads/data-for-carlos/all_sensor_data.csv",showProgress=FALSE)
library(lubridate)
library(dygraphs)
samples <- samples[,.(Date=ymd_hms(datetime),sensor_id,reading)]
#dt1 <- samples[sensor_id==4,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==4,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
#dt2 <- samples[sensor_id==5,.(Date=ymd_hms(datetime),Reading=reading)]
dt2 <- samples[sensor_id==5,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,WestWall=Reading.x,EastWall=Reading.y)], main = "Air Temperature (F)") %>% dyRangeSelector()
#dt1 <- samples[sensor_id==11,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==12,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==11,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
#dt2 <- samples[sensor_id==5,.(Date=ymd_hms(datetime),Reading=reading)]
dt2 <- samples[sensor_id==12,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,WestWall=Reading.x,EastWall=Reading.y)], main = "Air Temperature (F)") %>% dyRangeSelector()
#dt1 <- samples[sensor_id==17,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==18,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==17,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
#dt2 <- samples[sensor_id==5,.(Date=ymd_hms(datetime),Reading=reading)]
dt2 <- samples[sensor_id==18,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,WestWall=Reading.x,EastWall=Reading.y)], main = "Air Temperature (F)") %>% dyRangeSelector()
The temperatures of the buildings looks just fine. Let’s observe the surface ones:
Apparently, no data is available for surface despite being reported in the sensor table for all the 3 buildings.
#dt1 <- samples[sensor_id==1,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==2,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==1,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
#dt2 <- samples[sensor_id==5,.(Date=ymd_hms(datetime),Reading=reading)]
dt2 <- samples[sensor_id==2,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,Ceiling=Reading.x,WestWall=Reading.y)], main = "Illuminance (Foot Candle)") %>% dyRangeSelector()
#dt1 <- samples[sensor_id==8,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==9,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==8,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
dt2 <- samples[sensor_id==9,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,Ceiling=Reading.x,WestWall=Reading.y)], main = "Illuminance (Foot Candle)") %>% dyRangeSelector()
#dt1 <- samples[sensor_id==15,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==16,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==15,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
dt2 <- samples[sensor_id==16,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,Ceiling=Reading.x,WestWall=Reading.y)], main = "Illuminance (Foot Candle)") %>% dyRangeSelector()
For Illima, it appears there are some issues with the sensors when compared to the other buildings.
#dt <- samples[sensor_id==3,.(Date=ymd_hms(datetime),Reading=reading)]
dt <- samples[sensor_id==3,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt) <- c("Date","Reading")
dygraph(dt[,.(Date,Room=Reading)], main = "Relative Humidity (Percentage)") %>% dyRangeSelector()
#dt <- samples[sensor_id==10,.(Date=ymd_hms(datetime),Reading=reading)]
dt <- samples[sensor_id==10,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt) <- c("Date","Reading")
dygraph(dt[,.(Date,Room=Reading)], main = "Relative Humidity (Percentage)") %>% dyRangeSelector()
#dt <- samples[sensor_id==21,.(Date=ymd_hms(datetime),Reading=reading)]
dt <- samples[sensor_id==21,mean(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt) <- c("Date","Reading")
dygraph(dt[,.(Date,Room=Reading)], main = "Relative Humidity (Percentage)") %>% dyRangeSelector()
Energy sensors are divided in consumption and generation. Aside from Illida which contain two energy generation sensors, the remaining builds contain only one. The consumption portion is divided in several devices and the energy outlets.
#dt <- samples[sensor_id==60,.(Date=ymd_hms(datetime),Reading=reading)]
dt <- samples[sensor_id==60,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt) <- c("Date","Reading")
dygraph(dt[,.(Date,SolarGeneration=Reading)], main = "Solar Energy Generation (Kwh)") %>% dyRangeSelector()
#dt <- samples[sensor_id==50,.(Date=ymd_hms(datetime),Reading=reading)]
dt <- samples[sensor_id==50,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt) <- c("Date","Reading")
dygraph(dt[,.(Date,SolarGeneration=Reading)], main = "Solar energy Generation (Kwh)") %>% dyRangeSelector()
For Illima, the pv_inverter_1 and pv_inverter_2 summed result in the pv_generation, the only sensor available for the other buildings associated to energy generation.
#dt1 <- samples[sensor_id==35,.(Date=ymd_hms(datetime),Reading=reading)]
#dt2 <- samples[sensor_id==36,.(Date=ymd_hms(datetime),Reading=reading)]
dt1 <- samples[sensor_id==35,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","Reading")
#dt2 <- samples[sensor_id==5,.(Date=ymd_hms(datetime),Reading=reading)]
dt2 <- samples[sensor_id==36,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","Reading")
dt <- merge(dt1,dt2,by="Date")
dygraph(dt[,.(Date,SolarGeneration=Reading.x,WestWall=Reading.y)], main = "Solar Energy Generation (Kwh)") %>% dyRangeSelector()
This data is a bit different to reason about when compared to the environmental sensors. Basically the amount will always be the same if on or off, and it may make sense to plot the cumulative amount of energy spent than the consumption at every reading since that will always be fixed (i.e. without the cumulative function, the plot really will only serve to confirm wether it is on or off, which should be pretty obvious to someone inside the building!).
#dt1 <- samples[sensor_id==51,.(Date=ymd_hms(datetime),ceiling_fans=cumsum(reading))]
#dt2 <- samples[sensor_id==52,.(Date=ymd_hms(datetime),condensing_unit=cumsum(reading))]
#dt3 <- samples[sensor_id==53,.(Date=ymd_hms(datetime),exhaust_fans=cumsum(reading))]
#dt4 <- samples[sensor_id==54,.(Date=ymd_hms(datetime),fan_coil_unit=cumsum(reading))]
#dt5 <- samples[sensor_id==55,.(Date=ymd_hms(datetime),lighting_exterior=cumsum(reading))]
#dt6 <- samples[sensor_id==56,.(Date=ymd_hms(datetime),lighting_main_space=cumsum(reading))]
#dt7 <- samples[sensor_id==58,.(Date=ymd_hms(datetime),plug_load=cumsum(reading))]
#dt8 <- samples[sensor_id==59,.(Date=ymd_hms(datetime),louver_actuator=cumsum(reading))]
dt1 <- samples[sensor_id==51,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","ceiling_fans")
dt2 <- samples[sensor_id==52,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","condensing_unit")
dt3 <- samples[sensor_id==53,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt3) <- c("Date","exhaust_fans")
dt4 <- samples[sensor_id==54,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt4) <- c("Date","fan_coil_unit")
dt5 <- samples[sensor_id==55,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt5) <- c("Date","lighting_exterior")
dt6 <- samples[sensor_id==56,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt6) <- c("Date","lighting_main_space")
dt7 <- samples[sensor_id==58,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt7) <- c("Date","plug_load")
dt8 <- samples[sensor_id==59,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt8) <- c("Date","louver_actuator")
dt <- merge(dt1,dt2,by="Date")
dt <- merge(dt,dt3,by="Date")
dt <- merge(dt,dt4,by="Date")
dt <- merge(dt,dt5,by="Date")
dt <- merge(dt,dt6,by="Date")
dt <- merge(dt,dt7,by="Date")
dt <- merge(dt,dt8,by="Date")
dygraph(dt[,.(ceiling_fans=cumsum(ceiling_fans),condensing_unit=cumsum(condensing_unit),exhaust_fans=cumsum(exhaust_fans),fan_coil_unit=cumsum(fan_coil_unit),lighting_exterior=cumsum(lighting_exterior),lighting_main_space=cumsum(lighting_main_space),plug_load=cumsum(plug_load),louver_actuator=cumsum(louver_actuator))],main = "Devices and Outlet Energy Consumption (Kwh)") %>% dyRangeSelector()
With cumulative function.
#dt1 <- samples[sensor_id==41,.(Date=ymd_hms(datetime),ceiling_fans=cumsum(reading))]
#dt2 <- samples[sensor_id==42,.(Date=ymd_hms(datetime),condensing_unit=cumsum(reading))]
#dt3 <- samples[sensor_id==43,.(Date=ymd_hms(datetime),exhaust_fans=cumsum(reading))]
#dt4 <- samples[sensor_id==44,.(Date=ymd_hms(datetime),fan_coil_unit=cumsum(reading))]
#dt5 <- samples[sensor_id==45,.(Date=ymd_hms(datetime),lighting_exterior=cumsum(reading))]
#dt6 <- samples[sensor_id==46,.(Date=ymd_hms(datetime),lighting_main_space=cumsum(reading))]
#dt7 <- samples[sensor_id==48,.(Date=ymd_hms(datetime),plug_load=cumsum(reading))]
#dt8 <- samples[sensor_id==49,.(Date=ymd_hms(datetime),louver_actuator=cumsum(reading))]
dt1 <- samples[sensor_id==41,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","ceiling_fans")
dt2 <- samples[sensor_id==42,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","condensing_unit")
dt3 <- samples[sensor_id==43,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt3) <- c("Date","exhaust_fans")
dt4 <- samples[sensor_id==44,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt4) <- c("Date","fan_coil_unit")
dt5 <- samples[sensor_id==45,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt5) <- c("Date","lighting_exterior")
dt6 <- samples[sensor_id==46,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt6) <- c("Date","lighting_main_space")
dt7 <- samples[sensor_id==48,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt7) <- c("Date","plug_load")
dt8 <- samples[sensor_id==49,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt8) <- c("Date","louver_actuator")
dt <- merge(dt1,dt2,by="Date")
dt <- merge(dt,dt3,by="Date")
dt <- merge(dt,dt4,by="Date")
dt <- merge(dt,dt5,by="Date")
dt <- merge(dt,dt6,by="Date")
dt <- merge(dt,dt7,by="Date")
dt <- merge(dt,dt8,by="Date")
dygraph(dt[,.(ceiling_fans=cumsum(ceiling_fans),condensing_unit=cumsum(condensing_unit),exhaust_fans=cumsum(exhaust_fans),fan_coil_unit=cumsum(fan_coil_unit),lighting_exterior=cumsum(lighting_exterior),lighting_main_space=cumsum(lighting_main_space),plug_load=cumsum(plug_load),louver_actuator=cumsum(louver_actuator))],main = "Devices and Outlet Energy Consumption (Kwh)") %>% dyRangeSelector()
There is something wrong with this cumulative plot given the “reset bump”. Removing the cumulative function shows the actual sensor has several negative measurements.
#dt1 <- samples[sensor_id==41,.(Date=ymd_hms(datetime),ceiling_fans=reading)]
#dt2 <- samples[sensor_id==42,.(Date=ymd_hms(datetime),condensing_unit=reading)]
#dt3 <- samples[sensor_id==43,.(Date=ymd_hms(datetime),exhaust_fans=reading)]
#dt4 <- samples[sensor_id==44,.(Date=ymd_hms(datetime),fan_coil_unit=reading)]
#dt5 <- samples[sensor_id==45,.(Date=ymd_hms(datetime),lighting_exterior=reading)]
#dt6 <- samples[sensor_id==46,.(Date=ymd_hms(datetime),lighting_main_space=reading)]
#dt7 <- samples[sensor_id==48,.(Date=ymd_hms(datetime),plug_load=reading)]
#dt8 <- samples[sensor_id==49,.(Date=ymd_hms(datetime),louver_actuator=reading)]
#dt <- merge(dt1,dt2,by="Date")
#dt <- merge(dt,dt3,by="Date")
#dt <- merge(dt,dt4,by="Date")
#dt <- merge(dt,dt5,by="Date")
#dt <- merge(dt,dt6,by="Date")
#dt <- merge(dt,dt7,by="Date")
#dt <- merge(dt,dt8,by="Date")
dygraph(dt, main = "Devices and Outlet Energy Consumption (Kwh)") %>% dyRangeSelector()
For Illima, it appears there is no data available for sensor_id=38, the louver_actuator despite being listed in the sensor table.
#dt1 <- samples[sensor_id==28,.(Date=ymd_hms(datetime),ceiling_fans=reading)]
#dt2 <- samples[sensor_id==29,.(Date=ymd_hms(datetime),condensing_unit=reading)]
#dt3 <- samples[sensor_id==30,.(Date=ymd_hms(datetime),exhaust_fans=reading)]
#dt4 <- samples[sensor_id==31,.(Date=ymd_hms(datetime),fan_coil_unit=reading)]
#dt5 <- samples[sensor_id==32,.(Date=ymd_hms(datetime),lighting_exterior=reading)]
#dt6 <- samples[sensor_id==33,.(Date=ymd_hms(datetime),lighting_main_space=reading)]
#dt7 <- samples[sensor_id==37,.(Date=ymd_hms(datetime),plug_load=reading)]
#dt8 <- samples[sensor_id==38,.(Date=ymd_hms(datetime),louver_actuator=reading)]
dt1 <- samples[sensor_id==28,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt1) <- c("Date","ceiling_fans")
dt2 <- samples[sensor_id==29,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt2) <- c("Date","condensing_unit")
dt3 <- samples[sensor_id==30,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt3) <- c("Date","exhaust_fans")
dt4 <- samples[sensor_id==31,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt4) <- c("Date","fan_coil_unit")
dt5 <- samples[sensor_id==32,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt5) <- c("Date","lighting_exterior")
dt6 <- samples[sensor_id==33,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt6) <- c("Date","lighting_main_space")
dt7 <- samples[sensor_id==37,sum(reading),by=ymd_hms(paste(year(Date),"-",month(Date),"-",day(Date)," ",hour(Date),":00:00",sep=""))]
colnames(dt7) <- c("Date","plug_load")
dt <- merge(dt1,dt2,by="Date")
dt <- merge(dt,dt3,by="Date")
dt <- merge(dt,dt4,by="Date")
dt <- merge(dt,dt5,by="Date")
dt <- merge(dt,dt6,by="Date")
dt <- merge(dt,dt7,by="Date")
#dt <- merge(dt,dt8,by="Date")
dygraph(dt[,.(ceiling_fans=cumsum(ceiling_fans),condensing_unit=cumsum(condensing_unit),exhaust_fans=cumsum(exhaust_fans),fan_coil_unit=cumsum(fan_coil_unit),lighting_exterior=cumsum(lighting_exterior),lighting_main_space=cumsum(lighting_main_space),plug_load=cumsum(plug_load))],main = "Devices and Outlet Energy Consumption (Kwh)") %>% dyRangeSelector()