Skip to contents

This function creates vectors from a filled final-to-useful efficiency table created by write_fu_allocation_template(). The two vectors are:

  • eta_fu: a vector of final-to-useful energy efficiencies, and

  • phi_u: a vector of useful exergy-to-useful energy ratios.

Usage

form_eta_fu_phi_u_vecs(
  .eta_fu_table,
  matrix_class = c("matrix", "Matrix"),
  unit = IEATools::iea_cols$unit,
  year = IEATools::iea_cols$year,
  quantity = IEATools::template_cols$quantity,
  machine = IEATools::template_cols$machine,
  eu_product = IEATools::template_cols$eu_product,
  e_dot_machine = IEATools::template_cols$e_dot_machine,
  e_dot_machine_perc = IEATools::template_cols$e_dot_machine_perc,
  maximum_values = IEATools::template_cols$maximum_values,
  eta_fu = IEATools::template_cols$eta_fu,
  phi_u = IEATools::template_cols$phi_u,
  phi = IEATools::template_cols$phi,
  matnames = IEATools::mat_meta_cols$matnames,
  matvals = IEATools::mat_meta_cols$matvals,
  rownames = IEATools::mat_meta_cols$rownames,
  colnames = IEATools::mat_meta_cols$colnames,
  rowtypes = IEATools::mat_meta_cols$rowtypes,
  coltypes = IEATools::mat_meta_cols$coltypes,
  product = IEATools::row_col_types$product,
  industry = IEATools::row_col_types$industry,
  arrow_note = RCLabels::arrow_notation,
  from_note = RCLabels::from_notation,
  .id = ".id"
)

Arguments

.eta_fu_table

a final-to-useful efficiency table read by load_eta_fu_allocation_data(). A template for this table should have been created by eta_fu_table() and write_eta_fu_table().

matrix_class

The type of matrix to be created, one of "matrix" or "Matrix". Default is "matrix".

unit, year

See IEATools::iea_cols.

quantity, machine, eu_product, e_dot_machine, e_dot_machine_perc, maximum_values, eta_fu, phi_u, phi

See IEATools::template_cols.

matnames, matvals, rownames, colnames, rowtypes, coltypes

See IEATools::mat_meta_cols.

product, industry

See IEATools::row_col_types.

arrow_note, from_note

Notation vectors used for creating the eta_fu and phi vectors. See matsbyname::notation_vec(). Defaults are RCLabels::arrow_notation and ``RCLabels::from_notation`, respectively.

.id

The name of an identification column used internally. Default is ".id".

Value

a wide-by-matrices data frame with metadata columns (and year) along with columns for eta_fu and phi_u vectors.

Details

The vectors eta_fu and phi_u have special rownames that indicate sources and types of useful energy flows. Row names in the eta_fu vector have the pattern "industry -> product" to indicate the energy efficiency of "industry" for making "product" or the exergy-to-energy ratio of the useful energy form created by a final-to-useful machine. Row names in the phi_u vector are named by energy product only.

Each energy product should have the same phi, regardless of machine that produced it. So this function checks whether each combination of metadata produces the same phi values. If any different phi values are found, an error is produced.

Columns in the outgoing data frame are named by the variable in the vector: eta_fu for final-to-useful efficiencies and phi_u for useful exergy-to-useful energy ratios.

Examples

load_eta_fu_data() %>% 
  form_eta_fu_phi_u_vecs()
#> # A tibble: 4 × 7
#>   Country Method Energy.type Last.stage  Year eta.fu         phi.u        
#>   <chr>   <chr>  <chr>       <chr>      <dbl> <list>         <list>       
#> 1 GHA     PCM    E           Final       1971 <dbl [22 × 1]> <dbl [6 × 1]>
#> 2 GHA     PCM    E           Final       2000 <dbl [21 × 1]> <dbl [6 × 1]>
#> 3 ZAF     PCM    E           Final       1971 <dbl [31 × 1]> <dbl [7 × 1]>
#> 4 ZAF     PCM    E           Final       2000 <dbl [43 × 1]> <dbl [7 × 1]>