Extract temperatures (in Kelvin) from heat types
extract_TK.Rd
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.
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.
Examples
extract_TK(c("HTH.600.C", "LTH.-20.567.C", "LTH.-40.F", "LTH.-40.C"))
#> [1] 873.150 252.583 233.150 233.150