Skip to content

Instantly share code, notes, and snippets.

View hongyuanjia's full-sized avatar

Hongyuan Jia hongyuanjia

View GitHub Profile
@hongyuanjia
hongyuanjia / sch_year_from_csv.R
Last active March 15, 2022 13:44
Construct an EnregyPlus Schedule:Year object from multiple csv files
read_sch_data <- function(path) {
# read meta data
meta <- data.table::fread(path, nrows = 4)
# get the month number
month <- meta[V1 == "IMonth", as.integer(V2)]
# get the occu num
num <- meta[V1 == "OccuNum", as.integer(V2)]
@hongyuanjia
hongyuanjia / sch_day_list_from_csv.R
Created March 15, 2022 02:08
Construct an EnergyPlus `Schedule:Day:List` object using external CSV
library(eplusr)
# construct a fake schedule CSV file with 15 min interval and random values
interval <- 15
fake_data <- data.frame(
time = seq(
as.POSIXct("2020-03-15 00:15:00"),
by = "15 mins",
length.out = 24 * (60 / interval)
),
@hongyuanjia
hongyuanjia / init_stan_data.R
Last active March 9, 2022 14:21
Initialize input data for Stan
#' Initialize input data for Stan
#'
#' @param field A data.frame that contains field-measured data
#'
#' @param computed A data.frame that contains computed (simulated) data
#'
#' @param designed A data.frame that contains designed data for prediction.
#' Default is set to the same input as `computed.`
#'
#' @param inputs,outputs,params One or more unquoted expressions separated by
@hongyuanjia
hongyuanjia / epw-eplus-amy-leapyear.R
Created March 14, 2021 18:32
Test how AMY and leap year related things in EPW and IDF interact
library(eplusr)
library(purrr)
library(data.table)
library(lubridate)
create_idf <- function (ver = 8.9, realyear = FALSE, year = NULL, day_of_week = NULL) {
path <- file.path(eplus_config(ver)$dir, "ExampleFiles", "5Zone_Transformer.idf")
idf <- read_idf(path)
idf$Output_Variable <- NULL
@hongyuanjia
hongyuanjia / test-leap-year.R
Created May 8, 2019 17:51
Test how EnergyPlus handle leap year with AMY data in different versions
library(eplusr)
library(purrr)
library(data.table)
library(lubridate)
example_idf <- function (ver) {
file.path(eplus_config(ver)$dir, "ExampleFiles", "5Zone_Transformer.idf")
}
example_epw <- function(ver) {
@hongyuanjia
hongyuanjia / _Nvim-R-Tmux.md
Created April 7, 2019 16:06 — forked from tgirke/_Nvim-R-Tmux.md
Nvim-R-Tmux: An Integrated Working Environment for R
@hongyuanjia
hongyuanjia / aria2.bat
Created February 27, 2018 02:31 — forked from Rhilip/aria2.bat
Aria2的配置文件 & 启动脚本
:: 启动后需要保留窗口, 关闭窗口则结束进程
aria2c --conf-path=aria2.conf -D