Skip to contents

The function extracts product level EROIs from tidy Input Output matrices, in a tidy format.

Usage

extract_tidy_product_erois(
  .tidy_io_mats,
  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,
  matnames = IEATools::mat_meta_cols$matnames,
  matvals = IEATools::mat_meta_cols$matvals,
  eroi_g_p = "eroi_g_p",
  eroi_n_p = "eroi_n_p",
  eroi_g_p_feed = "eroi_g_p_feed",
  eroi_n_p_feed = "eroi_n_p_feed",
  type = "Type",
  boundary = "Boundary",
  eroi = "EROI",
  product = IEATools::iea_cols$product,
  colnames = "colnames",
  rowtypes = "rowtypes",
  coltypes = "coltypes"
)

Arguments

.tidy_io_mats

The .tidy_io_mats data frame from which EROIs should be extracted.

country, method, energy_type, last_stage, year, product

See IEATools::iea_cols.

matnames

The column name of the column having matrices names. Default is IEATools::mat_meta_cols$matnames.

matvals

The column name of the column reporting matrices values, once expanded. Default is IEATools::mat_meta_cols$matvals.

eroi_g_p

The name of the column containing vectors of product-level gross EROIs, including both energy use for feedstock and EIOU production. Default is "eroi_g_p".

eroi_n_p

The name of the column containing vectors of product-level net EROIs, including both energy use for feedstock and EIOU production. Default is "eroi_n_p".

eroi_g_p_feed

The name of the column containing vectors of product-level gross EROIs, including only energy use for feedstock production. Default is "eroi_g_p_feed".

eroi_n_p_feed

The name of the column containing vectors of product-level net EROIs, including only energy use for feedstock production. Default is "eroi_g_p_feed".

type

The name of the EROI type column (i.e. gross or net EROI). Default is "Type".

boundary

The name of the boundary column. Default is "Boundary".

eroi

The name of the product EROI column in output. Default is "EROI".

colnames

The name of columns when expanding matrices. Default is "colnames".

rowtypes

The name of row types when expanding matrices. Default is "rowtypes".

coltypes

The name of column types when expanding matrices. Default is "coltypes".

Value

A data frame reporting calculated EROIs in a tidy format.

Details

The function can be called after calculating EROIs through the Recca::calc_erois() function. The type column indicates whether the calculated EROI is gross or net. The boundary column indicates whether the EROI includes:

  • Only energy use for feedstock production ("Feedstock");

  • Both energy use for feedstock production and for EIOU production ("All").

Examples

# Let's first have a look at the raw data obtained when calculating EROIs:
calculated_erois_raw <- ECCTools::tidy_AB_data %>%
 IEATools::prep_psut() %>%
 Recca::calc_io_mats() %>%
 Recca::calc_E_EIOU() %>%
 Recca::calc_erois() %>%
 dplyr::glimpse()
