rdd_to_load {eplusr} | R Documentation |
Format RddFile Object to Standard Input for Idf$load()
Method
Description
rdd_to_load()
and mdd_to_load()
takes a RddFile
and MddFile
object
respectively and format it into a data.table in
acceptable format for $load()
method in Idf class.
Usage
rdd_to_load(rdd, key_value, reporting_frequency)
mdd_to_load(
mdd,
reporting_frequency,
class = c("Output:Meter", "Output:Meter:MeterFileOnly", "Output:Meter:Cumulative",
"Output:Meter:Cumulative:MeterFileOnly")
)
Arguments
rdd , mdd |
A |
key_value |
Key value name for all variables. If not specified and
the |
reporting_frequency |
Variable value reporting frequency for all
variables. If not specified and the |
class |
Class name for meter output. All possible values:
|
Value
A data.table with 5 columns with an additional
attribute named eplus_version
extracted from the original RddFile
and
MddFile
:
-
id
: Integer type. Used to distinguish each object definition. -
class
: Character type. Class names, e.g.Output:Variable
andOutput:Meter
. -
index
: Integer type. Field indices. -
field
: Character type. Field names. -
value
: Character type. The value of each field to be added.
Examples
## Not run:
# read an example distributed with eplusr
path_idf <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr")
idf <- read_idf(path_idf)
# run Design-Day-Only simulation silently
job <- idf$run(NULL, tempdir(), echo = FALSE)
# read RDD and MDD
rdd <- job$read_rdd()
mdd <- job$read_mdd()
# perform subsetting on the variables
# e.g.:
rdd_sub <- rdd[grepl("Site", variable)]
mdd_sub <- mdd[grepl("Electricity", variable)]
# use newly added helper `rdd_to_load()` and `mdd_to_load()` and `$load()` to
# add `Output:Variable` and `Output:Meter*`
idf$load(rdd_to_load(rdd_sub))
idf$load(mdd_to_load(mdd_sub))
# default `Key Value` is `"*"` and `Reporting Frequency` is `Timestep`
# can overwrite using `key_value` and `reporting_freqency` arg
rdd_to_load(rdd_sub, key_value = "Environment", reporting_frequency = "hourly")
# if input has column `key_value`, default is to use it, unless `key_value` is
# explicitly specified
rdd_to_load(rdd_sub[, key_value := "Environment"])
rdd_to_load(rdd_sub[, key_value := "Environment"], key_value = "*")
# `reporting_frequency` arg works in the same way as `key_value` arg, i.e.:
# if input has column `reporting_frequency`, use it, unless
# `reporting_frequency` is explicitly specified
rdd_to_load(rdd_sub[, reporting_frequency := "monthly"])
rdd_to_load(rdd_sub[, reporting_frequency := "monthly"], reporting_frequency = "detailed")
# if input has column `key_value`, default is to use it, unless `key_value` is
# explicitly specified
rdd_to_load(rdd_sub[, key_value := "Environment"])
rdd_to_load(rdd_sub[, key_value := "Environment"], key_value = "*")
# meter class can be further specified using `class` arg
mdd_to_load(mdd_sub, class = "Output:Meter:MeterFileOnly")
## End(Not run)