Learn R Programming

eplusr (version 0.8.3)

epw: Read, and modify an EnergyPlus Weather File (EPW)

Description

Reading an EPW file starts with function read_epw(), which parses an EPW file and returns an Epw object. The parsing process is extremely inspired by OpenStudio utilities library with some simplifications.

Arguments

Usage

epw <- read_epw(path)
epw$city
epw$city <- "city"
epw$state_province
epw$state_province <- "state_province"
epw$country
epw$country <- "country"
epw$data_source
epw$data_source <- "data_source"
epw$wmo_number
epw$wmo_number <- "wmo_number"
epw$latitude
epw$latitude <- "latitude"
epw$longitute
epw$longitute <- "longitute"
epw$time_zone
epw$time_zone <- "time_zone"
epw$elevation
epw$elevation <- "elevation"
epw$time_step
epw$time_step <- "time_step"
epw$start_day_of_week
epw$start_day_of_week <- "start_day_of_week"
epw$path()
epw$get_data(year = NULL, unit = FALSE, tz = Sys.timezone(), update = FALSE)
epw$set_data(data)
epw$save(path, overwrite = FALSE)
epw$print()
print(epw)

Read

epw <- read_epw(path)

Arguments

  • path: Path of an EnergyPlus EPW file.

epw$save(path, overwrite = FALSE)

Arguments

  • path: A path where to save the weather file. If NULL, the path of the weather file itself will be used. Default: NULL.

  • overwrite: Whether to overwrite the file if it already exists. Default is FALSE.

Query and Modify Header

epw$city
epw$city <- "city"
epw$state_province
epw$state_province <- "state_province"
epw$country
epw$country <- "country"
epw$data_source
epw$data_source <- "data_source"
epw$wmo_number
epw$wmo_number <- "wmo_number"
epw$latitude
epw$latitude <- "latitude"
epw$longitute
epw$longitute <- "longitute"
epw$time_zone
epw$time_zone <- "time_zone"
epw$elevation
epw$elevation <- "elevation"
epw$time_step
epw$time_step <- "time_step"
epw$start_day_of_week
epw$start_day_of_week <- "start_day_of_week"

$city, $state_province, $country, $data_source, $wmo_number, $latitude, $longitute, $time_zone, $elevation, $time_step and $start_day_of_week are all active bindings, which means that you can get the value and also set new value to it.

Query and Modify Data

epw$path()
epw$get_data(year = NULL, unit = FALSE, tz = Sys.timezone(), update = FALSE)
epw$set_data(data)

$path() returns the path of EPW file.

$get_data() returns the core weather data.

$set_data() replaces core weather data with input data. NOTE: This feature is experimental. There is no validation when replacing.

NOTE: Even though Epw class provides methods to replace core weather data, it is still not recommended.

Arguments

  • year: A integer to indicate the year value in the return datetime column. If NULL, the year will be left as it is in EPW file.

  • tz: The time zone of Date and Time in datetime column.

  • unit: If TRUE, units will be set to all numeric columns using units::set_units().

  • update: If TRUE, not only datetime column, but also year, month, day, hour and minute will also be updated according to the input year value.

  • data: A data.frame which has all required columns.

Details

An EPW file can be divided into two parts, headers and weather data. The first eight lines of a standard EPW file are normally headers which contains data of location, design conditions, typical/extreme periods, ground temperatures, holidays/daylight savings, data periods and other comments. For now, eplusr only parses headers of location, holidays/daylight savings and data periods. All other headers will be left as they were when parsing and saving. For details on the data structure of EPW file, please see "Chapter 2 - Weather Converter Program" in EnergyPlus "Auxiliary Programs" documentation. An online version can be found here.

There are about 35 variables in the core weather data. However, not all of them are used by EnergyPlus. Actually, despite of date and time columns, only 14 columns are used:

  1. dry bulb temperature

  2. dew point temperature

  3. relative humidity

  4. atmospheric pressure

  5. horizontal infrared radiation intensity from sky

  6. direct normal radiation

  7. diffuse horizontal radiation

  8. wind direction

  9. wind speed

  10. present weather observation

  11. present weather codes

  12. snow depth

  13. liquid precipitation depth

  14. liquid precipitation rate