s <- suppressPackageStartupMessages
s(library(data.table))
s(library(lubridate))
s(library(knitr))
s(library(dygraphs))
s(library(ggplot2))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("~/Downloads/template_IP_dhhl_house8_aug_sept.csv")Of the provided data, the following variables were used:
In addition, the following artificially created variables were used:
colnames(readings) <- c("ta","tr","vel","rh","met","clo")
readings$wme <- 0For 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.
readings_si <- readings
#Convert F to C
readings_si$ta <- (readings$ta - 32)*(5/9)
readings_si$tr <- (readings$tr - 32)*(5/9)
# Convert fpm to m/s
readings_si$vel <- 0.00508 * readings$velThis 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.
pmv_elevated_air <- cbind(readings,pmv_elevated_air)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.
# Convert ta to tr
pmv_elevated_air$ta_adj <- pmv_elevated_air$ta_adj*1.8 + 32
pmv_elevated_air$tr_adj <- pmv_elevated_air$tr_adj*1.8 + 32
kable(head(pmv_elevated_air))| ta | tr | vel | rh | met | clo | wme | pmv | ppd | set | ta_adj | tr_adj | cooling_effect |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| 84.900 | 84.900 | 32 | 58.548 | 1 | 1.1 | 0 | 1.771195 | 65.52252 | 32.58639 | 84.34185 | 84.34185 | 0.3100947 |
| 84.945 | 84.945 | 32 | 58.583 | 1 | 1.1 | 0 | 1.778521 | 65.90511 | 32.61514 | 84.38707 | 84.38707 | 0.3099731 |
| 84.722 | 84.722 | 32 | 55.662 | 1 | 1.1 | 0 | 1.711599 | 62.37170 | 32.23582 | 84.15227 | 84.15227 | 0.3165170 |
| 83.959 | 83.959 | 32 | 53.122 | 1 | 1.1 | 0 | 1.567876 | 54.59564 | 31.61651 | 83.38042 | 83.38042 | 0.3214231 |
| 83.332 | 83.332 | 32 | 50.514 | 1 | 1.1 | 0 | 1.445843 | 47.96911 | 31.09290 | 82.74630 | 82.74630 | 0.3254112 |
| 82.441 | 82.441 | 32 | 49.420 | 1 | 1.1 | 0 | 1.301822 | 40.36219 | 30.55440 | 81.85504 | 81.85504 | 0.3255535 |
pmv_elevated_air$is_acceptable <- NA_character_
pmv_elevated_air[ppd > 5]$is_acceptable <- ">5"
pmv_elevated_air[ppd < -5]$is_acceptable <- "Unacceptable Cold"
pmv_elevated_air[ppd >= -5 & ppd <= 5]$is_acceptable <- "Acceptable"ggplot() +
aes(pmv_elevated_air$pmv) +
geom_histogram(binwidth = 0.5, fill="black", col="grey") +
scale_x_continuous(breaks = seq(-5,5,0.5), lim = c(-5,5)) + theme_minimal() +
xlab("PMV") +
ylab("Number of Hours")