erdl / thermal_comfort

Algorithms for Thermal Comfort Prediction using PMV and Adaptive Method.
2 stars 1 forks source link

Create Adaptive Comfort Model Script #5

Closed carlosparadis closed 6 years ago

carlosparadis commented 6 years ago

Input Table

outdoor_temperature_f rolling_temperature_f in_air_temperature_f in_in_air_speed_fpm
70 80 73 10

Output Table

outdoor_temperature_f rolling_temperature_f in_air_temperature_f in_in_air_speed_fpm adaptive_80 degrees_off
70 80 73 10 Acceptable 5
20 25 73 10 Unacceptable 20
100 110 73 10 Unacceptable 20

Code Logic


# Define air speed adjustment for the comfort model
air_speed_adjustment <- function(in_in_air_speed_fpm){
    return(0.0153*in_in_air_speed_fpm+0.4333)
}

# Define bounds
upper_bound <- 0.31*rolling_temperature_f + 60.5 + air_speed_adjustment(in_in_air_speed_fpm)
lower_bound <- 0.31*rolling_temperature_f + 47.9 + air_speed_adjustment(in_in_air_speed_fpm)

# Calculate Acceptance and Degrees Off
acceptance <- NA
degrees_off <- NA
if (in_air_temperature_f > upper_bound){
    acceptance <- "Unacceptable"
    degrees_off <- in_air_temperature_f - upper_bound
}else if(in_air_temperature_f < lower_bound){
    acceptance <- "Unacceptable"
    degrees_off <- lower_bound - in_air_temperature_f
}else{
    acceptance <- "Acceptable"
    degrees_off <- 0
}

p.s.: Do not use the examples above to validate the script. This is just to remember the data format.

carlosparadis commented 6 years ago

@kathrynparadis Start here. The code is logic is in the issue. Copy and paste to the R script, and simply add the acceptance and degree_off variables to the main dataframe column. This should take you just another 2 lines.

Continue discussion on this issue here. Don't send it via e-mail or slack, please.

@eileenpeppard Let us know if these column names are OK.

carlosparadis commented 6 years ago

Some assumptions were changed as input and output of the model. Please see the notebook for details.