Skip to contents

Domestic perspective

Primary and final stage aggregations

Primary stage EROIs can be simply aggregated with the aggregate_primary_stage_erois. The function calculates, for each fossil fuel group (all fossil fuels, coal products, natural gas, oil and gas products, and oil products), the shares of each product in the primary extraction phase (which is why the tidy_AB_dta is passed as argument). Then, EROIs are computed by calculating the weighted average of EROIs. So, for country A, the share of coal in the group “Coal products” will be one, and the aggregated EROI for “Coal products” will be equal to the one of coal.

# Aggregating primary stage EROIs:
aggregated_primary_stage_erois <- aggregate_primary_stage_erois(
    .tidy_erois_df = tidy_AB_erois_dta,
    .tidy_iea_df = tidy_AB_dta,
    eroi_calc_method = "dta"
  ) %>% 
  dplyr::glimpse()
#> Rows: 12
#> Columns: 11
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Product.Group [12]
#> $ Country       <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "…
#> $ Method        <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", …
#> $ Energy.type   <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "…
#> $ Last.stage    <chr> "Final", "Final", "Final", "Final", "Final", "Final", "F…
#> $ Year          <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 20…
#> $ Eroi.method   <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", …
#> $ Type          <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", "N…
#> $ Boundary      <chr> "All", "All", "All", "Feedstock", "Feedstock", "Feedstoc…
#> $ Product.Group <chr> "All fossil fuels", "Coal products", "Oil and gas produc…
#> $ Energy.stage  <chr> "Primary", "Primary", "Primary", "Primary", "Primary", "…
#> $ Group.eroi    <dbl> 40.52669, 91.08310, 33.21149, 42.90249, 100.00000, 34.97…

Likewise, aggregated final stage EROIs are calculated with the aggregate_final_stage_erois. This function calculates, for each fossil fuel group, the shares of each product in the final use of a given country. It does so for the different final energy carriers: electricity, heat, fuel, and all carriers together. Then, aggregated final stage EROIs are calculated according to those shares.

# Aggregating final stage EROIs:
aggregated_final_stage_erois <- aggregate_final_stage_erois(
    .tidy_erois_df = tidy_AB_erois_dta,
    .tidy_iea_df = tidy_AB_dta,
    eroi_calc_method = "dta"
  ) %>% 
  dplyr::glimpse()
#> Rows: 80
#> Columns: 12
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Non_Energy_Uses, Product.Group [40]
#> $ Country         <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…
#> $ Method          <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type     <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",…
#> $ Last.stage      <chr> "Final", "Final", "Final", "Final", "Final", "Final", …
#> $ Year            <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, …
#> $ Eroi.method     <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type            <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", …
#> $ Boundary        <chr> "All", "All", "All", "All", "All", "All", "All", "All"…
#> $ Non_Energy_Uses <chr> "Excluded", "Excluded", "Excluded", "Excluded", "Exclu…
#> $ Product.Group   <chr> "All fossil fuels", "All fossil fuels", "Coal products…
#> $ Energy.stage    <chr> "Final (fuel)", "Final (fuel+elec+heat)", "Final (fuel…
#> $ Group.eroi      <dbl> 8.887669, 8.887669, 5.514706, 5.514706, 31.805135, 31.…

Useful stage aggregations

Aggregating EROIs at the useful stage of energy use requires the analyst to provide the average final-to-useful energy efficiencies with which each energy product is used, in each country. Indeed, the Recca package that we have used to calculate EROIs is used on a data frame describing the Energy Conversion Chain until the final energy stage, so that EROIs can only be calculated for products corresponding to the primary extraction and final energy stages.

Alternatively, the Recca package could also be used to calculate useful stage EROIs, but the matrices used should then describe the Energy Conversion Chain until the useful energy stage, which would require some preliminary work from the analyst anyway. To see an example of how the Physical Supply Use Table and Input-Output matrices can be used to describe an Energy Conversion Chain until the useful energy stage, see Heun, Owen, and Brockway (2018).

Here, we will create an artificial ad-hoc data frame containing made-up final-to-useful efficiencies to demonstrate the package.

# Aggregating final stage EROIs:
# 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))
  ) %>% 
  dplyr::glimpse()
#> Rows: 18
#> Columns: 6
#> $ Country                <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "B…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Product                <chr> "Blast furnace gas", "Coke oven coke", "Coking …
#> $ Average_Efficiency_Col <dbl> 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50,…

