s <- suppressPackageStartupMessages
library(data.table)
library(lubridate)
library(knitr)
library(dygraphs)This R Notebook utilizes the javascript functions from the CBE Comfort Tool, freely available on the website’s Github in order to estimate the thermal comfort of the students of FROG UHM.
The readings are a sample data from the frog-uhm project provided by Eileen Peppard to test the tool.
readings <- fread("~/Desktop/aug-24-comfort-sample.csv")Of the provided data, the following variables were used:
In addition, the following artificially created variables were used:
AddOtherVariableAssumptions <- function(building){
building$met <- 1.1
building$clo <- 0.5
building$wme <- 0
return(building)
}
readings <- readings[,.(building,datetime,ta=temperature_air_f,tr=temperature_mrt_f,vel=air_flow_fpm,rh=humidity_percent)]
readings <- AddOtherVariableAssumptions(readings)For the CBE Comfort Tool, the following units must be respected for the variables:
And were converted from the sample data to meet the expected units.
#Convert F to C
readings$ta <- (readings$ta - 32)*(5/9)
readings$tr <- (readings$tr - 32)*(5/9)
# Convert fpm to m/s
readings$vel <- 0.00508 * readings$velWe calculate the PMV for the frog buildings separately over time.
frogs1 <- readings[building=='frog-1',.(ta,tr,vel,rh,met,clo,wme)]
frogs2 <- readings[building=='frog-2',.(ta,tr,vel,rh,met,clo,wme)]This notebook uses the javascript function from the CBE Comfort Tool by passing the sample data after preparation as input, and then retrieving the output of the function which contains the PMV and PPD.
After the model results is output, the data is combined with the original readings for comparison.
frogs1_elevated_air_pmv <- cbind(readings[building=='frog-1'],frogs1_elevated_air_pmv)
frogs2_elevated_air_pmv <- cbind(readings[building=='frog-2'],frogs2_elevated_air_pmv)In addition to PMV and PPD, the following columns are also output in the table (not shown below):
The first 3 columns relate to the Elevated Airspeed adjustmenet to the PMV model, which can’t handle high air speeds in the original proposal by Fanger.
First few rows of the table for Frogs 1.
kable(head(frogs1_elevated_air_pmv))| building | datetime | ta | tr | vel | rh | met | clo | wme | pmv | ppd | set | ta_adj | tr_adj | cooling_effect |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| frog-1 | 8/24/2017 07:00:00 | 28.10000 | 27.66667 | 0.0000 | 58.13 | 1.1 | 0.5 | 0 | -1.019385 | 26.94295 | 28.35231 | 28.10000 | 27.66670 | 0.0000000 |
| frog-1 | 8/24/2017 07:05:00 | 27.92778 | 27.61111 | 0.0000 | 58.21 | 1.1 | 0.5 | 0 | -1.082323 | 29.71119 | 28.24999 | 27.92780 | 27.61110 | 0.0000000 |
| frog-1 | 8/24/2017 07:10:00 | 27.80000 | 27.55556 | 0.1778 | 59.04 | 1.1 | 0.5 | 0 | -1.361422 | 43.46731 | 27.96895 | 27.58704 | 27.34264 | 0.2129565 |
| frog-1 | 8/24/2017 07:15:00 | 27.86111 | 27.61111 | 0.1778 | 57.30 | 1.1 | 0.5 | 0 | -1.360287 | 43.40757 | 27.99993 | 27.64781 | 27.39781 | 0.2132927 |
| frog-1 | 8/24/2017 07:20:00 | 27.83889 | 27.61111 | 0.1778 | 57.03 | 1.1 | 0.5 | 0 | -1.372148 | 44.03333 | 27.98552 | 27.62443 | 27.39663 | 0.2144689 |
| frog-1 | 8/24/2017 07:25:00 | 27.86111 | 27.66667 | 0.1778 | 56.99 | 1.1 | 0.5 | 0 | -1.352435 | 42.99468 | 28.02493 | 27.64630 | 27.45190 | 0.2148009 |
dygraph(frogs1_elevated_air_pmv[,.(mdy_hms(datetime),pmv)], main = "Frogs 1 PMV Value") %>% dyRangeSelector()First few rows of the table for Frogs 2.
kable(head(frogs2_elevated_air_pmv))| building | datetime | ta | tr | vel | rh | met | clo | wme | pmv | ppd | set | ta_adj | tr_adj | cooling_effect |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| frog-2 | 8/24/2017 07:00:00 | 29.17222 | 28.44444 | 0.00508 | 56.54 | 1.1 | 0.5 | 0 | -0.5402296 | 11.10754 | 29.21211 | 29.1722 | 28.4444 | 0 |
| frog-2 | 8/24/2017 07:05:00 | 29.26111 | 28.44444 | 0.00508 | 55.76 | 1.1 | 0.5 | 0 | -0.5301976 | 10.88092 | 29.23702 | 29.2611 | 28.4444 | 0 |
| frog-2 | 8/24/2017 07:10:00 | 29.26111 | 28.44444 | 0.00508 | 56.42 | 1.1 | 0.5 | 0 | -0.5174139 | 10.59844 | 29.24754 | 29.2611 | 28.4444 | 0 |
| frog-2 | 8/24/2017 07:15:00 | 29.27778 | 28.44444 | 0.00508 | 55.28 | 1.1 | 0.5 | 0 | -0.5348055 | 10.98447 | 29.23636 | 29.2778 | 28.4444 | 0 |
| frog-2 | 8/24/2017 07:20:00 | 29.27778 | 28.44444 | 0.00508 | 56.46 | 1.1 | 0.5 | 0 | -0.5119278 | 10.47938 | 29.25520 | 29.2778 | 28.4444 | 0 |
| frog-2 | 8/24/2017 07:25:00 | 29.25000 | 28.44444 | 0.00508 | 56.21 | 1.1 | 0.5 | 0 | -0.5246116 | 10.75661 | 29.23954 | 29.2500 | 28.4444 | 0 |
dygraph(frogs2_elevated_air_pmv[,.(mdy_hms(datetime),pmv)], main = "Frogs 2 PMV Value") %>% dyRangeSelector()