run_idf {eplusr}R Documentation

Run simulations of EnergyPlus models.

Description

Run simulations of EnergyPlus models.

Usage

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
)

Arguments

model

A path (for run_idf()) or a vector of paths (for run_multi()) of EnergyPlus IDF or IMF files.

weather

A path (for run_idf()) or a vector of paths (for run_multi()) of EnergyPlus EPW weather files. If set to NULL, design-day-only simulation will be triggered, regardless of the design-day value. For run_multi(), weather can also be a single EPW file path. In this case, that weather will be used for all simulations; otherwise, model and weather should have the same length. You can set to design-day-only simulation to some specific simulations by setting the corresponding weather to NA.

output_dir

Output directory path (for rum_idf()) or paths (for run_mult()). If NULL, the directory of input model is used. For run_multi(), output_dir, if not NULL, should have the same length as model. Any duplicated combination of model and output_dir is prohibited.

design_day

Force design-day-only simulation. For rum_multi(), design_day can also be a logical vector which has the same length as model. Note that design_day and annual cannot be all TRUE at the same time. Default: FALSE.

annual

Force annual simulation. For rum_multi(), annual can also be a logical vector which has the same length as model. Note that design_day and annual cannot be all TRUE at the same time. Default: FALSE.

expand_obj

Whether to run ExpandObject preprocessor before simulation. Default: TRUE.

wait

If TRUE, R will hang on and wait all EnergyPlus simulations finish. If FALSE, all EnergyPlus simulations are run in the background, and a process object is returned.

echo

Only applicable when wait is TRUE. Whether to show standard output and error from EnergyPlus for run_idf() and simulation status for run_multi(). Default: TRUE.

eplus

An acceptable input (for run_idf()) or inputs (for run_multi()) of use_eplus() and eplus_config(). If NULL, which is the default, the version of EnergyPlus to use is determined by the version of input model. For run_multi(), eplus, if not NULL, should have the same length as model.

Details

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.

Value

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

Note

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.

Author(s)

Hongyuan Jia

References

Running EnergyPlus from Command Line (EnergyPlus GitHub Repository)

See Also

EplusJob class and ParametricJob class which provide a more friendly interface to run EnergyPlus simulations and collect outputs.

Examples

## 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)

[Package eplusr version 0.15.1 Index]