The analyst should provide the final-to-useful efficiencies in a format similar to the tidy_FU_efficiencies_dta data frame introduced here. Then, we can calculate the useful stage EROIs at the product level using the push_to_useful_erois as:

# Binding efficiencies to Input-Output EROIs
tidy_useful_erois_dta <- push_to_useful_erois(
    .tidy_io_erois = tidy_AB_erois_dta,
    tidy_FU_efficiencies = tidy_FU_efficiencies_dta,
    eroi_calc_method = "dta"
  ) %>%
  dplyr::glimpse()
#> Rows: 72
#> Columns: 12
#> $ Country                <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Last.stage             <chr> "Final", "Final", "Final", "Final", "Final", "F…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Eroi.method            <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type                   <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "G…
#> $ Boundary               <chr> "All", "All", "All", "All", "All", "All", "All"…
#> $ Product                <chr> "Blast furnace gas", "Coke oven coke", "Coking …
#> $ EROI                   <dbl> 5.185227, 7.239824, 91.083095, 33.935281, 26.36…
#> $ Average_Efficiency_Col <dbl> 0.15, 0.20, 0.25, 0.30, 0.35, 0.40, 0.45, 0.50,…
#> $ Useful_Stage_EROI      <dbl> 0.7777841, 1.4479647, 22.7707738, 10.1805843, 9…
  #dplyr::filter(! is.na(Useful_Stage_EROI))

Finally, we can aggregate useful stage EROIs in a similar way than at the primary and final stages using the aggregate_useful_stage_erois function. The function also uses the final use shares of each product within each fossil fuel group, as for the aggregate_final_stage_erois function.

# Aggregating final stage EROIs:
useful_stage_erois <- aggregate_useful_stage_erois(
  .tidy_erois_df = tidy_useful_erois_dta,
  .tidy_iea_df = tidy_AB_dta,
  eroi_calc_method = "dta"
) %>% 
  dplyr::glimpse()
#> Rows: 80
#> Columns: 12
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Non_Energy_Uses, Product.Group [40]
#> $ Country         <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…
#> $ Method          <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type     <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",…
#> $ Last.stage      <chr> "Final", "Final", "Final", "Final", "Final", "Final", …
#> $ Year            <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, …
#> $ Eroi.method     <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type            <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", …
#> $ Boundary        <chr> "All", "All", "All", "All", "All", "All", "All", "All"…
#> $ Non_Energy_Uses <chr> "Excluded", "Excluded", "Excluded", "Excluded", "Exclu…
#> $ Product.Group   <chr> "All fossil fuels", "All fossil fuels", "Coal products…
#> $ Energy.stage    <chr> "Useful (fuel)", "Useful (fuel+elec+heat)", "Useful (f…
#> $ Group.eroi      <dbl> 2.7410808, 2.7410808, 0.8617539, 0.8617539, 17.4928241…

Multi-regional perspective

Primary and final stage aggregations

To perform the aggregations when using a multi-regional perspective, the tidy data frame describing the Energy Conversion Chain needs to be adapted first, so that the country of location of each flow is added to the country column, and removed from the flow column. This step is important to allow the function to calculate the share of supply (primary stage) and use (final and useful stages) for each country. The prepare_gma_for_shares function is used to this effect.

# Aggregating final stage EROIs:
tidy_AB_data_gma_prepared <- tidy_AB_data_gma %>%
  prepare_gma_for_shares() %>% 
  dplyr::glimpse()
#> Rows: 94
#> Columns: 13
#> $ Country                <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Last.stage             <chr> "Final", "Final", "Final", "Final", "Final", "F…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Ledger.side            <chr> "Supply", "Supply", "Supply", "Supply", "Supply…
#> $ Flow.aggregation.point <chr> "Total primary energy supply", "Total primary e…
#> $ Flow                   <chr> "Resources [of Coking coal]", "Resources [of Cr…
#> $ Product                <chr> "{A}_Coking coal [from Resources]", "{A}_Crude …
#> $ Unit                   <chr> "ktoe", "ktoe", "ktoe", "ktoe", "ktoe", "ktoe",…
#> $ E.dot                  <dbl> 5000, 8500, 4000, 850, 5000, 400, 3200, 200, 85…
#> $ matnames               <chr> "R", "R", "R", "V", "V", "V", "V", "V", "V", "V…
#> $ product_without_origin <chr> "Coking coal [from Resources]", "Crude oil [fro…

