Learn R Programming

eplusr (version 0.8.3)

job: Run EnergyPlus Simulation and Collect Outputs

Description

EplusJob class wraps the EnergyPlus command line interface and provides methods to extract simulation outputs.

Arguments

Usage

job$run(wait = TRUE)
job$kill()
job$status()
job$errors(info = FALSE)
job$output_dir(open = FALSE)
job$locate_output(suffix = ".err", strict = TRUE)
job$report_data_dict()
job$report_data(key_value = NULL, name = NULL, year = NULL, tz = "GMT", case = "auto")
job$tabular_data()
job$print()

Create

job <- eplus_job(idf, epw)

Arguments

  • idf: Path to EnergyPlus IDF or IMF file or an Idf object.

  • epw: Path to EnergyPlus EPW file or an Epw object.

Run

job$run(wait = TRUE)
job$kill()
job$status()

$run() runs the simulation using input model and weather file.

$kill() kills the background EnergyPlus process if possible. It only works when simulation runs in waiting mode.

$status() returns a named list of values indicates the status of the job:

  • run_before: TRUE if the job has been run before.

  • changed_after: TRUE if the IDF file has been changed since last simulation.

  • terminated: TRUE if the simulation was terminated during last simulation.

  • successful: TRUE if last simulation ended successfully.

  • alive: TRUE if the simulation is still running in the background.

  • wait: TRUE if the simulation was run in waiting mode last time.

Arguments

  • echo: Only applicable to run_idf. Show EnergyPlus simulation process information to the console. If FALSE, which is default, a processx::process object will be return.

  • wait: If TRUE, R will hang on and wait for the simulation to complete. Output from EnergyPlus command line interface will be printed into the console as well. If FALSE, simulation will be run in a background process. Default: TRUE.

Results Extraction

job$output_dir(open = FALSE)
job$locate_output(suffix = ".err", strict = TRUE)
job$report_data_dict()
job$report_data(key_value = NULL, name = NULL, year = NULL, tz = "GMT", case = "auto")
job$tabular_data()

$output_dir() returns the output directory of simulation results.

$locate_output() returns the path of a single output file specified by file suffix.

$report_data_dict() returns a data.table which contains all information about report data. For details on the meaning of each columns, please see "2.20.2.1 ReportDataDictionary Table" in EnergyPlus "Output Details and Examples" documentation.

$report_data() extracts the report data using key values and variable names.

$tabular_data() extracts all tabular data.

Arguments:

  • open: If TRUE, the output directory will be opened. It may only work well on Windows.

  • suffix: A string that indicates the file suffix of simulation output. Default: ".err".

  • strict: If TRUE, it will check if the simulation was terminated, is still running or the file exists or not. Default: TRUE.

  • key_value: A character vector to identify key name of the data. If NULL, all keys of that variable will be returned. Default: NULL.

  • name: A character vector to specify the actual data name. If NULL, all variables will be returned. Default: NULL.

  • year: The year of the date and time in column DateTime. If NULL, it will be the current year. Default: NULL

  • tz: Time zone of date and time in column DateTime. Default: "GMT".

  • case: If not NULL, a character column will be added indicates the case of this simulation. If "auto", the name of the IDF file will be used.

Details

eplusr uses the EnergyPlus SQL output for extracting simulation outputs. In order to do so, a object in Output:SQLite with Option Type value of SimpleAndTabular will be automatically created if it does not exists. EplusJob has provide some wrappers that do SQL query to get report data results, i.e. results from Output:Variable and Output:Meter*. But for Output:Table results, you have to be familiar with the structure of the EnergyPlus SQL results, especially for table "TabularDataWithStrings". For details, please see "2.20 eplusout.sql", especially "2.20.4.4 TabularData Table" in EnergyPlus "Output Details and Examples" documentation.

See Also

ParametricJob class for EnergyPlus parametric simulations.