This is the result of reading the first sample of data from Sunset air. It is a csv file with hourly readings in cumulative kilowatt hours. The observations are all at 34 minutes after the hour.
library(lubridate)
##
## Attaching package: 'lubridate'
## The following objects are masked from 'package:base':
##
## date, intersect, setdiff, union
library(tidyverse)
## ── Attaching packages ────────────────────── tidyverse 1.3.0 ──
## ✓ ggplot2 3.3.2 ✓ purrr 0.3.4
## ✓ tibble 3.0.1 ✓ dplyr 1.0.0
## ✓ tidyr 1.1.2 ✓ stringr 1.4.0
## ✓ readr 1.3.1 ✓ forcats 0.5.0
## ── Conflicts ───────────────────────── tidyverse_conflicts() ──
## x lubridate::as.difftime() masks base::as.difftime()
## x lubridate::date() masks base::date()
## x dplyr::filter() masks stats::filter()
## x lubridate::intersect() masks base::intersect()
## x dplyr::lag() masks stats::lag()
## x lubridate::setdiff() masks base::setdiff()
## x lubridate::union() masks base::union()
library(Hmisc)
## Loading required package: lattice
## Loading required package: survival
## Loading required package: Formula
##
## Attaching package: 'Hmisc'
## The following objects are masked from 'package:dplyr':
##
## src, summarize
## The following objects are masked from 'package:base':
##
## format.pval, units
library(plotly)
##
## Attaching package: 'plotly'
## The following object is masked from 'package:Hmisc':
##
## subplot
## The following object is masked from 'package:ggplot2':
##
## last_plot
## The following object is masked from 'package:stats':
##
## filter
## The following object is masked from 'package:graphics':
##
## layout
S = read_csv("Sample_2020-11-04.csv")
## Parsed with column specification:
## cols(
## Timestamp = col_character(),
## hvac_kWh = col_character(),
## ltg_kWh = col_character(),
## main_kWh = col_character(),
## plug_kWh = col_character(),
## solar_kWh = col_character()
## )
glimpse(S)
## Rows: 24
## Columns: 6
## $ Timestamp <chr> "11/4/20 0:34", "11/4/20 1:34", "11/4/20 2:34", "11/4/20 3:…
## $ hvac_kWh <chr> "153598.9 kW-hr {ok}", "153599.7 kW-hr {ok}", "153600.5 kW-…
## $ ltg_kWh <chr> "332126.7 kW-hr {ok}", "332130.2 kW-hr {ok}", "332133.9 kW-…
## $ main_kWh <chr> "1134035.6 kW-hr {ok}", "1134048.4 kW-hr {ok}", "1134059.9 …
## $ plug_kWh <chr> "648310.0 kW-hr {ok}", "648318.5 kW-hr {ok}", "648325.5 kW-…
## $ solar_kWh <chr> "166649.0 kW-hr {ok}", "166649.0 kW-hr {ok}", "166649.0 kW-…
All of the data was imported as character strings and requires conversion to be useful.
S$Timestamp = mdy_hm(S$Timestamp)
S$hvac_kWh = as.numeric(substring(S$hvac_kWh,1,8))
S$ltg_kWh = as.numeric(substring(S$ltg_kWh,1,8))
S$main_kWh = as.numeric(substring(S$main_kWh,1,8))
S$plug_kWh = as.numeric(substring(S$plug_kWh,1,8))
S$solar_kWh = as.numeric(substring(S$solar_kWh,1,8))
S$hour = hour(S$Timestamp)
glimpse(S)
## Rows: 24
## Columns: 7
## $ Timestamp <dttm> 2020-11-04 00:34:00, 2020-11-04 01:34:00, 2020-11-04 02:34…
## $ hvac_kWh <dbl> 153598.9, 153599.7, 153600.5, 153601.2, 153602.1, 153603.0,…
## $ ltg_kWh <dbl> 332126.7, 332130.2, 332133.9, 332136.5, 332139.0, 332143.2,…
## $ main_kWh <dbl> 1134035, 1134048, 1134059, 1134070, 1134082, 1134094, 11341…
## $ plug_kWh <dbl> 648310.0, 648318.5, 648325.5, 648332.7, 648341.1, 648348.1,…
## $ solar_kWh <dbl> 166649.0, 166649.0, 166649.0, 166649.0, 166649.0, 166649.0,…
## $ hour <int> 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 1…
All of these measurements are cumulative in one-hour increments. We need to take deltas to get hourly rates of accumulation.
S$d_hvac = S$hvac_kWh - Lag(S$hvac_kWh)
S$d_ltg = S$ltg_kWh - Lag(S$ltg_kWh)
S$d_main = S$main_kWh - Lag(S$main_kWh)
S$d_plug = S$plug_kWh - Lag(S$plug_kWh)
S$d_solar = S$solar_kWh - Lag(S$solar_kWh)
View(S)
Let’s graph the hourly accumulations.
graph_hvac = S %>%
ggplot(aes(x = hour, y = d_hvac)) +
geom_point() +
ggtitle("hvac 11/4/20")
ggplotly(graph_hvac)
graph_ltg = S %>%
ggplot(aes(x = hour, y = d_ltg)) +
geom_point() +
ggtitle("ltg 11/4/20")
ggplotly(graph_ltg)
graph_plug = S %>%
ggplot(aes(x = hour, y = d_plug)) +
geom_point() +
ggtitle("plug 11/4/20")
ggplotly(graph_plug)
graph_main = S %>%
ggplot(aes(x = hour, y = d_main)) +
geom_point() +
ggtitle("main 11/4/20")
ggplotly(graph_main)
graph_solar = S %>%
ggplot(aes(x = hour, y = d_solar)) +
geom_point() +
ggtitle("solar 11/4/20")
ggplotly(graph_solar)
knitr::kable(S)
Timestamp | hvac_kWh | ltg_kWh | main_kWh | plug_kWh | solar_kWh | hour | d_hvac | d_ltg | d_main | d_plug | d_solar |
---|---|---|---|---|---|---|---|---|---|---|---|
2020-11-04 00:34:00 | 153598.9 | 332126.7 | 1134035 | 648310.0 | 166649.0 | 0 | NA | NA | NA | NA | NA |
2020-11-04 01:34:00 | 153599.7 | 332130.2 | 1134048 | 648318.5 | 166649.0 | 1 | 0.8 | 3.5 | 13 | 8.5 | 0.0 |
2020-11-04 02:34:00 | 153600.5 | 332133.9 | 1134059 | 648325.5 | 166649.0 | 2 | 0.8 | 3.7 | 11 | 7.0 | 0.0 |
2020-11-04 03:34:00 | 153601.2 | 332136.5 | 1134070 | 648332.7 | 166649.0 | 3 | 0.7 | 2.6 | 11 | 7.2 | 0.0 |
2020-11-04 04:34:00 | 153602.1 | 332139.0 | 1134082 | 648341.1 | 166649.0 | 4 | 0.9 | 2.5 | 12 | 8.4 | 0.0 |
2020-11-04 05:34:00 | 153603.0 | 332143.2 | 1134094 | 648348.1 | 166649.0 | 5 | 0.9 | 4.2 | 12 | 7.0 | 0.0 |
2020-11-04 06:34:00 | 153606.8 | 332147.4 | 1134112 | 648358.5 | 166649.0 | 6 | 3.8 | 4.2 | 18 | 10.4 | 0.0 |
2020-11-04 07:34:00 | 153609.3 | 332151.6 | 1134129 | 648368.8 | 166649.0 | 7 | 2.5 | 4.2 | 17 | 10.3 | 0.0 |
2020-11-04 08:34:00 | 153611.8 | 332156.7 | 1134147 | 648378.5 | 166649.3 | 8 | 2.5 | 5.1 | 18 | 9.7 | 0.3 |
2020-11-04 09:34:00 | 153613.9 | 332161.5 | 1134164 | 648389.2 | 166650.1 | 9 | 2.1 | 4.8 | 17 | 10.7 | 0.8 |
2020-11-04 10:34:00 | 153615.8 | 332166.5 | 1134181 | 648399.5 | 166652.6 | 10 | 1.9 | 5.0 | 17 | 10.3 | 2.5 |
2020-11-04 11:34:00 | 153617.6 | 332171.5 | 1134199 | 648410.5 | 166658.9 | 11 | 1.8 | 5.0 | 18 | 11.0 | 6.3 |
2020-11-04 12:34:00 | 153619.3 | 332177.0 | 1134217 | 648420.9 | 166660.6 | 12 | 1.7 | 5.5 | 18 | 10.4 | 1.7 |
2020-11-04 13:34:00 | 153620.9 | 332182.4 | 1134233 | 648430.5 | 166661.9 | 13 | 1.6 | 5.4 | 16 | 9.6 | 1.3 |
2020-11-04 14:34:00 | 153622.2 | 332187.7 | 1134251 | 648441.2 | 166663.9 | 14 | 1.3 | 5.3 | 18 | 10.7 | 2.0 |
2020-11-04 15:34:00 | 153623.6 | 332192.3 | 1134267 | 648451.1 | 166664.6 | 15 | 1.4 | 4.6 | 16 | 9.9 | 0.7 |
2020-11-04 16:34:00 | 153625.1 | 332196.8 | 1134283 | 648461.4 | 166664.8 | 16 | 1.5 | 4.5 | 16 | 10.3 | 0.2 |
2020-11-04 17:34:00 | 153626.5 | 332202.1 | 1134299 | 648471.0 | 166664.8 | 17 | 1.4 | 5.3 | 16 | 9.6 | 0.0 |
2020-11-04 18:34:00 | 153628.1 | 332208.1 | 1134319 | 648482.9 | 166664.8 | 18 | 1.6 | 6.0 | 20 | 11.9 | 0.0 |
2020-11-04 19:34:00 | 153629.7 | 332213.6 | 1134339 | 648496.7 | 166664.8 | 19 | 1.6 | 5.5 | 20 | 13.8 | 0.0 |
2020-11-04 20:34:00 | 153631.4 | 332220.8 | 1134359 | 648507.7 | 166664.8 | 20 | 1.7 | 7.2 | 20 | 11.0 | 0.0 |
2020-11-04 21:34:00 | 153632.5 | 332227.3 | 1134376 | 648516.7 | 166664.8 | 21 | 1.1 | 6.5 | 17 | 9.0 | 0.0 |
2020-11-04 22:34:00 | 153633.3 | 332235.1 | 1134393 | 648525.2 | 166664.8 | 22 | 0.8 | 7.8 | 17 | 8.5 | 0.0 |
2020-11-04 23:34:00 | 153634.1 | 332240.7 | 1134409 | 648534.9 | 166664.8 | 23 | 0.8 | 5.6 | 16 | 9.7 | 0.0 |