Following a Product Through an Energy Conversion Chain
following_a_product.Rmd
Introduction
It can be helpful to follow a product through the energy conversion chain (ECC) in the CL-PFU database to trace its production and consumption. Doing so enables comparison to raw data to enhance understanding of the way the PSUT framework represents IEA data.
To provide an example, this vignette follows one product (Naphtha) through the USA in 2013 and 2014. Comparison between the two years demonstrates an interesting feature of the CL-PFU database.
Evaluate a single year
To work with the CL-PFU database in the vignette, be sure you have access to several packages.
The matsbyname
package is especially useful for
isolating a particular product in an energy conversion chain.
To load data for 2013 and 2014 from the CL-PFU Database, one can use the following code:
pinboard <- pins::board_folder("~/Dropbox/Fellowship 1960-2015 PFU database/OutputData/PipelineReleases")
df <- pinboard %>%
# Load USA data from v0.9 of the database
pins::pin_read(name = "psut_usa", version = "20230220T223535Z-35e3e") %>%
# Isolate data of interest
dplyr::filter(Year %in% c(2013, 2014),
Energy.type == "E",
Last.stage == "Final",
IEAMW == "IEA")
dplyr::glimpse(df)
#> Rows: 2
#> Columns: 14
#> $ Country <chr> "USA", "USA"
#> $ Method <chr> "PCM", "PCM"
#> $ Energy.type <chr> "E", "E"
#> $ Last.stage <chr> "Final", "Final"
#> $ Year <dbl> 2013, 2014
#> $ IEAMW <chr> "IEA", "IEA"
#> $ Y <list> <<matrix[41 x 64]>>, <<matrix[42 x 77]>>
#> $ S_units <list> <<matrix[70 x 1]>>, <<matrix[70 x 1]>>
#> $ R <list> <<matrix[73 x 58]>>, <<matrix[62 x 54]>>
#> $ U <list> <<matrix[64 x 26]>>, <<matrix[66 x 26]>>
#> $ U_feed <list> <<matrix[59 x 26]>>, <<matrix[58 x 26]>>
#> $ U_EIOU <list> <<matrix[18 x 8]>>, <<matrix[21 x 8]>>
#> $ r_EIOU <list> <<matrix[64 x 26]>>, <<matrix[66 x 26]>>
#> $ V <list> <<matrix[27 x 46]>>, <<matrix[27 x 47]>>
Interrogate PSUT matrices
Next, we interrogate the PSUT matrices (R, Y, V, and Y) for Naphtha. (Note that row 1 contains 2013 data and row 2 contains 2014 data.) Along the way, we will compare to the original IEA World Extended Energy Balance (WEEB) data. We begin with 2013 data.
The R matrix contains exogenous inputs of Naphtha to the ECC. In 2013, there are both “Imports” and releases from stock (“Stock changes”) of Naphtha.
R_supply_2013 <- df$R[[1]] %>%
matsbyname::select_rows_byname("Naphtha") %>%
matsbyname::clean_byname()
R_supply_2013
#> Naphtha
#> Imports [of Naphtha] 1392
#> Stock changes [of Naphtha] 34
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
The IEA data show the same information.
However, there is no use (U) of Naphtha by the energy industry in 2013.
U_consumption_2013 <- df$U[[1]] %>%
matsbyname::select_rows_byname("Naphtha") %>%
matsbyname::clean_byname()
U_consumption_2013
#> NULL
The IEA EWEB data show the same.
(1 ktoe of Naphtha is used in 2014, as we will see later.)
Oil refineries make (V) Naphtha.
V_supply_2013 <- df$V[[1]] %>%
matsbyname::select_cols_byname("Naphtha") %>%
matsbyname::clean_byname()
V_supply_2013
#> Naphtha
#> Oil refineries 11007
#> attr(,"rowtype")
#> [1] "Industry"
#> attr(,"coltype")
#> [1] "Product"
The product of Naphtha found in the V matrix comes from the “Oil refineries” row in the IEA’s EWEB data.
Naphtha is consumed in final demand (Y) for Non-energy use industry/transformation/energy.
Y_consumption_2013 <- df$Y[[1]] %>%
matsbyname::select_rows_byname("Naphtha") %>%
matsbyname::clean_byname()
Y_consumption_2013
#> Non-energy use industry/transformation/energy
#> Naphtha 12433
#> attr(,"rowtype")
#> [1] "Product"
#> attr(,"coltype")
#> [1] "Industry"
Again, the consumption of Naphtha for non-energy uses is evident in the IEA’s EWEB data.
Verify overall energy balance
We can see that Naphtha is balanced, as expected, for 2013. In fact, energy balance is verified for all products in the CL-PFU database at the time of construction. Small corrections are made, if necessary (< 5 ktoe) and placed in the “Statistical differences” category. Thus, energy balance is guaranteed for every energy carrier in the CL-PFU database.
supply_2013 <- matsbyname::sumall_byname(R_supply_2013) +
as.numeric(V_supply_2013)
supply_2013
#> [1] 12433
consumption_2013 <- as.numeric(Y_consumption_2013)
consumption_2013
#> [1] 12433
# This difference should be exactly 0, and it is.
supply_2013 - consumption_2013
#> [1] 0
Compare across years
The data for 2013 have an interesting feature: the U matrix is empty of Naphtha, because no Naphtha is used by transformation processes. However, in 2014, the energy industry used 1 ktoe of Naphtha.
# Row 2 contains data for 2014.
df$U[[2]] %>%
matsbyname::select_rows_byname("Naphtha") %>%
matsbyname::clean_byname()
#> Oil refineries
#> Naphtha 1
#> attr(,"rowtype")
#> [1] "Product"
#> attr(,"coltype")
#> [1] "Industry"
The CL-PFU database contains three U matrices (U itself, U_feed, and U_EIOU) and a related matrix (r_EIOU). We can use U_feed and U_EIOU to learn the purpose of the 1 ktoe of Naphtha consumption by the energy industry in 2014.
df$U_feed[[2]] |>
matsbyname::select_rows_byname("Naphtha") |>
matsbyname::clean_byname()
#> NULL
df$U_EIOU[[2]] |>
matsbyname::select_rows_byname("Naphtha") |>
matsbyname::clean_byname()
#> Oil refineries
#> Naphtha 1
#> attr(,"rowtype")
#> [1] "Product"
#> attr(,"coltype")
#> [1] "Industry"
So we see that the use of Naphtha by the energy industry is self-consumption by Oil refineries.
Incidentally, it is always true that U = U_feed + U_eiou. The U_feed and U_EIOU matrices give the split between feedstocks and Energy industry own use. The matrix r_EIOU gives the element-wise ratio between U_EIOU and U.
Conclusion
Through judicious use of functions in matsbyname
and
other packages, analysts can isolate a single energy carrier and follow
its Imports, Stock changes, use, production, and final demand through
the CL-PFU database.
Following a single energy carrier through the PFU Database and comparing to raw IEA data can lead to better understanding of how IEA data are mapped into PSUT matrices.