knitr::opts_chunk$set( collapse = TRUE, comment = "#>" ) library(dplyr) library(IEATools)
\newcommand{\transpose}[1]{#1^\mathrm{T}} \newcommand{\inverse}[1]{#1^{\mathrm{-}1}} \newcommand{\mat}[1]{\mathbf{#1}} \newcommand{\colvec}[1]{\mathbf{#1}} \newcommand{\rowvec}[1]{\transpose{\colvec{#1}}} \newcommand{\inversetranspose}[1]{\transpose{\left( \inverse{\mat{#1}} \right)}} \newcommand{\transposeinverse}[1]{\inverse{\left( \transpose{\mat{#1}} \right)}} \newcommand{\hatinv}[1]{\inverse{\widehat{#1}}}
Extended energy balance data from the International Energy Agency (IEA) provides both primary and final energy information. (Primary energy is extracted from the biosphere, and final energy is sold to consumers.) But consumers don't buy final energy for its own sake. They buy final energy so they can convert it to useful energy (heat, light, work) that, when combined with infrastructure (buildings, roads, etc.), provides energy services (heated and cooled space, passenger and freight transport, etc.).
So some energy conversion chain analyses extend the final energy provided by the IEA to useful energy through a process that involves
(a) allocating final energy to final-to-useful energy conversion machines, (b) defining the efficiency of those final-to-useful energy conversion machines, and (c) calculating the useful energy injected into the the final demand economic sectors.
The IEATools
package provides several functions to assist the process of pushing
from final energy to useful energy.
This vignette demonstrates their use
and suggests a workflow for this process.
Extending the IEA's extended energy balance data to the useful stage begins with defining allocations of final energy carriers to final-to-useful energy conversion machines. To demonstrate this process, we'll use the sample IEA data bundled with this package.
library(dplyr) library(IEATools) Tidy_iea_data <- load_tidy_iea_df() %>% specify_all() %>% glimpse()
The next step is to develop a blank template in which the analyst
can provide final-to-useful allocation values (C
) in percentages.
fu_allocation_template()
builds a final-to-useful allocation template.
FU_allocation_template <- load_tidy_iea_df() %>% specify_all() %>% fu_allocation_template() FU_allocation_template %>% glimpse()
To obtain a nicely-formatted Excel spreadsheet, use the
write_fu_allocation_template()
function.
# FU_allocation_template %>% # write_fu_allocation_template("~/Desktop/Test_FU_allocation_template.xlsx")
The analyst should complete all of the unshaded cells in the Machine
and Eu.product
columns.
Machine
should contain names of final-to-useful machines such as "Automobiles," "Industrial heat/furnace," etc.
Eu.product
should be filled with names of useful energy carriers such as "HTH.600.C", "MD", or "Light".
Note that later processing will parse the heat categories for their temperature, and the required format is *TH.nnn.U
, where
*
(the first character) is arbitrary,
but H
, M
, and L
are typical for high, medium, and low temperature heat, respectively,TH.
is required,nnn
can be any number of digits, optionally preceded by a negative sign, .
is required, andU
is the temperature unit, one of C
, F
, R
, or K
for degrees Celsius, degrees Fahrenheit,
rankine, or kelvin, respectively.The C
rows representation allocations of E.dot
energy to final-to-useful machines for each year of available IEA data.
Three allocation rows (C_1 [%]
, C_2 [%]
, and C_3 [%]
) are provided for each combination
of Flow.aggregation.point
, Ef.product
, and Destination
.
Not all C_i [%]
rows need to be filled,
and the analyst can add more allocation rows (C_4 [%]
, C_5 [%]
, ...) as required.
The rows are in IEA order for Flow.aggregation.point
, Ef.product
, and Destination
.
The Maximum.values
column provides an indication of which Destination
s receive more energy than others,
allowing the analyst to focus more attention on larger energy flows, as desired.
After completing the final-to-useful allocation table,
the analyst must specify the efficiencies of the final-to-useful machines.
To assist with this task, the eta_fu_template()
function can be invoked.
To demonstrate, we'll use load_fu_allocation_data()
,
a function that reads a completed allocation table out of an excel file.
The default path
argument of load_fu_allocation_data()
points to a completed final-to-useful allocation table
that is provided with IEATools
.
Eta_fu_template <- load_fu_allocation_data() %>% eta_fu_template() Eta_fu_template %>% glimpse()
To obtain a nicely-formatted Excel spreadsheet, use the
write_fu_allocation_template()
function.
# Eta_fu_template %>% # write_eta_fu_template("~/Desktop/Test_eta_fu_template.xlsx")
The analyst should fill all unshaded cells in eta.fu
rows with
final-to-useful energy efficiency values (in %).
phi.u
rows should be completed with exergy-to-energy ratios for the useful stage energy carrier.
Note that many phi.u
values are already filled for cases where the
phi value is known or easily calculable,
specifically mechanical drive (phi = 1) and heat (phi = 1 - T_0/T_H, where T_H is the heat temperature
embedded in the *TH.nnn.U
useful exergy string).
The Maximum.values
column provides an indication of which Destination
s receive more energy than others,
allowing the analyst to focus more attention on larger energy flows, as desired.
The E.dot_machine
and E.dot_machine [%]
rows indicate energy flows and percentages
into each final-to-useful machine in each year.
After allocations and efficiencies are specified (by completing the templates), functions can be used to move the last stage of an energy conversion chain from final energy to useful energy.
Next, the C
values from the allocation table must be arranged into $\mat{C}$ matrices
using the form_C_mats()
function.
C_mats <- load_fu_allocation_data() %>% form_C_mats() glimpse(C_mats)
Note that two types of $\mat{C}$ matrices are formed, $\mat{C}_{EIOU}$ and $\mat{C}_Y$. Both are needed later.
Next, vectors containing final-to-useful energy efficiencies ($\colvec{\eta}_{fu}$) and
exergy-to-energy ratios ($\colvec{\phi}$) must be formed
using the form_eta_fu_phi_u_vecs()
function.
eta_fu_vecs <- load_eta_fu_data() %>% form_eta_fu_phi_u_vecs() glimpse(eta_fu_vecs)
To extend an energy conversion chain (ECC) to the useful stage, first convert the IEA data into physical supply-use table format with final energy being the last stage of the energy conversion chain. Thereafter, join the $\mat{C}$ matrices and $\colvec{\eta_{fu}}$ vectors to the data frame of PSUT matrices.
# Get a list of the metadata columns. # This list will be the same for C_mats. m_cols <- eta_fu_vecs %>% meta_cols(return_names = TRUE, years_to_keep = IEATools::iea_cols$year, not_meta = c(IEATools::template_cols$eta_fu, IEATools::template_cols$phi_u)) m_cols psut_mats_final <- load_tidy_iea_df() %>% specify_all() %>% prep_psut() %>% dplyr::full_join(C_mats, by = m_cols) %>% dplyr::full_join(eta_fu_vecs, by = m_cols) glimpse(psut_mats_final)
Then use the allocation and efficiency matrices to extend to the useful stage
with the extend_to_useful()
function.
psut_mats_useful <- psut_mats_final %>% extend_to_useful() psut_mats_useful <- stack_final_useful_df(psut_mats_useful, psut_mats_final) glimpse(psut_mats_useful)
Notice that several additional rows have been created in the data frame. The additional rows contain versions of ECC matrices wherein the last stage of the ECC is useful energy. Extending to the useful stage means many additional energy products are included in the energy conversion chain. For example, the $\mat{Y}$ matrix includes additional rows for mechanical drive (MD), heat (MTH.100.C, e.g.), and light.
# A Y matrix where final energy is the last stage of the energy conversion chain rownames(psut_mats_useful$Y[[1]]) # A Y matrix where useful energy is the last stage of the energy conversion chain rownames(psut_mats_useful$Y[[5]])
The process of moving from final energy to useful energy as the last stage of an energy conversion chain
is aided by several functions in the IEATools
package.
In particular,
prep_psut()
,form_C_mats()
,form_eta_fu_phi_u_vecs()
, andextend_to_useful()
provide a convenient workflow for that process.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.