Learn R Programming

ie2misc (version 0.8.6)

sat_enthalpy: Saturated Enthalpy (H)

Description

sat_enthalpy and sat_enthalpy2 solve for the saturated enthalpy (H) given an elevation in feet and a range of temperature values (degrees F).

Usage

sat_enthalpy(
  file = tk_choose.files(default = "", caption = "Select file to open", multi = FALSE,
    filters = matrix(c("Comma-separated value file", ".csv", "MS Excel spreadsheet",
    ".xlsx", "MS Excel 97-2003 spreadsheet", ".xls"), 6, 2, byrow = TRUE)),
  sheet = 1,
  overwrite = TRUE,
  output = c("console", "csv", "xlsx")
)

sat_enthalpy2( file = NULL, sheet = 1, elevation = NULL, tbegin = NULL, tend = NULL, tincrement = NULL, overwrite = TRUE, output = c("console", "csv", "xlsx") )

Arguments

file

Input file (.xls, .xlsx, or .csv)

sheet

Sheet number or sheet name for the input file (default is sheet 1)

overwrite

If TRUE, overwrite any existing spreadsheet.

output

The output format of the resulting data.table (console, .csv, or .xlsx)

elevation

numeric vector that contains the location elevation in feet

tbegin

numeric vector that contains the beginning temperature in degrees F

tend

numeric vector that contains the ending temperature in degrees F

tincrement

numeric vector that contains the temperature increment in degrees F

Value

data.table with the output parameters displayed on the console or as a spreadsheet

Details

The sat_enthalpy function provides a file dialog for the user to choose the selected file.

The sat_enthalpy2 function either allows the user to provide the elevation and temperature values without a file or allows the user to provide a file without using a file dialog.

H is expressed as

$$H = \left(0.24 \times T\right) + \left[W \times \left(1061 + 0.444 \times T\right)\right]$$

H

enthalpy (Btu/lb)

T

dry-bulb temperature (degrees F)

W

specific humidity (lbwater / lbdry air)

where W or SH (Specific Humidity) is expressed as

$$W = \left(0.622 \times E\right)/\left(Mb - \left(0.378 \times E\right)\right)$$

W

W or SH -- Specific Humidity (kg/kg)

E

Vapor pressure in saturated air at this temperature (millibars)

Mb

Pressure (millibars)

References

  1. "Andrew Revering's List of Meteorological Formulas", http://www.aprweather.com/pages/calc.htm.

  2. Functional Testing and Design Guides, Functional Testing Guide: from the Fundamentals to the Field, "Sidebar 3: How to Calculate Enthalpy", https://web.archive.org/web/20150216015428/https://www.ftguide.org/ftg/IntegratedOperation/IOC-Sidebars-1-3/IOC-SB3-How-To-Calculate-Enthalpy.htm. Retrieved thanks to the Internet Archive: Wayback Machine

Examples

Run this code
# NOT RUN {
library("ie2misc")
# Example to check the input file format

# Copy and paste the following code into the R console if you
# wish to see the input file format.
library("openxlsx")
openXL(system.file("extdata", "Saturated_Enthalpy_Example_Input.xlsx",
package = "ie2misc"))
  # opens the workbook using the default spreadsheet application



# Examples to show different use cases

sat_enthalpy(output = "csv")
# The sheet number is 1 (default) and the output is csv


sat_enthalpy2(system.file("extdata", "Saturated_Enthalpy_Example_Input.xlsx"
, package = "ie2misc"), output = "xlsx")
# The sheet number is 1 (default) and the output is xlsx


sat_enthalpy2(system.file("extdata", "Saturated_Enthalpy_Example_Input.csv",
package = "ie2misc"), output = "console")
# The sheet number is 1 (default) and the output is the console


sat_enthalpy2(elevation = 1200, tbegin = 32, tend = 180,
tincrement = 0.01, output = "csv")
# elevation = 1200 feet, tbegin = 32 degrees F, tend = 180 degrees F,
# tincrement = 0.01 degrees F
# }
# NOT RUN {

# }

Run the code above in your browser using DataLab