#> Rows: 2
#> Columns: 39
#> $ Country       <chr> "A", "B"
#> $ Method        <chr> "PCM", "PCM"
#> $ Energy.type   <chr> "E", "E"
#> $ Last.stage    <chr> "Final", "Final"
#> $ Year          <dbl> 2018, 2018
#> $ Y             <list> <<matrix[9 x 6]>>, <<matrix[7 x 4]>>
#> $ S_units       <list> <<matrix[12 x 1]>>, <<matrix[9 x 1]>>
#> $ R             <list> <<matrix[4 x 4]>>, <<matrix[3 x 3]>>
#> $ U             <list> <<matrix[11 x 7]>>, <<matrix[8 x 4]>>
#> $ U_feed        <list> <<matrix[9 x 7]>>, <<matrix[5 x 4]>>
#> $ U_EIOU        <list> <<matrix[5 x 7]>>, <<matrix[5 x 4]>>
#> $ r_EIOU        <list> <<matrix[11 x 7]>>, <<matrix[8 x 4]>>
#> $ V             <list> <<matrix[7 x 9]>>, <<matrix[4 x 6]>>
#> $ y             <list> <<matrix[9 x 1]>>, <<matrix[7 x 1]>>
#> $ q             <list> <<matrix[12 x 1]>>, <<matrix[9 x 1]>>
#> $ f             <list> <<matrix[7 x 1]>>, <<matrix[4 x 1]>>
#> $ g             <list> <<matrix[7 x 1]>>, <<matrix[4 x 1]>>
#> $ h             <list> <<matrix[4 x 1]>>, <<matrix[3 x 1]>>
#> $ r             <list> <<matrix[4 x 1]>>, <<matrix[3 x 1]>>
#> $ W             <list> <<matrix[12 x 7]>>, <<matrix[9 x 4]>>
#> $ Z             <list> <<matrix[11 x 7]>>, <<matrix[8 x 4]>>
#> $ K             <list> <<matrix[11 x 7]>>, <<matrix[8 x 4]>>
#> $ C             <list> <<matrix[9 x 7]>>, <<matrix[6 x 4]>>
#> $ D             <list> <<matrix[7 x 12]>>, <<matrix[4 x 9]>>
#> $ A             <list> <<matrix[11 x 12]>>, <<matrix[8 x 9]>>
#> $ O             <list> <<matrix[4 x 4]>>, <<matrix[3 x 3]>>
#> $ L_pxp         <list> <<matrix[12 x 12]>>, <<matrix[9 x 9]>>
#> $ L_ixp         <list> <<matrix[7 x 12]>>, <<matrix[4 x 9]>>
#> $ Z_feed        <list> <<matrix[9 x 7]>>, <<matrix[5 x 4]>>
#> $ K_feed        <list> <<matrix[9 x 7]>>, <<matrix[5 x 4]>>
#> $ A_feed        <list> <<matrix[9 x 12]>>, <<matrix[5 x 9]>>
#> $ L_pxp_feed    <list> <<matrix[12 x 12]>>, <<matrix[9 x 9]>>
#> $ L_ixp_feed    <list> <<matrix[7 x 12]>>, <<matrix[4 x 9]>>
#> $ E_EIOU        <list> <<matrix[5 x 7]>>, <<matrix[5 x 4]>>
#> $ e_EIOU        <list> <<matrix[7 x 1]>>, <<matrix[4 x 1]>>
#> $ eroi_g_p      <list> <<matrix[12 x 1]>>, <<matrix[9 x 1]>>
#> $ eroi_g_i      <list> <<matrix[7 x 1]>>, <<matrix[4 x 1]>>
#> $ eroi_g_p_feed <list> <<matrix[12 x 1]>>, <<matrix[9 x 1]>>
#> $ eroi_g_i_feed <list> <<matrix[7 x 1]>>, <<matrix[4 x 1]>>
# Let's then extract EROIs in a tidy format:
calculated_erois_raw %>%
 extract_tidy_product_erois() %>%
 print()
#> # A tibble: 36 × 9
#>    Country Method Energy.type Last.stage  Year Type  Boundary  Product      EROI
#>    <chr>   <chr>  <chr>       <chr>      <dbl> <chr> <chr>     <chr>       <dbl>
#>  1 A       PCM    E           Final       2018 Gross All       Blast furn…  8.95
#>  2 A       PCM    E           Final       2018 Gross All       Coke oven … 19.3 
#>  3 A       PCM    E           Final       2018 Gross All       Coking coal 92.5 
#>  4 A       PCM    E           Final       2018 Gross All       Crude oil   34.0 
#>  5 A       PCM    E           Final       2018 Gross All       Electricity 28.3 
#>  6 A       PCM    E           Final       2018 Gross All       Heat        19.9 
#>  7 A       PCM    E           Final       2018 Gross All       Kerosene t…  9.07
#>  8 A       PCM    E           Final       2018 Gross All       Motor gaso…  9.07
#>  9 A       PCM    E           Final       2018 Gross All       Natural gas 31.9 
#> 10 A       PCM    E           Final       2018 Gross Feedstock Blast furn…  9.57
#> # ℹ 26 more rows