extract_TK: Extract temperatures (in Kelvin) from heat types

View source: R/utilities.R

extract_TKR Documentation

Extract temperatures (in Kelvin) from heat types

Description

In societal exergy analysis, converting heat to exergy requires knowledge of the temperature of that heat. This function converts heat types (e.g., "HTH.600.C") to temperatures by extracting the temperature (in Kelvin) from the middle of the string.

Usage

extract_TK(heat_types, sep = ".")

Arguments

heat_types

a string vector of heat types to be converted to temperatures

sep

the separator between parts of the heat_types string. Default is ".".

Details

It is assumed that the heat type has the following structure:

  • a single letter (typically, "H", "M", or "L" for high, medium, or low, although the character doesn't matter)

  • the string "TH." or "TC." (for "temperature heating" or "temperature cooling"),

  • the temperature value, and

  • unit (one of ".C", ".F", ".R", or ".K", indicating ° Celsius, ° Fahrenheit, rankine, or kelvin, respectively).

If heat_type does not conform to the pattern shown above, NA is the likely result.

Value

a numeric vector of same length as heat_types containing temperatures in Kelvin.

Examples

extract_TK(c("HTH.600.C", "LTH.-20.567.C", "LTH.-40.F", "LTH.-40.C"))

MatthewHeun/IEATools documentation built on Feb. 6, 2024, 3:29 p.m.