Skip to contents

The function calculates the aggregated useful stage EROIs for each fossil fuel group. It determines the shares of uses of each energy product within each fossil fuel group (by default using the Y and U_eiou matrices), and from these shares determines the average useful stage EROI by fossil fuel group.

Usage

aggregate_useful_stage_erois(
  .tidy_erois_df,
  .tidy_iea_df,
  include_non_energy_uses = FALSE,
  final_use_mats = c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou),
  list_oil_products = IEATools::oil_and_oil_products,
  list_coal_products = IEATools::coal_and_coal_products,
  list_gas_products = IEATools::primary_gas_products,
  product.group = "Product.Group",
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  last_stage = IEATools::iea_cols$last_stage,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  non_energy_uses = "Non_Energy_Uses",
  eroi.method = "Eroi.method",
  type = "Type",
  boundary = "Boundary",
  share = "Share",
  useful_stage_eroi = "Useful_Stage_EROI",
  group.eroi = "Group.eroi",
  energy.stage = "Energy.stage",
  product_without_origin = "product_without_origin",
  Group.eroi.inversed = "Group.eroi.inversed",
  eroi_calc_method = c("dta", "gma")
)

Arguments

.tidy_erois_df

The tidy erois data frame for which the aggregation needs to be done.

.tidy_iea_df

The tidy_iea_df from which the input-output erois have been calculated.

include_non_energy_uses

A boolean indicating whether the calculation of use shares includes non-energy uses. Default is FALSE.

final_use_mats

The list of matrices to be used for calculating the use shares by energy product. Default is c(IEATools::psut_cols$Y, IEATools::psut_cols$U_eiou).

list_oil_products

The list of oil products to be used when calculating the use shares. Default is IEATools::oil_and_oil_products.

list_coal_products

The list of coal products to be used when calculating the use shares. Default is IEATools::coal_and_coal_products.

list_gas_products

The list of gas products to be used when calculating the use shares. Default is IEATools::primary_gas_products.

product.group

The name of the column containing the product group name. Default is "Product.Group".

country, method, energy_type, last_stage, year, product

See IEATools::iea_cols.

non_energy_uses

The name of the column stating whether non-energy uses are included in the calculation of use shares. Default is "Non_Energy_Uses".

eroi.method

The name of the column containing the method used for calculating the erois. Default is "Eroi.method".

type

The name of the column containing the type of eroi calculated. Default is "Type".

boundary

The name of the column containing the boundary for the eroi calculation. Default is "Boundary".

share

The name of the column containing the share of each energy product supply within each fossil fuel group. Default is "Share".

useful_stage_eroi

The name of the column containing the useful stage EROIs for each energy product.

group.eroi

The name of the column containing the fossil fuel group level eroi value. Default is "Group.eroi".

energy.stage

The name of the column containing the energy stage for the calculation of the EROI. Default is "Energy.stage".

product_without_origin

The name of the column containing the product name excluding the origin of the product. Default is "product_without_origin".

Group.eroi.inversed

Name of the temporary column that computes the inverse of the EROI.

eroi_calc_method

The method being used for calculating the erois. Default is "dta".

Value

A tidy data frame containing the aggregated useful stage EROIs by fossil fuel group.

Details

The function can work both on a single country Energy Conversion Chain of Domestic Technology Assumption type, or with a multi-regional Energy Conversion Chain for instance using the Global Market Assumption. The input data frame will have to be slightly adapted in this case (for an example see the tests related to the function)

Examples

tidy_AB_dta <- ECCTools::tidy_AB_data %>%
IEATools::add_psut_matnames() %>% 
ECCTools::transform_to_dta()
# Calculating IO matrices
tidy_io_AB_dta <- tidy_AB_dta %>%
 IEATools::prep_psut() %>%
 Recca::calc_io_mats(method_q_calculation = "sum_R_V_cols")
# Calculating tidy IO EROIs
tidy_AB_erois_dta <- tidy_io_AB_dta %>%
 Recca::calc_E_EIOU() %>%
 Recca::calc_erois() %>%
 EROITools::extract_tidy_product_erois() %>%
 dplyr::mutate(
   Eroi.method = "DTA"
 ) %>%
 dplyr::relocate(tidyselect::all_of("Eroi.method"), .after = tidyselect::all_of("Year"))
# Pushing to tidy useful stage EROIs
length_to_use <- tidy_AB_erois_dta %>% 
 dplyr::select(Country, Method, Energy.type, Year, Product) %>% 
 dplyr::distinct() %>% 
 nrow()
tidy_FU_efficiencies_dta <- tidy_AB_erois_dta %>% 
 dplyr::select(Country, Method, Energy.type, Year, Product) %>% 
 dplyr::distinct() %>% 
 dplyr::mutate(
   Average_Efficiency_Global = seq(0.15, 1, 0.85/(length_to_use-1))
 )
tidy_useful_erois_dta <- tidy_AB_erois_dta %>% 
 dplyr::left_join(tidy_FU_efficiencies_dta,
                  by = c("Country", "Method", "Energy.type", "Year", "Product")) %>%
 dplyr::mutate(
   Useful_Stage_EROI = Average_Efficiency_Global * EROI
 ) %>% 
 dplyr::filter(! is.na(Useful_Stage_EROI))
# Calculating aggregated EROIs:
res_dta <- aggregate_useful_stage_erois(
 .tidy_erois_df = tidy_useful_erois_dta,
 .tidy_iea_df = tidy_AB_dta,
 eroi_calc_method = "dta"
)