run_idf | R Documentation |
Run simulations of EnergyPlus models.
run_idf(
model,
weather,
output_dir,
design_day = FALSE,
annual = FALSE,
expand_obj = TRUE,
wait = TRUE,
echo = TRUE,
eplus = NULL
)
run_multi(
model,
weather,
output_dir,
design_day = FALSE,
annual = FALSE,
expand_obj = TRUE,
wait = TRUE,
echo = TRUE,
eplus = NULL
)
model |
A path (for |
weather |
A path (for |
output_dir |
Output directory path (for |
design_day |
Force design-day-only simulation. For |
annual |
Force annual simulation. For |
expand_obj |
Whether to run ExpandObject preprocessor before simulation. Default: TRUE. |
wait |
If |
echo |
Only applicable when |
eplus |
An acceptable input (for |
run_idf()
is a wrapper of EnergyPlus itself, plus various pre-processors
and post-processors which enables to run EnergyPlus model with different
options.
run_multi()
provides the functionality of running multiple models in
parallel.
It is suggested to run simulations using EplusJob class and EplusGroupJob class, which provide much more detailed controls on the simulation and also methods to extract simulation outputs.
For run_idf()
, if wait
is TRUE
, a named list of 11 elements:
No. | Column | Type | Description |
1 | idf | character(1) | Full path of input IDF file |
2 | epw | character(1) or NULL | Full path of input EPW file |
3 | version | character(1) | Version of called EnergyPlus |
4 | exit_status | integer(1) or NULL | Exit status of EnergyPlus. NULL if terminated or wait is FALSE |
5 | start_time | POSIXct(1) | Start of time of simulation |
6 | end_time | POSIXct(1) or NULL | End of time of simulation. NULL if wait is FALSE |
7 | output_dir | character(1) | Full path of simulation output directory |
8 | energyplus | character(1) | Full path of called EnergyPlus executable |
9 | stdout | character(1) or NULL | Standard output of EnergyPlus during simulation |
10 | stderr | character(1) or NULL | Standard error of EnergyPlus during simulation |
11 | process | r_process | A process object which called EnergyPlus and ran the simulation |
If wait
is FALSE
, the R process is directly returned.
You can get the results by calling result <- proc$get_result()
(proc
is
the returned process). Please note that in this case, result$process
will
alwasy be NULL
. But you can easily assign it by running result$process <- proc
For rum_multi()
, if wait
is TRUE, a
data.table of 12 columns:
No. | Column | Type | Description |
1 | index | integer | Index of simulation |
2 | status | character | Simulation status |
3 | idf | character | Full path of input IDF file |
4 | epw | character | Full path of input EPW file. NA for design-day-only simulation |
5 | version | character | Version of EnergyPlus |
6 | exit_status | integer | Exit status of EnergyPlus. NA if terminated |
7 | start_time | POSIXct | Start of time of simulation |
8 | end_time | POSIXct | End of time of simulation. |
9 | output_dir | character | Full path of simulation output directory |
10 | energyplus | character | Full path of called EnergyPlus executable |
11 | stdout | list | Standard output of EnergyPlus during simulation |
12 | stderr | list | Standard error of EnergyPlus during simulation |
For column status
, there are 4 possible values:
"completed"
: the simulation job is completed successfully
"failed"
: the simulation job ended with error
"terminated"
: the simulation job started but was terminated
"cancelled"
: the simulation job was cancelled, i.e. did not start at all
For run_multi()
, if wait
is FALSE
, a r_process
object of background R process which handles all simulation jobs is
returned. You can check if the jobs are completed using $is_alive()
and
get the final data.table using $get_result()
method.
If your input model has external file dependencies, e.g. FMU, schedule files,
etc. run_idf()
and run_multi()
will not work if the output directory is
different that where the input mode lives. If this is the case, parse the
model using read_idf()
and use Idf$run() or eplus_job()
instead.
They are able to automatically change the paths of external files to absolute
paths or copy them into the output directory, based on your choice.
Hongyuan Jia
Running EnergyPlus from Command Line (EnergyPlus GitHub Repository)
EplusJob class and ParametricJob class which provide a more friendly interface to run EnergyPlus simulations and collect outputs.
## Not run:
idf_path <- system.file("extdata/1ZoneUncontrolled.idf", package = "eplusr")
if (is_avail_eplus("8.8")) {
# run a single model
epw_path <- file.path(
eplus_config("8.8")$dir,
"WeatherData",
"USA_CA_San.Francisco.Intl.AP.724940_TMY3.epw"
)
run_idf(idf_path, epw_path, output_dir = tempdir())
# run multiple model in parallel
idf_paths <- file.path(eplus_config("8.8")$dir, "ExampleFiles",
c("1ZoneUncontrolled.idf", "1ZoneUncontrolledFourAlgorithms.idf")
)
epw_paths <- rep(epw_path, times = 2L)
output_dirs <- file.path(tempdir(), tools::file_path_sans_ext(basename(idf_paths)))
run_multi(idf_paths, epw_paths, output_dir = output_dirs)
}
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.