sudo dpkg -i <pkgname>.debdata.tablesudo apt install texlive-full to enable PDF outputLoad profiles come from http://wzy.ece.iastate.edu/Testsystem.html
feeder_a <- read.csv("feeder_a_data.csv")
names(feeder_a)
[1] "Time" "Year" "Month" "Day.of.Week" "Hour" "Elapsed.Days" "Elapsed.Hours"
[8] "Total.Power" "Bus.1001" "Bus.1002" "Bus.1003" "Bus.1004" "Bus.1005" "Bus.1006"
[15] "Bus.1007" "Bus.1008" "Bus.1009" "Bus.1010" "Bus.1011" "Bus.1012" "Bus.1013"
[22] "Bus.1014" "Bus.1015" "Bus.1016" "Bus.1017"
There’s a lot of columns here from the different smart meters. Let’s just take the total power
fa <- feeder_a[,c("Month","Day.of.Week","Hour","Elapsed.Days","Total.Power")]
Take a quick look at the loaded data. You can also use the “Environment” tab, but this won’t show up in the notebook
head(fa)
hist(fa$Total.Power)
How to do arithmetic with data frame columns
fa$b12 <- feeder_a$Bus.1001 + feeder_a$Bus.1002
mean(fa$Total.Power)
[1] 105.8696
There’s a convenient command to print summary stastics for each column
summary(fa)
Month Day.of.Week Hour Elapsed.Days Total.Power b12
Min. : 1.000 Min. :1.000 Min. : 0.00 Min. : 0.00 Min. : 42.68 Min. :0
1st Qu.: 4.000 1st Qu.:2.000 1st Qu.: 5.75 1st Qu.: 91.24 1st Qu.: 68.07 1st Qu.:0
Median : 7.000 Median :4.000 Median :11.50 Median :182.48 Median : 94.11 Median :0
Mean : 6.526 Mean :3.992 Mean :11.50 Mean :182.48 Mean :105.87 Mean :0
3rd Qu.:10.000 3rd Qu.:6.000 3rd Qu.:17.25 3rd Qu.:273.72 3rd Qu.:141.18 3rd Qu.:0
Max. :12.000 Max. :7.000 Max. :23.00 Max. :364.96 Max. :284.09 Max. :0
NA's :1
Plot the power over time. Yikes! There’s a lot of data here? Just how long is it?
plot(fa$Total.Power,type="l")
A whole year! That’s too much!
max(fa$Elapsed.Days)
[1] 364.96
We can plot just the first week by taking a subset of rows
plot(fa[fa$Elapsed.Days<=7,"Total.Power"],type="l")
names(fa)
[1] "Month" "Day.of.Week" "Hour" "Elapsed.Days" "Total.Power" "b12"
require(data.table)
Loading required package: data.table
Registered S3 method overwritten by 'data.table':
method from
print.data.table
data.table 1.14.0 using 1 threads (see ?getDTthreads). Latest news: r-datatable.com
**********
This installation of data.table has not detected OpenMP support. It should still work but in single-threaded mode.
This is a Mac. Please read https://mac.r-project.org/openmp/. Please engage with Apple and ask them for support. Check r-datatable.com for updates, and our Mac instructions here: https://github.com/Rdatatable/data.table/wiki/Installation. After several years of many reports of installation problems on Mac, it's time to gingerly point out that there have been no similar problems on Windows or Linux.
**********
ta <- as.data.table(fa)
Let’s look at how much power is used per day of week (1 = Sunday). People are a little lazy on Mondays
ta[,mean(Total.Power),by=Day.of.Week]
Now let’s look at power vs month. It looks like air conditioning loads cause a peak in July
ta[,mean(Total.Power),by=Month]
Finally, let’s look at power vs time of day. The peak is at noon, though in some regions/seasons it is common two have two peaks in mornings/evenings
ta[,mean(Total.Power),by=Hour]