Skip to contents

Calculate the total energy supply (TES) in primary energy terms. This metric was formerly called the total primary energy supply (TPES). This function first uses the uses Recca::find_p_industry_names() function, with a user-supplied set of primary industry prefixes p_industry_prefixes to identify the primary industries desired for analysis. The Recca::primary_aggregates() function is then applied to .sutdata data frame by total, to calculate the total energy supply across all products and flows.

Usage

calculate_p_ex_total(
  .sutdata,
  p_industry_prefixes,
  country_colname = IEATools::iea_cols$country,
  method_colname = IEATools::iea_cols$method,
  energy_type_colname = IEATools::iea_cols$energy_type,
  year_colname = IEATools::iea_cols$year,
  flow_colname = PFUWorkflow::sea_cols$flow_colname,
  e_product_colname = PFUWorkflow::sea_cols$e_product_colname,
  stage_colname = PFUWorkflow::sea_cols$stage_colname,
  gross_net_colname = PFUWorkflow::sea_cols$gross_net_colname,
  agg_by_colname = PFUWorkflow::sea_cols$agg_by_colname,
  p_ind_comp_colname = PFUWorkflow::sea_cols$p_ind_comp_colname,
  p_ind_prefix_colname = PFUWorkflow::sea_cols$p_ind_prefix_colname,
  ex_colname = PFUWorkflow::sea_cols$ex_colname,
  ex_p_colname = PFUWorkflow::sea_cols$ex_p_colname,
  primary_value = IEATools::all_stages$primary,
  all_value = PFUWorkflow::agg_metadata$all_value,
  total_value = PFUWorkflow::agg_metadata$total_value
)

Arguments

.sutdata

A data frame containing Physical Supply-Use Table (PSUT) matrices.

p_industry_prefixes

A character vector of primary energy industry prefixes. Usually "Resources", "Imports", and "Stock changes".

country_colname, method_colname, energy_type_colname, year_colname

See IEATools::iea_cols.

flow_colname, e_product_colname, stage_colname, gross_net_colname, agg_by_colname, p_ind_comp_colname, p_ind_prefix_colname, ex_colname, ex_p_colname

See PFUWorkflow::sea_cols.

primary_value

The string "Primary", representing the Primary stage of the energy conversion chain, see IEATools::all_stages.

all_value, total_value

See PFUWorkflow::agg_metadata.

Value

A data frame containing aggregate primary energy/exergy data by total (total energy supply (TES))

Examples

library(Recca)
total_energy_supply <- Recca::UKEnergy2000mats %>%
                         tidyr::pivot_wider(names_from = matrix.name,
                                            values_from = matrix) %>%
                         dplyr::mutate(Method = "PCM") %>%
                         calculate_p_ex_total(p_industry_prefixes = list(c("Resources", "Imports")))