Note the difference with the previous data frame (Country and Flow):

# Aggregating final stage EROIs:
dplyr::glimpse(tidy_AB_data_gma)
#> Rows: 94
#> Columns: 12
#> $ Country                <chr> "World", "World", "World", "World", "World", "W…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Last.stage             <chr> "Final", "Final", "Final", "Final", "Final", "F…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Ledger.side            <chr> "Supply", "Supply", "Supply", "Supply", "Supply…
#> $ Flow.aggregation.point <chr> "Total primary energy supply", "Total primary e…
#> $ Flow                   <chr> "{A}_Resources [of Coking coal]", "{A}_Resource…
#> $ Product                <chr> "{A}_Coking coal [from Resources]", "{A}_Crude …
#> $ Unit                   <chr> "ktoe", "ktoe", "ktoe", "ktoe", "ktoe", "ktoe",…
#> $ E.dot                  <dbl> 5000, 8500, 4000, 850, 5000, 400, 3200, 200, 85…
#> $ matnames               <chr> "R", "R", "R", "V", "V", "V", "V", "V", "V", "V…

Then the aggregation is simply conducted as:

# Aggregating final stage EROIs:
aggregated_primary_stage_erois_gma <- aggregate_primary_stage_erois(
    .tidy_erois_df = tidy_AB_erois_gma,
    .tidy_iea_df = tidy_AB_data_gma_prepared,
    eroi_calc_method = "gma"
  ) %>% 
  dplyr::glimpse()
#> Rows: 12
#> Columns: 11
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Product.Group [12]
#> $ Country       <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "…
#> $ Method        <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", …
#> $ Energy.type   <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "…
#> $ Last.stage    <chr> "Final", "Final", "Final", "Final", "Final", "Final", "F…
#> $ Year          <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 20…
#> $ Eroi.method   <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", …
#> $ Type          <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", "N…
#> $ Boundary      <chr> "All", "All", "All", "Feedstock", "Feedstock", "Feedstoc…
#> $ Product.Group <chr> "All fossil fuels", "Coal products", "Oil and gas produc…
#> $ Energy.stage  <chr> "Primary", "Primary", "Primary", "Primary", "Primary", "…
#> $ Group.eroi    <dbl> 40.24781, 88.47164, 33.09035, 42.90249, 100.00000, 34.97…

and likewise, at the final stage, as:

# Aggregating final stage EROIs:
aggregated_final_stage_erois_gma <- aggregate_final_stage_erois(
    .tidy_erois_df = tidy_AB_erois_gma,
    .tidy_iea_df = tidy_AB_data_gma_prepared,
    eroi_calc_method = "gma"
  ) %>% 
  dplyr::glimpse()
#> Rows: 80
#> Columns: 12
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Non_Energy_Uses, Product.Group [40]
#> $ Country         <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…
#> $ Method          <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type     <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",…
#> $ Last.stage      <chr> "Final", "Final", "Final", "Final", "Final", "Final", …
#> $ Year            <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, …
#> $ Eroi.method     <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type            <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", …
#> $ Boundary        <chr> "All", "All", "All", "All", "All", "All", "All", "All"…
#> $ Non_Energy_Uses <chr> "Excluded", "Excluded", "Excluded", "Excluded", "Exclu…
#> $ Product.Group   <chr> "All fossil fuels", "All fossil fuels", "Coal products…
#> $ Energy.stage    <chr> "Final (fuel)", "Final (fuel+elec+heat)", "Final (fuel…
#> $ Group.eroi      <dbl> 7.228293, 7.228293, 2.982800, 2.982800, 31.692055, 31.…

Note that each product is specified by its location of production in the Multi-Regional version of the framework. The implication is that at the final and useful stage, when aggregating EROIs, the use shares of each product are determined for products which are specific by region of production. So the aggregations we conduct at the final and useful stage are based on the consumption mix of a country, not on its production mix (conversely to the primary stage, for which aggregations only make sense based on the production mix).

Useful stage aggregations

As for the demonstration at the domestic level, we build a made-up data frame containing the average final-to-useful efficiencies of each energy product to expand the EROI calculations at the useful stage for each energy product.

# Building a data frame containing average final-to-useful efficiencies for each energy product
length_to_use <- tidy_AB_erois_gma %>%
  dplyr::select(Country, Method, Energy.type, Year, Product) %>%
  dplyr::distinct() %>%
  nrow()

