Skip to contents

This function calculates the useful stage EROIs based on the final stage EROIs and on the average final-to-useful efficiencies provided for each energy product. It also works if the efficiencies are provided by end-use, or by sector - then end-use or sector specific useful stage EROIs are returned.

Usage

push_to_useful_erois(
  .tidy_io_erois,
  tidy_FU_efficiencies,
  country = IEATools::iea_cols$country,
  method = IEATools::iea_cols$method,
  energy_type = IEATools::iea_cols$energy_type,
  year = IEATools::iea_cols$year,
  product = IEATools::iea_cols$product,
  product_without_origin = "product_without_origin",
  average_efficiency = "Average_Efficiency_Col",
  eroi = "EROI",
  useful_stage_eroi = "Useful_Stage_EROI",
  eroi_calc_method = c("dta", "gma")
)

Arguments

.tidy_io_erois

The .tidy_io_erois data frame for which useful stage EROIs need to be calculated.

tidy_FU_efficiencies

A tidy data frame containing the final-to-useful efficiencies to use for the calculation of useful stage EROIs.

country, method, energy_type, year, product

See IEATools::iea_cols.

product_without_origin

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

average_efficiency

The name of the column containing the average final-to-useful efficiency to apply to each energy product. Default is "Average_Efficiency_Col".

eroi

The name of the column containing EROIs. Default is "EROI".

useful_stage_eroi

The name of the column containing the useful stage EROI values. Default is "Useful_Stage_EROI".

eroi_calc_method

The calculation method being used, either DTA if working on single country, or GMA if working with a multi-regional framework. Default is "dta".

Value

The .tidy_io_erois data frame with useful stage EROIs added.

Examples

# Calculating IO matrices
tidy_io_AB_dta <- ECCTools::tidy_AB_data %>%
 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(.data[["Eroi.method"]], .after = Year)
#> Warning: Use of .data in tidyselect expressions was deprecated in tidyselect 1.2.0.
#>  Please use `all_of(var)` (or `any_of(var)`) instead of `.data[[var]]`
# 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_Col = seq(0.15, 1, 0.85/(length_to_use-1))
 )
# Applying the push_to_useful_erois() function:
tidy_useful_erois_dta_with_function <- push_to_useful_erois(
 .tidy_io_erois = tidy_AB_erois_dta,
 tidy_FU_efficiencies = tidy_FU_efficiencies_dta,
 eroi_calc_method = "dta"
)