calculate_fu_ex_total: Calculate total final consumption of final and useful energy

View source: R/tes_tfc_functions.R

calculate_fu_ex_totalR Documentation

Calculate total final consumption of final and useful energy

Description

Calculate the total final consumption (TFC) at the final and useful stages (along with any additional stages). This function first uses the uses create_fd_sectors_list() function, with a user-supplied set of final demand sectors fd_sectors to identify the final demand sectors desired for analysis. The Recca::finaldemand_aggregates() function is then applied to .sutdata data frame, to calculate the total final consumption across all products and sectors.

Usage

calculate_fu_ex_total(
  .sutdata,
  fd_sectors,
  country_colname = IEATools::iea_cols$country,
  method_colname = IEATools::iea_cols$method,
  energy_type_colname = IEATools::iea_cols$energy_type,
  last_stage_colname = IEATools::iea_cols$last_stage,
  year_colname = IEATools::iea_cols$year,
  sector_colname = PFUWorkflow::sea_cols$sector_colname,
  fd_sectors_colname = PFUWorkflow::sea_cols$fd_sectors_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,
  ex_colname = PFUWorkflow::sea_cols$ex_colname,
  ex_net_colname = PFUWorkflow::sea_cols$ex_net_colname,
  ex_gross_colname = PFUWorkflow::sea_cols$ex_gross_colname,
  net_value = PFUWorkflow::gross_net_metadata$net_value,
  gross_value = PFUWorkflow::gross_net_metadata$gross_value,
  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 with associated final demand sector names

fd_sectors

A character vector of final demand sectors.

country_colname, method_colname, energy_type_colname, last_stage_colname, year_colname

See IEATools::iea_cols.

sector_colname, fd_sectors_colname, e_product_colname, stage_colname, gross_net_colname, agg_by_colname, ex_colname, ex_net_colname, ex_gross_colname

See PFUWorkflow::sea_cols.

net_value, gross_value

See PFUWorkflow::gross_net_metadata.

all_value, total_value

See PFUWorkflow::agg_metadata.

Value

A data frame containing aggregate final and useful energy/exergy data by total

Examples

library(Recca)
tfc_total <- Recca::UKEnergy2000mats %>%
               tidyr::pivot_wider(names_from = matrix.name,
                                  values_from = matrix) %>%
               dplyr::mutate(Method = "PCM") %>%
               calculate_fu_ex_total(fd_sectors = c("Residential"))


MatthewHeun/SEAPSUTWorkflow documentation built on April 22, 2022, 2:21 p.m.