tidy_FU_efficiencies_gma <- tidy_AB_erois_gma %>% 
  dplyr::mutate(
    Country = stringr::str_extract(Product, "\\{.*\\}") %>% 
      stringr::str_remove("\\{") %>% stringr::str_remove("\\}"),
    Product = stringr::str_remove(Product, "\\{.*\\}_")
  ) %>% 
  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))
  ) %>% 
  dplyr::glimpse()
#> Rows: 15
#> Columns: 6
#> $ Country                <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "B…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Product                <chr> "Blast furnace gas", "Coke oven coke", "Coking …
#> $ Average_Efficiency_Col <dbl> 0.1500000, 0.2107143, 0.2714286, 0.3321429, 0.3…

Then, we expand the EROI calculations to the useful stage by applying the final-to-useful efficiencies of each energy product using the push_to_useful_erois function:

# Pushing to tidy useful stage EROIs
tidy_useful_erois_gma <- push_to_useful_erois(
  .tidy_io_erois = tidy_AB_erois_gma,
  tidy_FU_efficiencies = tidy_FU_efficiencies_gma,
  eroi_calc_method = "gma"
) %>% 
  dplyr::glimpse()
#> Rows: 108
#> Columns: 12
#> $ Country                <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A…
#> $ Method                 <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type            <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E…
#> $ Year                   <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018,…
#> $ Average_Efficiency_Col <dbl> 0.1500000, 0.1500000, 0.1500000, 0.1500000, 0.1…
#> $ Last.stage             <chr> "Final", "Final", "Final", "Final", "Final", "F…
#> $ Eroi.method            <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type                   <chr> "Gross", "Gross", "Gross", "Gross", "Net", "Net…
#> $ Boundary               <chr> "All", "All", "Feedstock", "Feedstock", "All", …
#> $ Product                <chr> "{A}_Blast furnace gas", "{B}_Blast furnace gas…
#> $ EROI                   <dbl> 2.9003030, 1.4240609, 3.4010475, 1.6927454, 1.9…
#> $ Useful_Stage_EROI      <dbl> 0.43504546, 0.21360914, 0.51015712, 0.25391181,…

Last, we can aggregate the useful stage EROIs using the aggregate_useful_stage_erois function:

# Calculating aggregated useful stage EROIs:
aggregated_useful_stage_erois <- aggregate_useful_stage_erois(
  .tidy_erois_df = tidy_useful_erois_gma,
  .tidy_iea_df = tidy_AB_data_gma_prepared,
  eroi_calc_method = "gma"
) %>% 
  dplyr::glimpse()
#> Rows: 72
#> Columns: 12
#> Groups: Country, Method, Energy.type, Last.stage, Year, Eroi.method, Type, Boundary, Non_Energy_Uses, Product.Group [36]
#> $ Country         <chr> "A", "A", "A", "A", "A", "A", "A", "A", "A", "A", "A",…
#> $ Method          <chr> "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM", "PCM"…
#> $ Energy.type     <chr> "E", "E", "E", "E", "E", "E", "E", "E", "E", "E", "E",…
#> $ Last.stage      <chr> "Final", "Final", "Final", "Final", "Final", "Final", …
#> $ Year            <dbl> 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, 2018, …
#> $ Eroi.method     <chr> "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA", "DTA"…
#> $ Type            <chr> "Gross", "Gross", "Gross", "Gross", "Gross", "Gross", …
#> $ Boundary        <chr> "All", "All", "All", "All", "All", "All", "All", "All"…
#> $ Non_Energy_Uses <chr> "Excluded", "Excluded", "Excluded", "Excluded", "Exclu…
#> $ Product.Group   <chr> "All fossil fuels", "All fossil fuels", "Coal products…
#> $ Energy.stage    <chr> "Useful (fuel)", "Useful (fuel+elec+heat)", "Useful (f…
#> $ Group.eroi      <dbl> 1.9917385, 1.9917385, 0.4730547, 0.4730547, 20.1470920…

References

Heun, Matthew Kuperus, Anne Owen, and Paul E. Brockway. 2018. “A Physical Supply-Use Table Framework for Energy Analysis on the Energy Conversion Chain.” Applied Energy 226 (September): 1134–62. https://doi.org/10.1016/j.apenergy.2018.05.109.