In this calibration, we use the U.S. Department of Energy (DOE) medium office reference building model in compliance with Standard ASHRAE 90.1 – 2004.
# path of the model
path <- here("data-raw/idf/RefBldgMediumOfficeNew2004_Chicago.idf")
# read model
model <- read_idf(path)
# open a viewer to show 3D building geometry
viewer <- model$view(x_ray = TRUE)
# save a snapshot of current view
snap <- viewer$snapshot(here("figures/3d.png"))
# close the viewer
viewer$close()
Fig. 1.1 shows a 3D view of the building geometry. It is a 3-story, 15-zone medium office building with a total floor area of 4982 m^2. A central packaged air conditioning unit with a gas furnace is equipped on each story. The air distribution systems are Variable Air Volume (VAV) terminal boxes with electric reheating coils.
knitr::include_graphics(here("figures/3d.png"))
Figure 1.1: 3D view of the medium office reference building model
The model was built for Chicago, U.S. Since we did not have measured weather data for Chicago, we deciaded to use our Philadelphia 2014 AMY (Actual Meteorological Year) weather file for the synthetic meter data.
For observed output, we choose hourly building electricity consumption. The
corresponding output variable in EnergyPlus is Electricity:Facility
with
Hourly
reporting frequency.
Below we made some necessary to the model, including adding the output meter and
setting the begin year of RunPeriod
objects based on our AMY weather data. We
saved the modifed model as Synthetic.idf
in the data/idf
folder.
# remove all existing outputs
model$`Output:Variable` <- NULL
model$`Output:Meter` <- NULL
# add hourly building electricity output meter
model$add(Output_Meter = list("Electricity:Facility", "Hourly"))
# make sure weater file is used
model$SimulationControl$Run_Simulation_for_Weather_File_Run_Periods <- "Yes"
# update RunPeriod to correctly indicate an AMY EPW file is used
model$RunPeriod$annual$set(
name = "Philadelphia 2014",
begin_year = 2014,
day_of_week_for_start_day = "Wednesday"
)
# save the model
model$save(here("data/idf/Synthetic.idf"), overwrite = TRUE)
Next, we run the model using AMY EPW file to create synthetic observed output. The data will present noise-free measurements which functions as a surrogate for clean sensor data.
Below we ran an annual simulation using the AMY EPW stored in
data-raw/epw/AMY
folder.
# path of AMY EPW
path_epw_amy <- here("data-raw/epw/AMY/PA_PHILADELPHIA_720304_14-13.epw")
# run annual simulation for AMY
model$run(path_epw_amy, here("data/sim/Synthetic"), echo = FALSE)
Once the simulation completed, we extracted the output using $report_data()
method, convert the unit of electricity from Joules to kWh and save the values
together with the timestamp to a csv file named synthetic_meter.csv
in the
data
folder.
synthetic_meter <- model %>% extract_electricity()
# save synthetic meter data
write_csv(synthetic_meter, here("data/synthetic_meter.csv"))
sessionInfo()
## R version 4.1.0 (2021-05-18)
## Platform: x86_64-w64-mingw32/x64 (64-bit)
## Running under: Windows 10 x64 (build 19042)
##
## Matrix products: default
##
## locale:
## [1] LC_COLLATE=English_United States.1252
## [2] LC_CTYPE=English_United States.1252
## [3] LC_MONETARY=English_United States.1252
## [4] LC_NUMERIC=C
## [5] LC_TIME=English_United States.1252
## system code page: 936
##
## attached base packages:
## [1] stats graphics grDevices utils datasets methods base
##
## other attached packages:
## [1] here_1.0.1 eplusr_0.14.2 forcats_0.5.1 stringr_1.4.0
## [5] dplyr_1.0.5 purrr_0.3.4 readr_1.4.0 tidyr_1.1.3
## [9] tibble_3.1.0 ggplot2_3.3.3 tidyverse_1.3.0
##
## loaded via a namespace (and not attached):
## [1] Rcpp_1.0.6 lubridate_1.7.10 prettyunits_1.1.1 ps_1.6.0
## [5] rprojroot_2.0.2 assertthat_0.2.1 digest_0.6.27 utf8_1.2.1
## [9] R6_2.5.0 cellranger_1.1.0 backports_1.2.1 reprex_1.0.0
## [13] RSQLite_2.2.4 evaluate_0.14 highr_0.8 httr_1.4.2
## [17] pillar_1.5.1 progress_1.2.2 rlang_0.4.10 readxl_1.3.1
## [21] data.table_1.14.0 rstudioapi_0.13 callr_3.5.1 blob_1.2.1
## [25] checkmate_2.0.0 rmarkdown_2.7 bit_4.0.4 munsell_0.5.0
## [29] broom_0.7.5 compiler_4.1.0 modelr_0.1.8 xfun_0.21
## [33] pkgconfig_2.0.3 htmltools_0.5.1.1 tidyselect_1.1.0 bookdown_0.21
## [37] fansi_0.4.2 crayon_1.4.1 dbplyr_2.1.0 withr_2.4.1
## [41] grid_4.1.0 jsonlite_1.7.2 gtable_0.3.0 lifecycle_1.0.0
## [45] DBI_1.1.1 magrittr_2.0.1 units_0.7-1 scales_1.1.1
## [49] cli_2.3.1 stringi_1.5.3 cachem_1.0.4 fs_1.5.0
## [53] xml2_1.3.2 ellipsis_0.3.1 generics_0.1.0 vctrs_0.3.6
## [57] tools_4.1.0 bit64_4.0.5 glue_1.4.2 hms_1.0.0
## [61] processx_3.5.0 fastmap_1.1.0 yaml_2.2.1 colorspace_2.0-0
## [65] rvest_1.0.0 memoise_2.0.0 knitr_1.31 haven_2.3.1